> SpecStream is the live web data engine for teams and agents. This is the Markdown copy of https://specstream.ai/docs/integrations/litellm. Every page, with what SpecStream does and costs: https://specstream.ai/llms.txt

# LiteLLM

For teams that call search through LiteLLM: the `google_pse` and `searxng` providers run on the Search API once you set their environment variables.

Pick the provider your code or your proxy already uses. Both take the key as its own variable.

## Google PSE provider

The Search API answers with the same JSON as Google Custom Search. Set these where LiteLLM runs, with your key in place of `YOUR_SPECSTREAM_KEY`:

Environment

```bash
GOOGLE_PSE_API_BASE=https://api.specstream.ai/customsearch/v1
GOOGLE_PSE_API_KEY=YOUR_SPECSTREAM_KEY
GOOGLE_PSE_ENGINE_ID=specstream
```

LiteLLM requires `GOOGLE_PSE_ENGINE_ID`. Any value works, and the Search API does not use it.

## SearXNG provider

Set these where LiteLLM runs. LiteLLM adds `/search` to the address and sends the key as a Bearer token:

Environment

```bash
SEARXNG_API_BASE=https://api.specstream.ai/searxng
SEARXNG_API_KEY=YOUR_SPECSTREAM_KEY
```

## Check it works

Run one search with the provider you set. It prints a title and a URL for each result:

google\_pse

```python
import litellm

response = litellm.search(query="latest SEC rule on climate disclosure", search_provider="google_pse")
for result in response.results:
    print(result.title, result.url)
```

searxng

```python
import litellm

response = litellm.search(query="latest SEC rule on climate disclosure", search_provider="searxng")
for result in response.results:
    print(result.title, result.url)
```

On the LiteLLM proxy, a search tool with `search_provider` set to `google_pse` or `searxng` reads the same variables.

## Cost

Each search is one Search API call at $5 per 1,000 searches of up to 10 results. It comes out of your balance, with no quote and no approval. [Search API](https://specstream.ai/docs/search-api.md) has the details.

## Your key

Create the key under **Agents & API** in your SpecStream workspace. [Sign up](https://specstream.ai/signup) and get $10 of credit, no card.

The same setting works in other tools too: [Search API by one setting](https://specstream.ai/docs/integrations/drop-in-search.md).
