API documentationIntegrationsCodex CLI

Codex CLI

Agentic coding CLI · Responses API

Codex talks the Responses API; KoRouter serves it on the OpenAI-compatible endpoint with a two-file setup — provider in config.toml, key in auth.json.

Base URL · OpenAI-compatible

https://korouter.ai/v1

Plus an API key from Keys and a bare model ID from Models. Every price on the catalog sits below the provider's official rate — pay as you go.

Setup

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.

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.

Other tools

Free to sign up, no monthly fee — pay as you go with credits.