Skip to content

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

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

fix(ai-gateway-provider): support Azure OpenAI v1 responses routing#604
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

🦋 Changeset detected

Latest commit: c0b4038

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
ai-gateway-provider Patch
workers-ai-provider Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@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
@hith3sh hith3sh force-pushed the codex/fix-azure-responses-routing branch from ac9416b to c0b4038 Compare July 7, 2026 03:54
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

1 participant