{"openapi":"3.1.0","info":{"title":"OpenRouter via Locus x402","version":"1.0.0","description":"Unified LLM gateway — one OpenAI-compatible API routing to hundreds of models from Anthropic, OpenAI, Google, Meta, and more.","contact":{"email":"api@paywithlocus.com"},"x-guidance":"Use the documented POST operations for OpenRouter. 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://openrouter.x402.stage.paywithlocus.com"}],"x-agentcash-guidance":{"llmsTxtUrl":"https://stage.paywithlocus.com/x402/openrouter.md"},"x-service-info":{"categories":["ai"],"docs":{"homepage":"https://openrouter.ai","apiReference":"https://openrouter.ai/docs","llms":"https://stage.paywithlocus.com/x402/openrouter.md"}},"paths":{"/openrouter/chat":{"post":{"operationId":"openrouter_chat","summary":"Chat Completions","description":"Generate text with any OpenRouter-listed model. OpenAI-compatible request/response format with provider-prefixed model ids.\n\nPublic x402 constraints:\n- Supported models: `anthropic/claude-sonnet-4.6`, `anthropic/claude-sonnet-4.5`, `anthropic/claude-haiku-4.5`, `openai/gpt-oss-120b`, `openai/gpt-oss-20b`, `google/gemini-2.5-flash`, `moonshotai/kimi-k2.5`.\n- `max_tokens` or `max_completion_tokens` is required. Plugins, fallback model lists, non-default service tiers, and custom provider routing are not supported.","tags":["AI / LLM"],"security":[],"x-payment-info":{"price":{"mode":"dynamic","currency":"USD","min":"0.001000","max":"0.500000"},"protocols":[{"x402":{}}],"x-locus":{"network":"eip155:8453","asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","scheme":"upto","pricing":"metered","authorization":"maximum","settlement":"actual-usage","pricingVersion":"openrouter-usage-cost-2026-08-07-v1","estimatedCost":"Model-dependent (~$0.001–$0.50)"}},"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":"Provider-prefixed model ID (e.g. 'anthropic/claude-sonnet-4.6', 'anthropic/claude-haiku-4.5', 'openai/gpt-oss-120b', 'google/gemini-2.5-flash')"},"messages":{"description":"Conversation messages. Each: { role: \"system\"|\"user\"|\"assistant\", content: \"text\" } or multimodal content arrays per the OpenAI format.","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. Required for public x402 so the authorization has a hard ceiling."},"temperature":{"type":"number","description":"Sampling temperature (0.0–2.0, default 1.0)"}},"required":["model","messages","max_tokens"],"additionalProperties":true},"example":{"model":"openai/gpt-oss-20b","messages":[{"role":"user","content":"Hello from x402"}],"max_tokens":256}}}},"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":{"choices":{"type":"array","items":{"type":"object","additionalProperties":true,"properties":{"message":{"type":"object","additionalProperties":true,"properties":{"content":{"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"}}}}}}