# Agent402 LLM Web Search Context

> Agent402 LLM Web Search Context is a paid API for AI agents from agent402.tools, paid per call via x402, $0.02/call, status unknown (last checked 2026-09-15).

Performs a web search and returns chunked, token-budgeted text context from live web results, optimized for LLM consumption

## Facts

- Endpoint: POST https://agent402.tools/api/llm-context
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agent402-llm-web-search-context-57f103df
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_3sliEshtAmaL6puKpSr8S

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability agent402-llm-web-search-context-57f103df -d '<json body>'
```

Example prompt: Search the web for the latest information about the x402 payment protocol and give me up to 8192 tokens of context, filtered to results from the past month, in English.

## When to prefer this

Use this endpoint when an AI agent needs live, token-budgeted web search context without managing API keys or subscriptions — paying only per call via USDC over x402. It is ideal for RAG pipelines, agentic research tasks, or any workflow where fresh web data must be injected into an LLM prompt with a controlled token footprint. Prefer it over direct Brave/Google Search APIs when the agent is operating autonomously with a crypto wallet identity and needs turnkey, pay-per-call access with no signup friction.

## Known failure modes

- Query exceeds 400 characters or 50 words — returns validation error
- maxTokens outside 1024–32768 range — returns parameter error
- Invalid freshness format — returns parsing error
- Invalid country or language code — may fall back to defaults or return error
- No results found for query — returns empty chunks array
- Upstream Brave Search outage — returns 502 or timeout
- Payment not received (x402) — returns 402 Payment Required before processing

## How this service works

Web search that returns READY-TO-USE grounding text, not links: for one query you get the passages an independent search index extracted from the pages it ranked, flattened into chunks with their source URL and title and an approximate token count, under a token budget you choose (1024-32768, default 4096). Use it to ground a model or a RAG pipeline in one call, where search + extract would take several.

## Output

Returns a JSON object containing an array of text chunks from live web search results, each with a URL, page title, text excerpt, and approximate token count. Also includes metadata: the original query, data source identifier (brave-llm-context), fetch timestamp, total token count, total chunk count, and a truncation flag indicating whether the token budget was hit. Content is flagged as untrustedContent=true.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "lang": {
   "type": "string",
   "description": "Optional language code for results, e.g. en or en-gb (upstream default en)"
  },
  "query": {
   "type": "string",
   "description": "Search query (1-400 chars, max 50 words)"
  },
  "country": {
   "type": "string",
   "description": "Optional 2-letter country code (upstream default us)"
  },
  "freshness": {
   "type": "string",
   "description": "Optional recency filter: pd, pw, pm, py, or a YYYY-MM-DDtoYYYY-MM-DD range"
  },
  "maxTokens": {
   "type": "number",
   "description": "Approximate token budget for the returned context, 1024-32768 (default 4096)"
  },
  "safesearch": {
   "type": "string",
   "description": "Optional adult-content filter: off, moderate, or strict"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "query": "x402 payment protocol",
  "chunks": [
   {
    "url": "https://www.x402.org/",
    "text": "x402 revives the HTTP 402 Payment Required status code so a server can quote a price and a client can pay per request...",
    "title": "x402: An open standard for internet-native payments",
    "tokensApprox": 34
   }
  ],
  "source": "brave-llm-context",
  "fetchedAt": "2026-08-22T12:00:00.000Z",
  "truncated": false,
  "totalChunks": 1,
  "tokensApprox": 34,
  "untrustedContent": true
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agent402-llm-web-search-context-57f103df/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agent402.tools](https://www.zero.xyz/host/agent402.tools/llms.txt)
