Codex CLI custom provider for GPT, Claude and Gemini
The Codex CLI talks to custom providers over the Responses API, which LLM Router supports. One installer command writes the provider and a profile per model family, so you switch models with a flag.
$ curl -fsSL https://llm-router.org/i/codex.sh | bash
PS> irm https://llm-router.org/i/codex.ps1 | iex
The installer asks for your API key, installs the Codex CLI if needed and writes ~/.codex/config.toml. It needs Node.js LTS.
Setup
Create a key and run the installer
Create the key in the dashboard (it starts with llmr_), then run the installer and paste it. An existing config.toml is backed up before it is replaced.
macOS / Linux
curl -fsSL https://llm-router.org/i/codex.sh | bash
Windows
irm https://llm-router.org/i/codex.ps1 | iex
Start Codex with a profile
One profile per model family.
codex --profile gpt
codex --profile sonnet
codex --profile gemini
Payment
The balance is kept in US dollars and charged per token. Minimum top-up: $3. For payments in rubles the rate is shown on the top-up page before you pay.
QR code · credited in seconds
Visa · Mastercard · MIR
Visa · Mastercard · issued outside RU
USDT and others
What the installer writes
Codex is pointed at LLM Router through the Responses API. Profiles are generated from the current catalog, so yours may differ from this example.
~/.codex/config.toml
model_reasoning_effort = "high"
model_provider = "llmrouter"
[model_providers.llmrouter]
name = "https://llm-router.org"
base_url = "https://llm-router.org/v1"
wire_api = "responses"
[profiles.gpt]
model = "gpt-…"
Worth knowing
Reasoning effort
model_reasoning_effort = "high" raises the thinking budget on models that support it. Use "medium", or remove the line, to spend less.
Re-running the installer
It saves the current config.toml as config.toml.bak.<date> first.
Prices
Per 1M tokens, USD. The full list is on the pricing page.
OpenAI GPT
8 modelsgpt-6-astra
$4.00 in · $20.00 out
gpt-5.6-sol
$1.60 in · $8.00 out
gpt-5.6-terra
$0.80 in · $4.80 out
Google Gemini
3 modelsgemini-3.5-flash
$0.60 in · $3.60 out
gemini-3.8-flash
$0.33 in · $1.65 out
gemini-3-flash
$0.20 in · $1.20 out
Troubleshooting
command not found: codexNode.js LTS is missing. Install it and run the installer again.
Profile not foundProfiles exist only for models in the current catalog. Check the [profiles.*] sections in config.toml.
401The key is wrong or disabled. Copy it again from the dashboard.
402Insufficient balance. Top up in the dashboard and retry.
Questions
How do I set up a custom provider in the Codex CLI?
Add a [model_providers.<id>] table with base_url and wire_api = "responses", and select it with model_provider. The installer writes this for LLM Router, together with your key.
Can I use Claude and Gemini models from Codex?
Yes. The installer adds profiles for them (gpt, sonnet, gemini), so you run codex --profile sonnet or --profile gemini.
How do I pay for usage?
Top up the balance by SBP, a Russian card (Visa, Mastercard, MIR), an international card or crypto. The minimum is $3, and usage is charged per token.
What happens when the balance runs out?
Requests are rejected with a 402 error until you top up. There is no subscription and no automatic charge.
Do you store my prompts and code?
No. We log metadata only: model, tokens and latency. Prompt content is not stored or used for training.
See also
Create an account, top up, run one command
Registration needs an email and a password. The key is created in the dashboard once you are in.
Create an account → Top up from $3