{
  "openapi": "3.1.0",
  "info": {
    "title": "Valar API",
    "version": "2026-08-14",
    "description": "Valar exposes Responses and Chat Completions endpoints that match the OpenAI shape. This reference documents the fields Valar supports today."
  },
  "servers": [
    {
      "url": "https://api.valarhq.ai/v1"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Models API",
      "description": "Discover which models you can call."
    },
    {
      "name": "Responses API",
      "description": "Responses endpoints that follow the OpenAI interface."
    },
    {
      "name": "Chat Completions API",
      "description": "Chat Completions endpoints that follow the OpenAI interface."
    },
    {
      "name": "Batches API",
      "description": "Submit request batches and track their progress."
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API Key"
      }
    },
    "schemas": {
      "ErrorObject": {
        "type": "object",
        "required": [
          "message",
          "type"
        ],
        "properties": {
          "message": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "param": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "code": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": true
      },
      "ErrorResponse": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "$ref": "#/components/schemas/ErrorObject"
          }
        },
        "additionalProperties": false
      },
      "RequestMetadata": {
        "type": "object",
        "description": "Optional string-valued metadata. Use completion_window to influence scheduling, and completion_webhook together with webhook_token to wire up a webhook that fires on completion.",
        "properties": {
          "completion_window": {
            "type": "string",
            "description": "The [completion window](/inference-modes#completion-windows), or latency tier, you want for this request. `asap` is the on-demand **Now** tier; `standard` is the lower-cost default; `flex` is the lowest-cost tier for background bulk work and **requires `background=true`**. Check the [Pricing](/pricing) page to see which windows each model supports. If you leave it out, Valar picks `standard` when the model supports it and falls back to `asap` otherwise; `flex` is never selected automatically. See [default behavior](/inference-modes#default-behavior).",
            "enum": [
              "asap",
              "standard",
              "flex"
            ]
          },
          "completion_webhook": {
            "type": "string",
            "format": "uri"
          },
          "webhook_token": {
            "type": "string"
          }
        },
        "additionalProperties": {
          "type": "string"
        }
      },
      "ModelObject": {
        "type": "object",
        "required": [
          "id",
          "object",
          "name",
          "context_length",
          "supports_chat",
          "supports_image_input",
          "supports_tools",
          "pricing"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "The value you send as `model` when you create a response."
          },
          "object": {
            "type": "string",
            "enum": [
              "model"
            ]
          },
          "name": {
            "type": "string",
            "description": "The model's display name, for when you show it to a person rather than send it as `model`."
          },
          "context_length": {
            "type": "integer",
            "description": "The model's context window, in tokens. Prompt plus generated output must fit inside it, whatever transport limits apply — a batch line under the 28 MiB cap can still exceed this."
          },
          "supports_chat": {
            "type": "boolean",
            "description": "Whether the model serves conversational requests."
          },
          "supports_image_input": {
            "type": "boolean",
            "description": "Whether the model accepts image input. Sending an image to a model without it fails with a `400`, rather than spending a call upstream to find out."
          },
          "supports_tools": {
            "type": "boolean",
            "description": "Whether the model supports tool calling."
          },
          "restricted": {
            "type": "boolean",
            "description": "Present and `true` when you can see this model because your organization was granted access to it. Absent for a model everyone can call."
          },
          "pricing": {
            "type": "array",
            "description": "What this model costs you: one entry per latency tier it is priced for, in US dollars per 1,000,000 tokens. The rates are resolved for your organization, so if you are on negotiated pricing these are yours — the same rates your usage is billed at. An empty list means no rate is published for the model.",
            "items": {
              "$ref": "#/components/schemas/ModelPrice"
            }
          },
          "long_context_pricing": {
            "$ref": "#/components/schemas/ModelLongContextPricing"
          }
        },
        "additionalProperties": false
      },
      "ModelLongContextPricing": {
        "type": "object",
        "description": "Present on a model whose rates are higher for a long prompt. A request with more than `above_input_tokens` input tokens — cached tokens included — is billed entirely at the multiplied rates, not only the tokens past the threshold. Absent when the model bills every prompt size at the rates in `pricing`.",
        "required": [
          "above_input_tokens",
          "input_multiplier",
          "output_multiplier",
          "effective_from"
        ],
        "properties": {
          "above_input_tokens": {
            "type": "integer",
            "description": "The threshold. A request with more input tokens than this is a long-context request; exactly this many is not."
          },
          "input_multiplier": {
            "type": "number",
            "description": "What the input and cached-input rates in `pricing` are multiplied by for a long-context request."
          },
          "output_multiplier": {
            "type": "number",
            "description": "What the output rate in `pricing` is multiplied by for a long-context request."
          },
          "effective_from": {
            "type": "string",
            "format": "date",
            "description": "The date (UTC) from which long-context requests are billed at the multiplied rates. Requests that completed earlier were billed at the rates in `pricing`."
          }
        },
        "additionalProperties": false
      },
      "ModelPrice": {
        "type": "object",
        "required": [
          "tier",
          "input_per_1m_tokens",
          "cached_input_per_1m_tokens",
          "output_per_1m_tokens"
        ],
        "properties": {
          "tier": {
            "type": "string",
            "description": "The tier these rates apply to — the `completion_window` you send when you create a response."
          },
          "input_per_1m_tokens": {
            "type": "number",
            "description": "US dollars per 1,000,000 input tokens that were not served from the prompt cache."
          },
          "cached_input_per_1m_tokens": {
            "type": "number",
            "description": "US dollars per 1,000,000 input tokens served from the prompt cache. 0 means the model publishes no cache discount, and cache hits bill at the input rate."
          },
          "output_per_1m_tokens": {
            "type": "number",
            "description": "US dollars per 1,000,000 output tokens, reasoning tokens included."
          }
        },
        "additionalProperties": false
      },
      "ModelListResponse": {
        "type": "object",
        "required": [
          "object",
          "data"
        ],
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ModelObject"
            }
          }
        },
        "additionalProperties": false
      },
      "ResponseInputTextPart": {
        "type": "object",
        "required": [
          "type",
          "text"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "input_text"
            ]
          },
          "text": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "ResponseInputImagePart": {
        "type": "object",
        "description": "An image content part. You can only send image input to multimodal models; check the Models page to see which ones qualify.",
        "required": [
          "type",
          "image_url"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "input_image"
            ]
          },
          "image_url": {
            "type": "string",
            "description": "Either a publicly reachable http(s) URL or a base64 data URI in the form data:<media-type>;base64,<data>."
          },
          "detail": {
            "type": "string",
            "enum": [
              "auto",
              "low",
              "high"
            ]
          }
        },
        "additionalProperties": false
      },
      "ResponseInputMessage": {
        "type": "object",
        "required": [
          "role",
          "content"
        ],
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "system",
              "user",
              "assistant",
              "tool",
              "function"
            ]
          },
          "content": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "minItems": 1,
                "items": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ResponseInputTextPart"
                    },
                    {
                      "$ref": "#/components/schemas/ResponseInputImagePart"
                    }
                  ]
                }
              }
            ]
          },
          "name": {
            "type": "string"
          },
          "tool_calls": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "tool_call_id": {
            "type": "string"
          },
          "function_call": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "additionalProperties": false
      },
      "ResponseInputObject": {
        "type": "object",
        "required": [
          "messages"
        ],
        "properties": {
          "messages": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/ResponseInputMessage"
            }
          }
        },
        "additionalProperties": false
      },
      "ResponseInput": {
        "description": "Accepts text, and image input (input_image) when you target a multimodal model. Valar does not yet accept audio, files, or item references.",
        "oneOf": [
          {
            "type": "string",
            "minLength": 1
          },
          {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/ResponseInputMessage"
            }
          },
          {
            "$ref": "#/components/schemas/ResponseInputObject"
          }
        ]
      },
      "ResponseTextFormat": {
        "type": "object",
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "text"
            ]
          }
        },
        "additionalProperties": false
      },
      "ResponseJsonSchemaFormat": {
        "type": "object",
        "required": [
          "type",
          "name"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "json_schema"
            ]
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "schema": {
            "type": "object",
            "additionalProperties": true
          },
          "strict": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "ResponseTextConfiguration": {
        "type": "object",
        "required": [
          "format"
        ],
        "properties": {
          "format": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ResponseTextFormat"
              },
              {
                "$ref": "#/components/schemas/ResponseJsonSchemaFormat"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "ResponseReasoningConfiguration": {
        "type": "object",
        "properties": {
          "effort": {
            "type": "string",
            "enum": [
              "none",
              "minimal",
              "low",
              "medium",
              "high",
              "xhigh"
            ]
          },
          "generate_summary": {
            "type": "string",
            "enum": [
              "auto",
              "concise",
              "detailed"
            ]
          }
        },
        "additionalProperties": true
      },
      "CreateResponseRequest": {
        "type": "object",
        "required": [
          "model",
          "input"
        ],
        "properties": {
          "model": {
            "type": "string"
          },
          "input": {
            "$ref": "#/components/schemas/ResponseInput"
          },
          "max_output_tokens": {
            "oneOf": [
              {
                "type": "integer",
                "minimum": 1
              },
              {
                "type": "null"
              }
            ]
          },
          "temperature": {
            "oneOf": [
              {
                "type": "number",
                "minimum": 0,
                "maximum": 2
              },
              {
                "type": "null"
              }
            ]
          },
          "top_p": {
            "oneOf": [
              {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              {
                "type": "null"
              }
            ]
          },
          "text": {
            "$ref": "#/components/schemas/ResponseTextConfiguration"
          },
          "reasoning": {
            "$ref": "#/components/schemas/ResponseReasoningConfiguration"
          },
          "background": {
            "type": "boolean"
          },
          "prompt_cache_key": {
            "type": "string",
            "description": "An optional hint Valar uses to keep prompt-prefix caches local. Requests sharing a key are steered toward the same place so you hit the cache more often."
          },
          "store": {
            "type": "boolean",
            "default": true,
            "description": "How reasoning is returned to you. `true` (the default) is the stateful contract: your SDK will reference earlier reasoning by id, which Valar cannot resolve, so thinking does not survive a turn. Set `false` for an agent loop - reasoning then comes back with `encrypted_content`, the form SDKs replay, and Valar carries it to the model on your next request. This field does not control retention: Valar stores the response either way so GET /responses/{id} works."
          },
          "truncation": {
            "type": "string",
            "enum": [
              "disabled"
            ]
          },
          "stream": {
            "type": "boolean",
            "enum": [
              false
            ],
            "description": "Streaming is not available on this endpoint yet."
          },
          "user": {
            "type": "string",
            "maxLength": 256
          },
          "metadata": {
            "$ref": "#/components/schemas/RequestMetadata"
          }
        },
        "additionalProperties": true
      },
      "ResponseUsageDetails": {
        "type": "object",
        "required": [
          "cached_tokens",
          "reasoning_tokens"
        ],
        "properties": {
          "cached_tokens": {
            "type": "integer"
          },
          "reasoning_tokens": {
            "type": "integer"
          }
        },
        "additionalProperties": false
      },
      "ResponseUsage": {
        "type": "object",
        "required": [
          "input_tokens",
          "input_tokens_details",
          "output_tokens",
          "output_tokens_details",
          "total_tokens"
        ],
        "properties": {
          "input_tokens": {
            "type": "integer"
          },
          "input_tokens_details": {
            "$ref": "#/components/schemas/ResponseUsageDetails"
          },
          "output_tokens": {
            "type": "integer"
          },
          "output_tokens_details": {
            "$ref": "#/components/schemas/ResponseUsageDetails"
          },
          "total_tokens": {
            "type": "integer"
          },
          "prompt_tokens": {
            "type": "integer"
          },
          "completion_tokens": {
            "type": "integer"
          }
        },
        "additionalProperties": false
      },
      "ResponseObject": {
        "type": "object",
        "required": [
          "id",
          "object",
          "created_at",
          "status",
          "model",
          "metadata",
          "usage"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "enum": [
              "response"
            ]
          },
          "created_at": {
            "type": "integer"
          },
          "status": {
            "type": "string",
            "enum": [
              "in_progress",
              "completed",
              "incomplete",
              "failed",
              "cancelled"
            ]
          },
          "model": {
            "type": "string"
          },
          "input": {
            "$ref": "#/components/schemas/ResponseInput"
          },
          "output": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                }
              },
              {
                "type": "object",
                "additionalProperties": true
              },
              {
                "type": "null"
              }
            ]
          },
          "error": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": true
              },
              {
                "type": "null"
              }
            ]
          },
          "incomplete_details": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": true
              },
              {
                "type": "null"
              }
            ]
          },
          "max_output_tokens": {
            "oneOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "reasoning": {
            "type": "object",
            "additionalProperties": true
          },
          "text": {
            "$ref": "#/components/schemas/ResponseTextConfiguration"
          },
          "store": {
            "type": "boolean"
          },
          "temperature": {
            "type": "number"
          },
          "top_p": {
            "type": "number"
          },
          "parallel_tool_calls": {
            "type": "boolean"
          },
          "tool_choice": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "additionalProperties": true
              }
            ]
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "truncation": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "additionalProperties": true
              }
            ]
          },
          "usage": {
            "$ref": "#/components/schemas/ResponseUsage"
          },
          "user": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "ChatTextContentPart": {
        "type": "object",
        "required": [
          "type",
          "text"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "text"
            ]
          },
          "text": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "ChatImageContentPart": {
        "type": "object",
        "description": "An image content part. You can only send image input to multimodal models; check the Models page to see which ones qualify.",
        "required": [
          "type",
          "image_url"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "image_url"
            ]
          },
          "image_url": {
            "type": "object",
            "required": [
              "url"
            ],
            "properties": {
              "url": {
                "type": "string",
                "description": "Either a publicly reachable http(s) URL or a base64 data URI."
              },
              "detail": {
                "type": "string",
                "enum": [
                  "auto",
                  "low",
                  "high"
                ]
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      },
      "ChatCompletionMessage": {
        "type": "object",
        "required": [
          "role"
        ],
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "system",
              "user",
              "assistant",
              "tool",
              "function",
              "developer"
            ]
          },
          "content": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              },
              {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ChatTextContentPart"
                    },
                    {
                      "$ref": "#/components/schemas/ChatImageContentPart"
                    }
                  ]
                }
              }
            ]
          },
          "name": {
            "type": "string"
          },
          "tool_calls": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "tool_call_id": {
            "type": "string"
          },
          "function_call": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "additionalProperties": false
      },
      "ChatResponseFormatText": {
        "type": "object",
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "text"
            ]
          }
        },
        "additionalProperties": false
      },
      "ChatResponseFormatJsonSchema": {
        "type": "object",
        "required": [
          "type",
          "json_schema"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "json_schema"
            ]
          },
          "json_schema": {
            "type": "object",
            "required": [
              "name"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "schema": {
                "type": "object",
                "additionalProperties": true
              },
              "strict": {
                "type": "boolean"
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      },
      "CreateChatCompletionRequest": {
        "type": "object",
        "required": [
          "model",
          "messages"
        ],
        "properties": {
          "model": {
            "type": "string"
          },
          "messages": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/ChatCompletionMessage"
            }
          },
          "temperature": {
            "oneOf": [
              {
                "type": "number",
                "minimum": 0,
                "maximum": 2
              },
              {
                "type": "null"
              }
            ]
          },
          "top_p": {
            "oneOf": [
              {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              {
                "type": "null"
              }
            ]
          },
          "max_completion_tokens": {
            "oneOf": [
              {
                "type": "integer",
                "minimum": 1
              },
              {
                "type": "null"
              }
            ]
          },
          "response_format": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ChatResponseFormatText"
              },
              {
                "$ref": "#/components/schemas/ChatResponseFormatJsonSchema"
              }
            ]
          },
          "reasoning_effort": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "none",
                  "minimal",
                  "low",
                  "medium",
                  "high",
                  "xhigh"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "n": {
            "type": "integer",
            "enum": [
              1
            ],
            "description": "Must be 1; requesting multiple choices is not supported yet."
          },
          "modalities": {
            "type": "array",
            "minItems": 1,
            "maxItems": 1,
            "items": {
              "type": "string",
              "enum": [
                "text"
              ]
            }
          },
          "stream": {
            "type": "boolean",
            "description": "Set this to true to receive the answer as a Server-Sent Events stream of chat.completion.chunk objects rather than one JSON payload."
          },
          "stream_options": {
            "type": "object",
            "description": "Settings that only take effect while streaming (stream is true).",
            "properties": {
              "include_usage": {
                "type": "boolean",
                "description": "Set this to true to receive one final chunk carrying token usage for the whole request, sent just ahead of the [DONE] terminator."
              }
            },
            "additionalProperties": false
          },
          "store": {
            "type": "boolean",
            "default": true,
            "description": "Accepted for compatibility and ignored. Chat Completions carries a model's thinking as ordinary content you resend, so there is nothing for this field to select. It does not control retention either: Valar stores the response either way."
          },
          "user": {
            "type": "string",
            "maxLength": 256
          },
          "metadata": {
            "$ref": "#/components/schemas/RequestMetadata"
          }
        },
        "additionalProperties": true
      },
      "ChatCompletionResponseMessage": {
        "type": "object",
        "required": [
          "role",
          "content"
        ],
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "assistant"
            ]
          },
          "content": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "reasoning_content": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "refusal": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": true
      },
      "ChatCompletionChoice": {
        "type": "object",
        "required": [
          "index",
          "message",
          "logprobs",
          "finish_reason"
        ],
        "properties": {
          "index": {
            "type": "integer"
          },
          "message": {
            "$ref": "#/components/schemas/ChatCompletionResponseMessage"
          },
          "logprobs": {
            "type": "null"
          },
          "finish_reason": {
            "type": "string",
            "enum": [
              "stop",
              "length",
              "tool_calls",
              "content_filter",
              "function_call"
            ]
          }
        },
        "additionalProperties": false
      },
      "ChatCompletionUsage": {
        "type": "object",
        "required": [
          "prompt_tokens",
          "completion_tokens",
          "total_tokens"
        ],
        "properties": {
          "prompt_tokens": {
            "type": "integer"
          },
          "completion_tokens": {
            "type": "integer"
          },
          "total_tokens": {
            "type": "integer"
          },
          "prompt_tokens_details": {
            "type": "object",
            "additionalProperties": true
          },
          "completion_tokens_details": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "additionalProperties": false
      },
      "ChatCompletionResponse": {
        "type": "object",
        "required": [
          "id",
          "object",
          "created",
          "model",
          "choices"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "enum": [
              "chat.completion"
            ]
          },
          "created": {
            "type": "integer"
          },
          "model": {
            "type": "string"
          },
          "choices": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/ChatCompletionChoice"
            }
          },
          "usage": {
            "$ref": "#/components/schemas/ChatCompletionUsage"
          }
        },
        "additionalProperties": true
      },
      "ChatCompletionChunkToolCallFunction": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "arguments": {
            "type": "string"
          },
          "input": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "ChatCompletionChunkToolCall": {
        "type": "object",
        "properties": {
          "index": {
            "type": "integer"
          },
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "function": {
            "$ref": "#/components/schemas/ChatCompletionChunkToolCallFunction"
          },
          "custom": {
            "$ref": "#/components/schemas/ChatCompletionChunkToolCallFunction"
          }
        },
        "additionalProperties": false
      },
      "ChatCompletionChunkDelta": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string"
          },
          "content": {
            "type": "string"
          },
          "reasoning_content": {
            "type": "string"
          },
          "refusal": {
            "type": "string"
          },
          "tool_calls": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChatCompletionChunkToolCall"
            }
          }
        },
        "additionalProperties": false
      },
      "ChatCompletionChunkChoice": {
        "type": "object",
        "required": [
          "index",
          "delta"
        ],
        "properties": {
          "index": {
            "type": "integer"
          },
          "delta": {
            "$ref": "#/components/schemas/ChatCompletionChunkDelta"
          },
          "logprobs": {
            "type": "null"
          },
          "finish_reason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "stop",
              "tool_calls",
              null
            ]
          }
        },
        "additionalProperties": false
      },
      "ChatCompletionChunk": {
        "type": "object",
        "description": "A single Server-Sent Events chunk produced while stream is true. The full streamed reply arrives as a series of these chat.completion.chunk objects, each delivered on its own SSE data: line, with a closing data: [DONE] line at the end.",
        "required": [
          "id",
          "object",
          "created",
          "model",
          "choices"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "enum": [
              "chat.completion.chunk"
            ]
          },
          "created": {
            "type": "integer"
          },
          "model": {
            "type": "string"
          },
          "choices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChatCompletionChunkChoice"
            }
          },
          "usage": {
            "$ref": "#/components/schemas/ChatCompletionUsage"
          }
        },
        "additionalProperties": false
      },
      "BatchObject": {
        "type": "object",
        "required": [
          "id",
          "object",
          "endpoint",
          "input_file_id",
          "completion_window",
          "status",
          "request_counts",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "The batch's unique ID."
          },
          "object": {
            "type": "string",
            "enum": [
              "batch"
            ]
          },
          "endpoint": {
            "type": "string",
            "enum": [
              "/v1/chat/completions",
              "/v1/responses"
            ],
            "description": "The API endpoint every request in the batch targets."
          },
          "input_file_id": {
            "type": "string",
            "description": "The uploaded JSONL file the batch was created from."
          },
          "completion_window": {
            "type": "string",
            "description": "The completion window the batch was submitted with. `24h` is the OpenAI-compatible value; Valar processes batches against its own promised SLAs."
          },
          "status": {
            "type": "string",
            "enum": [
            "validating",
            "in_progress",
            "finalizing",
            "completed",
            "failed",
            "expired"
          ],
            "description": "Where the batch currently stands. A new batch starts in `validating`, moves to `in_progress` while its requests run, and settles in a terminal state."
          },
          "output_file_id": {
            "type": "string",
            "description": "Once the batch completes, the file holding one JSONL result line per request. Download it with [Get file content](/api-reference/files-api/get-file-content)."
          },
          "error_file_id": {
            "type": "string",
            "description": "When any line failed, the file holding one JSONL error line per failed request - validation rejections included. Absent when every request succeeded."
          },
          "request_counts": {
            "type": "object",
            "required": [
              "total",
              "completed",
              "failed"
            ],
            "properties": {
              "total": {
                "type": "integer",
                "description": "How many requests the batch contains."
              },
              "completed": {
                "type": "integer",
                "description": "How many requests have finished successfully."
              },
              "failed": {
                "type": "integer",
                "description": "How many requests failed, including input lines rejected before they could run."
              }
            }
          },
          "created_at": {
            "type": "integer",
            "description": "When the batch was created, as a Unix timestamp."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "The metadata you attached at create time, if any."
          }
        }
      },
      "FileObject": {
        "type": "object",
        "required": [
          "id",
          "object",
          "bytes",
          "created_at",
          "filename",
          "purpose"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "The file's unique ID."
          },
          "object": {
            "type": "string",
            "enum": [
              "file"
            ]
          },
          "bytes": {
            "type": "integer",
            "description": "The file's size in bytes."
          },
          "created_at": {
            "type": "integer",
            "description": "When the file was uploaded, as a Unix timestamp."
          },
          "filename": {
            "type": "string",
            "description": "The name the file was uploaded with."
          },
          "purpose": {
            "type": "string",
            "description": "What the file is for. Use `batch` for Batch API input files."
          },
          "status": {
            "type": "string",
            "description": "The file's processing status."
          },
          "status_details": {
            "type": "string",
            "nullable": true
          }
        }
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string",
          "maxLength": 255
        },
        "description": "Lets you retry safely. Valar records a reservation under the combination of organization, API key, and Idempotency-Key, so sending the same value again hands back the stored response rather than running inference a second time. Values can be up to 255 characters. See [Idempotent Requests](/idempotency) for the complete rules."
      },
      "AnthropicIdempotencyKey": {
        "name": "anthropic-idempotency-key",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string",
          "maxLength": 255
        },
        "description": "The Anthropic-style idempotency header. It behaves exactly like Idempotency-Key and exists on the /messages endpoint so you can keep to Anthropic's naming."
      }
    }
  },
  "paths": {
    "/models": {
      "get": {
        "operationId": "listModels",
        "tags": [
          "Models API"
        ],
        "summary": "List the models you can call",
        "responses": {
          "200": {
            "description": "The models available to you.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelListResponse"
                }
              }
            }
          },
          "401": {
            "description": "We could not authenticate the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/responses": {
      "post": {
        "operationId": "createResponse",
        "tags": [
          "Responses API"
        ],
        "summary": "Create a response",
        "description": "Starts a Responses API task in the OpenAI style. You get back 202 when you pass background=true; otherwise the call returns 200 once the work finishes.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateResponseRequest"
              },
              "examples": {
                "basic": {
                  "value": {
                    "model": "zai-org/GLM-5.2",
                    "input": "Explain the key ideas behind transformer architectures."
                  }
                },
                "background": {
                  "value": {
                    "model": "zai-org/GLM-5.2",
                    "input": "Summarize this document.",
                    "background": true,
                    "metadata": {
                      "completion_window": "standard"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The response finished and is returned to you right away.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseObject"
                }
              }
            }
          },
          "202": {
            "description": "The response was queued and will be processed in the background.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseObject"
                }
              }
            }
          },
          "400": {
            "description": "Your request was malformed or asked for something Valar does not support.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "We could not authenticate the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on Valar's side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "An upstream service returned an error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "504": {
            "description": "The request timed out before the result was ready.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/responses/{response_id}": {
      "get": {
        "operationId": "getResponse",
        "tags": [
          "Responses API"
        ],
        "summary": "Fetch a response",
        "parameters": [
          {
            "name": "response_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The requested response object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseObject"
                }
              }
            }
          },
          "401": {
            "description": "We could not authenticate the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "No response exists for that ID.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on Valar's side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/chat/completions": {
      "post": {
        "operationId": "createChatCompletion",
        "tags": [
          "Chat Completions API"
        ],
        "summary": "Create a chat completion",
        "description": "A Chat Completions endpoint that follows the OpenAI interface. Pass stream: true to stream the reply back as Server-Sent Events made up of chat.completion.chunk objects.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateChatCompletionRequest"
              },
              "example": {
                "model": "zai-org/GLM-5.2",
                "messages": [
                  {
                    "role": "system",
                    "content": "You are a concise assistant."
                  },
                  {
                    "role": "user",
                    "content": "Summarize retrieval-augmented generation in 3 bullets."
                  }
                ],
                "max_completion_tokens": 300
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The chat completion. By default this is one JSON object; with stream: true it becomes a Server-Sent Events stream of chat.completion.chunk objects closed by a final data: [DONE] line.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletionResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletionChunk"
                }
              }
            }
          },
          "400": {
            "description": "Your request was malformed or asked for something Valar does not support.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "We could not authenticate the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "408": {
            "description": "The request timed out before the result was ready.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on Valar's side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/batches": {
      "post": {
        "operationId": "createBatch",
        "tags": [
          "Batches API"
        ],
        "summary": "Create a batch",
        "description": "Start processing a previously uploaded JSONL file of requests. Upload the file first with [Upload a file](/api-reference/files-api/upload-a-file) using `purpose: batch`. Each line of the file is one request:\n\n```json\n{\"custom_id\": \"req-1\", \"method\": \"POST\", \"url\": \"/v1/chat/completions\", \"body\": {\"model\": \"zai-org/GLM-5.2\", \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}]}}\n```\n\nA batch holds up to 10,000 requests, and each line can be up to 28 MiB — enough for a maximum-size 20 MB image, which takes about 26.7 MiB once base64-encoded. The line size is a transport limit; each request must also fit the context window of the model it names, which is a separate and often much tighter bound — read `context_length` from [List supported models](/api-reference/models-api/list-supported-models) and size your requests against it. A request over the window is accepted with the file and fails when it runs. A file with more than 10,000 requests fails the whole batch after creation (`status: failed`). A line that fails validation is rejected on its own and counted in `request_counts.failed`; the rest of the batch keeps running.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "input_file_id",
                  "endpoint",
                  "completion_window"
                ],
                "properties": {
                  "input_file_id": {
                    "type": "string",
                    "description": "The ID of an uploaded `purpose: batch` JSONL file holding the requests."
                  },
                  "endpoint": {
                    "type": "string",
                    "enum": [
                      "/v1/chat/completions",
                      "/v1/responses"
                    ],
                    "description": "The API endpoint every request in the batch targets. Must match the `url` on each line."
                  },
                  "completion_window": {
                    "type": "string",
                    "enum": [
                      "24h"
                    ],
                    "description": "Pass `24h`, the OpenAI-compatible value. Valar schedules the batch against its own promised SLAs."
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string"
                    },
                    "description": "Optional key-value metadata stored on the batch, echoed back on every read."
                  }
                },
                "additionalProperties": false
              },
              "example": {
                "input_file_id": "file-abc123",
                "endpoint": "/v1/chat/completions",
                "completion_window": "24h",
                "metadata": {
                  "label": "my-batch-job"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The batch was created and is validating.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchObject"
                },
                "example": {
                  "id": "batch_abc123",
                  "object": "batch",
                  "endpoint": "/v1/chat/completions",
                  "input_file_id": "file-abc123",
                  "completion_window": "24h",
                  "status": "validating",
                  "request_counts": {
                    "total": 0,
                    "completed": 0,
                    "failed": 0
                  },
                  "created_at": 1741564800,
                  "metadata": {
                    "label": "my-batch-job"
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "We could not authenticate the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "The input file was not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on Valar's side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listBatches",
        "tags": [
          "Batches API"
        ],
        "summary": "List batches",
        "description": "Retrieve your batches, paging through them when you need to.",
        "parameters": [
          {
            "name": "after_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Only return batches created after this batch ID."
          },
          {
            "name": "before_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Only return batches created before this batch ID."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 25,
              "minimum": 1,
              "maximum": 200
            },
            "description": "How many batches to return at most. Ranges from 1 to 200 and defaults to 25."
          }
        ],
        "responses": {
          "200": {
            "description": "Your batches, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "object",
                    "data"
                  ],
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/BatchObject"
                      }
                    },
                    "has_more": {
                      "type": "boolean",
                      "description": "Whether more batches exist beyond this page."
                    }
                  }
                },
                "example": {
                  "object": "list",
                  "data": [
                    {
                      "id": "batch_abc123",
                      "object": "batch",
                      "endpoint": "/v1/chat/completions",
                      "input_file_id": "file-abc123",
                      "completion_window": "24h",
                      "status": "in_progress",
                      "request_counts": {
                        "total": 100,
                        "completed": 42,
                        "failed": 1
                      },
                      "created_at": 1741564800,
                      "metadata": {
                        "label": "my-batch-job"
                      }
                    }
                  ],
                  "has_more": false
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "We could not authenticate the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on Valar's side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/batches/{batch_id}": {
      "get": {
        "operationId": "getBatch",
        "tags": [
          "Batches API"
        ],
        "summary": "Check batch status",
        "description": "See where a batch currently stands. Poll this until `status` is terminal (`completed`, `failed`, or `expired`), then download `output_file_id`. Progress can arrive in large steps - a batch can move from quiet to completed at once, often well before its window ends.",
        "parameters": [
          {
            "name": "batch_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The batch's current status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchObject"
                },
                "example": {
                  "id": "batch_abc123",
                  "object": "batch",
                  "endpoint": "/v1/chat/completions",
                  "input_file_id": "file-abc123",
                  "completion_window": "24h",
                  "status": "in_progress",
                  "request_counts": {
                    "total": 100,
                    "completed": 42,
                    "failed": 1
                  },
                  "created_at": 1741564800,
                  "metadata": {
                    "label": "my-batch-job"
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "We could not authenticate the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "No batch exists for that ID.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on Valar's side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/batches/{batch_id}/{custom_id}": {
      "get": {
        "operationId": "getBatchRequestResult",
        "tags": [
          "Batches API"
        ],
        "summary": "Get a single batch request result",
        "description": "Retrieve one request's result by its `custom_id` without waiting for the whole batch — a Valar extension to the OpenAI Batch API. Returns the request's Response object; while the batch is running the response reports `in_progress`. A line that was rejected at validation never became a request, so it returns 404.",
        "parameters": [
          {
            "name": "batch_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The batch's ID."
          },
          {
            "name": "custom_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The custom_id identifying the request inside the batch."
          }
        ],
        "responses": {
          "200": {
            "description": "The response object for that request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseObject"
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "We could not authenticate the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "No matching batch or request was found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on Valar's side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/files": {
      "post": {
        "operationId": "uploadFile",
        "tags": [
          "Files API"
        ],
        "summary": "Upload a file",
        "description": "Upload a file as `multipart/form-data`. For the Batch API, upload your JSONL request file with `purpose: batch`, then pass the returned file ID to [Create a batch](/api-reference/batches-api/create-a-batch). Batch input files can be up to 500 MB.",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file",
                  "purpose"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "The file to upload."
                  },
                  "purpose": {
                    "type": "string",
                    "description": "What the file is for. Use `batch` for Batch API input files."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The uploaded file.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileObject"
                },
                "example": {
                  "id": "file-abc123",
                  "object": "file",
                  "bytes": 34333913,
                  "created_at": 1741564800,
                  "filename": "requests.jsonl",
                  "purpose": "batch",
                  "status": "uploaded",
                  "status_details": null
                }
              }
            }
          },
          "400": {
            "description": "The request was malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "We could not authenticate the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on Valar's side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listFiles",
        "tags": [
          "Files API"
        ],
        "summary": "List files",
        "description": "Retrieve your uploaded files, newest first.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "How many files to return at most."
          }
        ],
        "responses": {
          "200": {
            "description": "Your files.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "object",
                    "data"
                  ],
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/FileObject"
                      }
                    }
                  }
                },
                "example": {
                  "object": "list",
                  "data": [
                    {
                      "id": "file-abc123",
                      "object": "file",
                      "bytes": 34333913,
                      "created_at": 1741564800,
                      "filename": "requests.jsonl",
                      "purpose": "batch",
                      "status": "uploaded",
                      "status_details": null
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "We could not authenticate the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on Valar's side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/files/{file_id}": {
      "get": {
        "operationId": "getFile",
        "tags": [
          "Files API"
        ],
        "summary": "Get file metadata",
        "parameters": [
          {
            "name": "file_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file's metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileObject"
                },
                "example": {
                  "id": "file-abc123",
                  "object": "file",
                  "bytes": 34333913,
                  "created_at": 1741564800,
                  "filename": "requests.jsonl",
                  "purpose": "batch",
                  "status": "uploaded",
                  "status_details": null
                }
              }
            }
          },
          "401": {
            "description": "We could not authenticate the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "The file was not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on Valar's side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteFile",
        "tags": [
          "Files API"
        ],
        "summary": "Delete a file",
        "parameters": [
          {
            "name": "file_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file was deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "object": {
                      "type": "string"
                    },
                    "deleted": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "We could not authenticate the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "The file was not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on Valar's side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/files/{file_id}/content": {
      "get": {
        "operationId": "getFileContent",
        "tags": [
          "Files API"
        ],
        "summary": "Get file content",
        "description": "Download a file's raw bytes. For a completed batch, download `output_file_id` to get one JSONL result line per request.",
        "parameters": [
          {
            "name": "file_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file's contents.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "We could not authenticate the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "The file was not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Something went wrong on Valar's side.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  }
}