Codex
Add CodaAPI as a model provider in ~/.codex/config.toml. It works for the Codex CLI, the IDE extension and the desktop app.
Codex is OpenAI's coding assistant. It comes as a command-line tool (Codex CLI), an IDE extension and a desktop app, and all three share one configuration file, ~/.codex/config.toml. Codex calls models only through the Responses endpoint (/v1/responses), which CodaAPI provides.
Method 2 (editing config.toml by hand) on this page has been tested on the CodaAPI gateway (Codex CLI 0.146.1, November 2026). Importing with CC Switch, the IDE extension and the desktop app haven't been tested yet and are marked where they appear. Settings may change when Codex updates, so the official documentation is authoritative.
Before you start:
- Install the Codex CLI, for example
npm install -g @openai/codex, orbrew install --cask codexon macOS. For other ways to install, see the official Codex repository. - A CodaAPI API key with Group set to
OpenAI-Codex. To create one, see the Quickstart. - Pick a model, for example
gpt-6.2-sol(it's in all three of theOpenAI-Codex,OpenAI-官转andOpenAI-AZgroups). The model must be in your key's group; for the models in each group, see Groups. Codex needs a model that can be called through the Responses endpoint. If a model errors saying it doesn't support this endpoint, try another model.
Setup
Method 1: import with CC Switch
Not tested: the CC Switch steps follow its official repository and haven't been tested on CodaAPI yet.
Same as for Claude Code: on the console's API Keys page, click CC Switch in that key's menu, set Application to Codex, choose a Primary Model, and click Open CC Switch. The imported address is https://codaapi.com/v1 (Codex uses the address with /v1). See the CC Switch page for the full steps.
Method 2: edit config.toml manually
-
Put the key in an environment variable. The configuration file holds only the variable name, never the key itself:
# macOS / Linux: add it to ~/.zshrc or ~/.bashrc, then reopen the terminal export CODAAPI_API_KEY="sk-your-key"# Windows: stores it as a user environment variable; takes effect after you reopen the terminal setx CODAAPI_API_KEY "sk-your-key" -
Edit
~/.codex/config.toml(on Windows,%USERPROFILE%\.codex\config.toml), and create it if it doesn't exist:model = "gpt-6.2-sol" model_provider = "codaapi" [model_providers.codaapi] name = "CodaAPI" base_url = "https://codaapi.com/v1" env_key = "CODAAPI_API_KEY" wire_api = "responses" requires_openai_auth = false
A few things to note:
- Top-level settings such as
modelandmodel_providermust come before the first[...]table. If they come after it, they are read as fields of that table. wire_apican only be"responses". Codex no longer supports Chat Completions, sowire_api = "chat"from older tutorials no longer works.- Don't use reserved names such as
openai,ollamaorlmstudioas the provider id. The example above usescodaapi. - Providers can only be defined in the user-level
~/.codex/config.toml. A.codex/config.tomlinside a project directory can't define providers.
Use it in an IDE and the desktop app
Not tested: this section follows the official Codex documentation. Sharing config.toml across all three is what the official docs say; the IDE extension and the desktop app haven't been tested on CodaAPI yet.
- Codex IDE extension:
openai.chatgptin the VS Code extension marketplace, which also supports editors such as Cursor and Windsurf. It reads the same~/.codex/config.tomlas the command line, so it works once you've configured it as above. In the extension, you can open this file with Open config.toml from the settings button. - Codex desktop app: it also reads
~/.codex/config.toml; see Codex app for details. - An app launched from a desktop icon may not see environment variables you set in a terminal. If the IDE or desktop app says the key is missing, set
CODAAPI_API_KEYas a system-level environment variable (on Windows, use thesetxabove) and restart the app, or import with CC Switch instead.
Check that it works
- Run
codexand type/statusto confirm that the current model and provider are CodaAPI. - Send a message, for example "Reply with only ok". If it answers normally, you're set. The matching request appears in the console usage logs.
You can also bypass Codex and test the Responses endpoint directly with curl:
curl https://codaapi.com/v1/responses \
-H "Authorization: Bearer $CODAAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-6.2-sol", "input": "ping"}'
If curl works but Codex doesn't, most likely Codex didn't pick up the environment variable, or the top-level settings in config.toml were written after a table.
MCP and plugins
MCP servers run on your own computer. Codex starts and calls them, and they are configured in [mcp_servers.<name>] tables of the same config.toml, in the form the official Codex documentation describes. Which gateway the model goes through doesn't affect them: after you switch to CodaAPI, MCP usage stays the same.
CodaAPI itself doesn't provide MCP servers and doesn't read or proxy your MCP traffic. What an MCP tool returns is sent to the model as part of the conversation and billed by tokens.