{
  "openapi": "3.1.0",
  "info": {
    "title": "Mixen API",
    "description": "OpenAI-compatible API for [Mixen AI](https://mixen.ai). **Drop-in**: point any\nOpenAI client at this base URL and use your Mixen key — nothing else changes.\n\n```python\nfrom openai import OpenAI\n\nclient = OpenAI(base_url=\"https://api.mixen.ai/v1\", api_key=\"mxn-...\")\nresp = client.chat.completions.create(\n    model=\"gpt-5.5\",\n    messages=[{\"role\": \"user\", \"content\": \"Hello!\"}],\n)\n```\n\n* **Auth** — `Authorization: Bearer mxn-...`. Create keys in your\n  [cabinet](https://mixen.ai/account/profile/api).\n* **Billing** — from your Mixen balance.\n* **Rate limit** — 60 requests/min per key by default (`429` + `Retry-After`).\n* **Endpoints** — `chat/completions`, `images/generations`, `audio/speech` (TTS),\n  `audio/transcriptions` (STT), `embeddings`, `models`.\n* **Models** — `GET /models` returns the live catalog with display names, pricing\n  (RUB + USD, identical to what is charged) and capabilities. Pass the `id` (or a\n  common OpenAI/Claude/Gemini name, e.g. `gpt-4o`, `claude-opus`) in the `model` field.\n\n## Wire protocols\n\nThe same models and the same key are reachable over four request formats — pick the\none your client already speaks:\n\n| Protocol | Base URL | Auth header | Used by |\n| --- | --- | --- | --- |\n| OpenAI Chat Completions | `https://api.mixen.ai/v1` | `Authorization: Bearer` | OpenAI SDK, most tools |\n| OpenAI Responses | `https://api.mixen.ai/v1` | `Authorization: Bearer` | Codex CLI, OpenAI Agents SDK |\n| Anthropic Messages | `https://api.mixen.ai` | `Authorization: Bearer` | Claude Code, Anthropic SDK |\n| Google Gemini | `https://api.mixen.ai/v1beta` | `x-goog-api-key` | gemini-cli, google-genai SDK |\n\n`POST /responses`, `POST /messages` and `POST /messages/count_tokens` are listed below.\nThe Gemini surface is not part of this schema — its routes are addressed Google-style\n(`POST /v1beta/models/{model}:generateContent`, `:streamGenerateContent`, plus\n`GET /v1beta/models`), which OpenAPI paths cannot express; see the\n[gemini-cli guide](https://api.mixen.ai/docs/en/integrations/gemini-cli/).\n",
    "version": "1.0"
  },
  "paths": {
    "/models": {
      "get": {
        "tags": [
          "models"
        ],
        "summary": "List models",
        "description": "Live catalog of available models with display names, per-unit pricing (RUB + USD, identical to what is charged) and capabilities. Each entry has a `type` (text/search/image/video/music/tts/stt/embeddings) telling you which endpoint to call. For text models, `capabilities.reasoning_efforts` lists the valid `reasoning_effort` values and `can_disable_reasoning` whether `\"off\"` is accepted; image models expose `references` (image-to-image via /images/edits); `native_search` marks models with the provider's built-in web search (set `web_search: \"native\"` on chat completions). Pass an `id` in the `model` field of a request; common OpenAI/Anthropic/Google names (e.g. `gpt-4o`, `claude-opus`) are also accepted.",
        "operationId": "list_models",
        "responses": {
          "200": {
            "description": "Catalog entries",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "type": "object",
                  "title": "Response List Models"
                },
                "example": {
                  "object": "list",
                  "data": [
                    {
                      "id": "openai/gpt-6-sol",
                      "object": "model",
                      "type": "text",
                      "name": "GPT-6 Sol",
                      "created": 1788000000,
                      "description": "Balanced tier of the GPT-6 family.",
                      "pricing": {
                        "prompt_rub": "228.0",
                        "completion_rub": "1139.9",
                        "prompt_usd": "2.5",
                        "completion_usd": "12.5",
                        "currency_note": "per 1M tokens"
                      },
                      "capabilities": {
                        "reasoning": true,
                        "reasoning_efforts": [
                          "low",
                          "medium",
                          "high",
                          "xhigh",
                          "max"
                        ],
                        "can_disable_reasoning": true,
                        "vision": true,
                        "file": true,
                        "video": false,
                        "audio": false,
                        "native_search": true
                      }
                    },
                    {
                      "id": "openai/gpt-image-2.5-flare",
                      "object": "model",
                      "type": "image",
                      "name": "GPT Image 2.5 Flare",
                      "created": 1785000000,
                      "pricing": {
                        "per_image_rub": "4.1038",
                        "per_image_usd": "0.045"
                      },
                      "capabilities": {
                        "references": true
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/balance": {
      "get": {
        "tags": [
          "balance"
        ],
        "summary": "Get balance",
        "description": "Available balance of the account that owns this API key, in rubles. The same balance is shared by the Telegram bot, the web cabinet and the API. `balance_rub` is a string with two decimals — parse it as a decimal, not a float, to avoid losing sub-cent precision. Read-only: recharges go through the cabinet.",
        "operationId": "get_balance",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/history": {
      "get": {
        "tags": [
          "history"
        ],
        "summary": "List balance transactions",
        "description": "Balance movements of the account that owns this API key: generation charges (negative), top-ups, bonuses and referrals (positive), newest first. `amount_rub` is a decimal string with up to 4 decimals — the exact charged value. `model` is the model id for generation charges and `null` for top-ups. Paginated with a cursor: pass `next_cursor` from the response as the `cursor` query parameter to get the next older page.",
        "operationId": "list_history",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Transaction id from a previous response's next_cursor; returns older items.",
              "title": "Cursor"
            },
            "description": "Transaction id from a previous response's next_cursor; returns older items."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 200,
              "minimum": 1,
              "description": "Page size, max 200.",
              "default": 50,
              "title": "Limit"
            },
            "description": "Page size, max 200."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/generations": {
      "get": {
        "tags": [
          "generations"
        ],
        "summary": "List generations",
        "description": "Previously generated artifacts of the account that owns this API key: images, videos and music from the bot, the web cabinet and the API alike — newest first. Pass `next_cursor` as `cursor` for the next older page. Fetch the artifact bytes from /v1/generations/{type}/{id}/content. Prompts are returned as stored; `charged_rub` is a decimal string.",
        "operationId": "list_generations",
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "required": true,
            "schema": {
              "enum": [
                "image",
                "video",
                "music"
              ],
              "type": "string",
              "description": "Artifact kind — histories live in separate tables with separate ids.",
              "title": "Type"
            },
            "description": "Artifact kind — histories live in separate tables with separate ids."
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Item id from a previous response's next_cursor.",
              "title": "Cursor"
            },
            "description": "Item id from a previous response's next_cursor."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 200,
              "minimum": 1,
              "description": "Page size, max 200.",
              "default": 50,
              "title": "Limit"
            },
            "description": "Page size, max 200."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/generations/{gen_type}/{gen_id}/content": {
      "get": {
        "tags": [
          "generations"
        ],
        "summary": "Download generation content",
        "description": "Artifact bytes (image, video or audio) of a generation from GET /v1/generations. Supports HTTP Range for video/audio playback.",
        "operationId": "generation_content",
        "parameters": [
          {
            "name": "gen_type",
            "in": "path",
            "required": true,
            "schema": {
              "enum": [
                "image",
                "video",
                "music"
              ],
              "type": "string",
              "title": "Gen Type"
            }
          },
          {
            "name": "gen_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Gen Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/files": {
      "post": {
        "tags": [
          "files"
        ],
        "summary": "Upload file",
        "description": "Upload a file to your storage. `policy=temp` keeps it for 7 days (then it is deleted automatically), `policy=permanent` — indefinitely, counted against the 1 GB permanent quota. Max size 25 MB. Use stored files as `file_data`/`image_url` inputs (fetch /v1/files/{id}/content) or just to keep results.",
        "operationId": "upload_file",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_upload_file"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "files"
        ],
        "summary": "List files",
        "description": "Your stored files, newest first. Cursor pagination like the other history endpoints: pass `next_cursor` as `cursor`.",
        "operationId": "list_files",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "File id from next_cursor.",
              "title": "Cursor"
            },
            "description": "File id from next_cursor."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 200,
              "minimum": 1,
              "default": 50,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/files/stats": {
      "get": {
        "tags": [
          "files"
        ],
        "summary": "Storage stats",
        "description": "Counts and volumes of your storage: temp and permanent separately, the permanent quota and how much of it is used.",
        "operationId": "files_stats",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/files/{file_id}": {
      "get": {
        "tags": [
          "files"
        ],
        "summary": "Retrieve file",
        "description": "Metadata of one stored file.",
        "operationId": "get_file",
        "parameters": [
          {
            "name": "file_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "File Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "files"
        ],
        "summary": "Delete file",
        "description": "Deletes the file and its metadata permanently.",
        "operationId": "delete_file",
        "parameters": [
          {
            "name": "file_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "File Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/files/{file_id}/content": {
      "get": {
        "tags": [
          "files"
        ],
        "summary": "Download file content",
        "description": "File bytes with the original mime type. Supports HTTP Range.",
        "operationId": "file_content",
        "parameters": [
          {
            "name": "file_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "File Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/files/{file_id}/keep": {
      "patch": {
        "tags": [
          "files"
        ],
        "summary": "Keep file forever",
        "description": "Switches a temp file to permanent storage: no expiry, counted against the 1 GB permanent quota.",
        "operationId": "keep_file",
        "parameters": [
          {
            "name": "file_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "File Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/chat/completions": {
      "post": {
        "tags": [
          "chat"
        ],
        "summary": "Create chat completion",
        "description": "OpenAI-compatible chat completion. Set `stream=true` for SSE token streaming; otherwise returns a single `chat.completion` object. Charged per-token from balance. Supports vision (image_url data: parts on vision models) and Perplexity Sonar (category=search models) — web results return as message.annotations (url_citation).",
        "operationId": "chat_completions",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatCompletionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/images/generations": {
      "post": {
        "tags": [
          "images"
        ],
        "summary": "Create image",
        "description": "OpenAI-compatible text-to-image. Returns base64 images (`b64_json`); `url` is not supported. Models: see GET /models (image), or `dall-e-3`/`gpt-image-1`. Charged per image.",
        "operationId": "create_image",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImageGenRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/images/price": {
      "post": {
        "tags": [
          "images"
        ],
        "summary": "Quote an image",
        "description": "Price of POST /images/generations for the same body, without generating or charging. Computed with the same formula as the actual charge (per image × n).",
        "operationId": "price_image",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImageGenRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/images/edits": {
      "post": {
        "tags": [
          "images"
        ],
        "summary": "Edit image (image-to-image)",
        "description": "OpenAI-compatible image-to-image: multipart `image` (one or more reference images) + `prompt` + `model`. Returns base64 (`b64_json`). Only models that accept image input (GET /models → image with `references: true`): Nano Banana / GPT Image 2 / Seedream / Flux. `aspect_ratio`+`resolution` (or `size`) optional. Charged per image.",
        "operationId": "create_image_edit",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_create_image_edit"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/images/upscale": {
      "post": {
        "tags": [
          "images"
        ],
        "summary": "Upscale image",
        "description": "Upscales an image 2× or 4× (Real-ESRGAN, face enhance on). Multipart: `image` file + `scale` (2 or 4, default 4). Input cap: the side is reduced so the output stays within 4K. Returns base64 (`b64_json`); the result is also saved to your generations history (GET /v1/generations?type=image). Charged per image.",
        "operationId": "upscale_image",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_upscale_image"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/audio/speech": {
      "post": {
        "tags": [
          "audio"
        ],
        "summary": "Text to speech",
        "description": "OpenAI-compatible TTS. Returns mp3 audio. Served by gpt-4o-mini-tts; OpenAI voices (alloy, echo, fable, nova, shimmer, ...) are accepted. Charged per input characters (most models) or per second of generated audio (seed-audio, gemini TTS).",
        "operationId": "create_speech",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SpeechRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/audio/transcriptions": {
      "post": {
        "tags": [
          "audio"
        ],
        "summary": "Transcribe audio",
        "description": "OpenAI-compatible STT (multipart: file + model). Served by whisper-large-v3-turbo. Returns `{\"text\": ..., \"usage\": {\"cost\", \"cost_rub\", \"billing_source\"}}` (or plain text if response_format=text). Charged per minute of audio. Max file size 25 MB.",
        "operationId": "create_transcription",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_create_transcription"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/embeddings": {
      "post": {
        "tags": [
          "embeddings"
        ],
        "summary": "Create embeddings",
        "description": "OpenAI-compatible embeddings. `input` is a string or array of strings. Models: text-embedding-3-small (1536-dim) / -large (3072-dim), qwen/qwen3-embedding-8b, qwen/qwen3-embedding-4b, google/gemini-embedding-2. Charged per input token.",
        "operationId": "create_embeddings_ep",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmbeddingsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/decisions": {
      "post": {
        "tags": [
          "decisions"
        ],
        "summary": "Submit a Decisions request",
        "description": "Structured decisions (e.g. `typesafe/jev-1.13`, `openai/gpt-6-luna-decisions`): send `state` and typed `questions` (noul / choice / score), get back typed answers with probabilities instead of generated text. Charged per input token; output tokens are free. See the Decisions guide in API docs.",
        "operationId": "create_decision_ep",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DecisionsApiRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/videos": {
      "post": {
        "tags": [
          "videos"
        ],
        "summary": "Create video",
        "description": "OpenAI-compatible async video job. Returns a Video object (status=queued). Poll GET /videos/{id} until status=completed, then GET /videos/{id}/content for the mp4. Models: see GET /models (video), e.g. veo-3.1-fast, kling-v3-pro, seedance-2.5, happyhorse-1.1.",
        "operationId": "create_video",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VideoCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/videos/price": {
      "post": {
        "tags": [
          "videos"
        ],
        "summary": "Quote a video",
        "description": "Price of POST /videos for the same body, without creating a job or charging. Computed with the same formula as the actual charge (resolution, duration, references).",
        "operationId": "price_video",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VideoCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/videos/{video_id}": {
      "get": {
        "tags": [
          "videos"
        ],
        "summary": "Retrieve video",
        "description": "Poll the video job. status: queued | in_progress | completed | failed.",
        "operationId": "get_video",
        "parameters": [
          {
            "name": "video_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Video Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/videos/upscale": {
      "post": {
        "tags": [
          "videos"
        ],
        "summary": "Upscale a video",
        "description": "Video upscaling (FLUX Video Upscale). Multipart: a `video` file (mp4), optional `prompt`, `upscale_factor` (1.5–3.0, default 1.5) and `creativity` (0.0–1.0, default 0.0). Billed per megapixel-second of the output: the amount depends on the source resolution and duration, so it is settled once the job completes. Returns a Video object; poll GET /videos/{id}.",
        "operationId": "create_video_upscale",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_create_video_upscale"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/videos/{video_id}/content": {
      "get": {
        "tags": [
          "videos"
        ],
        "summary": "Download video content",
        "description": "Returns the mp4 (Range supported) once status=completed.",
        "operationId": "get_video_content",
        "parameters": [
          {
            "name": "video_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Video Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/audio/music": {
      "post": {
        "tags": [
          "music"
        ],
        "summary": "Create music",
        "description": "Async music generation (job+poll). Suno (model \"suno\") returns 2 tracks; Lyria (\"lyria\"/\"lyria-pro\") returns 1 instrumental track. Poll GET /audio/music/{id} until status=completed, then GET .../content?index=N for the mp3.",
        "operationId": "create_music",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MusicCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/audio/music/price": {
      "post": {
        "tags": [
          "music"
        ],
        "summary": "Quote a music generation",
        "description": "Price of POST /audio/music for the same body, without creating a job or charging (flat per generation: Suno — 2 tracks, Lyria — 1).",
        "operationId": "price_music",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MusicCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/audio/music/{music_id}": {
      "get": {
        "tags": [
          "music"
        ],
        "summary": "Retrieve music",
        "description": "Poll the music job. status: queued | in_progress | completed | failed.",
        "operationId": "get_music",
        "parameters": [
          {
            "name": "music_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Music Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/audio/music/{music_id}/content": {
      "get": {
        "tags": [
          "music"
        ],
        "summary": "Download music content",
        "description": "Returns an mp3 track (Range supported) once status=completed. Use ?index=N to select a track (Suno yields 2, Lyria 1; default 0).",
        "operationId": "get_music_content",
        "parameters": [
          {
            "name": "music_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Music Id"
            }
          },
          {
            "name": "index",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 0,
              "title": "Index"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/messages": {
      "post": {
        "tags": [
          "chat"
        ],
        "summary": "Create a message (Anthropic-compatible)",
        "description": "Anthropic Messages API compatible endpoint for Claude Code / Anthropic SDK. Streaming: SSE events message_start/content_block_*/message_delta/message_stop.",
        "operationId": "create_message",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AnthropicMessagesRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/messages/count_tokens": {
      "post": {
        "tags": [
          "chat"
        ],
        "summary": "Count tokens (Anthropic-compatible)",
        "description": "Cheap ~chars/4 estimate without an upstream call. Used by Claude Code for context/compact decisions.",
        "operationId": "count_tokens",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CountTokensRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/responses": {
      "post": {
        "tags": [
          "chat"
        ],
        "summary": "Create a response (OpenAI Responses-compatible)",
        "description": "OpenAI Responses API compatible endpoint for Codex CLI / OpenAI Agents SDK. Stateless: send the full input on every request (previous_response_id/store are not supported). Streaming: SSE events response.created / response.output_item.* / response.output_text.* / response.completed.",
        "operationId": "create_response",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResponsesRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AnthropicMessagesRequest": {
        "properties": {
          "model": {
            "type": "string",
            "title": "Model"
          },
          "max_tokens": {
            "type": "integer",
            "minimum": 1.0,
            "title": "Max Tokens"
          },
          "messages": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Messages"
          },
          "system": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "System"
          },
          "tools": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tools"
          },
          "tool_choice": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tool Choice"
          },
          "temperature": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Temperature"
          },
          "top_p": {
            "anyOf": [
              {
                "type": "number",
                "maximum": 1.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Top P"
          },
          "top_k": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Top K"
          },
          "stream": {
            "type": "boolean",
            "title": "Stream",
            "default": false
          },
          "stop_sequences": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stop Sequences"
          },
          "thinking": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Thinking"
          },
          "provider": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Provider"
          },
          "service_tier": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Service Tier"
          },
          "metadata": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Metadata"
          }
        },
        "type": "object",
        "required": [
          "model",
          "max_tokens",
          "messages"
        ],
        "title": "AnthropicMessagesRequest"
      },
      "Body_create_image_edit": {
        "properties": {
          "image": {
            "items": {
              "type": "string",
              "contentMediaType": "application/octet-stream"
            },
            "type": "array",
            "title": "Image",
            "description": "Reference image(s) for image-to-image."
          },
          "model": {
            "type": "string",
            "title": "Model"
          },
          "prompt": {
            "type": "string",
            "title": "Prompt"
          },
          "n": {
            "type": "integer",
            "title": "N",
            "default": 1
          },
          "size": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Size"
          },
          "aspect_ratio": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Aspect Ratio"
          },
          "resolution": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Resolution"
          },
          "quality": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Quality"
          },
          "background": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Background"
          },
          "output_format": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Output Format"
          },
          "response_format": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Response Format"
          }
        },
        "type": "object",
        "required": [
          "image",
          "model",
          "prompt"
        ],
        "title": "Body_create_image_edit"
      },
      "Body_create_transcription": {
        "properties": {
          "file": {
            "type": "string",
            "contentMediaType": "application/octet-stream",
            "title": "File"
          },
          "model": {
            "type": "string",
            "title": "Model",
            "default": "whisper-1"
          },
          "language": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Language"
          },
          "response_format": {
            "type": "string",
            "title": "Response Format",
            "default": "json"
          }
        },
        "type": "object",
        "required": [
          "file"
        ],
        "title": "Body_create_transcription"
      },
      "Body_create_video_upscale": {
        "properties": {
          "video": {
            "type": "string",
            "contentMediaType": "application/octet-stream",
            "title": "Video",
            "description": "Source mp4 to enlarge"
          },
          "prompt": {
            "type": "string",
            "title": "Prompt",
            "default": "Upscale this video, keep every detail sharp"
          },
          "upscale_factor": {
            "type": "number",
            "title": "Upscale Factor",
            "default": 1.5
          },
          "creativity": {
            "type": "number",
            "title": "Creativity",
            "default": 0.0
          }
        },
        "type": "object",
        "required": [
          "video"
        ],
        "title": "Body_create_video_upscale"
      },
      "Body_upload_file": {
        "properties": {
          "file": {
            "type": "string",
            "contentMediaType": "application/octet-stream",
            "title": "File"
          },
          "policy": {
            "type": "string",
            "enum": [
              "temp",
              "permanent"
            ],
            "title": "Policy",
            "default": "temp"
          }
        },
        "type": "object",
        "required": [
          "file"
        ],
        "title": "Body_upload_file"
      },
      "Body_upscale_image": {
        "properties": {
          "image": {
            "type": "string",
            "contentMediaType": "application/octet-stream",
            "title": "Image"
          },
          "scale": {
            "type": "integer",
            "title": "Scale",
            "default": 4
          }
        },
        "type": "object",
        "required": [
          "image"
        ],
        "title": "Body_upscale_image"
      },
      "ChatCompletionRequest": {
        "properties": {
          "model": {
            "type": "string",
            "title": "Model",
            "description": "Model id from GET /models, or a common OpenAI/Claude/Gemini alias."
          },
          "messages": {
            "items": {
              "$ref": "#/components/schemas/_Msg"
            },
            "type": "array",
            "title": "Messages",
            "description": "Conversation so far; the last user message is the prompt."
          },
          "stream": {
            "type": "boolean",
            "title": "Stream",
            "description": "If true, stream tokens as SSE (text/event-stream).",
            "default": false
          },
          "stream_options": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stream Options",
            "description": "e.g. {\"include_usage\": true} to append a usage chunk."
          },
          "temperature": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Temperature"
          },
          "max_tokens": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Tokens"
          },
          "max_completion_tokens": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Completion Tokens"
          },
          "reasoning_effort": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "off",
                  "low",
                  "medium",
                  "high",
                  "xhigh",
                  "max"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Reasoning Effort"
          },
          "tools": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tools"
          },
          "tool_choice": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ],
            "title": "Tool Choice"
          },
          "response_format": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Response Format"
          },
          "web_search": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "string",
                "enum": [
                  "auto",
                  "native",
                  "exa"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Web Search"
          },
          "provider": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Provider",
            "description": "OpenRouter provider routing, passed through as-is: order, only, ignore, sort, allow_fallbacks, data_collection, zdr, quantizations, max_price."
          },
          "service_tier": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "flex",
                  "priority"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Service Tier",
            "description": "Service tier of the same provider: \"flex\" (cheaper, best-effort) or \"priority\" (faster, dearer). Ignored by models that have no such tier."
          },
          "stop": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array",
                "maxItems": 4
              },
              {
                "type": "null"
              }
            ],
            "title": "Stop",
            "description": "Up to 4 sequences where the model stops generating further tokens."
          },
          "seed": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Seed",
            "description": "Sampling seed for best-effort reproducibility."
          },
          "top_p": {
            "anyOf": [
              {
                "type": "number",
                "maximum": 1.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Top P",
            "description": "Nucleus sampling: consider tokens covering this probability mass."
          },
          "top_k": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Top K",
            "description": "Consider only the K most likely tokens. Open-weight models only."
          },
          "min_p": {
            "anyOf": [
              {
                "type": "number",
                "maximum": 1.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Min P",
            "description": "Drop tokens below this share of the top token probability."
          },
          "frequency_penalty": {
            "anyOf": [
              {
                "type": "number",
                "maximum": 2.0,
                "minimum": -2.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Frequency Penalty",
            "description": "Penalise tokens by how often they already appeared."
          },
          "presence_penalty": {
            "anyOf": [
              {
                "type": "number",
                "maximum": 2.0,
                "minimum": -2.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Presence Penalty",
            "description": "Penalise tokens that appeared at all."
          },
          "repetition_penalty": {
            "anyOf": [
              {
                "type": "number",
                "maximum": 2.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Repetition Penalty",
            "description": "Penalise repetition of the prompt and the answer so far."
          },
          "logprobs": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Logprobs",
            "description": "Return log probabilities of the output tokens."
          },
          "top_logprobs": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 20.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Top Logprobs",
            "description": "How many alternatives per position to return; requires logprobs."
          },
          "plugins": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Plugins",
            "description": "Upstream plugins, passed through as-is: e.g. [{\"id\": \"jev-router\", \"models\": [\"anthropic/*\", \"openai/gpt-6*\"]}] to constrain the Jev Router model pool (also allowed_models, excluded_models, cost_tier)."
          }
        },
        "type": "object",
        "required": [
          "model",
          "messages"
        ],
        "title": "ChatCompletionRequest",
        "example": {
          "messages": [
            {
              "content": "Hello!",
              "role": "user"
            }
          ],
          "model": "gpt-5.5",
          "stream": false
        }
      },
      "CountTokensRequest": {
        "properties": {
          "model": {
            "type": "string",
            "title": "Model"
          },
          "max_tokens": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Tokens"
          },
          "messages": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Messages"
          },
          "system": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "System"
          },
          "tools": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tools"
          },
          "tool_choice": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tool Choice"
          },
          "temperature": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Temperature"
          },
          "top_p": {
            "anyOf": [
              {
                "type": "number",
                "maximum": 1.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Top P"
          },
          "top_k": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Top K"
          },
          "stream": {
            "type": "boolean",
            "title": "Stream",
            "default": false
          },
          "stop_sequences": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stop Sequences"
          },
          "thinking": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Thinking"
          },
          "provider": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Provider"
          },
          "service_tier": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Service Tier"
          },
          "metadata": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Metadata"
          }
        },
        "type": "object",
        "required": [
          "model",
          "messages"
        ],
        "title": "CountTokensRequest"
      },
      "DecisionsApiRequest": {
        "properties": {
          "model": {
            "type": "string",
            "title": "Model"
          },
          "state": {
            "anyOf": [
              {},
              {
                "type": "string"
              },
              {
                "items": {},
                "type": "array"
              }
            ],
            "title": "State"
          },
          "questions": {
            "additionalProperties": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "object",
            "title": "Questions"
          },
          "session_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Session Id"
          },
          "user": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User"
          }
        },
        "type": "object",
        "required": [
          "model",
          "state",
          "questions"
        ],
        "title": "DecisionsApiRequest",
        "description": "OR Decisions API-форма (System One: typesafe/jev-*).\n\nstate — string | object | array; questions — map имя→{type: noul|choice|\nscore, instructions, criteria}. Детальная семантика критериев валидирует\nOR — наш слой резолвит модель, биллит по usage.cost и логирует."
      },
      "EmbeddingsRequest": {
        "properties": {
          "model": {
            "type": "string",
            "title": "Model",
            "description": "text-embedding-3-small | text-embedding-3-large (or text-embedding-ada-002) | qwen/qwen3-embedding-8b | qwen/qwen3-embedding-4b | google/gemini-embedding-2."
          },
          "input": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            ],
            "title": "Input",
            "description": "A string or array of strings to embed."
          },
          "encoding_format": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Encoding Format"
          }
        },
        "type": "object",
        "required": [
          "model",
          "input"
        ],
        "title": "EmbeddingsRequest",
        "example": {
          "input": "hello world",
          "model": "text-embedding-3-small"
        }
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "ImageGenRequest": {
        "properties": {
          "model": {
            "type": "string",
            "title": "Model",
            "description": "Image model id from GET /models, or dall-e-3 / gpt-image-1."
          },
          "prompt": {
            "type": "string",
            "title": "Prompt"
          },
          "n": {
            "type": "integer",
            "maximum": 4.0,
            "minimum": 1.0,
            "title": "N",
            "description": "Number of images (1-4).",
            "default": 1
          },
          "size": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Size",
            "description": "WxH; allowed values are per-model (see GET /models). Alternative to aspect_ratio+resolution."
          },
          "aspect_ratio": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Aspect Ratio",
            "description": "E.g. 16:9; allowed values are per-model (see GET /models). Defaults to 1:1."
          },
          "resolution": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Resolution",
            "description": "1k | 2k | 4k; allowed values are per-model (see GET /models). Defaults to 1k."
          },
          "background": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Background",
            "description": "transparent | opaque | auto — GPT Image 2.5 only; transparent requires png/webp output_format."
          },
          "output_format": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Output Format",
            "description": "png | jpeg | webp — GPT Image 2.5 only; default png."
          },
          "quality": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Quality",
            "description": "low | medium — only on models exposing a quality knob (e.g. grok-imagine-image-2)."
          },
          "response_format": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Response Format"
          }
        },
        "type": "object",
        "required": [
          "model",
          "prompt"
        ],
        "title": "ImageGenRequest",
        "example": {
          "model": "gpt-image-1",
          "prompt": "a red cat",
          "size": "1024x1024"
        }
      },
      "MusicCreateRequest": {
        "properties": {
          "idempotency_key": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 128,
                "minLength": 1
              },
              {
                "type": "null"
              }
            ],
            "title": "Idempotency Key",
            "description": "Client idempotency key: a repeated request with the same key (per API key owner) returns the already created job instead of creating and charging a new one."
          },
          "webhook_url": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2048
              },
              {
                "type": "null"
              }
            ],
            "title": "Webhook Url",
            "description": "Public https URL; when the job reaches completed/failed we POST the same job object that GET returns. Signed with X-Mixen-Signature (t=<unix>,v1=<hex>): HMAC-SHA256 over \"<t>.<raw body>\", secret = sha256 hex of your API key. Retries at 5/20/60/180 s on non-2xx."
          },
          "wait": {
            "type": "boolean",
            "title": "Wait",
            "description": "Hold the request until the job is terminal (or wait_timeout) and return the final job object. Default false — return the queued job immediately and poll.",
            "default": false
          },
          "wait_timeout": {
            "type": "integer",
            "maximum": 300.0,
            "minimum": 1.0,
            "title": "Wait Timeout",
            "description": "Seconds to wait when wait=true; on timeout the job is returned as is (still running).",
            "default": 60
          },
          "model": {
            "type": "string",
            "title": "Model",
            "description": "suno / suno-v6 (song with vocals, 2 tracks) or lyria / lyria-pro (instrumental, 1 track).",
            "default": "suno"
          },
          "prompt": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 5000
              },
              {
                "type": "null"
              }
            ],
            "title": "Prompt",
            "description": "Track description (Suno simple / Lyria). Unused in Suno custom mode."
          },
          "mode": {
            "type": "string",
            "title": "Mode",
            "description": "Suno: simple (from prompt) | custom (from lyrics+style+title). Ignored by Lyria.",
            "default": "simple"
          },
          "lyrics": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 5000
              },
              {
                "type": "null"
              }
            ],
            "title": "Lyrics",
            "description": "Suno custom: song lyrics."
          },
          "style": {
            "type": "string",
            "maxLength": 500,
            "title": "Style",
            "description": "Suno custom: genre, style, tags.",
            "default": ""
          },
          "title": {
            "type": "string",
            "maxLength": 200,
            "title": "Title",
            "description": "Suno custom: track title.",
            "default": ""
          }
        },
        "type": "object",
        "title": "MusicCreateRequest",
        "example": {
          "model": "suno",
          "prompt": "lo-fi hip-hop, rain outside the window, calm"
        }
      },
      "ResponsesRequest": {
        "properties": {
          "model": {
            "type": "string",
            "title": "Model"
          },
          "input": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              }
            ],
            "title": "Input"
          },
          "instructions": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Instructions"
          },
          "tools": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tools"
          },
          "tool_choice": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ],
            "title": "Tool Choice"
          },
          "max_output_tokens": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Output Tokens"
          },
          "temperature": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Temperature"
          },
          "reasoning": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reasoning"
          },
          "stream": {
            "type": "boolean",
            "title": "Stream",
            "default": false
          },
          "top_p": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Top P"
          },
          "provider": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Provider"
          },
          "service_tier": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Service Tier"
          },
          "previous_response_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Previous Response Id"
          },
          "store": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Store"
          },
          "background": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Background"
          },
          "metadata": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Metadata"
          },
          "text": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ],
            "title": "Text"
          }
        },
        "type": "object",
        "required": [
          "model",
          "input"
        ],
        "title": "ResponsesRequest",
        "description": "Запрос /v1/responses. extra='ignore': drop-in клиенты шлют много\nне-MVP полей (parallel_tool_calls, truncation, user…) — молча терпим."
      },
      "SpeechRequest": {
        "properties": {
          "model": {
            "type": "string",
            "title": "Model",
            "description": "Accepted for compatibility; served by gpt-4o-mini-tts.",
            "default": "tts-1"
          },
          "input": {
            "type": "string",
            "title": "Input",
            "description": "Text to synthesize."
          },
          "voice": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Voice",
            "description": "alloy, echo, fable, nova, shimmer, ... (unknown → default)."
          },
          "response_format": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Response Format"
          },
          "speed": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Speed"
          }
        },
        "type": "object",
        "required": [
          "input"
        ],
        "title": "SpeechRequest",
        "example": {
          "input": "Hello there!",
          "model": "tts-1",
          "voice": "alloy"
        }
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          },
          "input": {
            "title": "Input"
          },
          "ctx": {
            "type": "object",
            "title": "Context"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "VideoCreateRequest": {
        "properties": {
          "idempotency_key": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 128,
                "minLength": 1
              },
              {
                "type": "null"
              }
            ],
            "title": "Idempotency Key",
            "description": "Client idempotency key: a repeated request with the same key (per API key owner) returns the already created job instead of creating and charging a new one."
          },
          "webhook_url": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2048
              },
              {
                "type": "null"
              }
            ],
            "title": "Webhook Url",
            "description": "Public https URL; when the job reaches completed/failed we POST the same job object that GET returns. Signed with X-Mixen-Signature (t=<unix>,v1=<hex>): HMAC-SHA256 over \"<t>.<raw body>\", secret = sha256 hex of your API key. Retries at 5/20/60/180 s on non-2xx."
          },
          "wait": {
            "type": "boolean",
            "title": "Wait",
            "description": "Hold the request until the job is terminal (or wait_timeout) and return the final job object. Default false — return the queued job immediately and poll.",
            "default": false
          },
          "wait_timeout": {
            "type": "integer",
            "maximum": 300.0,
            "minimum": 1.0,
            "title": "Wait Timeout",
            "description": "Seconds to wait when wait=true; on timeout the job is returned as is (still running).",
            "default": 60
          },
          "model": {
            "type": "string",
            "title": "Model",
            "description": "A catalog video model (veo-3.1-fast, kling-v3-pro, seedance-2.5, happyhorse-1.1, gemini-omni-1.1-flash). The sora-2 aliases are deprecated and redirect to veo-3.1-fast.",
            "default": "veo-3.1-fast"
          },
          "prompt": {
            "type": "string",
            "maxLength": 30000,
            "minLength": 1,
            "title": "Prompt"
          },
          "seconds": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Seconds",
            "description": "Duration in seconds; allowed values are per-model (see GET /models); defaults to the model minimum."
          },
          "size": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Size",
            "description": "Size WxH; allowed values are per-model (see GET /models); defaults to the model 16:9 720p."
          },
          "input_reference": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Input Reference",
            "description": "Image-to-video: {\"image_url\": \"data:image/...;base64,...\"} (data: URLs only)."
          },
          "input_references": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Input References",
            "description": "Reference-to-video (models with \"references\": true in GET /models): data: image URLs. Gemini Omni 1.1 Flash accepts 0 to 7 images (0/empty = generate without references); other models accept from 1 image up to the per-model \"max_references\" from GET /models."
          },
          "seed": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 2147483647.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Seed",
            "description": "Reproducibility seed (models with \"seed\": true in GET /models). The same prompt with the same seed yields the same clip."
          }
        },
        "type": "object",
        "required": [
          "prompt"
        ],
        "title": "VideoCreateRequest",
        "example": {
          "model": "veo-3.1-fast",
          "prompt": "an astronaut cat riding a motorcycle at night",
          "seconds": "4",
          "size": "720x1280"
        }
      },
      "_Msg": {
        "properties": {
          "role": {
            "type": "string",
            "title": "Role"
          },
          "content": {
            "title": "Content"
          },
          "tool_calls": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tool Calls"
          },
          "tool_call_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tool Call Id"
          }
        },
        "type": "object",
        "required": [
          "role"
        ],
        "title": "_Msg"
      }
    },
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "mxn-..."
      }
    }
  },
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "tags": [
    {
      "name": "models",
      "description": "List available models"
    },
    {
      "name": "chat",
      "description": "Chat completions (text, vision). Web search via Perplexity Sonar models."
    },
    {
      "name": "images",
      "description": "Image generation"
    },
    {
      "name": "videos",
      "description": "Video generation (async job + poll)"
    },
    {
      "name": "music",
      "description": "Music generation (async job + poll)"
    },
    {
      "name": "audio",
      "description": "Text-to-speech and transcription"
    },
    {
      "name": "embeddings",
      "description": "Text embeddings"
    }
  ],
  "servers": [
    {
      "url": "https://api.mixen.ai/v1"
    }
  ]
}
