# auth.md

You are an agent. This file explains how to get and use credentials for the
Andi Search API.

- Service: Andi Search API — real-time web search for AI agents and apps.
- Resource: https://api.andiai.com
- Auth: static API key sent as the `x-api-key` header on every request.
- Fully programmatic registration is not yet available — a human completes
  signup in a browser. Follow the steps below.

## Step 1 — Ask your user for an API key

If your user already has an Andi API key, use it. Otherwise, give them this
link verbatim and ask them to create a free account and an API key:

https://console.andiai.com/signup

## Step 2 — Use the key

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

A `200` with markdown results means the key works. `401` = missing/invalid
key. `402` = out of credits (send the user to https://console.andiai.com/billing).
`429` = rate limited (back off and retry).

## Step 3 — Store the key

Store it as the `ANDI_API_KEY` environment variable or in your tool's
secret store. Never commit it to source control.

## MCP alternative

The same key authenticates the hosted MCP server at https://api.andiai.com/mcp
(Streamable HTTP, `x-api-key` header). Setup snippets: https://docs.andiai.com/resources/ai-agents

## No key? Pay per call with x402 (via Orthogonal)

Andi Search is listed on Orthogonal (orthogonal.com), whose gateway supports
the x402 payment protocol — your agent pays per call in USDC with no API key
and no human signup:

```
GET https://x402.orth.sh/andi/v1/search?q=your+query
```

Use an x402-enabled HTTP client (e.g. `x402-fetch`); payment is automatic on
the 402 challenge. Orthogonal credits work too. Details:
https://www.orthogonal.com/blog/andi-search-ai-powered-search

## More

- Full agent setup guide (MCP + skill install): https://api.andiai.com/install.md
- API docs: https://docs.andiai.com
- llms.txt: https://api.andiai.com/llms.txt
- OpenAPI: https://api.andiai.com/openapi.json
