Use BigModel.io with Codex CLI
Add BigModel.io as a Codex CLI model provider in config.toml with base_url https://bigmodel.io/v1 and wire_api "responses", and pick a key group that serves the Responses API.
On this page
Codex CLI reads custom providers from ~/.codex/config.toml and only speaks the OpenAI Responses API. BigModel.io serves it at https://bigmodel.io/v1/responses, but not every key group does, so check your group first.
| Setting | Value |
|---|---|
base_url |
https://bigmodel.io/v1 |
wire_api |
"responses" (the only supported value) |
env_key |
BIGMODEL_API_KEY (the variable holding your key) |
model |
a model ID from the model catalog |
Codex no longer supports
wire_api = "chat". Old configs fail withwire_api = "chat" is no longer supported. There is no Chat Completions fallback, so a key whose group only serves Chat Completions cannot be used with Codex.
#Before you start
- Create a key in API Keys.
- Check that the key's group serves
/v1/responsesfor the model you want. OpenAI- and Anthropic-platform groups do. GLM and DeepSeek groups are Chat Completions only and return 404 here, even though the same model works on/v1/chat/completions.
curl https://bigmodel.io/v1/responses \
-H "Authorization: Bearer $BIGMODEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"glm-5.3","input":"ping"}'A JSON response with output means the group works with Codex. A 404 not_found_error saying the platform "only supports /v1/chat/completions" means it does not: use a key from another group, or use a Chat Completions agent such as OpenCode or Cline.
#Configure config.toml
Add this to ~/.codex/config.toml (create it if needed):
model = "glm-5.3"
model_provider = "bigmodel"
[model_providers.bigmodel]
name = "BigModel"
base_url = "https://bigmodel.io/v1"
env_key = "BIGMODEL_API_KEY"
wire_api = "responses"Then export your key in the shell that runs Codex and start it:
export BIGMODEL_API_KEY="sk-..."
codexenv_key names the environment variable; do not paste the key itself into config.toml. Do not name the provider openai, ollama or lmstudio; those IDs are reserved. If Codex misjudges the model's context, set model_context_window to the value on the model page.
#Switch models with profiles
Profiles are separate files named ~/.codex/<name>.config.toml, selected with --profile <name>. For example, ~/.codex/fast.config.toml:
model = "glm-5.3-flash"
model_provider = "bigmodel"codex --profile fast
codex -m kimi-k3 "explain this repository"The provider block stays in ~/.codex/config.toml. Every model you use must be served on /v1/responses by your key's group.
#Verify the setup
codex exec "say hi"You should get a short reply, and the request should appear in Usage with the /v1/responses endpoint.
#Troubleshooting
wire_api = "chat" is no longer supported. Your config is from an older Codex release. Change it to wire_api = "responses".
404 not_found_error: ... platform only supports /v1/chat/completions; /v1/responses is not available. The key's group is Chat Completions only (GLM or DeepSeek platform). Codex cannot fall back to chat. Use a key from a group that serves Responses, or switch to OpenCode or Cline.
404 on every request. Check base_url. It must end in /v1, and must not include /responses.
401 API_KEY_REQUIRED or "missing environment variable". BIGMODEL_API_KEY is not set in the shell that started Codex. Run echo ${BIGMODEL_API_KEY:0:5} to check, and export it in ~/.zshrc or ~/.bashrc to make it permanent.
400 invalid_request_error mentioning previous_response_id. BigModel.io does not keep response state over HTTP; the client must send the full input each turn. Update Codex, and report it to support if it persists.
Codex still uses OpenAI. The top-level model_provider = "bigmodel" is missing, or a profile file overrides it. Run with --profile explicitly to rule out profile mix-ups.
503 api_error: No available accounts: no available accounts supporting model: .... The model ID is misspelled or not served by your key's group. Copy the ID from the model page, and list what your key can call with curl https://bigmodel.io/v1/models -H "Authorization: Bearer $BIGMODEL_API_KEY".
403 INSUFFICIENT_BALANCE or 429 API_KEY_QUOTA_EXHAUSTED. Top up in Billing or raise the key's quota. A 429 rate_limit_error ("Concurrency limit exceeded for user") means too many parallel requests; Codex retries, but lower concurrency if it keeps happening.
#Related
- Configure Base URL in Codex, Claude Code, Cursor and Cline uses the same
config.tomlblock. - CC Switch can write the Codex provider for you.
- Claude Code for the Anthropic-protocol terminal agent.
- Responses API reference.
Updated · View as Markdown