Codex
Connect the Codex CLI (OpenAI’s codex) to Routero by defining a custom model provider in its config. Codex then sends every request through your gateway.
Codex supports two wire formats — chat (/chat/completions) and responses (/responses). Routero supports both; responses is recommended for Codex.
What you must set
In ~/.codex/config.toml:
model_provider = "routero"
model = "openai/gpt-5.5"
preferred_auth_method = "apikey"
[model_providers.routero]
name = "routero"
base_url = "https://api.routero.dcsmartvision.com/v1"
wire_api = "responses"
Then provide your Routero key as the API key:
export OPENAI_API_KEY="YOUR_ROUTERO_KEY"
| Setting | Value / meaning |
|---|---|
model_provider |
the name of the [model_providers.*] block below (routero) |
model |
any model Routero serves (e.g. openai/gpt-5.5) |
preferred_auth_method |
apikey — authenticate with an API key, not ChatGPT login |
base_url |
https://api.routero.dcsmartvision.com/v1 |
wire_api |
responses (recommended) or chat |
OPENAI_API_KEY |
your Routero virtual key (sent as Authorization: Bearer) |
preferred_auth_method = "apikey" tells Codex to authenticate with OPENAI_API_KEY instead of ChatGPT sign-in. Set that env var to your Routero virtual key, not an OpenAI key.
Create a key for each developer
In the dashboard, open API Keys and create a virtual key per developer — scoped to their team, limited to the approved models, with an optional budget.
Related
→ Calling the API for the base URL and auth model. → Claude Code and Cursor for the other agents.