Codex CLI
One provider block in ~/.codex/config.toml, one key, every model on the list, pay as you go with no subscription.
At the end you have Codex CLI on a provider block that points at https://api.uplinkswitch.com/v1, with one API key from the console and any model id on the list as model, Claude included. No subscription and no OpenAI key: each request bills per token to the prepaid balance behind that key, and the live table below is the price on each model today.
Before you start
You need Codex CLI installed, an account on the console with credit on it, and one key created there. Create the key for Codex alone, so its requests sit apart from any other tool on the Usage page. Nothing is installed on the UplinkSwitch side: the base URL https://api.uplinkswitch.com/v1 and the key are the whole configuration.
Where the settings are
~/.codex/config.toml, the user config. A project can carry its own .codex/config.toml, but that file ignores model_provider and model_providers, so the provider block goes in the user file (Codex docs, read 2026-10-28).
Codex only speaks the Responses API to a custom provider: wire_api = "responses" is the one value and the default. The gateway answers it at /v1/responses for every chat model, so the Anthropic-style variables from the Claude Code guide do not apply here.
The provider block
Add this to ~/.codex/config.toml. The table id, uplinkswitch, is yours to choose as long as it is not openai, ollama or lmstudio, which Codex reserves; model_provider must match it.
model = "claude-sonnet-5-5"
model_provider = "uplinkswitch"
[model_providers.uplinkswitch]
name = "UplinkSwitch"
base_url = "https://api.uplinkswitch.com/v1"
env_key = "UPLINKSWITCH_API_KEY"
wire_api = "responses"
http_headers = { "HTTP-Referer" = "https://uplinkswitch.ai", "X-Title" = "Codex CLI" }base_url is the /v1 root, as in the provider examples in the Codex docs. http_headers adds two static headers to every request so the console can attribute the traffic to Codex on the Usage page; env_http_headers does the same from environment variables if you prefer. The retry knobs request_max_retries (4), stream_max_retries (5) and stream_idle_timeout_ms (300000) keep their defaults unless you set them.
The key
env_key names the environment variable Codex reads the key from. Export it before you start Codex:
export UPLINKSWITCH_API_KEY="sk-uplink-live-..."
codexThe variable is the provider's credential (Codex docs, read 2026-10-28); nothing else is set up on the Codex side.
Which model id to use
Any chat id on the Models page goes in model, Claude included: tool calling works on every chat model here, and Codex needs it for each file read, edit and command. The ids in the table below are the coding flagships; the uncensored coding builds take the same slot.
To switch for one run pass -m, or keep a profile file next to the config with its own model and start with --profile. Profile files use top-level keys, not a [profiles.name] table (Codex docs, read 2026-10-28).
# ~/.codex/opus.config.toml
model = "claude-opus-5-5"
model_provider = "uplinkswitch"codex -m gpt-6.1-sol
codex --profile opusPrice per token
| Model | Input / 1M | Cached input / 1M | Output / 1M | List input | List output | Under list |
|---|---|---|---|---|---|---|
| Claude Sonnet 5.5 | $1.20 | $0.075 | $3.00 | $2.00 | $10.00 | 40% on input |
| Claude Opus 5.5 | $2.80 | $0.15 | $10.00 | $4.00 | $20.00 | 30% on input |
| GPT-6.1 Sol | $0.60 | $0.06 | $3.00 | $2.00 | $10.00 | 70% on input |
| Gemini 3.1 Pro Preview | $1.20 | $0.12 | $7.20 | $2.00 | $12.00 | 40% on input |
| DeepSeek V4 Pro 0813 | $0.792 | $0.0625 | $1.188 | $1.32 | $3.96 | 40% on input |
| Kimi K3 | $0.90 | $0.12 | $4.50 | $3.00 | $15.00 | 70% on input |
USD per million tokens, live from GET /v1/catalog. List: the developer’s own published price. Cached input bills at the cache-read rate where the model has one, with no switch to set.
Codex sends the conversation and every tool result back on each step, so the input column decides what a session costs, and cached input brings it down further on the models that have a cache-read rate. The Claude Code pricing post works an hour of agent steps into days and months at these rates, and the 30-day price lock on each top-up holds them.
Check it
From a shell, the same key should list the models:
curl https://api.uplinkswitch.com/v1/models -H "Authorization: Bearer $UPLINKSWITCH_API_KEY"Then send one request the way Codex does, to /v1/responses. -i prints the headers: x-uplink-request-id names the request, and on a non-streamed answer x-uplink-charge is what it cost in USD.
curl -i https://api.uplinkswitch.com/v1/responses \
-H "Authorization: Bearer $UPLINKSWITCH_API_KEY" \
-H "content-type: application/json" \
-d '{"model": "claude-sonnet-5-5", "input": "Say ok."}'Then run codex and ask it something. The request shows on the console Usage page within seconds, with its tokens and the same charge, filterable by key and model.
Errors you will see
401 invalid_api_key: the key is wrong, revoked, or the variable named inenv_keyis not exported in the shell that runs Codex. Export it again, or copy the key from the console.404 model_not_found: the id inmodelis not on the Models page at this base URL. Copy it from the page rather than typing it.402 insufficient_balance: the balance does not cover the request. Top up in the console.402 monthly_limit_reached: the key hit the monthly spend limit you set on it. Raise it in the console, or wait for the first of the month.403 scope_denied: the key carries a model allowlist and this id is not on it. Pick an allowed id or use a key without the limit.429 rate_limited: the key hit its requests-per-minute or concurrency limit. The response carriesretry-afterin seconds; Codex retries on its own up torequest_max_retries.- The block has no effect:
model_providerdoes not match the table id, or the block sits in a project.codex/config.toml, which ignores it. Move it to~/.codex/config.toml.
Good to know
-c key=valueoverrides any config key for one run; values parse as TOML where they can.model_reasoning_effortin the same file sets the reasoning level for models that take one.- Cached input bills at the cache-read price on the model page by itself; there is no switch to set.
- A monthly spend limit and a model allowlist on the Codex key cap what it can spend and which ids it can call.
The same key in other agents
Questions
Get a key in the console: prepaid credit, no subscription, 30-day price lock.