{"openapi":"3.1.0","info":{"title":"Anthropic via Locus x402","version":"1.0.0","description":"Claude AI models — chat completions, vision, document processing, extended thinking, and tool use.","contact":{"email":"api@paywithlocus.com"},"x-guidance":"Use the documented POST operations for Anthropic. Send JSON matching each requestBody schema. Unpaid public x402 requests return an x402 v2 payment challenge; retry the same body with PAYMENT-SIGNATURE and the returned x-locus-request-id."},"servers":[{"url":"https://anthropic.x402.stage.paywithlocus.com"}],"x-agentcash-guidance":{"llmsTxtUrl":"https://stage.paywithlocus.com/x402/anthropic.md"},"x-service-info":{"categories":["ai"],"docs":{"homepage":"https://anthropic.com","apiReference":"https://docs.anthropic.com","llms":"https://stage.paywithlocus.com/x402/anthropic.md"}},"paths":{"/anthropic/models":{"post":{"operationId":"anthropic_models","summary":"List Models","description":"List the Claude models available to the configured upstream account, newest first.","tags":["AI / LLM"],"security":[],"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.001000"},"protocols":[{"x402":{}}],"x-locus":{"network":"eip155:8453","asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","scheme":"exact","estimatedCost":"Free"}},"parameters":[{"name":"x-locus-request-id","in":"header","required":false,"description":"UUID returned by the initial 402. Echo it on the paid retry and later recovery attempts.","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"limit":{"type":"number","description":"Maximum number of models to return (1–1000)"},"after_id":{"type":"string","description":"Return models after this pagination cursor"},"before_id":{"type":"string","description":"Return models before this pagination cursor"}},"additionalProperties":true},"example":{}}}},"responses":{"200":{"description":"Successful response with PAYMENT-RESPONSE and durable request receipt","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","additionalProperties":true,"properties":{"data":{"type":"array","items":{"type":"object","additionalProperties":true}}},"description":"Partial response schema observed in an authenticated, semantically verified customer call. Only observed field types are described; optionality, other inputs and error states are not inferred."},"request":{"type":"object","properties":{"id":{"type":"string","pattern":"^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"},"statusUrl":{"type":"string"}},"required":["id","statusUrl"],"additionalProperties":false},"payment":{"type":"object","properties":{"scheme":{"type":"string","enum":["exact","upto"]},"authorizedMaxUsdc":{"type":"string","pattern":"^\\d+\\.\\d{6}$"},"settledUsdc":{"type":"string","pattern":"^\\d+\\.\\d{6}$"},"capExhausted":{"type":"boolean"},"calculatedActualUsdc":{"type":"string","pattern":"^\\d+\\.\\d{6}$"},"usage":{}},"required":["scheme","authorizedMaxUsdc","settledUsdc"],"additionalProperties":false}},"required":["success","data","request","payment"],"additionalProperties":false}}}},"202":{"description":"The supplied request ID is already in progress"},"400":{"description":"Invalid request"},"402":{"description":"Payment Required"},"409":{"description":"Request ID conflict or terminal failed request"}}}},"/anthropic/chat":{"post":{"operationId":"anthropic_chat","summary":"Messages","description":"Generate text with Claude models. Supports text, vision (images via base64 or URL), document processing (PDF), extended thinking, tool use, and structured output.","tags":["AI / LLM"],"security":[],"x-payment-info":{"price":{"mode":"dynamic","currency":"USD","min":"0.001000","max":"0.200000"},"protocols":[{"x402":{}}],"x-locus":{"network":"eip155:8453","asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","scheme":"upto","pricing":"metered","authorization":"maximum","settlement":"actual-usage","pricingVersion":"anthropic-2026-08-21-v1","estimatedCost":"Model-dependent (~$0.001–$0.20)"}},"parameters":[{"name":"x-locus-request-id","in":"header","required":false,"description":"UUID returned by the initial 402. Echo it on the paid retry and later recovery attempts.","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string","description":"Model ID. Current public metered x402 models include 'claude-fable-5', 'claude-opus-5', 'claude-sonnet-5', 'claude-opus-4-8', and earlier reviewed Claude 4 models."},"messages":{"description":"Conversation messages. Each: { role: \"user\"|\"assistant\", content: \"text\" } or multimodal: { role: \"user\", content: [{ type: \"text\", text: \"...\" }, { type: \"image\", source: { type: \"base64\", media_type: \"image/png\", data: \"...\" } }] }","type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"text":{"type":"string"},"image_url":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"],"additionalProperties":true}},"required":["type"],"additionalProperties":true}},{"type":"null"}]},"name":{"type":"string"},"tool_call_id":{"type":"string"},"tool_calls":{"type":"array","items":{"type":"object","additionalProperties":true}}},"required":["role"],"additionalProperties":true}},"max_tokens":{"type":"number","description":"Maximum output tokens. x402 enforces the selected model limit (128k for current Claude 5 and recent Opus/Sonnet models; 64k for Haiku 4.5)."},"system":{"anyOf":[{"type":"string"},{"type":"array","items":{}}],"description":"System prompt. Can be a string or array of content blocks: [{ type: \"text\", text: \"...\" }]"},"temperature":{"type":"number","description":"Sampling temperature (0.0–1.0, default 1.0)"},"top_p":{"type":"number","description":"Nucleus sampling threshold"},"top_k":{"type":"number","description":"Top-K sampling (only sample from top K tokens)"},"stop_sequences":{"type":"array","items":{"type":"string"},"description":"Custom stop sequences to end generation"},"thinking":{"type":"object","additionalProperties":true,"description":"Enable extended thinking. { type: \"enabled\", budget_tokens: 10000 }. Thinking tokens are billed at the output token rate."},"tools":{"type":"array","items":{},"description":"Tool definitions for function calling. Each: { name, description, input_schema: { type: \"object\", properties: {...} } }"},"tool_choice":{"type":"object","additionalProperties":true,"description":"Tool use control: { type: \"auto\" } (default), { type: \"any\" }, { type: \"tool\", name: \"tool_name\" }, or { type: \"none\" }"},"stream":{"type":"boolean","description":"Stream partial results as SSE (text/event-stream). Recommended for reasoning models that exceed the edge buffered-response timeout."}},"required":["model","messages","max_tokens"],"additionalProperties":true},"example":{"model":"claude-haiku-4-5","messages":[{"role":"user","content":"Hello from x402"}],"max_tokens":16}}}},"responses":{"200":{"description":"Successful response with PAYMENT-RESPONSE and durable request receipt","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","additionalProperties":true,"properties":{"content":{"type":"array","items":{"type":"object","additionalProperties":true,"properties":{"text":{"type":"string"}}}}},"description":"Partial response schema observed in an authenticated, semantically verified customer call. Only observed field types are described; optionality, other inputs and error states are not inferred."},"request":{"type":"object","properties":{"id":{"type":"string","pattern":"^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"},"statusUrl":{"type":"string"}},"required":["id","statusUrl"],"additionalProperties":false},"payment":{"type":"object","properties":{"scheme":{"type":"string","enum":["exact","upto"]},"authorizedMaxUsdc":{"type":"string","pattern":"^\\d+\\.\\d{6}$"},"settledUsdc":{"type":"string","pattern":"^\\d+\\.\\d{6}$"},"capExhausted":{"type":"boolean"},"calculatedActualUsdc":{"type":"string","pattern":"^\\d+\\.\\d{6}$"},"usage":{}},"required":["scheme","authorizedMaxUsdc","settledUsdc"],"additionalProperties":false}},"required":["success","data","request","payment"],"additionalProperties":false}}}},"202":{"description":"The supplied request ID is already in progress"},"400":{"description":"Invalid request"},"402":{"description":"Payment Required"},"409":{"description":"Request ID conflict or terminal failed request"}}}},"/anthropic/count-tokens":{"post":{"operationId":"anthropic_count_tokens","summary":"Count Tokens","description":"Count tokens for a message payload before sending. Useful for cost estimation and staying within context limits.","tags":["AI / LLM"],"security":[],"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.001000"},"protocols":[{"x402":{}}],"x-locus":{"network":"eip155:8453","asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","scheme":"exact","estimatedCost":"$0.001"}},"parameters":[{"name":"x-locus-request-id","in":"header","required":false,"description":"UUID returned by the initial 402. Echo it on the paid retry and later recovery attempts.","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string","description":"Model ID to count tokens for"},"messages":{"description":"Messages array (same format as Messages endpoint)","type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"text":{"type":"string"},"image_url":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"],"additionalProperties":true}},"required":["type"],"additionalProperties":true}},{"type":"null"}]},"name":{"type":"string"},"tool_call_id":{"type":"string"},"tool_calls":{"type":"array","items":{"type":"object","additionalProperties":true}}},"required":["role"],"additionalProperties":true}},"system":{"anyOf":[{"type":"string"},{"type":"array","items":{}}],"description":"System prompt to include in token count"},"tools":{"type":"array","items":{},"description":"Tool definitions to include in token count"}},"required":["model","messages"],"additionalProperties":true},"example":{"model":"claude-haiku-4-5","messages":[{"role":"user","content":"Hello from x402"}]}}}},"responses":{"200":{"description":"Successful response with PAYMENT-RESPONSE and durable request receipt","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"data":{"type":"object","additionalProperties":true,"properties":{"input_tokens":{"type":"number"}},"description":"Partial response schema observed in an authenticated, semantically verified customer call. Only observed field types are described; optionality, other inputs and error states are not inferred."},"request":{"type":"object","properties":{"id":{"type":"string","pattern":"^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"},"statusUrl":{"type":"string"}},"required":["id","statusUrl"],"additionalProperties":false},"payment":{"type":"object","properties":{"scheme":{"type":"string","enum":["exact","upto"]},"authorizedMaxUsdc":{"type":"string","pattern":"^\\d+\\.\\d{6}$"},"settledUsdc":{"type":"string","pattern":"^\\d+\\.\\d{6}$"},"capExhausted":{"type":"boolean"},"calculatedActualUsdc":{"type":"string","pattern":"^\\d+\\.\\d{6}$"},"usage":{}},"required":["scheme","authorizedMaxUsdc","settledUsdc"],"additionalProperties":false}},"required":["success","data","request","payment"],"additionalProperties":false}}}},"202":{"description":"The supplied request ID is already in progress"},"400":{"description":"Invalid request"},"402":{"description":"Payment Required"},"409":{"description":"Request ID conflict or terminal failed request"}}}}}}