Skip to content

Azure Open AI not supported(?) #975

@brentwc

Description

@brentwc

What version of Codex is running?

0.1.2505161243

Which model were you using?

gpt-4o-mini

What platform is your computer?

linux | x64 | 5.15.167.4-microsoft-standard-WSL2

What steps can reproduce the bug?

cat <<EOF > .env
AZURE_OPENAI_API_KEY=`<key.value>`
AZURE_OPENAI_API_VERSION=`<api.version>`
EOF
cat <<EOF > ~/.codex/config.yaml
model: gpt-4o-mini
provider: azure
providers:
  azure:
    name: AzureOpenAI
    baseURL: https://`<project.name>`.openai.azure.com/openai
    envKey: AZURE_OPENAI_API_KEY
approvalMode: suggest
fullAutoErrorMode: ask-user
notify: true
EOF
codex 'say hello'

What is the expected behavior?

"Hello."

What do you see instead?

╭──────────────────────────────────────────────────────────────╮
│ ● OpenAI Codex (research preview) v0.1.2505161243            │
╰──────────────────────────────────────────────────────────────╯
╭──────────────────────────────────────────────────────────────╮
│ localhost session: 799947181fe549c0973432efcf8157de          │
│ ↳ workdir: ~/workspace/`<parent>`/`<child>`                  │
│ ↳ model: gpt-4o-mini                                         │
│ ↳ provider: azure                                            │
│ ↳ approval: suggest                                          │
╰──────────────────────────────────────────────────────────────╯
user
say hello

    system
    ⚠️  OpenAI rejected the request. Error details: Status: 401, Code: 401, Type: unknown, Message: 401 Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource..
     Please verify your settings and try again.

Additional information

The composition of Azure OpenAI API URL's may be in appropriately assembled by the codex package as this pattern worked for me; while codex refused.

curl https://`<project.name>`.openai.azure.com/openai/deployments/`<deployment-id>`/chat/completions?api-version=`<api.version>` \
  -H "Content-Type: application/json" \
  -H "api-key: `<key.value>`" \
  -d '{
    "messages": [{"role": "user", "content": "Say Hello"}],
    "temperature": 0,
    "max_tokens": 50
  }'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions