Skip to main content
Use the Responses web-search tool when you want a model to retrieve fresh web context as part of a normal response workflow. Search support still depends on the selected model.

Request Shape

For normal public search workflows on this gateway, start with tools: [{"type": "web_search"}]. That simple identifying tool shape is the documented public default here.
from openai import OpenAI

client = OpenAI(
    base_url="https://api.naga.ac/v1",
    api_key="YOUR_API_KEY",
)

response = client.responses.create(
    model="gpt-4.1",
    input="Find recent reporting about AI regulation in the UK and cite your sources.",
    tools=[{"type": "web_search"}],
)

print(response.output_text)

How to read results

  • the main answer still arrives as normal output_text
  • citations can appear as annotations on the returned text parts
  • your app should inspect annotations if it needs to render sources explicitly

Citation Shape

Search citations can appear as annotations on output_text parts.
{
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "output_text",
      "text": "Reuters reports that ...",
      "annotations": [
        {
          "type": "url_citation",
          "url": "https://www.reuters.com/example"
        }
      ],
      "logprobs": []
    }
  ]
}

Streaming Behavior

  • text arrives in response.output_text.delta
  • citations can arrive in response.output_text.annotation.added
  • the stream closes with response.completed and [DONE]

Caveats

  • support still depends on the selected model and upstream provider
  • inspect annotations instead of scraping citations out of the generated text
  • use normal non-search prompting when the answer does not need fresh web context