Web Search Plugin
Enable web search using theplugins parameter:
Plugin Configuration
Configure web search behavior:| Parameter | Type | Description |
|---|---|---|
id | string | Required. Must be “web” |
engine | string | Search engine: "native", "exa", "firecrawl", "parallel", or omit for auto |
max_results | integer | Maximum search results to retrieve (1–25; 1–20 for Perplexity; default 5) |
include_domains | string[] | Restrict results to these domains (supports wildcards like *.substack.com) |
exclude_domains | string[] | Exclude results from these domains |
X Search Filters (xAI only)
When using xAI models (e.g.x-ai/grok-4.1-fast),
you can pass x_search_filter as a top-level
request parameter to filter X/Twitter search
results:
| Parameter | Type | Description |
|---|---|---|
allowed_x_handles | string[] | Only include posts from these handles (max 10) |
excluded_x_handles | string[] | Exclude posts from these handles (max 10) |
from_date | string | Start date (ISO 8601, e.g. "2025-01-01") |
to_date | string | End date (ISO 8601, e.g. "2025-12-31") |
enable_image_understanding | boolean | Analyze images in posts |
enable_video_understanding | boolean | Analyze videos in posts |
Structured Message with Web Search
Use structured messages for more complex queries:Online Model Variants
Some models have built-in web search capabilities using the:online variant:
Response with Annotations
Web search responses include citation annotations:Annotation Types
Web search responses can include different annotation types:URL Citation
Complex Search Queries
Handle multi-part search queries:Web Search in Conversation
Include web search in multi-turn conversations:Streaming Web Search
Monitor web search progress with streaming:Annotation Processing
Extract and process citation information:Best Practices
- Limit results: Use appropriate
max_resultsto balance quality and speed - Handle annotations: Process citation annotations for proper attribution
- Query specificity: Make search queries specific for better results
- Error handling: Handle cases where web search might fail
- Rate limits: Be mindful of search rate limits
Next Steps
- Learn about Tool Calling integration
- Explore Reasoning capabilities
- Review Basic Usage fundamentals