WebSearch API not working anymore - Cannot force Websearch

I cannot web search or force web search anymore. I tried so many ways, including forcing the web search through system prompts, but still nothing. Other than the prompts provided in the documentation, none of the other prompts (almost 99%) return citation results.

Here is some of the code I have tried. Im trying to force web search as I need citations everytime I run a prompt.

  1. chat_completions
from openai import OpenAI
client = OpenAI()

completion = client.chat.completions.create(
    model="gpt-4o-search-preview",
    web_search_options={
        "search_context_size": "low",
    },
    messages=[{
        "role": "user",
        "content": "top 10 best earbuds for running in 2025",
    }],
)
print(completion.choices[0])
  1. Force web search using system_prompt
from openai import OpenAI
client = OpenAI()

system_prompt = "For whatever query the user provides, you must and will use the web search online to find the most relevant information."
user_prompt = "what are movies are currently in theaters"

completion = client.chat.completions.create(
    model="gpt-4o-mini-search-preview",
    messages=[
    {"role": "system", "content": system_prompt},
    {"role": "user", "content": user_prompt}
],
web_search_options={
    "search_context_size": "high",
},
)
print(completion.choices[0])
  1. Response
from openai import OpenAI
client = OpenAI()

response = client.responses.create(
    model="gpt-4.1",
    tools=[{
        "type": "web_search_preview",
        "search_context_size": "high",
    }],
    input="top 10 best earbuds for running in 2025",
)
print(response)
  1. Response again
from openai import OpenAI
client = OpenAI()

response = client.responses.create(
    model="gpt-4.1",
    tools=[{
        "type": "web_search_preview",
        "user_location": {
            "type": "approximate",
            "country": "US",
            "city": "",
            "region": "",
        }
    }],
    input="top 10 best slipper for kayaking and rock climbing",
)
print(response)
  1. Response with tool choice
from openai import OpenAI
client = OpenAI()

response = client.responses.create(
    model="gpt-4.1",
    tools=[{"type": "web_search_preview"}],
    tool_choice={"type": "web_search_preview"},
    input="What was a positive news story from today?"
)

print(response)
1 Like

I have the same problem. We want to use this tool in production, so it’s really not good it stopped working… Did anyone encounter this issue in the past?

I just tried and it is working for me, but it might be a specific condition.

Have you tried in playground if it works?

Nope, I dont think its a specific condition. It doesnt work for me as well. Works in playground, but I literally copied the code from playground and executed the same query, it doesnt work. Something’s wrong

Could you check if your openai package is updated?

pip install --upgrade openai

You can also try running with curl in your local command prompt.

On windows you can paste this, or copy the curl version in the playground:

curl https://api.openai.com/v1/responses ^
  -H "Content-Type: application/json" ^
  -H "Authorization: Bearer %OPENAI_API_KEY%" ^
  -d "{\"model\": \"gpt-4.1\", \"tools\": [{ \"type\": \"web_search_preview\" }], \"input\": \"What is the papal conclave status?\"}"

You may need to set your environment first:

set OPENAI_API_KEY=your_key

If it runs with curl locally, then it is probably something with your code (check your venv or update packages).

1 Like

I have the same issue and it worked last Wednesday. We used gpt-4o-search-preview. The venv wasn’t changed. Tried to upgrade the sdk and it still doesn’t work. The curl with my data still doesn’t work. It answers but it doesn’t give the annotation. For example, {"model": "gpt-4o", "tools": [{ "type": "web_search_preview" }], "input": "careers at lifebrdige. Answer just from https://www.lifebridgehealth.org"} doesn’t work.

I have the same issue, only recently started to not work. In the playground, it seems to be “Searching the web…” but then it’s response isn’t based at all on anything from the web and includes no annotations. Doesn’t work in curl or code either, but it does work in the normal chatgpt UI.
@OpenAI_Support Can you fix this?

I just tested the web search preview tool and found that it was working both on Chat Completions and Responses API.

Here’s the responses for your command. I upgraded the openai python package as well to the latest. I ran many times, only the prompt you gave works. Likewise, only the prompt listed in OpenAI docs works. None of the other prompts work, rarely even if. @OpenAI_Support please take a look into this ASAP as its a critical feature for production

Response 1
Prompt: What is the papal conclave status?

{
  "id": "resp_68178a0a5f44819185fe64e0657273d909a1be076849ad39",
  "object": "response",
  "created_at": 1746373130,
  "status": "completed",
  "error": null,
  "incomplete_details": null,
  "instructions": null,
  "max_output_tokens": null,
  "model": "gpt-4.1-2025-04-14",
  "output": [
    {
      "id": "ws_68178a0b334481919fec913d435cf95709a1be076849ad39",
      "type": "web_search_call",
      "status": "completed"
    },
    {
      "id": "msg_68178a0e278c8191b84609a9ecbea18709a1be076849ad39",
      "type": "message",
      "status": "completed",
      "content": [
        {
          "type": "output_text",
          "annotations": [
            {
              "type": "url_citation",
              "end_index": 1951,
              "start_index": 1681,
              "title": "Un c\u00f3nclave sumido en el desconcierto y abierto a la sorpresa: ning\u00fan bando tiene un candidato claro",
              "url": "https://elpais.com/internacional/2025-05-04/un-conclave-sumido-en-el-desconcierto-y-abierto-a-la-sorpresa-ningun-bando-tiene-un-candidato-claro.html?utm_source=openai"
            },
            {
              "type": "url_citation",
              "end_index": 2132,
              "start_index": 1954,
              "title": "Guatemala's cardinal trusts migration will be a priority for next pope as he readies for conclave",
              "url": "https://apnews.com/article/45353f5805bf237dd1428aef04b287c8?utm_source=openai"
            },
            {
              "type": "url_citation",
              "end_index": 2329,
              "start_index": 2135,
              "title": "Sistine Chapel's conclave preparations leave tourists shut out",
              "url": "https://www.reuters.com/world/europe/sistine-chapels-conclave-preparations-leave-tourists-shut-out-2025-04-28/?utm_source=openai"
            }
          ],
          "text": "As of May 4, 2025, the Holy See is in a period of *sede vacante* following the death of Pope Francis on April 21, 2025. The papal conclave to elect his successor is scheduled to commence on May 7, 2025, in the Sistine Chapel. \n\n**Conclave Details:**\n\n- **Participants:** The College of Cardinals currently comprises 135 eligible electors under the age of 80. However, two cardinals have announced they will not attend, reducing the expected number of participants to 133. \n\n- **Diversity:** This conclave is notable for its diversity, with cardinals from 71 countries, reflecting the global nature of the Church. \n\n**Current Status:**\n\n- **Preparations:** The Sistine Chapel has been closed to the public since April 28 to facilitate preparations for the conclave. \n\n- **Candidate Landscape:** Unlike previous conclaves, there is no clear frontrunner. The traditional conservative and progressive blocs lack consensus on a candidate, leading to an atmosphere of uncertainty and the potential for unexpected outcomes. \n\n**Recent Developments:**\n\n- **Cardinal Ramazzini's Perspective:** Cardinal \u00c1lvaro Ramazzini of Guatemala emphasizes the importance of continuing Pope Francis' legacy, particularly regarding the Church's commitment to supporting migrants. \n\n- **Controversy:** President Donald Trump faced criticism for posting an AI-generated image of himself dressed as the pope, which many viewed as disrespectful during the mourning period for Pope Francis. \n\nThe conclave is set to begin on May 7, and until then, the Church remains in a period of transition, with the College of Cardinals preparing to elect the next pope.\n\n\n## Key Updates on the Upcoming Papal Conclave:\n- [Un c\u00f3nclave sumido en el desconcierto y abierto a la sorpresa: ning\u00fan bando tiene un candidato claro](https://elpais.com/internacional/2025-05-04/un-conclave-sumido-en-el-desconcierto-y-abierto-a-la-sorpresa-ningun-bando-tiene-un-candidato-claro.html?utm_source=openai)\n- [Guatemala's cardinal trusts migration will be a priority for next pope as he readies for conclave](https://apnews.com/article/45353f5805bf237dd1428aef04b287c8?utm_source=openai)\n- [Sistine Chapel's conclave preparations leave tourists shut out](https://www.reuters.com/world/europe/sistine-chapels-conclave-preparations-leave-tourists-shut-out-2025-04-28/?utm_source=openai) "
        }
      ],
      "role": "assistant"
    }
  ],
  "parallel_tool_calls": true,
  "previous_response_id": null,
  "reasoning": {
    "effort": null,
    "summary": null
  },
  "service_tier": "default",
  "store": true,
  "temperature": 1.0,
  "text": {
    "format": {
      "type": "text"
    }
  },
  "tool_choice": "auto",
  "tools": [
    {
      "type": "web_search_preview",
      "search_context_size": "medium",
      "user_location": {
        "type": "approximate",
        "city": null,
        "country": "US",
        "region": null,
        "timezone": null
      }
    }
  ],
  "top_p": 1.0,
  "truncation": "disabled",
  "usage": {
    "input_tokens": 310,
    "input_tokens_details": {
      "cached_tokens": 0
    },
    "output_tokens": 565,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 875
  },
  "user": null,
  "metadata": {}
}

Response 2

prompt: What are movies currently in theatre?

{
  "id": "resp_6817897109c48191bada678923489a1",
  "object": "response",
  "created_at": 1746372977,
  "status": "completed",
  "error": null,
  "incomplete_details": null,
  "instructions": null,
  "max_output_tokens": null,
  "model": "gpt-4.1-2025-04-14",
  "output": [
    {
      "id": "ws_6817897184fc8191b1b153f6b8e6cbd403127678923489a1",
      "type": "web_search_call",
      "status": "completed"
    },
    {
      "id": "msg_681789747c688191aaa1f4a401c9d4b603127678923489a1",
      "type": "message",
      "status": "completed",
      "content": [
        {
          "type": "output_text",
          "annotations": [],
          "text": "As of May 4, 2025, several notable films are playing in theaters across the United States. Here's a selection of current releases:\n\n\n\n**Captain America: Brave New World**  \nAnthony Mackie stars as Sam Wilson, the new Captain America, investigating a conspiracy involving U.S. President Thaddeus Ross, portrayed by Harrison Ford. Released on February 14, 2025, the film has grossed over $414 million worldwide. \n\n\n\n\n**Mickey 17**  \nDirected by Bong Joon Ho and starring Robert Pattinson, this science fiction black comedy follows a man who joins a space colony as an 'Expendable,' a disposable worker who gets cloned every time he dies. Released on March 7, 2025, the film has received generally positive reviews. \n\n\n\n\n**Sinners**  \nA horror film directed by Ryan Coogler, featuring Michael B. Jordan in dual roles as twin brothers confronting a supernatural evil in 1932 Mississippi. Released on April 18, 2025, it has been praised for its direction and performances. \n\n\n\n\n**Thunderbolts**  \nMarvel's latest superhero ensemble film, released on May 2, 2025, brings together a team of antiheroes for covert missions. The cast includes Florence Pugh, David Harbour, and Sebastian Stan. \n\n\n\n\n**Hurry Up Tomorrow**  \nA psychological drama directed by Trey Edward Shults, starring Abel Tesfaye (The Weeknd), Jenna Ortega, and Barry Keoghan. The film follows a musician tormented by insomnia who embarks on an unexpected journey with a mysterious stranger. Scheduled for release on May 16, 2025. \n\n\nPlease note that movie availability can vary by location. For the most accurate and up-to-date information on showtimes and theater locations, it's recommended to check with local theaters or online ticketing platforms. "
        }
      ],
      "role": "assistant"
    }
  ],
  "parallel_tool_calls": true,
  "previous_response_id": null,
  "reasoning": {
    "effort": null,
    "summary": null
  },
  "service_tier": "default",
  "store": true,
  "temperature": 1.0,
  "text": {
    "format": {
      "type": "text"
    }
  },
  "tool_choice": "auto",
  "tools": [
    {
      "type": "web_search_preview",
      "search_context_size": "medium",
      "user_location": {
        "type": "approximate",
        "city": null,
        "country": "US",
        "region": null,
        "timezone": null
      }
    }
  ],
  "top_p": 1.0,
  "truncation": "disabled",
  "usage": {
    "input_tokens": 308,
    "input_tokens_details": {
      "cached_tokens": 0
    },
    "output_tokens": 392,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 700
  },
  "user": null,
  "metadata": {}
}%                                                                                                                                                                                              

Response 4
Prompt: top 10 running shoes of 2025

{
  "id": "resp_68178a30823081918bbfd604f56c81ab002bfc5c616d2b8f",
  "object": "response",
  "created_at": 1746373168,
  "status": "completed",
  "error": null,
  "incomplete_details": null,
  "instructions": null,
  "max_output_tokens": null,
  "model": "gpt-4.1-2025-04-14",
  "output": [
    {
      "id": "ws_68178a30fe948191bc422f27b627ba6d002bfc5c616d2b8f",
      "type": "web_search_call",
      "status": "completed"
    },
    {
      "id": "msg_68178a343a488191bf2264d038aa005f002bfc5c616d2b8f",
      "type": "message",
      "status": "completed",
      "content": [
        {
          "type": "output_text",
          "annotations": [],
          "text": "As of May 2025, the running shoe market offers a variety of models catering to different preferences and running styles. Here are ten top-rated running shoes that have garnered attention for their performance, comfort, and innovation:\n\n\n\n**Nike Alphafly 3**  \nDesigned for marathon speed, the Alphafly 3 features a carbon fiber plate, Air Zoom units, and a ZoomX foam midsole, providing propulsion and cushioning for long-distance runners. \n\n\n\n\n**Adidas Adizero Adios Pro Evo 2**  \nAimed at elite runners, this lightweight shoe incorporates increased Lightstrike Pro foam for enhanced energy return and a redesigned outsole for improved grip, making it ideal for competitive racing. \n\n\n\n\n**ASICS Novablast 4**  \nKnown for its FlyteFoam Blast technology, the Novablast 4 offers responsive cushioning and a breathable upper, making it suitable for daily training and long runs. \n\n\n\n\n**Brooks Ghost 16**  \nFeaturing nitrogen-infused DNA Loft v3 cushioning and a 3D Fit Print upper, the Ghost 16 provides a balanced ride with a secure fit, appealing to runners seeking comfort and support. \n\n\n\n\n**Hoka Clifton 9**  \nThis model offers a lightweight design with an EVA midsole, delivering a cushioned ride without added weight, making it a favorite among neutral runners. \n\n\n\n\n**New Balance Fresh Foam X 1080 v13**  \nWith its soft and responsive Fresh Foam X cushioning, this shoe is ideal for long-distance runners seeking comfort during extended runs. \n\n\n\n\n**Saucony Triumph 22**  \nUtilizing PWRRUN+ foam, the Triumph 22 provides plush cushioning and a smooth ride, suitable for runners who prioritize comfort over long distances. \n\n\n\n\n**Nike ZoomX Vaporfly Next% 3**  \nBuilt for speed, this shoe features ZoomX foam and a carbon-fiber plate, offering exceptional energy return and responsiveness for competitive runners. \n\n\n\n\n**Saucony Endorphin Speed 4**  \nA versatile, budget-friendly speed training shoe, the Endorphin Speed 4 features PWRRUN PB foam and a flexible nylon plate, delivering a smooth, propulsive ride without sacrificing comfort. \n\n\n\n\n**On Cloudsurfer 7**  \nKnown for its balanced and versatile performance, the Cloudsurfer 7 offers a rolling, snappy, and responsive ride, making it suitable for various running activities. \n\n\nThese models represent a selection of the top running shoes available in 2025, each offering unique features to cater to various running needs and preferences. "
        }
      ],
      "role": "assistant"
    }
  ],
  "parallel_tool_calls": true,
  "previous_response_id": null,
  "reasoning": {
    "effort": null,
    "summary": null
  },
  "service_tier": "default",
  "store": true,
  "temperature": 1.0,
  "text": {
    "format": {
      "type": "text"
    }
  },
  "tool_choice": "auto",
  "tools": [
    {
      "type": "web_search_preview",
      "search_context_size": "medium",
      "user_location": {
        "type": "approximate",
        "city": null,
        "country": "US",
        "region": null,
        "timezone": null
      }
    }
  ],
  "top_p": 1.0,
  "truncation": "disabled",
  "usage": {
    "input_tokens": 310,
    "input_tokens_details": {
      "cached_tokens": 0
    },
    "output_tokens": 532,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 842
  },
  "user": null,
  "metadata": {}
}%                                                                                                                                                                                              

That’s weird, if curl works it should in python too.

Try executing this in your IDE:

import openai
print(openai.__version__)

The output should be 1.77.0

Thats right, Mine’s the latest.

Python 3.13.3 (main, Jun 20 2023, 17:23:00) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import openai
>>> print(openai.__version__)
1.77.0
>>> 

And that should make searching pretty much unstoppable. With that model, only available on chat completions, you get a text injection from search outside of a tool call placement. It may still have a quality of needing purpose behind the search.

A Prompts Playground preset: https://platform.openai.com/playground/p/DsWQjwpZjYue3e6oRP6AfRwd?mode=chat

Confirmation:

Note that location was filled out.

web_search_options={
    "search_context_size": "high",
    "user_location": {
      "type": "approximate",
      "approximate": {
        "country": "US",
        "region": "New York",
        "city": "New York"
      }
    }
  }
1 Like

broken for me too. Basic search returns no websearch results ResponseOutputText(annotations=[], ...

It seems the concern is with the AI not producing citations.

Perhaps is not broken necessarily, but that OpenAI found an undesired use pattern, and doesn’t instruct the model in the same way on writing them.

I add:

Producing markdown URL web citations for every result is mandatory.

Then after what is basically “Bing that looks like AI” out of your control, some footnotes with links as a product:

I could look back at older tool context dumps to see what the AI must actually produce as citation and annotation trigger, the Japanese bracket curlies, and re-instruct, but meh.

I am also getting this problem. My Python request looks like this:

search_resp = await openai_client.responses.create(
    model=model.value,
    tools=[
        {
            "type": "web_search_preview",
            "search_context_size": config.model_search_context_size.value,
        }
    ],
    input=prompt,
)

The “annotations” in the API response are empty. The UI dashboard does indicate that it ran a web search. Is the model actually running a web search but just not returning the annotations/citations, or is it just recalling from memory?

Our production system relies on OpenAI actually searching the web to find facts that ground the answers.

2 Likes

Just an update on this thread: The citations are back :slight_smile: Hell yeah baby! :smiley: Its working well and good. All the requests now come back with citations even on search_context_size low

1 Like

I can confirm it also works for us now. @OpenAI_Support Were you aware of the issue? Is there a PIR?

It seems for me that every day only the first two trys get a response with annotations. Does anyone has the same situation or has any ideas?