Use /model in Codex CLI
Point OpenAI's Codex CLI at /model with a few lines in its config file, and run it on GPT models at /model's prices.
Checked November 24, 2026
Codex CLI talks to its models through OpenAI's Responses API. /model serves that API for its GPT models, so Codex works with a provider of your own in its config file. We ran these steps with Codex CLI 0.154.0, on 24 Nov 2026.
Before you start
- A /model API key: create one on the API keys page and add credit on the credits page.
- The Codex CLI.
Set it up
Add a provider to Codex's config file, ~/.codex/config.toml, and make it the default:
model = "gpt-6.1-sol"
model_provider = "slashmodel"
[model_providers.slashmodel]
name = "slashmodel"
base_url = "https://api.slashmodel.com/v1"
env_key = "SLASHMODEL_API_KEY"
wire_api = "responses"base_urlends in/v1.wire_api = "responses"tells Codex to use the Responses API.env_keynames the environment variable Codex reads your key from, so the key itself stays out of the file.
Set that variable and start Codex:
export SLASHMODEL_API_KEY="sk-sm-…"
codexPick a model
model in the config file is the default. To start one session on another model, name it:
codex --model gpt-6.2-solCodex works with the GPT models. GPT-6.1 Sol, GPT-6.2 Sol, GPT-6 Astra and GPT-5.6 Sol ran in our test. The pricing page has each model's id and price.
Good to know
- Only GPT models work in Codex. Codex speaks only the Responses API, which /model serves for GPT models. With a Claude, Gemini or Grok model, Codex reconnects five times and then shows the API's error, which names the endpoints that model is on.
- Prompt caching works. Codex sends its instructions and the conversation again with every request. In our run, over 12,000 tokens of every request after the first were read from the cache, at the cache price. See the Responses API.
- Codex warns that it has no metadata for the model when it starts. The requests work all the same.
- A key can cap what a session costs. Give Codex a key of its own with a daily or monthly limit: see key settings.
- If you set up Claude Code Router too: it rewrites this config file. That guide says how to get yours back.
- Every request shows under Usage with its tokens and its cost.