Docs navigation

Integrations

Codex

Point OpenAI Codex CLI at TokenRouter as a custom provider.

The Codex CLI supports custom model providers that implement the Responses API. TokenRouter serves /v1/responses, so Codex works with a short config block.

Configure

Add a provider to ~/.codex/config.toml — note the base URL includes /v1 here:

toml
model = "openai/gpt-5-mini"
model_provider = "tokenrouter"

[model_providers.tokenrouter]
name = "TokenRouter"
base_url = "https://api.tokenrouter.io/v1"
env_key = "TOKENROUTER_API_KEY"
wire_api = "responses"

Set your key and run

bash
export TOKENROUTER_API_KEY=tr_your_key_here
codex "explain what this repo does"

Codex sends stateless Responses API calls, which matches TokenRouter’s Responses implementation — no previous_response_id is needed because Codex resends context each turn.

Model choice

Any routed model works in the model field — including anthropic/claude-sonnet-4-5 or auto:quality. TokenRouter translates Responses calls to each provider’s native API.