{
  "openapi": "3.1.0",
  "info": {
    "title": "RunInfra API",
    "description": "OpenAI-compatible HTTP API for verified RunInfra inference deployments.",
    "version": "2026-08-13",
    "contact": {
      "name": "RunInfra support",
      "email": "jaber@runinfra.ai",
      "url": "https://runinfra.ai/contact"
    }
  },
  "servers": [
    {
      "url": "https://api.runinfra.ai/v1",
      "description": "Production"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/chat/completions": {
      "post": {
        "operationId": "createChatCompletion",
        "summary": "Create chat completion",
        "description": "OpenAI-compatible hosted chat completion. See the chat completions reference for the exact forwarding contract.",
        "tags": [
          "Chat"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatCompletionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Chat completion (or SSE stream if stream=true)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletion"
                }
              },
              "text/event-stream": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletionChunk"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "description": "Request body exceeds 3.5 MB (payload_too_large)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "502": {
            "$ref": "#/components/responses/BadGateway"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/GatewayTimeout"
          }
        }
      }
    },
    "/responses": {
      "post": {
        "operationId": "createResponse",
        "summary": "Create response",
        "description": "Responses-shaped chat-completions compatibility adapter for compatible LLM and vision-language deployments. Does not implement full state, include, reasoning, hosted-tool, conversation-item, or background-job semantics.",
        "tags": [
          "Responses"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResponsesRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Response object or SSE stream if stream=true",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponsesResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "$ref": "#/components/schemas/ResponsesEvent"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "502": {
            "$ref": "#/components/responses/BadGateway"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/GatewayTimeout"
          }
        }
      }
    },
    "/embeddings": {
      "post": {
        "operationId": "createEmbedding",
        "summary": "Create embeddings",
        "description": "Generate vector embeddings for one or more inputs. OpenAI-compatible response shape. The gateway does not replay-cache this operation.",
        "tags": [
          "Embeddings"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmbeddingRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Embedding response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmbeddingResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "502": {
            "$ref": "#/components/responses/BadGateway"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/GatewayTimeout"
          }
        }
      }
    },
    "/rerank": {
      "post": {
        "operationId": "createRerank",
        "summary": "Rerank documents",
        "description": "Text reranking for verified TEI deployments and multimodal document reranking for compatible vLLM vision rerank deployments. Flat workspace requests are replay-safe when an Idempotency-Key is provided; pipeline-scoped rerank helpers are sent once.",
        "tags": [
          "Rerank"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RerankRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Rerank response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RerankResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "502": {
            "$ref": "#/components/responses/BadGateway"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/GatewayTimeout"
          }
        }
      }
    },
    "/images/generations": {
      "post": {
        "operationId": "createImage",
        "summary": "Generate image",
        "description": "Generate images from verified image-generation deployments. OpenAI-compatible response shape. The gateway does not replay-cache this operation.",
        "tags": [
          "Images"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImageGenerationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Image generation response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImageGenerationResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "502": {
            "$ref": "#/components/responses/BadGateway"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/GatewayTimeout"
          }
        }
      }
    },
    "/audio/transcriptions": {
      "post": {
        "operationId": "createTranscription",
        "summary": "Transcribe audio",
        "description": "Speech-to-text via Whisper-class models. Multipart upload with a non-empty audio file. Audio requests are sent once; do not rely on Idempotency-Key to deduplicate retries.",
        "tags": [
          "Audio"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/TranscriptionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Transcription",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Transcription"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "502": {
            "$ref": "#/components/responses/BadGateway"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/GatewayTimeout"
          }
        }
      }
    },
    "/audio/speech": {
      "post": {
        "operationId": "createSpeech",
        "summary": "Generate speech",
        "description": "Text-to-speech served by XTTS, Bark, or Qwen3-TTS depending on the pipeline. Audio requests are sent once; do not rely on Idempotency-Key to deduplicate retries.",
        "tags": [
          "Audio"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SpeechRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Audio bytes",
            "content": {
              "audio/mpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "audio/wav": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "502": {
            "$ref": "#/components/responses/BadGateway"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/GatewayTimeout"
          }
        }
      }
    },
    "/credits": {
      "get": {
        "operationId": "retrieveCredits",
        "summary": "Credits and budget",
        "description": "Read the balance, the amount held by requests in flight, the amount available now, the current period spend and the spend cap behind the API key. Read-only, charges nothing, never cached.",
        "tags": [
          "Credits"
        ],
        "responses": {
          "200": {
            "description": "Credits and budget",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Credits"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/models": {
      "get": {
        "operationId": "listModels",
        "summary": "List models",
        "description": "List the model IDs available to the API key, including public hosted models.",
        "tags": [
          "Models"
        ],
        "responses": {
          "200": {
            "description": "Model list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/models/{model}": {
      "get": {
        "operationId": "retrieveModel",
        "summary": "Retrieve model",
        "description": "Retrieve one model available to the API key by ID.",
        "tags": [
          "Models"
        ],
        "parameters": [
          {
            "name": "model",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Model ID returned by GET /v1/models."
          }
        ],
        "responses": {
          "200": {
            "description": "Model",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Model"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/messages": {
      "post": {
        "operationId": "createAnthropicMessage",
        "summary": "Create message (Anthropic-compatible)",
        "description": "Anthropic-compatible Messages surface over the same serving pipeline as /chat/completions. Billing, credits, idempotency, rate limits, request-size limits and cached-input pricing follow the same rules. Supports text, base64 image input on compatible models, client tools, thinking controls, structured output and Anthropic event-named streaming. anthropic-beta and Claude Code compatibility headers are accepted and ignored.",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "anthropicApiKeyAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "anthropic-version",
            "in": "header",
            "required": false,
            "description": "Accepted and echoed back on the response. It does not select a behavior: this endpoint publishes one grammar.",
            "schema": {
              "type": "string",
              "examples": [
                "2023-06-01"
              ]
            }
          },
          {
            "name": "anthropic-beta",
            "in": "header",
            "required": false,
            "description": "Accepted and ignored for client compatibility.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Binds the outcome to the Anthropic request body sent, so a retry replays instead of generating and billing a second time.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/AnthropicMessageRequest"
                  },
                  {
                    "required": [
                      "max_tokens"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Anthropic Message, or an Anthropic SSE event stream if stream=true",
            "headers": {
              "anthropic-version": {
                "schema": {
                  "type": "string"
                },
                "description": "Echoed back when the request sent one"
              },
              "request-id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request identifier for support and tracing"
              },
              "x-request-id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request identifier for support and tracing"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicMessage"
                }
              },
              "text/event-stream": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicStreamEvent"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/AnthropicBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/AnthropicUnauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AnthropicBillingError"
          },
          "403": {
            "$ref": "#/components/responses/AnthropicForbidden"
          },
          "404": {
            "$ref": "#/components/responses/AnthropicNotFound"
          },
          "409": {
            "$ref": "#/components/responses/AnthropicConflict"
          },
          "413": {
            "$ref": "#/components/responses/AnthropicPayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/AnthropicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/AnthropicServerError"
          },
          "502": {
            "$ref": "#/components/responses/AnthropicServerError"
          },
          "503": {
            "$ref": "#/components/responses/AnthropicOverloaded"
          },
          "504": {
            "$ref": "#/components/responses/AnthropicTimeout"
          }
        }
      }
    },
    "/messages/count_tokens": {
      "post": {
        "operationId": "countAnthropicMessageTokens",
        "summary": "Count message input tokens (Anthropic-compatible)",
        "description": "Estimates input tokens for an Anthropic-compatible Messages request without running or billing the model. max_tokens is optional. The per-key rate limit applies. anthropic-beta and Claude Code compatibility headers are accepted and ignored.",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "anthropicApiKeyAuth": []
          },
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "anthropic-version",
            "in": "header",
            "required": false,
            "description": "Accepted and echoed back on the response.",
            "schema": {
              "type": "string",
              "examples": [
                "2023-06-01"
              ]
            }
          },
          {
            "name": "anthropic-beta",
            "in": "header",
            "required": false,
            "description": "Accepted and ignored for client compatibility.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AnthropicMessageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Estimated input token count",
            "headers": {
              "anthropic-version": {
                "schema": {
                  "type": "string"
                },
                "description": "Echoed back when the request sent one"
              },
              "request-id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request identifier for support and tracing"
              },
              "x-request-id": {
                "schema": {
                  "type": "string"
                },
                "description": "Request identifier for support and tracing"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicTokenCount"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/AnthropicBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/AnthropicUnauthorized"
          },
          "402": {
            "$ref": "#/components/responses/AnthropicBillingError"
          },
          "403": {
            "$ref": "#/components/responses/AnthropicForbidden"
          },
          "404": {
            "$ref": "#/components/responses/AnthropicNotFound"
          },
          "409": {
            "$ref": "#/components/responses/AnthropicConflict"
          },
          "413": {
            "$ref": "#/components/responses/AnthropicPayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/AnthropicRateLimited"
          },
          "500": {
            "$ref": "#/components/responses/AnthropicServerError"
          },
          "502": {
            "$ref": "#/components/responses/AnthropicServerError"
          },
          "503": {
            "$ref": "#/components/responses/AnthropicOverloaded"
          },
          "504": {
            "$ref": "#/components/responses/AnthropicTimeout"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "RunInfra API key. Generate at https://runinfra.ai/settings/api-keys. Bearer authentication works on every endpoint. POST /messages and POST /messages/count_tokens also accept x-api-key."
      },
      "anthropicApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "The same RunInfra API key in the header the Anthropic SDK sends. Accepted on POST /messages and POST /messages/count_tokens only. Every other endpoint takes Authorization: Bearer. When both headers are present on either Messages route, a non-blank x-api-key wins."
      }
    },
    "headers": {
      "AnthropicRequestId": {
        "description": "Request identifier for support and tracing",
        "schema": {
          "type": "string"
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Malformed request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Missing or invalid API key",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "PaymentRequired": {
        "description": "Insufficient credits",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden": {
        "description": "Key scope mismatch or plan limit exceeded",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "Model or deployment not found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Conflict": {
        "description": "Idempotency conflict",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "RateLimited": {
        "description": "Rate limit exceeded",
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer"
            },
            "description": "Seconds to wait before retrying"
          },
          "X-RateLimit-Remaining": {
            "schema": {
              "type": "integer"
            },
            "description": "Remaining requests in the window"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "UnprocessableEntity": {
        "description": "Request cannot be replayed or processed safely",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "InternalServerError": {
        "description": "Unexpected gateway error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unavailable": {
        "description": "Endpoint stopped, provisioning, or at capacity",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "BadGateway": {
        "description": "Upstream serving backend transient failure",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "GatewayTimeout": {
        "description": "Gateway timeout",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "AnthropicBadRequest": {
        "description": "Missing or unsupported field, named in the message",
        "headers": {
          "request-id": {
            "$ref": "#/components/headers/AnthropicRequestId"
          },
          "x-request-id": {
            "$ref": "#/components/headers/AnthropicRequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AnthropicError"
            }
          }
        }
      },
      "AnthropicUnauthorized": {
        "description": "Missing or invalid API key",
        "headers": {
          "request-id": {
            "$ref": "#/components/headers/AnthropicRequestId"
          },
          "x-request-id": {
            "$ref": "#/components/headers/AnthropicRequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AnthropicError"
            }
          }
        }
      },
      "AnthropicBillingError": {
        "description": "Prepaid credit balance too low for this request",
        "headers": {
          "request-id": {
            "$ref": "#/components/headers/AnthropicRequestId"
          },
          "x-request-id": {
            "$ref": "#/components/headers/AnthropicRequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AnthropicError"
            }
          }
        }
      },
      "AnthropicForbidden": {
        "description": "Key scope mismatch or plan limit exceeded",
        "headers": {
          "request-id": {
            "$ref": "#/components/headers/AnthropicRequestId"
          },
          "x-request-id": {
            "$ref": "#/components/headers/AnthropicRequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AnthropicError"
            }
          }
        }
      },
      "AnthropicNotFound": {
        "description": "Model not available to this key",
        "headers": {
          "request-id": {
            "$ref": "#/components/headers/AnthropicRequestId"
          },
          "x-request-id": {
            "$ref": "#/components/headers/AnthropicRequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AnthropicError"
            }
          }
        }
      },
      "AnthropicMethodNotAllowed": {
        "description": "Only POST is implemented on this path",
        "headers": {
          "Allow": {
            "schema": {
              "type": "string"
            },
            "description": "Methods this path implements"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AnthropicError"
            }
          }
        }
      },
      "AnthropicConflict": {
        "description": "Idempotency conflict",
        "headers": {
          "request-id": {
            "$ref": "#/components/headers/AnthropicRequestId"
          },
          "x-request-id": {
            "$ref": "#/components/headers/AnthropicRequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AnthropicError"
            }
          }
        }
      },
      "AnthropicPayloadTooLarge": {
        "description": "Request body exceeds the published size ceiling and returns request_too_large",
        "headers": {
          "request-id": {
            "$ref": "#/components/headers/AnthropicRequestId"
          },
          "x-request-id": {
            "$ref": "#/components/headers/AnthropicRequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AnthropicError"
            }
          }
        }
      },
      "AnthropicUnprocessableEntity": {
        "description": "Request cannot be replayed or processed safely",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AnthropicError"
            }
          }
        }
      },
      "AnthropicRateLimited": {
        "description": "Rate limit or concurrency limit reached",
        "headers": {
          "request-id": {
            "$ref": "#/components/headers/AnthropicRequestId"
          },
          "x-request-id": {
            "$ref": "#/components/headers/AnthropicRequestId"
          },
          "Retry-After": {
            "schema": {
              "type": "integer"
            },
            "description": "Seconds to wait before retrying"
          },
          "X-RateLimit-Remaining": {
            "schema": {
              "type": "integer"
            },
            "description": "Remaining requests in the window"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AnthropicError"
            }
          }
        }
      },
      "AnthropicServerError": {
        "description": "500 or 502 transient failure with error.type api_error",
        "headers": {
          "request-id": {
            "$ref": "#/components/headers/AnthropicRequestId"
          },
          "x-request-id": {
            "$ref": "#/components/headers/AnthropicRequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AnthropicError"
            }
          }
        }
      },
      "AnthropicOverloaded": {
        "description": "503 temporary unavailability with error.type overloaded_error",
        "headers": {
          "request-id": {
            "$ref": "#/components/headers/AnthropicRequestId"
          },
          "x-request-id": {
            "$ref": "#/components/headers/AnthropicRequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AnthropicError"
            }
          }
        }
      },
      "AnthropicTimeout": {
        "description": "504 inference deadline with error.type timeout_error",
        "headers": {
          "request-id": {
            "$ref": "#/components/headers/AnthropicRequestId"
          },
          "x-request-id": {
            "$ref": "#/components/headers/AnthropicRequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AnthropicError"
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "message",
              "type"
            ],
            "properties": {
              "message": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "param": {
                "type": "string",
                "nullable": true
              },
              "code": {
                "type": "string",
                "nullable": true
              }
            }
          }
        }
      },
      "ChatCompletionRequest": {
        "type": "object",
        "required": [
          "model",
          "messages"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "Model id returned by GET /v1/models.",
            "example": "deepseek-v4-flash"
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChatMessage"
            }
          },
          "stream": {
            "type": "boolean",
            "description": "When true, the response is a server-sent event stream."
          },
          "temperature": {
            "type": "number",
            "minimum": 0,
            "maximum": 2
          },
          "max_tokens": {
            "type": "integer",
            "minimum": 1
          },
          "max_completion_tokens": {
            "type": "integer",
            "minimum": 1
          },
          "top_p": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "n": {
            "type": "integer",
            "minimum": 1
          },
          "best_of": {
            "type": "integer",
            "minimum": 1
          },
          "stop": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ]
          },
          "tools": {
            "type": "array",
            "items": {}
          },
          "tool_choice": {},
          "reasoning_effort": {
            "type": "string",
            "enum": [
              "none",
              "low",
              "medium",
              "high",
              "xhigh",
              "max"
            ],
            "description": "Reasoning effort for this request. Which of these values a model honors, and which it rejects, is model specific and is stated on that model's page; deepseek-v4-flash applies max when the field is omitted and sends high and xhigh upstream as max. On a model that cannot enforce a response format while it is reasoning, a request carrying response_format is refused with 400 hosted_parameter_not_supported and param response_format unless it also sends reasoning_effort none."
          },
          "response_format": {}
        },
        "additionalProperties": true
      },
      "ChatMessage": {
        "type": "object",
        "required": [
          "role"
        ],
        "description": "Assistant messages require content or a non-empty tool_calls array. Tool messages require content and tool_call_id. Other roles require content.",
        "properties": {
          "role": {
            "type": "string",
            "minLength": 1
          },
          "content": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array"
              },
              {
                "type": "null"
              }
            ]
          },
          "tool_calls": {
            "type": "array",
            "items": {}
          },
          "tool_call_id": {
            "type": "string"
          }
        },
        "additionalProperties": true
      },
      "Tool": {
        "type": "object",
        "required": [
          "type",
          "function"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "function"
            ]
          },
          "function": {
            "type": "object",
            "required": [
              "name"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "parameters": {
                "type": "object",
                "description": "JSON Schema"
              }
            }
          }
        }
      },
      "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 arguments"
              }
            }
          }
        }
      },
      "ResponseFormat": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "text"
                ]
              }
            }
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "json_object"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "type",
              "json_schema"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "json_schema"
                ]
              },
              "json_schema": {
                "type": "object",
                "required": [
                  "name",
                  "schema"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "strict": {
                    "type": "boolean",
                    "default": false
                  },
                  "schema": {
                    "type": "object",
                    "description": "JSON Schema"
                  }
                }
              }
            }
          }
        ]
      },
      "ChatCompletion": {
        "type": "object",
        "required": [
          "id",
          "object",
          "created",
          "model",
          "choices"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "chatcmpl_abc123"
          },
          "object": {
            "type": "string",
            "example": "chat.completion"
          },
          "created": {
            "type": "integer"
          },
          "model": {
            "type": "string"
          },
          "choices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer"
                },
                "message": {
                  "$ref": "#/components/schemas/ChatMessage"
                },
                "finish_reason": {
                  "type": "string",
                  "enum": [
                    "stop",
                    "length",
                    "tool_calls",
                    "content_filter"
                  ]
                },
                "runinfra": {
                  "$ref": "#/components/schemas/RunInfraChoiceMetadata"
                }
              }
            }
          },
          "usage": {
            "$ref": "#/components/schemas/Usage"
          }
        }
      },
      "ChatCompletionChunk": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "example": "chat.completion.chunk"
          },
          "created": {
            "type": "integer"
          },
          "model": {
            "type": "string"
          },
          "choices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer"
                },
                "delta": {
                  "type": "object",
                  "additionalProperties": true
                },
                "finish_reason": {
                  "type": "string",
                  "nullable": true
                },
                "runinfra": {
                  "$ref": "#/components/schemas/RunInfraChoiceMetadata"
                }
              }
            }
          },
          "usage": {
            "$ref": "#/components/schemas/Usage"
          }
        }
      },
      "ResponsesRequest": {
        "type": "object",
        "required": [
          "model",
          "input"
        ],
        "properties": {
          "model": {
            "type": "string",
            "example": "deepseek-v4-flash"
          },
          "input": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "object"
                }
              }
            ]
          },
          "instructions": {
            "type": "string",
            "description": "System-level instruction text mapped into a chat system message."
          },
          "stream": {
            "type": "boolean",
            "default": false,
            "description": "When true, the response is a server-sent event stream."
          },
          "max_output_tokens": {
            "type": "integer",
            "minimum": 1
          },
          "temperature": {
            "type": "number",
            "minimum": 0,
            "maximum": 2
          },
          "top_p": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "tools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Tool"
            }
          },
          "tool_choice": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "none",
                  "auto",
                  "required"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "function"
                    ]
                  },
                  "function": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            ]
          },
          "reasoning_effort": {
            "type": "string",
            "enum": [
              "none",
              "low",
              "medium",
              "high",
              "xhigh",
              "max"
            ],
            "description": "Reasoning effort for this request, sent at the top level beside text. Which of these values a model honors, and which it rejects, is model specific and is stated on that model's page. On a model that cannot enforce a response format while it is reasoning, a request carrying text.format or response_format is refused with 400 hosted_parameter_not_supported and param response_format unless it also sends reasoning_effort none."
          },
          "response_format": {
            "$ref": "#/components/schemas/ResponseFormat"
          },
          "reasoning": {
            "type": "object",
            "description": "The canonical Responses effort carrier. reasoning.effort maps to the same per-model effort rule as reasoning_effort; models refused for structured output at their default accept reasoning.effort none.",
            "properties": {
              "effort": {
                "type": "string",
                "enum": [
                  "none",
                  "low",
                  "medium",
                  "high",
                  "xhigh",
                  "max"
                ]
              }
            }
          }
        }
      },
      "ResponsesResponse": {
        "type": "object",
        "required": [
          "id",
          "object",
          "model"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "resp_abc123"
          },
          "object": {
            "type": "string",
            "example": "response"
          },
          "created_at": {
            "type": "integer"
          },
          "model": {
            "type": "string"
          },
          "output_text": {
            "type": "string",
            "description": "Convenience text extracted from output content when available."
          },
          "output": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "usage": {
            "$ref": "#/components/schemas/Usage"
          }
        }
      },
      "ResponsesEvent": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "example": "response.output_text.delta"
          },
          "delta": {
            "type": "string"
          },
          "response": {
            "$ref": "#/components/schemas/ResponsesResponse"
          }
        }
      },
      "Usage": {
        "type": "object",
        "properties": {
          "cost": {
            "type": "number",
            "description": "The calculated cost of this request in US dollars, to eight decimals: the settlement formula over the tokens the provider reported. Present on hosted models; absent on workspace deployments. 0 during a promotional free window and for a response with no billable output. runinfra.cost_microcents is the canonical integer.",
            "example": 0.00294
          },
          "prompt_tokens": {
            "type": "integer"
          },
          "completion_tokens": {
            "type": "integer"
          },
          "total_tokens": {
            "type": "integer"
          },
          "prompt_tokens_details": {
            "type": "object",
            "description": "Present on every hosted model response. cached_tokens is the count of input tokens billed at the cached input rate, the figure the cost was computed with; 0 when nothing was billed as cached, including a response that settled at zero and a model whose cache is shared across tenants. runinfra.cached_input_tokens carries the same number.",
            "properties": {
              "cached_tokens": {
                "type": "integer",
                "example": 0
              }
            }
          },
          "runinfra": {
            "$ref": "#/components/schemas/RunInfraUsageMetadata"
          }
        }
      },
      "RunInfraChoiceMetadata": {
        "type": "object",
        "description": "RunInfra-owned choice metadata. Present when the gateway must distinguish a completed response from a response that produced no final answer.",
        "properties": {
          "output_status": {
            "$ref": "#/components/schemas/RunInfraOutputStatus"
          }
        }
      },
      "RunInfraOutputStatus": {
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "generation_limit_reached_before_answer",
              "no_answer_content"
            ],
            "description": "The generation-limit code is used for finish_reason length. Other terminal empty choices use no_answer_content."
          },
          "message": {
            "type": "string",
            "example": "The model reached its generation limit before producing answer content. Increase max_tokens or max_completion_tokens if the model limit allows, or shorten the prompt, then retry."
          }
        }
      },
      "RunInfraUsageMetadata": {
        "type": "object",
        "properties": {
          "cost_microcents": {
            "type": "integer",
            "description": "The calculated cost of this request in microcents (one cent is 1,000,000 microcents), the ledger unit settlement uses; the canonical figure. usage.cost is this value in dollars. The balance is debited in whole cents with sub-cent carry, so a single debit can differ from this by less than a cent.",
            "example": 294000
          },
          "cached_input_tokens": {
            "type": "integer",
            "description": "The count of input tokens billed at the cached input rate on this request, the same number as usage.prompt_tokens_details.cached_tokens. Present on every hosted model response; 0 when nothing was billed as cached.",
            "example": 0
          },
          "output_token_accounting": {
            "$ref": "#/components/schemas/RunInfraOutputTokenAccounting"
          }
        }
      },
      "RunInfraOutputTokenAccounting": {
        "type": "object",
        "required": [
          "visible_answer_tokens",
          "non_answer_completion_tokens",
          "sources"
        ],
        "properties": {
          "visible_answer_tokens": {
            "type": "integer",
            "enum": [
              0
            ],
            "description": "Final-answer token count classified by the RunInfra proxy for an all-empty generation-limit outcome."
          },
          "non_answer_completion_tokens": {
            "type": "integer",
            "minimum": 0,
            "description": "Provider-reported completion tokens when the response produced no final answer."
          },
          "sources": {
            "type": "object",
            "required": [
              "visible_answer_tokens",
              "non_answer_completion_tokens"
            ],
            "properties": {
              "visible_answer_tokens": {
                "type": "string",
                "enum": [
                  "proxy_classified"
                ]
              },
              "non_answer_completion_tokens": {
                "type": "string",
                "enum": [
                  "provider_reported"
                ]
              }
            }
          }
        }
      },
      "EmbeddingRequest": {
        "type": "object",
        "required": [
          "model",
          "input"
        ],
        "properties": {
          "model": {
            "type": "string",
            "example": "bge-m3"
          },
          "input": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ]
          },
          "encoding_format": {
            "type": "string",
            "enum": [
              "float",
              "base64"
            ],
            "default": "float"
          }
        }
      },
      "EmbeddingResponse": {
        "type": "object",
        "required": [
          "object",
          "data",
          "model",
          "usage"
        ],
        "properties": {
          "object": {
            "type": "string",
            "example": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "object": {
                  "type": "string",
                  "example": "embedding"
                },
                "index": {
                  "type": "integer"
                },
                "embedding": {
                  "type": "array",
                  "items": {
                    "type": "number"
                  }
                }
              }
            }
          },
          "model": {
            "type": "string"
          },
          "usage": {
            "type": "object",
            "properties": {
              "prompt_tokens": {
                "type": "integer"
              },
              "total_tokens": {
                "type": "integer"
              }
            }
          }
        }
      },
      "RerankDocument": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "object",
            "required": [
              "text"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "text": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "content"
            ],
            "description": "Multimodal document shape for compatible vLLM vision rerank deployments. TEI rerank deployments are text-only.",
            "properties": {
              "id": {
                "type": "string"
              },
              "content": {
                "type": "array",
                "minItems": 1,
                "items": {
                  "$ref": "#/components/schemas/RerankContentPart"
                }
              }
            }
          }
        ]
      },
      "RerankContentPart": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "type",
              "text"
            ],
            "properties": {
              "type": {
                "const": "text"
              },
              "text": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "type",
              "image_url"
            ],
            "properties": {
              "type": {
                "const": "image_url"
              },
              "image_url": {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "object",
                    "required": [
                      "url"
                    ],
                    "properties": {
                      "url": {
                        "type": "string"
                      }
                    }
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "type",
              "video_url"
            ],
            "properties": {
              "type": {
                "const": "video_url"
              },
              "video_url": {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "object",
                    "required": [
                      "url"
                    ],
                    "properties": {
                      "url": {
                        "type": "string"
                      }
                    }
                  }
                ]
              }
            }
          }
        ]
      },
      "RerankRequest": {
        "type": "object",
        "required": [
          "model",
          "query"
        ],
        "properties": {
          "model": {
            "type": "string",
            "example": "bge-reranker-v2-m3"
          },
          "query": {
            "type": "string",
            "example": "What is RunInfra Instant Start?"
          },
          "texts": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "minItems": 1,
            "maxItems": 500
          },
          "documents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RerankDocument"
            },
            "minItems": 1,
            "maxItems": 500
          },
          "top_n": {
            "type": "integer",
            "minimum": 1,
            "description": "Optional number of ranked results to return."
          }
        },
        "oneOf": [
          {
            "required": [
              "texts"
            ]
          },
          {
            "required": [
              "documents"
            ]
          }
        ]
      },
      "RerankResult": {
        "type": "object",
        "required": [
          "index",
          "score"
        ],
        "properties": {
          "index": {
            "type": "integer"
          },
          "score": {
            "type": "number"
          },
          "id": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RerankContentPart"
            }
          }
        }
      },
      "RerankScore": {
        "type": "object",
        "required": [
          "index",
          "score"
        ],
        "properties": {
          "index": {
            "type": "integer"
          },
          "score": {
            "type": "number"
          }
        }
      },
      "RerankResponse": {
        "type": "object",
        "required": [
          "object",
          "model",
          "scores",
          "rankings",
          "results",
          "document_count"
        ],
        "properties": {
          "object": {
            "type": "string",
            "example": "runinfra.rerank"
          },
          "model": {
            "type": "string"
          },
          "upstream_model": {
            "type": "string"
          },
          "scores": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RerankScore"
            }
          },
          "rankings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RerankResult"
            }
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RerankResult"
            }
          },
          "document_count": {
            "type": "integer"
          },
          "usage": {
            "$ref": "#/components/schemas/Usage"
          }
        }
      },
      "ImageGenerationRequest": {
        "type": "object",
        "required": [
          "model",
          "prompt"
        ],
        "properties": {
          "model": {
            "type": "string",
            "example": "flux-schnell"
          },
          "prompt": {
            "type": "string"
          },
          "n": {
            "type": "integer",
            "default": 1,
            "minimum": 1,
            "maximum": 4
          },
          "size": {
            "type": "string",
            "example": "1024x1024"
          },
          "response_format": {
            "type": "string",
            "enum": [
              "url",
              "b64_json"
            ],
            "default": "b64_json"
          }
        }
      },
      "ImageGenerationResponse": {
        "type": "object",
        "required": [
          "created",
          "data"
        ],
        "properties": {
          "created": {
            "type": "integer"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string"
                },
                "b64_json": {
                  "type": "string"
                },
                "revised_prompt": {
                  "type": "string"
                }
              }
            }
          },
          "usage": {
            "$ref": "#/components/schemas/Usage"
          }
        }
      },
      "TranscriptionRequest": {
        "type": "object",
        "required": [
          "file",
          "model"
        ],
        "properties": {
          "file": {
            "type": "string",
            "format": "binary",
            "description": "Non-empty audio file (mp3, wav, m4a, flac, webm, ogg)."
          },
          "model": {
            "type": "string",
            "example": "whisper-large-v3"
          },
          "language": {
            "type": "string",
            "description": "ISO-639-1 code"
          },
          "prompt": {
            "type": "string"
          },
          "response_format": {
            "type": "string",
            "enum": [
              "json",
              "text",
              "srt",
              "vtt",
              "verbose_json"
            ],
            "default": "json"
          },
          "temperature": {
            "type": "number",
            "default": 0
          }
        }
      },
      "Transcription": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string"
          }
        }
      },
      "SpeechRequest": {
        "type": "object",
        "required": [
          "model",
          "input"
        ],
        "properties": {
          "model": {
            "type": "string",
            "example": "kokoro"
          },
          "input": {
            "type": "string"
          },
          "voice": {
            "type": "string"
          },
          "response_format": {
            "type": "string",
            "enum": [
              "mp3",
              "wav",
              "flac",
              "opus",
              "aac",
              "pcm"
            ],
            "default": "mp3"
          },
          "speed": {
            "type": "number",
            "default": 1,
            "minimum": 0.25,
            "maximum": 4
          }
        }
      },
      "Credits": {
        "type": "object",
        "required": [
          "object",
          "balance_cents",
          "held_cents",
          "available_cents",
          "currency",
          "period",
          "spend_cap",
          "plan_tier",
          "as_of"
        ],
        "properties": {
          "object": {
            "type": "string",
            "example": "credits"
          },
          "balance_cents": {
            "type": "integer",
            "description": "Stored ledger balance in US cents. Open holds are already taken out of it. Negative when the workspace owes for usage that settled after the balance ran out. The same number a 402 reports as details.current_balance_cents.",
            "example": 5476
          },
          "held_cents": {
            "type": "integer",
            "description": "Cents reserved by requests currently in flight. Informational: already inside balance_cents, never subtract it again.",
            "example": 34
          },
          "available_cents": {
            "type": "integer",
            "description": "balance_cents floored at zero. What a new request can be settled against now.",
            "example": 5476
          },
          "currency": {
            "type": "string",
            "enum": [
              "usd"
            ]
          },
          "period": {
            "type": "object",
            "required": [
              "start",
              "spent_cents"
            ],
            "properties": {
              "start": {
                "type": "string",
                "format": "date-time",
                "description": "Start of the current billing period: the subscription period while the subscription is active or trialing, otherwise the calendar month in UTC."
              },
              "spent_cents": {
                "type": "integer",
                "description": "Settled spend in the current period. Open holds are not spend yet."
              }
            }
          },
          "spend_cap": {
            "type": "object",
            "required": [
              "limit_cents",
              "hard",
              "used_cents",
              "remaining_cents",
              "gates_inference"
            ],
            "properties": {
              "limit_cents": {
                "type": "integer",
                "nullable": true,
                "description": "Configured monthly spend cap, or null when none is set."
              },
              "hard": {
                "type": "boolean",
                "description": "True when reaching the cap refuses new optimization, benchmark and deployment work; false when it only alerts. Always false when there is no cap."
              },
              "used_cents": {
                "type": "integer",
                "nullable": true,
                "description": "What the cap is measured against: settled spend plus declared open maximums. Null when there is no cap."
              },
              "remaining_cents": {
                "type": "integer",
                "nullable": true,
                "description": "limit_cents minus used_cents, floored at zero, or null when there is no cap."
              },
              "gates_inference": {
                "type": "boolean",
                "description": "Always false: the cap never refuses an inference request.",
                "example": false
              }
            }
          },
          "plan_tier": {
            "type": "string",
            "description": "The entitled workspace tier, the same value X-RateLimit-Tier carries.",
            "example": "pro"
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ModelList": {
        "type": "object",
        "required": [
          "object",
          "data"
        ],
        "properties": {
          "object": {
            "type": "string",
            "example": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Model"
            }
          }
        }
      },
      "Model": {
        "type": "object",
        "required": [
          "id",
          "object",
          "owned_by"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "deepseek-v4-flash"
          },
          "object": {
            "type": "string",
            "example": "model"
          },
          "owned_by": {
            "type": "string"
          },
          "created": {
            "type": "integer",
            "description": "Creation time in Unix seconds."
          },
          "availability": {
            "type": "string",
            "enum": [
              "available",
              "paused"
            ],
            "description": "Whether the model currently accepts requests. A paused model stays listed."
          },
          "paused_until": {
            "type": "string",
            "format": "date-time",
            "description": "Scheduled return time, present while availability is paused."
          }
        }
      },
      "AnthropicError": {
        "type": "object",
        "description": "The Anthropic error envelope returned by every 4xx and 5xx from POST /messages and POST /messages/count_tokens.",
        "required": [
          "type",
          "error",
          "request_id"
        ],
        "properties": {
          "type": {
            "type": "string",
            "const": "error"
          },
          "error": {
            "type": "object",
            "required": [
              "type",
              "message"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "invalid_request_error",
                  "authentication_error",
                  "billing_error",
                  "permission_error",
                  "not_found_error",
                  "conflict_error",
                  "request_too_large",
                  "rate_limit_error",
                  "timeout_error",
                  "overloaded_error",
                  "api_error"
                ]
              },
              "message": {
                "type": "string"
              }
            }
          },
          "request_id": {
            "type": "string",
            "description": "Also returned on the request-id and x-request-id response headers."
          }
        }
      },
      "AnthropicTextBlock": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "type",
          "text"
        ],
        "properties": {
          "type": {
            "type": "string",
            "const": "text"
          },
          "text": {
            "type": "string"
          },
          "cache_control": {
            "description": "Accepted and ignored."
          }
        }
      },
      "AnthropicBase64ImageSource": {
        "type": "object",
        "required": [
          "type",
          "media_type",
          "data"
        ],
        "properties": {
          "type": {
            "type": "string",
            "const": "base64"
          },
          "media_type": {
            "type": "string",
            "enum": [
              "image/png",
              "image/jpeg",
              "image/gif",
              "image/webp"
            ]
          },
          "data": {
            "type": "string",
            "description": "Base64-encoded image bytes. URL and file sources are refused."
          }
        }
      },
      "AnthropicImageBlock": {
        "type": "object",
        "required": [
          "type",
          "source"
        ],
        "properties": {
          "type": {
            "type": "string",
            "const": "image"
          },
          "source": {
            "$ref": "#/components/schemas/AnthropicBase64ImageSource"
          },
          "cache_control": {
            "description": "Accepted and ignored."
          }
        }
      },
      "AnthropicToolUseBlock": {
        "type": "object",
        "required": [
          "type",
          "id",
          "name",
          "input"
        ],
        "properties": {
          "type": {
            "type": "string",
            "const": "tool_use"
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "input": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "AnthropicToolResultBlock": {
        "type": "object",
        "required": [
          "type",
          "tool_use_id",
          "content"
        ],
        "properties": {
          "type": {
            "type": "string",
            "const": "tool_result"
          },
          "tool_use_id": {
            "type": "string"
          },
          "content": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AnthropicTextBlock"
                }
              }
            ]
          },
          "is_error": {
            "type": "boolean",
            "default": false
          },
          "cache_control": {
            "description": "Accepted and ignored."
          }
        }
      },
      "AnthropicThinkingBlock": {
        "type": "object",
        "required": [
          "type",
          "thinking",
          "signature"
        ],
        "properties": {
          "type": {
            "type": "string",
            "const": "thinking"
          },
          "thinking": {
            "type": "string"
          },
          "signature": {
            "type": "string",
            "description": "Opaque compatibility value. It is not an Anthropic attestation."
          }
        }
      },
      "AnthropicRedactedThinkingBlock": {
        "type": "object",
        "required": [
          "type",
          "data"
        ],
        "properties": {
          "type": {
            "type": "string",
            "const": "redacted_thinking"
          },
          "data": {
            "type": "string"
          }
        }
      },
      "AnthropicMessageContentBlock": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/AnthropicTextBlock"
          },
          {
            "$ref": "#/components/schemas/AnthropicImageBlock"
          },
          {
            "$ref": "#/components/schemas/AnthropicToolUseBlock"
          },
          {
            "$ref": "#/components/schemas/AnthropicToolResultBlock"
          },
          {
            "$ref": "#/components/schemas/AnthropicThinkingBlock"
          },
          {
            "$ref": "#/components/schemas/AnthropicRedactedThinkingBlock"
          }
        ]
      },
      "AnthropicMessageParam": {
        "type": "object",
        "additionalProperties": true,
        "description": "A user or assistant turn. Consecutive turns with the same role are merged. tool_result blocks must come first in a user message. Prior thinking and redacted_thinking blocks are accepted and dropped.",
        "required": [
          "role",
          "content"
        ],
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "user",
              "assistant"
            ]
          },
          "content": {
            "description": "A string or an array of supported content blocks. Base64 images require a model whose page lists image input. URL and file image sources, document blocks and unknown block types are refused with 400 invalid_request_error.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AnthropicMessageContentBlock"
                }
              }
            ]
          }
        }
      },
      "AnthropicToolDefinition": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "name",
          "input_schema"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "input_schema": {
            "type": "object",
            "additionalProperties": true
          },
          "strict": {
            "description": "Accepted and ignored."
          },
          "defer_loading": {
            "description": "Accepted and ignored."
          },
          "cache_control": {
            "description": "Accepted and ignored."
          },
          "input_examples": {
            "description": "Accepted and ignored."
          }
        }
      },
      "AnthropicToolChoice": {
        "description": "auto, none, any, or a named client tool. any requires a tool call. On models whose page says forced tool calling is limited, any with several tools is refused, so use auto or name one tool. disable_parallel_tool_use belongs inside this object. Anthropic server tools are refused.",
        "oneOf": [
          {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "type": "string",
                "const": "auto"
              },
              "disable_parallel_tool_use": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "type": "string",
                "const": "none"
              },
              "disable_parallel_tool_use": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "type": "string",
                "const": "any"
              },
              "disable_parallel_tool_use": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "type",
              "name"
            ],
            "properties": {
              "type": {
                "type": "string",
                "const": "tool"
              },
              "name": {
                "type": "string"
              },
              "disable_parallel_tool_use": {
                "type": "boolean"
              }
            }
          }
        ]
      },
      "AnthropicThinkingConfig": {
        "type": "object",
        "additionalProperties": true,
        "description": "enabled and adaptive keep reasoning on, including enabling it on deepseek-v4-pro. disabled turns reasoning off where supported and is ignored with a hint response header where the model cannot disable reasoning.",
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "enabled",
              "adaptive",
              "disabled"
            ]
          },
          "budget_tokens": {
            "type": "integer",
            "description": "Accepted and ignored. Reasoning spends max_tokens."
          }
        }
      },
      "AnthropicOutputFormat": {
        "type": "object",
        "required": [
          "type",
          "schema"
        ],
        "properties": {
          "type": {
            "type": "string",
            "const": "json_schema"
          },
          "schema": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "AnthropicOutputConfig": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "effort": {
            "type": "string",
            "enum": [
              "low",
              "medium",
              "high",
              "xhigh",
              "max"
            ],
            "description": "Selects reasoning effort when the model accepts the value."
          },
          "format": {
            "$ref": "#/components/schemas/AnthropicOutputFormat"
          }
        }
      },
      "AnthropicMetadata": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "user_id": {
            "type": "string",
            "description": "Stable routing-affinity hint."
          }
        }
      },
      "AnthropicMessageRequest": {
        "type": "object",
        "required": [
          "model",
          "messages"
        ],
        "additionalProperties": true,
        "description": "Anthropic-compatible Messages request. POST /messages additionally requires max_tokens. Unknown top-level fields are accepted and ignored.",
        "properties": {
          "model": {
            "type": "string",
            "description": "Model id returned by GET /v1/models.",
            "example": "deepseek-v4-flash"
          },
          "max_tokens": {
            "type": "integer",
            "minimum": 1,
            "description": "Required by POST /messages and optional for POST /messages/count_tokens. Reasoning spends this budget. 0 is refused."
          },
          "messages": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/AnthropicMessageParam"
            }
          },
          "system": {
            "description": "A string or an array of text blocks. Array blocks remain separate prompt parts. Block-level cache_control is accepted and ignored.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AnthropicTextBlock"
                }
              }
            ]
          },
          "temperature": {
            "type": "number",
            "description": "Passed through."
          },
          "top_p": {
            "type": "number",
            "description": "Passed through."
          },
          "top_k": {
            "description": "Accepted and ignored."
          },
          "stop_sequences": {
            "type": "array",
            "description": "Passed through as stop strings. The matched sequence is not reported.",
            "items": {
              "type": "string"
            }
          },
          "stream": {
            "type": "boolean",
            "description": "true returns text/event-stream in the Anthropic event grammar."
          },
          "tools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AnthropicToolDefinition"
            },
            "description": "Client tools only. Anthropic server tools are refused."
          },
          "tool_choice": {
            "$ref": "#/components/schemas/AnthropicToolChoice"
          },
          "thinking": {
            "$ref": "#/components/schemas/AnthropicThinkingConfig"
          },
          "metadata": {
            "$ref": "#/components/schemas/AnthropicMetadata"
          },
          "output_config": {
            "$ref": "#/components/schemas/AnthropicOutputConfig"
          },
          "cache_control": {
            "description": "Accepted and ignored."
          },
          "service_tier": {
            "description": "Accepted and ignored."
          },
          "container": {
            "description": "Accepted and ignored."
          },
          "mcp_servers": {
            "description": "Accepted and ignored."
          },
          "context_management": {
            "description": "Accepted and ignored."
          },
          "inference_geo": {
            "description": "Accepted and ignored."
          },
          "speed": {
            "description": "Accepted and ignored."
          }
        }
      },
      "AnthropicResponseContentBlock": {
        "description": "Response content appears in thinking, text, then tool_use order when those blocks exist.",
        "oneOf": [
          {
            "$ref": "#/components/schemas/AnthropicThinkingBlock"
          },
          {
            "$ref": "#/components/schemas/AnthropicTextBlock"
          },
          {
            "$ref": "#/components/schemas/AnthropicToolUseBlock"
          }
        ]
      },
      "AnthropicUsage": {
        "type": "object",
        "required": [
          "input_tokens",
          "output_tokens",
          "cache_read_input_tokens",
          "cache_creation_input_tokens"
        ],
        "properties": {
          "input_tokens": {
            "type": "integer",
            "description": "Prompt tokens not served from cache. Add cache_read_input_tokens for the billed prompt count."
          },
          "output_tokens": {
            "type": "integer",
            "description": "All generated output tokens, including reasoning."
          },
          "cache_read_input_tokens": {
            "type": "integer",
            "description": "Prompt-prefix tokens served from cache."
          },
          "cache_creation_input_tokens": {
            "type": "integer",
            "const": 0,
            "description": "Always 0."
          }
        }
      },
      "AnthropicTokenCount": {
        "type": "object",
        "required": [
          "input_tokens"
        ],
        "properties": {
          "input_tokens": {
            "type": "integer",
            "description": "Estimated input tokens. The operation does not run or bill the model."
          }
        }
      },
      "AnthropicMessage": {
        "type": "object",
        "required": [
          "id",
          "type",
          "role",
          "content",
          "model",
          "stop_reason",
          "stop_sequence",
          "usage"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "msg_a1b2c3d4"
          },
          "type": {
            "type": "string",
            "const": "message"
          },
          "role": {
            "type": "string",
            "const": "assistant"
          },
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AnthropicResponseContentBlock"
            }
          },
          "model": {
            "type": "string"
          },
          "stop_reason": {
            "type": "string",
            "nullable": true,
            "enum": [
              "end_turn",
              "max_tokens",
              "tool_use",
              null
            ],
            "description": "end_turn when the model finished, max_tokens at the output ceiling, tool_use when it requested a client tool, or null when no reason is available."
          },
          "stop_sequence": {
            "type": "string",
            "nullable": true,
            "description": "Always null on this endpoint, for the reason above. Your stop_sequences are still honored by the model."
          },
          "usage": {
            "$ref": "#/components/schemas/AnthropicUsage"
          }
        }
      },
      "AnthropicTextDelta": {
        "type": "object",
        "required": [
          "type",
          "text"
        ],
        "properties": {
          "type": {
            "type": "string",
            "const": "text_delta"
          },
          "text": {
            "type": "string"
          }
        }
      },
      "AnthropicThinkingDelta": {
        "type": "object",
        "required": [
          "type",
          "thinking"
        ],
        "properties": {
          "type": {
            "type": "string",
            "const": "thinking_delta"
          },
          "thinking": {
            "type": "string"
          }
        }
      },
      "AnthropicSignatureDelta": {
        "type": "object",
        "required": [
          "type",
          "signature"
        ],
        "properties": {
          "type": {
            "type": "string",
            "const": "signature_delta"
          },
          "signature": {
            "type": "string"
          }
        }
      },
      "AnthropicInputJsonDelta": {
        "type": "object",
        "required": [
          "type",
          "partial_json"
        ],
        "properties": {
          "type": {
            "type": "string",
            "const": "input_json_delta"
          },
          "partial_json": {
            "type": "string",
            "description": "Concatenate fragments for the content block to recover the complete tool input object."
          }
        }
      },
      "AnthropicContentBlockDelta": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/AnthropicTextDelta"
          },
          {
            "$ref": "#/components/schemas/AnthropicThinkingDelta"
          },
          {
            "$ref": "#/components/schemas/AnthropicSignatureDelta"
          },
          {
            "$ref": "#/components/schemas/AnthropicInputJsonDelta"
          }
        ]
      },
      "AnthropicStreamEvent": {
        "description": "One event-named Server-Sent Event. There is no data: [DONE] sentinel. Blocks open lazily. The server emits ping every 15 seconds while the model is silent. message_delta carries authoritative cumulative usage. A failure after the stream opens ends with an error event and no message_stop.",
        "oneOf": [
          {
            "type": "object",
            "required": [
              "type",
              "message"
            ],
            "properties": {
              "type": {
                "type": "string",
                "const": "message_start"
              },
              "message": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/AnthropicMessage"
                  }
                ],
                "description": "content is empty and usage is zero here. The prompt token count is not known until generation ends, and the authoritative counts arrive on message_delta, which is where the Anthropic SDK stream accumulator takes final usage from."
              }
            }
          },
          {
            "type": "object",
            "required": [
              "type",
              "index",
              "content_block"
            ],
            "properties": {
              "type": {
                "type": "string",
                "const": "content_block_start"
              },
              "index": {
                "type": "integer"
              },
              "content_block": {
                "$ref": "#/components/schemas/AnthropicResponseContentBlock"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "type": "string",
                "const": "ping",
                "description": "Emitted every 15 seconds while the model is silent."
              }
            }
          },
          {
            "type": "object",
            "required": [
              "type",
              "index",
              "delta"
            ],
            "properties": {
              "type": {
                "type": "string",
                "const": "content_block_delta"
              },
              "index": {
                "type": "integer"
              },
              "delta": {
                "$ref": "#/components/schemas/AnthropicContentBlockDelta"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "type",
              "index"
            ],
            "properties": {
              "type": {
                "type": "string",
                "const": "content_block_stop"
              },
              "index": {
                "type": "integer"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "type",
              "delta",
              "usage"
            ],
            "properties": {
              "type": {
                "type": "string",
                "const": "message_delta"
              },
              "delta": {
                "type": "object",
                "properties": {
                  "stop_reason": {
                    "type": "string",
                    "nullable": true,
                    "enum": [
                      "end_turn",
                      "max_tokens",
                      "tool_use",
                      null
                    ]
                  },
                  "stop_sequence": {
                    "type": "string",
                    "nullable": true
                  }
                }
              },
              "usage": {
                "$ref": "#/components/schemas/AnthropicUsage"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "type": "string",
                "const": "message_stop"
              }
            }
          },
          {
            "$ref": "#/components/schemas/AnthropicError"
          }
        ]
      }
    }
  }
}
