{"openapi": "3.1.0", "info": {"title": "Surp API", "version": "1.0.0", "description": "Base-native AI inference marketplace and x402 router."}, "servers": [{"url": "https://surp.ivc.lol/v1"}], "x-service-info": {"categories": ["ai", "developer-tools", "payments"], "docs": {"homepage": "https://surp.ivc.lol/developers", "apiReference": "https://surp.ivc.lol/docs", "llms": "https://surp.ivc.lol/llms.txt"}}, "components": {"schemas": {"Problem": {"type": "object", "required": ["code", "message", "status"], "properties": {"type": {"type": "string", "format": "uri"}, "title": {"type": "string"}, "status": {"type": "integer"}, "code": {"type": "string"}, "message": {"type": "string"}, "resolution": {"type": "string"}}}, "Model": {"type": "object", "required": ["id"], "properties": {"id": {"type": "string"}, "object": {"type": "string"}}}, "ModelsResponse": {"type": "object", "required": ["data"], "properties": {"object": {"type": "string"}, "data": {"type": "array", "items": {"$ref": "#/components/schemas/Model"}}}}, "ChatMessage": {"type": "object", "required": ["role", "content"], "properties": {"role": {"type": "string", "enum": ["system", "user", "assistant", "tool"], "description": "Conversation role."}, "content": {"type": "string", "description": "Message content."}, "name": {"type": "string"}, "tool_call_id": {"type": "string"}}}, "ChatRequest": {"type": "object", "required": ["model", "messages"], "properties": {"model": {"type": "string", "description": "Route to call, e.g. surp/free, surp/value, surp/frontier.", "examples": ["surp/free", "surp/value"]}, "messages": {"type": "array", "items": {"$ref": "#/components/schemas/ChatMessage"}}, "max_tokens": {"type": "integer", "minimum": 1}, "temperature": {"type": "number", "minimum": 0, "maximum": 2}, "stream": {"type": "boolean", "default": false}}}, "ChatChoice": {"type": "object", "required": ["index", "message"], "properties": {"index": {"type": "integer"}, "message": {"$ref": "#/components/schemas/ChatMessage"}, "finish_reason": {"type": ["string", "null"], "enum": ["stop", "length", "content_filter", "tool_calls", null]}}}, "Usage": {"type": "object", "properties": {"prompt_tokens": {"type": "integer"}, "completion_tokens": {"type": "integer"}, "total_tokens": {"type": "integer"}}}, "ChatResponse": {"type": "object", "required": ["id", "choices"], "properties": {"id": {"type": "string"}, "object": {"type": "string"}, "created": {"type": "integer"}, "model": {"type": "string"}, "choices": {"type": "array", "items": {"$ref": "#/components/schemas/ChatChoice"}}, "usage": {"$ref": "#/components/schemas/Usage"}}}}}, "paths": {"/chat/completions": {"post": {"operationId": "createChatCompletion", "summary": "Chat completions", "description": "OpenAI-compatible chat completions. Requires x402 EIP-3009 USDC payment on Base or a prepaid API key.", "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ChatRequest"}}}}, "x-payment-info": {"offers": [{"intent": "charge", "method": "evm", "amount": null, "currency": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "description": "Dynamic per-request USDC charge on Base; the runtime HTTP 402 challenge provides the authoritative amount."}]}, "responses": {"200": {"description": "Chat completion", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ChatResponse"}}}}, "402": {"description": "Payment required", "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Problem"}}}}, "404": {"description": "Route not found", "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Problem"}}}}, "429": {"description": "Rate limited", "headers": {"Retry-After": {"schema": {"type": "integer"}}}, "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Problem"}}}}, "500": {"description": "Server error", "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Problem"}}}}}}}, "/models": {"get": {"operationId": "listModels", "summary": "List models", "description": "List available Surp routes and models.", "responses": {"200": {"description": "Available models", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ModelsResponse"}}}}, "500": {"description": "Server error", "content": {"application/problem+json": {"schema": {"$ref": "#/components/schemas/Problem"}}}}}}}}, "x-rate-limit-policy": {"headers": {"RateLimit-Limit": "60", "RateLimit-Remaining": "59", "RateLimit-Reset": "60"}, "documentation": "Clients should honor RateLimit-* headers and Retry-After on 429 responses."}, "x-deprecation-policy": "Stable API versions live under /v1. Breaking changes are never made silently: at least 90 days before a breaking change the affected responses carry a `Deprecation` header (RFC 9745) and a `Sunset` header (RFC 8594) with the removal date, and the change is announced on the versioning policy page https://surp.ivc.lol/versioning and in https://surp.ivc.lol/llms.txt. Additive changes (new optional fields, new routes) may ship at any time and are never breaking.", "x-sunset-policy": "When an API version is scheduled for removal, every response from that version returns `Deprecation: true` and `Sunset: <HTTP-date>` (RFC 8594). Clients should treat any Sunset date as authoritative and migrate before it. See https://surp.ivc.lol/versioning."}