Coding Tools

Share

Use KiteRouter as the gateway for coding agents by configuring each tool with the API shape it already speaks. Codex uses OpenAI Responses, Claude Code uses Anthropic Messages, and Gemini CLI uses the Gemini API.

Share this section with teammates: https://kiterouter.com/docs/coding-tools

ToolConfigure this base URLKey env varProtocol sent by the tool
Codexhttps://kiterouter.com/api/v1KITEROUTER_API_KEYOpenAI Responses: /responses
Claude Codehttps://kiterouter.com/apiANTHROPIC_AUTH_TOKENAnthropic Messages: /v1/messages
Gemini CLIhttps://kiterouter.com/apiGEMINI_API_KEYGemini API: /v1/models/...

Info: The Claude Code and Gemini CLI base URL intentionally ends at /api, not /api/v1. Those tools append /v1/... themselves.

Before you start

  1. Create a KiteRouter API key from Dashboard -> API Keys.
  2. Copy the exact model id from the Models page.
  3. Restart the coding tool after changing env vars or config files.
  4. Test with a tiny prompt before launching a long agent task.

Config file locations

Use the user-level file for API keys and personal provider settings. Project-level files can be committed for team defaults, but do not put kr- keys in a repository.

ToolWindows user filemacOS user fileLinux / WSL user file
Codex%USERPROFILE%\.codex\config.toml~/.codex/config.toml~/.codex/config.toml
Claude Code%USERPROFILE%\.claude\settings.json~/.claude/settings.json~/.claude/settings.json
Gemini CLI%USERPROFILE%\.gemini\settings.json~/.gemini/settings.json~/.gemini/settings.json
Gemini env%USERPROFILE%\.gemini\.env~/.gemini/.env~/.gemini/.env

Info: In WSL, use the Linux paths inside the WSL home directory, not the Windows %USERPROFILE% path.

Codex

Codex reads config.toml from the Codex user directory above. Current Codex custom providers use the Responses API, so point base_url at KiteRouter's OpenAI-compatible versioned base URL and keep wire_api = "responses".

toml
1model = "openai/gpt-5.5"
2model_provider = "kiterouter"
3
4[model_providers.kiterouter]
5name = "KiteRouter"
6base_url = "https://kiterouter.com/api/v1"
7env_key = "KITEROUTER_API_KEY"
8wire_api = "responses"

macOS / Linux / WSL:

bash
1export KITEROUTER_API_KEY="kr-your-api-key"
2codex exec "Reply with: ready"

Windows PowerShell:

powershell
1$env:KITEROUTER_API_KEY = "kr-your-api-key"
2codex exec "Reply with: ready"

Use the model value for the KiteRouter model you want Codex to run. If you switch models often, set the provider once and override the model from the Codex CLI when needed.

Claude Code

Claude Code supports LLM gateways through ANTHROPIC_BASE_URL. Use ANTHROPIC_AUTH_TOKEN for KiteRouter so Claude Code sends your kr- key as a Bearer token.

macOS / Linux / WSL:

bash
1export ANTHROPIC_BASE_URL="https://kiterouter.com/api"
2export ANTHROPIC_AUTH_TOKEN="kr-your-api-key"
3export ANTHROPIC_MODEL="anthropic/claude-sonnet-4-5"
4claude -p "Reply with: ready"

Windows PowerShell:

powershell
1$env:ANTHROPIC_BASE_URL = "https://kiterouter.com/api"
2$env:ANTHROPIC_AUTH_TOKEN = "kr-your-api-key"
3$env:ANTHROPIC_MODEL = "anthropic/claude-sonnet-4-5"
4claude -p "Reply with: ready"

For a persistent setup, put the same values in the user settings.json file from the platform table:

json
1{
2  "env": {
3    "ANTHROPIC_BASE_URL": "https://kiterouter.com/api",
4    "ANTHROPIC_AUTH_TOKEN": "kr-your-api-key",
5    "ANTHROPIC_MODEL": "anthropic/claude-sonnet-4-5"
6  }
7}

If you want Claude Code's /model picker to discover gateway models, enable gateway model discovery:

bash
1export CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1

Gemini CLI

Gemini CLI supports a custom Gemini API base URL with GOOGLE_GEMINI_BASE_URL. Set the API version to v1 so requests land on KiteRouter's /api/v1/models/... routes.

macOS / Linux / WSL:

bash
1export GEMINI_API_KEY="kr-your-api-key"
2export GOOGLE_GEMINI_BASE_URL="https://kiterouter.com/api"
3export GOOGLE_GENAI_API_VERSION="v1"
4export GEMINI_MODEL="gemini-2.5-pro"
5gemini -p "Reply with: ready"

Windows PowerShell:

powershell
1$env:GEMINI_API_KEY = "kr-your-api-key"
2$env:GOOGLE_GEMINI_BASE_URL = "https://kiterouter.com/api"
3$env:GOOGLE_GENAI_API_VERSION = "v1"
4$env:GEMINI_MODEL = "gemini-2.5-pro"
5gemini -p "Reply with: ready"

For a persistent setup, put the env values in the Gemini .env file from the platform table:

dotenv
1GEMINI_API_KEY=kr-your-api-key
2GOOGLE_GEMINI_BASE_URL=https://kiterouter.com/api
3GOOGLE_GENAI_API_VERSION=v1
4GEMINI_MODEL=gemini-2.5-pro

Then make sure Gemini CLI is set to API-key auth in the user settings.json file:

json
1{
2  "security": {
3    "auth": {
4      "selectedType": "gemini-api-key"
5    }
6  },
7  "model": {
8    "name": "gemini-2.5-pro"
9  }
10}

Use a Gemini-family model id from the Models page.

CC Switch

If you manage several coding agents on the same machine, create one KiteRouter provider per protocol:

Provider nameUse withBase URL
KiteRouter OpenAICodexhttps://kiterouter.com/api/v1
KiteRouter AnthropicClaude Codehttps://kiterouter.com/api
KiteRouter GeminiGemini CLIhttps://kiterouter.com/api

Keep the provider name tied to the protocol, not the model. That makes it obvious when a tool is about to send OpenAI, Anthropic, or Gemini-shaped requests.

Troubleshooting

SymptomWhat to check
401 or invalid_api_keyUse a KiteRouter kr- key and restart the tool after setting env vars.
404 from Claude CodeANTHROPIC_BASE_URL should be https://kiterouter.com/api, not https://kiterouter.com/api/v1.
404 from Gemini CLIUse GOOGLE_GEMINI_BASE_URL="https://kiterouter.com/api" and GOOGLE_GENAI_API_VERSION="v1".
Codex config rejectedPut provider settings in ~/.codex/config.toml and keep wire_api = "responses".
Model not foundCopy the exact model id from the Models page and match it to the tool protocol.

Security: Never commit kr- keys. Prefer environment variables, OS keychain storage, or your coding tool's secret manager.

Ready to start building?

Get your API key and make your first request in under a minute.