{ "/search": { "post": { "tags": [ "search" ], "summary": "Search", "description": "Search endpoint for performing web searches.\n\nFollows the Perplexity Search API spec:\nhttps://docs.perplexity.ai/api-reference/search-post\n\nThe search_tool_name can be passed either:\n1. In the URL path: /v1/search/{search_tool_name}\n2. In the request body: {\"search_tool_name\": \"...\"}\n\nExample with search_tool_name in URL (recommended - keeps body Perplexity-compatible):\n```bash\ncurl -X POST \"http://localhost:4000/v1/search/litellm-search\" -H \"Authorization: Bearer sk-1234\" -H \"Content-Type: application/json\" -d '{\n \"query\": \"latest AI developments 2024\",\n \"max_results\": 5,\n \"search_domain_filter\": [\"arxiv.org\", \"nature.com\"],\n \"country\": \"US\"\n }'\n```\n\nExample with search_tool_name in body:\n```bash\ncurl -X POST \"http://localhost:4000/v1/search\" -H \"Authorization: Bearer sk-1234\" -H \"Content-Type: application/json\" -d '{\n \"search_tool_name\": \"litellm-search\",\n \"query\": \"latest AI developments 2024\",\n \"max_results\": 5,\n \"search_domain_filter\": [\"arxiv.org\", \"nature.com\"],\n \"country\": \"US\"\n }'\n```\n\nRequest Body Parameters (when search_tool_name not in URL):\n- search_tool_name (str, required if not in URL): Name of the search tool configured in router\n- query (str or list[str], required): Search query\n- max_results (int, optional): Maximum number of results (1-20), default 10\n- search_domain_filter (list[str], optional): List of domains to filter (max 20)\n- max_tokens_per_page (int, optional): Max tokens per page, default 1024\n- country (str, optional): Country code filter (e.g., 'US', 'GB', 'DE')\n\nWhen using URL path parameter, only Perplexity-compatible parameters are needed in body:\n- query (str or list[str], required): Search query\n- max_results (int, optional): Maximum number of results (1-20), default 10\n- search_domain_filter (list[str], optional): List of domains to filter (max 20)\n- max_tokens_per_page (int, optional): Max tokens per page, default 1024\n- country (str, optional): Country code filter (e.g., 'US', 'GB', 'DE')\n\nResponse follows Perplexity Search API format:\n```json\n{\n \"object\": \"search\",\n \"results\": [\n {\n \"title\": \"Result title\",\n \"url\": \"https://example.com\",\n \"snippet\": \"Result snippet...\",\n \"date\": \"2024-01-01\",\n \"last_updated\": \"2024-01-01\"\n }\n ]\n}\n```", "operationId": "search_search_post", "security": [ { "APIKeyHeader": [] } ], "parameters": [ { "name": "search_tool_name", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Search Tool Name" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/search/tools": { "get": { "tags": [ "search" ], "summary": "List Search Tools", "description": "List all available search tools configured in the router.\n\nThis endpoint returns the search tools that are currently loaded and available\nfor use with the /v1/search endpoint.\n\nExample:\n```bash\ncurl -X GET \"http://localhost:4000/v1/search/tools\" -H \"Authorization: Bearer sk-1234\"\n```\n\nResponse:\n```json\n{\n \"object\": \"list\",\n \"data\": [\n {\n \"search_tool_name\": \"litellm-search\",\n \"search_provider\": \"perplexity\",\n \"description\": \"Perplexity search tool\"\n }\n ]\n}\n```", "operationId": "list_search_tools_search_tools_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } } }, "security": [ { "APIKeyHeader": [] } ] } }, "/search/{search_tool_name}": { "post": { "tags": [ "search" ], "summary": "Search", "description": "Search endpoint for performing web searches.\n\nFollows the Perplexity Search API spec:\nhttps://docs.perplexity.ai/api-reference/search-post\n\nThe search_tool_name can be passed either:\n1. In the URL path: /v1/search/{search_tool_name}\n2. In the request body: {\"search_tool_name\": \"...\"}\n\nExample with search_tool_name in URL (recommended - keeps body Perplexity-compatible):\n```bash\ncurl -X POST \"http://localhost:4000/v1/search/litellm-search\" -H \"Authorization: Bearer sk-1234\" -H \"Content-Type: application/json\" -d '{\n \"query\": \"latest AI developments 2024\",\n \"max_results\": 5,\n \"search_domain_filter\": [\"arxiv.org\", \"nature.com\"],\n \"country\": \"US\"\n }'\n```\n\nExample with search_tool_name in body:\n```bash\ncurl -X POST \"http://localhost:4000/v1/search\" -H \"Authorization: Bearer sk-1234\" -H \"Content-Type: application/json\" -d '{\n \"search_tool_name\": \"litellm-search\",\n \"query\": \"latest AI developments 2024\",\n \"max_results\": 5,\n \"search_domain_filter\": [\"arxiv.org\", \"nature.com\"],\n \"country\": \"US\"\n }'\n```\n\nRequest Body Parameters (when search_tool_name not in URL):\n- search_tool_name (str, required if not in URL): Name of the search tool configured in router\n- query (str or list[str], required): Search query\n- max_results (int, optional): Maximum number of results (1-20), default 10\n- search_domain_filter (list[str], optional): List of domains to filter (max 20)\n- max_tokens_per_page (int, optional): Max tokens per page, default 1024\n- country (str, optional): Country code filter (e.g., 'US', 'GB', 'DE')\n\nWhen using URL path parameter, only Perplexity-compatible parameters are needed in body:\n- query (str or list[str], required): Search query\n- max_results (int, optional): Maximum number of results (1-20), default 10\n- search_domain_filter (list[str], optional): List of domains to filter (max 20)\n- max_tokens_per_page (int, optional): Max tokens per page, default 1024\n- country (str, optional): Country code filter (e.g., 'US', 'GB', 'DE')\n\nResponse follows Perplexity Search API format:\n```json\n{\n \"object\": \"search\",\n \"results\": [\n {\n \"title\": \"Result title\",\n \"url\": \"https://example.com\",\n \"snippet\": \"Result snippet...\",\n \"date\": \"2024-01-01\",\n \"last_updated\": \"2024-01-01\"\n }\n ]\n}\n```", "operationId": "search_search__search_tool_name__post", "security": [ { "APIKeyHeader": [] } ], "parameters": [ { "name": "search_tool_name", "in": "path", "required": true, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Search Tool Name" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } } }