> ## Documentation Index
> Fetch the complete documentation index at: https://docs.naga.ac/llms.txt
> Use this file to discover all available pages before exploring further.

# Web Search

> Understand where search-capable requests fit into the Responses API workflow.

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.

<CodeGroup>
  ```python Python theme={null}
  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)
  ```

  ```javascript Node.js theme={null}
  import OpenAI from 'openai';

  const client = new OpenAI({
    baseURL: 'https://api.naga.ac/v1',
    apiKey: 'YOUR_API_KEY',
  });

  const response = await 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' }],
  });

  console.log(response.output_text);
  ```

  ```bash cURL theme={null}
  curl https://api.naga.ac/v1/responses \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gpt-4.1",
      "input": "Find recent reporting about AI regulation in the UK and cite your sources.",
      "tools": [
        {
          "type": "web_search"
        }
      ]
    }'
  ```
</CodeGroup>

## 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.

```json theme={null}
{
  "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

## Related Docs

* [Capability-level Web Search](/build/web-search)
* [Responses API](/api/responses)
* [Create response reference](/api-reference/endpoints/responses/create)
