{"openapi": "3.1.0", "info": {"title": "Dyadic Anthropic-Compatible API", "version": "1.0.0", "description": "Anthropic's Messages API on Dyadic: point an Anthropic SDK (or any client of Anthropic's API, Claude Code included)\nat `https://dyadic.app/api/anthropic` with a Dyadic API key, sent as `x-api-key` or `Authorization: Bearer`. Requests run on\nthe key's agents, limits, credits, activity log and Black Box, answered by the model chosen for this API in Admin > Models.\n\nA `model` is one of the key's agents (`iris`, `iris-think`) or any Claude model name, which runs the key's first agent; the\nname asked for is the name answered with. Thinking (`adaptive` by `output_config.effort`, `enabled` by `budget_tokens`,\n`disabled`) is shown with the signature its model gave, empty when it gives none. Prompt caching (`cache_control`), structured\noutput (`output_config.format`), stop sequences, images and PDFs (inline or by Files API id) are supported.\n\nServer tools run on Dyadic's own: `web_search` and `web_fetch` (with `max_uses`), `code_execution` (Python and bash in\nDyadic's containers; the key's Code Interpreter switch) and remote MCP servers (`mcp_servers`; the key's MCP switch).\nAnthropic's client tools (`bash`, the text editor, `memory`) are the application's to run. Refused with 400, never ignored:\ndomain limits on web search and fetch, Anthropic's skills, the computer and browser toolsets and tool search.\n\nErrors have Anthropic's shape (`{\"type\": \"error\", \"error\": {\"type\", \"message\"}}`) and statuses: 400 invalid_request_error,\n401 authentication_error, 402 billing_error (credits or a key limit), 403 permission_error, 404 not_found_error,\n413 request_too_large, 429 rate_limit_error, 5xx api_error. Every response carries a `request-id` header.\n"}, "servers": [{"url": "https://dyadic.app/api/anthropic/v1"}], "components": {"schemas": {"Error": {"type": "object", "properties": {"type": {"const": "error"}, "error": {"type": "object", "properties": {"type": {"type": "string"}, "message": {"type": "string"}}}, "request_id": {"type": "string"}}}, "ContentBlock": {"type": "object", "description": "A content block: text, image, document, tool_use, tool_result, thinking, redacted_thinking, server_tool_use, web_search_tool_result, web_fetch_tool_result, code_execution_tool_result, bash_code_execution_tool_result, mcp_tool_use or mcp_tool_result.", "properties": {"type": {"type": "string"}}, "required": ["type"]}, "MessageParam": {"type": "object", "required": ["role", "content"], "properties": {"role": {"enum": ["user", "assistant"]}, "content": {"oneOf": [{"type": "string"}, {"type": "array", "items": {"$ref": "#/components/schemas/ContentBlock"}}]}}}, "Tool": {"type": "object", "description": "A custom tool ({name, description, input_schema}), a server tool (web_search_*, web_fetch_*, code_execution_*) or a client tool Anthropic defines (bash_*, text_editor_*, memory_*).", "properties": {"type": {"type": "string"}, "name": {"type": "string"}, "description": {"type": "string"}, "input_schema": {"type": "object"}, "max_uses": {"type": "integer", "minimum": 1}, "cache_control": {"type": "object"}}}, "MessageRequest": {"type": "object", "required": ["model", "max_tokens", "messages"], "properties": {"model": {"type": "string", "description": "One of the key's agents, or a Claude model name."}, "max_tokens": {"type": "integer", "minimum": 1}, "messages": {"type": "array", "items": {"$ref": "#/components/schemas/MessageParam"}}, "system": {"oneOf": [{"type": "string"}, {"type": "array", "items": {"$ref": "#/components/schemas/ContentBlock"}}]}, "stream": {"type": "boolean"}, "stop_sequences": {"type": "array", "items": {"type": "string"}, "maxItems": 4}, "temperature": {"type": "number", "minimum": 0, "maximum": 1, "description": "Not sent to a Claude model that refuses it."}, "top_p": {"type": "number"}, "top_k": {"type": "integer"}, "thinking": {"type": "object", "properties": {"type": {"enum": ["adaptive", "enabled", "between_tools", "disabled"]}, "budget_tokens": {"type": "integer", "minimum": 1024}}}, "output_config": {"type": "object", "properties": {"effort": {"enum": ["low", "medium", "high", "xhigh", "max"]}, "format": {"type": "object"}}}, "tools": {"type": "array", "items": {"$ref": "#/components/schemas/Tool"}}, "tool_choice": {"type": "object"}, "mcp_servers": {"type": "array", "items": {"type": "object", "properties": {"type": {"const": "url"}, "url": {"type": "string"}, "name": {"type": "string"}, "authorization_token": {"type": "string"}, "tool_configuration": {"type": "object"}}}}, "container": {"oneOf": [{"type": "string"}, {"type": "object"}]}, "cache_control": {"type": "object"}, "metadata": {"type": "object", "properties": {"user_id": {"type": "string"}}}}}, "CountTokensRequest": {"type": "object", "required": ["model", "messages"], "properties": {"model": {"type": "string"}, "messages": {"type": "array", "items": {"$ref": "#/components/schemas/MessageParam"}}, "system": {}, "tools": {"type": "array", "items": {"$ref": "#/components/schemas/Tool"}}, "thinking": {"type": "object"}}}, "Usage": {"type": "object", "properties": {"input_tokens": {"type": "integer"}, "output_tokens": {"type": "integer"}, "cache_creation_input_tokens": {"type": "integer"}, "cache_read_input_tokens": {"type": "integer"}, "server_tool_use": {"type": "object", "properties": {"web_search_requests": {"type": "integer"}, "web_fetch_requests": {"type": "integer"}}}}}, "Message": {"type": "object", "properties": {"id": {"type": "string"}, "type": {"const": "message"}, "role": {"const": "assistant"}, "model": {"type": "string"}, "content": {"type": "array", "items": {"$ref": "#/components/schemas/ContentBlock"}}, "stop_reason": {"enum": ["end_turn", "max_tokens", "stop_sequence", "tool_use", "refusal"]}, "stop_sequence": {"type": ["string", "null"]}, "usage": {"$ref": "#/components/schemas/Usage"}, "container": {"type": "object"}, "dyadic": {"type": "object", "description": "Credits charged and the activity log's id."}}}, "Model": {"type": "object", "properties": {"type": {"const": "model"}, "id": {"type": "string"}, "display_name": {"type": "string"}, "created_at": {"type": "string"}, "lifecycle": {"const": "active"}}}, "ModelList": {"type": "object", "properties": {"data": {"type": "array", "items": {"$ref": "#/components/schemas/Model"}}, "has_more": {"type": "boolean"}, "first_id": {"type": ["string", "null"]}, "last_id": {"type": ["string", "null"]}}}, "File": {"type": "object", "properties": {"type": {"const": "file"}, "id": {"type": "string"}, "filename": {"type": "string"}, "mime_type": {"type": "string"}, "size_bytes": {"type": "integer"}, "created_at": {"type": "string"}, "downloadable": {"type": "boolean"}}}, "FileList": {"type": "object", "properties": {"data": {"type": "array", "items": {"$ref": "#/components/schemas/File"}}, "has_more": {"type": "boolean"}, "first_id": {"type": ["string", "null"]}, "last_id": {"type": ["string", "null"]}}}, "BatchRequest": {"type": "object", "required": ["requests"], "properties": {"requests": {"type": "array", "maxItems": 5000, "items": {"type": "object", "required": ["custom_id", "params"], "properties": {"custom_id": {"type": "string"}, "params": {"$ref": "#/components/schemas/MessageRequest"}}}}}}, "MessageBatch": {"type": "object", "properties": {"id": {"type": "string"}, "type": {"const": "message_batch"}, "processing_status": {"enum": ["in_progress", "canceling", "ended"]}, "request_counts": {"type": "object", "properties": {"processing": {"type": "integer"}, "succeeded": {"type": "integer"}, "errored": {"type": "integer"}, "canceled": {"type": "integer"}, "expired": {"type": "integer"}}}, "created_at": {"type": "string"}, "expires_at": {"type": "string"}, "ended_at": {"type": ["string", "null"]}, "cancel_initiated_at": {"type": ["string", "null"]}, "archived_at": {"type": "null"}, "results_url": {"type": ["string", "null"]}}}, "BatchList": {"type": "object", "properties": {"data": {"type": "array", "items": {"$ref": "#/components/schemas/MessageBatch"}}, "has_more": {"type": "boolean"}, "first_id": {"type": ["string", "null"]}, "last_id": {"type": ["string", "null"]}}}}, "securitySchemes": {"apiKey": {"type": "apiKey", "in": "header", "name": "x-api-key"}, "bearer": {"type": "http", "scheme": "bearer"}}}, "security": [{"apiKey": []}, {"bearer": []}], "paths": {"/messages": {"post": {"tags": ["Messages"], "operationId": "createMessage", "summary": "Create a message", "responses": {"200": {"description": "With stream: true, Anthropic's Server-Sent Events: message_start, content_block_start, content_block_delta (text_delta, thinking_delta, signature_delta, input_json_delta), content_block_stop, message_delta, message_stop, ping, error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Message"}}, "text/event-stream": {"schema": {"type": "string"}}}}, "400": {"description": "invalid_request_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "authentication_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "402": {"description": "billing_error: out of credits or over a key limit", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "403": {"description": "permission_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "404": {"description": "not_found_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "413": {"description": "request_too_large", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "rate_limit_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "500": {"description": "api_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MessageRequest"}}}}}}, "/messages/count_tokens": {"post": {"tags": ["Messages"], "operationId": "countTokens", "summary": "Count a request's input tokens", "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"type": "object", "properties": {"input_tokens": {"type": "integer"}}}}}}, "400": {"description": "invalid_request_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "authentication_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "403": {"description": "permission_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "rate_limit_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "description": "Free. Counted by Anthropic for a Claude model; otherwise estimated (header X-Dyadic-Estimated: true).", "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/CountTokensRequest"}}}}}}, "/models": {"get": {"tags": ["Models"], "operationId": "listModels", "summary": "List the key's models", "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ModelList"}}}}, "401": {"description": "authentication_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}}}, "/models/{model}": {"get": {"tags": ["Models"], "operationId": "getModel", "summary": "Get a model", "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Model"}}}}, "401": {"description": "authentication_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "404": {"description": "not_found_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "parameters": [{"name": "model", "in": "path", "required": true, "schema": {"type": "string"}, "description": "A model id from the list."}]}}, "/files": {"post": {"tags": ["Files"], "operationId": "uploadFile", "summary": "Upload a file", "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/File"}}}}, "400": {"description": "invalid_request_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "authentication_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "403": {"description": "permission_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "413": {"description": "request_too_large", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "rate_limit_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "description": "Kept with the account's API files (the same ones /api/openai/v1/files lists). Needs the key's Files switch.", "requestBody": {"required": true, "content": {"multipart/form-data": {"schema": {"type": "object", "properties": {"file": {"type": "string", "format": "binary"}}, "required": ["file"]}}}}}, "get": {"tags": ["Files"], "operationId": "listFiles", "summary": "List files", "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/FileList"}}}}, "400": {"description": "invalid_request_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "authentication_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "403": {"description": "permission_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "parameters": [{"name": "limit", "in": "query", "schema": {"type": "integer", "minimum": 1, "maximum": 1000, "default": 20}, "description": "How many, 1 to 1000."}, {"name": "after_id", "in": "query", "schema": {"type": "string"}, "description": "The page after this id."}, {"name": "before_id", "in": "query", "schema": {"type": "string"}, "description": "The page before this id."}]}}, "/files/{file_id}": {"get": {"tags": ["Files"], "operationId": "getFile", "summary": "Get a file's metadata", "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/File"}}}}, "401": {"description": "authentication_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "403": {"description": "permission_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "404": {"description": "not_found_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "parameters": [{"name": "file_id", "in": "path", "required": true, "schema": {"type": "string"}, "description": "A file id."}]}, "delete": {"tags": ["Files"], "operationId": "deleteFile", "summary": "Delete a file", "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"type": "object", "properties": {"id": {"type": "string"}, "type": {"const": "file_deleted"}}}}}}, "401": {"description": "authentication_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "403": {"description": "permission_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "404": {"description": "not_found_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "parameters": [{"name": "file_id", "in": "path", "required": true, "schema": {"type": "string"}, "description": "A file id."}]}}, "/files/{file_id}/content": {"get": {"tags": ["Files"], "operationId": "downloadFile", "summary": "Download a file", "responses": {"200": {"description": "OK", "content": {"application/octet-stream": {"schema": {"type": "string", "format": "binary"}}}}, "401": {"description": "authentication_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "403": {"description": "permission_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "404": {"description": "not_found_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "parameters": [{"name": "file_id", "in": "path", "required": true, "schema": {"type": "string"}, "description": "A file id."}]}}, "/messages/batches": {"post": {"tags": ["Message Batches"], "operationId": "createBatch", "summary": "Create a message batch", "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MessageBatch"}}}}, "400": {"description": "invalid_request_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "authentication_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "403": {"description": "permission_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "413": {"description": "request_too_large", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "rate_limit_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "description": "Up to 5,000 requests, each a Messages call on this API, on Dyadic's batch runner. Needs the key's Files switch.", "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/BatchRequest"}}}}}, "get": {"tags": ["Message Batches"], "operationId": "listBatches", "summary": "List message batches", "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/BatchList"}}}}, "400": {"description": "invalid_request_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "authentication_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "403": {"description": "permission_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "parameters": [{"name": "limit", "in": "query", "schema": {"type": "integer", "minimum": 1, "maximum": 1000, "default": 20}, "description": "How many, 1 to 1000."}, {"name": "after_id", "in": "query", "schema": {"type": "string"}, "description": "The page after this id."}]}}, "/messages/batches/{batch_id}": {"get": {"tags": ["Message Batches"], "operationId": "getBatch", "summary": "Get a message batch", "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MessageBatch"}}}}, "401": {"description": "authentication_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "403": {"description": "permission_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "404": {"description": "not_found_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "parameters": [{"name": "batch_id", "in": "path", "required": true, "schema": {"type": "string"}, "description": "A batch id."}]}, "delete": {"tags": ["Message Batches"], "operationId": "deleteBatch", "summary": "Delete an ended message batch", "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"type": "object", "properties": {"id": {"type": "string"}, "type": {"const": "message_batch_deleted"}}}}}}, "400": {"description": "invalid_request_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "authentication_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "403": {"description": "permission_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "404": {"description": "not_found_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "parameters": [{"name": "batch_id", "in": "path", "required": true, "schema": {"type": "string"}, "description": "A batch id."}]}}, "/messages/batches/{batch_id}/cancel": {"post": {"tags": ["Message Batches"], "operationId": "cancelBatch", "summary": "Cancel a message batch", "responses": {"200": {"description": "OK", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MessageBatch"}}}}, "401": {"description": "authentication_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "403": {"description": "permission_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "404": {"description": "not_found_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "parameters": [{"name": "batch_id", "in": "path", "required": true, "schema": {"type": "string"}, "description": "A batch id."}]}}, "/messages/batches/{batch_id}/results": {"get": {"tags": ["Message Batches"], "operationId": "getBatchResults", "summary": "Get an ended batch's results", "responses": {"200": {"description": "One JSON line per request: {custom_id, result: {type: succeeded, message} | {type: errored, error} | {type: canceled} | {type: expired}}", "content": {"application/x-jsonl": {"schema": {"type": "string"}}}}, "400": {"description": "invalid_request_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "authentication_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "403": {"description": "permission_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "404": {"description": "not_found_error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "parameters": [{"name": "batch_id", "in": "path", "required": true, "schema": {"type": "string"}, "description": "A batch id."}]}}}}