Codex

Integration status
  • Recommended protocol: OpenAI Responses
  • Configuration checked: July 15, 2026 (official Codex configuration reference)
  • Runtime verification: Pending

Codex custom providers use the Responses protocol. Select a GetRouter model that supports /v1/responses.

Store the API key

export GETROUTER_API_KEY="YOUR_API_KEY"

Add it to your shell's secure environment configuration if needed. Do not write the key directly into config.toml.

Configure Codex

Edit ~/.codex/config.toml:

model = "MODEL_ID"
model_provider = "getrouter"

[model_providers.getrouter]
name = "GetRouter"
base_url = "https://getrouter.ai/v1"
env_key = "GETROUTER_API_KEY"
wire_api = "responses"

Replace MODEL_ID with an exact model ID from Models. Preserve unrelated Codex settings.

Warning

Do not use wire_api = "chat". Current Codex custom providers use Responses. A model that only supports Chat Completions is not suitable for this configuration.

Verify

  1. Restart Codex from a shell where GETROUTER_API_KEY is set.
  2. Confirm Codex shows the expected model/provider.
  3. Start with a harmless repository question.
  4. Confirm the request appears in GetRouter usage logs.
  5. Only then test edits, tool calls, long context, or higher reasoning settings.

Common errors

  • Missing environment variable: launch Codex from a shell that exports GETROUTER_API_KEY.
  • 404 on /responses: use base_url = "https://getrouter.ai/v1"; do not append /responses yourself.
  • Model not found: copy the exact model ID and confirm the key can use it.
  • Unsupported response or tool event: the selected model/provider path may not fully support Responses tool events; test another Responses-capable model.
  • Codex still uses another provider: check the active config profile and top-level model_provider.

See Integration troubleshooting before sharing diagnostics.