openai_base_url config and OPENAI_BASE_URL env var are ignored — always calls api.openai.com

Resolved 💬 2 comments Opened Apr 3, 2026 by tpes007 Closed Apr 3, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

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

  1. Create ~/.codex/config.toml:
model = "gpt-5.4-mini"

[model_provider_config]
openai_base_url = "http://localhost:4000/v1"
  1. Run:
OPENAI_API_KEY=test codex exec -m gpt-5.4-mini --sandbox danger-full-access "Say hello"
  1. Observe: requests go to api.openai.com, not localhost: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.

View original on GitHub ↗

2 Comments

etraut-openai contributor · 4 months ago

openai_base_url is a top-level config key, not [model_provider_config].openai_base_url, so the TOML snippet here won’t affect the built-in openai provider.

Switch to this:

model = "gpt-5.4-mini"
openai_base_url = "http://localhost:4000/v1"
tpes007 · 4 months ago

Thank you

On Apr 3, 2026, at 4:42 PM, Eric Traut @.***> wrote: etraut-openai left a comment (openai/codex#16719) <https://github.com/openai/codex/issues/16719#issuecomment-4185124336> openai_base_url is a top-level config key, not [model_provider_config].openai_base_url, so the TOML snippet here won’t affect the built-in openai provider. Switch to this: model = "gpt-5.4-mini" openai_base_url = "http://localhost:4000/v1" — Reply to this email directly, view it on GitHub <https://github.com/openai/codex/issues/16719?email_source=notifications&email_token=B46G3AG42BNFSYWX6BBDAU34UAO4LA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMJYGUYTENBTGM3KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-4185124336>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/B46G3AFYU3TXLNQHGEZ5Q3L4UAO4LAVCNFSM6AAAAACXMD2IKOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DCOBVGEZDIMZTGY>. You are receiving this because you authored the thread.