{
  "openapi": "3.1.0",
  "info": {
    "title": "RouteMux Gateway API",
    "version": "2.0.0",
    "description": "Call models from multiple providers through one base URL and one API key,\nusing OpenAI-, Anthropic-, or Google Vertex-compatible protocols.\n\n**Billing**: prepaid wallet, priced per token or per call. Admission failures are not billed.\nIf an already-started stream is interrupted, inspect `error.billing.status` and the request\nlog for its final settlement outcome. An empty wallet returns `422`.\n\n**Migration cost**: point your existing SDK's `base_url` at `https://api.routemux.com/v1`.\nNothing else in your code changes.\n",
    "contact": {
      "url": "https://routemux.com"
    },
    "license": {
      "name": "Proprietary"
    }
  },
  "servers": [
    {
      "url": "https://api.routemux.com",
      "description": "Production gateway"
    }
  ],
  "externalDocs": {
    "description": "RouteMux error reference",
    "url": "https://routemux.com/docs/errors"
  },
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Chat",
      "description": "Text conversation and reasoning. Choose a protocol enabled for your model; availability is listed in the model catalog."
    },
    {
      "name": "Images",
      "description": "Image generation and editing."
    },
    {
      "name": "Video",
      "description": "Video generation. Asynchronous — submit a job, then poll for the result."
    },
    {
      "name": "Music",
      "description": "Music generation. Asynchronous — submit a job, then poll for the result."
    },
    {
      "name": "Embeddings",
      "description": "Text vectorisation. Billed per input token."
    },
    {
      "name": "Audio",
      "description": "Speech synthesis and transcription. Billing unit differs per model — see each model's pricing."
    },
    {
      "name": "Models",
      "description": "Model metadata."
    }
  ],
  "paths": {
    "/v1/chat/completions": {
      "post": {
        "tags": [
          "Chat"
        ],
        "operationId": "chat_completions",
        "summary": "Chat completions (OpenAI-compatible)",
        "description": "OpenAI Chat Completions-compatible endpoint. Point your OpenAI SDK's `base_url` at\n`https://api.routemux.com/v1` and choose a model that exposes this protocol.\nParameters and multimodal input follow that model's compatibility contract.\n\nWith `stream: true` chunks arrive as SSE. RouteMux never buffers the whole response,\nand bills **actual usage** once the upstream finishes.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PassthroughBody"
              },
              "examples": {
                "minimal": {
                  "summary": "Minimal request",
                  "value": {
                    "model": "openai/gpt-5.5",
                    "messages": [
                      {
                        "role": "user",
                        "content": "Explain prepaid billing in one line."
                      }
                    ]
                  }
                },
                "streaming": {
                  "summary": "Streaming",
                  "value": {
                    "model": "openai/gpt-5.5",
                    "stream": true,
                    "messages": [
                      {
                        "role": "user",
                        "content": "Stream a haiku"
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/OpenAIOk"
          },
          "401": {
            "$ref": "#/components/responses/OpenAIError"
          },
          "422": {
            "$ref": "#/components/responses/OpenAIError"
          },
          "429": {
            "$ref": "#/components/responses/OpenAIError"
          },
          "503": {
            "$ref": "#/components/responses/OpenAIError"
          }
        }
      }
    },
    "/v1/responses": {
      "post": {
        "tags": [
          "Chat"
        ],
        "operationId": "responses",
        "summary": "Responses (OpenAI-compatible)",
        "description": "OpenAI Responses API-compatible endpoint. The bare path `/responses` is also accepted\n(some SDKs omit the `/v1` prefix).\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PassthroughBody"
              },
              "examples": {
                "minimal": {
                  "value": {
                    "model": "openai/gpt-5.5",
                    "input": "Say hello."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/OpenAIOk"
          },
          "401": {
            "$ref": "#/components/responses/OpenAIError"
          },
          "422": {
            "$ref": "#/components/responses/OpenAIError"
          },
          "429": {
            "$ref": "#/components/responses/OpenAIError"
          }
        }
      }
    },
    "/v1/alpha/search": {
      "post": {
        "tags": [
          "Chat"
        ],
        "operationId": "alpha_search",
        "summary": "Alpha Search (Codex web search)",
        "description": "Non-streaming web search endpoint used by Codex (`web.run`). The bare path `/alpha/search`\nis also accepted. When an upstream pool does not natively implement `/v1/alpha/search`,\nRouteMux transparently bridges the call through `/v1/responses` hosted `web_search` and\nreturns a normalized JSON search response.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PassthroughBody"
              },
              "examples": {
                "minimal": {
                  "value": {
                    "model": "openai/gpt-5.5",
                    "commands": {
                      "search_query": [
                        {
                          "q": "latest release notes"
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/OpenAIOk"
          },
          "401": {
            "$ref": "#/components/responses/OpenAIError"
          },
          "422": {
            "$ref": "#/components/responses/OpenAIError"
          },
          "429": {
            "$ref": "#/components/responses/OpenAIError"
          }
        }
      }
    },
    "/v1/messages": {
      "post": {
        "tags": [
          "Chat"
        ],
        "operationId": "messages",
        "summary": "Messages (Anthropic-compatible)",
        "description": "Anthropic Messages-compatible endpoint. `/anthropic/v1/messages` is an equivalent alias.\n\nAuthenticate with `Authorization: Bearer`, or with the `x-api-key` header the Anthropic\nSDK sends. Sending **both headers with different values** returns 400 `AUTH_AMBIGUOUS_API_KEY`;\nthe same value in both is fine (tools such as CC Switch send both).\n\nErrors use the Anthropic envelope shape, unlike the other endpoints here — see the 401 example.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PassthroughBody"
              },
              "examples": {
                "minimal": {
                  "value": {
                    "model": "anthropic/claude-sonnet-5",
                    "max_tokens": 256,
                    "messages": [
                      {
                        "role": "user",
                        "content": "Hello"
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/AnthropicOk"
          },
          "401": {
            "$ref": "#/components/responses/AnthropicError"
          },
          "422": {
            "$ref": "#/components/responses/AnthropicError"
          },
          "429": {
            "$ref": "#/components/responses/AnthropicError"
          }
        }
      }
    },
    "/vertex-ai/v1beta/models/{model}:generateContent": {
      "post": {
        "tags": [
          "Chat"
        ],
        "operationId": "generate_content",
        "summary": "generateContent (Google Vertex-compatible)",
        "description": "Google GenAI / Vertex native format. The `x-goog-api-key` header is also accepted.",
        "parameters": [
          {
            "$ref": "#/components/parameters/VertexModel"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PassthroughBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/VertexOk"
          },
          "401": {
            "$ref": "#/components/responses/VertexError"
          },
          "422": {
            "$ref": "#/components/responses/VertexError"
          }
        }
      }
    },
    "/vertex-ai/v1beta/models/{model}:streamGenerateContent": {
      "post": {
        "tags": [
          "Chat"
        ],
        "operationId": "stream_generate_content",
        "summary": "streamGenerateContent (Google Vertex-compatible, streaming)",
        "description": "Same as `generateContent`, streamed.",
        "parameters": [
          {
            "$ref": "#/components/parameters/VertexModel"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PassthroughBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/VertexOk"
          },
          "401": {
            "$ref": "#/components/responses/VertexError"
          },
          "422": {
            "$ref": "#/components/responses/VertexError"
          }
        }
      }
    },
    "/v1/images/generations": {
      "post": {
        "tags": [
          "Images"
        ],
        "operationId": "image_generation",
        "summary": "Generate images (OpenAI-compatible)",
        "description": "The billing unit depends on the model — the catalogue shows whether it prices per image or per token. Requesting several images bills **each image separately** either way. A request can also be served by a backup model if the primary upstream is down; the response headers name the model that actually answered.\n\n**Per-model limits** (`openai/gpt-image-2.5-sunburst`, `openai/gpt-image-2.5-flare`, `openai/gpt-image-2`):\n- Standard `size`: `auto` (default), `1024x1024`, `1536x1024`, `1024x1536`. Output is about 1.5 MP; `size` only sets the aspect ratio and `quality` does not change the output or the price. Other sizes return 400.\n- `n`: up to 4 for `openai/gpt-image-2`; 1 for flare and sunburst.\n- The response is always `{created, data:[{b64_json}]}` (base64 PNG); `response_format` has no effect.\n- `openai/gpt-image-2.5-sunburst` 2K / 4K: `2048x2048`, `2560x1440`, `1440x2560` or `\"2K\"` = 2K at $0.08 per image; `3840x2160`, `2160x3840` or `\"4K\"` = 4K at $0.12 per image (standard is $0.0186). 2K / 4K requires `n` = 1, ignores `quality`, does not support `mask`, and is never retried or served by a backup model. Unlisted sizes return 400 and are not charged.\n\n**`xai/grok-imagine-image-2.0`**: `quality` is `low` (default; `auto` means `low`) or `medium`; `resolution` is `1k` (default), `1.5k` or `2k`; `aspect_ratio` sets the frame; `n` up to 4. Priced per image by quality × resolution, see the [model page](https://routemux.com/xai/grok-imagine-image-2.0). Other `quality` or `resolution` values return 400 and are not charged.\n\n**`minimax/minimax-h3-image` / `minimax/minimax-h3-image-highspeed`**: `area` is `1K`, `2K` or `4K` paired with `aspect_ratio` (`auto` or `X:Y` integer ratio in `[1/3, 3]`), or pass an explicit pixel `size` (`WxH` with area `655,360`–`20,000,000` and ratio in `[1/3, 3]`; omit `area` and `aspect_ratio` when `size` is `WxH`); `n` up to 10; `disable_prompt_enhanced` (`true` requires explicit `size` `WxH` or `aspect_ratio` `X:Y`); `output_format` (`jpeg`, `jpg`, `png`, `webp`); `output_compression` (integer `0`–`100`, default `95`, applies to `jpeg` / `webp`); `response_format` (`url`, `b64_json`). Billed per token and non-idempotent (no automatic 5xx/timeout retry; set `max_retries=0` in SDKs), see the [model page](https://routemux.com/minimax/minimax-h3-image).\n\nSee [Images: Parameters vs. OpenAI](https://routemux.com/docs/images#parameters-vs-openai) for the full list of supported and unsupported parameters.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PassthroughBody"
              },
              "examples": {
                "grok_medium_2k": {
                  "value": {
                    "model": "xai/grok-imagine-image-2.0",
                    "prompt": "A watercolor lighthouse on a cliff",
                    "quality": "medium",
                    "resolution": "2k",
                    "aspect_ratio": "16:9"
                  }
                },
                "minimal": {
                  "value": {
                    "model": "openai/gpt-image-2.5-flare",
                    "prompt": "A neon city at dusk"
                  }
                },
                "sunburst_4k": {
                  "value": {
                    "model": "openai/gpt-image-2.5-sunburst",
                    "prompt": "A neon city at dusk",
                    "size": "3840x2160"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/OpenAIOk"
          },
          "401": {
            "$ref": "#/components/responses/OpenAIError"
          },
          "422": {
            "$ref": "#/components/responses/OpenAIError"
          }
        }
      }
    },
    "/v1/images/edits": {
      "post": {
        "tags": [
          "Images"
        ],
        "operationId": "image_edit",
        "summary": "Edit an image (OpenAI-compatible)",
        "description": "Accepts `multipart/form-data` (with a reference image) or JSON. Billed per call.\n\nFor `openai/gpt-image-2.5-sunburst` 2K / 4K edits, send up to 10 reference images as multipart `image` / `image[]`, or as JSON `image` / `images` (https URLs or data URLs; `images:[{image_url}]` is also accepted).\n\n**Per-model limits** (`openai/gpt-image-2.5-sunburst`, `openai/gpt-image-2.5-flare`, `openai/gpt-image-2`):\n- Standard `size`: `auto` (default), `1024x1024`, `1536x1024`, `1024x1536`. Output is about 1.5 MP; `size` only sets the aspect ratio and `quality` does not change the output or the price. Other sizes return 400.\n- `n`: up to 4 for `openai/gpt-image-2`; 1 for flare and sunburst.\n- The response is always `{created, data:[{b64_json}]}` (base64 PNG); `response_format` has no effect.\n- `openai/gpt-image-2.5-sunburst` 2K / 4K: `2048x2048`, `2560x1440`, `1440x2560` or `\"2K\"` = 2K at $0.08 per image; `3840x2160`, `2160x3840` or `\"4K\"` = 4K at $0.12 per image (standard is $0.0186). 2K / 4K requires `n` = 1, ignores `quality`, does not support `mask`, and is never retried or served by a backup model. Unlisted sizes return 400 and are not charged.\n\n**`xai/grok-imagine-image-2.0`**: send one source image as JSON `image` (`{\"url\": ...}`, an https URL or a data URL), up to 3 as JSON `images`, or as multipart `image` / `image[]`. With several images, refer to them in the prompt as `<IMAGE_0>`, `<IMAGE_1>` and so on. For edits `quality` defaults to `medium` (`auto` means `medium`); `resolution` and `n` work as for generations, and there is no `mask`. Billed per output image by quality × resolution, plus each source image once per request. More than 3 source images return 400 before anything is billed.\n\n**`minimax/minimax-h3-image` / `minimax/minimax-h3-image-highspeed`**: send 1–16 reference images as JSON `images` (`[{\"image_url\": ...}]`, each a public https URL or a data URL; `mm_file://` references return 400) or multipart `image` / `image[]`; `area`, `aspect_ratio`, `size`, `n` (up to 10), `output_format`, `output_compression` and `response_format` work as for generations; `mask` and `disable_prompt_enhanced=true` return 400. Billed per input and output token and non-idempotent (`max_retries=0`), see the [model page](https://routemux.com/minimax/minimax-h3-image).\n\nSee [Images: Parameters vs. OpenAI](https://routemux.com/docs/images#parameters-vs-openai) for the full list of supported and unsupported parameters.\n",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PassthroughBody"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PassthroughBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/OpenAIOk"
          },
          "401": {
            "$ref": "#/components/responses/OpenAIError"
          },
          "422": {
            "$ref": "#/components/responses/OpenAIError"
          }
        }
      }
    },
    "/vertex-ai/v1beta/models/{model}:generateImages": {
      "post": {
        "tags": [
          "Images"
        ],
        "operationId": "generate_images",
        "summary": "generateImages (Google Vertex-compatible)",
        "description": "Google GenAI / Vertex native image generation. The `x-goog-api-key` header is also accepted. The billing unit depends on the model — the model catalogue shows whether it prices per image or per token.",
        "parameters": [
          {
            "$ref": "#/components/parameters/VertexModel"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PassthroughBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/VertexOk"
          },
          "422": {
            "$ref": "#/components/responses/VertexError"
          }
        }
      }
    },
    "/vertex-ai/v1beta/models/{model}:editImage": {
      "post": {
        "tags": [
          "Images"
        ],
        "operationId": "edit_image",
        "summary": "editImage (Google Vertex-compatible)",
        "description": "Google GenAI / Vertex native image editing, taking the provider's own request body. The `x-goog-api-key` header is also accepted.",
        "parameters": [
          {
            "$ref": "#/components/parameters/VertexModel"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PassthroughBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/VertexOk"
          },
          "422": {
            "$ref": "#/components/responses/VertexError"
          }
        }
      }
    },
    "/vertex-ai/v1beta/models/{model}:upscaleImage": {
      "post": {
        "tags": [
          "Images"
        ],
        "operationId": "upscale_image",
        "summary": "upscaleImage (Google Vertex-compatible)",
        "description": "Google GenAI / Vertex native image upscaling, taking the provider's own request body. The `x-goog-api-key` header is also accepted.",
        "parameters": [
          {
            "$ref": "#/components/parameters/VertexModel"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PassthroughBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/VertexOk"
          },
          "422": {
            "$ref": "#/components/responses/VertexError"
          }
        }
      }
    },
    "/v1/videos": {
      "post": {
        "tags": [
          "Video"
        ],
        "operationId": "video_generation",
        "summary": "Create a video job (asynchronous)",
        "description": "**Asynchronous.** This endpoint submits a job and returns immediately; it does not block\nuntil the video is rendered. Poll `GET /v1/videos/{id}` for status, then fetch the result\nfrom `GET /v1/videos/{id}/content`.\n\nBilling happens when the job **completes successfully**. Failed jobs are not billed.\n\n**Image-to-video.** Send input images in the same request. As JSON, each image is an\n`https://` URL or a base64 data URL (`data:image/png;base64,...`); as `multipart/form-data`\n(what the OpenAI SDK sends for `input_reference`), use the same field names as file parts.\n\n- `first_frame_image` (aliases `input_reference`, `image`): the first frame\n- `last_frame_image` (alias `last_frame`): the last frame; most models need a first frame with it\n- `reference_images` (array; alias `reference_image`): reference images\n- `keyframes` (array of `{ \"image\": ..., \"timestamp_s\": 2.5 }`): images pinned at a moment inside the\n  clip. In `multipart/form-data`, send the whole array as one JSON text field.\n- `reference_videos` (array; alias `reference_video`): reference video clips, MP4 or MOV, up to\n  50 MB each.\n- `reference_audios` (array): either preset voices `{ \"voice_id\": \"eve\" }`, or reference audio\n  files (an `https://` URL, a data URL, or `{ \"url\": ... }`), WAV or MP3, up to 15 MB each. In\n  `multipart/form-data`, send voices as one JSON text field and audio files as file parts.\n\nImages are PNG, JPEG or WebP, up to 10 MB each, at most 30 images and 80 MB of images per\nrequest; reference videos and audio clips are at most 10 per type (tighter per-model limits\napply); all inputs together at most 120 MB. Which inputs a model accepts is listed on its\nmodel page: `minimax/minimax-hailuo-2.3` takes a first frame only; `minimax/minimax-h3` and its\nvariants (`-highspeed`, `-lite`, `-max`), `kuaishou/kling-4.0`, `bytedance/seedance-2.5` and\n`alibaba/wan-3.0` take a first frame or first + last frame, or references (images, videos,\naudio files; see below); `kuaishou/kling-4.0-flash` takes a first frame (no last frame) or\nimage/video references; `xai/grok-imagine-video-1.5` takes frames, keyframes, reference images\nand preset voices (see below). An input the model does not support is rejected with a 400,\nnever silently ignored.\n\n**MiniMax H3 (`minimax/minimax-h3`) parameters.**\n\n| Field | Values | Default |\n|---|---|---|\n| `size` | `768P` or `2K`. `720p` counts as `768P`; 1080p is rejected. A width×height such as `720x1280` or `2560x1440` is also accepted: it sets the ratio and maps to the tier of its shorter side (`768P` or `2K`). | `768P` |\n| `seconds` | Any whole number from 4 to 15 | `5` |\n| `ratio` | `16:9`, `9:16`, `1:1`, `4:3`, `3:4`, `21:9`, or `adaptive` (follows the input image; needs at least one input image) | `16:9` without images, `adaptive` with images |\n\nH3 references can be combined with each other, but not with first/last frames:\n\n| Input | Limit |\n|---|---|\n| `reference_images` | Up to 9. |\n| `reference_videos` | Up to 3 clips, each 2–15 seconds, 15 seconds in total. MP4 or MOV. |\n| `reference_audios` (audio files) | Up to 3 clips, each 2–15 seconds, 15 seconds in total. WAV or MP3. Preset voices are not supported on H3. |\n\nAcross the H3 family a request takes at most 12 input files (images, videos and audio combined).\n\n**H3 family.** `minimax/minimax-h3-highspeed`, `minimax/minimax-h3-lite` and\n`minimax/minimax-h3-max` take the same fields, frames and references as H3, with these\ndifferences:\n\n| Model | `size` | `seconds` | Other |\n|---|---|---|---|\n| `minimax/minimax-h3-highspeed` | `480P` or `768P` | 4–15 | — |\n| `minimax/minimax-h3-lite` | `480P` or `768P` | 4–15 | With reference inputs, `ratio` must be an explicit ratio: it can be neither `adaptive` nor left out. |\n| `minimax/minimax-h3-max` | `480P` or `768P` | 5–15 | Optional `prompt_expansion_mode`: `disabled`, `balanced` (default) or `quality`; MiniMax's native `extra.prompt_expansion_mode` is accepted too. Only the first 2 reference images are free, and reference video has its own per-second rate. |\n\nBilling is per output second at the rate for the chosen `size`; `2K` costs more per second\nthan `768P`. On top of that, reference video is billed per input second at the same rate as\nthe output (each clip rounded up to a whole second), the first 5 reference images are free\nand each one after that is billed, and reference audio is free. See the\n[model page](https://routemux.com/minimax/minimax-h3) (and each variant's own page) for the current\nrates. One video per job (`n` must be 1).\n\nNot supported on the H3 family through RouteMux: `callback_url` (poll the job instead). A last\nframe needs a first frame. Invalid combinations are rejected with `400`\n`MODEL_PARAMETER_UNSUPPORTED` before a job is created (and nothing is billed): `seconds`\noutside the model's range or not a whole number, an unsupported `size` or `ratio`, `adaptive`\nwithout an input image or video, first/last frames combined with references, more than 9\nreference images, more than 12 input files, `prompt_expansion_mode` on a model other than\nH3 Max, or reference clips outside the limits above. A GIF image, or a video or\naudio file in another format, returns `415` `REQUEST_MEDIA_TYPE_UNSUPPORTED`.\n\n**xAI Grok Imagine Video 1.5 (`xai/grok-imagine-video-1.5`) parameters.** The output video\nhas sound.\n\n| Field | Values | Default |\n|---|---|---|\n| `size` (alias `resolution`) | `480p`, `720p` or `1080p`. A width×height such as `1280x720` is also accepted: it sets the ratio and maps to the tier of its shorter side. | `480p` |\n| `seconds` (alias `duration`) | Any whole number from 1 to 15 | `8` |\n| `ratio` (alias `aspect_ratio`) | `16:9`, `9:16`, `1:1`, `4:3`, `3:4`, `3:2`, `2:3`, `21:9`, `5:2`. Ignored with a first frame: the video follows the image. | `16:9` |\n\nInputs on Grok Imagine Video 1.5 can be combined in one request:\n\n| Input | Limit |\n|---|---|\n| First frame, last frame | One each. The last frame can also be used alone. |\n| `keyframes` | Up to 4. `timestamp_s` must be greater than 0 and less than `seconds`. Timestamps snap to a 1/3-second grid, so keep keyframes at least 1/3 s apart. |\n| `reference_images` | Up to 14. Refer to them in the prompt as `<IMAGE_0>`, `<IMAGE_1>`, …; with a first frame, the first frame is `<IMAGE_0>` and reference images start at `<IMAGE_1>`. |\n| `reference_audios` | Up to 3 preset voices such as `eve`, `ara`, `rex`, `sal`, `leo`. Refer to them as `<AUDIO_0>`, `<AUDIO_1>`, …. Custom voice audio (`url`) is not available. An unknown voice fails the job, and nothing is billed. |\n\nWith reference images or voices the video is capped at `720p`; `1080p` is rejected with a 400.\n\nBilling is per output second at the rate for the chosen `size`, plus a charge for each input\nimage (first frame, last frame, keyframe or reference image); voices are free. See the\n[model page](https://routemux.com/xai/grok-imagine-video-1.5) for the current rates. One\nvideo per job (`n` must be 1), and a `prompt` is required with input images too. Video\nedit / extend is not available (xAI offers it only on the older `grok-imagine-video`).\nInvalid values (`seconds` outside 1–15 or not a whole number, another `size` or `ratio`,\ntoo many inputs, a keyframe time outside the clip) are rejected with `400`\n`MODEL_PARAMETER_UNSUPPORTED` before a job is created, and nothing is billed. Video\ngeneration on this model also has a per-account daily allowance: past it, requests return\n`429` `LIMIT_VIDEO_DAILY_CAP` until 00:00 UTC.\n\n**Kuaishou Kling 4.0 (`kuaishou/kling-4.0` / `kuaishou/kling-4.0-flash`) parameters.** Always\nincludes native stereo audio (`audio` / `generate_audio` and `seed` are not configurable).\n\n| Field | `kuaishou/kling-4.0` | `kuaishou/kling-4.0-flash` | Default |\n|---|---|---|---|\n| `size` (alias `resolution`) | `720p` or `1080p` (or `WxH` such as `1280x720`, `1920x1080`) | `720p` only (`1080p` returns 400) | `720p` |\n| `seconds` (alias `duration`) | Whole seconds `3`–`30` | Whole seconds `3`–`20` | `5` |\n| `ratio` (alias `aspect_ratio`) | `16:9`, `9:16`, `1:1`, `21:9`, or `adaptive` with visual input | `16:9`, `9:16`, `1:1`, `21:9` for text/reference; omitted automatically when a first frame is supplied | `16:9` (or follows input) |\n\nFirst/last frames and reference media cannot be mixed in the same request (max 15 files total;\nimage dimensions ≥ 300 px per side, aspect ratio between `0.4` and `2.5`):\n\n- **Frames:** `kling-4.0` accepts `first_frame_image` and optional `last_frame_image`;\n  `kling-4.0-flash` accepts `first_frame_image` only (`last_frame_image` returns `400`\n  `MODEL_LAST_FRAME_UNSUPPORTED`).\n- **References:** Up to 10 `reference_images` (refer to `@Image1`, `@Image2`, … in `prompt`); up to\n  5 `reference_videos` (`3`–`30` s each / `≤ 30` s total on `kling-4.0`; `3`–`20` s each / `≤ 20` s\n  total on `kling-4.0-flash`, `@Video1`…); on `kling-4.0` only, up to 3 `reference_audios` (`5`–`30` s\n  each / `≤ 30` s total, `@Audio1`…).\n- **Billing:** Without reference video, billed at `seconds × output_rate(resolution)`. With\n  `reference_videos` (total rounded-up seconds `R > 0`, output duration `D`), the entire job switches\n  to the lower reference-video per-second rate for **`D + max(D, R)`** seconds (for example, `D = 10` s\n  output + `R = 4` s reference video bills `10 + max(10, 4) = 20` seconds at the reference-video rate).\n  Reference images and audio add no extra charge. See\n  [Kling 4.0](https://routemux.com/kuaishou/kling-4.0) and\n  [Kling 4.0 Flash](https://routemux.com/kuaishou/kling-4.0-flash) for current rates.\n\n**ByteDance Seedance 2.5 (`bytedance/seedance-2.5`) parameters.**\n\n| Field | Values | Default |\n|---|---|---|\n| `size` (alias `resolution`) | `480p`, `720p`, `1080p` or `4k` (`2160p` and `3840x2160` map to `4k`; `2k` is not supported) | `720p` |\n| `seconds` (alias `duration`) | Whole seconds `4`–`30` | `5` |\n| `ratio` (alias `aspect_ratio`) | `21:9`, `16:9`, `4:3`, `1:1`, `3:4`, `9:16`, or `adaptive` (at `4k` with first/last frames, `adaptive` is enforced automatically) | `16:9` without visual input, `adaptive` with visual input |\n| `audio` (alias `generate_audio`) | `true` or `false` (same price) | `true` |\n| `seed` | `-1` (random) or integer `0`–`2147483647` | `-1` |\n\nFirst/last frames and reference media cannot be mixed (max 50 files total; image dimensions\n≥ 300 px per side, aspect ratio `0.4`–`2.5`):\n\n- **Frames:** `first_frame_image` and optional `last_frame_image` (`last_frame_image` requires\n  `first_frame_image`).\n- **References:** Up to 30 `reference_images` (`@图片1`…), up to 10 `reference_videos` (`2`–`15` s\n  each, `≤ 30` s total, `@视频1`…), and up to 10 `reference_audios` (`2`–`15` s each, `≤ 30` s total,\n  `@音频1`…; audio references require at least one reference image or video in the same request).\n- **Billing:** Without reference video, billed at `seconds × output_rate(resolution)`. With\n  `reference_videos` (total rounded-up seconds `R > 0`, output duration `D`), the entire job bills at\n  the reference-video per-second rate for **`D + R`** seconds (for example, `D = 10` s output +\n  `R = 4` s reference video bills `14` seconds at the reference-video rate). Reference images and\n  audio add no extra charge. Draft mode (`draft` / `draft_task_id`) is not supported (`400`). See\n  [Seedance 2.5](https://routemux.com/bytedance/seedance-2.5) for current rates.\n\n**Alibaba Wan 3.0 (`alibaba/wan-3.0`) parameters.**\n\n| Field | Values | Default |\n|---|---|---|\n| `size` (alias `resolution`) | `480p`, `720p` or `1080p` | `720p` |\n| `seconds` (alias `duration`) | Whole seconds `2`–`30` | `5` |\n| `ratio` (alias `aspect_ratio`) | `21:9`, `16:9`, `4:3`, `1:1`, `3:4`, `9:16`, or `adaptive` | `16:9` without visual input, `adaptive` with visual input |\n| `audio` (alias `generate_audio`) | `true` or `false` (same price) | `true` |\n| `seed` | `-1` (random) or integer `0`–`2147483647` | `-1` |\n\nFirst/last frames and reference media cannot be mixed (max 20 files total; image dimensions\n≥ 240 px per side):\n\n- **Frames:** `first_frame_image` and optional `last_frame_image`.\n- **References:** Up to 10 `reference_images` (`图1`…), up to 5 `reference_videos` (`1`–`15` s each,\n  `≤ 15` s total, and **`reference_video_seconds + seconds <= 30`**, `视频1`…), and up to 5\n  `reference_audios` (`1`–`15` s each, `≤ 15` s total, `音频1`…). Document/page inputs (`file_url` /\n  `link_url`) are not supported (`400`).\n- **Billing:** Billed strictly per output second (`seconds × output_rate(resolution)`). Reference\n  images, reference videos, and reference audio add zero extra charge. See\n  [Wan 3.0](https://routemux.com/alibaba/wan-3.0) for current rates.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PassthroughBody"
              },
              "examples": {
                "minimal": {
                  "value": {
                    "model": "minimax/minimax-h3",
                    "prompt": "A drone shot over a coastline",
                    "seconds": 6
                  }
                },
                "first_frame": {
                  "value": {
                    "model": "minimax/minimax-hailuo-2.3",
                    "prompt": "The dog starts running toward the camera",
                    "first_frame_image": "https://example.com/dog.png"
                  }
                },
                "first_and_last_frame": {
                  "value": {
                    "model": "minimax/minimax-h3",
                    "prompt": "The flower slowly blooms",
                    "seconds": 6,
                    "first_frame_image": "https://example.com/bud.png",
                    "last_frame_image": "data:image/png;base64,iVBORw0KGgo..."
                  }
                },
                "reference_images": {
                  "value": {
                    "model": "minimax/minimax-h3",
                    "prompt": "This dog surfing a big wave at sunset",
                    "seconds": 8,
                    "ratio": "9:16",
                    "reference_images": [
                      "https://example.com/dog-front.png",
                      "https://example.com/dog-side.png"
                    ]
                  }
                },
                "h3_reference_video_and_audio": {
                  "value": {
                    "model": "minimax/minimax-h3",
                    "prompt": "The dog from reference image 1 dances to the rhythm of reference video 1; the voice follows reference audio 1",
                    "seconds": 6,
                    "ratio": "16:9",
                    "reference_images": [
                      "https://example.com/dog.png"
                    ],
                    "reference_videos": [
                      "https://example.com/dance-4s.mp4"
                    ],
                    "reference_audios": [
                      "https://example.com/voice-3s.wav"
                    ]
                  }
                },
                "h3_lite_references_480p": {
                  "value": {
                    "model": "minimax/minimax-h3-lite",
                    "prompt": "This dog surfing a big wave at sunset",
                    "seconds": 5,
                    "size": "480P",
                    "ratio": "9:16",
                    "reference_images": [
                      "https://example.com/dog-front.png"
                    ]
                  }
                },
                "h3_max_prompt_expansion": {
                  "value": {
                    "model": "minimax/minimax-h3-max",
                    "prompt": "A drone shot over a coastline",
                    "seconds": 5,
                    "size": "768P",
                    "prompt_expansion_mode": "disabled"
                  }
                },
                "grok_text_to_video": {
                  "value": {
                    "model": "xai/grok-imagine-video-1.5",
                    "prompt": "A red paper boat drifting on a calm pond",
                    "seconds": 6,
                    "size": "720p"
                  }
                },
                "grok_first_frame": {
                  "value": {
                    "model": "xai/grok-imagine-video-1.5",
                    "prompt": "The red circle slowly pulses like a heartbeat",
                    "seconds": 4,
                    "first_frame_image": "https://example.com/circle.png"
                  }
                },
                "grok_frames_and_keyframes": {
                  "value": {
                    "model": "xai/grok-imagine-video-1.5",
                    "prompt": "The circle turns into a triangle, then into a square",
                    "seconds": 4,
                    "size": "1080p",
                    "first_frame_image": "https://example.com/circle.png",
                    "keyframes": [
                      {
                        "image": "https://example.com/triangle.png",
                        "timestamp_s": 2
                      }
                    ],
                    "last_frame_image": "https://example.com/square.png"
                  }
                },
                "grok_references_and_voice": {
                  "value": {
                    "model": "xai/grok-imagine-video-1.5",
                    "prompt": "<IMAGE_0> waves at the camera and says hello in the voice of <AUDIO_0>",
                    "seconds": 6,
                    "size": "720p",
                    "reference_images": [
                      "https://example.com/character.png"
                    ],
                    "reference_audios": [
                      {
                        "voice_id": "eve"
                      }
                    ]
                  }
                },
                "kling_4_0_text_to_video": {
                  "value": {
                    "model": "kuaishou/kling-4.0",
                    "prompt": "A paper boat drifts along a rainy neon street at night, gentle rain sound",
                    "seconds": 6,
                    "resolution": "1080p",
                    "aspect_ratio": "16:9"
                  }
                },
                "kling_4_0_flash_first_frame": {
                  "value": {
                    "model": "kuaishou/kling-4.0-flash",
                    "prompt": "Camera slowly pushes in as steam rises from the cup",
                    "seconds": 5,
                    "first_frame_image": "https://example.com/coffee.jpg"
                  }
                },
                "seedance_2_5_multimodal_reference": {
                  "value": {
                    "model": "bytedance/seedance-2.5",
                    "prompt": "@图片1 character performs the dance move in @视频1 under warm stage lighting",
                    "seconds": 8,
                    "resolution": "1080p",
                    "aspect_ratio": "9:16",
                    "audio": true,
                    "seed": 42,
                    "reference_images": [
                      "https://example.com/dancer.png"
                    ],
                    "reference_videos": [
                      "https://example.com/choreo-5s.mp4"
                    ]
                  }
                },
                "wan_3_0_text_to_video": {
                  "value": {
                    "model": "alibaba/wan-3.0",
                    "prompt": "A kitten runs across a moonlit rooftop, cinematic camera tracking shot",
                    "seconds": 5,
                    "resolution": "720p",
                    "aspect_ratio": "21:9",
                    "audio": true
                  }
                }
              }
            },
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/PassthroughBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/OpenAIOk"
          },
          "401": {
            "$ref": "#/components/responses/OpenAIError"
          },
          "422": {
            "$ref": "#/components/responses/OpenAIError"
          }
        }
      }
    },
    "/vertex-ai/v1beta/models/{model}:generateVideos": {
      "post": {
        "tags": [
          "Video"
        ],
        "operationId": "generate_videos",
        "summary": "generateVideos (Google Vertex-compatible, asynchronous)",
        "description": "**Asynchronous.** Google GenAI / Vertex native video generation; the `x-goog-api-key` header is\nalso accepted. Runs on the same job pipeline as `POST /v1/videos` — the request returns as soon\nas the job is queued, and billing happens when the job completes successfully.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/VertexModel"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PassthroughBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/VertexOk"
          },
          "422": {
            "$ref": "#/components/responses/VertexError"
          }
        }
      }
    },
    "/v1/music/generations": {
      "post": {
        "tags": [
          "Music"
        ],
        "operationId": "music_generation",
        "summary": "Generate music (asynchronous)",
        "description": "Returns a **job**, not audio. Poll `GET /v1/jobs/{id}` until `status` is\n`completed`, then read the artifact URL from the result.\n\nGeneration typically takes under a minute. The returned artifact URL stays\nvalid for the full retention window — re-read the job to get a fresh link\nrather than caching the URL itself.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PassthroughBody"
              },
              "examples": {
                "minimal": {
                  "value": {
                    "model": "minimax/music-3.0",
                    "prompt": "dreamy synthwave, slow build",
                    "lyrics": "[verse]\nneon rain on empty streets\n[chorus]\nwe drive till morning"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/OpenAIOk"
          },
          "401": {
            "$ref": "#/components/responses/OpenAIError"
          },
          "422": {
            "$ref": "#/components/responses/OpenAIError"
          }
        }
      }
    },
    "/v1/embeddings": {
      "post": {
        "tags": [
          "Embeddings"
        ],
        "operationId": "embeddings",
        "summary": "Create embeddings (OpenAI-compatible)",
        "description": "Billed per **input** token. `input` accepts a string or an array of strings.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PassthroughBody"
              },
              "examples": {
                "minimal": {
                  "value": {
                    "model": "openai/text-embedding-3-small",
                    "input": "A neon city at dusk"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/OpenAIOk"
          },
          "401": {
            "$ref": "#/components/responses/OpenAIError"
          },
          "422": {
            "$ref": "#/components/responses/OpenAIError"
          }
        }
      }
    },
    "/v1/audio/speech": {
      "post": {
        "tags": [
          "Audio"
        ],
        "operationId": "audio_speech",
        "summary": "Text to speech (OpenAI-compatible)",
        "description": "Returns raw audio bytes, not JSON — set your client to read the response as binary.\n\n**The billing unit is model-dependent**: some models bill per input character,\nothers per output token. Check the model's pricing before batching large jobs.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PassthroughBody"
              },
              "examples": {
                "minimal": {
                  "value": {
                    "model": "openai/tts-1",
                    "input": "A neon city at dusk",
                    "voice": "alloy"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/OpenAIOk"
          },
          "401": {
            "$ref": "#/components/responses/OpenAIError"
          },
          "422": {
            "$ref": "#/components/responses/OpenAIError"
          }
        }
      }
    },
    "/v1/audio/transcriptions": {
      "post": {
        "tags": [
          "Audio"
        ],
        "operationId": "audio_transcription",
        "summary": "Speech to text (OpenAI-compatible)",
        "description": "Upload an audio file as `multipart/form-data`, using `model=minimax/asr-1.0`.\n\n### Example\n\n```bash\ncurl https://api.routemux.com/v1/audio/transcriptions \\\n  -H \"Authorization: Bearer $ROUTEMUX_API_KEY\" \\\n  -F \"model=minimax/asr-1.0\" \\\n  -F \"file=@./audio.wav\" \\\n  -F \"language=ru\" \\\n  -F \"response_format=verbose_json\" \\\n  -F \"timestamp_level=word\"\n```\n\n### Supported parameters\n\n| Field | Required | Support |\n| --- | --- | --- |\n| `model` | Yes | `minimax/asr-1.0` |\n| `file` | Yes | WAV, AIFF, FLAC, ALAC (M4A), MP3, AAC, Opus or Ogg; at most 500 seconds and 50 MB. Raw PCM is unsupported. |\n| `language` | No | A language code from the list below; omit or leave empty for automatic, mixed-language recognition. Send as a form field with OpenAI SDKs, or as the native `language` HTTP header. RouteMux maps the form field to the provider header; the form field takes precedence. |\n| `response_format` | No | `json` (default): text and duration; `verbose_json`: also speaker labels, `n_speakers` and `segments`; `srt`: SRT subtitles; `vtt`: WebVTT subtitles. |\n| `timestamp_level` | No | Empty or `sentence` (default), or `word`. Applies to `verbose_json`, `srt` and `vtt`; accepted but ignored for `json`. Chinese uses character timestamps; English uses word timestamps. |\n| `timestamp_granularities[]` | No | OpenAI SDK alias: `segment` maps to `sentence`, `word` maps to `word`. If both are requested, word takes precedence. An explicit `timestamp_level` takes precedence over this alias. |\n| `stream` | No | `false` (default) returns the complete result; `true` streams SSE and requires `response_format=json`. |\n\nSupported language hints: `zh`, `yue`, `en`, `ja`, `ko`, `th`, `vi`, `id`, `ms`, `fil`, `ar`, `tr`, `fr`, `de`, `es`, `it`, `pt`, `pl`, `ru`, `uk`.\n`zh` is Chinese, `ru` is Russian, and `en` is English. The provider does not support `prompt` or `temperature`; supplying either returns `400 REQUEST_INVALID` rather than silently ignoring it.\n\n### Subtitles and streaming\n\nFor subtitles, use `-F response_format=srt -o transcript.srt` or `-F response_format=vtt -o transcript.vtt` with the example above.\nFor streaming, use `curl -N`, `-F response_format=json` and `-F stream=true`. The SSE response contains:\n\n```text\ndata: {\"index\":0,\"delta\":\"Hello\",\"finish\":false}\n\ndata: {\"index\":1,\"delta\":\"\",\"finish\":true,\"duration\":5.952688}\n```\n\nConcatenate `delta` values in order, and stop at `finish=true`. The final event carries the audio duration. `stream=true` cannot be combined with `verbose_json`, `srt` or `vtt`; invalid combinations return `400` before provider invocation.\nThis API transcribes an uploaded file; streaming output does not accept a live microphone input stream.\n\n### Billing and downloads\n\nBilling uses the input audio duration in seconds, not tokens. JSON and SSE use the provider's returned `duration`; subtitle responses use the duration verified from the uploaded file on the server. See the [current model price](https://routemux.com/pricing).\nIn Playground, speech audio and transcription/subtitle files are saved to [Artifacts](https://console.routemux.com/artifacts), where they can be previewed and downloaded. Artifacts are kept according to the configured retention window (7 days by default); download anything you want to keep.\n\nOfficial references: [MiniMax ASR API](https://platform.minimax.io/docs/api-reference/speech-to-text) and [supported languages and audio requirements](https://platform.minimax.io/docs/guides/speech-to-text).\n",
        "externalDocs": {
          "description": "MiniMax speech-to-text API reference",
          "url": "https://platform.minimax.io/docs/api-reference/speech-to-text"
        },
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/AudioTranscriptionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Transcribed text and processed audio duration. verbose_json also includes speaker labels and timestamped segments.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AudioTranscriptionResponse"
                },
                "examples": {
                  "verbose": {
                    "value": {
                      "text": "Hello, this is a speech recognition test. We process three hundred minutes of audio every day.",
                      "duration": 5.952688,
                      "n_speakers": 1,
                      "segments": [
                        {
                          "id": 0,
                          "start": 0.04,
                          "end": 5.74,
                          "speaker": "S1",
                          "text": "Hello, this is a speech recognition test. We process three hundred minutes of audio every day."
                        }
                      ]
                    }
                  }
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string",
                  "description": "SRT subtitle text."
                }
              },
              "text/vtt": {
                "schema": {
                  "type": "string",
                  "description": "WebVTT subtitle text."
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "SSE data events containing index",
                  "delta and finish; the final event also contains duration.": null
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/OpenAIError"
          },
          "401": {
            "$ref": "#/components/responses/OpenAIError"
          },
          "413": {
            "$ref": "#/components/responses/OpenAIError"
          },
          "422": {
            "$ref": "#/components/responses/OpenAIError"
          }
        }
      }
    },
    "/v1/models": {
      "get": {
        "tags": [
          "Models"
        ],
        "operationId": "models",
        "summary": "List callable models",
        "description": "Returns every model **this key can actually call** — not a marketing catalogue.\nModels absent from the response will fail if called; treat this endpoint as the source of truth.\n\nThis is a metadata query and is **not billed**.\n",
        "responses": {
          "200": {
            "description": "Model list, OpenAI shape: object=list, data is an array of models.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PassthroughBody"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/OpenAIError"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "`Authorization: Bearer <your RouteMux API key>`.\n\nCreate keys at https://console.routemux.com/keys. New keys use the `sk-` prefix;\nthe legacy `rmx_live_` prefix is still accepted.\n\nThe Anthropic SDK's `x-api-key` and the Google SDK's `x-goog-api-key` are accepted too.\nSending several key headers with **different** values returns 400 `AUTH_AMBIGUOUS_API_KEY`.\n"
      }
    },
    "parameters": {
      "VertexModel": {
        "name": "model",
        "in": "path",
        "required": true,
        "description": "Model ID, e.g. `anthropic/claude-sonnet-5`. URL-encoded.",
        "schema": {
          "type": "string"
        },
        "example": "openai/gpt-5.5"
      }
    },
    "schemas": {
      "AudioTranscriptionRequest": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "model",
          "file"
        ],
        "description": "Supported fields for MiniMax ASR 1.0 through RouteMux. See the endpoint description for provider differences.",
        "properties": {
          "model": {
            "type": "string",
            "description": "RouteMux transcription model ID.",
            "example": "minimax/asr-1.0"
          },
          "file": {
            "type": "string",
            "format": "binary",
            "description": "Audio file. Maximum 500 seconds and 50 MB; longer recordings must be split."
          },
          "language": {
            "type": "string",
            "enum": [
              "",
              "zh",
              "yue",
              "en",
              "ja",
              "ko",
              "th",
              "vi",
              "id",
              "ms",
              "fil",
              "ar",
              "tr",
              "fr",
              "de",
              "es",
              "it",
              "pt",
              "pl",
              "ru",
              "uk"
            ],
            "description": "Optional language hint, mapped to the provider language header. Omit or use an empty string for automatic mixed-language recognition.",
            "example": "ru"
          },
          "response_format": {
            "type": "string",
            "enum": [
              "json",
              "verbose_json",
              "srt",
              "vtt"
            ],
            "default": "json",
            "description": "json returns text and duration; verbose_json adds speakers and segments. srt and vtt return subtitle text. Only json supports streaming."
          },
          "timestamp_level": {
            "type": "string",
            "enum": [
              "",
              "sentence",
              "word"
            ],
            "default": "sentence",
            "description": "Effective with verbose_json, srt and vtt. word returns character timestamps for Chinese and word timestamps for English; ignored with json."
          },
          "timestamp_granularities[]": {
            "type": "array",
            "maxItems": 2,
            "items": {
              "type": "string",
              "enum": [
                "segment",
                "word"
              ]
            },
            "description": "OpenAI SDK alias. segment maps to sentence. word wins when both are requested; explicit timestamp_level takes precedence."
          },
          "stream": {
            "type": "boolean",
            "default": false,
            "description": "true returns SSE text deltas with duration in the finish=true event; requires response_format=json."
          }
        }
      },
      "AudioTranscriptionResponse": {
        "type": "object",
        "required": [
          "text",
          "duration"
        ],
        "description": "Transcription result. Speaker and segment fields are returned with verbose_json.",
        "properties": {
          "text": {
            "type": "string",
            "description": "Full transcript in the detected language."
          },
          "duration": {
            "type": "number",
            "description": "Processed audio duration in seconds, used for billing MiniMax ASR 1.0."
          },
          "n_speakers": {
            "type": "integer",
            "description": "Number of detected speakers; verbose_json only."
          },
          "segments": {
            "type": "array",
            "description": "Timestamped transcription units; verbose_json only. Granularity follows timestamp_level.",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer"
                },
                "start": {
                  "type": "number",
                  "description": "Start time in seconds."
                },
                "end": {
                  "type": "number",
                  "description": "End time in seconds."
                },
                "speaker": {
                  "type": "string",
                  "description": "Speaker label",
                  "for example S1.": null
                },
                "text": {
                  "type": "string",
                  "description": "Transcribed text for this unit."
                }
              }
            }
          },
          "trace_id": {
            "type": "string",
            "description": "Provider trace ID, when present. Use the x-request-id response header for RouteMux support."
          }
        }
      },
      "PassthroughBody": {
        "type": "object",
        "additionalProperties": true,
        "description": "Request and response bodies match the upstream provider's official format **verbatim** —\nRouteMux passes them through untouched. See the provider's own docs for field definitions;\nthe gateway itself only reads `model` and `stream`.\n",
        "properties": {
          "model": {
            "type": "string",
            "description": "RouteMux model slug (one of those returned by `GET /v1/models`).",
            "example": "openai/gpt-5.5"
          },
          "stream": {
            "type": "boolean",
            "description": "Stream the response. Ignored by the image and video endpoints."
          }
        }
      },
      "RouteMuxErrorRetry": {
        "type": "object",
        "required": [
          "retryable",
          "strategy"
        ],
        "properties": {
          "retryable": {
            "type": "boolean",
            "description": "Whether the same operation can be attempted again after following the strategy."
          },
          "strategy": {
            "type": "string",
            "enum": [
              "NONE",
              "AUTHENTICATE",
              "FIX_REQUEST",
              "TOP_UP",
              "BACKOFF",
              "RETRY",
              "SWITCH_MODEL",
              "CONTACT_SUPPORT"
            ]
          },
          "retry_after_seconds": {
            "type": "integer",
            "minimum": 0,
            "description": "Minimum wait when RouteMux can provide one."
          }
        }
      },
      "RouteMuxErrorBilling": {
        "type": "object",
        "required": [
          "status"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "NOT_BILLED",
              "BILLED",
              "PENDING",
              "UNKNOWN"
            ],
            "description": "Billing outcome known when this error was emitted."
          }
        }
      },
      "RouteMuxErrorDescriptor": {
        "type": "object",
        "required": [
          "code",
          "message",
          "reference",
          "documentation_url",
          "request_id",
          "retry",
          "billing"
        ],
        "properties": {
          "code": {
            "type": "string",
            "pattern": "^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$",
            "example": "BILLING_INSUFFICIENT_CREDITS",
            "description": "Canonical business-domain error code. Branch on this field, never on message."
          },
          "message": {
            "type": "string",
            "example": "The prepaid wallet does not have enough available credit for this request. Top up the wallet, then submit the request again."
          },
          "reference": {
            "type": "string",
            "pattern": "^RMX-[A-Z]+-[0-9]{4}$",
            "example": "RMX-BILLING-5001",
            "description": "Stable lookup number for documentation and support."
          },
          "documentation_url": {
            "type": "string",
            "format": "uri",
            "example": "https://routemux.com/docs/errors#rmx-billing-5001"
          },
          "request_id": {
            "type": "string",
            "example": "req_01HXYZ...",
            "description": "Identifier for this individual occurrence; include it when contacting support."
          },
          "retry": {
            "$ref": "#/components/schemas/RouteMuxErrorRetry"
          },
          "billing": {
            "$ref": "#/components/schemas/RouteMuxErrorBilling"
          }
        }
      },
      "OpenAIErrorBody": {
        "type": "object",
        "description": "OpenAI-style error envelope (shared by chat, responses, images, and videos).",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RouteMuxErrorDescriptor"
              },
              {
                "type": "object",
                "required": [
                  "type",
                  "param"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "authentication_error",
                      "billing_error",
                      "rate_limit_error",
                      "invalid_request_error",
                      "overloaded_error",
                      "upstream_error",
                      "api_error"
                    ]
                  },
                  "param": {
                    "type": "null"
                  }
                }
              }
            ]
          }
        }
      },
      "AnthropicErrorBody": {
        "type": "object",
        "description": "Anthropic-style error envelope (only `/v1/messages`).",
        "required": [
          "type",
          "error",
          "request_id"
        ],
        "properties": {
          "type": {
            "type": "string",
            "const": "error"
          },
          "error": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RouteMuxErrorDescriptor"
              },
              {
                "type": "object",
                "required": [
                  "type"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "example": "billing_error"
                  }
                }
              }
            ]
          },
          "request_id": {
            "type": "string",
            "example": "req_01HXYZ..."
          }
        }
      },
      "VertexErrorBody": {
        "type": "object",
        "description": "Google Vertex-style error envelope (only `/vertex-ai/*`).",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "status",
              "message",
              "details"
            ],
            "properties": {
              "code": {
                "type": "integer",
                "example": 422
              },
              "status": {
                "type": "string",
                "pattern": "^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$",
                "example": "BILLING_INSUFFICIENT_CREDITS"
              },
              "message": {
                "type": "string"
              },
              "details": {
                "type": "array",
                "description": "Google `ErrorInfo` metadata carries the reference, docs URL, request ID, retry and billing fields; `Help` carries the clickable documentation URL.",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "headers": {
      "RequestId": {
        "description": "Identifier for this individual request.",
        "schema": {
          "type": "string",
          "example": "req_01HXYZ..."
        }
      },
      "ErrorCode": {
        "description": "Canonical RouteMux business-domain error code.",
        "schema": {
          "type": "string",
          "example": "BILLING_INSUFFICIENT_CREDITS"
        }
      },
      "ErrorReference": {
        "description": "Stable RouteMux error lookup number.",
        "schema": {
          "type": "string",
          "example": "RMX-BILLING-5001"
        }
      },
      "ErrorDocumentation": {
        "description": "Documentation link using the standard `describedby` relation.",
        "schema": {
          "type": "string",
          "example": "<https://routemux.com/docs/errors#rmx-billing-5001>; rel=\"describedby\"; type=\"text/html\"; hreflang=\"en\""
        }
      },
      "ErrorLanguage": {
        "description": "Language used for the safe public message and documentation URL.",
        "schema": {
          "type": "string",
          "enum": [
            "en",
            "zh"
          ]
        }
      },
      "ErrorBilling": {
        "description": "Whether the request was billed, or whether settlement is still pending/unknown.",
        "schema": {
          "type": "string",
          "enum": [
            "true",
            "false",
            "pending",
            "unknown"
          ]
        }
      },
      "RetryAfter": {
        "description": "Minimum seconds to wait before retrying, when known.",
        "schema": {
          "type": "integer",
          "minimum": 0
        }
      },
      "ErrorCacheControl": {
        "description": "Public error responses are never cacheable.",
        "schema": {
          "type": "string",
          "const": "no-store"
        }
      }
    },
    "responses": {
      "OpenAIOk": {
        "description": "Success. The body matches the upstream provider's format (SSE when streaming).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PassthroughBody"
            }
          }
        }
      },
      "AnthropicOk": {
        "description": "Success. The body matches Anthropic's official format.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PassthroughBody"
            }
          }
        }
      },
      "VertexOk": {
        "description": "Success. The body matches Google's official format.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PassthroughBody"
            }
          }
        }
      },
      "OpenAIError": {
        "description": "Error. `401` authentication failed · `422` wallet out of credit (top up at\nhttps://console.routemux.com/billing and retry) · `429` rate limited · `503` upstream overloaded.\nThe descriptor reports the billing outcome and links directly to the matching catalog entry.\n",
        "headers": {
          "X-Request-ID": {
            "$ref": "#/components/headers/RequestId"
          },
          "X-RouteMux-Error-Code": {
            "$ref": "#/components/headers/ErrorCode"
          },
          "X-RouteMux-Error-Reference": {
            "$ref": "#/components/headers/ErrorReference"
          },
          "Link": {
            "$ref": "#/components/headers/ErrorDocumentation"
          },
          "Content-Language": {
            "$ref": "#/components/headers/ErrorLanguage"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/ErrorCacheControl"
          },
          "X-RouteMux-Billed": {
            "$ref": "#/components/headers/ErrorBilling"
          },
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/OpenAIErrorBody"
            },
            "example": {
              "error": {
                "code": "BILLING_INSUFFICIENT_CREDITS",
                "message": "The prepaid wallet does not have enough available credit for this request. Top up the wallet, then submit the request again.",
                "type": "billing_error",
                "param": null,
                "reference": "RMX-BILLING-5001",
                "documentation_url": "https://routemux.com/docs/errors#rmx-billing-5001",
                "request_id": "req_01HXYZ...",
                "retry": {
                  "retryable": false,
                  "strategy": "TOP_UP"
                },
                "billing": {
                  "status": "NOT_BILLED"
                }
              }
            }
          }
        }
      },
      "AnthropicError": {
        "description": "Error in the Anthropic envelope with the same canonical RouteMux descriptor.",
        "headers": {
          "X-Request-ID": {
            "$ref": "#/components/headers/RequestId"
          },
          "X-RouteMux-Error-Code": {
            "$ref": "#/components/headers/ErrorCode"
          },
          "X-RouteMux-Error-Reference": {
            "$ref": "#/components/headers/ErrorReference"
          },
          "Link": {
            "$ref": "#/components/headers/ErrorDocumentation"
          },
          "Content-Language": {
            "$ref": "#/components/headers/ErrorLanguage"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/ErrorCacheControl"
          },
          "X-RouteMux-Billed": {
            "$ref": "#/components/headers/ErrorBilling"
          },
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AnthropicErrorBody"
            },
            "example": {
              "type": "error",
              "error": {
                "type": "billing_error",
                "code": "BILLING_INSUFFICIENT_CREDITS",
                "message": "The prepaid wallet does not have enough available credit for this request. Top up the wallet, then submit the request again.",
                "reference": "RMX-BILLING-5001",
                "documentation_url": "https://routemux.com/docs/errors#rmx-billing-5001",
                "request_id": "req_01HXYZ...",
                "retry": {
                  "retryable": false,
                  "strategy": "TOP_UP"
                },
                "billing": {
                  "status": "NOT_BILLED"
                }
              },
              "request_id": "req_01HXYZ..."
            }
          }
        }
      },
      "VertexError": {
        "description": "Error in the Google envelope. `ErrorInfo` and `Help` carry the canonical RouteMux descriptor and documentation link.",
        "headers": {
          "X-Request-ID": {
            "$ref": "#/components/headers/RequestId"
          },
          "X-RouteMux-Error-Code": {
            "$ref": "#/components/headers/ErrorCode"
          },
          "X-RouteMux-Error-Reference": {
            "$ref": "#/components/headers/ErrorReference"
          },
          "Link": {
            "$ref": "#/components/headers/ErrorDocumentation"
          },
          "Content-Language": {
            "$ref": "#/components/headers/ErrorLanguage"
          },
          "Cache-Control": {
            "$ref": "#/components/headers/ErrorCacheControl"
          },
          "X-RouteMux-Billed": {
            "$ref": "#/components/headers/ErrorBilling"
          },
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/VertexErrorBody"
            },
            "example": {
              "error": {
                "code": 422,
                "status": "BILLING_INSUFFICIENT_CREDITS",
                "message": "The prepaid wallet does not have enough available credit for this request. Top up the wallet, then submit the request again.",
                "details": [
                  {
                    "@type": "type.googleapis.com/google.rpc.ErrorInfo",
                    "reason": "BILLING_INSUFFICIENT_CREDITS",
                    "domain": "routemux.com",
                    "metadata": {
                      "reference": "RMX-BILLING-5001",
                      "documentation_url": "https://routemux.com/docs/errors#rmx-billing-5001",
                      "request_id": "req_01HXYZ...",
                      "retryable": "false",
                      "retry_strategy": "TOP_UP",
                      "billing_status": "NOT_BILLED"
                    }
                  },
                  {
                    "@type": "type.googleapis.com/google.rpc.Help",
                    "links": [
                      {
                        "description": "RouteMux error RMX-BILLING-5001",
                        "url": "https://routemux.com/docs/errors#rmx-billing-5001"
                      }
                    ]
                  }
                ]
              }
            }
          }
        }
      }
    }
  }
}
