codex-rs 0.2.0 still not working with Azure

Resolved 💬 12 comments Opened Jul 4, 2025 by seb-lec Closed Jul 8, 2025
💡 Likely answer: A maintainer (bolinfest, collaborator) responded on this thread — see the highlighted reply below.

What version of Codex is running?

0.2.0

Which model were you using?

gpt-4o

What platform is your computer?

Linux 6.6.87.2-microsoft-standard-WSL2 x86_64 x86_64

What steps can reproduce the bug?

Hello,

It's supposed to be fixed in 0.2.0 but it still doesn't work and give 404 errors.

Here's the config:

model = "gpt-4o"
model_provider = "azure"

[model_providers.azure]
name = "Azure"
base_url = "https://xxx.openai.azure.com/openai"
env_key = "AZURE_OPENAI_API_KEY"
query_params = { api-version = "2024-12-01-preview" }
wire_api = "chat"

Please note that the same config as json works with the nodjs version of the cli:

{
  "model": "gpt-4o",
  "provider": "azure",
  "providers": {
    "azure": {
      "name": "AzureOpenAI",
      "baseURL": "https://xxx.openai.azure.com/openai",
      "envKey": "AZURE_OPENAI_API_KEY"
    }
  }
}

What is the expected behavior?

Working

What do you see instead?

BackgroundEvent(BackgroundEventEvent { message: stream error: unexpected status 404 Not Found: ...

View original on GitHub ↗

12 Comments

cchen7 · 1 year ago

need a better document to guidance with Azure OpenAI API

fcsonline · 1 year ago

Same behaviour here

kingdomseed · 1 year ago

I have Azure working with the following config.toml in ~./.codex:

# --------------  ~/.codex/config.toml  --------------
# Default settings ── used when you run plain `codex`
model_provider = "azure"
model          = "o3"            # pick whatever you want as your day-to-day default

[model_providers.azure]
name         = "Azure OpenAI – YOUR Cognitiveservices"
# NOTE: leave **only** the part up to /openai
base_url     = "https://YOUR_RG.cognitiveservices.azure.com/openai"
env_key      = "AZURE_OPENAI_API_KEY"        # you already export this in ~/.zshrc
wire_api     = "responses"                   # o-series, GPT-4.1, etc. are Responses-only
query_params = { api-version = "2025-04-01-preview" }

# ----------  one profile per model so you can switch fast  ----------
[profiles.o3]
model_provider = "azure"
model          = "o3"

[profiles.o3-pro]
model_provider = "azure"
model          = "o3-pro"

[profiles.o4-mini]
model_provider = "azure"
model          = "o4-mini"

[profiles.codex-mini]
model_provider = "azure"
model          = "codex-mini"

[profiles.gpt-4.1]
model_provider = "azure"
model          = "gpt-4.1"

[profiles.model-router]
model_provider = "azure"
model          = "model-router"
# ---------------------------------------------------------------
jepio · 1 year ago

This works here:

profile = "codex"

[model_providers.azureo4]
name = "Azure"
base_url = "https://xxx.openai.azure.com/openai/deployments/o4-mini"
env_key = "AZURE_OPENAI_API_KEY"
query_params = { "api-version" = "2025-04-01-preview" }

[model_providers.azurecodex]
name = "Azure"
base_url = "https://xxx.openai.azure.com/openai"
env_key = "AZURE_OPENAI_API_KEY"
query_params = { "api-version" = "2025-04-01-preview" }
wire_api = "responses"

[model_providers.azure41]
name = "Azure"
base_url = "https://xxx.openai.azure.com/openai/deployments/gpt-4.1"
env_key = "AZURE_OPENAI_API_KEY"
query_params = { "api-version" = "2025-04-01-preview" }


[profiles.o4]
model = "o4-mini"
model_provider = "azureo4"

[profiles.codex]
model = "codex-mini-latest"
model_provider = "azurecodex"

[profiles.gpt41]
model = "gpt-4.1"
model_provider = "azure41"

I found that the codex deployment has to be called codex-mini-latest so that codex-rs can match the right model context size.

jepio · 1 year ago

And you can also use entra auth, though the token won't be refreshed:

export AZURE_OPENAI_API_KEY=$(az account get-access-token --scope https://cognitiveservices.azure.com/.default | jq -r .accessToken)
kingdomseed · 1 year ago

Thanks for sharing the codex-mini-latest bit.

This works here: `` profile = "codex" [model_providers.azureo4] name = "Azure" base_url = "https://xxx.openai.azure.com/openai/deployments/o4-mini" env_key = "AZURE_OPENAI_API_KEY" query_params = { "api-version" = "2025-04-01-preview" } [model_providers.azurecodex] name = "Azure" base_url = "https://xxx.openai.azure.com/openai" env_key = "AZURE_OPENAI_API_KEY" query_params = { "api-version" = "2025-04-01-preview" } wire_api = "responses" [model_providers.azure41] name = "Azure" base_url = "https://xxx.openai.azure.com/openai/deployments/gpt-4.1" env_key = "AZURE_OPENAI_API_KEY" query_params = { "api-version" = "2025-04-01-preview" } [profiles.o4] model = "o4-mini" model_provider = "azureo4" [profiles.codex] model = "codex-mini-latest" model_provider = "azurecodex" [profiles.gpt41] model = "gpt-4.1" model_provider = "azure41" `` I found that the codex deployment has to be called codex-mini-latest so that codex-rs can match the right model context size.
zhujian0805 · 1 year ago

the same issue here, will this be fixed in next release?

seb-lec · 1 year ago

Thanks a lot to everyone.
Indeed I could make it work with o4-mini with this config:

model = "o4-mini"
model_provider = "azure"

[model_providers.azure]
name = "Azure"
base_url = "https://xxx.openai.azure.com/openai/deployments/o4-mini"
env_key = "AZURE_OPENAI_API_KEY"
query_params = { api-version = "2025-04-01-preview" }
wire_api = "chat"

I think the bug can be kept open to either fix the tool or the config.md for better explanation if that's by design.

fcsonline · 1 year ago

I also was able to make it work. Thanks everyone.

Double check that you are using the native version published in Github. The one published in NPM, 0.1.2505291658 / native doesn't include the fix.

If you want to perform a quick test, just run this Dockerfile, and ensure that base_url is the one that includes _deployments_ on it:

FROM ubuntu:24.04

RUN apt update && apt install -y \
        curl \
        zstd

# Download and decompress codex
RUN curl -L https://github.com/openai/codex/releases/download/rust-v0.2.0/codex-x86_64-unknown-linux-gnu.zst \
        | zstd -d -o /usr/local/bin/codex && \
        chmod +x /usr/local/bin/codex

# Default to bash if no CMD provided
CMD ["/bin/bash"]

If you run:

> RUST_LOG=debug codex exec --skip-git-repo-check "3+3"
DEBUG codex_core::chat_completions: POST to https://xxxxxx.openai.azure.com/openai/deployments/o3-mini/chat/completions?api-version=2025-01-01-preview

@bolinfest Can we publish the new native version in npm registry, please?

bolinfest collaborator · 1 year ago

@fcsonline I just updated the npm publishing scripts in https://github.com/openai/codex/pull/1472 so we can update the npm module. Should be done by end of day.

bolinfest collaborator · 1 year ago

@fcsonline (and others): if you (re-)install via npm, you should now have v0.2.0, which is the Rust version. I updated the installation instructions as part of https://github.com/openai/codex/pull/1475.

fcsonline · 1 year ago

OMG! @bolinfest you rock!