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

# ChatWebSearchShorthand - TypeScript SDK

> ChatWebSearchShorthand type definition

<Warning>
  The TypeScript SDK and docs are currently in beta.
  Report issues on [GitHub](https://github.com/OpenRouterTeam/typescript-sdk/issues).
</Warning>

Web search tool using OpenAI Responses API syntax. Automatically converted to openrouter:web\_search.

## Example Usage

```typescript lines theme={null}
import { ChatWebSearchShorthand } from "@openrouter/sdk/models";

let value: ChatWebSearchShorthand = {
  type: "web_search_2025_08_26",
};
```

## Fields

| Field               | Type                                                                                                                 | Required             | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                 | Example                                                                                                                    |
| ------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| `allowedDomains`    | *string*\[]                                                                                                          | :heavy\_minus\_sign: | Limit search results to these domains. Supported by Exa, Firecrawl, Parallel, and most native providers (Anthropic, OpenAI, xAI). Not supported with Perplexity. Cannot be used with excluded\_domains.                                                                                                                                                                                                                                                     |                                                                                                                            |
| `engine`            | [models.WebSearchEngineEnum](/agent-sdk/typescript/api-reference/models/websearchengineenum)                         | :heavy\_minus\_sign: | Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search. "exa" forces the Exa search API. "firecrawl" uses Firecrawl (requires BYOK). "parallel" uses the Parallel search API.                                                                                                                                                                                  | auto                                                                                                                       |
| `excludedDomains`   | *string*\[]                                                                                                          | :heavy\_minus\_sign: | Exclude search results from these domains. Supported by Exa, Firecrawl, Parallel, Anthropic, and xAI. Not supported with OpenAI (silently ignored) or Perplexity. Cannot be used with allowed\_domains.                                                                                                                                                                                                                                                     |                                                                                                                            |
| `maxResults`        | *number*                                                                                                             | :heavy\_minus\_sign: | Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, and Parallel engines; ignored with native provider search.                                                                                                                                                                                                                                                                                            | 5                                                                                                                          |
| `maxTotalResults`   | *number*                                                                                                             | :heavy\_minus\_sign: | Maximum total number of search results across all search calls in a single request. Once this limit is reached, the tool will stop returning new results. Useful for controlling cost and context size in agentic loops. Defaults to 50 when not specified.                                                                                                                                                                                                 | 50                                                                                                                         |
| `parameters`        | [models.WebSearchConfig](/agent-sdk/typescript/api-reference/models/websearchconfig)                                 | :heavy\_minus\_sign: | N/A                                                                                                                                                                                                                                                                                                                                                                                                                                                         | `{"max_results": 5,"search_context_size": "medium"}`                                                                       |
| `searchContextSize` | [models.SearchQualityLevel](/agent-sdk/typescript/api-reference/models/searchqualitylevel)                           | :heavy\_minus\_sign: | How much context to retrieve per result. Applies to Exa and Parallel engines; ignored with native provider search and Firecrawl. For Exa, pins a fixed per-result character cap (low=5,000, medium=15,000, high=30,000); when omitted, Exa picks an adaptive size per query and document (typically \~2,000–4,000 characters per result). For Parallel, controls the total characters across all results; when omitted, Parallel uses its own default size. | medium                                                                                                                     |
| `type`              | [models.ChatWebSearchShorthandType](/agent-sdk/typescript/api-reference/models/chatwebsearchshorthandtype)           | :heavy\_check\_mark: | N/A                                                                                                                                                                                                                                                                                                                                                                                                                                                         |                                                                                                                            |
| `userLocation`      | [models.WebSearchUserLocationServerTool](/agent-sdk/typescript/api-reference/models/websearchuserlocationservertool) | :heavy\_minus\_sign: | Approximate user location for location-biased results.                                                                                                                                                                                                                                                                                                                                                                                                      | `{"city": "San Francisco","country": "US","region": "California","timezone": "America/Los_Angeles","type": "approximate"}` |
