latestOpenAPI 3.1.02026-08-197104501.1 MB
8fbaab4fc7c5
search
Search
Search endpoint for performing web searches.
Follows the Perplexity Search API spec: https://docs.perplexity.ai/api-reference/search-post
The search_tool_name can be passed either:
- In the URL path: /v1/search/{search_tool_name}
- In the request body: {"search_tool_name": "..."}
Example with search_tool_name in URL (recommended - keeps body Perplexity-compatible):
curl -X POST "http://localhost:4000/v1/search/litellm-search" -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" -d '{
"query": "latest AI developments 2024",
"max_results": 5,
"search_domain_filter": ["arxiv.org", "nature.com"],
"country": "US"
}'
Example with search_tool_name in body:
curl -X POST "http://localhost:4000/v1/search" -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" -d '{
"search_tool_name": "litellm-search",
"query": "latest AI developments 2024",
"max_results": 5,
"search_domain_filter": ["arxiv.org", "nature.com"],
"country": "US"
}'
Request Body Parameters (when search_tool_name not in URL):
- search_tool_name (str, required if not in URL): Name of the search tool configured in router
- query (str or list[str], required): Search query
- max_results (int, optional): Maximum number of results (1-20), default 10
- search_domain_filter (list[str], optional): List of domains to filter (max 20)
- max_tokens_per_page (int, optional): Max tokens per page, default 1024
- country (str, optional): Country code filter (e.g., 'US', 'GB', 'DE')
When using URL path parameter, only Perplexity-compatible parameters are needed in body:
- query (str or list[str], required): Search query
- max_results (int, optional): Maximum number of results (1-20), default 10
- search_domain_filter (list[str], optional): List of domains to filter (max 20)
- max_tokens_per_page (int, optional): Max tokens per page, default 1024
- country (str, optional): Country code filter (e.g., 'US', 'GB', 'DE')
Response follows Perplexity Search API format:
{
"object": "search",
"results": [
{
"title": "Result title",
"url": "https://example.com",
"snippet": "Result snippet...",
"date": "2024-01-01",
"last_updated": "2024-01-01"
}
]
}
post/v1/search/{search_tool_name}
Path parameters
search_tool_namestring nullable required
Response
Successful Response
{"stackTrail":"paths:/v1/search/{search_tool_name}:post:responses:200:content:application/json:schema","oasType":"schema","type":"unknown"}