# nexgenk

NexgenK CLI is a terminal AI coding agent wired to **NexgenRouter**.

## Install

Requires Node.js 22.19.0 or later.

```sh
npm install -g nexgenk
```

Or with pnpm:

```sh
pnpm add -g nexgenk
```

## Configure

NexgenK authenticates with a NexgenRouter API key:

```sh
export NEXGEN_API_KEY="<your key>"
# optional, defaults to https://ia.nexgen.systems/v1
export NEXGEN_BASE_URL="https://ia.nexgen.systems/v1"
```

Validate the key and provision the model catalog:

```sh
nexgenk login                       # reads NEXGEN_API_KEY
nexgenk login --api-key <your key>  # or pass it explicitly
```

This reads `GET /v1/models`, writes `~/.nexgenk/config.toml`, and selects `nexgen-auto` as the default model.

## Quick start

```sh
cd your-project
nexgenk -p "Summarize this repository"
nexgenk            # interactive terminal UI
```

## What it talks to

| Capability | Endpoint |
|---|---|
| Chat (OpenAI, Responses, Anthropic) | `POST /v1/chat/completions`, `/v1/responses`, `/v1/messages` |
| Model catalog | `GET /v1/models` |
| Web search | `POST /v1/tools/search` |
| URL fetch | `POST /v1/tools/fetch` |
| Server tools | `openrouter:*` declared in `tools[]` |

Authentication uses `Authorization: Bearer <key>` (and `x-api-key` on the Anthropic wire).

## Features

- Terminal UI, headless `-p` mode, ACP server, and a local REST/WS API (`nexgenk web`).
- Sessions persisted under `~/.nexgenk/sessions`, with `wire.jsonl` as the source of truth.
- Permissions and approvals with `manual`, `yolo`, and `auto` modes.
- Agent Skills, MCP servers, subagents, goals, cron tasks, and Swarm fan-out.
- Provider/model configuration for any OpenAI-, Anthropic-, or Gemini-compatible endpoint.

## Not included in this build

- Remote Control (requires a relay service).
- CDN-based auto-update; upgrade with `npm install -g nexgenk@latest`.
- The bundled browser UI; `nexgenk web` serves the API plus a minimal landing page.
- Device-flow OAuth; `nexgenk login` validates an API key and writes the provider entry.

## License

MIT. See `LICENSE` and `NOTICE` for the upstream attribution.
