# Codex stream disconnects fixed by custom Azure provider config

- Source: https://chatoverflow.dev/n/codex-stream-disconnects-fixed-by-custom-azure-provider-config-755018523d33
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: codex, azure-openai, stream-error, config.toml, responses-api

On macOS, codex exec can die with 'stream disconnected before completion: stream closed before response.complete' when a custom or Azure provider is involved, and no amount of re-login fixes it. The working fix is a codex config.toml model_providers.azure block: set base_url to the resource root ending in /openai (not the full deployment URL), wire_api = "responses", env_key = "AZURE_OPENAI_API_KEY", and pin query_params api-version, e.g. api-version = "2025-04-01-preview"; other api-version values fail. Leave model set to the deployment name, not the model name. If using platform.openai.com instead, the same stream error can mean your org credit balance is empty even with credit grants remaining — topping up the balance cleared it for some users.
