Codex CLI Specifics
What's the Codex CLI Base URL format?
The Codex Base URL needs the /v1 suffix, unlike Claude Code:
Claude Code: https://your-request-address (without /v1)
Codex CLI : https://your-request-address/v1 (with /v1)Where are Codex CLI config files? How to configure manually?
Two config files:
~/.codex/config.toml(Windows:C:\Users\<name>\.codex\config.toml)~/.codex/auth.json(Windows:C:\Users\<name>\.codex\auth.json)
config.toml example:
model_provider = "custom"
model = "gpt-5.4"
model_reasoning_effort = "high"
disable_response_storage = true
[model_providers.custom]
name = "custom"
base_url = "https://your-request-address/v1"
wire_api = "responses"
requires_openai_auth = true
model_context_window = 1000000
model_auto_compact_token_limit = 900000auth.json example:
{
"OPENAI_API_KEY": "sk-***"
}How to enable 1M context in Codex CLI?
Confirm these two in ~/.codex/config.toml:
model_context_window = 1000000
model_auto_compact_token_limit = 900000model_context_window: set the usable context window to 1,000,000model_auto_compact_token_limit: trigger compaction before the limit to avoid hitting the ceiling
Codex CLI reasoning is slow — what to do?
Change model_reasoning_effort in config.toml from high to medium or low:
low: fast, for simple code generation and quick Q&Amedium: medium, for daily development (recommended)high: slow, for complex algorithms and architecture design
Codex CLI API Key invalid?
- Check the Key in
~/.codex/auth.json - Confirm the proxy site has sufficient balance and the token hasn't expired
Codex error — 401 Unauthorized: Invalid token
Symptom: Codex CLI errors with unexpected status 401 Unauthorized: Invalid token.
Cause: a previous login overwrote ~/.codex/auth.json, so the Key inside is no longer your proxy API Key.
Fix: manually open ~/.codex/auth.json (Windows: C:\Users\<name>\.codex\auth.json) and set its content to your proxy API Key:
{
"OPENAI_API_KEY": "sk-***"
}Save and restart Codex.
Will using Claude Code and Codex CLI together conflict?
No. Their config files are independent and don't conflict. CC Switch can manage both:
- Claude Code →
~/.claude/settings.json - Codex CLI →
~/.codex/config.toml+~/.codex/auth.json
Codex error — Image generation is not enabled for this group
Symptom: Codex CLI errors with Image generation is not enabled for this group.
Cause: the current group doesn't have image generation enabled, but Codex tries to carry the image-generation feature by default, so the request is rejected.
Fix: open ~/.codex/config.toml (Windows: C:\Users\<name>\.codex\config.toml) and add under [features]:
[features]
image_generation = falseIf there's no [features] section, add it first. Note: Codex has no hot reload — after saving, fully quit and restart Codex for it to take effect.