Web Search
Real-time web search integration with the Responses API Beta
Beta API
This API is in beta stage and may have breaking changes.
The Responses API Beta supports web search integration, allowing models to access real-time information from the internet and provide responses with proper citations and annotations.
Web Search Plugin
Enable web search using the plugins parameter:
Plugin Configuration
Configure web search behavior:
See the Web Search plugin docs for full details on engine selection, domain filter compatibility, and pricing.
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:
allowed_x_handles and excluded_x_handles are
mutually exclusive. See the
Web Search plugin docs
for full details.
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