{
  "components": {
    "responses": {
      "Error": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/OpenAIError"
            }
          }
        },
        "description": "OpenAI-shaped error; raw upstream bodies are never returned",
        "headers": {
          "x-request-id": {
            "description": "Request correlation id",
            "schema": {
              "$ref": "#/components/schemas/RequestId"
            }
          }
        }
      },
      "Forbidden": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/OpenAIError"
            }
          }
        },
        "description": "Key is valid but the model or route is not entitled",
        "headers": {
          "x-request-id": {
            "description": "Request correlation id",
            "schema": {
              "$ref": "#/components/schemas/RequestId"
            }
          }
        }
      },
      "RateLimited": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/OpenAIError"
            }
          }
        },
        "description": "Entitlement or GPU admission capacity limit",
        "headers": {
          "Access-Control-Expose-Headers": {
            "description": "Response headers a browser client may read",
            "schema": {
              "$ref": "#/components/schemas/AccessControlExposeHeaders"
            }
          },
          "Retry-After": {
            "description": "Seconds before retrying when supplied",
            "schema": {
              "$ref": "#/components/schemas/RetryAfterSeconds"
            }
          },
          "Server-Timing": {
            "description": "Pre-stream phase timings when supplied",
            "schema": {
              "$ref": "#/components/schemas/ServerTiming"
            }
          },
          "x-request-id": {
            "description": "Request correlation id",
            "schema": {
              "$ref": "#/components/schemas/RequestId"
            }
          }
        }
      },
      "Unauthorized": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/OpenAIError"
            }
          }
        },
        "description": "Missing, malformed, or unknown Cloud key",
        "headers": {
          "x-request-id": {
            "description": "Request correlation id",
            "schema": {
              "$ref": "#/components/schemas/RequestId"
            }
          }
        }
      }
    },
    "schemas": {
      "AccessControlExposeHeaders": {
        "description": "The response headers a browser client may read, as a comma-separated list; it names x-request-id, Retry-After and Server-Timing when the response carries them.",
        "maxLength": 1024,
        "minLength": 1,
        "type": "string"
      },
      "AdditionalPropertiesRule": {
        "oneOf": [
          {
            "type": "boolean"
          },
          {
            "$ref": "#/components/schemas/JsonSchemaProperty"
          }
        ]
      },
      "AssistantMessage": {
        "additionalProperties": false,
        "anyOf": [
          {
            "required": [
              "content"
            ]
          },
          {
            "required": [
              "tool_calls"
            ]
          }
        ],
        "properties": {
          "content": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/FreeText"
              },
              {
                "type": "null"
              }
            ]
          },
          "name": {
            "$ref": "#/components/schemas/ToolName"
          },
          "reasoning_content": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/FreeText"
              },
              {
                "type": "null"
              }
            ]
          },
          "role": {
            "const": "assistant"
          },
          "tool_calls": {
            "items": {
              "$ref": "#/components/schemas/AssistantToolCall"
            },
            "maxItems": 128,
            "minItems": 1,
            "type": "array"
          }
        },
        "required": [
          "role"
        ],
        "type": "object"
      },
      "AssistantToolCall": {
        "additionalProperties": false,
        "properties": {
          "function": {
            "$ref": "#/components/schemas/AssistantToolCallFunction"
          },
          "id": {
            "$ref": "#/components/schemas/ToolCallId"
          },
          "type": {
            "const": "function"
          }
        },
        "required": [
          "id",
          "type",
          "function"
        ],
        "type": "object"
      },
      "AssistantToolCallFunction": {
        "additionalProperties": false,
        "properties": {
          "arguments": {
            "$ref": "#/components/schemas/FreeText"
          },
          "name": {
            "$ref": "#/components/schemas/ToolName"
          }
        },
        "required": [
          "name",
          "arguments"
        ],
        "type": "object"
      },
      "ChatCompletion": {
        "additionalProperties": false,
        "properties": {
          "choices": {
            "items": {
              "$ref": "#/components/schemas/CompletionChoice"
            },
            "maxItems": 16,
            "minItems": 1,
            "type": "array"
          },
          "created": {
            "minimum": 0,
            "type": "integer"
          },
          "id": {
            "$ref": "#/components/schemas/CompletionId"
          },
          "metadata": {
            "$ref": "#/components/schemas/CompletionMetadata"
          },
          "model": {
            "$ref": "#/components/schemas/CompletionModelId"
          },
          "object": {
            "const": "chat.completion"
          },
          "system_fingerprint": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CompletionSystemFingerprint"
              },
              {
                "type": "null"
              }
            ]
          },
          "usage": {
            "$ref": "#/components/schemas/CompletionUsage"
          }
        },
        "required": [
          "id",
          "object",
          "created",
          "model",
          "choices"
        ],
        "type": "object"
      },
      "ChatCompletionChunk": {
        "additionalProperties": false,
        "description": "One JSON value in a data frame. The terminal data: [DONE] sentinel is specified separately. A stream the sidecar ends early carries StreamErrorFrame ($defs) as its last data frame instead of [DONE].",
        "properties": {
          "choices": {
            "items": {
              "$ref": "#/components/schemas/ChunkChoice"
            },
            "maxItems": 16,
            "type": "array"
          },
          "created": {
            "minimum": 0,
            "type": "integer"
          },
          "id": {
            "$ref": "#/components/schemas/ChunkId"
          },
          "model": {
            "$ref": "#/components/schemas/ChunkModelId"
          },
          "object": {
            "const": "chat.completion.chunk"
          },
          "system_fingerprint": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SystemFingerprint"
              },
              {
                "type": "null"
              }
            ]
          },
          "usage": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ChunkUsage"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "object",
          "choices"
        ],
        "type": "object"
      },
      "ChatCompletionEventStream": {
        "description": "SSE frames named message carry ChatCompletionChunk JSON and the stream terminates with data: [DONE]. A stream the sidecar ends early instead terminates with one StreamErrorFrame and no [DONE].",
        "format": "binary",
        "type": "string",
        "x-sse-events": {
          "message": {
            "$ref": "#/components/schemas/ChatCompletionStreamData"
          },
          "sentinel": "[DONE]",
          "terminal_error": {
            "$ref": "#/components/schemas/StreamErrorFrame"
          }
        }
      },
      "ChatCompletionStreamData": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/ChatCompletionChunk"
          },
          {
            "$ref": "#/components/schemas/OpenAIError"
          }
        ]
      },
      "ChatCompletionsRequest": {
        "additionalProperties": false,
        "properties": {
          "frequency_penalty": {
            "maximum": 2,
            "minimum": -2,
            "type": "number"
          },
          "max_completion_tokens": {
            "maximum": 1048576,
            "minimum": 1,
            "type": "integer"
          },
          "max_tokens": {
            "maximum": 1048576,
            "minimum": 1,
            "type": "integer"
          },
          "messages": {
            "items": {
              "$ref": "#/components/schemas/ChatMessage"
            },
            "maxItems": 4096,
            "minItems": 1,
            "type": "array"
          },
          "model": {
            "$ref": "#/components/schemas/ModelId"
          },
          "n": {
            "maximum": 16,
            "minimum": 1,
            "type": "integer"
          },
          "parallel_tool_calls": {
            "type": "boolean"
          },
          "presence_penalty": {
            "maximum": 2,
            "minimum": -2,
            "type": "number"
          },
          "reasoning_effort": {
            "$ref": "#/components/schemas/ReasoningEffort"
          },
          "response_format": {
            "$ref": "#/components/schemas/ResponseFormat"
          },
          "seed": {
            "maximum": 9223372036854775807,
            "minimum": -9223372036854775808,
            "type": "integer"
          },
          "stop": {
            "$ref": "#/components/schemas/StopSequenceSet"
          },
          "store": {
            "default": false,
            "type": "boolean"
          },
          "stream": {
            "default": false,
            "type": "boolean"
          },
          "stream_options": {
            "$ref": "#/components/schemas/StreamOptions"
          },
          "temperature": {
            "maximum": 2,
            "minimum": 0,
            "type": "number"
          },
          "tool_choice": {
            "$ref": "#/components/schemas/ToolChoice"
          },
          "tools": {
            "items": {
              "$ref": "#/components/schemas/ChatTool"
            },
            "maxItems": 128,
            "minItems": 1,
            "type": "array"
          },
          "top_p": {
            "maximum": 1,
            "minimum": 0,
            "type": "number"
          },
          "user": {
            "$ref": "#/components/schemas/EndUserId"
          }
        },
        "required": [
          "model",
          "messages"
        ],
        "type": "object"
      },
      "ChatMessage": {
        "discriminator": {
          "propertyName": "role"
        },
        "oneOf": [
          {
            "$ref": "#/components/schemas/SystemMessage"
          },
          {
            "$ref": "#/components/schemas/UserMessage"
          },
          {
            "$ref": "#/components/schemas/AssistantMessage"
          },
          {
            "$ref": "#/components/schemas/ToolMessage"
          }
        ]
      },
      "ChatTool": {
        "additionalProperties": false,
        "properties": {
          "function": {
            "$ref": "#/components/schemas/ChatToolFunction"
          },
          "type": {
            "const": "function"
          }
        },
        "required": [
          "type",
          "function"
        ],
        "type": "object"
      },
      "ChatToolFunction": {
        "additionalProperties": false,
        "properties": {
          "description": {
            "$ref": "#/components/schemas/FreeText"
          },
          "name": {
            "$ref": "#/components/schemas/ToolName"
          },
          "parameters": {
            "$ref": "#/components/schemas/ToolParameters"
          },
          "strict": {
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "parameters"
        ],
        "type": "object"
      },
      "ChunkChoice": {
        "additionalProperties": false,
        "properties": {
          "delta": {
            "$ref": "#/components/schemas/ChunkDelta"
          },
          "finish_reason": {
            "$ref": "#/components/schemas/NullableFinishReason"
          },
          "index": {
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "index",
          "delta",
          "finish_reason"
        ],
        "type": "object"
      },
      "ChunkDelta": {
        "additionalProperties": false,
        "properties": {
          "content": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ChunkText"
              },
              {
                "type": "null"
              }
            ]
          },
          "reasoning_content": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ChunkText"
              },
              {
                "type": "null"
              }
            ]
          },
          "role": {
            "$ref": "#/components/schemas/ChunkRole"
          },
          "tool_calls": {
            "items": {
              "$ref": "#/components/schemas/ChunkToolCall"
            },
            "maxItems": 128,
            "minItems": 1,
            "type": "array"
          }
        },
        "type": "object"
      },
      "ChunkId": {
        "maxLength": 256,
        "minLength": 1,
        "type": "string"
      },
      "ChunkModelId": {
        "maxLength": 128,
        "minLength": 1,
        "type": "string"
      },
      "ChunkRole": {
        "enum": [
          "assistant"
        ],
        "type": "string"
      },
      "ChunkText": {
        "maxLength": 16777216,
        "minLength": 0,
        "type": "string"
      },
      "ChunkToolCall": {
        "additionalProperties": false,
        "properties": {
          "function": {
            "$ref": "#/components/schemas/ChunkToolFunction"
          },
          "id": {
            "$ref": "#/components/schemas/ChunkToolCallId"
          },
          "index": {
            "minimum": 0,
            "type": "integer"
          },
          "type": {
            "const": "function"
          }
        },
        "required": [
          "index"
        ],
        "type": "object"
      },
      "ChunkToolCallId": {
        "maxLength": 256,
        "minLength": 1,
        "type": "string"
      },
      "ChunkToolFunction": {
        "additionalProperties": false,
        "properties": {
          "arguments": {
            "$ref": "#/components/schemas/ChunkText"
          },
          "name": {
            "$ref": "#/components/schemas/ChunkToolName"
          }
        },
        "type": "object"
      },
      "ChunkToolName": {
        "maxLength": 64,
        "minLength": 1,
        "pattern": "^[A-Za-z0-9_-]+$",
        "type": "string"
      },
      "ChunkUsage": {
        "additionalProperties": false,
        "properties": {
          "completion_tokens": {
            "minimum": 0,
            "type": "integer"
          },
          "completion_tokens_details": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CompletionTokensDetails"
              },
              {
                "type": "null"
              }
            ]
          },
          "prompt_tokens": {
            "minimum": 0,
            "type": "integer"
          },
          "prompt_tokens_details": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PromptTokensDetails"
              },
              {
                "type": "null"
              }
            ]
          },
          "reasoning_tokens": {
            "minimum": 0,
            "type": "integer"
          },
          "total_tokens": {
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "prompt_tokens",
          "completion_tokens",
          "total_tokens"
        ],
        "type": "object"
      },
      "CompletionChoice": {
        "additionalProperties": false,
        "properties": {
          "finish_reason": {
            "$ref": "#/components/schemas/CompletionFinishReason"
          },
          "index": {
            "minimum": 0,
            "type": "integer"
          },
          "logprobs": {
            "type": "null"
          },
          "matched_stop": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CompletionText"
              },
              {
                "maximum": 2147483647,
                "minimum": 0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "message": {
            "$ref": "#/components/schemas/CompletionMessage"
          }
        },
        "required": [
          "index",
          "message",
          "finish_reason"
        ],
        "type": "object"
      },
      "CompletionFinishReason": {
        "enum": [
          "stop",
          "length",
          "tool_calls",
          "content_filter",
          "function_call"
        ],
        "type": "string"
      },
      "CompletionId": {
        "maxLength": 256,
        "minLength": 1,
        "type": "string"
      },
      "CompletionMessage": {
        "additionalProperties": false,
        "properties": {
          "content": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CompletionText"
              },
              {
                "type": "null"
              }
            ]
          },
          "reasoning_content": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CompletionText"
              },
              {
                "type": "null"
              }
            ]
          },
          "role": {
            "$ref": "#/components/schemas/CompletionRole"
          },
          "tool_calls": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/CompletionToolCall"
                },
                "maxItems": 128,
                "minItems": 1,
                "type": "array"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "role",
          "content"
        ],
        "type": "object"
      },
      "CompletionMetadata": {
        "additionalProperties": false,
        "properties": {
          "weight_version": {
            "$ref": "#/components/schemas/CompletionWeightVersion"
          },
          "weight_versions": {
            "description": "Every weight range the engine has loaded. Served alongside weight_version, which names the active one.",
            "items": {
              "$ref": "#/components/schemas/CompletionWeightVersionRange"
            },
            "maxItems": 64,
            "type": "array"
          }
        },
        "type": "object"
      },
      "CompletionModelId": {
        "maxLength": 128,
        "minLength": 1,
        "type": "string"
      },
      "CompletionPromptTokensDetails": {
        "additionalProperties": false,
        "minProperties": 1,
        "properties": {
          "audio_tokens": {
            "minimum": 0,
            "type": "integer"
          },
          "cached_tokens": {
            "minimum": 0,
            "type": "integer"
          },
          "text_tokens": {
            "minimum": 0,
            "type": "integer"
          }
        },
        "type": "object"
      },
      "CompletionRole": {
        "enum": [
          "assistant"
        ],
        "type": "string"
      },
      "CompletionSystemFingerprint": {
        "maxLength": 120,
        "minLength": 1,
        "type": "string"
      },
      "CompletionText": {
        "maxLength": 16777216,
        "minLength": 0,
        "type": "string"
      },
      "CompletionTokensDetails": {
        "additionalProperties": false,
        "minProperties": 1,
        "properties": {
          "accepted_prediction_tokens": {
            "minimum": 0,
            "type": "integer"
          },
          "audio_tokens": {
            "minimum": 0,
            "type": "integer"
          },
          "reasoning_tokens": {
            "minimum": 0,
            "type": "integer"
          },
          "rejected_prediction_tokens": {
            "minimum": 0,
            "type": "integer"
          },
          "text_tokens": {
            "minimum": 0,
            "type": "integer"
          }
        },
        "type": "object"
      },
      "CompletionToolCall": {
        "additionalProperties": false,
        "properties": {
          "function": {
            "$ref": "#/components/schemas/CompletionToolFunction"
          },
          "id": {
            "$ref": "#/components/schemas/CompletionToolCallId"
          },
          "index": {
            "description": "Position of this call within the message's tool_calls array. Emitted by the engine on buffered and streamed responses alike. NOT required: a provider-hosted model routed through the gateway may omit it.",
            "maximum": 127,
            "minimum": 0,
            "type": "integer"
          },
          "type": {
            "const": "function"
          }
        },
        "required": [
          "id",
          "type",
          "function"
        ],
        "type": "object"
      },
      "CompletionToolCallId": {
        "maxLength": 256,
        "minLength": 1,
        "type": "string"
      },
      "CompletionToolFunction": {
        "additionalProperties": false,
        "properties": {
          "arguments": {
            "$ref": "#/components/schemas/CompletionText"
          },
          "name": {
            "$ref": "#/components/schemas/CompletionToolName"
          }
        },
        "required": [
          "name",
          "arguments"
        ],
        "type": "object"
      },
      "CompletionToolName": {
        "maxLength": 64,
        "minLength": 1,
        "pattern": "^[A-Za-z0-9_-]+$",
        "type": "string"
      },
      "CompletionUsage": {
        "additionalProperties": false,
        "properties": {
          "completion_tokens": {
            "minimum": 0,
            "type": "integer"
          },
          "completion_tokens_details": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CompletionTokensDetails"
              },
              {
                "type": "null"
              }
            ]
          },
          "prompt_tokens": {
            "minimum": 0,
            "type": "integer"
          },
          "prompt_tokens_details": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CompletionPromptTokensDetails"
              },
              {
                "type": "null"
              }
            ]
          },
          "reasoning_tokens": {
            "minimum": 0,
            "type": "integer"
          },
          "total_tokens": {
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "prompt_tokens",
          "completion_tokens",
          "total_tokens"
        ],
        "type": "object"
      },
      "CompletionWeightVersion": {
        "maxLength": 256,
        "minLength": 1,
        "type": "string"
      },
      "CompletionWeightVersionRange": {
        "additionalProperties": false,
        "description": "One loaded weight range, as the engine reports it.",
        "properties": {
          "end": {
            "minimum": 0,
            "type": "integer"
          },
          "start": {
            "minimum": 0,
            "type": "integer"
          },
          "version": {
            "$ref": "#/components/schemas/CompletionWeightVersion"
          }
        },
        "required": [
          "version",
          "start",
          "end"
        ],
        "type": "object"
      },
      "ContentPart": {
        "discriminator": {
          "propertyName": "type"
        },
        "oneOf": [
          {
            "$ref": "#/components/schemas/TextContentPart"
          },
          {
            "$ref": "#/components/schemas/ImageContentPart"
          }
        ]
      },
      "ContentPartList": {
        "items": {
          "$ref": "#/components/schemas/ContentPart"
        },
        "maxItems": 4096,
        "minItems": 1,
        "type": "array"
      },
      "EndUserId": {
        "maxLength": 256,
        "minLength": 1,
        "type": "string"
      },
      "ErrorCode": {
        "enum": [
          "bad_request",
          "not_found",
          "payload_too_large",
          "unprocessable",
          "invalid_api_key",
          "expired_api_key",
          "revoked_api_key",
          "insufficient_credit",
          "account_frozen",
          "model_not_entitled",
          "not_in_cohort",
          "user_rate_limited",
          "request_cancelled",
          "quota_exceeded",
          "capacity_exceeded",
          "idempotency_key_reused",
          "unsupported_endpoint",
          "proxy_retired",
          "gateway_unavailable",
          "control_plane_overloaded",
          "credit_gate_unavailable",
          "upstream_contract_violation",
          "unattributed_key",
          "internal",
          "bad_gateway",
          "draining",
          "spool_unhealthy",
          "cold",
          "timeout"
        ],
        "type": "string"
      },
      "ErrorMessage": {
        "maxLength": 2048,
        "minLength": 1,
        "type": "string"
      },
      "ErrorParameter": {
        "maxLength": 256,
        "minLength": 1,
        "type": "string"
      },
      "ErrorType": {
        "enum": [
          "invalid_request_error",
          "authentication_error",
          "permission_error",
          "rate_limit_error",
          "quota",
          "capacity",
          "server_error",
          "timeout"
        ],
        "type": "string"
      },
      "FinishReason": {
        "enum": [
          "stop",
          "length",
          "tool_calls",
          "content_filter",
          "function_call"
        ],
        "type": "string"
      },
      "FreeText": {
        "maxLength": 16777216,
        "minLength": 0,
        "type": "string"
      },
      "ImageContentPart": {
        "additionalProperties": false,
        "properties": {
          "image_url": {
            "$ref": "#/components/schemas/ImageUrl"
          },
          "type": {
            "const": "image_url"
          }
        },
        "required": [
          "type",
          "image_url"
        ],
        "type": "object"
      },
      "ImageUrl": {
        "additionalProperties": false,
        "properties": {
          "detail": {
            "enum": [
              "auto",
              "low",
              "high"
            ],
            "type": "string"
          },
          "url": {
            "description": "An https URL or an RFC 2397 data URL.",
            "maxLength": 16777216,
            "minLength": 1,
            "type": "string"
          }
        },
        "required": [
          "url"
        ],
        "type": "object"
      },
      "JsonScalar": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/FreeText"
          },
          {
            "maximum": 1e+308,
            "minimum": -1e+308,
            "type": "number"
          },
          {
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          },
          {
            "type": "boolean"
          },
          {
            "type": "null"
          }
        ]
      },
      "JsonSchemaDialect": {
        "description": "The JSON Schema dialect a client's tool-schema generator stamps at the ROOT of `parameters` (zod-to-json-schema, the Vercel AI SDK and Pydantic all emit `$schema`). Accepted at the root only, only as a json-schema.org URI, and otherwise ignored: `parameters` is validated against this contract, not against the dialect named.",
        "format": "uri",
        "maxLength": 256,
        "minLength": 1,
        "pattern": "^https?://json-schema\\.org/",
        "type": "string"
      },
      "JsonSchemaProperty": {
        "additionalProperties": false,
        "properties": {
          "additionalProperties": {
            "$ref": "#/components/schemas/AdditionalPropertiesRule"
          },
          "allOf": {
            "items": {
              "$ref": "#/components/schemas/JsonSchemaProperty"
            },
            "minItems": 1,
            "type": "array"
          },
          "anyOf": {
            "items": {
              "$ref": "#/components/schemas/JsonSchemaProperty"
            },
            "minItems": 1,
            "type": "array"
          },
          "const": {
            "$ref": "#/components/schemas/JsonScalar"
          },
          "default": {
            "$ref": "#/components/schemas/JsonScalar"
          },
          "description": {
            "$ref": "#/components/schemas/FreeText"
          },
          "enum": {
            "items": {
              "$ref": "#/components/schemas/JsonScalar"
            },
            "minItems": 1,
            "type": "array"
          },
          "items": {
            "$ref": "#/components/schemas/JsonSchemaProperty"
          },
          "maxLength": {
            "minimum": 0,
            "type": "integer"
          },
          "maximum": {
            "maximum": 1e+308,
            "minimum": -1e+308,
            "type": "number"
          },
          "minLength": {
            "minimum": 0,
            "type": "integer"
          },
          "minimum": {
            "maximum": 1e+308,
            "minimum": -1e+308,
            "type": "number"
          },
          "oneOf": {
            "items": {
              "$ref": "#/components/schemas/JsonSchemaProperty"
            },
            "minItems": 1,
            "type": "array"
          },
          "pattern": {
            "maxLength": 1024,
            "minLength": 1,
            "type": "string"
          },
          "properties": {
            "$ref": "#/components/schemas/ToolParameterProperties"
          },
          "required": {
            "items": {
              "$ref": "#/components/schemas/ToolParameterName"
            },
            "type": "array",
            "uniqueItems": true
          },
          "type": {
            "$ref": "#/components/schemas/JsonSchemaType"
          }
        },
        "type": "object"
      },
      "JsonSchemaType": {
        "enum": [
          "string",
          "number",
          "integer",
          "boolean",
          "array",
          "object",
          "null"
        ],
        "type": "string"
      },
      "ModelId": {
        "description": "An explicitly entitled Wally model identifier.",
        "maxLength": 128,
        "minLength": 1,
        "pattern": "^[A-Za-z0-9][A-Za-z0-9._:/-]*$",
        "type": "string"
      },
      "ModelList": {
        "additionalProperties": false,
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/PublicModel"
            },
            "type": "array"
          },
          "object": {
            "const": "list"
          }
        },
        "required": [
          "object",
          "data"
        ],
        "type": "object"
      },
      "ModelOwner": {
        "maxLength": 128,
        "minLength": 1,
        "type": "string"
      },
      "NamedToolChoice": {
        "additionalProperties": false,
        "properties": {
          "function": {
            "$ref": "#/components/schemas/NamedToolChoiceFunction"
          },
          "type": {
            "const": "function"
          }
        },
        "required": [
          "type",
          "function"
        ],
        "type": "object"
      },
      "NamedToolChoiceFunction": {
        "additionalProperties": false,
        "properties": {
          "name": {
            "$ref": "#/components/schemas/ToolName"
          }
        },
        "required": [
          "name"
        ],
        "type": "object"
      },
      "NonEmptyText": {
        "maxLength": 16777216,
        "minLength": 1,
        "type": "string"
      },
      "NullableFinishReason": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/FinishReason"
          },
          {
            "type": "null"
          }
        ]
      },
      "OpenAIError": {
        "additionalProperties": false,
        "properties": {
          "error": {
            "$ref": "#/components/schemas/OpenAIErrorDetail"
          }
        },
        "required": [
          "error"
        ],
        "type": "object"
      },
      "OpenAIErrorDetail": {
        "additionalProperties": false,
        "properties": {
          "code": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ErrorCode"
              },
              {
                "type": "null"
              }
            ]
          },
          "message": {
            "$ref": "#/components/schemas/ErrorMessage"
          },
          "param": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ErrorParameter"
              },
              {
                "type": "null"
              }
            ]
          },
          "type": {
            "$ref": "#/components/schemas/ErrorType"
          }
        },
        "required": [
          "message",
          "type"
        ],
        "type": "object"
      },
      "PromptTokensDetails": {
        "additionalProperties": false,
        "minProperties": 1,
        "properties": {
          "audio_tokens": {
            "minimum": 0,
            "type": "integer"
          },
          "cached_tokens": {
            "minimum": 0,
            "type": "integer"
          },
          "text_tokens": {
            "minimum": 0,
            "type": "integer"
          }
        },
        "type": "object"
      },
      "PublicModel": {
        "additionalProperties": false,
        "properties": {
          "created": {
            "description": "OpenAI-shaped creation timestamp (unix seconds) the gateway reports; informational.",
            "minimum": 0,
            "type": "integer"
          },
          "id": {
            "$ref": "#/components/schemas/PublicModelId"
          },
          "max_input_tokens": {
            "description": "The advertised ceiling on input tokens for this model -- what an OpenAI-shaped coding agent reads to decide when to compact. It is the largest prompt the engine still answers with one output token, not the raw context length: a prompt longer than this is refused with 400 before it is billed. null means the deployment has not established one.",
            "minimum": 1,
            "type": [
              "integer",
              "null"
            ]
          },
          "max_output_tokens": {
            "description": "The advertised ceiling on output tokens, when the deployment declares one separately from the context window. null means this model draws output from the single budget max_input_tokens already describes.",
            "minimum": 1,
            "type": [
              "integer",
              "null"
            ]
          },
          "mode": {
            "description": "The gateway's model mode; every Wally model is a chat model.",
            "enum": [
              "chat"
            ],
            "type": "string"
          },
          "object": {
            "const": "model"
          },
          "owned_by": {
            "$ref": "#/components/schemas/ModelOwner"
          }
        },
        "required": [
          "id",
          "object",
          "owned_by"
        ],
        "type": "object"
      },
      "PublicModelId": {
        "maxLength": 128,
        "minLength": 1,
        "pattern": "^[A-Za-z0-9][A-Za-z0-9._:/-]*$",
        "type": "string"
      },
      "ReasoningEffort": {
        "enum": [
          "none",
          "minimal",
          "low",
          "medium",
          "high"
        ],
        "type": "string"
      },
      "RequestId": {
        "maxLength": 256,
        "minLength": 1,
        "type": "string"
      },
      "ResponseFormat": {
        "additionalProperties": false,
        "properties": {
          "type": {
            "enum": [
              "text",
              "json_object"
            ],
            "type": "string"
          }
        },
        "required": [
          "type"
        ],
        "type": "object"
      },
      "RetryAfterSeconds": {
        "minimum": 0,
        "type": "integer"
      },
      "ServerTiming": {
        "description": "W3C Server-Timing. As a HEADER it carries pre-stream phases only, for example the gateway's authorize call and the sidecar's ra-queue (time waiting for a seat) and ra-admit (the sidecar's own work before the request reached the model). Time to first token is never in the header, because it is not known when the headers are sent; on a streaming response it arrives as a Server-Timing TRAILER named ra-ttft, after the last SSE frame. Metric names are not a closed set: ignore a name you do not know, and treat the trailer as optional.",
        "maxLength": 1024,
        "minLength": 1,
        "type": "string"
      },
      "StopSequence": {
        "maxLength": 4096,
        "minLength": 1,
        "type": "string"
      },
      "StopSequenceList": {
        "items": {
          "$ref": "#/components/schemas/StopSequence"
        },
        "maxItems": 4,
        "minItems": 1,
        "type": "array"
      },
      "StopSequenceSet": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/StopSequence"
          },
          {
            "$ref": "#/components/schemas/StopSequenceList"
          }
        ]
      },
      "StreamErrorDetail": {
        "additionalProperties": false,
        "description": "Why the sidecar ended the stream. A narrowing of error.schema.json OpenAIErrorDetail: every value here is a member of that schema's closed ErrorType and ErrorCode sets, so a client that handles the public error envelope needs nothing new.",
        "properties": {
          "code": {
            "enum": [
              "timeout"
            ],
            "type": "string"
          },
          "message": {
            "maxLength": 2048,
            "minLength": 1,
            "type": "string"
          },
          "type": {
            "enum": [
              "timeout"
            ],
            "type": "string"
          }
        },
        "required": [
          "message",
          "type",
          "code"
        ],
        "type": "object"
      },
      "StreamErrorFrame": {
        "additionalProperties": false,
        "description": "The last data frame of a stream the sidecar ends before completion because no first token arrived within the release contract's first-token deadline. No [DONE] follows it. Every instance is also a valid error.schema.json OpenAIError.",
        "properties": {
          "error": {
            "$ref": "#/components/schemas/StreamErrorDetail"
          }
        },
        "required": [
          "error"
        ],
        "type": "object"
      },
      "StreamOptions": {
        "additionalProperties": false,
        "properties": {
          "include_usage": {
            "type": "boolean"
          }
        },
        "required": [
          "include_usage"
        ],
        "type": "object"
      },
      "SystemFingerprint": {
        "maxLength": 120,
        "minLength": 1,
        "type": "string"
      },
      "SystemMessage": {
        "additionalProperties": false,
        "properties": {
          "content": {
            "$ref": "#/components/schemas/NonEmptyText"
          },
          "name": {
            "$ref": "#/components/schemas/ToolName"
          },
          "role": {
            "const": "system"
          }
        },
        "required": [
          "role",
          "content"
        ],
        "type": "object"
      },
      "TextContentPart": {
        "additionalProperties": false,
        "properties": {
          "text": {
            "$ref": "#/components/schemas/NonEmptyText"
          },
          "type": {
            "const": "text"
          }
        },
        "required": [
          "type",
          "text"
        ],
        "type": "object"
      },
      "ToolCallId": {
        "maxLength": 256,
        "minLength": 1,
        "type": "string"
      },
      "ToolChoice": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/ToolChoiceMode"
          },
          {
            "$ref": "#/components/schemas/NamedToolChoice"
          }
        ]
      },
      "ToolChoiceMode": {
        "enum": [
          "none",
          "auto",
          "required"
        ],
        "type": "string"
      },
      "ToolMessage": {
        "additionalProperties": false,
        "properties": {
          "content": {
            "$ref": "#/components/schemas/FreeText"
          },
          "role": {
            "const": "tool"
          },
          "tool_call_id": {
            "$ref": "#/components/schemas/ToolCallId"
          }
        },
        "required": [
          "role",
          "content",
          "tool_call_id"
        ],
        "type": "object"
      },
      "ToolName": {
        "maxLength": 64,
        "minLength": 1,
        "pattern": "^[A-Za-z0-9_-]+$",
        "type": "string"
      },
      "ToolParameterName": {
        "maxLength": 256,
        "minLength": 1,
        "type": "string"
      },
      "ToolParameterProperties": {
        "additionalProperties": {
          "$ref": "#/components/schemas/JsonSchemaProperty"
        },
        "description": "OpenAI tool parameter names are caller-defined; each value is still a typed JSON Schema property.",
        "type": "object"
      },
      "ToolParameters": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "$ref": "#/components/schemas/JsonSchemaDialect"
          },
          "additionalProperties": {
            "$ref": "#/components/schemas/AdditionalPropertiesRule"
          },
          "properties": {
            "$ref": "#/components/schemas/ToolParameterProperties"
          },
          "required": {
            "items": {
              "$ref": "#/components/schemas/ToolParameterName"
            },
            "type": "array",
            "uniqueItems": true
          },
          "type": {
            "const": "object"
          }
        },
        "required": [
          "type",
          "properties"
        ],
        "type": "object"
      },
      "UserContent": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/NonEmptyText"
          },
          {
            "$ref": "#/components/schemas/ContentPartList"
          }
        ]
      },
      "UserMessage": {
        "additionalProperties": false,
        "properties": {
          "content": {
            "$ref": "#/components/schemas/UserContent"
          },
          "name": {
            "$ref": "#/components/schemas/ToolName"
          },
          "role": {
            "const": "user"
          }
        },
        "required": [
          "role",
          "content"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "BearerAuth": {
        "bearerFormat": "RunAnywhereCloudKey",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "description": "OpenAI-compatible hosted inference for Wally. Usage is billed against prepaid credits at the list prices shown in the RunAnywhere console.",
    "title": "RunAnywhere Wally Public Inference API",
    "version": "2.0.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/chat/completions": {
      "post": {
        "operationId": "createChatCompletion",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatCompletionsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletion"
                }
              },
              "text/event-stream": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletionEventStream"
                }
              }
            },
            "description": "A completion or an SSE stream when stream=true",
            "headers": {
              "Access-Control-Expose-Headers": {
                "description": "Response headers a browser client may read",
                "schema": {
                  "$ref": "#/components/schemas/AccessControlExposeHeaders"
                }
              },
              "Server-Timing": {
                "description": "Pre-stream phase timings when supplied",
                "schema": {
                  "$ref": "#/components/schemas/ServerTiming"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        },
        "summary": "Create a chat completion"
      }
    },
    "/models": {
      "get": {
        "operationId": "listModels",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelList"
                }
              }
            },
            "description": "Available model aliases"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        },
        "summary": "List models available to the current key"
      }
    }
  },
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "servers": [
    {
      "description": "Wally production inference gateway",
      "url": "https://inference.runanywhere.ai/v1"
    }
  ],
  "x-runanywhere-contract": {
    "name": "wally-public",
    "source_schemas": {
      "error": {
        "path": "public/error.schema.json",
        "sha256": "039c2486e4656d05d7478918111cb2b9bbc21cdfc46953b4680629849c6d4d15"
      },
      "model_list": {
        "path": "public/model_list.schema.json",
        "sha256": "50763327264b84631c60b5431d55f945cdfece998c026a7e8b965cc3192d9a2c"
      },
      "request": {
        "path": "public/chat_completions_request.schema.json",
        "sha256": "78a4656b4263be08cd1869c05a5d36bead5ae4d85c59ca7e86c9da6653f8340a"
      },
      "response": {
        "path": "public/chat_completion.schema.json",
        "sha256": "8116d7c2ce83a03d6ade1b2f8a247206a77efc135cc91c00f0c1b6f39ecb6f18"
      },
      "sse_event": {
        "path": "public/sse_event.schema.json",
        "sha256": "7377b6f82670231e457ef42684eea15189e73a066475ee327a93e63ef9383022"
      }
    },
    "status": "candidate",
    "version": "2.0.0"
  }
}
