Skip to content

ai-sdk/azure calling the wrong url path for r1 deployment #4797

Closed

Description

@sahanatvessel

Description

https://sdk.vercel.ai/providers/ai-sdk-providers/azure#chat-models

This is not always correct? Deployed R1 to azure and openai is still added to the url for some reason when using with the sdk

Code example

No response

AI provider

No response

Additional context

Image

Activity

  1. kevsjh commented on Feb 13, 2025

    @kevsjh

    Yes, im facing the same issue as well. Applying baseURL does not fix it

  2. Genzo0 commented on Feb 17, 2025

    @Genzo0

    Does anyone find the solution for this problem ?

  3. sahanatvessel commented on Mar 3, 2025

    @sahanatvessel
    Author

    @lgrammel any insights on this, please?

  4. tobiasbueschel commented on Mar 19, 2025

    @tobiasbueschel
    Contributor

    I've been having a similar issue when using a custom gateway to access Azure hosted LLMs. This is the URL that @ai-sdk/azure is creating after I've modified the baseURL, which is incorrect:

    https://{GATEWAY}.com/llama2-70b-chat/{CLIENT_ID}/v1/llama-2-70b-chat/chat/completions?api-version=2024-10-01-preview
    

    This is the actual URL I need for my gateway:

    https://{GATEWAY}.com/llama2-70b-chat/{CLIENT_ID}/v1/chat/completions
    

    I've tried using a custom fetch implementation in an attempt to correct the URL, but passing a newUrl to the return fetch call does not change where the request is sent to and is also not a great way to fix this issue:

    const llama2_70b_chat = createAzure({
      apiKey: AI_GATEWAY_KEY,
      baseURL: `https://${GATEWAY}.com/llama2-70b-chat/${CLIENT_ID}/v1`,
      fetch: async (url, options) => {
        const newUrl = url.replace("v1/llama-2-70b-chat", "v1");
        return await fetch(newUrl, options);
      },
    });

    Has anyone found a way to solve the above? Or should one use a custom provider for situation like this?

    Thanks

  5. Genzo0 commented on Mar 19, 2025

    @Genzo0

    its keep the openai completions in the url, for know i think its better to look at the other provider thats support your model

  6. aayush-kapoor commented on Jan 22, 2026

    @aayush-kapoor
    Collaborator

    Marking this as closed for now - if you face any regression or have a similar problem after migrating to the latest AI SDK version, please feel free to open a new issue (with possible reproduction)

  7. lgrammel commented on Jul 22, 2026

    @lgrammel
    Collaborator

    Identify issue type

    Identified as Bug
    Confidence: High

    Rationale

    This describes concrete incorrect request URL construction in the existing Azure provider, causing requests to target endpoints different from those configured or required.

    Evidence

    • The reporter states that @ai-sdk/azure constructs the wrong URL for an Azure-hosted R1 deployment by adding an OpenAI-specific path.
    • Another user provides concrete generated and expected URLs, showing that the SDK inserts an unwanted model/deployment segment and api-version query even when baseURL is customized.
    • Multiple commenters confirm the same behavior, and changing baseURL reportedly does not resolve it.
  8. added theissue type on Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions