{
  "openapi": "3.1.0",
  "info": {
    "title": "RunInfra API",
    "description": "OpenAI-compatible and Anthropic-compatible HTTP API for RunInfra Model APIs: hosted open-weight models for agents and apps, billed per token.",
    "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"
                }
              }
            },
            "headers": {
              "x-runinfra-funding": {
                "$ref": "#/components/headers/x-runinfra-funding"
              },
              "x-runinfra-plan": {
                "$ref": "#/components/headers/x-runinfra-plan"
              },
              "x-runinfra-plan-5h-used-percent": {
                "$ref": "#/components/headers/x-runinfra-plan-5h-used-percent"
              },
              "x-runinfra-plan-5h-resets-at": {
                "$ref": "#/components/headers/x-runinfra-plan-5h-resets-at"
              },
              "x-runinfra-plan-week-used-percent": {
                "$ref": "#/components/headers/x-runinfra-plan-week-used-percent"
              },
              "x-runinfra-plan-week-resets-at": {
                "$ref": "#/components/headers/x-runinfra-plan-week-resets-at"
              }
            }
          },
          "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"
                }
              }
            },
            "headers": {
              "x-runinfra-funding": {
                "$ref": "#/components/headers/x-runinfra-funding"
              },
              "x-runinfra-plan": {
                "$ref": "#/components/headers/x-runinfra-plan"
              },
              "x-runinfra-plan-5h-used-percent": {
                "$ref": "#/components/headers/x-runinfra-plan-5h-used-percent"
              },
              "x-runinfra-plan-5h-resets-at": {
                "$ref": "#/components/headers/x-runinfra-plan-5h-resets-at"
              },
              "x-runinfra-plan-week-used-percent": {
                "$ref": "#/components/headers/x-runinfra-plan-week-used-percent"
              },
              "x-runinfra-plan-week-resets-at": {
                "$ref": "#/components/headers/x-runinfra-plan-week-resets-at"
              }
            }
          },
          "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"
                }
              }
            },
            "headers": {
              "x-runinfra-funding": {
                "$ref": "#/components/headers/x-runinfra-funding"
              },
              "x-runinfra-plan": {
                "$ref": "#/components/headers/x-runinfra-plan"
              },
              "x-runinfra-plan-5h-used-percent": {
                "$ref": "#/components/headers/x-runinfra-plan-5h-used-percent"
              },
              "x-runinfra-plan-5h-resets-at": {
                "$ref": "#/components/headers/x-runinfra-plan-5h-resets-at"
              },
              "x-runinfra-plan-week-used-percent": {
                "$ref": "#/components/headers/x-runinfra-plan-week-used-percent"
              },
              "x-runinfra-plan-week-resets-at": {
                "$ref": "#/components/headers/x-runinfra-plan-week-resets-at"
              }
            }
          },
          "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"
                }
              }
            },
            "headers": {
              "x-runinfra-funding": {
                "$ref": "#/components/headers/x-runinfra-funding"
              },
              "x-runinfra-plan": {
                "$ref": "#/components/headers/x-runinfra-plan"
              },
              "x-runinfra-plan-5h-used-percent": {
                "$ref": "#/components/headers/x-runinfra-plan-5h-used-percent"
              },
              "x-runinfra-plan-5h-resets-at": {
                "$ref": "#/components/headers/x-runinfra-plan-5h-resets-at"
              },
              "x-runinfra-plan-week-used-percent": {
                "$ref": "#/components/headers/x-runinfra-plan-week-used-percent"
              },
              "x-runinfra-plan-week-resets-at": {
                "$ref": "#/components/headers/x-runinfra-plan-week-resets-at"
              }
            }
          },
          "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/PaymentRequiredCredits"
          },
          "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/PaymentRequiredCredits"
          },
          "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/PaymentRequiredCredits"
          },
          "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. `workspace_id` identifies the workspace authenticated by the API key. Read-only, charges nothing, never cached. The response has no coding_plan field; GET /usage returns coding plan windows and policy.",
        "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"
          }
        },
        "security": [
          {
            "anthropicApiKeyAuth": []
          },
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/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"
          }
        },
        "security": [
          {
            "anthropicApiKeyAuth": []
          },
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/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"
              },
              "x-runinfra-funding": {
                "$ref": "#/components/headers/x-runinfra-funding"
              },
              "x-runinfra-plan": {
                "$ref": "#/components/headers/x-runinfra-plan"
              },
              "x-runinfra-plan-5h-used-percent": {
                "$ref": "#/components/headers/x-runinfra-plan-5h-used-percent"
              },
              "x-runinfra-plan-5h-resets-at": {
                "$ref": "#/components/headers/x-runinfra-plan-5h-resets-at"
              },
              "x-runinfra-plan-week-used-percent": {
                "$ref": "#/components/headers/x-runinfra-plan-week-used-percent"
              },
              "x-runinfra-plan-week-resets-at": {
                "$ref": "#/components/headers/x-runinfra-plan-week-resets-at"
              }
            },
            "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"
          }
        }
      }
    },
    "/usage": {
      "get": {
        "operationId": "retrievePlanUsage",
        "summary": "Plan usage and funding",
        "description": "Read-only, workspace-key financial endpoint. Separate limit of 60 reads per minute per key, in addition to the normal request limit. Response timestamps are ISO 8601. Funding reset headers on inference responses use Unix seconds.",
        "tags": [
          "Credits"
        ],
        "responses": {
          "200": {
            "description": "Workspace coding plan policy and counters",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CodingPlanUsage"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "usage_scope_violation for legacy deployment or endpoint keys and internal canary keys",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "405": {
            "description": "Only GET is supported",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "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`, `POST /messages/count_tokens`, `GET /models` and `GET /models/{model}` 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`, `POST /messages/count_tokens`, `GET /models` and `GET /models/{model}` only. Every other endpoint takes Authorization: Bearer. When both headers are present on any of these four routes, a non-blank x-api-key wins."
      }
    },
    "headers": {
      "AnthropicRequestId": {
        "description": "Request identifier for support and tracing",
        "schema": {
          "type": "string"
        }
      },
      "x-runinfra-funding": {
        "description": "Request funding from the admission snapshot. Only present when a coding plan decision applied. Absent on ordinary pay-as-you-go requests.",
        "schema": {
          "type": "string",
          "enum": [
            "plan",
            "credits",
            "standby",
            "refused"
          ]
        }
      },
      "x-runinfra-plan": {
        "description": "Coding plan tier for the admission snapshot. Absent on ordinary pay-as-you-go requests.",
        "schema": {
          "type": "string",
          "enum": [
            "starter",
            "pro",
            "team"
          ]
        }
      },
      "x-runinfra-plan-5h-used-percent": {
        "description": "Integer percent used, clamped to 0 through 100. Omitted before a 5-hour window starts. Absent on ordinary pay-as-you-go requests.",
        "schema": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        }
      },
      "x-runinfra-plan-5h-resets-at": {
        "description": "Unix timestamp in seconds. Omitted before a 5-hour window starts. Absent on ordinary pay-as-you-go requests.",
        "schema": {
          "type": "integer"
        }
      },
      "x-runinfra-plan-week-used-percent": {
        "description": "Integer percent used, clamped to 0 through 100. Absent on ordinary pay-as-you-go requests.",
        "schema": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        }
      },
      "x-runinfra-plan-week-resets-at": {
        "description": "Unix timestamp in seconds. Absent on ordinary pay-as-you-go requests.",
        "schema": {
          "type": "integer"
        }
      }
    },
    "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": "Billing refusal, including insufficient credits, an account hold, a key spending limit, or plan_limit_reached. Plan-limit refusals carry x-should-retry: false and no Retry-After.",
        "content": {
          "application/json": {
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/Error"
                },
                {
                  "$ref": "#/components/schemas/PlanLimitError"
                }
              ]
            }
          }
        },
        "headers": {
          "x-runinfra-funding": {
            "$ref": "#/components/headers/x-runinfra-funding"
          },
          "x-runinfra-plan": {
            "$ref": "#/components/headers/x-runinfra-plan"
          },
          "x-runinfra-plan-5h-used-percent": {
            "$ref": "#/components/headers/x-runinfra-plan-5h-used-percent"
          },
          "x-runinfra-plan-5h-resets-at": {
            "$ref": "#/components/headers/x-runinfra-plan-5h-resets-at"
          },
          "x-runinfra-plan-week-used-percent": {
            "$ref": "#/components/headers/x-runinfra-plan-week-used-percent"
          },
          "x-runinfra-plan-week-resets-at": {
            "$ref": "#/components/headers/x-runinfra-plan-week-resets-at"
          },
          "x-should-retry": {
            "description": "false for plan_limit_reached. No Retry-After is sent for that billing refusal.",
            "schema": {
              "type": "string",
              "const": "false"
            }
          }
        }
      },
      "PaymentRequiredCredits": {
        "description": "Billing refusal on pay-as-you-go credits, such as insufficient credits. Coding plans do not fund this operation, so the response carries no plan fields and no plan headers.",
        "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. Also returned as idempotency_unavailable when an Idempotency-Key could not be checked; the request did not run and nothing was charged, so retry with the same key after Retry-After.",
        "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": "Billing refusal. A coding plan limit keeps only the self-explanatory message and billing_error type, plus request_id. Structured plan fields are not included.",
        "headers": {
          "request-id": {
            "$ref": "#/components/headers/AnthropicRequestId"
          },
          "x-request-id": {
            "$ref": "#/components/headers/AnthropicRequestId"
          },
          "x-runinfra-funding": {
            "$ref": "#/components/headers/x-runinfra-funding"
          },
          "x-runinfra-plan": {
            "$ref": "#/components/headers/x-runinfra-plan"
          },
          "x-runinfra-plan-5h-used-percent": {
            "$ref": "#/components/headers/x-runinfra-plan-5h-used-percent"
          },
          "x-runinfra-plan-5h-resets-at": {
            "$ref": "#/components/headers/x-runinfra-plan-5h-resets-at"
          },
          "x-runinfra-plan-week-used-percent": {
            "$ref": "#/components/headers/x-runinfra-plan-week-used-percent"
          },
          "x-runinfra-plan-week-resets-at": {
            "$ref": "#/components/headers/x-runinfra-plan-week-resets-at"
          },
          "x-should-retry": {
            "description": "false for plan_limit_reached. No Retry-After is sent for that billing refusal.",
            "schema": {
              "type": "string",
              "const": "false"
            }
          }
        },
        "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. Also returned when an Idempotency-Key could not be checked; the message names the key, the request did not run, and nothing was charged.",
        "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": "nemotron-3-5-lightning-30b"
          },
          "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. Supported values, defaults, and rewrites are model specific; check the model's page in the Model Library. When response_format requires a conforming effort, omitting reasoning_effort applies the model's published value and reports it in X-RunInfra-Reasoning-Effort-Applied. For Nemotron 3.5 Lightning 30B this value is none. An incompatible explicit effort is refused with 400 hosted_parameter_not_supported and param response_format."
          },
          "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": "nemotron-3-5-lightning-30b"
          },
          "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. Supported values, defaults, and rewrites follow the model's published rules. When text.format or response_format requires a conforming effort, omitting it applies the model's published value and reports it in X-RunInfra-Reasoning-Effort-Applied. An incompatible explicit effort is refused with 400 hosted_parameter_not_supported and param response_format."
          },
          "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. Check the model's page for the effort values that support structured output.",
            "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": "Calculated charge in US dollars, to eight decimals. On credits, this is the settlement formula over provider-reported tokens, not the final whole-cent wallet debit. Zero when the coding plan or Standby paid, during promotional zero-price usage, or without billable output. Hosted chat completions and Responses expose this field; Messages exposes token counters instead.",
            "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": "Calculated charge in integer microcents; one cent is 1,000,000 microcents. Zero when the plan or Standby paid. Credit settlement carries fractional cents and can be bounded by the balance debt floor, so this is not a per-request whole-cent debit.",
            "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"
          },
          "plan_value_microcents": {
            "type": "integer",
            "minimum": 0,
            "description": "Usage value at the applicable per-token rates. Added only when paid_from is plan or standby."
          },
          "paid_from": {
            "type": "string",
            "enum": [
              "plan",
              "standby"
            ],
            "description": "Present only when the coding plan or Standby paid. Credit-funded usage retains its ordinary cost fields."
          }
        }
      },
      "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",
            "description": "Replace MODEL_ID with the id of an embedding model deployed in your workspace and reachable by your key. GET /v1/models lists the ids your key can reach.",
            "example": "MODEL_ID"
          },
          "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",
            "description": "Replace MODEL_ID with the id of a rerank model deployed in your workspace and reachable by your key. GET /v1/models lists the ids your key can reach.",
            "example": "MODEL_ID"
          },
          "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",
            "description": "Replace MODEL_ID with the id of an image generation model deployed in your workspace and reachable by your key. GET /v1/models lists the ids your key can reach.",
            "example": "MODEL_ID"
          },
          "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",
            "description": "Replace MODEL_ID with the id of a transcription model deployed in your workspace and reachable by your key. GET /v1/models lists the ids your key can reach.",
            "example": "MODEL_ID"
          },
          "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",
            "description": "Replace MODEL_ID with the id of a speech model deployed in your workspace and reachable by your key. GET /v1/models lists the ids your key can reach.",
            "example": "MODEL_ID"
          },
          "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",
          "workspace_id",
          "balance_cents",
          "held_cents",
          "available_cents",
          "currency",
          "period",
          "spend_cap",
          "plan_tier",
          "as_of"
        ],
        "properties": {
          "object": {
            "type": "string",
            "example": "credits"
          },
          "workspace_id": {
            "type": "string",
            "format": "uuid",
            "description": "`workspace_id` identifies the workspace authenticated by the API key.",
            "example": "00000000-0000-4000-8000-000000000000"
          },
          "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 error.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 the legacy workspace cap refuses the work it covers; false when it only alerts. It never gates inference. 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": "core"
          },
          "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": "nemotron-3-5-lightning-30b"
          },
          "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": "Time availability is next rechecked, not a promised return. Present only 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": "nemotron-3-5-lightning-30b"
          },
          "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"
          }
        ]
      },
      "CodingPlanWindow": {
        "type": "object",
        "properties": {
          "starts_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
          },
          "resets_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
          },
          "used_microcents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "limit_microcents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "used_percent": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          }
        },
        "required": [
          "starts_at",
          "resets_at",
          "used_microcents",
          "limit_microcents",
          "used_percent"
        ],
        "additionalProperties": false,
        "description": "ISO 8601 window bounds and exact microcent counters. resets_at must be later than starts_at. used_percent is the whole-number percentage of used_microcents over limit_microcents, rounded down and capped at 100; a zero limit reports 100. An admitted crossing request can finish beyond the limit."
      },
      "CodingPlanCopy": {
        "type": "object",
        "properties": {
          "summary": {
            "type": "string"
          },
          "policy": {
            "type": "string"
          },
          "actual": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "chip_label": {
            "type": "string"
          },
          "chip_aria_label": {
            "type": "string"
          },
          "tile_label": {
            "type": "string"
          },
          "five_hour": {
            "type": "string"
          },
          "week": {
            "type": "string"
          },
          "standby": {
            "type": "string"
          },
          "credits": {
            "type": "string"
          },
          "price": {
            "type": "string"
          },
          "included_value": {
            "type": "string"
          },
          "scope": {
            "type": "string"
          },
          "included_month": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "pending_change": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "credits_lever": {
            "type": "string"
          },
          "remedy": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "freshness": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "summary",
          "policy",
          "actual",
          "chip_label",
          "chip_aria_label",
          "tile_label",
          "five_hour",
          "week",
          "standby",
          "credits",
          "price",
          "included_value",
          "scope",
          "included_month",
          "pending_change",
          "credits_lever",
          "remedy",
          "freshness"
        ],
        "additionalProperties": false
      },
      "CodingPlanCredits": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "cap_cents": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 100,
                "maximum": 10000000
              },
              {
                "type": "null"
              }
            ]
          },
          "balance_cents": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "month_spent_microcents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "pending_max_holds_microcents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "resets_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "enabled",
          "cap_cents",
          "balance_cents",
          "month_spent_microcents",
          "pending_max_holds_microcents",
          "resets_at"
        ],
        "additionalProperties": false,
        "description": "Credits after plan limits only. Monetary fields use the units in their names; null cap_cents means no cap. This is separate from the workspace spend cap."
      },
      "CodingPlanState": {
        "type": "object",
        "properties": {
          "tier": {
            "type": "string",
            "enum": [
              "starter",
              "pro",
              "team"
            ]
          },
          "interval": {
            "type": "string",
            "enum": [
              "month"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "incomplete",
              "active",
              "past_due",
              "unpaid",
              "canceled",
              "disputed"
            ]
          },
          "tile_state": {
            "type": "string",
            "enum": [
              "active",
              "payment_needed",
              "canceling",
              "paused",
              "ended",
              "refund_closed"
            ]
          },
          "serving": {
            "type": "boolean"
          },
          "cancel_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "renews_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "price_cents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "five_hour_limit_microcents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "plan_blocked_until": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ],
            "description": "Latest blocking plan reset, counting pending commitments. Null when no plan window blocks admission; displayed window usage remains settled-only."
          },
          "resumes_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional earliest time requests can resume after a limit, considering plan resets, eligible Standby refills, and credits-period resets. Null when no resume time is available."
          },
          "five_hour": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CodingPlanWindow"
              },
              {
                "type": "null"
              }
            ]
          },
          "week": {
            "$ref": "#/components/schemas/CodingPlanWindow"
          },
          "standby_day": {
            "$ref": "#/components/schemas/CodingPlanWindow"
          },
          "included_month": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "starts_at": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                  },
                  "resets_at": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                  },
                  "used_microcents": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "starts_at",
                  "resets_at",
                  "used_microcents"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ],
            "description": "Plan usage in the stored billing period, or null when unavailable. resets_at must be later than starts_at."
          },
          "pending_change": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "tier": {
                    "type": "string",
                    "enum": [
                      "starter",
                      "pro",
                      "team"
                    ]
                  },
                  "effective_at": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                  }
                },
                "required": [
                  "tier",
                  "effective_at"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "credits": {
            "$ref": "#/components/schemas/CodingPlanCredits"
          },
          "funding": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "plan",
                  "credits",
                  "standby",
                  "refused"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Null on GET /usage, which returns policy rather than a request receipt."
          },
          "predicted_funding": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "plan",
                  "credits",
                  "standby",
                  "refused"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Availability for a nominal next covered chat request, not a reservation or a receipt. Key policy, cost, operation and capacity can change the actual decision."
          },
          "remedy_code": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "enable_credits",
                  "raise_cap",
                  "add_funds",
                  "raise_key_limit",
                  "ask_owner",
                  "contact_support",
                  "wait_for_refill"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional typed remedy behind copy.remedy. Choose an action from this code rather than parsing display text. Null when no remedy is available, including while billing_frozen is true."
          },
          "serving_until": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional. When the plan stops serving unless a payment succeeds: the payment grace deadline, or the scheduled cancellation when that is earlier. Null while the plan is not serving."
          },
          "can_keep": {
            "type": "boolean",
            "description": "Optional. True while a scheduled cancellation can still be undone (Keep plan): cancel_at is in the future and the plan has no dispute hold, no reversal fence, and is not canceled, disputed, incomplete or refund-closed."
          },
          "billing_frozen": {
            "type": "boolean",
            "description": "Optional. True while an unpaid bill freezes the account, which blocks requests until the bill is resolved in Billing. A negative credit balance is not a billing freeze. Plan and credits settings cannot lift it, so remedy_code and copy.remedy are null while it is true."
          },
          "copy": {
            "$ref": "#/components/schemas/CodingPlanCopy"
          }
        },
        "required": [
          "tier",
          "interval",
          "status",
          "tile_state",
          "serving",
          "cancel_at",
          "renews_at",
          "price_cents",
          "five_hour_limit_microcents",
          "plan_blocked_until",
          "five_hour",
          "week",
          "standby_day",
          "included_month",
          "pending_change",
          "credits",
          "funding",
          "predicted_funding",
          "copy"
        ],
        "additionalProperties": false
      },
      "CodingPlanSnapshot": {
        "type": "object",
        "properties": {
          "observed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "availability": {
            "type": "string",
            "enum": [
              "available",
              "stale",
              "unavailable"
            ]
          },
          "current": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CodingPlanState"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "observed_at",
          "availability",
          "current"
        ],
        "additionalProperties": false,
        "description": "Plan snapshot with its own observation time. Available or stale snapshots require a non-null observed_at. A non-null current also requires observed_at; unavailable snapshots require current to be null."
      },
      "CodingPlanUsage": {
        "type": "object",
        "properties": {
          "workspace_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "coding_plan": {
            "$ref": "#/components/schemas/CodingPlanSnapshot"
          },
          "covers": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "chat",
                "embeddings",
                "rerank"
              ]
            }
          },
          "order": {
            "type": "array",
            "prefixItems": [
              {
                "type": "string",
                "const": "plan"
              },
              {
                "type": "string",
                "const": "credits"
              },
              {
                "type": "string",
                "const": "standby"
              },
              {
                "type": "string",
                "const": "refused"
              }
            ],
            "minItems": 4,
            "maxItems": 4
          }
        },
        "required": [
          "workspace_id",
          "coding_plan",
          "covers",
          "order"
        ],
        "additionalProperties": false,
        "description": "Current workspace coding plan policy. This read does not reserve usage or report the funding of a completed request. Read /credits for the credit balance when no plan exists."
      },
      "PlanLimitError": {
        "type": "object",
        "required": [
          "error",
          "request_id"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message",
              "type",
              "param",
              "limit",
              "resets_at",
              "tier",
              "used_microcents",
              "limit_microcents",
              "pending_microcents",
              "standby_resets_at",
              "standby_blocker",
              "credits",
              "fixes"
            ],
            "properties": {
              "code": {
                "type": "string",
                "const": "plan_limit_reached"
              },
              "message": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "const": "permission_error"
              },
              "param": {
                "type": "null"
              },
              "limit": {
                "type": "string",
                "enum": [
                  "five_hour",
                  "week"
                ]
              },
              "resets_at": {
                "type": "string",
                "format": "date-time"
              },
              "tier": {
                "type": "string",
                "enum": [
                  "starter",
                  "pro",
                  "team"
                ]
              },
              "used_microcents": {
                "type": "integer",
                "minimum": 0
              },
              "limit_microcents": {
                "type": "integer",
                "minimum": 0
              },
              "pending_microcents": {
                "type": "integer",
                "minimum": 0
              },
              "standby_resets_at": {
                "type": "string",
                "format": "date-time"
              },
              "standby_blocker": {
                "type": "string",
                "enum": [
                  "not_covered",
                  "payment_needed",
                  "credits_owed",
                  "closed",
                  "exhausted"
                ]
              },
              "credits": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "cap_cents": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "balance_cents": {
                    "type": "integer"
                  },
                  "month_spent_microcents": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "pending_max_holds_microcents": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "blocker": {
                    "type": "string",
                    "enum": [
                      "disabled",
                      "balance_negative",
                      "key_limit",
                      "empty",
                      "cap",
                      "period_unavailable"
                    ]
                  }
                },
                "required": [
                  "enabled",
                  "cap_cents",
                  "balance_cents",
                  "month_spent_microcents",
                  "pending_max_holds_microcents",
                  "blocker"
                ]
              },
              "fixes": {
                "type": "array",
                "minItems": 1,
                "maxItems": 1,
                "items": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string",
                      "enum": [
                        "enable_credits",
                        "raise_cap",
                        "add_funds",
                        "raise_key_limit",
                        "ask_owner",
                        "contact_support"
                      ]
                    },
                    "label": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string",
                      "const": "https://runinfra.ai/settings/cost?section=plan"
                    }
                  },
                  "required": [
                    "code",
                    "label",
                    "url"
                  ]
                }
              }
            }
          },
          "request_id": {
            "type": "string"
          }
        },
        "example": {
          "error": {
            "code": "plan_limit_reached",
            "message": "RunInfra coding plan (Pro): 5-hour limit reached, resets Sep 23, 3:00 PM UTC. Standby refills Sep 24, 12:00 AM UTC. Keep full speed on credits: https://runinfra.ai/settings/cost?section=plan",
            "limit": "five_hour",
            "resets_at": "2026-09-23T15:00:00.000Z",
            "tier": "pro",
            "used_microcents": 323076922,
            "limit_microcents": 323076922,
            "pending_microcents": 0,
            "standby_resets_at": "2026-09-24T00:00:00.000Z",
            "standby_blocker": "exhausted",
            "credits": {
              "enabled": false,
              "cap_cents": null,
              "balance_cents": 0,
              "month_spent_microcents": 0,
              "pending_max_holds_microcents": 0,
              "blocker": "disabled"
            },
            "fixes": [
              {
                "code": "enable_credits",
                "label": "Keep full speed on credits",
                "url": "https://runinfra.ai/settings/cost?section=plan"
              }
            ],
            "type": "permission_error",
            "param": null
          },
          "request_id": "req_example_plan_limit"
        }
      }
    }
  }
}
