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
Our Azure setup uses a corporate API gateway that proxies requests to Azure OpenAI. The gateway handles routing and API versioning internally, so we don't use /v1 path segments or api-version query params on our end. We're using @ai-sdk/azure within OpenCode.
When we configure createAzure({ baseURL: "https://our-gateway.example.com/azure" }), the provider constructs https://our-gateway.example.com/azure/v1/chat/completions?api-version=.... Both the /v1 and the api-version param break our gateway, so we've been carrying a local patch to @ai-sdk/azure to work around it.
Could we submit a PR that adds a baseURL branch to skip both? Something like:
if (options.useDeploymentBasedUrls) {
fullUrl = new URL(`${baseUrlPrefix}/deployments/${modelId}${path}`);
+ } else if (options.baseURL) {+ fullUrl = new URL(`${baseUrlPrefix}${path}`);
} else {
fullUrl = new URL(`${baseUrlPrefix}/v1${path}`);
}
- fullUrl.searchParams.set('api-version', apiVersion);+ if (!options.baseURL) {+ fullUrl.searchParams.set('api-version', apiVersion);+ }
The idea is: if someone explicitly provides a baseURL, they probably want full control over the URL shape. Happy to adjust the approach if there's a preferred way to handle this.
For context, this is related to #7372 — that issue led to the useDeploymentBasedUrls flag, which handles one URL variant. Our case is another variant in the same if/else chain: when baseURL is set, the caller likely wants the URL used as-is without /v1 or api-version appended.
{
"evidence": [
"Configuring `createAzure({ baseURL: \"https://our-gateway.example.com/azure\" })` results in URLs with `/v1/chat/completions?api-version=...` appended.",
"The reporter says both the `/v1` path segment and `api-version` query parameter break their corporate Azure OpenAI gateway.",
"They propose changing `baseURL` handling so explicitly provided base URLs are used without adding `/v1` or `api-version`."
],
"rationale": "The issue describes current `@ai-sdk/azure` URL construction producing a URL shape that breaks a configured custom gateway, i.e. existing behavior is incorrect for the reported configuration. Although a fix is suggested, the primary report is a concrete failure.",
"type": "bug",
"confidence": "medium"
}
Created and ran reproduction script packages/azure/reproductions/issue-13956.mjs with node packages/azure/reproductions/issue-13956.mjs; it observed https://our-gateway.example.com/azure/v1/chat/completions?api-version=v1 instead of the expected custom gateway URL without /v1 or api-version, failing the assertion.
Activity
Dulani commentedon Mar 31, 2026
For context, this is related to #7372 — that issue led to the
useDeploymentBasedUrlsflag, which handles one URL variant. Our case is another variant in the sameif/elsechain: whenbaseURLis set, the caller likely wants the URL used as-is without/v1orapi-versionappended.fix(azure): skip /v1 and api-version when baseURL is provided
fix(azure): skip /v1 and api-version when baseURL is provided
lgrammel commentedon Jul 2, 2026
Identify issue type
{ "evidence": [ "Configuring `createAzure({ baseURL: \"https://our-gateway.example.com/azure\" })` results in URLs with `/v1/chat/completions?api-version=...` appended.", "The reporter says both the `/v1` path segment and `api-version` query parameter break their corporate Azure OpenAI gateway.", "They propose changing `baseURL` handling so explicitly provided base URLs are used without adding `/v1` or `api-version`." ], "rationale": "The issue describes current `@ai-sdk/azure` URL construction producing a URL shape that breaks a configured custom gateway, i.e. existing behavior is incorrect for the reported configuration. Although a fix is suggested, the primary report is a concrete failure.", "type": "bug", "confidence": "medium" }lgrammel commentedon Jul 2, 2026
Bug Reproduction
Bug was reproduced.
Created and ran reproduction script packages/azure/reproductions/issue-13956.mjs with
node packages/azure/reproductions/issue-13956.mjs; it observedhttps://our-gateway.example.com/azure/v1/chat/completions?api-version=v1instead of the expected custom gateway URL without/v1orapi-version, failing the assertion.Branch:
bug-reproduction/13956-1fix(azure): use custom base urls if provided (#16649)
fix(azure): use custom base urls if provided (#16649)
github-actions commentedon Jul 2, 2026
🚀 Published in:
ai@ai-sdk/alibaba@ai-sdk/amazon-bedrock@ai-sdk/angular@ai-sdk/anthropic@ai-sdk/assemblyai@ai-sdk/azure@ai-sdk/baseten@ai-sdk/black-forest-labs@ai-sdk/bytedance@ai-sdk/cerebras@ai-sdk/cohere@ai-sdk/deepgram@ai-sdk/deepinfra@ai-sdk/deepseek@ai-sdk/devtools@ai-sdk/elevenlabs@ai-sdk/fal@ai-sdk/fireworks@ai-sdk/gateway@ai-sdk/gladia@ai-sdk/google@ai-sdk/google-vertex@ai-sdk/groq@ai-sdk/harness@ai-sdk/harness-claude-code@ai-sdk/harness-codex@ai-sdk/harness-deepagents@ai-sdk/harness-opencode@ai-sdk/harness-pi@ai-sdk/huggingface@ai-sdk/hume@ai-sdk/klingai@ai-sdk/langchain@ai-sdk/llamaindex@ai-sdk/lmnt@ai-sdk/luma@ai-sdk/mcp@ai-sdk/mistral@ai-sdk/moonshotai@ai-sdk/open-responses@ai-sdk/openai@ai-sdk/openai-compatible@ai-sdk/otel@ai-sdk/perplexity@ai-sdk/policy-opa@ai-sdk/prodia@ai-sdk/provider@ai-sdk/provider-utils@ai-sdk/quiverai@ai-sdk/react@ai-sdk/replicate@ai-sdk/revai@ai-sdk/rsc@ai-sdk/sandbox-just-bash@ai-sdk/sandbox-vercel@ai-sdk/svelte@ai-sdk/togetherai@ai-sdk/tui@ai-sdk/valibot@ai-sdk/vercel@ai-sdk/voyage@ai-sdk/vue@ai-sdk/workflow@ai-sdk/workflow-harness@ai-sdk/xai