Skip to content

Azure OpenAI: api-version must be query param, not header — runtime sends as header causing 404 #46676

@samassistantnouv-sudo

Description

@samassistantnouv-sudo

Bug Report

Version: 2026.3.13

Problem

Azure OpenAI requires api-version as a URL query parameter, not an HTTP header. The OpenClaw runtime sends it as a header, which causes Azure to return 404 Resource not found for all requests.

Root Cause

The runtime builds the request URL as:

${baseUrl}/chat/completions

…with api-version passed in the headers object. Azure ignores it there and returns 404.

Verified: all three header variants fail:

  • api-version: 2024-12-01-preview (header) → 404
  • x-ms-version: 2024-12-01-preview → 404
  • openai-version: 2024-12-01-preview → 404

The only working form:

https://<resource>.openai.azure.com/openai/deployments/<model>/chat/completions?api-version=2024-12-01-preview

Note: The onboarding probe correctly injects api-version as a query param (in onboard-custom-*.js), so onboarding succeeds — but the runtime doesn't do the same injection.

Config (openclaw.json)

"azure-gpt53-chat": {
  "baseUrl": "https://executive-assistant-resource.openai.azure.com/openai/deployments/gpt-5.3-chat",
  "api": "openai-completions",
  "headers": {
    "api-version": "2024-12-01-preview",
    "api-key": "<key>"
  }
}

Workaround

None available in current config schema — there is no queryParams field in ModelProviderSchema.

Suggested Fix

Option 1: Detect Azure URLs (hostname ends with .openai.azure.com) and auto-inject api-version header value as a query param at request time.

Option 2: Add a queryParams field to ModelProviderSchema for arbitrary query param injection.

Option 3: Document that users should include ?api-version= in the baseUrl and change the URL construction to handle query strings correctly when appending /chat/completions (e.g. use URL constructor instead of string concat).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions