Codex CLI not working with Azure provider - stream error: error sending request for url
Resolved 💬 8 comments Opened Sep 22, 2025 by Techie5879 Closed Jan 10, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor)
responded on this thread — see the highlighted reply below.
What version of Codex is running?
codex-cli 0.39.0
Which model were you using?
gpt-5
What platform is your computer?
Linux 6.6.87.2-microsoft-standard-WSL2 x86_64 x86_64
What steps can reproduce the bug?
I have the following config
model = "gpt-5"
model_provider = "azure"
model_reasoning_effort = "high"
[model_providers.azure]
name = "Azure"
base_url = "https://<azure_endpoint_resource>.openai.azure.com/openai/v1"
env_key = "AZURE_OPENAI_API_KEY"
wire_api = "responses"
query_params = { api-version="2025-04-01-preview" }
For all requests - I get: ⚠️ stream error: error sending request for url (https://<azure_endpoint_resource>.openai.azure.com/openai/v1/chat/completions?api-version=2025-04-01-preview); retrying 1/5 in 198ms…
....
It retries 5 times and then exits. The API key is exported. I've tried versions of the base_url, removing the v1 as well.
What is the expected behavior?
_No response_
What do you see instead?
_No response_
Additional information
_No response_
8 Comments
Logs do not provide any more information than:
stream disconnected - retrying turn (3/5 in 756ms)...
@Techie5879 two things to try as I am unable to repro your issue with my Azure account on WSL.
<img width="1510" height="1755" alt="Image" src="https://github.com/user-attachments/assets/903eb8fd-1db5-4c79-a2b6-aff96c40974f" />
When testing with the new v1 GA API don't pass
api-versionit should only be required with the older versions. This is what my file looks like:```config.toml
model = "gpt-5" # Replace with your actual Azure model deployment name
model_provider = "azure"
model_reasoning_effort = "high"
[model_providers.azure]
name = "Azure OpenAI"
base_url = "https://YOUR-RESOURCE-NAME.openai.azure.com/openai/v1"
env_key = "AZURE_OPENAI_API_KEY"
wire_api = "responses"
@Techie5879 - the fix https://github.com/openai/codex/issues/1552, worked for me
@mrbullwinkle - Tried - did not work. Still getting the same error. And yes I've been exporting the key properly as an env variable and not passing it as string in the file. Can confirm no quota issue as I can query the same deployment fine with the openai python package tho.
This work. Does seem like the npm package is broken.
Hi, what did you do to let it work? I am still unable to work with it
https://github.com/openai/codex/issues/1552#issuecomment-3066563153
Download the linux binary and put it somewhere - use it - and alias
codexto that location and seemed to work great for me.Closing out stale bugs.