{"uid":"cap_YgpMFM3643TeEvSbMxH8i","slug":"agent402-tools-premium-chat-completions-faf9ff41","name":"agent402.tools Premium Chat Completions","description":"OpenAI-compatible chat completions, premium tier: gpt-5, o3/o4, claude opus - paid per call in USDC over x402. Same wire format as /v1/chat/completions with the largest caps (64k chars in, 8192 tokens out).","url":"https://agent402.tools/v1/premium/chat/completions","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"zdr":{"type":"boolean","description":"Optional - true routes only to zero-data-retention providers (OpenRouter provider.zdr); the only provider preference a caller may set."},"model":{"type":"string","description":"Model id - OpenRouter form (openai/gpt-4o-mini) or bare OpenAI form (gpt-4o-mini). GET /v1/models lists the allowlist per tier. Optional: omit it and the tier serves its documented default (x402.defaultModel on /v1/models), named back in agent402_default_model; the price does not change"},"tools":{"type":"array","description":"Optional - OpenAI function tools {type:\"function\", function:{...}}, or a tool namespace {type:\"namespace\", name, tools:[...]} (flattened into its functions). The pro and premium routes also accept the bounded server tools openrouter:web_search, openrouter:web_fetch and openrouter:datetime with server-owned limits (GET /v1/models lists them); stop_server_tools_when and max_tool_calls are refused. A request with a server tool is never served from the prompt cache."},"messages":{"type":"array","description":"OpenAI chat messages: [{role, content}] - text and image_url content blocks supported"},"reasoning":{"type":"object","description":"Optional - {effort: \"none\"|\"minimal\"|\"low\"|\"medium\"|\"high\"|\"xhigh\"|\"max\", max_tokens?, exclude?, enabled?}. Reasoning tokens count against max_tokens. Omitted: low effort on the budget tiers, the model default on premium. reasoning_effort (string) is accepted as an alias."},"max_tokens":{"type":"number","description":"Output token cap (clamped to the tier maximum)"},"cache_control":{"description":"Optional - prompt caching preference. Default ON ({type:\"ephemeral\"}, 5-minute TTL): repeated prefixes across your turns are served from the provider cache (same price to you). Send false to disable. ttl:\"1h\" is not offered."},"max_completion_tokens":{"type":"integer","description":"Optional - alias of max_tokens (newer OpenAI SDKs send this)."}}},"responseSchema":{"type":"json","example":{"id":"gen-…","model":"anthropic/claude-opus-4","usage":{"total_tokens":13,"prompt_tokens":12,"completion_tokens":1},"object":"chat.completion","choices":[{"index":0,"message":{"role":"assistant","content":"OK"},"finish_reason":"stop"}],"created":1750000000}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.5","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.5/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.5","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.5","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_spa3e9qWT_q5KnYXffmDB","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.5","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"OpenAI-compatible chat completions via x402 micropayment, routing to premium models (GPT-5, o3/o4, Claude Opus) with 64k input and 8192 token output caps","exampleAgentPrompt":"Send this 50,000-character legal document to Claude Opus or GPT-5 and ask it to summarize the key obligations and risks — use zero-data-retention mode and give me up to 4000 tokens in the response.","exampleUseCases":null,"resultDescription":"An OpenAI-format chat completion JSON object containing the assistant's reply, model used, token usage counts (prompt, completion, total), finish reason, and any tool calls if applicable. The response is structurally identical to /v1/chat/completions from OpenAI.","failureModes":["Payment not received or insufficient USDC — 402 Payment Required","Requested model not in premium tier allowlist — 400 with model error","ZDR flag set but no zero-data-retention provider available for that model — upstream error, failover chain exhausted","Input exceeds 64k character cap — 400 validation error","max_tokens exceeds tier maximum — value is silently clamped","Provider timeout or upstream outage — 503 or 504","Malformed messages array — 400 validation error"],"whenToPreferThis":"Choose this endpoint when you need the absolute highest-capability frontier models (GPT-5, o3, o4, Claude Opus) with large context windows (64k input, 8192 output), and you want to pay per call in USDC without a monthly subscription. Ideal for agents that only occasionally need heavy reasoning or long-context tasks and want cost-proportional billing. Prefer over the standard tier when model quality and context size matter more than cost per call. Use the ZDR flag when privacy compliance requires zero data retention.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-13T18:52:12.264Z","isFirstParty":false}