You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AI Gateway doesn't supports Azure OpenAPI Responses API #399
On chat completion api, we are not able to set maxCompletionToken on a chat api, so we run into
{
"error": {
"message": "Could not finish the message because max_tokens or model output limit was reached. Please try again with higher max_tokens.",
"type": "invalid_request_error",
"param": null,
"code": null
}
}
(Note that max_tokens is not supported on GPT5 model.)
The way for it to work is to enable responses api, and call the azure no deployment specific endpoint from cloudflare server. See AI SDK code (!options.useDeploymentBasedUrls codepath)
const url = ({ path, modelId }: { path: string; modelId: string }) => {
const baseUrlPrefix =
options.baseURL ?? `https://${getResourceName()}.openai.azure.com/openai`;
let fullUrl: URL;
if (options.useDeploymentBasedUrls) {
// Use deployment-based format for compatibility with certain Azure OpenAI models
fullUrl = new URL(`${baseUrlPrefix}/deployments/${modelId}${path}`);
} else {
// Use v1 API format - no deployment ID in URL
fullUrl = new URL(`${baseUrlPrefix}/v1${path}`);
}
fullUrl.searchParams.set('api-version', apiVersion);
return fullUrl.toString();
};
Activity
[-]Cloudflare only supports Azure OpenAPI Chat API[/-][+]AI Gateway doesn't supports Azure OpenAPI Responses API[/+]tnkuehne commentedon May 10, 2026
Workaround:
fix(gateway-core): scope Azure v1 routing to the responses API
fix(ai-gateway-provider): support Azure OpenAI v1 responses routing