Description
When configuring an Azure OpenAI provider with api: "openai-completions", the gateway returns HTTP 404: Resource not found because the underlying pi-ai library uses the standard OpenAI SDK client which doesn't append the required ?api-version= query parameter for Azure cognitiveservices endpoints.
Steps to Reproduce
- Configure
openclaw.json with an Azure OpenAI provider:
{
"models": {
"providers": {
"azure-openai": {
"baseUrl": "https://{resource}.cognitiveservices.azure.com/openai",
"api": "openai-completions",
"headers": { "api-key": "${AZURE_OPENAI_API_KEY}" },
"models": [{
"id": "model-router",
"api": "openai-completions"
}]
}
}
}
}
- Send a message via the agent
- Get
HTTP 404: Resource not found
Root Cause
The openai-completions provider in @mariozechner/pi-ai uses the standard OpenAI client which constructs:
.../openai/deployments/{model}/chat/completions
But Azure requires:
.../openai/deployments/{model}/chat/completions?api-version=2025-01-01-preview
Note: openai-responses API type already has dedicated Azure support via azure-openai-responses.js, but the Responses API is not available on all Azure deployments (e.g., model-router).
Fix
Upstream PR submitted to pi-mono: earendil-works/pi#2525
Workaround: Apply a post-install patch in the Dockerfile to use AzureOpenAI SDK client for Azure providers in the openai-completions provider.
Environment
- OpenClaw 2026.3.14
@mariozechner/pi-ai 0.61.1
- Azure OpenAI (cognitiveservices) with model-router deployment
Description
When configuring an Azure OpenAI provider with
api: "openai-completions", the gateway returnsHTTP 404: Resource not foundbecause the underlyingpi-ailibrary uses the standardOpenAISDK client which doesn't append the required?api-version=query parameter for Azure cognitiveservices endpoints.Steps to Reproduce
openclaw.jsonwith an Azure OpenAI provider:{ "models": { "providers": { "azure-openai": { "baseUrl": "https://{resource}.cognitiveservices.azure.com/openai", "api": "openai-completions", "headers": { "api-key": "${AZURE_OPENAI_API_KEY}" }, "models": [{ "id": "model-router", "api": "openai-completions" }] } } } }HTTP 404: Resource not foundRoot Cause
The
openai-completionsprovider in@mariozechner/pi-aiuses the standardOpenAIclient which constructs:But Azure requires:
Note:
openai-responsesAPI type already has dedicated Azure support viaazure-openai-responses.js, but the Responses API is not available on all Azure deployments (e.g., model-router).Fix
Upstream PR submitted to pi-mono: earendil-works/pi#2525
Workaround: Apply a post-install patch in the Dockerfile to use
AzureOpenAISDK client for Azure providers in theopenai-completionsprovider.Environment
@mariozechner/pi-ai0.61.1