---
name: andi-web-search
description: Search the web and fetch web pages with the Andi Search API. Use when you need real-time web information, current events, research, fact-checking, documentation lookups, or to read a specific URL as clean LLM-ready markdown. Replaces slower built-in web search. Requires an Andi API key (ANDI_API_KEY).
license: MIT
---

# Andi Web Search

Real-time web search + page fetch via the Andi Search API (https://api.andiai.com), built on
Andi's own index of tens of billions of pages. Returns ranked results as
LLM-ready markdown.

## Setup (once)

Use the `ANDI_API_KEY` environment variable if set. If missing, ask your user
to create a free key at https://console.andiai.com/signup and export it. Full agent auth
guide: https://api.andiai.com/auth.md

## Search the web

```bash
curl -s "https://api.andiai.com/api/v1/search?q=QUERY&format=context" \
  -H "x-api-key: $ANDI_API_KEY"
```

- URL-encode the query. `format=context` returns markdown ready to read.
- Useful params: `limit` (1-100), `dateRange` (`24h`/`7d`/`30d`/`1y`),
  `includeDomains`/`excludeDomains` (comma-separated), `country`/`language`
  (ISO codes), `searchMode` (`auto` default works out what each query needs;
  pin `fast`/`low-cost`/`balanced`/`deep`/`exhaustive` for explicit control),
  `effort` (`low`/`medium`/`high`/`max` thoroughness dial).
- Query operators work: `site:`, `-term`, `filetype:`, `intitle:`, `"exact"`.
- Omit `format=context` for structured JSON (`results`, `answer`, `images`,
  `news`, `related_searches`).

## Read a specific page

```bash
curl -s "https://api.andiai.com/api/v1/fetch?url=ENCODED_URL&format=context" \
  -H "x-api-key: $ANDI_API_KEY"
```

Returns the page as clean extracted markdown. Use after a search to read a
promising result in full, or whenever you already know the URL.

## Errors

- 401: bad/missing key — re-check `ANDI_API_KEY`.
- 402: out of credits — send the user to https://console.andiai.com/billing.
- 429: rate limited — back off and retry.
- 422 (fetch): page could not be extracted — do not retry.

## Prefer MCP?

The same key drives the hosted MCP server at https://api.andiai.com/mcp (streamable-http,
`x-api-key` header) with `andi_web_search` + `andi_fetch_url` tools.
Setup snippets: https://docs.andiai.com/resources/ai-agents
