{"uid":"cap_eJ6hm7aLNj7mpqyPDX26c","slug":"agent402-tools-auto-routed-chat-completions-aeda31d5","name":"agent402.tools Auto-Routed Chat Completions","description":"OpenAI-compatible chat completions with the model chosen server-side: omit model and the gateway routes the prompt to the top-ranked model for its task (code, reasoning, long-context, general) from a fixed eval-derived ranking, failing over automatically on provider errors. Flat price per call, 16k chars in, 1024 tokens out, streaming supported. Use it as a drop-in OpenAI base_url when you want good answers without picking a model.","url":"https://agent402.tools/v1/auto/chat/completions","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"model":{"type":"string","description":"Optional - omit (or send \"auto\") for eval-ranked server-side routing. An explicit model from the auto ranking is honored at the auto caps."},"quality":{"type":"string","description":"Optional routing band when the gateway picks the model: \"fast\" (cheapest/snappiest), \"balanced\" (default), \"best\" (strongest under the flat price). Never changes the price."},"messages":{"type":"array","description":"OpenAI chat messages: [{role, content}] - text and image_url content blocks supported"},"max_tokens":{"type":"number","description":"Output token cap (clamped to the tier maximum)"}}},"responseSchema":{"type":"json","example":{"id":"gen-…","model":"openai/gpt-4o-mini","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,"agent402_router":{"served":"openai/gpt-4o-mini","quality":"balanced","category":"general"}}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.01","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.01/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_er96CU0N11RVweSqi5AxJ","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.01","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 that automatically route prompts to the best-ranked model for the task (code, reasoning, long-context, or general) without requiring the caller to specify a model.","exampleAgentPrompt":"Send this message array to the auto-routing chat completions endpoint with quality set to 'best' and let the gateway pick the top model for reasoning tasks: [{\"role\":\"user\",\"content\":\"Explain the difference between mutex and semaphore in concurrent programming.\"}]","exampleUseCases":null,"resultDescription":"An OpenAI-compatible chat completion response containing the generated text from whichever model the gateway ranked highest for the detected task type (code, reasoning, long-context, or general), along with standard completion metadata.","failureModes":["Invalid or malformed messages array — returns 400 with schema validation error","max_tokens exceeds tier maximum — value is clamped silently or returns an error","Payment not processed — 402 Payment Required if x402 payment header is missing or insufficient","Model explicitly specified is not available in the auto-ranking tier — may fall back or error","Rate limiting if too many concurrent requests from same wallet","Upstream model provider outage causing delayed or failed response"],"whenToPreferThis":"Prefer this endpoint when you want OpenAI-compatible chat completions but don't want to hardcode a specific model — especially useful when task type varies (code vs. reasoning vs. general) and you want the gateway to route to the current best-ranked model automatically. Ideal for agents that need flat-rate, task-adaptive LLM access via x402 micropayment without managing model selection logic.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T07:01:42.658Z","isFirstParty":false}