{"uid":"cap_Apmnx8u6hMR0PZwFFqLC1","slug":"agent402-tools-metered-anthropic-messages-api-dd9f4a51","name":"Agent402.tools Metered Anthropic Messages API","description":"Anthropic Messages API billed per request from what the call costs: the 402 quotes exact-BPE input (system + messages + tools) plus your max_tokens at the model's list price, times 1.15, from $0.001 up to a $2 per-call cap. Point the Anthropic SDK (or any Messages-format client) at base_url https://agent402.tools/v1/metered. Any model from the flat tiers (GET /v1/models). Pay the quote over x402 exact, or authorize it as a ceiling over upto, credits or card and settle actual usage.","url":"https://agent402.tools/v1/metered/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.001","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.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_HaXhygPH580WcNf4FVCZt","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Forwards requests to the Anthropic Messages API with per-call billing via x402 micropayments, priced at 1.15× model list price (input+output tokens) with a $2 cap","exampleAgentPrompt":"Send a Claude Sonnet message asking 'What is x402 and how does it work?' with a max of 256 output tokens, billed per request using USDC micropayments — quote me the exact cost before settling.","exampleUseCases":[{"title":"Agentic LLM calls without subscription","prompt":"I want my agent to call Claude Sonnet for each user query without committing to a monthly API plan — just charge USDC per request based on actual tokens used, capped at $2 per call."},{"title":"Tool-augmented reasoning on demand","prompt":"Run a Claude claude-3-5-sonnet call with my custom search tool definition and a system prompt saying 'You are a research assistant' — the message is 'Summarize recent AI safety developments', max 512 tokens, pay per call."},{"title":"Streaming Claude inference with micropayment","prompt":"Stream a response from Claude on the metered endpoint for the message 'Draft a 3-paragraph product description for a reusable water bottle', using streaming SSE, max 400 tokens, and settle the cost in USDC automatically."}],"resultDescription":"Returns an Anthropic Messages API response object containing the assistant's content blocks (text, tool_use, etc.), the model used, token usage counts (input and output), a stop_reason, and a unique message ID — identical to the native Anthropic API response format.","failureModes":["402 Payment Required if x402 payment header is missing or insufficient","400 Bad Request if model ID is not on the allowlist for the selected tier","400 if max_tokens exceeds the tier output cap","Model unavailable if requested model is temporarily offline","Payment settlement failure if USDC balance or card authorization is insufficient","Timeout or streaming interruption on very long generation requests"],"whenToPreferThis":"Choose this endpoint when you need pay-as-you-go access to Claude models with no monthly subscription, when your agent must settle inference costs in USDC via x402 micropayments, or when you want exact token-cost transparency (BPE-counted, 1.15× list price) with a per-call cap. Prefer it over direct Anthropic API when operating in agentic finance pipelines where on-chain payment settlement is required, or when you want to avoid credit card billing and instead pay per inference call programmatically.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T01:16:30.377Z","isFirstParty":false}