CLI Tool Setup Guides
Step-by-step instructions to connect your favorite coding tools to KRouter. All tools use the same base URL and API key.
https://krouter.net/v1Claude Code
Managed configInstall Claude Code CLI, then point `ANTHROPIC_BASE_URL` to KRouter and set model aliases in `~/.claude/settings.json`.
~/.claude/settings.jsonchecklistSetup Steps
Install Claude Code and run `claude` once to verify the CLI is available.
Set `ANTHROPIC_BASE_URL` to `https://KRouter.net/v1` and `ANTHROPIC_AUTH_TOKEN` to your KRouter API key.
Optionally map the default opus, sonnet, and haiku model variables to your chosen KRouter model paths.
{
"env": {
"ANTHROPIC_BASE_URL": "https://KRouter.net/v1",
"ANTHROPIC_AUTH_TOKEN": "YOUR_KROUTER_API_KEY",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "provider/model-id"
}
}npm install -g @anthropic-ai/claude-codeOpenAI Codex CLI
Managed configCodex uses a provider block in `~/.codex/config.toml` plus an API key in `~/.codex/auth.json`.
~/.codex/config.toml + ~/.codex/auth.jsonchecklistSetup Steps
Install Codex CLI and verify with `codex`.
Set `base_url` to `https://KRouter.net/v1` inside the `model_providers.krouter` block and keep `wire_api = "responses"`.
Store `OPENAI_API_KEY` in `~/.codex/auth.json`, then set your main model and optional subagent model.
model = "provider/model-id" model_provider = "krouter" [model_providers.krouter] name = "KRouter" base_url = "https://KRouter.net/v1" wire_api = "responses" [agents.subagent] model = "provider/model-id"
npm install -g @openai/codexOpenCode
Managed configOpenCode stores provider and model configuration in `~/.config/opencode/opencode.json`.
~/.config/opencode/opencode.jsonchecklistSetup Steps
Install OpenCode and verify the CLI is available.
Create a provider named `krouter` that uses the OpenAI-compatible SDK with `baseURL = https://KRouter.net/v1`.
Attach your KRouter API key, register one or more models, and optionally set a subagent explorer model.
{
"provider": {
"krouter": {
"npm": "@ai-sdk/openai-compatible",
"options": {
"baseURL": "https://KRouter.net/v1",
"apiKey": "YOUR_KROUTER_API_KEY"
}
}
},
"model": "krouter/provider/model-id"
}npm install -g opencode-aiOpen Claw
Managed configOpen Claw uses `~/.openclaw/openclaw.json` and can map a default model plus per-agent overrides.
~/.openclaw/openclaw.jsonchecklistSetup Steps
Define provider `krouter` with `baseUrl = https://KRouter.net/v1` and your KRouter API key.
Set the default agent model to `krouter/provider/model-id`.
If needed, override individual agent models for specific workflows.
{
"agents": {
"defaults": {
"model": {
"primary": "krouter/provider/model-id"
}
}
},
"models": {
"providers": {
"krouter": {
"baseUrl": "https://KRouter.net/v1",
"apiKey": "YOUR_KROUTER_API_KEY"
}
}
}
}Factory Droid
Managed configFactory Droid writes a custom model entry in `~/.factory/settings.json` or `%USERPROFILE%\\.factory\\settings.json`.
~/.factory/settings.jsonchecklistSetup Steps
Add a custom model entry whose `baseUrl` is `https://KRouter.net/v1`.
Use your KRouter API key in the `apiKey` field.
Set the model field to the routed model path you want the tool to call.
{
"customModels": [
{
"model": "provider/model-id",
"id": "custom:KRouter-0",
"baseUrl": "https://KRouter.net/v1",
"apiKey": "YOUR_KROUTER_API_KEY",
"provider": "openai"
}
]
}Cursor
Guide-based setupCursor uses the custom OpenAI API flow and expects an externally reachable endpoint.
Cursor Settings > ModelschecklistSetup Steps
Open Cursor Settings and go to Models.
Enable the OpenAI API key option, then set Base URL to `https://KRouter.net/v1`.
Paste your KRouter API key and add a custom model path.
The current setup flow marks Cursor as requiring an external URL rather than localhost.
Cline / Kilo Code / Roo
OpenAI-compatible guideThese tools mainly need provider selection, base URL, API key, and a model path.
Tool settings panelchecklistSetup Steps
Open each tool's settings panel.
Choose an OpenAI-compatible provider. Roo follows the Ollama-style path in the original guide.
Set Base URL to `https://KRouter.net/v1` for Cline and Kilo, or `https://KRouter.net` for Roo if the client expects the raw host.
Paste the API key and select your routed model path.
Continue
Config fileContinue expects an OpenAI provider model object in its configuration file.
Continue config filechecklistSetup Steps
Open the Continue configuration file.
Add an OpenAI model object whose `apiBase` points to `https://KRouter.net/v1`.
Fill in the KRouter API key and the model path you want to route.
{
"apiBase": "https://KRouter.net/v1",
"title": "provider/model-id",
"model": "provider/model-id",
"provider": "openai",
"apiKey": "YOUR_KROUTER_API_KEY"
}Antigravity / Copilot / Kiro
MITM flowThese tools do not follow the normal custom-provider path. The current product routes them through MITM-oriented setup inside the dashboard.
Dashboard > CLI Tools > MITMchecklistSetup Steps
Open the MITM tools section and start the MITM service with the required system permissions.
Accept certificate and DNS/network changes required by the tool-specific flow.
Select a KRouter API key and map each exposed alias to the upstream model route you want.
This mirrors the intent of the current CLI Tools tab, where MITM tools link to a separate flow instead of using the same generic setup card.