fix(ai-gateway-provider): support Azure OpenAI v1 responses routing by hith3sh · Pull Request #604 · cloudflare/ai · GitHub
Skip to content

fix(ai-gateway-provider): support Azure OpenAI v1 responses routing - #604

Closed
hith3sh wants to merge 1 commit into
cloudflare:mainfrom
hith3sh:codex/fix-azure-responses-routing
Closed

hith3sh wants to merge 1 commit into
cloudflare:mainfrom
hith3sh:codex/fix-azure-responses-routing

Conversation

@hith3sh

@hith3sh hith3sh commented Jul 6, 2026 •

Copy link
Copy Markdown

Summary

  • add Azure OpenAI v1 Responses API URL support to the shared gateway provider matcher
  • keep deployment-based Azure routing unchanged while mapping /openai/v1/responses... requests to the gateway's azure-openai endpoint shape ({resource}/openai/responses..., Azure's non-deployment Responses route)
  • deliberately scoped to responses: other v1 paths (chat, embeddings) have no non-deployment Azure route to map to, so they stay unmatched (clear "provider not supported" error) instead of routing to an endpoint that 404s at Azure — a negative test locks this in
  • add endpoint coverage plus a request-shaping test for createAzure(...).responses(...)
  • changeset covers both ai-gateway-provider and workers-ai-provider, which share the matcher via gateway-core

Why

  • ai-gateway-provider could already route deployment-based Azure URLs
  • Azure Responses API models created with useDeploymentBasedUrls: false generate URLs like https://<resource>.openai.azure.com/openai/v1/responses?...
  • those URLs were not recognized, so wrapped Azure responses models failed with provider "azure.responses" is currently not supported

Validation

  • pnpm exec vitest run packages/ai-gateway-provider/test/endpoint.test.ts packages/ai-gateway-provider/test/request-shaping.test.ts packages/gateway-core/test/gateway-providers.test.ts packages/workers-ai-provider/test/gateway-providers.test.ts

Closes #399

@changeset-bot

changeset-bot Bot commented Jul 6, 2026 •

Copy link
Copy Markdown

@hith3sh
hith3sh marked this pull request as ready for review July 6, 2026 13:41
Azure Responses API models created with useDeploymentBasedUrls: false
generate URLs like https://<resource>.openai.azure.com/openai/v1/responses,
which the shared gateway provider matcher did not recognize, so wrapped
Azure responses models failed with 'provider "azure.responses" is
currently not supported'.

Map /openai/v1/responses... to the gateway's azure-openai endpoint shape
({resource}/openai/responses..., Azure's non-deployment Responses route)
while keeping deployment-based routing unchanged. The match is deliberately
scoped to responses: other v1 paths (chat, embeddings) have no
non-deployment Azure route, so they stay unmatched with a clear error
instead of routing to an endpoint that 404s at Azure.

Changeset covers ai-gateway-provider and workers-ai-provider, which share
the matcher via gateway-core.

Closes cloudflare#399
@mattzcarey

mattzcarey commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

@mattzcarey mattzcarey closed this Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AI Gateway doesn't supports Azure OpenAPI Responses API

2 participants