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

# OpenAI Chat Completions

> Server-side web search on /v1/chat/completions via the web_search_options request field.

`POST /v1/chat/completions`

Web search lives at the top level of the request body in `web_search_options` — **not** inside the `tools` array. The two are mutually exclusive: a request with both returns `400`.

## Request

```python theme={"system"}
from openai import OpenAI

client = OpenAI(base_url="https://api.abliteration.ai/v1", api_key=os.environ["ABLIT_KEY"])

resp = client.chat.completions.create(
    model="abliterated-model",
    messages=[{"role": "user", "content": "Latest SEC filings for NVDA"}],
    extra_body={
        "web_search_options": {
            "search_context_size": "medium",
            "user_location": "us-east-1",
        }
    },
)
```

## Options

| Field                 | Values                          | Effect                                                     |
| --------------------- | ------------------------------- | ---------------------------------------------------------- |
| `search_context_size` | `"low"` / `"medium"` / `"high"` | Number of results fetched (5 / 10 / 20). Default `medium`. |
| `user_location`       | string or location object       | Hint for region-relevant results                           |

## Domain restrictions

OpenAI's Chat Completions spec does not define a native per-request domain filter for `web_search_options`. Domain restrictions come from one place:

**Project-level allow/block** via Policy Gateway. If your project has `web_tools.allowed_domains` or `web_tools.blocked_domains` set, the gateway enforces them server-side on every search made through this surface.

Configure them per project in the [console](https://abliteration.ai/console) under **Project → Web tools**. If you need per-request domain filters, use the [Responses API](/capabilities/web-search/openai-responses) or [Anthropic Messages](/capabilities/web-search/anthropic-messages) surfaces.
