How to properly configure model_providers for Azure
Open 💬 11 comments Opened Aug 20, 2025 by Soorma718
What version of Codex is running?
0.22.0
Which model were you using?
gpt-5
What platform is your computer?
wsl
What steps can reproduce the bug?
projects = { "/home/-/.codex" = { trust_level = "trusted" } }
[model_providers.azure]
name = "Azure"
# Make sure you set the appropriate subdomain for this URL.
base_url = "https://<>.openai.azure.com/openai"
env_key = "AZURE_API_KEY" # Or "OPENAI_API_KEY",
query_params = { "api-version" = "2025-04-01-preview" }
wire_api = "responses"
[profiles.5]
model_provider = "azure"
model = "gpt-5"
🖐 error sending request for url (https://<>.openai.azure.com/openai/responses?
api-version=2025-04-01-preview)
/status
📂 Workspace
• Path: ~/projects/--
• Approval Mode: on-request
• Sandbox: workspace-write
• Session ID: 00-=-0-=---
🧠 Model
• Name: gpt-5
• Provider: Azure
• Reasoning Effort: Medium
• Reasoning Summaries: Auto
📊 Token Usage
• Input: 0
• Output: 0
• Total: 0
▌ Ask Codex to do anything
⏎ send Ctrl+J newline Ctrl+C quit
What is the expected behavior?
_No response_
What do you see instead?
_No response_
Additional information
_No response_
11 Comments
~~The documented instructions didn't work for me either.~~
~~Below is the configuration that is working for me:~~
this approach broke in release
0.23.0https://github.com/openai/codex/issues/2480#issuecomment-3209520600 answer is working for me
Thanks for the response, unfortunately still no luck.
Its also not working for me
please help
I got it working like this now - I was previously editing the config.toml in the project directory, thats why it didnt pickup the changes.
I run the cli like this:
same error still for me with your config stream error: error sending request for url (https://*********.openai.azure.com/openai/responses?api-version=2025-04-01-preview); retrying 1/5 in
188ms…
I had the same error and struggled with it for a while, so I’d like to share what worked for me.
The important part was the
base_urlformat and thewire_apisetting.chat completions API, sowire_api = "chat".https://<YOUR-RESOURCE-NAME>.cognitiveservices.azure.com/openai/deployments/<MODEL_DEPLOYMENT_NAME>/Here’s the config snippet that finally worked:
I tested with different URL formats, but only this structure with wire_api = "chat" worked for me.
Hope this helps anyone facing the same issue :)
error sending request for url (https://RESOURCE-NAME.openai.azure.com/openai/responses?api-version=2025-04-01-preview); retrying 1/5 in 202ms…" }) }
[2025-09-01T15:36:18] stream error: error sending request for url (https://RESOURCE-NAME.openai.azure.com/openai/responses?api-version=2025-04-01-preview) is related to my issue https://github.com/openai/codex/issues/1552
Works for me
Thank you for the fix #1552, this was killing me!
@jakeatmsft Exactly! That issue has been bothering me for several months!