{
  "openapi": "3.1.0",
  "info": {
    "title": "LocalEngine Local API",
    "version": "0.7.0",
    "description": "Local-only macOS API. Enable Settings → Local API and copy the generated token. This static website specification was checked against LocalEngine 0.7.0 source on 2026-10-31. Inference runs locally; select the required model in the app. Compatibility is limited to the documented routes: /v1/responses, /v1/translate and /v1/translate/batch are not implemented. Streaming media types are SSE strings; extension fields describe their payloads and the WebSocket frame protocol."
  },
  "servers": [
    {
      "url": "http://127.0.0.1:38680",
      "description": "Default loopback server. Change the port to match Settings → Local API."
    }
  ],
  "security": [
    {
      "bearerAuth": []
    },
    {
      "apiKeyAuth": []
    },
    {
      "privyToken": []
    }
  ],
  "tags": [
    {
      "name": "system"
    },
    {
      "name": "models"
    },
    {
      "name": "chat"
    },
    {
      "name": "anthropic"
    },
    {
      "name": "embeddings"
    },
    {
      "name": "decisions"
    },
    {
      "name": "images"
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "operationId": "getHealth",
        "summary": "Server liveness",
        "tags": [
          "system"
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Health"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        },
        "security": []
      }
    },
    "/v1/health": {
      "get": {
        "operationId": "getV1Health",
        "summary": "Server liveness (v1 alias)",
        "tags": [
          "system"
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Health"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        },
        "security": []
      }
    },
    "/v1/capabilities": {
      "get": {
        "operationId": "getCapabilities",
        "summary": "Registered routes",
        "tags": [
          "system"
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Capabilities"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        },
        "security": []
      }
    },
    "/v1/openapi.json": {
      "get": {
        "operationId": "getRuntimeOpenAPI",
        "summary": "Runtime-generated OpenAPI document",
        "tags": [
          "system"
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeOpenAPI"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        },
        "description": "Returns the installed server’s route-derived document. This is separate from the downloadable, detailed website specification.",
        "security": []
      }
    },
    "/v1/status": {
      "get": {
        "operationId": "getStatus",
        "summary": "Active chat runtime and model",
        "tags": [
          "system"
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Status"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/models": {
      "get": {
        "operationId": "listModels",
        "summary": "List registered models",
        "tags": [
          "models"
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ModelList"
                    },
                    {
                      "$ref": "#/components/schemas/AnthropicModelList"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        },
        "description": "Includes registered models and installed image models. With an empty model registry, returns runtime aliases. The anthropic-version header selects the Anthropic response shape.",
        "parameters": [
          {
            "name": "anthropic-version",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "2023-06-01",
            "description": "Presence of this header selects the Anthropic model-list format."
          }
        ]
      }
    },
    "/v1/chat/completions": {
      "post": {
        "operationId": "createChatCompletion",
        "summary": "OpenAI-compatible chat completion",
        "tags": [
          "chat"
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletion"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Each data field is ChatChunk JSON, followed by [DONE]. include_usage adds a final usage chunk. Failures after streaming begins are error payloads."
                },
                "example": "data: {\"id\":\"chatcmpl-example\",\"object\":\"chat.completion.chunk\",\"created\":1793404800,\"model\":\"localengine\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\"Hello\"}}]}\n\ndata: [DONE]\n\n",
                "x-event-schema": {
                  "$ref": "#/components/schemas/ChatChunk"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          }
        },
        "description": "Returns JSON by default or SSE with stream: true. Tool calling is LlamaKit-only. This is not the Responses API.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatRequest"
              },
              "example": {
                "model": "localengine",
                "messages": [
                  {
                    "role": "user",
                    "content": "Hello!"
                  }
                ],
                "max_tokens": 512
              }
            }
          }
        }
      }
    },
    "/v1/messages": {
      "post": {
        "operationId": "createMessage",
        "summary": "Anthropic-compatible Messages",
        "tags": [
          "anthropic"
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessagesResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Anthropic events: message_start, content_block_start, content_block_delta (text_delta, thinking_delta, input_json_delta), content_block_stop, message_delta, message_stop; ping while waiting and error on failure. Tool input arrives once complete."
                },
                "example": "event: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"Hello\"}}\n\n"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/AnthropicError"
          },
          "default": {
            "$ref": "#/components/responses/AnthropicError"
          },
          "400": {
            "$ref": "#/components/responses/AnthropicError"
          }
        },
        "description": "Use the server root as the Anthropic client base URL, with the generated token in x-api-key or Authorization. URL images and PDFs are unsupported.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MessagesRequest"
              },
              "example": {
                "model": "localengine",
                "max_tokens": 512,
                "messages": [
                  {
                    "role": "user",
                    "content": "Hello!"
                  }
                ]
              }
            }
          }
        },
        "parameters": [
          {
            "name": "anthropic-version",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "2023-06-01",
            "description": "Accepted for SDK compatibility; not required by LocalEngine."
          }
        ]
      }
    },
    "/v1/messages/count_tokens": {
      "post": {
        "operationId": "countMessageTokens",
        "summary": "Estimate input tokens",
        "tags": [
          "anthropic"
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenCount"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/AnthropicError"
          },
          "default": {
            "$ref": "#/components/responses/AnthropicError"
          },
          "400": {
            "$ref": "#/components/responses/AnthropicError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CountTokensRequest"
              },
              "example": {
                "messages": [
                  {
                    "role": "user",
                    "content": "Hello!"
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/v1/embeddings": {
      "post": {
        "operationId": "createEmbeddings",
        "summary": "Text embeddings",
        "tags": [
          "embeddings"
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmbeddingsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmbeddingsRequest"
              },
              "example": {
                "input": [
                  "Hello world",
                  "Local inference"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/systemone": {
      "post": {
        "operationId": "createDecision",
        "summary": "Typed decisions with Clef",
        "tags": [
          "decisions"
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DecisionResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DecisionRequest"
              },
              "example": {
                "model": "clef",
                "state": "Checkout is down.",
                "questions": {
                  "outage": {
                    "type": "noul",
                    "instructions": "Is a service down?"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/images/generations": {
      "post": {
        "operationId": "generateImage",
        "summary": "Local image generation",
        "tags": [
          "images"
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImageResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "An image_generation.completed event containing ImageCompletedEvent JSON. Keepalive comments every 10 seconds. Failures arrive as error events. No [DONE] or chat chunks."
                },
                "example": "event: image_generation.completed\ndata: {\"type\":\"image_generation.completed\",\"b64_json\":\"<base64 PNG>\",\"created_at\":1793404800,\"size\":\"1024x1024\",\"output_format\":\"png\",\"seed\":42}\n\n",
                "x-event-schema": {
                  "$ref": "#/components/schemas/ImageCompletedEvent"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "503": {
            "description": "Image generation unavailable (image_generation_unavailable), or generation timed out (timeout).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Image provider rate limit (rate_limit_exceeded).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImageRequest"
              },
              "example": {
                "prompt": "A watercolor mountain landscape",
                "n": 1,
                "size": "1024x1024",
                "response_format": "b64_json",
                "seed": 42
              }
            }
          }
        }
      }
    },
    "/v1/chat/completions/ws": {
      "get": {
        "operationId": "connectChatWebSocket",
        "summary": "Upgrade to a chat WebSocket",
        "tags": [
          "chat"
        ],
        "description": "HTTP upgrade only; use ws://127.0.0.1:38680/v1/chat/completions/ws. After upgrade, send ChatRequest JSON in text frames. Non-streaming replies are ChatCompletion frames; streaming replies are ChatChunk frames followed by [DONE]. Browser authentication: new WebSocket(url, [\"bearer\", token]) or ?token=TOKEN. OpenAPI describes the handshake; x-websocket documents the frame protocol.",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "privyToken": []
          },
          {
            "webSocketToken": []
          },
          {
            "webSocketProtocol": []
          }
        ],
        "responses": {
          "101": {
            "description": "WebSocket connection established."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "426": {
            "description": "WebSocket upgrade required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-websocket": {
          "request": {
            "$ref": "#/components/schemas/ChatRequest"
          },
          "response": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ChatCompletion"
              },
              {
                "$ref": "#/components/schemas/ChatChunk"
              },
              {
                "$ref": "#/components/schemas/Error"
              },
              {
                "type": "string",
                "enum": [
                  "[DONE]"
                ]
              }
            ]
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Generated LocalEngine token (le-...). Stored in the macOS Keychain; regenerating invalidates the previous token."
      },
      "apiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "Same generated token, sent without a Bearer prefix."
      },
      "privyToken": {
        "type": "apiKey",
        "in": "header",
        "name": "x-privy-token",
        "description": "Alternative HTTP token header. Browser CORS clients should use Authorization or x-api-key."
      },
      "webSocketToken": {
        "type": "apiKey",
        "in": "query",
        "name": "token",
        "description": "WebSocket handshake only; not accepted for ordinary HTTP API requests."
      },
      "webSocketProtocol": {
        "type": "apiKey",
        "in": "header",
        "name": "Sec-WebSocket-Protocol",
        "description": "WebSocket handshake only. Send bearer, <token>; in the browser pass [\"bearer\", token] as the WebSocket protocols argument."
      }
    },
    "schemas": {
      "Health": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ok"
            ]
          },
          "app": {
            "type": "string",
            "enum": [
              "LocalEngine"
            ]
          },
          "version": {
            "type": "string",
            "examples": [
              "0.7.0"
            ]
          }
        },
        "required": [
          "status",
          "app",
          "version"
        ]
      },
      "Capabilities": {
        "type": "object",
        "properties": {
          "app": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "routes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "method": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                }
              },
              "required": [
                "method",
                "path"
              ]
            }
          }
        },
        "required": [
          "app",
          "version",
          "routes"
        ]
      },
      "Status": {
        "type": "object",
        "properties": {
          "runtime": {
            "type": "string",
            "enum": [
              "localengine-llama",
              "localengine-mlx"
            ]
          },
          "active_model": {
            "type": "string",
            "description": "Omitted when no chat model is selected."
          },
          "ready": {
            "type": "boolean",
            "description": "Whether a chat model is selected; not a guarantee that inference is already loaded."
          },
          "local_api": {
            "type": "string",
            "enum": [
              "running",
              "stopped"
            ]
          }
        },
        "required": [
          "runtime",
          "ready",
          "local_api"
        ]
      },
      "ModelList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "object": {
                  "type": "string",
                  "enum": [
                    "model"
                  ]
                },
                "created": {
                  "type": "integer"
                },
                "owned_by": {
                  "type": "string",
                  "enum": [
                    "localengine"
                  ]
                }
              },
              "required": [
                "id",
                "object",
                "created",
                "owned_by"
              ]
            }
          }
        },
        "required": [
          "object",
          "data"
        ]
      },
      "AnthropicModelList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "model"
                  ]
                },
                "id": {
                  "type": "string"
                },
                "display_name": {
                  "type": "string"
                },
                "created_at": {
                  "type": "string",
                  "format": "date-time"
                }
              },
              "required": [
                "type",
                "id",
                "display_name",
                "created_at"
              ]
            }
          },
          "has_more": {
            "type": "boolean"
          },
          "first_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "data",
          "has_more",
          "first_id",
          "last_id"
        ]
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "details": {
                "type": "object",
                "properties": {},
                "additionalProperties": {
                  "type": "string"
                }
              }
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "AnthropicError": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "error"
            ]
          },
          "error": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "invalid_request_error",
                  "authentication_error",
                  "permission_error",
                  "not_found_error",
                  "request_too_large",
                  "rate_limit_error",
                  "overloaded_error",
                  "api_error"
                ]
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "message"
            ]
          }
        },
        "required": [
          "type",
          "error"
        ]
      },
      "Usage": {
        "type": "object",
        "properties": {
          "prompt_tokens": {
            "type": "integer",
            "minimum": 0
          },
          "completion_tokens": {
            "type": "integer",
            "minimum": 0
          },
          "total_tokens": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "prompt_tokens",
          "completion_tokens",
          "total_tokens"
        ],
        "description": "Length-based estimates, approximately four characters per token, not exact tokenizer counts."
      },
      "TextPart": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "text",
              "input_text"
            ]
          },
          "text": {
            "type": "string"
          }
        },
        "required": [
          "type",
          "text"
        ]
      },
      "ImagePart": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "image_url",
              "input_image"
            ]
          },
          "image_url": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string",
                "description": "A base64 data URL, file:// URL, or accessible absolute local path. Remote URLs are rejected."
              },
              "detail": {
                "type": "string",
                "enum": [
                  "auto",
                  "low",
                  "high",
                  "original"
                ]
              }
            },
            "required": [
              "url"
            ]
          }
        },
        "required": [
          "type",
          "image_url"
        ]
      },
      "ToolCall": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "function"
            ]
          },
          "function": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "arguments": {
                "type": "string",
                "description": "JSON-encoded function arguments."
              }
            },
            "required": [
              "name",
              "arguments"
            ]
          }
        },
        "required": [
          "id",
          "type",
          "function"
        ]
      },
      "ChatInputMessage": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "system",
              "developer",
              "user",
              "assistant",
              "tool"
            ]
          },
          "content": {
            "anyOf": [
              {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "array",
                    "items": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/TextPart"
                        },
                        {
                          "$ref": "#/components/schemas/ImagePart"
                        }
                      ]
                    }
                  }
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "tool_calls": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InputToolCall"
            }
          },
          "tool_call_id": {
            "type": "string"
          }
        },
        "required": [
          "role"
        ]
      },
      "FunctionTool": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "function"
            ]
          },
          "function": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "parameters": {
                "type": "object",
                "properties": {},
                "description": "JSON Schema for function arguments; property names are preserved.",
                "additionalProperties": true
              }
            },
            "required": [
              "name"
            ]
          }
        },
        "required": [
          "type",
          "function"
        ]
      },
      "ChatRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "default": "localengine",
            "description": "Selects a runtime, not a different loaded model. Registered IDs/names use that model’s runtime; mlx/llama names select those runtimes; otherwise the active runtime is used. Select the model in the app."
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChatInputMessage"
            },
            "minItems": 1
          },
          "temperature": {
            "type": "number"
          },
          "max_tokens": {
            "type": "integer",
            "description": "Defaults to the app token limit."
          },
          "max_completion_tokens": {
            "type": "integer",
            "description": "Takes precedence over max_tokens."
          },
          "stream": {
            "type": "boolean",
            "default": false
          },
          "stream_options": {
            "type": "object",
            "properties": {
              "include_usage": {
                "type": "boolean",
                "default": false
              }
            }
          },
          "tools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FunctionTool"
            },
            "description": "Function calling is supported by LlamaKit. MLX returns text."
          },
          "tool_choice": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "auto",
                  "none",
                  "required"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "function"
                    ]
                  },
                  "function": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "name"
                    ]
                  }
                },
                "required": [
                  "type",
                  "function"
                ]
              }
            ]
          }
        },
        "required": [
          "messages"
        ],
        "description": "Unknown fields are ignored. Required or named tool calls are best effort, not grammar-constrained."
      },
      "ChatOutputMessage": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "assistant"
            ]
          },
          "content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "tool_calls": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ToolCall"
            }
          },
          "reasoning_content": {
            "type": "string",
            "description": "LocalEngine extension; reasoning is kept separate from the answer."
          }
        },
        "required": [
          "role",
          "content"
        ]
      },
      "ChatCompletion": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "enum": [
              "chat.completion"
            ]
          },
          "created": {
            "type": "integer"
          },
          "model": {
            "type": "string"
          },
          "choices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer"
                },
                "message": {
                  "$ref": "#/components/schemas/ChatOutputMessage"
                },
                "finish_reason": {
                  "type": "string",
                  "enum": [
                    "stop",
                    "tool_calls"
                  ]
                }
              },
              "required": [
                "index",
                "message",
                "finish_reason"
              ]
            }
          },
          "usage": {
            "$ref": "#/components/schemas/Usage"
          }
        },
        "required": [
          "id",
          "object",
          "created",
          "model",
          "choices",
          "usage"
        ]
      },
      "ChatChunk": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "enum": [
              "chat.completion.chunk"
            ]
          },
          "created": {
            "type": "integer"
          },
          "model": {
            "type": "string"
          },
          "choices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer"
                },
                "delta": {
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "assistant"
                      ]
                    },
                    "content": {
                      "type": "string"
                    },
                    "reasoning_content": {
                      "type": "string"
                    },
                    "tool_calls": {
                      "type": "array",
                      "items": {
                        "allOf": [
                          {
                            "$ref": "#/components/schemas/ToolCall"
                          },
                          {
                            "type": "object",
                            "properties": {
                              "index": {
                                "type": "integer"
                              }
                            },
                            "required": [
                              "index"
                            ]
                          }
                        ]
                      }
                    }
                  }
                },
                "finish_reason": {
                  "type": "string",
                  "enum": [
                    "stop",
                    "tool_calls"
                  ]
                }
              },
              "required": [
                "index",
                "delta"
              ]
            }
          },
          "usage": {
            "$ref": "#/components/schemas/Usage"
          }
        },
        "required": [
          "id",
          "object",
          "created",
          "model",
          "choices"
        ],
        "description": "SSE data or WebSocket text-frame JSON. The optional final usage chunk has empty choices. Tool calls arrive together once their markup is complete."
      },
      "AnthropicText": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "text"
            ]
          },
          "text": {
            "type": "string"
          }
        },
        "required": [
          "type",
          "text"
        ]
      },
      "AnthropicImage": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "image"
            ]
          },
          "source": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "base64"
                ]
              },
              "media_type": {
                "type": "string",
                "examples": [
                  "image/png"
                ]
              },
              "data": {
                "type": "string",
                "contentEncoding": "base64"
              }
            },
            "required": [
              "type",
              "media_type",
              "data"
            ]
          }
        },
        "required": [
          "type",
          "source"
        ]
      },
      "AnthropicDocument": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "document"
            ]
          },
          "source": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "text"
                ]
              },
              "data": {
                "type": "string"
              },
              "media_type": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "data"
            ]
          }
        },
        "required": [
          "type",
          "source"
        ],
        "description": "Only text documents are supported, not PDFs."
      },
      "AnthropicToolUse": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "tool_use"
            ]
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "input": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          }
        },
        "required": [
          "type",
          "id",
          "name",
          "input"
        ]
      },
      "AnthropicToolResult": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "tool_result"
            ]
          },
          "tool_use_id": {
            "type": "string"
          },
          "content": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/AnthropicText"
                    },
                    {
                      "$ref": "#/components/schemas/AnthropicImage"
                    }
                  ]
                }
              }
            ]
          },
          "is_error": {
            "type": "boolean"
          }
        },
        "required": [
          "type",
          "tool_use_id"
        ],
        "description": "Use in user turns. is_error prefixes the tool result with Error: for the model."
      },
      "AnthropicThinking": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "thinking"
            ]
          },
          "thinking": {
            "type": "string"
          },
          "signature": {
            "type": "string"
          }
        },
        "required": [
          "type",
          "thinking",
          "signature"
        ],
        "description": "Returned only with thinking.type enabled or adaptive. Signature is empty."
      },
      "AnthropicInputMessage": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "user",
              "assistant"
            ]
          },
          "content": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/AnthropicText"
                    },
                    {
                      "$ref": "#/components/schemas/AnthropicImage"
                    },
                    {
                      "$ref": "#/components/schemas/AnthropicDocument"
                    },
                    {
                      "$ref": "#/components/schemas/AnthropicToolUse"
                    },
                    {
                      "$ref": "#/components/schemas/AnthropicToolResult"
                    },
                    {
                      "$ref": "#/components/schemas/AnthropicThinking"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "redacted_thinking"
                          ]
                        },
                        "data": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "type"
                      ]
                    }
                  ]
                }
              }
            ]
          }
        },
        "required": [
          "role",
          "content"
        ],
        "description": "Input thinking/redacted_thinking blocks and unknown block types are ignored. tool_use belongs to assistant turns; tool_result belongs to user turns."
      },
      "AnthropicTool": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "input_schema": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          },
          "type": {
            "type": "string",
            "enum": [
              "custom"
            ]
          }
        },
        "required": [
          "name"
        ],
        "description": "Client tools only; versioned Anthropic server tools are skipped. Tool calling requires LlamaKit."
      },
      "MessagesRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "default": "localengine",
            "description": "Same runtime selection as chat completions."
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AnthropicInputMessage"
            },
            "minItems": 1
          },
          "system": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AnthropicText"
                }
              }
            ]
          },
          "max_tokens": {
            "type": "integer",
            "minimum": 1
          },
          "temperature": {
            "type": "number"
          },
          "stream": {
            "type": "boolean",
            "default": false
          },
          "tools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AnthropicTool"
            }
          },
          "tool_choice": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "none",
                      "any"
                    ]
                  }
                },
                "required": [
                  "type"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "tool"
                    ]
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "type",
                  "name"
                ]
              }
            ]
          },
          "stop_sequences": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "thinking": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "enabled",
                  "adaptive",
                  "disabled"
                ]
              },
              "budget_tokens": {
                "type": "integer",
                "description": "Ignored; the local model controls reasoning length."
              }
            },
            "required": [
              "type"
            ]
          },
          "top_p": {
            "type": "number",
            "description": "Accepted but ignored."
          },
          "top_k": {
            "type": "integer",
            "description": "Accepted but ignored."
          },
          "metadata": {
            "type": "object",
            "properties": {},
            "description": "Accepted but ignored.",
            "additionalProperties": true
          },
          "service_tier": {
            "type": "string",
            "description": "Accepted but ignored."
          }
        },
        "required": [
          "messages",
          "max_tokens"
        ],
        "description": "Unknown keys and cache_control are ignored. any/tool choices are best effort."
      },
      "CountTokensRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "default": "localengine",
            "description": "Same runtime selection as chat completions."
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AnthropicInputMessage"
            },
            "minItems": 1
          },
          "system": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AnthropicText"
                }
              }
            ]
          },
          "max_tokens": {
            "type": "integer",
            "minimum": 1
          },
          "temperature": {
            "type": "number"
          },
          "stream": {
            "type": "boolean",
            "default": false
          },
          "tools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AnthropicTool"
            }
          },
          "tool_choice": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "none",
                      "any"
                    ]
                  }
                },
                "required": [
                  "type"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "tool"
                    ]
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "type",
                  "name"
                ]
              }
            ]
          },
          "stop_sequences": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "thinking": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "enabled",
                  "adaptive",
                  "disabled"
                ]
              },
              "budget_tokens": {
                "type": "integer",
                "description": "Ignored; the local model controls reasoning length."
              }
            },
            "required": [
              "type"
            ]
          },
          "top_p": {
            "type": "number",
            "description": "Accepted but ignored."
          },
          "top_k": {
            "type": "integer",
            "description": "Accepted but ignored."
          },
          "metadata": {
            "type": "object",
            "properties": {},
            "description": "Accepted but ignored.",
            "additionalProperties": true
          },
          "service_tier": {
            "type": "string",
            "description": "Accepted but ignored."
          }
        },
        "required": [
          "messages"
        ],
        "description": "Same body as Messages; max_tokens is optional. Returns a length-based estimate."
      },
      "AnthropicUsage": {
        "type": "object",
        "properties": {
          "input_tokens": {
            "type": "integer",
            "minimum": 0
          },
          "output_tokens": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "input_tokens",
          "output_tokens"
        ],
        "description": "Length-based token estimates."
      },
      "MessagesResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "message"
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "assistant"
            ]
          },
          "model": {
            "type": "string"
          },
          "content": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/AnthropicText"
                },
                {
                  "$ref": "#/components/schemas/AnthropicToolUse"
                },
                {
                  "$ref": "#/components/schemas/AnthropicThinking"
                }
              ]
            }
          },
          "stop_reason": {
            "type": "string",
            "enum": [
              "end_turn",
              "tool_use",
              "stop_sequence"
            ]
          },
          "stop_sequence": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "usage": {
            "$ref": "#/components/schemas/AnthropicUsage"
          }
        },
        "required": [
          "id",
          "type",
          "role",
          "model",
          "content",
          "stop_reason",
          "stop_sequence",
          "usage"
        ],
        "description": "Reaching max_tokens still reports end_turn."
      },
      "TokenCount": {
        "type": "object",
        "properties": {
          "input_tokens": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "input_tokens"
        ]
      },
      "EmbeddingsRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "description": "Omit for the selected embedding model, or use its exact ID or name. Other values return model_not_found."
          },
          "input": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "minItems": 1
              }
            ]
          }
        },
        "required": [
          "input"
        ],
        "description": "Select a Llama/GGUF model with Use for Embeddings. Token-ID inputs, dimensions and encoding_format are not implemented."
      },
      "EmbeddingsResponse": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "object": {
                  "type": "string",
                  "enum": [
                    "embedding"
                  ]
                },
                "index": {
                  "type": "integer"
                },
                "embedding": {
                  "type": "array",
                  "items": {
                    "type": "number"
                  }
                }
              },
              "required": [
                "object",
                "index",
                "embedding"
              ]
            }
          },
          "model": {
            "type": "string"
          },
          "usage": {
            "type": "object",
            "properties": {
              "prompt_tokens": {
                "type": "integer"
              },
              "total_tokens": {
                "type": "integer"
              }
            },
            "required": [
              "prompt_tokens",
              "total_tokens"
            ]
          }
        },
        "required": [
          "object",
          "data",
          "model",
          "usage"
        ]
      },
      "ChoiceQuestion": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "choice"
            ]
          },
          "instructions": {
            "type": "string"
          },
          "criteria": {
            "type": "object",
            "properties": {},
            "additionalProperties": {
              "type": "string"
            },
            "minProperties": 1,
            "maxProperties": 255
          }
        },
        "required": [
          "type",
          "criteria"
        ]
      },
      "ScoreQuestion": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "score"
            ]
          },
          "instructions": {
            "type": "string"
          },
          "criteria": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "minItems": 2,
            "maxItems": 10
          }
        },
        "required": [
          "type",
          "criteria"
        ]
      },
      "NoulQuestion": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "noul"
            ]
          },
          "instructions": {
            "type": "string"
          },
          "criteria": {
            "type": "object",
            "properties": {
              "true": {
                "type": "string"
              },
              "false": {
                "type": "string"
              }
            }
          }
        },
        "required": [
          "type"
        ]
      },
      "DecisionRequest": {
        "type": "object",
        "properties": {
          "state": {
            "description": "Text or any JSON value; passed to the decision runtime."
          },
          "model": {
            "type": "string",
            "description": "Echoed in the response; the model selected with Use for Decisions performs inference."
          },
          "questions": {
            "type": "object",
            "properties": {},
            "additionalProperties": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/ChoiceQuestion"
                },
                {
                  "$ref": "#/components/schemas/ScoreQuestion"
                },
                {
                  "$ref": "#/components/schemas/NoulQuestion"
                }
              ]
            },
            "minProperties": 1
          },
          "images": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^data:image/[^;]+;base64,",
              "description": "Requires the model vision projector."
            }
          }
        },
        "required": [
          "state",
          "questions"
        ],
        "description": "Select Clef/Clef Flash with Use for Decisions. Instructions default to the question ID. Requests are serialized, with an 8,192-token context limit. Videos are unsupported."
      },
      "ChoiceAnswer": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "choice"
            ]
          },
          "choice": {
            "type": "string"
          },
          "confidence": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "probabilities": {
            "type": "object",
            "properties": {},
            "additionalProperties": {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            }
          }
        },
        "required": [
          "type",
          "choice",
          "confidence",
          "probabilities"
        ]
      },
      "ScoreAnswer": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "score"
            ]
          },
          "score": {
            "type": "number",
            "description": "Expected level index, which may be fractional."
          },
          "confidence": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "legend": {
            "type": "object",
            "properties": {},
            "additionalProperties": {
              "type": "string"
            }
          },
          "probabilities": {
            "type": "object",
            "properties": {},
            "additionalProperties": {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            }
          }
        },
        "required": [
          "type",
          "score",
          "confidence",
          "legend",
          "probabilities"
        ]
      },
      "NoulAnswer": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "noul"
            ]
          },
          "noul": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "Probability of true."
          }
        },
        "required": [
          "type",
          "noul"
        ]
      },
      "DecisionResponse": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string"
          },
          "answers": {
            "type": "object",
            "properties": {},
            "additionalProperties": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/ChoiceAnswer"
                },
                {
                  "$ref": "#/components/schemas/ScoreAnswer"
                },
                {
                  "$ref": "#/components/schemas/NoulAnswer"
                }
              ]
            }
          },
          "usage": {
            "type": "object",
            "properties": {
              "input_tokens": {
                "type": "integer"
              },
              "output_tokens": {
                "type": "integer",
                "const": 0
              }
            },
            "required": [
              "input_tokens",
              "output_tokens"
            ]
          }
        },
        "required": [
          "answers",
          "usage"
        ]
      },
      "ImageRequest": {
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "description": "Must contain non-whitespace text."
          },
          "model": {
            "type": "string",
            "description": "Installed image model ID. Omit to use the active image model."
          },
          "n": {
            "type": "integer",
            "const": 1
          },
          "size": {
            "type": "string",
            "description": "WIDTHxHEIGHT, auto, or omitted. auto/omitted uses model-family defaults.",
            "examples": [
              "1024x1024"
            ]
          },
          "response_format": {
            "type": "string",
            "enum": [
              "b64_json"
            ]
          },
          "stream": {
            "type": "boolean",
            "default": false
          },
          "steps": {
            "type": "integer"
          },
          "guidance_scale": {
            "type": "number",
            "description": "Takes precedence over cfg_scale."
          },
          "cfg_scale": {
            "type": "number"
          },
          "negative_prompt": {
            "type": "string"
          },
          "seed": {
            "type": "integer",
            "format": "int64"
          },
          "sampling_method": {
            "type": "string"
          },
          "flow_shift": {
            "type": "number"
          },
          "quality": {
            "type": "string"
          },
          "output_format": {
            "type": "string"
          },
          "output_compression": {
            "type": "integer"
          },
          "background": {
            "type": "string"
          },
          "partial_images": {
            "type": "integer"
          }
        },
        "required": [
          "prompt"
        ],
        "description": "Requires an installed image model and the image runner. Sampling defaults depend on the model family. quality, output_format, output_compression, background and partial_images are forwarded to the provider; support depends on the provider. The current response reports PNG."
      },
      "ImageResponse": {
        "type": "object",
        "properties": {
          "created": {
            "type": "integer"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "b64_json": {
                  "type": "string",
                  "contentEncoding": "base64",
                  "contentMediaType": "image/png"
                },
                "seed": {
                  "type": "integer",
                  "format": "int64"
                }
              },
              "required": [
                "b64_json"
              ]
            },
            "minItems": 1,
            "maxItems": 1
          },
          "output_format": {
            "type": "string",
            "enum": [
              "png"
            ]
          },
          "size": {
            "type": "string"
          }
        },
        "required": [
          "created",
          "data",
          "output_format",
          "size"
        ]
      },
      "ImageCompletedEvent": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "image_generation.completed"
            ]
          },
          "b64_json": {
            "type": "string",
            "contentEncoding": "base64",
            "contentMediaType": "image/png"
          },
          "created_at": {
            "type": "integer"
          },
          "size": {
            "type": "string"
          },
          "output_format": {
            "type": "string",
            "enum": [
              "png"
            ]
          },
          "seed": {
            "type": "integer",
            "format": "int64"
          }
        },
        "required": [
          "type",
          "b64_json",
          "created_at",
          "size",
          "output_format"
        ]
      },
      "RuntimeOpenAPI": {
        "type": "object",
        "properties": {
          "openapi": {
            "type": "string"
          },
          "info": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          },
          "paths": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          }
        },
        "required": [
          "openapi",
          "info",
          "paths"
        ],
        "additionalProperties": true
      },
      "InputToolCall": {
        "type": "object",
        "required": [
          "function"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Omitted IDs default to call_<index>."
          },
          "type": {
            "type": "string",
            "enum": [
              "function"
            ]
          },
          "function": {
            "type": "object",
            "required": [
              "name"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "arguments": {
                "type": "string",
                "description": "JSON-encoded arguments. Missing or non-string values default to {}."
              }
            }
          }
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Invalid request, unsupported content, model_not_found, or context_length_exceeded.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Missing or invalid token (invalid_token).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Error": {
        "description": "HTTP error. Inspect error.code and error.message.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "AnthropicError": {
        "description": "Anthropic error envelope. 400 invalid_request_error; 401 authentication_error; 403 permission_error; 404 not_found_error; 413 request_too_large; 429 rate_limit_error; 503 overloaded_error; other failures api_error.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AnthropicError"
            }
          }
        }
      }
    }
  }
}
