Web Search - Real-time Information Access for AI Models
Enhance responses with up-to-date web data
LLMAPI.dev's web search integration allows you to augment any model with real-time information from the internet, ensuring responses are grounded in current data rather than limited to the model's training cutoff.
Access the latest information from across the web, ensuring your AI responses are always current and relevant.
Ground AI responses in factual, up-to-date information rather than relying solely on training data.
Stay informed about breaking news, market changes, and recent developments in any field.
User Query
Question submitted
Web Search
Real-time data retrieval
Enhanced Response
AI + current data
Enabling Web Search
You can incorporate web search capabilities in two simple ways:
:online
to any model slug for instant web search capabilities{
"model": "openai/gpt-4o:online",
"messages": [
{"role": "user", "content": "What are the latest developments in quantum computing?"}
]
}
{
"model": "openai/gpt-4o",
"plugins": [{ "id": "web" }],
"messages": [
{"role": "user", "content": "What are the latest developments in quantum computing?"}
]
}
Accessing Search Results
All web search results are standardized in the API response, regardless of which model you're using. Search annotations follow a consistent schema in the message object, making it easy to extract and utilize the retrieved information:
{
"role": "assistant",
"content": "According to recent developments, quantum computing has seen significant advances...",
"tool_calls": [
{
"id": "call_abc123",
"type": "function",
"function": {
"name": "web_search",
"arguments": "{\"query\":\"latest developments quantum computing\"}"
}
}
]
}
Customizing Search Behavior
The web search plugin offers several customization options to tailor the search experience to your specific needs:
{
"plugins": [{
"id": "web",
"settings": {
"max_results": 8,
"search_prompt": "Use these search results to provide current information about {query}. Today's date is {date}."
}
}]
}
Parameters you can adjust include:
- max_resultsControl the number of search results returned (default: 5)
- search_promptCustomize how search results are presented to the model
By default, the search prompt includes the current date to help the model understand the temporal context of the information.
Pricing Structure
LLMAPI.dev's web search feature is priced based on usage:
Cost per 1,000 results
With default 5 results per query ≈ $0.02 per request
Search Context Levels:
Basic search with minimal context
Standard search with moderate context
Comprehensive search with extensive context
{
"web_search_options": {
"context_size": "medium"
}
}
Model-specific Pricing:
Model Type | Low Context | Medium Context | High Context |
---|---|---|---|
Premium Models GPT-4, GPT-4o, Claude Opus equivalents | +$0.01/query | +$0.03/query | +$0.06/query |
Standard Models GPT-3.5, Claude Sonnet equivalents | +$0.005/query | +$0.015/query | +$0.03/query |