{
  "openapi": "3.1.0",
  "info": {
    "title": "1xAi API",
    "summary": "One key for the models of ten vendors: OpenAI-compatible routes, native Anthropic and Gemini routes, realtime voice and a read-only account API.",
    "description": "The public API of 1xAi (https://1xai.ir). Authenticate with a `1xai-`-prefixed key from the dashboard, in `Authorization: Bearer`, `x-api-key` or `x-goog-api-key`. A request body reaches the model's vendor untranslated. Billing is in Toman from a prepaid wallet: the vendor's own list price plus a published markup; a failed request is not billed. Each key may send 1000 requests a minute by default (burst 1000); every response carries `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`, and `X-Request-Id` (1xAi's id of the call); a non-streamed, successful answer of a billed route carries `X-1xai-Cost-Toman`, the amount billed in Toman. Documentation, one page per topic: https://1xai.ir/en/docs (English), https://1xai.ir/docs (Persian). Endpoints that are not supported are listed at https://1xai.ir/en/docs/unsupported. 1xAi is an independent gateway and is not affiliated with the model vendors.",
    "version": "2026-11-20",
    "termsOfService": "https://1xai.ir/en/terms",
    "contact": {
      "name": "1xAi",
      "url": "https://1xai.ir/en/contact"
    }
  },
  "servers": [
    {
      "url": "https://1xai.ir",
      "description": "Production. OpenAI SDKs use https://1xai.ir/v1 as their base URL, Anthropic SDKs https://1xai.ir/anthropic, Google GenAI SDKs https://1xai.ir/gemini."
    }
  ],
  "externalDocs": {
    "description": "Documentation",
    "url": "https://1xai.ir/en/docs"
  },
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Chat",
      "description": "Chat and text completion, for the models of every vendor.",
      "externalDocs": {
        "url": "https://1xai.ir/en/docs/openai-compatible"
      }
    },
    {
      "name": "Responses",
      "description": "OpenAI's Responses API, with billed web search."
    },
    {
      "name": "Embeddings",
      "description": "Text embeddings."
    },
    {
      "name": "Images",
      "description": "Image generation and editing."
    },
    {
      "name": "Audio",
      "description": "Speech and transcription."
    },
    {
      "name": "Video",
      "description": "Video generation."
    },
    {
      "name": "Batch",
      "description": "OpenAI's Batch API and its files (`purpose=batch`): chat completions and embeddings within 24 hours at 50% of the list price.",
      "externalDocs": {
        "url": "https://1xai.ir/en/docs/openai-batch"
      }
    },
    {
      "name": "Models",
      "description": "The model list.",
      "externalDocs": {
        "url": "https://1xai.ir/en/docs/models"
      }
    },
    {
      "name": "Anthropic",
      "description": "Anthropic's own Messages API and Message Batches.",
      "externalDocs": {
        "url": "https://1xai.ir/en/docs/anthropic"
      }
    },
    {
      "name": "Gemini",
      "description": "Google's own Generative Language API.",
      "externalDocs": {
        "url": "https://1xai.ir/en/docs/gemini"
      }
    },
    {
      "name": "Realtime",
      "description": "Realtime voice over WebSocket.",
      "externalDocs": {
        "url": "https://1xai.ir/en/docs/realtime"
      }
    },
    {
      "name": "Account",
      "description": "Read-only usage, wallet, key and service-credit endpoints, with the same key.",
      "externalDocs": {
        "url": "https://1xai.ir/en/docs/account-api"
      }
    }
  ],
  "paths": {
    "/v1/chat/completions": {
      "post": {
        "operationId": "createChatCompletion",
        "tags": [
          "Chat"
        ],
        "summary": "Chat completion, for the models of every vendor",
        "description": "OpenAI's chat completions. The body reaches the vendor untranslated; the gateway's few changes are listed at https://1xai.ir/en/docs/openai-compatible#what-the-gateway-changes. Billed by tokens.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatCompletionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The vendor's response. `X-1xai-Cost-Toman` when not streamed.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              },
              "X-1xai-Model-Alias": {
                "$ref": "#/components/headers/X-1xai-Model-Alias"
              },
              "X-1xai-Cost-Toman": {
                "$ref": "#/components/headers/X-1xai-Cost-Toman"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletionResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-Sent Events, as the vendor sends them."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/UpstreamTimeout"
          }
        }
      }
    },
    "/v1/responses": {
      "post": {
        "operationId": "createResponse",
        "tags": [
          "Responses"
        ],
        "summary": "Responses API (OpenAI models only)",
        "description": "Billed by tokens, and per web search when the `web_search` tool is used. Responses are not stored, so `/v1/responses/{id}` is not available.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResponsesRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The vendor's response. `X-1xai-Cost-Toman` when not streamed.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              },
              "X-1xai-Model-Alias": {
                "$ref": "#/components/headers/X-1xai-Model-Alias"
              },
              "X-1xai-Cost-Toman": {
                "$ref": "#/components/headers/X-1xai-Cost-Toman"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-Sent Events, as the vendor sends them."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/UpstreamTimeout"
          }
        }
      }
    },
    "/v1/embeddings": {
      "post": {
        "operationId": "createEmbedding",
        "tags": [
          "Embeddings"
        ],
        "summary": "Text embeddings",
        "description": "Billed by input tokens.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmbeddingRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The vendor's response.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              },
              "X-1xai-Cost-Toman": {
                "$ref": "#/components/headers/X-1xai-Cost-Toman"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/UpstreamTimeout"
          }
        }
      }
    },
    "/v1/completions": {
      "post": {
        "operationId": "createCompletion",
        "tags": [
          "Chat"
        ],
        "summary": "Legacy text completion",
        "description": "For the models that still accept it. Billed by tokens.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompletionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The vendor's response. `X-1xai-Cost-Toman` when not streamed.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              },
              "X-1xai-Cost-Toman": {
                "$ref": "#/components/headers/X-1xai-Cost-Toman"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-Sent Events, as the vendor sends them."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/UpstreamTimeout"
          }
        }
      }
    },
    "/v1/moderations": {
      "post": {
        "operationId": "createModeration",
        "tags": [
          "Chat"
        ],
        "summary": "Moderation",
        "description": "Free.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ModerationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The vendor's response.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/UpstreamTimeout"
          }
        }
      }
    },
    "/v1/images/generations": {
      "post": {
        "operationId": "createImage",
        "tags": [
          "Images"
        ],
        "summary": "Generate an image",
        "description": "Billed per image or by tokens, depending on the model. Google image models are served on the native Gemini route instead.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImageGenerationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The vendor's response.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              },
              "X-1xai-Cost-Toman": {
                "$ref": "#/components/headers/X-1xai-Cost-Toman"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/UpstreamTimeout"
          }
        }
      }
    },
    "/v1/images/edits": {
      "post": {
        "operationId": "createImageEdit",
        "tags": [
          "Images"
        ],
        "summary": "Edit an image",
        "description": "A multipart form.",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ImageEditRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The vendor's response.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              },
              "X-1xai-Cost-Toman": {
                "$ref": "#/components/headers/X-1xai-Cost-Toman"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/UpstreamTimeout"
          }
        }
      }
    },
    "/v1/images/variations": {
      "post": {
        "operationId": "createImageVariation",
        "tags": [
          "Images"
        ],
        "summary": "Make a variation of an image",
        "description": "A multipart form.",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string"
                  },
                  "image": {
                    "type": "string",
                    "format": "binary"
                  }
                },
                "required": [
                  "model",
                  "image"
                ],
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The vendor's response.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              },
              "X-1xai-Cost-Toman": {
                "$ref": "#/components/headers/X-1xai-Cost-Toman"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/UpstreamTimeout"
          }
        }
      }
    },
    "/v1/audio/speech": {
      "post": {
        "operationId": "createSpeech",
        "tags": [
          "Audio"
        ],
        "summary": "Text to speech",
        "description": "Billed by input characters. The request body may be up to 1 MiB.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SpeechRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The audio.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              },
              "X-1xai-Cost-Toman": {
                "$ref": "#/components/headers/X-1xai-Cost-Toman"
              }
            },
            "content": {
              "audio/mpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/UpstreamTimeout"
          }
        }
      }
    },
    "/v1/audio/transcriptions": {
      "post": {
        "operationId": "createTranscription",
        "tags": [
          "Audio"
        ],
        "summary": "Speech to text",
        "description": "A multipart form. Billed by the length of the audio, or by tokens for the Gemini model.",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/TranscriptionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The transcript.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              },
              "X-1xai-Cost-Toman": {
                "$ref": "#/components/headers/X-1xai-Cost-Toman"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/UpstreamTimeout"
          }
        }
      }
    },
    "/v1/audio/translations": {
      "post": {
        "operationId": "createTranslation",
        "tags": [
          "Audio"
        ],
        "summary": "Speech to English text",
        "description": "A multipart form. Billed by the length of the audio.",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/TranscriptionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The translation.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              },
              "X-1xai-Cost-Toman": {
                "$ref": "#/components/headers/X-1xai-Cost-Toman"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/UpstreamTimeout"
          }
        }
      }
    },
    "/v1/videos": {
      "post": {
        "operationId": "createVideo",
        "tags": [
          "Video"
        ],
        "summary": "Start a video generation (OpenAI's video API shape)",
        "description": "Billed by seconds of video. A retired model answers 410 `model_retired`. Video is served today by Gemini Omni on `/gemini/v1beta/interactions`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VideoRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The video job.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/UpstreamTimeout"
          }
        }
      }
    },
    "/v1/videos/{id}": {
      "get": {
        "operationId": "getVideo",
        "tags": [
          "Video"
        ],
        "summary": "Poll a video job",
        "description": "Free.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The video job.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/videos/{id}/content": {
      "get": {
        "operationId": "getVideoContent",
        "tags": [
          "Video"
        ],
        "summary": "Download a finished video",
        "description": "Free.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The video file.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "video/mp4": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/files": {
      "post": {
        "operationId": "createFile",
        "tags": [
          "Batch"
        ],
        "summary": "Upload a batch input file",
        "description": "A multipart form with `purpose=batch` and `file` (JSONL). Each line is checked while it uploads, before it reaches OpenAI; the first bad line refuses the whole file. At most 25 MB, 50000 requests and 8 MB a line. Free. https://1xai.ir/en/docs/openai-batch",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/OpenAIFileUpload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OpenAI's file object.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIFile"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BatchBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/BatchPaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "429": {
            "$ref": "#/components/responses/BatchLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/UpstreamTimeout"
          },
          "404": {
            "$ref": "#/components/responses/BatchNotFound"
          },
          "413": {
            "$ref": "#/components/responses/BatchFileTooLarge"
          }
        }
      },
      "get": {
        "operationId": "listFiles",
        "tags": [
          "Batch"
        ],
        "summary": "Your batch files",
        "description": "Your own input, output and error files, newest first (`order=asc` for oldest first), from 1xAi's records; deleted files are left out. Free.",
        "parameters": [
          {
            "name": "purpose",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "batch",
                "batch_output"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 10000,
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "order",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "desc",
                "asc"
              ],
              "default": "desc"
            }
          },
          {
            "name": "after",
            "in": "query",
            "description": "A file id: the page after it.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of files.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIFileList"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/files/{file_id}": {
      "get": {
        "operationId": "retrieveFile",
        "tags": [
          "Batch"
        ],
        "summary": "One of your batch files",
        "description": "Reachable only with keys of the account that made it (for one made with a company workspace key, only with keys of that workspace); any other key gets 404 `not_found`. `expires_at` is when it will be deleted.",
        "parameters": [
          {
            "name": "file_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "file-abc123"
          }
        ],
        "responses": {
          "200": {
            "description": "The file.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIFile"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "404": {
            "$ref": "#/components/responses/BatchNotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      },
      "delete": {
        "operationId": "deleteFile",
        "tags": [
          "Batch"
        ],
        "summary": "Delete a batch file now",
        "description": "Reachable only with keys of the account that made it (for one made with a company workspace key, only with keys of that workspace); any other key gets 404 `not_found`. Deleted at OpenAI at once. A batch's output or error file can be deleted only once the batch is settled (409 `batch_not_settled` before that).",
        "parameters": [
          {
            "name": "file_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "file-abc123"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIFileDeleted"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "404": {
            "$ref": "#/components/responses/BatchNotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "409": {
            "$ref": "#/components/responses/BatchNotSettled"
          }
        }
      }
    },
    "/v1/files/{file_id}/content": {
      "get": {
        "operationId": "downloadFile",
        "tags": [
          "Batch"
        ],
        "summary": "Download a batch's output or error file",
        "description": "Reachable only with keys of the account that made it (for one made with a company workspace key, only with keys of that workspace); any other key gets 404 `not_found`. Streamed from OpenAI: one JSON line per request, matched by `custom_id`. A transfer cut in the middle ends with the connection aborted, never as a shorter file. Kept 1 day after the batch is settled (404 `file_expired` after that).",
        "parameters": [
          {
            "name": "file_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "file-abc123"
          }
        ],
        "responses": {
          "200": {
            "description": "The file's bytes (JSONL), as OpenAI serves them.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "404": {
            "$ref": "#/components/responses/BatchNotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/batches": {
      "post": {
        "operationId": "createBatch",
        "tags": [
          "Batch"
        ],
        "summary": "Create a batch",
        "description": "OpenAI models on `/v1/chat/completions` or `/v1/embeddings`. Billed at 50% of the list price for uncached input and output (cached input at the usual cached rate), plus the model's usual markup, from the wallet only. On creation the file's estimated maximum plus 10% is held; when the batch ends only completed requests are billed, as one usage row per model (endpoint `/v1/batches`, `request_id` `obatch_<batch id>_<model>`), and the hold is released. No `X-1xai-Cost-Toman`: the cost is known at settlement. https://1xai.ir/en/docs/openai-batch",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OpenAIBatchRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OpenAI's batch object.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIBatch"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BatchBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/BatchPaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "429": {
            "$ref": "#/components/responses/BatchLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/UpstreamTimeout"
          },
          "404": {
            "$ref": "#/components/responses/BatchNotFound"
          }
        }
      },
      "get": {
        "operationId": "listBatches",
        "tags": [
          "Batch"
        ],
        "summary": "Your batches",
        "description": "Your own batches, newest first, as OpenAI last reported each, from 1xAi's records. Free.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 20,
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "after",
            "in": "query",
            "description": "A batch id: the page after it.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of batches.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIBatchList"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/batches/{batch_id}": {
      "get": {
        "operationId": "retrieveBatch",
        "tags": [
          "Batch"
        ],
        "summary": "A batch's status",
        "description": "Reachable only with keys of the account that made it (for one made with a company workspace key, only with keys of that workspace); any other key gets 404 `not_found`. Free.",
        "parameters": [
          {
            "name": "batch_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "batch_abc123"
          }
        ],
        "responses": {
          "200": {
            "description": "OpenAI's batch object.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIBatch"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "404": {
            "$ref": "#/components/responses/BatchNotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/batches/{batch_id}/cancel": {
      "post": {
        "operationId": "cancelBatch",
        "tags": [
          "Batch"
        ],
        "summary": "Cancel a batch",
        "description": "Reachable only with keys of the account that made it (for one made with a company workspace key, only with keys of that workspace); any other key gets 404 `not_found`. Requests that completed before the cancel are billed; the rest cost nothing.",
        "parameters": [
          {
            "name": "batch_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "batch_abc123"
          }
        ],
        "responses": {
          "200": {
            "description": "OpenAI's batch object.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIBatch"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "404": {
            "$ref": "#/components/responses/BatchNotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/models": {
      "get": {
        "operationId": "listModels",
        "tags": [
          "Models"
        ],
        "summary": "List the callable models",
        "description": "Every model that is priced and callable, image, audio and video models included, each with its `type` and, when known, `context_window` and `max_output_tokens`. Free.",
        "responses": {
          "200": {
            "description": "The list.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelList"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/models/{model}": {
      "get": {
        "operationId": "getModel",
        "tags": [
          "Models"
        ],
        "summary": "One model",
        "description": "A retired model answers 410 `model_retired`.",
        "parameters": [
          {
            "name": "model",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "A model id, written exactly as `GET /v1/models` returns it.",
            "example": "gpt-5.5"
          }
        ],
        "responses": {
          "200": {
            "description": "The model.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Model"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/messages": {
      "post": {
        "operationId": "createMessageV1",
        "tags": [
          "Anthropic"
        ],
        "summary": "Anthropic Messages on the /v1 base URL",
        "description": "The same route as `/anthropic/v1/messages`, so an Anthropic SDK whose base URL is the site root works.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AnthropicMessagesRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Anthropic's response. `X-1xai-Cost-Toman` when not streamed.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              },
              "X-1xai-Model-Alias": {
                "$ref": "#/components/headers/X-1xai-Model-Alias"
              },
              "X-1xai-Cost-Toman": {
                "$ref": "#/components/headers/X-1xai-Cost-Toman"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicMessagesResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-Sent Events, as the vendor sends them."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/UpstreamTimeout"
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {
            "anthropicKey": []
          },
          {
            "googleKey": []
          }
        ]
      }
    },
    "/anthropic/v1/messages": {
      "post": {
        "operationId": "createMessage",
        "tags": [
          "Anthropic"
        ],
        "summary": "Anthropic Messages (native)",
        "description": "Anthropic's own Messages API: prompt caching with `cache_control`, extended thinking, citations. The headers `anthropic-version` and `anthropic-beta` are forwarded.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AnthropicMessagesRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Anthropic's response. `X-1xai-Cost-Toman` when not streamed.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              },
              "X-1xai-Model-Alias": {
                "$ref": "#/components/headers/X-1xai-Model-Alias"
              },
              "X-1xai-Cost-Toman": {
                "$ref": "#/components/headers/X-1xai-Cost-Toman"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicMessagesResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-Sent Events, as the vendor sends them."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/UpstreamTimeout"
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {
            "anthropicKey": []
          },
          {
            "googleKey": []
          }
        ]
      }
    },
    "/anthropic/v1/messages/count_tokens": {
      "post": {
        "operationId": "countMessageTokens",
        "tags": [
          "Anthropic"
        ],
        "summary": "Count the tokens of a Messages request",
        "description": "Free.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The count.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "input_tokens": {
                      "type": "integer"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/UpstreamTimeout"
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {
            "anthropicKey": []
          },
          {
            "googleKey": []
          }
        ]
      }
    },
    "/anthropic/v1/messages/batches": {
      "post": {
        "operationId": "createMessageBatch",
        "tags": [
          "Anthropic"
        ],
        "summary": "Submit a Message Batch",
        "description": "Needs a positive balance (402 `insufficient_balance` otherwise); nothing is held at submit. The batch is billed once, when its results are first downloaded. Keep the returned `id`: the list of batches (`GET` on this path) is not served and answers 404 `path_not_found`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MessageBatchRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The batch object.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageBatch"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/UpstreamTimeout"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {
            "anthropicKey": []
          },
          {
            "googleKey": []
          }
        ]
      }
    },
    "/anthropic/v1/messages/batches/{id}": {
      "get": {
        "operationId": "getMessageBatch",
        "tags": [
          "Anthropic"
        ],
        "summary": "A Message Batch's status",
        "description": "Reachable only with keys of the account that created the batch (for a batch created with a company workspace key, only with keys of that workspace); any other key gets 404 `not_found`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "msgbatch_013Zva2CMHLNnXjNJJKqJ2EF"
          }
        ],
        "responses": {
          "200": {
            "description": "The batch object.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageBatch"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {
            "anthropicKey": []
          },
          {
            "googleKey": []
          }
        ]
      },
      "delete": {
        "operationId": "deleteMessageBatch",
        "tags": [
          "Anthropic"
        ],
        "summary": "Delete a Message Batch",
        "description": "Reachable only with keys of the account that created the batch (for a batch created with a company workspace key, only with keys of that workspace); any other key gets 404 `not_found`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "msgbatch_013Zva2CMHLNnXjNJJKqJ2EF"
          }
        ],
        "responses": {
          "200": {
            "description": "Anthropic's answer.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {
            "anthropicKey": []
          },
          {
            "googleKey": []
          }
        ]
      }
    },
    "/anthropic/v1/messages/batches/{id}/results": {
      "get": {
        "operationId": "getMessageBatchResults",
        "tags": [
          "Anthropic"
        ],
        "summary": "Download a Message Batch's results",
        "description": "Reachable only with keys of the account that created the batch (for a batch created with a company workspace key, only with keys of that workspace); any other key gets 404 `not_found`. One JSON line per request. The first download bills the batch: each succeeded request's tokens at 50% of the model's per-token list price, plus the model's markup; later downloads are free. The batch object's `results_url` names this path.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "msgbatch_013Zva2CMHLNnXjNJJKqJ2EF"
          }
        ],
        "responses": {
          "200": {
            "description": "The results (JSONL).",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/x-jsonl": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {
            "anthropicKey": []
          },
          {
            "googleKey": []
          }
        ]
      }
    },
    "/anthropic/v1/messages/batches/{id}/cancel": {
      "post": {
        "operationId": "cancelMessageBatch",
        "tags": [
          "Anthropic"
        ],
        "summary": "Cancel a Message Batch",
        "description": "Reachable only with keys of the account that created the batch (for a batch created with a company workspace key, only with keys of that workspace); any other key gets 404 `not_found`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "msgbatch_013Zva2CMHLNnXjNJJKqJ2EF"
          }
        ],
        "responses": {
          "200": {
            "description": "The batch object.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageBatch"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {
            "anthropicKey": []
          },
          {
            "googleKey": []
          }
        ]
      }
    },
    "/anthropic/v1/models": {
      "get": {
        "operationId": "listAnthropicModels",
        "tags": [
          "Anthropic"
        ],
        "summary": "List the Claude models (Anthropic's shape)",
        "description": "Free.",
        "responses": {
          "200": {
            "description": "The list.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {
            "anthropicKey": []
          },
          {
            "googleKey": []
          }
        ]
      }
    },
    "/gemini/v1beta/models": {
      "get": {
        "operationId": "listGeminiModels",
        "tags": [
          "Gemini"
        ],
        "summary": "List the Gemini models (Google's shape)",
        "description": "Free.",
        "responses": {
          "200": {
            "description": "The list.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {
            "anthropicKey": []
          },
          {
            "googleKey": []
          }
        ]
      }
    },
    "/gemini/v1beta/models/{model}:generateContent": {
      "post": {
        "operationId": "geminiGenerateContent",
        "tags": [
          "Gemini"
        ],
        "summary": "Gemini generateContent (native)",
        "description": "Google's Generative Language API. The key must be in a header (`x-goog-api-key` or `Authorization: Bearer`); `?key=` is not read. `cachedContents` is not supported; implicit caching is automatic. Billed from `usageMetadata`.",
        "parameters": [
          {
            "name": "model",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "A model id, written exactly as `GET /v1/models` returns it.",
            "example": "gemini-3.5-flash"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GeminiGenerateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Google's response.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              },
              "X-1xai-Model-Alias": {
                "$ref": "#/components/headers/X-1xai-Model-Alias"
              },
              "X-1xai-Cost-Toman": {
                "$ref": "#/components/headers/X-1xai-Cost-Toman"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiGenerateResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/UpstreamTimeout"
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {
            "anthropicKey": []
          },
          {
            "googleKey": []
          }
        ]
      }
    },
    "/gemini/v1beta/models/{model}:streamGenerateContent": {
      "post": {
        "operationId": "geminiStreamGenerateContent",
        "tags": [
          "Gemini"
        ],
        "summary": "Gemini streamGenerateContent (native)",
        "description": "With `?alt=sse` the answer is Server-Sent Events.",
        "parameters": [
          {
            "name": "model",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "A model id, written exactly as `GET /v1/models` returns it.",
            "example": "gemini-3.5-flash"
          },
          {
            "name": "alt",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "sse"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GeminiGenerateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Google's stream.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              },
              "X-1xai-Model-Alias": {
                "$ref": "#/components/headers/X-1xai-Model-Alias"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeminiGenerateResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-Sent Events, as the vendor sends them."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/UpstreamTimeout"
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {
            "anthropicKey": []
          },
          {
            "googleKey": []
          }
        ]
      }
    },
    "/gemini/v1beta/models/{model}:countTokens": {
      "post": {
        "operationId": "geminiCountTokens",
        "tags": [
          "Gemini"
        ],
        "summary": "Count the tokens of a Gemini request",
        "description": "Free.",
        "parameters": [
          {
            "name": "model",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "A model id, written exactly as `GET /v1/models` returns it.",
            "example": "gemini-3.5-flash"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The count.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "totalTokens": {
                      "type": "integer"
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/UpstreamTimeout"
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {
            "anthropicKey": []
          },
          {
            "googleKey": []
          }
        ]
      }
    },
    "/gemini/v1beta/interactions": {
      "post": {
        "operationId": "geminiCreateVideo",
        "tags": [
          "Gemini"
        ],
        "summary": "Generate a video with Gemini Omni",
        "description": "Synchronous: the answer arrives when the video is made, with the video as base64 in `steps`. Billed by seconds of video, only when a video was produced. Allow a client timeout of several minutes.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GeminiInteractionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The interaction, with the video inline.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/UpstreamTimeout"
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {
            "anthropicKey": []
          },
          {
            "googleKey": []
          }
        ]
      }
    },
    "/v1/realtime/client_secret": {
      "post": {
        "operationId": "createRealtimeClientSecret",
        "tags": [
          "Realtime"
        ],
        "summary": "Mint a client secret for a realtime voice call",
        "description": "Your server calls this with its API key and hands the secret to its own front end, which opens the WebSocket at `url` with `?client_secret=` (a browser) or `Authorization: Bearer` (a server). A call lasts up to 30 minutes and is billed after each of the model's responses. WebSocket only.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RealtimeClientSecretRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The secret and the socket to open.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RealtimeClientSecret"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          },
          "504": {
            "$ref": "#/components/responses/UpstreamTimeout"
          }
        }
      }
    },
    "/v1/usage": {
      "get": {
        "operationId": "listUsage",
        "tags": [
          "Account"
        ],
        "summary": "The call log",
        "description": "Newest first. Read-only and free. A personal key reads the account's calls outside company workspaces; a company workspace key, its own workspace's calls. `request_id` finds one call by the `X-Request-Id` of its answer.",
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/offset"
          },
          {
            "$ref": "#/components/parameters/request_id"
          },
          {
            "$ref": "#/components/parameters/from"
          },
          {
            "$ref": "#/components/parameters/to"
          },
          {
            "$ref": "#/components/parameters/model"
          },
          {
            "$ref": "#/components/parameters/provider"
          },
          {
            "$ref": "#/components/parameters/status"
          },
          {
            "$ref": "#/components/parameters/key_id"
          },
          {
            "$ref": "#/components/parameters/q"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of usage rows.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsagePage"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "400": {
            "$ref": "#/components/responses/BadParameter"
          },
          "503": {
            "$ref": "#/components/responses/SearchTimeout"
          }
        }
      }
    },
    "/v1/usage/export": {
      "get": {
        "operationId": "exportUsage",
        "tags": [
          "Account"
        ],
        "summary": "The calls of a date range as CSV",
        "description": "At most 31 days a request (a longer span is refused, never cut short) and 100000 rows a file; when more exist the last line is `#truncated,<cursor>`, and `#error,<cursor>` when the export stopped after rows were written. UTF-8 with a byte order mark, CRLF lines, newest first. Columns: `time`, `request_id`, `key_name`, `model`, `provider`, `endpoint`, `status`, `prompt_tokens`, `completion_tokens`, `cached_tokens`, `total_tokens`, `base_cost_usd`, `markup_percent`, `toman_per_usd`, `cost_toman`. Never a request or response text. The rows are those `GET /v1/usage` shows the same key. One export at a time and 6 a minute per account (per workspace for a company workspace key).",
        "parameters": [
          {
            "$ref": "#/components/parameters/from"
          },
          {
            "$ref": "#/components/parameters/to"
          },
          {
            "$ref": "#/components/parameters/cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "The CSV file.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              },
              "X-1xai-Export-Row-Limit": {
                "$ref": "#/components/headers/X-1xai-Export-Row-Limit"
              }
            },
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/ExportLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "400": {
            "$ref": "#/components/responses/BadParameter"
          },
          "503": {
            "$ref": "#/components/responses/SearchTimeout"
          }
        }
      }
    },
    "/v1/usage/summary": {
      "get": {
        "operationId": "getUsageSummary",
        "tags": [
          "Account"
        ],
        "summary": "Usage summary of a window",
        "description": "Totals, a daily series (Tehran days), and the same window by model, vendor, key and status. `request_id` is ignored here.",
        "parameters": [
          {
            "$ref": "#/components/parameters/days"
          },
          {
            "$ref": "#/components/parameters/from"
          },
          {
            "$ref": "#/components/parameters/to"
          },
          {
            "$ref": "#/components/parameters/model"
          },
          {
            "$ref": "#/components/parameters/provider"
          },
          {
            "$ref": "#/components/parameters/status"
          },
          {
            "$ref": "#/components/parameters/key_id"
          },
          {
            "$ref": "#/components/parameters/q"
          }
        ],
        "responses": {
          "200": {
            "description": "The summary.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageSummary"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "400": {
            "$ref": "#/components/responses/BadParameter"
          },
          "503": {
            "$ref": "#/components/responses/SearchTimeout"
          }
        }
      }
    },
    "/v1/wallet/transactions": {
      "get": {
        "operationId": "listWalletTransactions",
        "tags": [
          "Account"
        ],
        "summary": "Wallet transactions",
        "description": "Top-ups, charges, refunds, adjustments and gifts, newest first. A company workspace key gets 403 `forbidden`: the ledger is the whole company's and is on the company dashboard.",
        "parameters": [
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/offset"
          },
          {
            "$ref": "#/components/parameters/from"
          },
          {
            "$ref": "#/components/parameters/to"
          },
          {
            "$ref": "#/components/parameters/kind"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of transactions.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WalletTransactionPage"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "400": {
            "$ref": "#/components/responses/BadParameter"
          }
        }
      }
    },
    "/v1/wallet/summary": {
      "get": {
        "operationId": "getWalletSummary",
        "tags": [
          "Account"
        ],
        "summary": "Wallet summary and spendable balance",
        "description": "`spendable_toman` is the figure the low-balance alert is compared against. A company workspace key reads the short form (`scope`, `spendable_toman`).",
        "parameters": [
          {
            "$ref": "#/components/parameters/days"
          }
        ],
        "responses": {
          "200": {
            "description": "The summary.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/WalletSummary"
                    },
                    {
                      "$ref": "#/components/schemas/WorkspaceKeyWallet"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/keys": {
      "get": {
        "operationId": "listKeys",
        "tags": [
          "Account"
        ],
        "summary": "The API keys",
        "description": "Revoked and expired keys included. A key itself is never returned. Keys are created and revoked in the dashboard. A personal key lists the account's keys outside company workspaces; a company workspace key, its workspace's keys.",
        "responses": {
          "200": {
            "description": "The keys.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyList"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/keys/current": {
      "get": {
        "operationId": "getCurrentKey",
        "tags": [
          "Account"
        ],
        "summary": "The key this request was sent with",
        "description": "The fields of one item of `GET /v1/keys`. Never the secret.",
        "responses": {
          "200": {
            "description": "The key.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyCurrent"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    },
    "/v1/keys/{id}": {
      "get": {
        "operationId": "getKey",
        "tags": [
          "Account"
        ],
        "summary": "One key and its usage totals",
        "description": "The id is the integer `id` of `GET /v1/keys`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "example": 4821
          }
        ],
        "responses": {
          "200": {
            "description": "The key and its stats.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyDetail"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/KeyRestricted"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          }
        }
      }
    },
    "/v1/sla/credits": {
      "get": {
        "operationId": "listServiceCredits",
        "tags": [
          "Account"
        ],
        "summary": "The account's service credits",
        "description": "One row per month and vendor family that owes this account a credit, newest month first; a month that owes nothing has no row, and a month is listed only once its credit is certain to be paid. Covered from the Jalali month 1405-09 (Azar 1405). A company workspace key gets 403 `forbidden`: credits are the paying account's. https://1xai.ir/en/docs/service-credit",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 50,
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The credits.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-1xai-Request-Id": {
                "$ref": "#/components/headers/X-1xai-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceCreditPage"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "A `1xai-`-prefixed key: `Authorization: Bearer 1xai-...`. Works on every route."
      },
      "anthropicKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "The same key, as the Anthropic SDK sends it."
      },
      "googleKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-goog-api-key",
        "description": "The same key, as the Google GenAI SDK sends it. A key in the URL (`?key=`) is not read."
      }
    },
    "parameters": {
      "limit": {
        "name": "limit",
        "in": "query",
        "schema": {
          "type": "integer",
          "default": 50,
          "minimum": 1,
          "maximum": 500
        }
      },
      "offset": {
        "name": "offset",
        "in": "query",
        "schema": {
          "type": "integer",
          "default": 0,
          "minimum": 0
        }
      },
      "from": {
        "name": "from",
        "in": "query",
        "description": "Start of the window: an RFC 3339 time with an offset (`2026-11-01T00:00:00Z`), or a plain date `YYYY-MM-DD` read as that day in Tehran time (its first instant). A value in neither form answers 400 `invalid_request` with `param`.",
        "schema": {
          "type": "string",
          "examples": [
            "2026-11-01",
            "2026-11-01T00:00:00+03:30"
          ]
        }
      },
      "to": {
        "name": "to",
        "in": "query",
        "description": "End of the window: an RFC 3339 time with an offset, or a plain date read as the end of that Tehran day. A value in neither form answers 400 `invalid_request` with `param`.",
        "schema": {
          "type": "string",
          "examples": [
            "2026-11-30",
            "2026-11-30T23:59:59+03:30"
          ]
        }
      },
      "request_id": {
        "name": "request_id",
        "in": "query",
        "description": "Exact match on a call's id (the `X-Request-Id` of its answer); at most 128 characters of `A-Z a-z 0-9 _ - . :`. Returns that call's rows the key may read, normally one; any other id returns an empty list. An unreadable value answers 400.",
        "schema": {
          "type": "string",
          "maxLength": 128
        }
      },
      "cursor": {
        "name": "cursor",
        "in": "query",
        "description": "Continues a truncated export: the second cell of the previous file's `#truncated` (or `#error`) line, with the same `from` and `to`.",
        "schema": {
          "type": "string"
        }
      },
      "days": {
        "name": "days",
        "in": "query",
        "schema": {
          "type": "integer",
          "default": 30,
          "minimum": 1,
          "maximum": 365
        }
      },
      "model": {
        "name": "model",
        "in": "query",
        "description": "An exact model id.",
        "schema": {
          "type": "string"
        }
      },
      "provider": {
        "name": "provider",
        "in": "query",
        "schema": {
          "type": "string",
          "enum": [
            "openai",
            "anthropic",
            "gemini",
            "deepseek",
            "xai",
            "moonshot",
            "zhipu",
            "alibaba",
            "minimax",
            "tencent"
          ]
        }
      },
      "status": {
        "name": "status",
        "in": "query",
        "description": "`ok` for successful calls (status under 400), `error` for failed ones.",
        "schema": {
          "type": "string",
          "enum": [
            "ok",
            "error"
          ]
        }
      },
      "key_id": {
        "name": "key_id",
        "in": "query",
        "schema": {
          "type": "integer"
        }
      },
      "q": {
        "name": "q",
        "in": "query",
        "description": "Searches the model, the route, the key's name, the request id and the logged request and response text.",
        "schema": {
          "type": "string"
        }
      },
      "kind": {
        "name": "kind",
        "in": "query",
        "description": "A comma-separated list of kinds.",
        "schema": {
          "type": "string",
          "example": "topup,refund"
        }
      }
    },
    "headers": {
      "X-RateLimit-Limit": {
        "description": "The requests a minute this key is held to.",
        "schema": {
          "type": "integer",
          "example": 1000
        }
      },
      "X-RateLimit-Remaining": {
        "description": "Whole requests left in the key's bucket after this one.",
        "schema": {
          "type": "integer"
        }
      },
      "X-RateLimit-Reset": {
        "description": "Seconds until the bucket is full again; 0 when it is full.",
        "schema": {
          "type": "integer"
        }
      },
      "Retry-After": {
        "description": "Seconds to wait before sending again.",
        "schema": {
          "type": "integer",
          "minimum": 1
        }
      },
      "X-Request-Id": {
        "description": "1xAi's id of this call (`gw_` and 26 characters), on every response, served or refused. The same id is the `request_id` of the call's usage row and what `GET /v1/usage?request_id=` finds. Give it to support. A vendor's own id is never sent here.",
        "schema": {
          "type": "string",
          "example": "gw_01JD3Z5T8Q0V6W4M2K9R7N1PXA"
        }
      },
      "X-1xai-Request-Id": {
        "description": "The same id as `X-Request-Id`, still sent.",
        "schema": {
          "type": "string"
        }
      },
      "X-1xai-Cost-Toman": {
        "description": "What this call was billed, in Toman, markup included (the `cost_toman` of its usage row). On a successful answer that is not streamed; absent on streams and on every error. Treat it as optional: when absent, read the usage row.",
        "schema": {
          "type": "string",
          "example": "158"
        }
      },
      "X-1xai-Export-Row-Limit": {
        "description": "The most rows one export file holds.",
        "schema": {
          "type": "integer",
          "example": 100000
        }
      },
      "X-1xai-Model-Alias": {
        "description": "Present when a retired model id was served by its successor: `requested -> served`. The call is billed at the served model's price.",
        "schema": {
          "type": "string"
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "The request is malformed, or asks for something not metered. Codes: `invalid_request`, `hosted_tool_unmetered`, `search_not_priced`, `path_unmetered`, `model_not_supported`, `offer_request_refused`.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "X-1xai-Request-Id": {
            "$ref": "#/components/headers/X-1xai-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "message": "…",
                "type": "api_error",
                "code": "invalid_request"
              }
            }
          }
        }
      },
      "Unauthorized": {
        "description": "`missing_api_key` (no key in `Authorization`, `x-api-key` or `x-goog-api-key`); `invalid_api_key` (a key 1xAi does not know); `account_disabled` (the key's account is switched off); `key_revoked` (revoked or expired); `key_capped` (the key reached its spend cap); `workspace_limit` (a workspace's or member's monthly limit).",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "X-1xai-Request-Id": {
            "$ref": "#/components/headers/X-1xai-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "message": "…",
                "type": "api_error",
                "code": "invalid_api_key"
              }
            }
          }
        }
      },
      "BadParameter": {
        "description": "`invalid_request`: a `from`, `to` or `request_id` (on the export also `cursor`, or a span over 31 days) that cannot be read; `param` names it.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "X-1xai-Request-Id": {
            "$ref": "#/components/headers/X-1xai-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "message": "…",
                "type": "api_error",
                "code": "invalid_request"
              }
            }
          }
        }
      },
      "Forbidden": {
        "description": "`forbidden`: a company workspace key asked for the wallet ledger or the service credits, which are the whole company's. `key_ip_not_allowed` or `key_scope_denied`: the key's own controls refused the request.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "X-1xai-Request-Id": {
            "$ref": "#/components/headers/X-1xai-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "message": "…",
                "type": "api_error",
                "code": "forbidden"
              }
            }
          }
        }
      },
      "KeyRestricted": {
        "description": "The key's own controls refused the request, before anything was billed. `key_ip_not_allowed`: the caller's address is not on the key's address list. `key_scope_denied`: the route is outside the key's scope. `key_model_not_allowed` (billed routes): the model is not on the key's model list.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "X-1xai-Request-Id": {
            "$ref": "#/components/headers/X-1xai-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "message": "…",
                "type": "api_error",
                "code": "key_scope_denied"
              }
            }
          }
        }
      },
      "SearchTimeout": {
        "description": "`usage_search_timeout`: the `q` search ran longer than 8 seconds. Narrow `from`/`to`, or use `request_id`.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "X-1xai-Request-Id": {
            "$ref": "#/components/headers/X-1xai-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "message": "…",
                "type": "api_error",
                "code": "usage_search_timeout"
              }
            }
          }
        }
      },
      "ExportLimited": {
        "description": "`export_in_progress`: another export of the account (or workspace) is running (`Retry-After: 5`). `rate_limited`: more than 6 exports a minute. `rate_limit_exceeded`: the key's own limit.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "X-1xai-Request-Id": {
            "$ref": "#/components/headers/X-1xai-Request-Id"
          },
          "Retry-After": {
            "$ref": "#/components/headers/Retry-After"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "message": "…",
                "type": "api_error",
                "code": "export_in_progress"
              }
            }
          }
        }
      },
      "PaymentRequired": {
        "description": "`insufficient_balance`, `plan_media_used` (a media call after a paid plan has used up its media share for the period, which the wallet cannot fund; text calls still use the plan), `model_not_priced` (an unpriced model is refused, never served free), or `path_unmetered` (a path that cannot be metered).",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "X-1xai-Request-Id": {
            "$ref": "#/components/headers/X-1xai-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "message": "…",
                "type": "api_error",
                "code": "insufficient_balance"
              }
            }
          }
        }
      },
      "NotFound": {
        "description": "`path_not_found` (no such path, including any unknown path or method under /v1/usage, /v1/wallet and /v1/keys, and the list of message batches) or `not_found` (no such id for this key: a key, a video job, or a message batch another account or workspace created).",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "X-1xai-Request-Id": {
            "$ref": "#/components/headers/X-1xai-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "message": "…",
                "type": "api_error",
                "code": "path_not_found"
              }
            }
          }
        }
      },
      "RateLimited": {
        "description": "Two cases. `rate_limit_exceeded`: the key went over its own limit (1000 requests a minute by default); `X-RateLimit-Remaining` is 0 and `Retry-After` is ours. `upstream_capacity` (on the OpenAI-shaped routes): the model's vendor is busy; `Retry-After`, when present, is the vendor's. Neither is billed.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "X-1xai-Request-Id": {
            "$ref": "#/components/headers/X-1xai-Request-Id"
          },
          "Retry-After": {
            "$ref": "#/components/headers/Retry-After"
          },
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/X-RateLimit-Limit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/X-RateLimit-Remaining"
          },
          "X-RateLimit-Reset": {
            "$ref": "#/components/headers/X-RateLimit-Reset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "message": "…",
                "type": "rate_limit_exceeded",
                "code": "rate_limit_exceeded"
              }
            }
          }
        }
      },
      "ServerError": {
        "description": "`internal`: a fault on our side.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "X-1xai-Request-Id": {
            "$ref": "#/components/headers/X-1xai-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "message": "…",
                "type": "api_error",
                "code": "internal"
              }
            }
          }
        }
      },
      "UpstreamError": {
        "description": "`upstream_error`: the model's vendor could not be reached. Nothing was billed.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "X-1xai-Request-Id": {
            "$ref": "#/components/headers/X-1xai-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "message": "…",
                "type": "api_error",
                "code": "upstream_error"
              }
            }
          }
        }
      },
      "Unavailable": {
        "description": "`upstream_unavailable`: the model's vendor is not available through us right now. `offer_unavailable`: a special-offer model has no capacity (with `Retry-After`).",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "X-1xai-Request-Id": {
            "$ref": "#/components/headers/X-1xai-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "message": "…",
                "type": "api_error",
                "code": "upstream_unavailable"
              }
            }
          }
        }
      },
      "UpstreamTimeout": {
        "description": "`upstream_error`: the vendor did not answer within 10 minutes. Not billed when nothing was delivered.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "X-1xai-Request-Id": {
            "$ref": "#/components/headers/X-1xai-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "message": "…",
                "type": "api_error",
                "code": "upstream_error"
              }
            }
          }
        }
      },
      "BatchBadRequest": {
        "description": "`batch_file_invalid` (an upload): the first bad line refuses the whole file, with `line` (as an editor numbers it, blank lines counted; 0 for the file as a whole) and `reason`: `invalid_json`, `custom_id`, `duplicate_custom_id`, `method`, `url`, `mixed_url`, `body`, `model`, `model_not_batch`, `model_not_priced`, `stream`, `max_tokens`, `n`, `unsupported_field`, `too_many_lines`, `line_too_long`, `empty_file`. Nothing of a refused file is kept. `invalid_request`: not a multipart form, no `file` or no `purpose`; a batch without `input_file_id` or `endpoint`; a `completion_window` other than `24h`; an `input_file_id` that is not a checked input file of yours; an `endpoint` that is not the file's `url`.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "X-1xai-Request-Id": {
            "$ref": "#/components/headers/X-1xai-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "message": "…",
                "type": "api_error",
                "code": "batch_file_invalid"
              }
            }
          }
        }
      },
      "BatchPaymentRequired": {
        "description": "`path_unmetered`: a `purpose` other than `batch`. `insufficient_balance`: the account is in debt, or the wallet cannot fund the batch's hold (with `estimate_toman`, `required_toman` and `available_toman`); plan credit and gift credit do not pay for batches. `key_capped` (with `cap_toman`, `spent_toman` and `required_toman`) and `workspace_limit`: the key's spend cap, or the workspace's or member's monthly limit, has no room for the hold. `model_not_priced`: a model of the file lost its price after the upload.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "X-1xai-Request-Id": {
            "$ref": "#/components/headers/X-1xai-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "message": "…",
                "type": "api_error",
                "code": "insufficient_balance"
              }
            }
          }
        }
      },
      "BatchNotFound": {
        "description": "`not_found`: no such file or batch for this key (another account's or workspace's, or a file you deleted). `file_expired`: the file was deleted at OpenAI when its retention ended (1 day after its batch was settled).",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "X-1xai-Request-Id": {
            "$ref": "#/components/headers/X-1xai-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "message": "…",
                "type": "api_error",
                "code": "not_found"
              }
            }
          }
        }
      },
      "BatchNotSettled": {
        "description": "`batch_not_settled`: a batch's output or error file cannot be deleted before the batch's cost is settled, usually a few minutes after it ends.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "X-1xai-Request-Id": {
            "$ref": "#/components/headers/X-1xai-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "message": "…",
                "type": "api_error",
                "code": "batch_not_settled"
              }
            }
          }
        }
      },
      "BatchFileTooLarge": {
        "description": "`batch_file_too_large`: the file is larger than 25 MB. A far larger upload may be refused before it reaches the gateway, with a 413 that has no JSON body.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "X-1xai-Request-Id": {
            "$ref": "#/components/headers/X-1xai-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "message": "…",
                "type": "api_error",
                "code": "batch_file_too_large"
              }
            }
          }
        }
      },
      "BatchLimited": {
        "description": "`batch_limit`: one of the account's batch limits (unsettled batches, their estimates together, requests in 24 hours: with `limit` and `current`; uploads at once: with `limit`; input files or bytes kept at OpenAI: with `files` and `stored_bytes`, or `reason` `stored_bytes`). `upstream_capacity`: our batch queue at OpenAI is full; submit later or a smaller batch. `rate_limit_exceeded`: the key's own limit.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/X-Request-Id"
          },
          "X-1xai-Request-Id": {
            "$ref": "#/components/headers/X-1xai-Request-Id"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "message": "…",
                "type": "api_error",
                "code": "batch_limit"
              }
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "description": "The gateway's own error body, on every route. An error that comes from the model vendor keeps the vendor's own shape and status.",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string",
                "description": "Human-readable. Persian by default; English with `Accept-Language: en`. Do not match on it."
              },
              "type": {
                "type": "string",
                "description": "`api_error` for gateway errors; `rate_limit_exceeded` for the rate limit.",
                "examples": [
                  "api_error"
                ]
              },
              "code": {
                "type": "string",
                "description": "The machine code. Absent only on the 413 of a body over the size limit.",
                "examples": [
                  "insufficient_balance"
                ]
              },
              "param": {
                "type": "string",
                "description": "On some account API errors: the query parameter that could not be read.",
                "examples": [
                  "from"
                ]
              }
            },
            "required": [
              "message",
              "type"
            ],
            "additionalProperties": true
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": true
      },
      "Message": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "system",
              "developer",
              "user",
              "assistant",
              "tool"
            ]
          },
          "content": {
            "description": "A string, or an array of content parts (`text`, `image_url`, `input_audio`).",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "tool_calls": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "tool_call_id": {
            "type": "string"
          }
        },
        "required": [
          "role"
        ],
        "additionalProperties": true
      },
      "ChatCompletionRequest": {
        "type": "object",
        "description": "OpenAI's chat completion request. Fields not listed here are passed through to the vendor unchanged.",
        "properties": {
          "model": {
            "type": "string",
            "description": "The model id decides the vendor: `claude-*` Anthropic, `gemini-*` Google, `deepseek-*`, `grok-*`, `kimi-*`, `glm-*`, `qwen*`, `minimax-*`, `hy*`, anything else OpenAI.",
            "examples": [
              "gpt-5.5"
            ]
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Message"
            }
          },
          "stream": {
            "type": "boolean",
            "description": "Server-Sent Events. The gateway sets `stream_options.include_usage`, so the last chunk carries `usage`."
          },
          "max_tokens": {
            "type": "integer",
            "description": "Lowered by the gateway when the balance cannot fund it. Sent to OpenAI models as `max_completion_tokens`."
          },
          "max_completion_tokens": {
            "type": "integer"
          },
          "temperature": {
            "type": "number"
          },
          "top_p": {
            "type": "number"
          },
          "tools": {
            "type": "array",
            "description": "Function tools (`type: function` or `custom`). Any other tool type answers 400 `hosted_tool_unmetered`.",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "tool_choice": {
            "description": "Passed through to the vendor."
          },
          "response_format": {
            "type": "object",
            "additionalProperties": true,
            "description": "`json_object` or `json_schema`; passed through to the vendor."
          }
        },
        "required": [
          "model",
          "messages"
        ],
        "additionalProperties": true
      },
      "Usage": {
        "type": "object",
        "properties": {
          "prompt_tokens": {
            "type": "integer"
          },
          "completion_tokens": {
            "type": "integer"
          },
          "total_tokens": {
            "type": "integer"
          }
        },
        "additionalProperties": true
      },
      "ChatCompletionResponse": {
        "type": "object",
        "description": "The vendor's response, relayed as it is.",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "examples": [
              "chat.completion"
            ]
          },
          "created": {
            "type": "integer"
          },
          "model": {
            "type": "string",
            "description": "The model that served the call."
          },
          "choices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer"
                },
                "message": {
                  "$ref": "#/components/schemas/Message"
                },
                "finish_reason": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "additionalProperties": true
            }
          },
          "usage": {
            "$ref": "#/components/schemas/Usage"
          }
        },
        "additionalProperties": true
      },
      "ResponsesRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "description": "An OpenAI model. Another vendor's model answers 400 `invalid_request`.",
            "examples": [
              "gpt-5.5"
            ]
          },
          "input": {
            "description": "A string or an array of input items."
          },
          "tools": {
            "type": "array",
            "description": "Function tools and `web_search`. `code_interpreter`, `file_search`, `image_generation`, `computer_use` and `mcp` answer 400 `hosted_tool_unmetered`.",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "stream": {
            "type": "boolean"
          },
          "max_output_tokens": {
            "type": "integer"
          },
          "background": {
            "type": "boolean",
            "description": "Not supported: `true` answers 400 `path_unmetered`."
          },
          "store": {
            "type": "boolean",
            "description": "Always sent to the vendor as `false`."
          }
        },
        "required": [
          "model",
          "input"
        ],
        "additionalProperties": true
      },
      "EmbeddingRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "examples": [
              "text-embedding-3-small"
            ]
          },
          "input": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ]
          }
        },
        "required": [
          "model",
          "input"
        ],
        "additionalProperties": true
      },
      "CompletionRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string"
          },
          "prompt": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ]
          },
          "max_tokens": {
            "type": "integer"
          },
          "stream": {
            "type": "boolean"
          }
        },
        "required": [
          "model",
          "prompt"
        ],
        "additionalProperties": true
      },
      "ImageGenerationRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "description": "Defaults to `gpt-image-2`.",
            "examples": [
              "gpt-image-2"
            ]
          },
          "prompt": {
            "type": "string"
          },
          "size": {
            "type": "string",
            "examples": [
              "1024x1024"
            ]
          },
          "quality": {
            "type": "string"
          },
          "n": {
            "type": "integer"
          },
          "stream": {
            "type": "boolean",
            "description": "Not supported: `true` answers 400 `path_unmetered`."
          }
        },
        "required": [
          "prompt"
        ],
        "additionalProperties": true
      },
      "ImageEditRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "description": "Required in a multipart form.",
            "examples": [
              "gpt-image-2"
            ]
          },
          "image": {
            "type": "string",
            "format": "binary"
          },
          "prompt": {
            "type": "string"
          },
          "size": {
            "type": "string"
          }
        },
        "required": [
          "model",
          "image",
          "prompt"
        ],
        "additionalProperties": true
      },
      "SpeechRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "examples": [
              "gpt-4o-mini-tts"
            ]
          },
          "input": {
            "type": "string",
            "description": "Billed by its number of characters."
          },
          "voice": {
            "type": "string",
            "examples": [
              "alloy"
            ]
          },
          "response_format": {
            "type": "string"
          }
        },
        "required": [
          "model",
          "input",
          "voice"
        ],
        "additionalProperties": true
      },
      "TranscriptionRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "description": "`whisper-1`, `gpt-4o-transcribe`, or `gemini-3.5-transcribe` (json or text only, transcriptions only).",
            "examples": [
              "gpt-4o-transcribe"
            ]
          },
          "file": {
            "type": "string",
            "format": "binary"
          },
          "language": {
            "type": "string"
          },
          "prompt": {
            "type": "string"
          },
          "response_format": {
            "type": "string"
          }
        },
        "required": [
          "model",
          "file"
        ],
        "additionalProperties": true
      },
      "ModerationRequest": {
        "type": "object",
        "properties": {
          "input": {
            "description": "A string or an array."
          }
        },
        "required": [
          "input"
        ],
        "additionalProperties": true
      },
      "Model": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "examples": [
              "model"
            ]
          },
          "created": {
            "type": "integer"
          },
          "owned_by": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "description": "What the model is, i.e. which routes call it. Left out when not known; new values may be added.",
            "enum": [
              "chat",
              "embedding",
              "image",
              "video",
              "transcription",
              "speech",
              "realtime",
              "music",
              "moderation",
              "rerank"
            ]
          },
          "context_window": {
            "type": "integer",
            "description": "Input tokens the model accepts. On `chat` and `embedding` models, when known."
          },
          "max_output_tokens": {
            "type": "integer",
            "description": "Output tokens the model can produce. On `chat` models, when known."
          }
        },
        "required": [
          "id",
          "object"
        ],
        "additionalProperties": true
      },
      "ModelList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "examples": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Model"
            }
          }
        },
        "required": [
          "object",
          "data"
        ],
        "additionalProperties": true
      },
      "VideoRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string"
          },
          "prompt": {
            "type": "string"
          },
          "seconds": {
            "description": "Length in seconds; billed per second."
          },
          "size": {
            "type": "string"
          }
        },
        "required": [
          "model",
          "prompt"
        ],
        "additionalProperties": true
      },
      "AnthropicMessagesRequest": {
        "type": "object",
        "description": "Anthropic's Messages request, forwarded as it is.",
        "properties": {
          "model": {
            "type": "string",
            "examples": [
              "claude-sonnet-5"
            ]
          },
          "max_tokens": {
            "type": "integer",
            "description": "Required."
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "system": {
            "description": "A string or an array of blocks; a block may carry `cache_control`."
          },
          "thinking": {
            "type": "object",
            "additionalProperties": true
          },
          "tools": {
            "type": "array",
            "description": "Your own tools, and the server tools `web_search`, `web_fetch`, `bash`, `text_editor`, `computer`, `memory`. `code_execution` answers 400 `hosted_tool_unmetered`.",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "stream": {
            "type": "boolean"
          }
        },
        "required": [
          "model",
          "max_tokens",
          "messages"
        ],
        "additionalProperties": true
      },
      "AnthropicMessagesResponse": {
        "type": "object",
        "description": "Anthropic's response, relayed as it is.",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "examples": [
              "message"
            ]
          },
          "role": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "content": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "stop_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "usage": {
            "type": "object",
            "properties": {
              "input_tokens": {
                "type": "integer"
              },
              "output_tokens": {
                "type": "integer"
              },
              "cache_read_input_tokens": {
                "type": "integer"
              },
              "cache_creation_input_tokens": {
                "type": "integer"
              }
            },
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "GeminiGenerateRequest": {
        "type": "object",
        "description": "Google's generateContent request, forwarded as it is.",
        "properties": {
          "contents": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "systemInstruction": {
            "type": "object",
            "additionalProperties": true
          },
          "generationConfig": {
            "type": "object",
            "additionalProperties": true
          },
          "tools": {
            "type": "array",
            "description": "`functionDeclarations` and Google Search grounding. Google Maps grounding answers 402 `hosted_tool_unmetered`.",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          }
        },
        "required": [
          "contents"
        ],
        "additionalProperties": true
      },
      "GeminiGenerateResponse": {
        "type": "object",
        "description": "Google's response, relayed as it is.",
        "properties": {
          "candidates": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "usageMetadata": {
            "type": "object",
            "properties": {
              "promptTokenCount": {
                "type": "integer"
              },
              "candidatesTokenCount": {
                "type": "integer"
              },
              "thoughtsTokenCount": {
                "type": "integer"
              },
              "cachedContentTokenCount": {
                "type": "integer"
              },
              "totalTokenCount": {
                "type": "integer"
              }
            },
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "GeminiInteractionRequest": {
        "type": "object",
        "description": "Synchronous video generation. `background`, `store: true` and `delivery: uri` answer 400 `invalid_request`.",
        "properties": {
          "model": {
            "type": "string",
            "examples": [
              "gemini-omni-1.1-flash"
            ]
          },
          "input": {
            "description": "Text, or text with an inline image."
          },
          "response_format": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "video"
                ]
              },
              "duration": {
                "type": "string",
                "enum": [
                  "4s",
                  "6s",
                  "8s"
                ]
              }
            },
            "additionalProperties": true
          }
        },
        "required": [
          "model",
          "input",
          "response_format"
        ],
        "additionalProperties": true
      },
      "RealtimeClientSecretRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "description": "One of the realtime models. Defaults to `gpt-realtime`.",
            "enum": [
              "gpt-realtime",
              "gpt-realtime-mini",
              "gpt-realtime-2.1-mini",
              "gemini-3.1-flash-live-preview",
              "gemini-3.8-live"
            ]
          }
        },
        "additionalProperties": true
      },
      "RealtimeClientSecret": {
        "type": "object",
        "properties": {
          "client_secret": {
            "type": "object",
            "properties": {
              "value": {
                "type": "string",
                "description": "Starts with `ek_`. Valid for 2 minutes; opens one WebSocket call."
              },
              "expires_at": {
                "type": "integer",
                "description": "Unix seconds."
              }
            },
            "required": [
              "value",
              "expires_at"
            ],
            "additionalProperties": true
          },
          "model": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "description": "The WebSocket to open: `wss://1xai.ir/rt/voice` or `wss://1xai.ir/rt/gemini`."
          }
        },
        "required": [
          "client_secret",
          "model",
          "url"
        ],
        "additionalProperties": true
      },
      "UsageRow": {
        "type": "object",
        "properties": {
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "model": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "description": "The model's vendor.",
            "enum": [
              "openai",
              "anthropic",
              "gemini",
              "deepseek",
              "xai",
              "moonshot",
              "zhipu",
              "alibaba",
              "minimax",
              "tencent"
            ]
          },
          "endpoint": {
            "type": "string",
            "description": "The route called, e.g. `/v1/chat/completions`; `refund` on a refund row."
          },
          "prompt_tokens": {
            "type": "integer"
          },
          "completion_tokens": {
            "type": "integer"
          },
          "total_tokens": {
            "type": "integer",
            "description": "On routes not billed by tokens, that route's unit: seconds of audio, characters, or images."
          },
          "cached_tokens": {
            "type": "integer",
            "description": "The part of `prompt_tokens` read from a cache."
          },
          "base_cost_usd": {
            "type": "number",
            "description": "The vendor's list price for this call in USD, before 1xAi's markup."
          },
          "cost_toman": {
            "type": "number",
            "description": "The full amount of this call in Toman, markup included."
          },
          "status_code": {
            "type": "integer"
          },
          "request_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "1xAi's id of the call: the `X-Request-Id` of its answer (`gw_…`). Null only on old rows that have none."
          },
          "request_body": {
            "type": [
              "string",
              "null"
            ],
            "description": "The logged start (and end) of the request text; null after 30 days. Through an API key, returned only for calls made with an API key."
          },
          "response_body": {
            "type": [
              "string",
              "null"
            ],
            "description": "The logged start (and end) of the response text; null after 30 days. Through an API key, returned only for calls made with an API key."
          },
          "request_body_truncated": {
            "type": "boolean"
          },
          "response_body_truncated": {
            "type": "boolean"
          },
          "key_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "workspace": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "additionalProperties": false
      },
      "UsagePage": {
        "type": "object",
        "properties": {
          "usage": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UsageRow"
            }
          },
          "total": {
            "type": "integer",
            "description": "Every row this key may read; with `request_id`, the number of rows returned."
          },
          "filtered_total": {
            "type": "integer",
            "description": "Rows matching the filters; with `request_id`, the number of rows returned."
          }
        },
        "required": [
          "usage",
          "total",
          "filtered_total"
        ],
        "additionalProperties": false
      },
      "UsageDaily": {
        "type": "object",
        "properties": {
          "day": {
            "type": "string",
            "description": "A day in Tehran time, `YYYY-MM-DD`."
          },
          "calls": {
            "type": "integer"
          },
          "tokens": {
            "type": "integer"
          },
          "cost_toman": {
            "type": "number"
          },
          "by_provider": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          }
        },
        "additionalProperties": true
      },
      "UsageSummary": {
        "type": "object",
        "properties": {
          "window_days": {
            "type": "integer"
          },
          "from": {
            "type": "string",
            "format": "date-time"
          },
          "to": {
            "type": "string",
            "format": "date-time"
          },
          "total_calls": {
            "type": "integer"
          },
          "ok_calls": {
            "type": "integer"
          },
          "error_calls": {
            "type": "integer"
          },
          "total_tokens": {
            "type": "integer"
          },
          "prompt_tokens": {
            "type": "integer"
          },
          "completion_tokens": {
            "type": "integer"
          },
          "total_cost_toman": {
            "type": "number"
          },
          "total_cost_usd": {
            "type": "number"
          },
          "average_cost_toman": {
            "type": "number"
          },
          "daily": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UsageDaily"
            }
          },
          "by_model": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "model": {
                  "type": "string"
                },
                "provider": {
                  "type": "string"
                },
                "calls": {
                  "type": "integer"
                },
                "tokens": {
                  "type": "integer"
                },
                "cost_toman": {
                  "type": "number"
                },
                "last_used_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "additionalProperties": false
            }
          },
          "by_provider": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "provider": {
                  "type": "string"
                },
                "calls": {
                  "type": "integer"
                },
                "tokens": {
                  "type": "integer"
                },
                "cost_toman": {
                  "type": "number"
                }
              },
              "additionalProperties": false
            }
          },
          "by_key": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key_id": {
                  "type": "integer"
                },
                "key_name": {
                  "type": "string"
                },
                "key_prefix": {
                  "type": "string"
                },
                "workspace": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "calls": {
                  "type": "integer"
                },
                "tokens": {
                  "type": "integer"
                },
                "cost_toman": {
                  "type": "number"
                },
                "last_used_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "additionalProperties": false
            }
          },
          "by_status": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "status_code": {
                  "type": "integer"
                },
                "count": {
                  "type": "integer"
                }
              },
              "additionalProperties": false
            }
          }
        },
        "additionalProperties": false
      },
      "WalletTransaction": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "kind": {
            "type": "string",
            "enum": [
              "topup",
              "charge",
              "refund",
              "adjustment",
              "gift"
            ]
          },
          "amount_toman": {
            "type": "number",
            "description": "Charges are negative."
          },
          "reference": {
            "type": "string",
            "description": "For a charge, the `X-Request-Id` of the call."
          },
          "balance_after_toman": {
            "type": "number"
          },
          "model": {
            "type": "string"
          }
        },
        "additionalProperties": true
      },
      "WalletTransactionPage": {
        "type": "object",
        "properties": {
          "transactions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WalletTransaction"
            }
          },
          "total": {
            "type": "integer"
          },
          "filtered_total": {
            "type": "integer"
          }
        },
        "required": [
          "transactions"
        ],
        "additionalProperties": false
      },
      "WalletSummary": {
        "type": "object",
        "properties": {
          "window_days": {
            "type": "integer"
          },
          "total_topups_toman": {
            "type": "number"
          },
          "total_gifts_toman": {
            "type": "number"
          },
          "total_charges_toman": {
            "type": "number"
          },
          "total_refunds_toman": {
            "type": "number"
          },
          "total_adjustments_toman": {
            "type": "number"
          },
          "net_change_toman": {
            "type": "number"
          },
          "balance_toman": {
            "type": "number",
            "description": "The current balance."
          },
          "by_kind_daily": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "date": {
                  "type": "string"
                },
                "topup": {
                  "type": "number"
                },
                "gift": {
                  "type": "number"
                },
                "charge": {
                  "type": "number"
                },
                "refund": {
                  "type": "number"
                },
                "adjustment": {
                  "type": "number"
                }
              },
              "additionalProperties": false
            }
          },
          "credit_granted_toman": {
            "type": "number"
          },
          "credit_spent_toman": {
            "type": "number"
          },
          "spendable_toman": {
            "type": "number",
            "description": "What can be spent right now: the balance less the amount held for requests in flight, plus gift credit usable on any model."
          }
        },
        "additionalProperties": false
      },
      "KeyControls": {
        "type": "object",
        "description": "What the key's owner restricted, and its rotation. Set in the dashboard; read-only here. https://1xai.ir/en/docs/key-controls",
        "properties": {
          "scope": {
            "type": "string",
            "description": "`full`: every route. `inference`: every route but the account API. `usage`: only `GET` on the account API (no model call).",
            "enum": [
              "full",
              "inference",
              "usage"
            ]
          },
          "allowed_models": {
            "type": "array",
            "description": "Exact model ids, or prefixes ending in `*`. Empty: every model.",
            "items": {
              "type": "string"
            }
          },
          "allowed_ips": {
            "type": "array",
            "description": "IPv4 or IPv6 addresses or CIDR ranges. Empty: any address.",
            "items": {
              "type": "string"
            }
          },
          "rate_limit_per_min": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The key's own limit; null: the account's."
          },
          "effective_rate_limit_per_min": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The limit the key is held to now (its `X-RateLimit-Limit`); null: none."
          },
          "rotated_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "The key's last rotation, RFC 3339."
          },
          "previous_secret_expires_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the secret before the last rotation stops working; null once it has."
          }
        },
        "required": [
          "scope",
          "allowed_models",
          "allowed_ips"
        ],
        "additionalProperties": false
      },
      "ApiKey": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "prefix": {
            "type": "string",
            "description": "The first characters of the key. The key itself is never returned."
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_used_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "revoked_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "cap_toman": {
            "type": [
              "number",
              "null"
            ],
            "description": "The spend cap; null for none."
          },
          "spent_toman": {
            "type": "number"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "controls": {
            "$ref": "#/components/schemas/KeyControls"
          }
        },
        "required": [
          "id",
          "prefix",
          "created_at"
        ],
        "additionalProperties": true
      },
      "KeyList": {
        "type": "object",
        "properties": {
          "keys": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiKey"
            }
          }
        },
        "required": [
          "keys"
        ],
        "additionalProperties": false
      },
      "KeyCurrent": {
        "type": "object",
        "description": "The key the request was sent with.",
        "properties": {
          "key": {
            "$ref": "#/components/schemas/ApiKey"
          }
        },
        "required": [
          "key"
        ],
        "additionalProperties": false
      },
      "WorkspaceKeyWallet": {
        "type": "object",
        "description": "`GET /v1/wallet/summary` as a company workspace key reads it: the spendable balance only. The ledger is the whole company's and is on the company dashboard.",
        "properties": {
          "scope": {
            "type": "string",
            "description": "Always `workspace`.",
            "enum": [
              "workspace"
            ]
          },
          "spendable_toman": {
            "type": "number",
            "description": "What the company account can spend right now."
          }
        },
        "required": [
          "scope",
          "spendable_toman"
        ],
        "additionalProperties": false
      },
      "MessageBatchRequest": {
        "type": "object",
        "description": "Anthropic's Message Batches request, forwarded as it is.",
        "properties": {
          "requests": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "custom_id": {
                  "type": "string"
                },
                "params": {
                  "$ref": "#/components/schemas/AnthropicMessagesRequest"
                }
              },
              "required": [
                "custom_id",
                "params"
              ],
              "additionalProperties": true
            }
          }
        },
        "required": [
          "requests"
        ],
        "additionalProperties": true
      },
      "MessageBatch": {
        "type": "object",
        "description": "Anthropic's batch object, relayed as it is except `results_url`, which names the results route on 1xAi.",
        "properties": {
          "id": {
            "type": "string",
            "examples": [
              "msgbatch_013Zva2CMHLNnXjNJJKqJ2EF"
            ]
          },
          "type": {
            "type": "string",
            "examples": [
              "message_batch"
            ]
          },
          "processing_status": {
            "type": "string",
            "enum": [
              "in_progress",
              "canceling",
              "ended"
            ]
          },
          "request_counts": {
            "type": "object",
            "additionalProperties": true
          },
          "created_at": {
            "type": "string"
          },
          "ended_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "expires_at": {
            "type": "string"
          },
          "results_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "The batch's results on 1xAi: `/anthropic/v1/messages/batches/{id}/results` on the host the request was sent to, so the Anthropic SDK's `messages.batches.results()` works with the 1xAi key. `null` until the results are ready."
          }
        },
        "additionalProperties": true
      },
      "KeyDetail": {
        "type": "object",
        "properties": {
          "key": {
            "$ref": "#/components/schemas/ApiKey"
          },
          "stats": {
            "type": "object",
            "properties": {
              "total_calls": {
                "type": "integer"
              },
              "ok_calls": {
                "type": "integer"
              },
              "total_tokens": {
                "type": "integer"
              },
              "total_cost_toman": {
                "type": "number"
              },
              "first_used_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "last_used_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "most_used_model": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "additionalProperties": false
          }
        },
        "required": [
          "key",
          "stats"
        ],
        "additionalProperties": false
      },
      "ServiceCredit": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "period": {
            "type": "string",
            "description": "The Jalali month, `YYYY-MM`, in Tehran time.",
            "examples": [
              "1405-09"
            ]
          },
          "month_fa": {
            "type": "string",
            "description": "The month's Persian name."
          },
          "period_start": {
            "type": "string",
            "format": "date-time"
          },
          "period_end": {
            "type": "string",
            "description": "Exclusive.",
            "format": "date-time"
          },
          "provider": {
            "type": "string",
            "description": "The vendor family.",
            "enum": [
              "openai",
              "anthropic",
              "gemini",
              "deepseek",
              "xai",
              "moonshot",
              "zhipu",
              "alibaba",
              "minimax",
              "tencent"
            ]
          },
          "rate_bp": {
            "type": "integer",
            "description": "The family's success rate that month, for all customers, on the credit's basis: the vendor's own outages left out. In basis points, rounded down. The tier is the one this rate falls in."
          },
          "rate_pct": {
            "type": "string",
            "description": "The same rate as a two-decimal string, rounded down.",
            "examples": [
              "99.39"
            ]
          },
          "eligible_requests": {
            "type": "integer",
            "description": "This account's eligible requests on that family in the month, on the credit's basis (the requests that failed because of the vendor alone are left out)."
          },
          "ok_requests": {
            "type": "integer",
            "description": "Of them, the successful ones."
          },
          "status_rate_bp": {
            "type": "integer",
            "description": "The family's success rate that month as the status page measures it, every failure counted, in basis points, rounded down. For information: the credit is decided on `rate_bp`."
          },
          "status_rate_pct": {
            "type": "string",
            "description": "The same rate as a two-decimal string, rounded down.",
            "examples": [
              "98.00"
            ]
          },
          "spend_toman": {
            "type": "integer",
            "description": "What this account's wallet paid for its calls on that family made in the month, less the refunds of those calls. Whole Toman."
          },
          "credit_pct": {
            "type": "integer",
            "description": "The tier's percentage."
          },
          "credit_toman": {
            "type": "integer",
            "description": "`floor(spend_toman × credit_pct / 100)`."
          },
          "state": {
            "type": "string",
            "description": "`paid`, or `pending`: certain to be paid as things stand.",
            "enum": [
              "pending",
              "paid"
            ]
          },
          "paid_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "Payment time, RFC 3339; null until paid."
          },
          "wallet_transaction_id": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The wallet ledger line of the payment (kind `gift`); null until paid."
          }
        },
        "additionalProperties": false
      },
      "ServiceCreditPage": {
        "type": "object",
        "properties": {
          "active": {
            "type": "boolean",
            "description": "The commitment is in force now."
          },
          "total_paid_toman": {
            "type": "integer",
            "description": "The sum of `credit_toman` over this page's `paid` rows."
          },
          "credits": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ServiceCredit"
            }
          }
        },
        "required": [
          "active",
          "total_paid_toman",
          "credits"
        ],
        "additionalProperties": false
      },
      "OpenAIFileUpload": {
        "type": "object",
        "properties": {
          "purpose": {
            "type": "string",
            "description": "Only `batch`; any other purpose answers 402 `path_unmetered`.",
            "enum": [
              "batch"
            ]
          },
          "file": {
            "type": "string",
            "description": "The JSONL input file: one request per line, at most 50000 requests, 8 MB a line and 25 MB in all.",
            "format": "binary"
          }
        },
        "required": [
          "purpose",
          "file"
        ],
        "additionalProperties": true
      },
      "OpenAIFile": {
        "type": "object",
        "description": "A batch file in OpenAI's shape. The upload relays OpenAI's answer; the reads come from 1xAi's records.",
        "properties": {
          "id": {
            "type": "string",
            "examples": [
              "file-abc123"
            ]
          },
          "object": {
            "type": "string",
            "enum": [
              "file"
            ]
          },
          "bytes": {
            "type": "integer"
          },
          "created_at": {
            "type": "integer",
            "description": "Unix seconds."
          },
          "expires_at": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix seconds when the file will be deleted at OpenAI: 1 day after its batch is settled, or after the upload for an input file no batch uses; `null` while its batch is open."
          },
          "filename": {
            "type": "string"
          },
          "purpose": {
            "type": "string",
            "description": "`batch` for an input file, `batch_output` for a batch's output or error file.",
            "enum": [
              "batch",
              "batch_output"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "processed"
            ]
          },
          "status_details": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "object",
          "bytes",
          "created_at",
          "filename",
          "purpose"
        ],
        "additionalProperties": true
      },
      "OpenAIFileList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OpenAIFile"
            }
          },
          "first_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "required": [
          "object",
          "data",
          "has_more"
        ],
        "additionalProperties": false
      },
      "OpenAIFileDeleted": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "enum": [
              "file"
            ]
          },
          "deleted": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "object",
          "deleted"
        ],
        "additionalProperties": false
      },
      "OpenAIBatchRequest": {
        "type": "object",
        "description": "Other fields (such as `output_expires_after`) are ignored: 1xAi sets the retention.",
        "properties": {
          "input_file_id": {
            "type": "string",
            "description": "A checked input file of yours (`POST /v1/files`) that was not deleted.",
            "examples": [
              "file-abc123"
            ]
          },
          "endpoint": {
            "type": "string",
            "description": "The `url` of every line of that file.",
            "enum": [
              "/v1/chat/completions",
              "/v1/embeddings"
            ]
          },
          "completion_window": {
            "type": "string",
            "enum": [
              "24h"
            ]
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Sent to OpenAI as it is."
          }
        },
        "required": [
          "input_file_id",
          "endpoint",
          "completion_window"
        ],
        "additionalProperties": true
      },
      "OpenAIBatch": {
        "type": "object",
        "description": "OpenAI's batch object, as OpenAI last reported it, with our organisation's id removed.",
        "properties": {
          "id": {
            "type": "string",
            "examples": [
              "batch_abc123"
            ]
          },
          "object": {
            "type": "string",
            "enum": [
              "batch"
            ]
          },
          "endpoint": {
            "type": "string"
          },
          "input_file_id": {
            "type": "string"
          },
          "completion_window": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "validating",
              "failed",
              "in_progress",
              "finalizing",
              "completed",
              "expired",
              "cancelling",
              "cancelled"
            ]
          },
          "output_file_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "One line per completed request."
          },
          "error_file_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "One line per failed or expired request."
          },
          "request_counts": {
            "type": "object",
            "properties": {
              "total": {
                "type": "integer"
              },
              "completed": {
                "type": "integer"
              },
              "failed": {
                "type": "integer"
              }
            },
            "additionalProperties": true
          },
          "created_at": {
            "type": "integer"
          },
          "metadata": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "OpenAIBatchList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OpenAIBatch"
            }
          },
          "first_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "has_more": {
            "type": "boolean"
          }
        },
        "required": [
          "object",
          "data",
          "has_more"
        ],
        "additionalProperties": false
      }
    }
  }
}
