{"uid":"cap_nxLrEjRV8SdPI7LKhMWus","slug":"agent402-ai-messages-api-pay-per-call-llm-inference-0d8feed3","name":"Agent402 AI Messages API — Pay-Per-Call LLM Inference","description":"Anthropic Messages API over x402 - point the Anthropic SDK (or Claude Code / the Agent SDK) at base_url https://agent402.tools/v1 and pay $0.02 per call in USDC, no API key, no signup. Same models, caps and price as this tier's /chat/completions route; any model here is served through the Messages wire (Claude natively, others translated). Up to 32,000 input chars and 2048 output tokens; streaming supported.","url":"https://agent402.tools/v1/messages","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"zdr":{"type":"boolean","description":"Optional - zero-data-retention providers only"},"model":{"type":"string","description":"Model id (OpenRouter naming, e.g. anthropic/claude-sonnet-5) - allowlisted per tier; omit (or \"auto\") on the auto tier"},"tools":{"type":"array","description":"Optional client tools {name, description, input_schema}; server/built-in tools are not served"},"stream":{"type":"boolean","description":"Anthropic SSE (message_start … message_stop)"},"system":{"type":"string","description":"Optional system prompt (string or text blocks)"},"messages":{"type":"array","description":"Anthropic messages: {role: user|assistant, content: string | [text|image|tool_use|tool_result blocks]}"},"thinking":{"type":"object","description":"Optional {type:\"enabled\", budget_tokens} | {type:\"adaptive\"} | {type:\"disabled\"} - thinking tokens are output tokens"},"max_tokens":{"type":"integer","description":"Required by the Messages API; clamped to the tier's output cap"}}},"responseSchema":{"type":"json","example":{"id":"msg_…","role":"assistant","type":"message","model":"anthropic/claude-sonnet-5","usage":{"input_tokens":14,"output_tokens":18},"content":[{"text":"x402 is an HTTP-native way for agents to pay per request with USDC.","type":"text"}],"stop_reason":"end_turn"}},"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_mIujsp_qEneO-8_FDoNEg","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":"Sends messages to a large language model via the Anthropic Messages API format, paying $0.02 USDC per call over x402 with no API keys required","exampleAgentPrompt":"Ask Claude Sonnet (anthropic/claude-sonnet-5) to explain what x402 is in one sentence — pay per call with my USDC wallet, no API key needed, and stream the response back.","exampleUseCases":[{"title":"Anonymous LLM inference for agent pipeline","prompt":"I need to run a Claude Sonnet call right now without setting up any API keys — just use my wallet to pay $0.02 USDC and ask it: 'Summarize the key risks of DeFi yield farming in three bullet points.' Stream the response back to me."},{"title":"Extended thinking for complex reasoning task","prompt":"Use Claude with extended thinking enabled (budget 5000 tokens) to reason through this logic puzzle step by step: 'If all A are B, and some B are C, what can we conclude about A and C?' Pay per call with my crypto wallet."},{"title":"Zero-data-retention AI call for sensitive content","prompt":"I need to send a confidential legal clause to an LLM for plain-English summarization — make sure you use a zero-data-retention provider (set zdr to true), model auto-select is fine, and keep max_tokens at 500."}],"resultDescription":"Returns an Anthropic-format message object with an assistant role, content array of text or tool_use blocks, stop_reason, model identifier, and input/output token counts — identical to the Anthropic Messages API response envelope.","failureModes":["Payment not received or insufficient USDC balance — 402 Payment Required returned before inference runs","Requested model not allowlisted for caller's tier — model ID rejected with error","max_tokens exceeds tier output cap — clamped silently or rejected","Malformed messages array (missing role or content) — 400 validation error","ZDR flag set but no ZDR-compliant provider available — fallback or error","Stream connection dropped mid-response — partial SSE events received","Rate limit hit at the routing layer — 429 Too Many Requests"],"whenToPreferThis":"Choose this endpoint when you need LLM inference with no signup friction, no API key management, and wallet-based micropayment identity — ideal for autonomous AI agents that self-fund calls via x402, privacy-sensitive workloads needing zero-data-retention providers, or multi-agent pipelines that need per-call cost accounting in USDC. Prefer it over direct Anthropic or OpenRouter access when the caller is an on-chain agent, when you want pay-as-you-go without monthly subscriptions, or when you need access to the open x402 ecosystem's smart order routing across 558+ tools.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T06:51:52.722Z","isFirstParty":false}