openai_base_url config and OPENAI_BASE_URL env var are ignored — always calls api.openai.com
Bug
Codex CLI v0.118.0 ignores the openai_base_url config.toml setting and the OPENAI_BASE_URL environment variable. All requests go to https://api.openai.com/v1/responses regardless of configuration.
Steps to Reproduce
- Create
~/.codex/config.toml:
model = "gpt-5.4-mini"
[model_provider_config]
openai_base_url = "http://localhost:4000/v1"
- Run:
OPENAI_API_KEY=test codex exec -m gpt-5.4-mini --sandbox danger-full-access "Say hello"
- Observe: requests go to
api.openai.com, notlocalhost:4000. A local proxy on port 4000 receives zero requests.
Also tried: OPENAI_BASE_URL=http://localhost:4000/v1 env var (prints deprecation warning but still ignores it).
Also tried: -c 'model_provider_config.openai_base_url="http://localhost:4000/v1"' flag.
Expected
Requests should go to the configured base URL, enabling Azure OpenAI and other OpenAI-compatible endpoints.
Environment
- Codex CLI: 0.118.0
- macOS 15 (Apple Silicon)
- Node.js 25.6.1
Use Case
We're trying to use Azure OpenAI ($100K sponsorship credits) with Codex CLI as part of a Paperclip agent orchestration setup. Azure supports the Responses API (/openai/responses?api-version=2025-03-01-preview) and works fine via curl, but Codex CLI can't be pointed at it.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗