{"uid":"cap_3sliEshtAmaL6puKpSr8S","slug":"agent402-llm-web-search-context-57f103df","name":"Agent402 LLM Web Search Context","description":"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.","url":"https://agent402.tools/api/llm-context","method":"POST","headers":{},"bodySchema":{"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"}}},"responseSchema":{"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}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_3FqxrQr-ie4WGOc9vUSDg","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Performs a web search and returns chunked, token-budgeted text context from live web results, optimized for LLM consumption","exampleAgentPrompt":"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.","exampleUseCases":[{"title":"Real-time protocol research for agent","prompt":"Search the web for how the x402 HTTP payment protocol works and return up to 4096 tokens of context so I can feed it into my reasoning pipeline."},{"title":"Country-specific news lookup","prompt":"Find recent news about the UK AI regulation bill — limit results to UK sources in English and give me around 2048 tokens of context from the past week."},{"title":"Safe-search filtered research for minors","prompt":"Search for educational content about climate change suitable for a school project, use strict safe search, English language, and return up to 6000 tokens of chunked web context."}],"resultDescription":"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.","failureModes":["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"],"whenToPreferThis":"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.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T06:57:59.284Z","isFirstParty":false}