{"openapi": "3.1.0", "info": {"title": "Dyadic OpenRouter-Compatible Gateway", "version": "1.1.1", "description": "OpenRouter's API through Dyadic: point an OpenRouter client (or an OpenAI SDK with OpenRouter's model ids) at\n`https://api.dyadic.app/openrouter/v1` with a Dyadic API key that has the AI gateway switch.\n\n**Who turns it on.** The gateway reaches any of OpenRouter's models at the platform's cost, so it's a platform decision:\nDyadic (a platform administrator) turns it on for an app's key on request. The key's owner can turn it off at any time in\nthe key's settings; turning it back on is again Dyadic's. A key without it is answered `403 gateway_not_allowed`: that's\nthe policy, not a fault.\n\nRequests and answers are OpenRouter's (model ids like `anthropic/claude-haiku-5.5`, `models` fallback lists, `provider`\nrouting, `reasoning`, `plugins`, `usage.cost`, its errors), on the application's own OpenRouter key when its API key carries\none, else on Dyadic's. On the way Dyadic applies the key's switches (images, embeddings, audio), its output cap and, when\nthe key moderates requests, moderation; it refuses provider-side web search (`400 paid_search_disabled`: the `web` plugin,\na `web_search` tool, an `:online` or Perplexity model). Each model request counts against the key's rate, spending and\nconcurrency limits and is kept, with its cost, in the key's activity log (and Black Box, when the key records); a refused\nrequest is logged with its reason.\n\n[`GET /key`](https://dyadic.app/developers/api/#openrouter/tag/account/GET/key) (also [`GET /auth/key`](https://dyadic.app/developers/api/#openrouter/tag/account/GET/auth/key)) and [`GET /credits`](https://dyadic.app/developers/api/#openrouter/tag/account/GET/credits) are answered by Dyadic, never OpenRouter: the Dyadic key's own usage\nand limits, and its account's allowance, in US dollars. [`GET /generation`](https://dyadic.app/developers/api/#openrouter/tag/lookups/GET/generation) answers only for this key's own requests.\n\nThis contract describes the gateway routes Dyadic implements, not every upstream API family.\nRead [`GET /models`](https://dyadic.app/developers/api/#openrouter/tag/lookups/GET/models) for the current catalog. Closing a local stream is not proof of provider cancellation or\nzero charges; reconcile a retained generation before considering a retry. Workspace-generated video does\nnot imply a public video-generation route in this gateway contract.\n"}, "servers": [{"url": "https://api.dyadic.app/openrouter/v1"}, {"url": "https://api.dyadic.app/gateway/v1"}], "components": {"schemas": {"Error": {"type": "object", "properties": {"error": {"type": "object", "properties": {"message": {"type": "string"}, "type": {"type": "string"}, "param": {"type": ["string", "null"]}, "code": {"type": ["string", "null"]}}}}}, "KeyInfo": {"type": "object", "properties": {"data": {"type": "object", "properties": {"label": {"type": "string", "description": "The key's name."}, "usage": {"type": "number", "description": "What the key has cost, ever, in dollars."}, "limit": {"type": ["number", "null"], "description": "Its spending limit in dollars (or its credits limit in dollars)."}, "limit_remaining": {"type": ["number", "null"], "description": "What's left of it this period."}, "limit_reset": {"type": ["string", "null"], "enum": ["daily", "weekly", "monthly", null]}, "is_free_tier": {"const": false}, "is_provisioning_key": {"const": false}, "rate_limit": {"type": "object", "properties": {"requests": {"type": "integer", "description": "The key's requests a minute."}, "interval": {"const": "1m"}}}}}}}, "Credits": {"type": "object", "properties": {"data": {"type": "object", "properties": {"total_credits": {"type": ["number", "null"], "description": "This week's allowance in dollars; null when unlimited."}, "total_usage": {"type": "number", "description": "Used and held this week, in dollars."}}}}}}, "securitySchemes": {"bearer": {"type": "http", "scheme": "bearer"}}}, "security": [{"bearer": []}], "paths": {"/chat/completions": {"post": {"tags": ["Models"], "operationId": "createChatCompletion", "summary": "Chat completion", "responses": {"200": {"description": "OpenRouter's answer", "content": {"application/json": {"schema": {"type": "object"}}, "text/event-stream": {"schema": {"type": "string"}}}}, "400": {"description": "invalid_json (the body isn't a JSON object), paid_search_disabled, or content_flagged (the key's moderation)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Missing or invalid API key", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "403": {"description": "gateway_not_allowed (the key doesn't have the AI gateway: Dyadic turns it on for an app), a key switch the request needs (images, embeddings, audio), or a paused key, an address it doesn't allow or an inactive account", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "413": {"description": "request_too_large: over 32 MB", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate, spending or concurrency limit", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "502": {"description": "upstream_unavailable: OpenRouter couldn't be reached or didn't answer in time; upstream_error (lookups): its answer wasn't JSON", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "503": {"description": "unavailable: the gateway isn't configured", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "description": "The key's output cap, when it has one, replaces a larger or non-integer max_tokens or max_completion_tokens, or is sent when neither is. With stream: true, OpenRouter's Server-Sent Events. A moderated key's request is checked (400 content_flagged); a flagged whole answer becomes a short refusal with finish_reason content_filter, and a flagged stream ends with a content_filter chunk.", "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "description": "OpenRouter's request body."}}}}}}, "/completions": {"post": {"tags": ["Models"], "operationId": "createCompletion", "summary": "Text completion", "responses": {"200": {"description": "OpenRouter's answer", "content": {"application/json": {"schema": {"type": "object"}}, "text/event-stream": {"schema": {"type": "string"}}}}, "400": {"description": "invalid_json (the body isn't a JSON object), paid_search_disabled, or content_flagged (the key's moderation)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Missing or invalid API key", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "403": {"description": "gateway_not_allowed (the key doesn't have the AI gateway: Dyadic turns it on for an app), a key switch the request needs (images, embeddings, audio), or a paused key, an address it doesn't allow or an inactive account", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "413": {"description": "request_too_large: over 32 MB", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate, spending or concurrency limit", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "502": {"description": "upstream_unavailable: OpenRouter couldn't be reached or didn't answer in time; upstream_error (lookups): its answer wasn't JSON", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "503": {"description": "unavailable: the gateway isn't configured", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "description": "The key's output cap, when it has one, replaces a larger or non-integer max_tokens or max_completion_tokens, or is sent when neither is. With stream: true, OpenRouter's Server-Sent Events. A moderated key's request is checked (400 content_flagged); a flagged whole answer becomes a short refusal with finish_reason content_filter, and a flagged stream ends with a content_filter chunk.", "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "description": "OpenRouter's request body."}}}}}}, "/embeddings": {"post": {"tags": ["Models"], "operationId": "createEmbedding", "summary": "Embeddings (the key's Embeddings switch)", "responses": {"200": {"description": "OpenRouter's answer", "content": {"application/json": {"schema": {"type": "object"}}}}, "400": {"description": "invalid_json (the body isn't a JSON object), paid_search_disabled, or content_flagged (the key's moderation)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Missing or invalid API key", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "403": {"description": "gateway_not_allowed (the key doesn't have the AI gateway: Dyadic turns it on for an app), a key switch the request needs (images, embeddings, audio), or a paused key, an address it doesn't allow or an inactive account", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "413": {"description": "request_too_large: over 32 MB", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate, spending or concurrency limit", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "502": {"description": "upstream_unavailable: OpenRouter couldn't be reached or didn't answer in time; upstream_error (lookups): its answer wasn't JSON", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "503": {"description": "unavailable: the gateway isn't configured", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "description": "OpenRouter's request body."}}}}}}, "/audio/speech": {"post": {"tags": ["Models"], "operationId": "createSpeech", "summary": "Text to speech (the key's Audio switch)", "responses": {"200": {"description": "OpenRouter's answer", "content": {"audio/*": {"schema": {"type": "string", "format": "binary"}}}}, "400": {"description": "invalid_json (the body isn't a JSON object), paid_search_disabled, or content_flagged (the key's moderation)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Missing or invalid API key", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "403": {"description": "gateway_not_allowed (the key doesn't have the AI gateway: Dyadic turns it on for an app), a key switch the request needs (images, embeddings, audio), or a paused key, an address it doesn't allow or an inactive account", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "413": {"description": "request_too_large: over 32 MB", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate, spending or concurrency limit", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "502": {"description": "upstream_unavailable: OpenRouter couldn't be reached or didn't answer in time; upstream_error (lookups): its answer wasn't JSON", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "503": {"description": "unavailable: the gateway isn't configured", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "description": "OpenRouter's request body."}}}}}}, "/audio/transcriptions": {"post": {"tags": ["Models"], "operationId": "createTranscription", "summary": "Transcription (the key's Audio switch)", "responses": {"200": {"description": "OpenRouter's answer", "content": {"application/json": {"schema": {"type": "object"}}}}, "400": {"description": "invalid_json (the body isn't a JSON object), paid_search_disabled, or content_flagged (the key's moderation)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Missing or invalid API key", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "403": {"description": "gateway_not_allowed (the key doesn't have the AI gateway: Dyadic turns it on for an app), a key switch the request needs (images, embeddings, audio), or a paused key, an address it doesn't allow or an inactive account", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "413": {"description": "request_too_large: over 32 MB", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate, spending or concurrency limit", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "502": {"description": "upstream_unavailable: OpenRouter couldn't be reached or didn't answer in time; upstream_error (lookups): its answer wasn't JSON", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "503": {"description": "unavailable: the gateway isn't configured", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "description": "OpenRouter's request body."}}, "multipart/form-data": {"schema": {"type": "object", "description": "Forwarded as sent."}}}}}}, "/images": {"post": {"tags": ["Models"], "operationId": "createImage", "summary": "Image generation (the key's Images switch)", "responses": {"200": {"description": "OpenRouter's answer", "content": {"application/json": {"schema": {"type": "object"}}}}, "400": {"description": "invalid_json (the body isn't a JSON object), paid_search_disabled, or content_flagged (the key's moderation)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Missing or invalid API key", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "403": {"description": "gateway_not_allowed (the key doesn't have the AI gateway: Dyadic turns it on for an app), a key switch the request needs (images, embeddings, audio), or a paused key, an address it doesn't allow or an inactive account", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "413": {"description": "request_too_large: over 32 MB", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate, spending or concurrency limit", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "502": {"description": "upstream_unavailable: OpenRouter couldn't be reached or didn't answer in time; upstream_error (lookups): its answer wasn't JSON", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "503": {"description": "unavailable: the gateway isn't configured", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "description": "A moderated key's prompt is checked before anything is drawn (400 content_flagged).", "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "description": "OpenRouter's request body."}}}}}}, "/models": {"get": {"tags": ["Lookups"], "operationId": "listModels", "summary": "OpenRouter's models", "responses": {"200": {"description": "OpenRouter's answer", "content": {"application/json": {"schema": {"type": "object"}}}}, "401": {"description": "Missing or invalid API key", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "403": {"description": "gateway_not_allowed (the key doesn't have the AI gateway: Dyadic turns it on for an app), a key switch the request needs (images, embeddings, audio), or a paused key, an address it doesn't allow or an inactive account", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate, spending or concurrency limit", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "502": {"description": "upstream_unavailable: OpenRouter couldn't be reached or didn't answer in time; upstream_error (lookups): its answer wasn't JSON", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "503": {"description": "unavailable: the gateway isn't configured", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "description": "OpenRouter's answer, unchanged; the query goes to OpenRouter as sent."}}, "/models/{author}/{slug}/endpoints": {"get": {"tags": ["Lookups"], "operationId": "listEndpoints", "summary": "A model's providers and prices", "responses": {"200": {"description": "OpenRouter's answer", "content": {"application/json": {"schema": {"type": "object"}}}}, "401": {"description": "Missing or invalid API key", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "403": {"description": "gateway_not_allowed (the key doesn't have the AI gateway: Dyadic turns it on for an app), a key switch the request needs (images, embeddings, audio), or a paused key, an address it doesn't allow or an inactive account", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate, spending or concurrency limit", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "502": {"description": "upstream_unavailable: OpenRouter couldn't be reached or didn't answer in time; upstream_error (lookups): its answer wasn't JSON", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "503": {"description": "unavailable: the gateway isn't configured", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "description": "OpenRouter's answer, unchanged; the query goes to OpenRouter as sent.", "parameters": [{"name": "author", "in": "path", "required": true, "schema": {"type": "string"}}, {"name": "slug", "in": "path", "required": true, "schema": {"type": "string"}}]}}, "/images/models/{author}/{slug}/endpoints": {"get": {"tags": ["Lookups"], "operationId": "listImageEndpoints", "summary": "An image model's providers and prices", "responses": {"200": {"description": "OpenRouter's answer", "content": {"application/json": {"schema": {"type": "object"}}}}, "401": {"description": "Missing or invalid API key", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "403": {"description": "gateway_not_allowed (the key doesn't have the AI gateway: Dyadic turns it on for an app), a key switch the request needs (images, embeddings, audio), or a paused key, an address it doesn't allow or an inactive account", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate, spending or concurrency limit", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "502": {"description": "upstream_unavailable: OpenRouter couldn't be reached or didn't answer in time; upstream_error (lookups): its answer wasn't JSON", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "503": {"description": "unavailable: the gateway isn't configured", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "description": "OpenRouter's answer, unchanged; the query goes to OpenRouter as sent.", "parameters": [{"name": "author", "in": "path", "required": true, "schema": {"type": "string"}}, {"name": "slug", "in": "path", "required": true, "schema": {"type": "string"}}]}}, "/generation": {"get": {"tags": ["Lookups"], "operationId": "getGeneration", "summary": "A generation's cost and tokens (this key's own requests only)", "responses": {"200": {"description": "OpenRouter's answer", "content": {"application/json": {"schema": {"type": "object"}}}}, "401": {"description": "Missing or invalid API key", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "403": {"description": "gateway_not_allowed (the key doesn't have the AI gateway: Dyadic turns it on for an app), a key switch the request needs (images, embeddings, audio), or a paused key, an address it doesn't allow or an inactive account", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "404": {"description": "not_found: no request with that id was made with this key", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate, spending or concurrency limit", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "502": {"description": "upstream_unavailable: OpenRouter couldn't be reached or didn't answer in time; upstream_error (lookups): its answer wasn't JSON", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "503": {"description": "unavailable: the gateway isn't configured", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "parameters": [{"name": "id", "in": "query", "required": true, "schema": {"type": "string"}, "description": "A generation id this key made; only it goes to OpenRouter."}]}}, "/key": {"get": {"tags": ["Account"], "operationId": "getKey", "summary": "This Dyadic key's usage and limits (answered by Dyadic)", "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/KeyInfo"}}}}, "401": {"description": "Missing or invalid API key", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "403": {"description": "gateway_not_allowed (the key doesn't have the AI gateway: Dyadic turns it on for an app), a key switch the request needs (images, embeddings, audio), or a paused key, an address it doesn't allow or an inactive account", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate, spending or concurrency limit", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "503": {"description": "unavailable: the gateway isn't configured", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}}}, "/auth/key": {"get": {"tags": ["Account"], "operationId": "getAuthKey", "summary": "This Dyadic key's usage and limits (answered by Dyadic)", "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/KeyInfo"}}}}, "401": {"description": "Missing or invalid API key", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "403": {"description": "gateway_not_allowed (the key doesn't have the AI gateway: Dyadic turns it on for an app), a key switch the request needs (images, embeddings, audio), or a paused key, an address it doesn't allow or an inactive account", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate, spending or concurrency limit", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "503": {"description": "unavailable: the gateway isn't configured", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "description": "The same answer as [`GET /key`](https://dyadic.app/developers/api/#openrouter/tag/account/GET/key)."}}, "/credits": {"get": {"tags": ["Account"], "operationId": "getCredits", "summary": "The account's allowance and use, in dollars (answered by Dyadic)", "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Credits"}}}}, "401": {"description": "Missing or invalid API key", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "403": {"description": "gateway_not_allowed (the key doesn't have the AI gateway: Dyadic turns it on for an app), a key switch the request needs (images, embeddings, audio), or a paused key, an address it doesn't allow or an inactive account", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate, spending or concurrency limit", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "503": {"description": "unavailable: the gateway isn't configured", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}}}}}