How to use Responses API on Azure?

It is VMS 100 Reputation points
2025-06-20T16:35:18.55+00:00

I would like to use Responses API with a file search function.

See https://learn.microsoft.com/en-us/answers/questions/2285762/how-to-deploy-a-responses-api-on-azure-ai-foundry?page=1&orderby=Helpful&comment=answer-2063332&translated=false#newest-answer-comment for info

Here's what I have done so far. Deployed gpt-4o-mini on EastUS2, both support the responses API. A REST call to https://resourcename.openai.azure.com/openai/deployments/deplymentName/chat/completions?api-version=2025-01-01-preview with the API key in header works. Great

But a call to https://your-resource-name.openai.azure.com/openai/v1/responses?api-version=preview with the same resource name as the previous one gives an error :-(

I get the following (400 server error)

                    [code] => BadRequest
                    [message] => API version not supported

What am i doing wrong? How do I call the Response API for REST ?

Thanks!

Update:

I deployed gpt-4o and when I send the same request but with gpt-4o as the model to be used, i get a different error! ( a 500 server error)

                    [code] => BackendNotSet
                    [message] => The API backend for the resource is not properly set.
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
4,080 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Manas Mohanty 5,620 Reputation points Microsoft External Staff Moderator
    2025-06-20T19:47:47.3133333+00:00

    Hi It is VMS

    I am able to do file search with response api with below code after declaring the vector store id copied from vector store tab in Azure AI foundry

    Sample code that worked with OpenAI version = 1.77

    from openai import OpenAI
    client = OpenAI(
        api_key="<apikey>",
        base_url="https://<youropeniresourcename>.openai.azure.com/openai/v1/",
        default_query={"api-version": "preview"},
    )
    input=[{"role": "user", "content": "Summarize the uploaded file"}]
    second_response = client.responses.create(
        model="gpt-4o-mini",
        input=input,
        tools=[{
            "type": "file_search",
            "vector_store_ids": ["vs_8HEzmBLsCImwxe33m2rk7AYf"], #replace it with your vector store id
        }]
    )
    
    for i in second_response.output:
        if i.type == "message":
            print(i.content[0].text)
    

    Results

    The uploaded document is a sample IEEE format paper titled "Distance Direction Extraction in Geospatial Text." Here are the main points:
    
    - **Authors**: John Doe, Jane Smith
    - **Abstract**: The paper introduces a method for extracting directional and distance information from geospatial expressions.
    - **Introduction**: It highlights the importance of extracting expressions like '.14 Miles E' for spatial analysis in mapping datasets.
    - **Methodology**: The focus is on identifying patterns where distance is followed by a directional abbreviation.
    - **Results**: The model successfully extracted various geospatial expressions, such as .14 Miles E and .25 Miles W.
    - **Conclusion**: The paper serves as a mock example to demonstrate how data can be formatted for training extraction models.
    
    
    

    Please let us know if you it is a working solution for you.

    Thank you.

    0 comments No comments

  2. It is VMS 100 Reputation points
    2025-06-21T04:05:33.8333333+00:00

    I figured it out. I hope they make the documentation a lot more clearer!!!!

    What i did:

    Created a new project on the AI Foundry

    Deployed gpt-40, the oldest version i could find

    Removed any other model in that project

    & just called the Responses API. Voila! It worked!!!

    Responses API doesn't necessarily support the latest versions of the gpt models. They could mention it explicitly in the document. It can save time for a lot of folks as it isn't very evident!


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.