OpenAI Codex CLI & OpenCode Custom API Configuration
Configure ~/.codex/config.toml with top-level model_provider and wire_api="responses" to run gpt-6.2-sol, gpt-6.2-astra, and gpt-6.1-terra over native /v1/responses, or wire OpenCode opencode.json for Gemini 4 and DeepSeek V4.1.
1. OpenAI Codex CLI Setup (~/.codex/config.toml)
Per the OpenAI Codex configuration documentation, custom providers are defined in ~/.codex/config.toml (Windows: %USERPROFILE%\.codex\config.toml).
Critical TOML gotcha: model_provider and model must sit at the top level before [model_providers.deepclub]. Placing them underneath the table header nests them inside the provider table and silently disables your custom provider:
# Keep these keys at file root ABOVE [model_providers.*]
model_provider = "deepclub"
model = "gpt-6.2-sol"
model_reasoning_effort = "medium"
[model_providers.deepclub]
name = "DeepClub"
base_url = "https://deepclub.net/v1"
wire_api = "responses"
env_key = "DEEPCLUB_API_KEY"
Export your scoped DeepClub key and launch Codex CLI:
export DEEPCLUB_API_KEY="sk-your-deepclub-key"
codex
# Escalate a hard algorithmic or concurrency ticket to GPT-6.2 Astra
codex -m gpt-6.2-astra
Three GPT-6.2 Guardrails in Codex CLI
- Use only Responses-enabled models with
wire_api = "responses": Supported catalog models includegpt-6.2-sol,gpt-6.2-astra,gpt-6.1-terra,gpt-6-luna,grok-4.7, andglm-5.3. Do not pointwire_api = "responses"at Chat-only models likedeepseek-v4.1-flash. - Never set
model_reasoning_effort = "none"ongpt-6.2-solorgpt-6.2-astra: OpenAI rejectseffort="none"on GPT-6.2 with HTTP 400; uselow,medium, orhigh. - Watch the 272K long-context billing boundary: Compact long sessions before input tokens exceed 272K to avoid OpenAI's long-context tier jump (see GPT-6.2 Sol API Guide).
2. OpenCode Multi-Model Terminal Setup (opencode.json)
To run gemini-4-neon, gemini-4-carbon, deepseek-v4.1-flash, glm-5.3, kimi-k3, and qwen3.8-flash inside OpenCode, place opencode.json in your project or global config directory, then run /connect → Other → provider ID deepclub to save your API key:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"deepclub": {
"npm": "@ai-sdk/openai-compatible",
"name": "DeepClub",
"options": {
"baseURL": "https://deepclub.net/v1"
},
"models": {
"gemini-4-neon": { "name": "Gemini 4 Neon" },
"gemini-4-carbon": { "name": "Gemini 4 Carbon" },
"deepseek-v4.1-flash": { "name": "DeepSeek V4.1 Flash" },
"glm-5.3": { "name": "GLM-5.3" },
"kimi-k3": { "name": "Kimi-k3" },
"qwen3.8-flash": { "name": "Qwen 3.8 Flash" }
}
}
}
}
Pair Codex CLI with Claude Code for native Anthropic /v1/messages sessions on the same balance. Check Live Pricing or API Troubleshooting.
Frequently Asked Questions
- Why did Codex CLI ignore my DeepClub config.toml?
- In TOML, any key written below [model_providers.deepclub] belongs to that sub-table. Move model_provider = "deepclub" and model = "gpt-6.2-sol" to the very top of ~/.codex/config.toml.
- Why does Codex CLI return 400 when I set model_reasoning_effort = "none"?
- OpenAI GPT-6.2 Sol and GPT-6.2 Astra explicitly reject reasoning.effort="none". Set model_reasoning_effort to "low", "medium", or "high".
- Can I run DeepSeek V4.1 or Gemini 4 inside Codex CLI?
- No. DeepSeek V4.1 and Gemini 4 expose /v1/chat/completions on DeepClub rather than /v1/responses. Use OpenCode, Cline, Roo Code, or Continue for those models.
Updated