---
title: "Serper Search"
url: "/docs/search/serper"
canonical_url: "https://docs.litellm.ai/docs/search/serper"
type: "docs"
last_updated: "2026-10-09"
related:
  - "/docs/search/linkup"
  - "/docs/search/you_com"
---
# Serper Search

> Index of all LiteLLM docs: https://docs.litellm.ai/llms.txt


**Get API Key:** [https://serper.dev](https://serper.dev)

## LiteLLM Python SDK

```python showLineNumbers title="Serper Search"
import os
from litellm import search

os.environ["SERPER_API_KEY"] = "your-api-key"

response = search(
    query="latest AI developments",
    search_provider="serper",
    max_results=5
)
```

## LiteLLM AI Gateway

### 1. Setup config.yaml

```yaml showLineNumbers title="config.yaml"
model_list:
  - model_name: gpt-5.6-terra
    litellm_params:
      model: gpt-5.6-terra
      api_key: os.environ/OPENAI_API_KEY

search_tools:
  - search_tool_name: serper-search
    litellm_params:
      search_provider: serper
      api_key: os.environ/SERPER_API_KEY
```

### 2. Start the proxy

```bash
litellm --config /path/to/config.yaml

# RUNNING on http://0.0.0.0:4000
```

### 3. Test the search endpoint

```bash showLineNumbers title="Test Request"
curl http://0.0.0.0:4000/v1/search/serper-search \
  -H "Authorization: Bearer $LITELLM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "latest AI developments",
    "max_results": 5
  }'
```

## Provider-specific Parameters

```python showLineNumbers title="Serper Search with Provider-specific Parameters"
import os
from litellm import search

os.environ["SERPER_API_KEY"] = "your-api-key"

response = search(
    query="latest tech news",
    search_provider="serper",
    max_results=10,
    # Serper-specific parameters
    gl="us",                    # Country/geolocation code
    hl="en",                    # Language code
    autocorrect=False,          # Disable autocorrect
    tbs="qdr:d",               # Time filter: past day ('qdr:h' hour, 'qdr:w' week, 'qdr:m' month)
    page=2                      # Page number
)
```

## Related pages

- [Linkup Search](https://docs.litellm.ai/docs/search/linkup.md)
- [You.com Search](https://docs.litellm.ai/docs/search/you_com.md)
