Tool integrations
Every guide below uses the same three ingredients: a base URL, an API key from Keys, and a bare model ID from Models. Pick your tool, or use the base-URL rule to connect anything OpenAI-compatible.
Base URLs & keys
https://korouter.aiOne endpoint serves every tool. The samples below keep whichever form each tool's own docs use — the gateway accepts both. Everything else is pasting a key and a model ID.
| Client family | Base URL | Used by |
|---|---|---|
| OpenAI-compatible | https://korouter.ai/v1 | Cursor, Cline, Aider, Continue, Open WebUI, Vercel AI SDK, Codex, and every OpenAI SDK. |
| Anthropic-native | https://korouter.ai | Claude Code and Anthropic SDKs, which add their own request path. |
The full API key is shown once at creation. Calls need a positive credit balance — without one, requests return 403 with the code INSUFFICIENT_BALANCE, including the verification requests tools send during setup.
A tool that is not listed here still works if it lets you set an OpenAI-compatible base URL and key. Point it at https://korouter.ai/v1 and use a bare model ID.
Claude Code
Agentic coding CLI · Messages API
Add the block below to ~/.claude/settings.json (Windows: %USERPROFILE%\.claude\settings.json). The same keys also work as environment variables.
{
"env": {
"ANTHROPIC_BASE_URL": "https://korouter.ai",
"ANTHROPIC_AUTH_TOKEN": "sk-your-key",
"ANTHROPIC_MODEL": "claude-fable-5",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
"CLAUDE_CODE_ATTRIBUTION_HEADER": "0"
}
}claude -p "Reply with OK"If it fails
- 401 — the key belongs in
ANTHROPIC_AUTH_TOKEN, notANTHROPIC_API_KEY. - model errors —
ANTHROPIC_MODELtakes a bare ID from Models, e.g.claude-fable-5.
Codex CLI
Agentic coding CLI · Responses API
Codex reads a provider from ~/.codex/config.toml and the key from ~/.codex/auth.json (Windows: %USERPROFILE%\.codex\).
model = "gpt-5.6-sol"
model_provider = "korouter"
model_reasoning_effort = "high"
[model_providers.korouter]
name = "KoRouter"
base_url = "https://korouter.ai/v1"
wire_api = "responses"{ "OPENAI_API_KEY": "sk-your-key" }codex exec "Reply with OK"If it fails
- requests never arrive —
wire_apimust be"responses"— KoRouter serves Codex through the Responses API. - 401 — the key lives in
auth.json, not inconfig.toml. - 400 on reasoning —
model_reasoning_effortis optional (low / medium / high / xhigh); remove it if the selected model rejects it.
Cursor
AI code editor · Chat Completions
- 1. Open Cursor Settings → Models → API Keys.
- 2. Paste your key into OpenAI API Key, enable Override OpenAI Base URL, and set it to
https://korouter.ai/v1. - 3. Click Verify, then use Add model to register each bare model ID you want, e.g.
claude-fable-5.
Verify
Select the added model in chat and send a message. The call appears on Usage with its token breakdown and charge.
If it fails
- Verify fails with 403 (INSUFFICIENT_BALANCE) — verification sends a real request, so the account needs credits first.
- Tab autocomplete unchanged — the override covers chat and agent modes; Cursor Tab keeps using Cursor's own models.
- model not found — the custom model name must match the bare ID exactly; disable built-in models you do not route through the key.
Cline
VS Code agent extension · Chat Completions
- 1. In the Cline panel, open Settings → API Configuration.
- 2. Set API Provider to OpenAI Compatible, Base URL to
https://korouter.ai/v1, paste the key, and enter a bare model ID. - 3. Save and start a task.
Verify
Give it a short task such as "reply with OK". The request shows up on Usage; streaming works without further configuration.
If it fails
- no base-URL field — choose OpenAI Compatible, not OpenAI — only the compatible provider exposes one.
- output truncates early — set the model's context window in Cline's advanced model settings to the value shown on the model card.
Aider
Terminal pair programmer · Chat Completions
Aider talks to models through LiteLLM, so KoRouter connects as a generic OpenAI-compatible endpoint: export the two variables and prefix the model with openai/.
export OPENAI_API_BASE="https://korouter.ai/v1"
export OPENAI_API_KEY="sk-your-key"
aider --model openai/model-nameVerify
Aider prints the connected model and endpoint on startup. Ask it anything, then check Usage for the call.
If it fails
- wrong-looking model name — the
openai/prefix is local routing for LiteLLM; the request body carries the bare ID after the slash. - unknown-model cost warnings — cosmetic — aider does not know custom catalogs. Silence them with
--no-show-model-warnings. - 401 despite a correct key — export the variables in the same shell that launches aider, or add them to your shell profile.
Continue
VS Code / JetBrains assistant · Chat Completions
Add a model entry to ~/.continue/config.yaml using the generic openai provider with apiBase.
models:
- name: KoRouter model-name
provider: openai
model: model-name
apiBase: https://korouter.ai/v1
apiKey: sk-your-key
roles:
- chat
- editVerify
Reload the editor, pick the entry in Continue's model selector, and send a chat message. The call lands on Usage.
If it fails
- requests go to api.openai.com — the entry must set
apiBase; without it, the openai provider uses the default endpoint. - older install — legacy versions read
config.json— the field names (apiBase,apiKey) are the same. - no autocomplete — autocomplete is a separate role; add a dedicated model entry for it rather than reusing the chat entry.
Open WebUI
Self-hosted chat UI · Chat Completions
- 1. Open Admin Panel → Settings → Connections.
- 2. Under OpenAI API, add
https://korouter.ai/v1with your key. - 3. Save. Open WebUI loads the model list from
GET /v1/modelsinto the picker.
Verify
The model selector lists KoRouter model IDs. Send a message and confirm the call on Usage.
If it fails
- empty model picker — re-verify the connection — a mistyped URL or key keeps the list empty. The model list itself works even at zero balance.
- too many models — use the connection's model filter to expose only the IDs your members should see.
- surprise spend — every chat message is a normal billed API call; the key's spend limit still applies.
Vercel AI SDK
TypeScript framework · Chat Completions
Use the OpenAI-compatible provider package and point it at KoRouter. The same provider instance works with generateText, streamText, and the rest of the SDK.
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { generateText } from "ai";
const korouter = createOpenAICompatible({
name: "korouter",
baseURL: "https://korouter.ai/v1",
apiKey: process.env.KOROUTER_API_KEY,
});
const { text } = await generateText({
model: korouter("model-name"),
prompt: "Hello",
});
console.log(text);Verify
Run the script with the env var set. The text prints and the request appears on Usage.
If it fails
- key in the browser — keep the key in a server-side env var — never expose it with a
NEXT_PUBLIC_prefix. - structured output errors —
generateObjectdepends on the model'sresponse_formatsupport — check the model card first.
Troubleshooting
The failures below account for nearly every unsuccessful first connection, whatever the tool.
| Status | Symptom | Fix |
|---|---|---|
| 401 | Key missing, mistyped, or deleted | Re-copy the key from Keys and confirm which header your tool sends — Authorization: Bearer or x-api-key. |
| 403 | No credits on the account (INSUFFICIENT_BALANCE) | Add credits first. Verify buttons and test prompts inside tools fire real requests. |
| 404 | Model not found | Send the bare model ID exactly as listed on Models — no provider/ prefix in the request body. |
| 429 | Concurrency or key spend limit reached | Lower parallel requests, or raise the key's spend limit, then retry with backoff. |
The full status-code table, retry guidance, and error envelopes are in Errors & limits. Still stuck? Email support@korouter.ai with the tool name, the model ID, and the exact error text.