{"openapi":"3.1.0","info":{"title":"KeepRouter API","version":"v0.5.0","description":"The live OpenAI- and Anthropic-compatible KeepRouter gateway for text, vision, embeddings, audio, and image generation, with prepaid billing and published pricing.","termsOfService":"https://keeprouter.com/terms","contact":{"name":"KeepRouter support","url":"https://keeprouter.com/contact","email":"support@keeprouter.com"}},"servers":[{"url":"https://keeprouter.com/v1","description":"KeepRouter production API"}],"tags":[{"name":"OpenAI-compatible generation","description":"Text and multimodal generation in OpenAI wire formats."},{"name":"Anthropic (Claude) Messages","description":"Anthropic Messages and token-counting compatibility."},{"name":"Audio","description":"Text-to-speech generation."},{"name":"Images","description":"Image generation."},{"name":"Embeddings","description":"Vector embedding generation."},{"name":"OpenAI Proxy","description":"OpenAI-compatible discovery endpoints."}],"externalDocs":{"description":"KeepRouter quickstart, pricing, errors, and compatibility guides","url":"https://keeprouter.com/docs/quickstart"},"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"KeepRouter API key","description":"Send a KeepRouter key as Authorization: Bearer sk-kr-…"},"AnthropicApiKey":{"type":"apiKey","in":"header","name":"x-api-key","description":"Anthropic-style alternative: send the same KeepRouter key in x-api-key."}},"schemas":{},"parameters":{}},"paths":{"/chat/completions":{"post":{"operationId":"createChatCompletion","tags":["OpenAI-compatible generation"],"summary":"Create a chat completion","description":"Generate an assistant response from an OpenAI-compatible message list. Use stream=true for server-sent events; KeepRouter selects an eligible upstream channel and preserves the public model id.","security":[{"BearerAuth":[]},{"AnthropicApiKey":[]}],"requestBody":{"description":"OpenAI-compatible chat completion request. Provider-specific extension fields are passed through when supported.","required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string","minLength":1,"description":"Canonical KeepRouter model id."},"messages":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["developer","system","user","assistant","tool"]},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","description":"Content-part type, for example text, image_url, or input_audio."},"text":{"type":"string"},"image_url":{"anyOf":[{"type":"string"},{"type":"object","additionalProperties":{}}]}},"required":["type"]}},{"type":"null"},{"type":"null"}]},"name":{"type":"string"},"tool_call_id":{"type":"string"},"tool_calls":{"type":"array","items":{"type":"object","additionalProperties":{}}}},"required":["role","content"]},"minItems":1,"description":"Conversation history in OpenAI chat format."},"max_tokens":{"type":"integer","exclusiveMinimum":0},"max_completion_tokens":{"type":"integer","exclusiveMinimum":0},"temperature":{"type":"number","minimum":0,"maximum":2},"top_p":{"type":"number","minimum":0,"maximum":1},"stream":{"type":"boolean","default":false},"stop":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"tools":{"type":"array","items":{"type":"object","additionalProperties":{}}},"tool_choice":{"anyOf":[{"type":"string"},{"type":"object","additionalProperties":{}}]},"response_format":{"type":"object","additionalProperties":{}},"n":{"type":"number","enum":[1],"description":"KeepRouter currently accepts one generated choice per request."},"user":{"type":"string"}},"required":["model","messages"]},"example":{"model":"deepseek-v4-pro","messages":[{"role":"user","content":"Summarize the trade-offs in three bullets."}],"stream":false}}}},"responses":{"200":{"description":"Chat completion JSON, or an SSE stream when stream=true.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","description":"Usually chat.completion."},"created":{"type":"integer"},"model":{"type":"string"},"choices":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer"},"message":{"type":"object","properties":{"role":{"type":"string","enum":["assistant"]},"content":{"type":["string","null"]},"tool_calls":{"type":"array","items":{"type":"object","additionalProperties":{}}}},"required":["role","content"]},"finish_reason":{"type":["string","null"]}},"required":["index","message","finish_reason"]}},"usage":{"type":"object","properties":{"prompt_tokens":{"type":"integer","minimum":0},"completion_tokens":{"type":"integer","minimum":0},"total_tokens":{"type":"integer","minimum":0}}}},"required":["id","object","created","model","choices"]},"example":{"id":"chatcmpl_kr_example","object":"chat.completion","created":1786800000,"model":"deepseek-v4-pro","choices":[{"index":0,"message":{"role":"assistant","content":"- Lower latency\n- Published pricing\n- One API key"},"finish_reason":"stop"}],"usage":{"prompt_tokens":18,"completion_tokens":14,"total_tokens":32}}},"text/event-stream":{"schema":{"type":"string","description":"Server-sent events terminated by data: [DONE]."},"example":"data: {\"id\":\"chatcmpl_kr_example\",\"choices\":[{\"delta\":{\"content\":\"Hello\"}}]}\n\ndata: [DONE]\n\n"}}},"400":{"description":"Invalid JSON or request parameters.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"The request body is invalid.","type":"invalid_request_error","code":"invalid_request","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#invalid_request"}}}}},"401":{"description":"Missing, invalid, expired, or revoked API key.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"The API key is missing or invalid.","type":"invalid_request_error","code":"invalid_api_key","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#invalid_api_key"}}}}},"402":{"description":"The account does not have enough prepaid credit for this request.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"Add credits before retrying this request.","type":"invalid_request_error","code":"insufficient_credits","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#insufficient_credits"}}}}},"429":{"description":"Rate limit exceeded. Respect Retry-After when present.","headers":{"Retry-After":{"schema":{"type":"integer","exclusiveMinimum":0,"description":"Seconds to wait before retrying."},"required":false,"description":"Seconds to wait before retrying."},"x-should-retry":{"schema":{"type":["boolean","null"],"description":"Whether the client should retry automatically."},"required":false,"description":"Whether the client should retry automatically."}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"Too many requests. Retry after the indicated delay.","type":"rate_limit_error","code":"rate_limit_exceeded","retryable":true,"doc_url":"https://keeprouter.com/docs/errors#rate_limit_exceeded"}}}}},"500":{"description":"Unexpected KeepRouter gateway error.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"The gateway could not complete the request.","type":"api_error","code":"internal_error","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#internal_error"}}}}},"502":{"description":"The selected upstream provider returned an unusable response.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"The upstream model provider returned an invalid response.","type":"api_error","code":"upstream_error","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#upstream_error"}}}}},"503":{"description":"No eligible healthy channel is currently available.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"No healthy channel is currently available.","type":"api_error","code":"service_unavailable","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#service_unavailable"}}}}}}}},"/messages":{"post":{"operationId":"createMessage","tags":["Anthropic (Claude) Messages"],"summary":"Create an Anthropic-style message","description":"Send an Anthropic Messages request from Claude Code or the Anthropic SDK. KeepRouter accepts x-api-key or Bearer authentication and returns native Anthropic response and error envelopes.","security":[{"BearerAuth":[]},{"AnthropicApiKey":[]}],"parameters":[{"schema":{"type":"string","description":"Anthropic API version, for example 2023-06-01."},"required":false,"description":"Anthropic API version, for example 2023-06-01.","name":"anthropic-version","in":"header"}],"requestBody":{"description":"Anthropic Messages request.","required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string","description":"模型 id，例如 claude-sonnet-4-6"},"max_tokens":{"type":"integer","exclusiveMinimum":0,"description":"最大生成 token 数（必填）"},"messages":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["user","assistant"]},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{}}],"description":"字符串，或内容块数组（text / image / tool_use / tool_result）"}},"required":["role","content"]},"description":"对话消息"},"system":{"anyOf":[{"type":"string"},{"type":"array","items":{}}],"description":"System 提示（字符串或内容块）"},"stream":{"type":"boolean","description":"是否走 SSE 流式输出"},"temperature":{"type":"number"},"top_p":{"type":"number"},"top_k":{"type":"number"},"stop_sequences":{"type":"array","items":{"type":"string"}},"tools":{"type":"array","items":{},"description":"工具定义（name / description / input_schema）"},"tool_choice":{},"metadata":{}},"required":["model","max_tokens","messages"]},"example":{"model":"claude-sonnet-4-6","max_tokens":512,"messages":[{"role":"user","content":"Explain this diff in three bullets."}],"stream":false}}}},"responses":{"200":{"description":"Anthropic Messages JSON, or named SSE events when stream=true.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["message"]},"role":{"type":"string","enum":["assistant"]},"model":{"type":"string"},"content":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"text":{"type":"string"}},"required":["type"]},"description":"内容块（type=text 时含 text；工具调用为 type=tool_use）"},"stop_reason":{"type":["string","null"],"description":"end_turn | max_tokens | tool_use | stop_sequence"},"stop_sequence":{"type":["string","null"]},"usage":{"type":"object","properties":{"input_tokens":{"type":"number"},"output_tokens":{"type":"number"}},"required":["input_tokens","output_tokens"]}},"required":["id","type","role","model","content","stop_reason","usage"]},"example":{"id":"msg_kr_example","type":"message","role":"assistant","model":"claude-sonnet-4-6","content":[{"type":"text","text":"- The change is scoped.\n- The contract is explicit.\n- Errors are documented."}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":18,"output_tokens":20}}},"text/event-stream":{"schema":{"type":"string","description":"Server-sent events terminated by data: [DONE]."},"example":"event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"delta\":{\"type\":\"text_delta\",\"text\":\"Hello\"}}\n\n"}}},"400":{"description":"Invalid JSON or request parameters.","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["error"]},"error":{"type":"object","properties":{"type":{"type":"string"},"message":{"type":"string"},"code":{"type":"string"}},"required":["type","message"]}},"required":["type","error"]},"example":{"type":"error","error":{"type":"invalid_request_error","message":"The request body is invalid.","code":"invalid_request"}}}}},"401":{"description":"Missing, invalid, expired, or revoked API key.","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["error"]},"error":{"type":"object","properties":{"type":{"type":"string"},"message":{"type":"string"},"code":{"type":"string"}},"required":["type","message"]}},"required":["type","error"]},"example":{"type":"error","error":{"type":"authentication_error","message":"The API key is missing or invalid.","code":"invalid_api_key"}}}}},"402":{"description":"The account does not have enough prepaid credit for this request.","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["error"]},"error":{"type":"object","properties":{"type":{"type":"string"},"message":{"type":"string"},"code":{"type":"string"}},"required":["type","message"]}},"required":["type","error"]},"example":{"type":"error","error":{"type":"invalid_request_error","message":"Add credits before retrying this request.","code":"insufficient_credits"}}}}},"429":{"description":"Rate limit exceeded. Respect Retry-After when present.","headers":{"Retry-After":{"schema":{"type":"integer","exclusiveMinimum":0,"description":"Seconds to wait before retrying."},"required":false,"description":"Seconds to wait before retrying."},"x-should-retry":{"schema":{"type":["boolean","null"],"description":"Whether the client should retry automatically."},"required":false,"description":"Whether the client should retry automatically."}},"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["error"]},"error":{"type":"object","properties":{"type":{"type":"string"},"message":{"type":"string"},"code":{"type":"string"}},"required":["type","message"]}},"required":["type","error"]},"example":{"type":"error","error":{"type":"rate_limit_error","message":"Too many requests. Retry after the indicated delay.","code":"rate_limit_exceeded"}}}}},"500":{"description":"Unexpected KeepRouter gateway error.","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["error"]},"error":{"type":"object","properties":{"type":{"type":"string"},"message":{"type":"string"},"code":{"type":"string"}},"required":["type","message"]}},"required":["type","error"]},"example":{"type":"error","error":{"type":"api_error","message":"The gateway could not complete the request.","code":"internal_error"}}}}},"502":{"description":"The selected upstream provider returned an unusable response.","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["error"]},"error":{"type":"object","properties":{"type":{"type":"string"},"message":{"type":"string"},"code":{"type":"string"}},"required":["type","message"]}},"required":["type","error"]},"example":{"type":"error","error":{"type":"api_error","message":"The upstream model provider returned an invalid response.","code":"upstream_error"}}}}},"503":{"description":"No eligible healthy channel is currently available.","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["error"]},"error":{"type":"object","properties":{"type":{"type":"string"},"message":{"type":"string"},"code":{"type":"string"}},"required":["type","message"]}},"required":["type","error"]},"example":{"type":"error","error":{"type":"overloaded_error","message":"No healthy channel is currently available.","code":"service_unavailable"}}}}}}}},"/messages/count_tokens":{"post":{"operationId":"countMessageTokens","tags":["Anthropic (Claude) Messages"],"summary":"Count Anthropic message input tokens","description":"Estimate input tokens locally for an Anthropic Messages payload. The key and model must be eligible for the corresponding Messages API call; this endpoint is not billed.","security":[{"BearerAuth":[]},{"AnthropicApiKey":[]}],"parameters":[{"schema":{"type":"string","description":"Anthropic API version, for example 2023-06-01."},"required":false,"description":"Anthropic API version, for example 2023-06-01.","name":"anthropic-version","in":"header"}],"requestBody":{"description":"Anthropic Messages payload to estimate.","required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string","description":"Canonical KeepRouter model id."},"messages":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["user","assistant"]},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{}}],"description":"字符串，或内容块数组（text / image / tool_use / tool_result）"}},"required":["role","content"]},"minItems":1},"system":{"anyOf":[{"type":"string"},{"type":"array","items":{}}]},"tools":{"type":"array","items":{}}},"required":["model","messages"]},"example":{"model":"claude-sonnet-4-6","messages":[{"role":"user","content":"How many tokens are in this request?"}]}}}},"responses":{"200":{"description":"Estimated input token count.","content":{"application/json":{"schema":{"type":"object","properties":{"input_tokens":{"type":"integer","minimum":0}},"required":["input_tokens"]},"example":{"input_tokens":18}}}},"400":{"description":"Invalid JSON or request parameters.","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["error"]},"error":{"type":"object","properties":{"type":{"type":"string"},"message":{"type":"string"},"code":{"type":"string"}},"required":["type","message"]}},"required":["type","error"]},"example":{"type":"error","error":{"type":"invalid_request_error","message":"The request body is invalid.","code":"invalid_request"}}}}},"401":{"description":"Missing, invalid, expired, or revoked API key.","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["error"]},"error":{"type":"object","properties":{"type":{"type":"string"},"message":{"type":"string"},"code":{"type":"string"}},"required":["type","message"]}},"required":["type","error"]},"example":{"type":"error","error":{"type":"authentication_error","message":"The API key is missing or invalid.","code":"invalid_api_key"}}}}},"402":{"description":"The account does not have enough prepaid credit for this request.","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["error"]},"error":{"type":"object","properties":{"type":{"type":"string"},"message":{"type":"string"},"code":{"type":"string"}},"required":["type","message"]}},"required":["type","error"]},"example":{"type":"error","error":{"type":"invalid_request_error","message":"Add credits before retrying this request.","code":"insufficient_credits"}}}}},"429":{"description":"Rate limit exceeded. Respect Retry-After when present.","headers":{"Retry-After":{"schema":{"type":"integer","exclusiveMinimum":0,"description":"Seconds to wait before retrying."},"required":false,"description":"Seconds to wait before retrying."},"x-should-retry":{"schema":{"type":["boolean","null"],"description":"Whether the client should retry automatically."},"required":false,"description":"Whether the client should retry automatically."}},"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["error"]},"error":{"type":"object","properties":{"type":{"type":"string"},"message":{"type":"string"},"code":{"type":"string"}},"required":["type","message"]}},"required":["type","error"]},"example":{"type":"error","error":{"type":"rate_limit_error","message":"Too many requests. Retry after the indicated delay.","code":"rate_limit_exceeded"}}}}},"500":{"description":"Unexpected KeepRouter gateway error.","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["error"]},"error":{"type":"object","properties":{"type":{"type":"string"},"message":{"type":"string"},"code":{"type":"string"}},"required":["type","message"]}},"required":["type","error"]},"example":{"type":"error","error":{"type":"api_error","message":"The gateway could not complete the request.","code":"internal_error"}}}}},"502":{"description":"The selected upstream provider returned an unusable response.","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["error"]},"error":{"type":"object","properties":{"type":{"type":"string"},"message":{"type":"string"},"code":{"type":"string"}},"required":["type","message"]}},"required":["type","error"]},"example":{"type":"error","error":{"type":"api_error","message":"The upstream model provider returned an invalid response.","code":"upstream_error"}}}}},"503":{"description":"No eligible healthy channel is currently available.","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["error"]},"error":{"type":"object","properties":{"type":{"type":"string"},"message":{"type":"string"},"code":{"type":"string"}},"required":["type","message"]}},"required":["type","error"]},"example":{"type":"error","error":{"type":"overloaded_error","message":"No healthy channel is currently available.","code":"service_unavailable"}}}}}}}},"/responses":{"post":{"operationId":"createResponse","tags":["OpenAI-compatible generation"],"summary":"Create a Responses API response","description":"Generate text or structured output through the OpenAI Responses API shape. Use this endpoint for input-item and tool workflows; use stream=true for server-sent events.","security":[{"BearerAuth":[]},{"AnthropicApiKey":[]}],"requestBody":{"description":"OpenAI Responses API request.","required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string","minLength":1,"description":"Canonical KeepRouter model id."},"input":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"object","additionalProperties":{}}}],"description":"Text or Responses API input items."},"instructions":{"type":"string"},"max_output_tokens":{"type":"integer","exclusiveMinimum":0},"temperature":{"type":"number","minimum":0,"maximum":2},"top_p":{"type":"number","minimum":0,"maximum":1},"stream":{"type":"boolean","default":false},"tools":{"type":"array","items":{"type":"object","additionalProperties":{}}},"tool_choice":{"anyOf":[{"type":"string"},{"type":"object","additionalProperties":{}}]},"metadata":{"type":"object","additionalProperties":{}}},"required":["model","input"]},"example":{"model":"deepseek-v4-pro","input":"Give me a concise release checklist."}}}},"responses":{"200":{"description":"Completed response JSON, or an SSE stream when stream=true.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["response"]},"created_at":{"type":"integer"},"status":{"type":"string"},"model":{"type":"string"},"output":{"type":"array","items":{"type":"object","additionalProperties":{}}},"output_text":{"type":"string"},"usage":{"type":"object","properties":{"input_tokens":{"type":"integer","minimum":0},"output_tokens":{"type":"integer","minimum":0},"total_tokens":{"type":"integer","minimum":0}}}},"required":["id","object","status","model","output"]},"example":{"id":"resp_kr_example","object":"response","status":"completed","model":"deepseek-v4-pro","output":[{"type":"message","role":"assistant","content":[{"type":"output_text","text":"1. Test\n2. Deploy\n3. Verify"}]}],"output_text":"1. Test\n2. Deploy\n3. Verify","usage":{"input_tokens":9,"output_tokens":12,"total_tokens":21}}},"text/event-stream":{"schema":{"type":"string","description":"Server-sent events terminated by data: [DONE]."},"example":"data: {\"type\":\"response.output_text.delta\",\"delta\":\"Hello\"}\n\ndata: [DONE]\n\n"}}},"400":{"description":"Invalid JSON or request parameters.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"The request body is invalid.","type":"invalid_request_error","code":"invalid_request","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#invalid_request"}}}}},"401":{"description":"Missing, invalid, expired, or revoked API key.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"The API key is missing or invalid.","type":"invalid_request_error","code":"invalid_api_key","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#invalid_api_key"}}}}},"402":{"description":"The account does not have enough prepaid credit for this request.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"Add credits before retrying this request.","type":"invalid_request_error","code":"insufficient_credits","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#insufficient_credits"}}}}},"429":{"description":"Rate limit exceeded. Respect Retry-After when present.","headers":{"Retry-After":{"schema":{"type":"integer","exclusiveMinimum":0,"description":"Seconds to wait before retrying."},"required":false,"description":"Seconds to wait before retrying."},"x-should-retry":{"schema":{"type":["boolean","null"],"description":"Whether the client should retry automatically."},"required":false,"description":"Whether the client should retry automatically."}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"Too many requests. Retry after the indicated delay.","type":"rate_limit_error","code":"rate_limit_exceeded","retryable":true,"doc_url":"https://keeprouter.com/docs/errors#rate_limit_exceeded"}}}}},"500":{"description":"Unexpected KeepRouter gateway error.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"The gateway could not complete the request.","type":"api_error","code":"internal_error","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#internal_error"}}}}},"502":{"description":"The selected upstream provider returned an unusable response.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"The upstream model provider returned an invalid response.","type":"api_error","code":"upstream_error","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#upstream_error"}}}}},"503":{"description":"No eligible healthy channel is currently available.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"No healthy channel is currently available.","type":"api_error","code":"service_unavailable","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#service_unavailable"}}}}}}}},"/audio/speech":{"post":{"operationId":"createSpeech","tags":["Audio"],"summary":"Generate speech audio","description":"Synthesize speech from text. The response is binary audio in the requested response_format; mp3 is the default.","security":[{"BearerAuth":[]},{"AnthropicApiKey":[]}],"requestBody":{"description":"Text-to-speech request.","required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string","minLength":1},"input":{"type":"string","minLength":1,"description":"Text to synthesize."},"voice":{"type":"string","minLength":1,"description":"Voice supported by the selected model."},"response_format":{"type":"string","enum":["mp3","opus","aac","flac","wav","pcm"],"default":"mp3"},"speed":{"type":"number","exclusiveMinimum":0,"default":1}},"required":["model","input","voice"]},"example":{"model":"gpt-4o-mini-tts","input":"Your build is ready.","voice":"alloy","response_format":"mp3"}}}},"responses":{"200":{"description":"Generated binary audio.","content":{"audio/mpeg":{"schema":{"type":"string","format":"binary","description":"Generated audio bytes."}},"audio/ogg":{"schema":{"type":"string","format":"binary","description":"Generated audio bytes."}},"audio/aac":{"schema":{"type":"string","format":"binary","description":"Generated audio bytes."}},"audio/flac":{"schema":{"type":"string","format":"binary","description":"Generated audio bytes."}},"audio/wav":{"schema":{"type":"string","format":"binary","description":"Generated audio bytes."}},"application/octet-stream":{"schema":{"type":"string","format":"binary","description":"Generated audio bytes."}}}},"400":{"description":"Invalid JSON or request parameters.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"The request body is invalid.","type":"invalid_request_error","code":"invalid_request","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#invalid_request"}}}}},"401":{"description":"Missing, invalid, expired, or revoked API key.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"The API key is missing or invalid.","type":"invalid_request_error","code":"invalid_api_key","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#invalid_api_key"}}}}},"402":{"description":"The account does not have enough prepaid credit for this request.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"Add credits before retrying this request.","type":"invalid_request_error","code":"insufficient_credits","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#insufficient_credits"}}}}},"429":{"description":"Rate limit exceeded. Respect Retry-After when present.","headers":{"Retry-After":{"schema":{"type":"integer","exclusiveMinimum":0,"description":"Seconds to wait before retrying."},"required":false,"description":"Seconds to wait before retrying."},"x-should-retry":{"schema":{"type":["boolean","null"],"description":"Whether the client should retry automatically."},"required":false,"description":"Whether the client should retry automatically."}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"Too many requests. Retry after the indicated delay.","type":"rate_limit_error","code":"rate_limit_exceeded","retryable":true,"doc_url":"https://keeprouter.com/docs/errors#rate_limit_exceeded"}}}}},"500":{"description":"Unexpected KeepRouter gateway error.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"The gateway could not complete the request.","type":"api_error","code":"internal_error","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#internal_error"}}}}},"502":{"description":"The selected upstream provider returned an unusable response.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"The upstream model provider returned an invalid response.","type":"api_error","code":"upstream_error","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#upstream_error"}}}}},"503":{"description":"No eligible healthy channel is currently available.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"No healthy channel is currently available.","type":"api_error","code":"service_unavailable","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#service_unavailable"}}}}}}}},"/images/generations":{"post":{"operationId":"createImage","tags":["Images"],"summary":"Generate an image","description":"Generate one image from a text prompt. The response contains either a hosted URL or base64-encoded image data, depending on the model and response_format.","security":[{"BearerAuth":[]},{"AnthropicApiKey":[]}],"requestBody":{"description":"OpenAI-compatible image generation request.","required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string","minLength":1},"prompt":{"type":"string","minLength":1},"n":{"type":"number","enum":[1],"description":"KeepRouter bills and returns one generated image per request."},"size":{"type":"string"},"quality":{"type":"string"},"style":{"type":"string"},"response_format":{"type":"string","enum":["url","b64_json"]},"user":{"type":"string"}},"required":["model","prompt"]},"example":{"model":"gpt-image-1","prompt":"A clean editorial illustration of an API router","n":1,"size":"1024x1024"}}}},"responses":{"200":{"description":"Generated image payload.","content":{"application/json":{"schema":{"type":"object","properties":{"created":{"type":"integer"},"data":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"b64_json":{"type":"string"},"revised_prompt":{"type":"string"}}}}},"required":["created","data"]},"example":{"created":1786800000,"data":[{"b64_json":"iVBORw0KGgoAAA...","revised_prompt":"Editorial illustration of an API router"}]}}}},"400":{"description":"Invalid JSON or request parameters.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"The request body is invalid.","type":"invalid_request_error","code":"invalid_request","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#invalid_request"}}}}},"401":{"description":"Missing, invalid, expired, or revoked API key.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"The API key is missing or invalid.","type":"invalid_request_error","code":"invalid_api_key","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#invalid_api_key"}}}}},"402":{"description":"The account does not have enough prepaid credit for this request.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"Add credits before retrying this request.","type":"invalid_request_error","code":"insufficient_credits","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#insufficient_credits"}}}}},"429":{"description":"Rate limit exceeded. Respect Retry-After when present.","headers":{"Retry-After":{"schema":{"type":"integer","exclusiveMinimum":0,"description":"Seconds to wait before retrying."},"required":false,"description":"Seconds to wait before retrying."},"x-should-retry":{"schema":{"type":["boolean","null"],"description":"Whether the client should retry automatically."},"required":false,"description":"Whether the client should retry automatically."}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"Too many requests. Retry after the indicated delay.","type":"rate_limit_error","code":"rate_limit_exceeded","retryable":true,"doc_url":"https://keeprouter.com/docs/errors#rate_limit_exceeded"}}}}},"500":{"description":"Unexpected KeepRouter gateway error.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"The gateway could not complete the request.","type":"api_error","code":"internal_error","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#internal_error"}}}}},"502":{"description":"The selected upstream provider returned an unusable response.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"The upstream model provider returned an invalid response.","type":"api_error","code":"upstream_error","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#upstream_error"}}}}},"503":{"description":"No eligible healthy channel is currently available.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"No healthy channel is currently available.","type":"api_error","code":"service_unavailable","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#service_unavailable"}}}}}}}},"/embeddings":{"post":{"operationId":"createEmbedding","tags":["Embeddings"],"summary":"Create embeddings","description":"Convert one or more text or token inputs into embedding vectors using an OpenAI-compatible request and response shape.","security":[{"BearerAuth":[]},{"AnthropicApiKey":[]}],"requestBody":{"description":"OpenAI-compatible embeddings request.","required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string","minLength":1},"input":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"array","items":{"type":"number"}},{"type":"array","items":{"type":"array","items":{"type":"number"}}}]},"encoding_format":{"type":"string","enum":["float","base64"],"default":"float"},"dimensions":{"type":"integer","exclusiveMinimum":0},"user":{"type":"string"}},"required":["model","input"]},"example":{"model":"text-embedding-3-small","input":["KeepRouter unifies model APIs.","Published pricing improves predictability."],"encoding_format":"float"}}}},"responses":{"200":{"description":"Embedding vectors and token usage.","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","enum":["list"]},"model":{"type":"string"},"data":{"type":"array","items":{"type":"object","properties":{"object":{"type":"string","enum":["embedding"]},"embedding":{"anyOf":[{"type":"array","items":{"type":"number"}},{"type":"string"}]},"index":{"type":"integer","minimum":0}},"required":["object","embedding","index"]}},"usage":{"type":"object","properties":{"prompt_tokens":{"type":"integer","minimum":0},"total_tokens":{"type":"integer","minimum":0}},"required":["prompt_tokens","total_tokens"]}},"required":["object","model","data","usage"]},"example":{"object":"list","model":"text-embedding-3-small","data":[{"object":"embedding","embedding":[0.012,-0.008,0.031],"index":0}],"usage":{"prompt_tokens":12,"total_tokens":12}}}}},"400":{"description":"Invalid JSON or request parameters.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"The request body is invalid.","type":"invalid_request_error","code":"invalid_request","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#invalid_request"}}}}},"401":{"description":"Missing, invalid, expired, or revoked API key.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"The API key is missing or invalid.","type":"invalid_request_error","code":"invalid_api_key","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#invalid_api_key"}}}}},"402":{"description":"The account does not have enough prepaid credit for this request.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"Add credits before retrying this request.","type":"invalid_request_error","code":"insufficient_credits","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#insufficient_credits"}}}}},"429":{"description":"Rate limit exceeded. Respect Retry-After when present.","headers":{"Retry-After":{"schema":{"type":"integer","exclusiveMinimum":0,"description":"Seconds to wait before retrying."},"required":false,"description":"Seconds to wait before retrying."},"x-should-retry":{"schema":{"type":["boolean","null"],"description":"Whether the client should retry automatically."},"required":false,"description":"Whether the client should retry automatically."}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"Too many requests. Retry after the indicated delay.","type":"rate_limit_error","code":"rate_limit_exceeded","retryable":true,"doc_url":"https://keeprouter.com/docs/errors#rate_limit_exceeded"}}}}},"500":{"description":"Unexpected KeepRouter gateway error.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"The gateway could not complete the request.","type":"api_error","code":"internal_error","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#internal_error"}}}}},"502":{"description":"The selected upstream provider returned an unusable response.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"The upstream model provider returned an invalid response.","type":"api_error","code":"upstream_error","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#upstream_error"}}}}},"503":{"description":"No eligible healthy channel is currently available.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"No healthy channel is currently available.","type":"api_error","code":"service_unavailable","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#service_unavailable"}}}}}}}},"/models":{"get":{"operationId":"listModels","tags":["OpenAI Proxy"],"summary":"List available models","description":"List public model ids in the OpenAI models shape. Without authentication this returns the public catalog; with a valid API key it returns only models the key is currently eligible to call.","security":[{},{"BearerAuth":[]},{"AnthropicApiKey":[]}],"responses":{"200":{"description":"List of available models","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string"},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string"},"created":{"type":"number"},"owned_by":{"type":"string"}},"required":["id","object","created","owned_by"]}}},"required":["object","data"]},"example":{"object":"list","data":[{"id":"deepseek-v4-pro","object":"model","created":1700000000,"owned_by":"api-router"}]}}}},"400":{"description":"Invalid JSON or request parameters.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"The request body is invalid.","type":"invalid_request_error","code":"invalid_request","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#invalid_request"}}}}},"401":{"description":"Missing, invalid, expired, or revoked API key.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"The API key is missing or invalid.","type":"invalid_request_error","code":"invalid_api_key","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#invalid_api_key"}}}}},"402":{"description":"The account does not have enough prepaid credit for this request.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"Add credits before retrying this request.","type":"invalid_request_error","code":"insufficient_credits","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#insufficient_credits"}}}}},"429":{"description":"Rate limit exceeded. Respect Retry-After when present.","headers":{"Retry-After":{"schema":{"type":"integer","exclusiveMinimum":0,"description":"Seconds to wait before retrying."},"required":false,"description":"Seconds to wait before retrying."},"x-should-retry":{"schema":{"type":["boolean","null"],"description":"Whether the client should retry automatically."},"required":false,"description":"Whether the client should retry automatically."}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"Too many requests. Retry after the indicated delay.","type":"rate_limit_error","code":"rate_limit_exceeded","retryable":true,"doc_url":"https://keeprouter.com/docs/errors#rate_limit_exceeded"}}}}},"500":{"description":"Unexpected KeepRouter gateway error.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"The gateway could not complete the request.","type":"api_error","code":"internal_error","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#internal_error"}}}}},"502":{"description":"The selected upstream provider returned an unusable response.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"The upstream model provider returned an invalid response.","type":"api_error","code":"upstream_error","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#upstream_error"}}}}},"503":{"description":"No eligible healthy channel is currently available.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"retryable":{"type":"boolean"},"param":{"type":"string"},"doc_url":{"type":"string","format":"uri"}},"required":["message","type","code","retryable","doc_url"]}},"required":["error"]},"example":{"error":{"message":"No healthy channel is currently available.","type":"api_error","code":"service_unavailable","retryable":false,"doc_url":"https://keeprouter.com/docs/errors#service_unavailable"}}}}}}}}},"webhooks":{}}