{"uid":"cap_NcUKPtZLIifaM2aQhW0nS","slug":"locus-x402-openrouter-chat-completions-66210c4b","name":"Locus x402 OpenRouter Chat Completions","description":"Locus public pay-per-use API","url":"https://openrouter.x402.stage.paywithlocus.com/openrouter/chat?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"model":{"type":"string"},"messages":{"type":"array","items":{"type":"object","required":["role"],"properties":{"name":{"type":"string"},"role":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"object","required":["type"],"properties":{"text":{"type":"string"},"type":{"type":"string"},"image_url":{"type":"object","required":["url"],"properties":{"url":{"type":"string"}},"additionalProperties":true}},"additionalProperties":true}},{"type":"null"}]},"tool_calls":{"type":"array","items":{"type":"object","additionalProperties":true}},"tool_call_id":{"type":"string"}},"additionalProperties":true}},"max_tokens":{"type":"number"},"temperature":{"type":"number"}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.001","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":1,"rating":{"score":"0.00","successRate":"0.00","reviews":1,"stars":null,"state":"rated"},"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_6nYZ7FcXoQjaxg0MkG5ZK","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":"Pay-per-use LLM chat completions gateway via OpenRouter, billed per-call at $0.001 USDC using the x402 payment protocol","exampleAgentPrompt":"Send this conversation to anthropic/claude-sonnet-5 via the Locus x402 OpenRouter gateway — system: 'You are a helpful assistant', user: 'Summarize the history of the Roman Empire in 3 bullet points', with max_tokens 300 and temperature 0.7, paying the $0.001 USDC per-call fee automatically.","exampleUseCases":[{"title":"Microbilling agent for dynamic LLM tasks","prompt":"Use the Locus x402 pay-per-use gateway to ask google/gemini-2.5-flash to extract all action items from this meeting transcript, limit the response to 500 tokens — I want to be billed in USDC only for what I actually use."},{"title":"Multi-model comparison with crypto billing","prompt":"Send the same user prompt — 'Write a haiku about distributed systems' — to both anthropic/claude-haiku-4.5 and openai/gpt-oss-120b through the Locus OpenRouter x402 endpoint with max_tokens 100, so I can compare outputs and pay per call."},{"title":"Serverless AI chatbot backend","prompt":"My chatbot needs to respond to a user message 'How do I reset my password?' using anthropic/claude-sonnet-5 with a system prompt 'You are a friendly customer support agent', max 200 tokens, temperature 0.5 — route it through the x402 Locus OpenRouter API so each reply is billed at $0.001 USDC."}],"resultDescription":"Returns a chat completion response in OpenAI-compatible format containing the assistant's generated message, model used, token usage counts, and finish reason. The response mirrors the OpenRouter/OpenAI chat completions schema with the `choices` array holding the assistant reply.","failureModes":["Payment authorization failure if x402 USDC balance is insufficient — returns 402 Payment Required","Invalid or unsupported model ID returns a 400 or model-not-found error","max_tokens not provided — required for x402 cost ceiling enforcement, will likely reject the request","Token limit exceeded if prompt plus max_tokens surpasses the model's context window","Rate limiting or upstream OpenRouter errors propagated as 5xx responses","Malformed messages array (wrong role values or missing content) causes validation errors"],"whenToPreferThis":"Choose this endpoint when you need pay-per-use LLM inference billed in USDC micropayments via the x402 protocol — ideal for agents that want to avoid monthly API subscriptions, need to access multiple model providers (Anthropic, OpenAI, Google) through a single endpoint, or are building autonomous systems where cost is metered per individual inference call. Prefer this over direct OpenAI or Anthropic APIs when you want crypto-native billing without pre-purchase commitments.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":2,"lastUsedAt":"2026-08-10T17:24:30.501Z","lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-10T06:34:34.948Z","isFirstParty":false,"canonicalSlug":"locus-x402-openrouter-chat-completions-66210c4b"}