API documentationIntegrations

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

Endpointhttps://korouter.ai

One 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 familyBase URLUsed by
OpenAI-compatiblehttps://korouter.ai/v1Cursor, Cline, Aider, Continue, Open WebUI, Vercel AI SDK, Codex, and every OpenAI SDK.
Anthropic-nativehttps://korouter.aiClaude 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.

~/.claude/settings.json
{
  "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"
  }
}
Verify
claude -p "Reply with OK"

If it fails

  • 401the key belongs in ANTHROPIC_AUTH_TOKEN, not ANTHROPIC_API_KEY.
  • model errorsANTHROPIC_MODEL takes a bare ID from Models, e.g. claude-fable-5.
Full Claude Code guide ↗

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\).

~/.codex/config.toml
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"
~/.codex/auth.json
{ "OPENAI_API_KEY": "sk-your-key" }
Verify
codex exec "Reply with OK"

If it fails

  • requests never arrivewire_api must be "responses" — KoRouter serves Codex through the Responses API.
  • 401the key lives in auth.json, not in config.toml.
  • 400 on reasoningmodel_reasoning_effort is optional (low / medium / high / xhigh); remove it if the selected model rejects it.
Full Codex CLI guide ↗

Cursor

AI code editor · Chat Completions

  1. 1. Open Cursor Settings → Models → API Keys.
  2. 2. Paste your key into OpenAI API Key, enable Override OpenAI Base URL, and set it to https://korouter.ai/v1.
  3. 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 unchangedthe override covers chat and agent modes; Cursor Tab keeps using Cursor's own models.
  • model not foundthe custom model name must match the bare ID exactly; disable built-in models you do not route through the key.
Full Cursor guide ↗

Cline

VS Code agent extension · Chat Completions

  1. 1. In the Cline panel, open Settings → API Configuration.
  2. 2. Set API Provider to OpenAI Compatible, Base URL to https://korouter.ai/v1, paste the key, and enter a bare model ID.
  3. 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 fieldchoose OpenAI Compatible, not OpenAI — only the compatible provider exposes one.
  • output truncates earlyset the model's context window in Cline's advanced model settings to the value shown on the model card.
Full Cline guide ↗

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/.

Terminal
export OPENAI_API_BASE="https://korouter.ai/v1"
export OPENAI_API_KEY="sk-your-key"
aider --model openai/model-name

Verify

Aider prints the connected model and endpoint on startup. Ask it anything, then check Usage for the call.

If it fails

  • wrong-looking model namethe openai/ prefix is local routing for LiteLLM; the request body carries the bare ID after the slash.
  • unknown-model cost warningscosmetic — aider does not know custom catalogs. Silence them with --no-show-model-warnings.
  • 401 despite a correct keyexport the variables in the same shell that launches aider, or add them to your shell profile.
Full Aider guide ↗

Continue

VS Code / JetBrains assistant · Chat Completions

Add a model entry to ~/.continue/config.yaml using the generic openai provider with apiBase.

~/.continue/config.yaml
models:
  - name: KoRouter model-name
    provider: openai
    model: model-name
    apiBase: https://korouter.ai/v1
    apiKey: sk-your-key
    roles:
      - chat
      - edit

Verify

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.comthe entry must set apiBase; without it, the openai provider uses the default endpoint.
  • older installlegacy versions read config.json — the field names (apiBase, apiKey) are the same.
  • no autocompleteautocomplete is a separate role; add a dedicated model entry for it rather than reusing the chat entry.
Full Continue guide ↗

Open WebUI

Self-hosted chat UI · Chat Completions

  1. 1. Open Admin Panel → Settings → Connections.
  2. 2. Under OpenAI API, add https://korouter.ai/v1 with your key.
  3. 3. Save. Open WebUI loads the model list from GET /v1/models into the picker.

Verify

The model selector lists KoRouter model IDs. Send a message and confirm the call on Usage.

If it fails

  • empty model pickerre-verify the connection — a mistyped URL or key keeps the list empty. The model list itself works even at zero balance.
  • too many modelsuse the connection's model filter to expose only the IDs your members should see.
  • surprise spendevery chat message is a normal billed API call; the key's spend limit still applies.
Full Open WebUI guide ↗

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.

npm install ai @ai-sdk/openai-compatible
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 browserkeep the key in a server-side env var — never expose it with a NEXT_PUBLIC_ prefix.
  • structured output errorsgenerateObject depends on the model's response_format support — check the model card first.
Full Vercel AI SDK guide ↗

Troubleshooting

The failures below account for nearly every unsuccessful first connection, whatever the tool.

StatusSymptomFix
401Key missing, mistyped, or deletedRe-copy the key from Keys and confirm which header your tool sends — Authorization: Bearer or x-api-key.
403No credits on the account (INSUFFICIENT_BALANCE)Add credits first. Verify buttons and test prompts inside tools fire real requests.
404Model not foundSend the bare model ID exactly as listed on Models — no provider/ prefix in the request body.
429Concurrency or key spend limit reachedLower 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.