{
  "openapi": "3.1.0",
  "info": {
    "title": "UberLLM API",
    "version": "2026-11-04",
    "summary": "One API key for text, image, video, music and speech models, OpenAI- and Anthropic-compatible.",
    "description": "UberLLM is an API for text, image, video, music and speech models. Each request is sent to an available third-party provider for the model you name and billed what that provider charged, with no UberLLM fee on requests. Accounts are prepaid (card top-ups from $5); every request is listed with its cost in Dashboard → Activity.\n\n* OpenAI-compatible base URL: `https://api.uberllm.dev/v1` (`/chat/completions`, `/responses`, `/images`, `/audio`, `/models`).\n* Anthropic-compatible base URL: `https://api.uberllm.dev` (`/v1/messages`).\n* Model ids contain slashes (`deepseek/deepseek-v4-flash`). In `/v1/models/{model_id}` send them unescaped: `/v1/models/deepseek/deepseek-v4-flash`.\n* Errors use the OpenAI envelope `{\"error\": {\"code\", \"message\", \"type\"}}` (Anthropic's `{\"type\": \"error\", \"error\": {...}}` on `/v1/messages`).\n\nGuides: https://uberllm.dev/docs · Machine-readable summary and live prices: https://uberllm.dev/llms.txt · MCP server (Streamable HTTP, same key): https://api.uberllm.dev/mcp",
    "termsOfService": "https://uberllm.dev/terms",
    "contact": {
      "name": "UberLLM support",
      "email": "support@uberllm.dev",
      "url": "https://uberllm.dev/contact"
    },
    "license": {
      "name": "Proprietary",
      "url": "https://uberllm.dev/terms"
    },
    "x-logo": {
      "url": "https://uberllm.dev/logo.svg",
      "altText": "UberLLM"
    }
  },
  "externalDocs": {
    "description": "UberLLM documentation",
    "url": "https://uberllm.dev/docs"
  },
  "servers": [
    {
      "url": "https://api.uberllm.dev",
      "description": "Production"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    },
    {
      "apiKeyHeader": []
    }
  ],
  "tags": [
    {
      "name": "Chat",
      "description": "Text models: OpenAI Chat Completions, OpenAI Responses and Anthropic Messages.",
      "externalDocs": {
        "url": "https://uberllm.dev/docs/quickstart"
      }
    },
    {
      "name": "Models",
      "description": "What can be called right now, with live prices. Readable without a key.",
      "externalDocs": {
        "url": "https://uberllm.dev/docs/models-and-routing"
      }
    },
    {
      "name": "Images",
      "description": "Make and edit pictures; the image comes back in the answer.",
      "externalDocs": {
        "url": "https://uberllm.dev/docs/media"
      }
    },
    {
      "name": "Video",
      "description": "Video is a job: start it, poll it, download the result.",
      "externalDocs": {
        "url": "https://uberllm.dev/docs/media"
      }
    },
    {
      "name": "Music",
      "description": "Same job flow as video.",
      "externalDocs": {
        "url": "https://uberllm.dev/docs/media#music"
      }
    },
    {
      "name": "Audio",
      "description": "Speech from text and text from recordings.",
      "externalDocs": {
        "url": "https://uberllm.dev/docs/media#speech"
      }
    },
    {
      "name": "Files",
      "description": "Upload a source picture once and use it for 24 hours.",
      "externalDocs": {
        "url": "https://uberllm.dev/docs/media#upload-a-picture-once"
      }
    },
    {
      "name": "Pricing",
      "description": "Price a media request before you run it, and hold that price for 15 minutes."
    },
    {
      "name": "Account",
      "description": "Balance of the key's account."
    }
  ],
  "paths": {
    "/v1/chat/completions": {
      "post": {
        "tags": [
          "Chat"
        ],
        "operationId": "createChatCompletion",
        "summary": "Create a chat completion (OpenAI format)",
        "description": "OpenAI Chat Completions on every chat model. The body is forwarded to the provider, so standard OpenAI fields (`tools`, `response_format`, `reasoning`, `temperature`, …) work where the model supports them. UberLLM adds `models` (fallbacks), `provider` (routing) and `metadata` (tags). Failed attempts are retried before the first byte; a request that fails is not billed.",
        "externalDocs": {
          "url": "https://uberllm.dev/docs/openai-sdk"
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatCompletionRequest"
              },
              "example": {
                "model": "deepseek/deepseek-v4-flash",
                "messages": [
                  {
                    "role": "user",
                    "content": "Say hello."
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The completion, or a stream of `chat.completion.chunk` events ending with `data: [DONE]`. `usage.cost_usd` is what the request was billed.",
            "headers": {
              "X-UberLLM-Cost-USD": {
                "$ref": "#/components/headers/X-UberLLM-Cost-USD"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletion"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-sent events (sent when the request has `\"stream\": true`)."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/responses": {
      "post": {
        "tags": [
          "Chat"
        ],
        "operationId": "createResponse",
        "summary": "Create a response (OpenAI Responses API, stateless)",
        "description": "OpenAI's Responses API on every chat model. Stateless: send the whole conversation in `input` each call. `previous_response_id`, `conversation`, `background: true`, `item_reference` items and stored `prompt` templates are refused with `400 unsupported_parameter`. Hosted tools (web_search, file_search, …) are left out of the request.",
        "externalDocs": {
          "url": "https://uberllm.dev/docs/responses"
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResponsesRequest"
              },
              "example": {
                "model": "deepseek/deepseek-v4.1-flash",
                "instructions": "Answer in one short sentence.",
                "input": "What is the capital of France?"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A `response` object, or `response.*` server-sent events when `stream` is true.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseObject"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-sent events (sent when the request has `\"stream\": true`)."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/messages": {
      "post": {
        "tags": [
          "Chat"
        ],
        "operationId": "createMessage",
        "summary": "Create a message (Anthropic format)",
        "description": "Anthropic's Messages API on every chat model (Claude Code and the Anthropic SDKs work with base URL `https://api.uberllm.dev`). The key may also be sent as `x-api-key`. Errors use Anthropic's error shape.",
        "externalDocs": {
          "url": "https://uberllm.dev/docs/anthropic-sdk"
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MessagesRequest"
              },
              "example": {
                "model": "deepseek/deepseek-v4-flash",
                "max_tokens": 256,
                "messages": [
                  {
                    "role": "user",
                    "content": "Say hello."
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A message, or Anthropic server-sent events when `stream` is true (the cost is in the `usage` of `message_delta`).",
            "headers": {
              "X-UberLLM-Cost-USD": {
                "$ref": "#/components/headers/X-UberLLM-Cost-USD"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/X-RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Message"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-sent events (sent when the request has `\"stream\": true`)."
                }
              }
            }
          },
          "4XX": {
            "description": "Refused (Anthropic error shape); nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "5XX": {
            "description": "No provider could serve it, or a temporary problem (Anthropic error shape); nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/messages/count_tokens": {
      "post": {
        "tags": [
          "Chat"
        ],
        "operationId": "countMessageTokens",
        "summary": "Count the input tokens of a message request",
        "description": "Takes the same body as `POST /v1/messages` and answers with the input token count (text, tools, images and documents) that the request's hold is sized on. Free.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MessagesRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The count.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "input_tokens"
                  ],
                  "properties": {
                    "input_tokens": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "input_tokens": 12
                }
              }
            }
          },
          "4XX": {
            "description": "Refused (Anthropic error shape); nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          },
          "5XX": {
            "description": "No provider could serve it, or a temporary problem (Anthropic error shape); nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/models": {
      "get": {
        "tags": [
          "Models"
        ],
        "operationId": "listModels",
        "summary": "List models you can call now",
        "description": "Every model a request can be routed to right now, with live prices. Without `type` the list is chat models only. Works without a key (per-IP limited, cached 30 s).",
        "security": [
          {},
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "`chat`, `image`, `video`, `music`, `speech`, `transcription`, `audio` (speech and transcription) or `all`; several may be joined with commas.",
            "schema": {
              "type": "string",
              "default": "chat"
            },
            "example": "video"
          }
        ],
        "responses": {
          "200": {
            "description": "The models.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/v1/models/aliases": {
      "get": {
        "tags": [
          "Models"
        ],
        "operationId": "listModelAliases",
        "summary": "List model aliases and what they stand for now",
        "description": "`best-price:<job>` and `fastest:<job>` aliases that resolve right now, with the model each picks. Works without a key.",
        "security": [
          {},
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "The aliases.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AliasList"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/v1/models/{model_id}": {
      "get": {
        "tags": [
          "Models"
        ],
        "operationId": "getModel",
        "summary": "Get one model",
        "description": "One model with its price, limits and, for a media model, `parameters`: a JSON Schema of the request body it takes. Model ids contain slashes: send them unescaped (`/v1/models/fal-ai/vidu/q3/text-to-video/turbo`). An alias such as `best-price:chat` answers with the model it stands for and `alias` set. Works without a key.",
        "security": [
          {},
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "model_id",
            "in": "path",
            "required": true,
            "description": "Model id or alias, slashes unescaped.",
            "schema": {
              "type": "string"
            },
            "example": "deepseek/deepseek-v4-flash"
          }
        ],
        "responses": {
          "200": {
            "description": "The model.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Model"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/balance": {
      "get": {
        "tags": [
          "Account"
        ],
        "operationId": "getBalance",
        "summary": "Get the account balance",
        "responses": {
          "200": {
            "description": "The balance in US dollars.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Balance"
                },
                "example": {
                  "object": "balance",
                  "balance_usd": 12.4,
                  "held_usd": 0.35,
                  "available_usd": 12.05
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/images/generations": {
      "post": {
        "tags": [
          "Images"
        ],
        "operationId": "createImage",
        "summary": "Make an image",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImageRequest"
              },
              "example": {
                "model": "venice/z-image-turbo",
                "prompt": "a red apple on a white table",
                "n": 1,
                "size": "1024x1024"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The images (`data`), or a `Quote` when `validate` is true.",
            "headers": {
              "X-UberLLM-Cost-USD": {
                "$ref": "#/components/headers/X-UberLLM-Cost-USD"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ImageResponse"
                    },
                    {
                      "$ref": "#/components/schemas/Quote"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/images/edits": {
      "post": {
        "tags": [
          "Images"
        ],
        "operationId": "editImage",
        "summary": "Edit a picture",
        "description": "Send the source picture in `image` (or `image_url`, `input_images`, `images`), as JSON or as a multipart upload. Masks are not supported. No source picture: `400 image_required`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImageEditRequest"
              },
              "example": {
                "model": "google/nano-banana-pro-edit",
                "prompt": "make the sky a sunset",
                "image": "https://example.com/skyline.png"
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "model",
                  "prompt",
                  "image"
                ],
                "properties": {
                  "model": {
                    "type": "string"
                  },
                  "prompt": {
                    "type": "string"
                  },
                  "image": {
                    "type": "string",
                    "contentMediaType": "application/octet-stream"
                  },
                  "n": {
                    "type": "integer"
                  },
                  "size": {
                    "type": "string"
                  },
                  "response_format": {
                    "type": "string",
                    "enum": [
                      "url",
                      "b64_json"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The images, or a `Quote` when `validate` is true.",
            "headers": {
              "X-UberLLM-Cost-USD": {
                "$ref": "#/components/headers/X-UberLLM-Cost-USD"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ImageResponse"
                    },
                    {
                      "$ref": "#/components/schemas/Quote"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/video/generations": {
      "post": {
        "tags": [
          "Video"
        ],
        "operationId": "createVideoJob",
        "summary": "Start a video job",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VideoRequest"
              },
              "example": {
                "model": "fal-ai/vidu/q3/text-to-video/turbo",
                "prompt": "a red ball bouncing on green grass",
                "duration_seconds": 5
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The job was accepted; poll `poll_url`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MediaJob"
                }
              }
            }
          },
          "200": {
            "description": "A `Quote` when `validate` is true, or the ended job of a repeated `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/Quote"
                    },
                    {
                      "$ref": "#/components/schemas/MediaJob"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/video/generations/{job_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/JobId"
        }
      ],
      "get": {
        "tags": [
          "Video"
        ],
        "operationId": "getVideoJob",
        "summary": "Check a video job",
        "description": "HTTP 202 while the job runs, 200 once it has ended. Poll every 5–10 seconds, or send `callback_url` when starting it.",
        "responses": {
          "200": {
            "description": "The job has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MediaJob"
                }
              }
            }
          },
          "202": {
            "description": "The job is queued or running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MediaJob"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "tags": [
          "Video"
        ],
        "operationId": "cancelVideoJob",
        "summary": "Ask to stop a video job",
        "description": "A request to stop, not a promise: a job the provider finishes anyway ends `succeeded` and is billed; one it stops ends `canceled` and costs nothing.",
        "responses": {
          "200": {
            "description": "The job.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MediaJob"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/music/generations": {
      "post": {
        "tags": [
          "Music"
        ],
        "operationId": "createMusicJob",
        "summary": "Start a music job",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MusicRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The job was accepted; poll `poll_url`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MediaJob"
                }
              }
            }
          },
          "200": {
            "description": "A `Quote` when `validate` is true, or the ended job of a repeated `Idempotency-Key`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/Quote"
                    },
                    {
                      "$ref": "#/components/schemas/MediaJob"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/music/generations/{job_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/JobId"
        }
      ],
      "get": {
        "tags": [
          "Music"
        ],
        "operationId": "getMusicJob",
        "summary": "Check a music job",
        "responses": {
          "200": {
            "description": "The job has ended.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MediaJob"
                }
              }
            }
          },
          "202": {
            "description": "The job is queued or running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MediaJob"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "tags": [
          "Music"
        ],
        "operationId": "cancelMusicJob",
        "summary": "Ask to stop a music job",
        "responses": {
          "200": {
            "description": "The job.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MediaJob"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/media/artifacts/{job_id}/{index}": {
      "get": {
        "tags": [
          "Video",
          "Music",
          "Images"
        ],
        "operationId": "downloadArtifact",
        "summary": "Download a result file",
        "description": "The file a job made (`results[].url`). Video and music files are kept about 3 hours after the job ends, image links about 15 minutes; after that `404 artifact_expired`.",
        "parameters": [
          {
            "$ref": "#/components/parameters/JobId"
          },
          {
            "name": "index",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 0
            },
            "description": "`artifact_index` of the result."
          }
        ],
        "responses": {
          "200": {
            "description": "The file.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "application/octet-stream"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/audio/speech": {
      "post": {
        "tags": [
          "Audio"
        ],
        "operationId": "createSpeech",
        "summary": "Speech from text",
        "description": "The answer is the audio file. Its cost is in the `X-UberLLM-Cost-USD` header. Billed per started 1K characters of `input`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SpeechRequest"
              },
              "example": {
                "model": "x-ai/tts-xai-v1",
                "input": "Hello from UberLLM."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The audio (or a `Quote` as JSON when `validate` is true).",
            "headers": {
              "X-UberLLM-Cost-USD": {
                "$ref": "#/components/headers/X-UberLLM-Cost-USD"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "audio/mpeg": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "audio/mpeg"
                }
              },
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "application/octet-stream"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Quote"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/audio/transcriptions": {
      "post": {
        "tags": [
          "Audio"
        ],
        "operationId": "createTranscription",
        "summary": "Text from a recording",
        "description": "Multipart form with `file` and `model`. Billed per minute of audio; files up to 40 MB. UberLLM's own fields go in the form too and are never sent to the model.",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/TranscriptionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The text. `json` (default) carries `usage.cost_usd`; `text`, `srt` and `vtt` answers carry the cost only in the header.",
            "headers": {
              "X-UberLLM-Cost-USD": {
                "$ref": "#/components/headers/X-UberLLM-Cost-USD"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Transcription"
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/quote": {
      "post": {
        "tags": [
          "Pricing"
        ],
        "operationId": "createQuote",
        "summary": "Price a media request and hold the price 15 minutes",
        "description": "Takes the same body as an image, video, music or speech request (for a transcription: `model` and `duration_seconds`). Nothing is charged or held. Send the request with the returned `quote_id` within 15 minutes to be billed at most `max_cost_usd`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "model"
                ],
                "properties": {
                  "model": {
                    "type": "string"
                  }
                },
                "additionalProperties": true
              },
              "example": {
                "model": "kling/kling-o3",
                "prompt": "a red ball bouncing",
                "duration_seconds": 5
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The quote.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Quote"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/files": {
      "post": {
        "tags": [
          "Files"
        ],
        "operationId": "uploadFile",
        "summary": "Upload a picture",
        "description": "PNG, JPEG, WebP, GIF, HEIC or AVIF, up to 10 MB, kept 24 hours, at most 500 per account. Use the id or `url` anywhere a source picture goes.",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "contentMediaType": "application/octet-stream"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The file.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/File"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "413": {
            "$ref": "#/components/responses/TooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "503": {
            "$ref": "#/components/responses/Unavailable"
          }
        }
      }
    },
    "/v1/files/{file_id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/FileId"
        }
      ],
      "get": {
        "tags": [
          "Files"
        ],
        "operationId": "getFile",
        "summary": "Describe an uploaded file",
        "responses": {
          "200": {
            "description": "The file.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/File"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "tags": [
          "Files"
        ],
        "operationId": "deleteFile",
        "summary": "Delete an uploaded file now",
        "responses": {
          "200": {
            "description": "Deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "object": {
                      "const": "file"
                    },
                    "deleted": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/files/{file_id}/content": {
      "parameters": [
        {
          "$ref": "#/components/parameters/FileId"
        }
      ],
      "get": {
        "tags": [
          "Files"
        ],
        "operationId": "downloadFile",
        "summary": "Download an uploaded file",
        "responses": {
          "200": {
            "description": "The file.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "application/octet-stream"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "ull_…",
        "description": "An UberLLM API key (`ull_…`) from https://uberllm.dev/dashboard/keys: `Authorization: Bearer ull_…`."
      },
      "apiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "The same key in Anthropic's header."
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string",
          "maxLength": 255
        },
        "description": "Any unique string. Repeating the same request with the same key within 24 hours returns the same job; the same key with a different request is refused with `409 idempotency_key_reused`."
      },
      "JobId": {
        "name": "job_id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "FileId": {
        "name": "file_id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        },
        "example": "file_3f9c…"
      }
    },
    "headers": {
      "X-Request-Id": {
        "description": "The request's id, the same as its row in Dashboard → Activity.",
        "schema": {
          "type": "string"
        }
      },
      "X-UberLLM-Cost-USD": {
        "description": "What the call cost in US dollars (absent on streams: read `usage.cost_usd`).",
        "schema": {
          "type": "string"
        }
      },
      "X-RateLimit-Limit": {
        "description": "Requests this key may send per minute.",
        "schema": {
          "type": "integer"
        }
      },
      "X-RateLimit-Remaining": {
        "description": "Requests left in the current minute.",
        "schema": {
          "type": "integer"
        }
      },
      "X-RateLimit-Reset": {
        "description": "When the window starts over (Unix seconds).",
        "schema": {
          "type": "integer"
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "The request was refused; nothing was charged. `code` says why (`invalid_request`, `context_length_exceeded`, `tools_not_supported`, `wrong_endpoint`, `max_price_exceeded`, `unsupported_routing_option`, `image_required`, `max_cost_too_low`, `quote_mismatch`, …).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Missing or invalid API key (`missing_api_key`, `invalid_api_key`).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "message": "Missing API key. Provide it as 'Authorization: Bearer ull_...'.",
                "type": "authentication_error",
                "code": "missing_api_key"
              }
            }
          }
        }
      },
      "PaymentRequired": {
        "description": "`insufficient_credits` (top up at Dashboard → Credits) or `key_spend_cap_exceeded` (the key's spend limit).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "`model_not_found`, `not_found` (no such job), `file_not_found`, `artifact_expired` or `quote_not_found`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Conflict": {
        "description": "`idempotency_key_reused` or `quote_used`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "TooLarge": {
        "description": "`request_too_large` or `file_too_large`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "RateLimited": {
        "description": "`rate_limited` (the key's per-minute limit) or `too_many_files`. Wait `Retry-After` seconds.",
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unavailable": {
        "description": "`no_available_provider` (nobody can serve the model right now, after automatic retries), `no_timing_data` or `service_unavailable`. Nothing was charged.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "message"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "type": {
                "type": "string"
              }
            }
          }
        }
      },
      "AnthropicError": {
        "type": "object",
        "properties": {
          "type": {
            "const": "error"
          },
          "error": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "Metadata": {
        "type": "object",
        "maxProperties": 16,
        "additionalProperties": {
          "type": "string",
          "maxLength": 512
        },
        "description": "Your own tags (up to 16 text values; keys up to 64 characters without a colon). Stored with the request, shown in Activity and the CSV export, never sent to a provider."
      },
      "ChatProvider": {
        "type": "object",
        "description": "Routing options. An option UberLLM cannot apply is refused with `400 unsupported_routing_option`.",
        "properties": {
          "only": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "allow": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "ignore": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "deny": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "order": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sort": {
            "type": "string",
            "enum": [
              "price",
              "latency",
              "uptime",
              "throughput"
            ]
          },
          "max_price": {
            "type": "object",
            "description": "US dollars per million tokens.",
            "properties": {
              "prompt": {
                "type": "number"
              },
              "completion": {
                "type": "number"
              }
            }
          },
          "allow_fallbacks": {
            "type": "boolean"
          },
          "data_collection": {
            "const": "allow"
          },
          "zdr": {
            "const": false
          },
          "require_parameters": {
            "const": false
          }
        }
      },
      "ChatMessage": {
        "type": "object",
        "required": [
          "role"
        ],
        "additionalProperties": true,
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "system",
              "developer",
              "user",
              "assistant",
              "tool"
            ]
          },
          "content": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "name": {
            "type": "string"
          },
          "tool_calls": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "tool_call_id": {
            "type": "string"
          }
        }
      },
      "ChatCompletionRequest": {
        "type": "object",
        "required": [
          "model",
          "messages"
        ],
        "additionalProperties": true,
        "description": "OpenAI Chat Completions body. Fields not listed here are forwarded to the provider as sent.",
        "properties": {
          "model": {
            "type": "string",
            "description": "A model id from `GET /v1/models`, an alias (`best-price:chat`, `fastest:chat`) or an id with a `:floor` / `:nitro` suffix."
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChatMessage"
            }
          },
          "stream": {
            "type": "boolean"
          },
          "max_tokens": {
            "type": "integer"
          },
          "max_completion_tokens": {
            "type": "integer"
          },
          "temperature": {
            "type": "number"
          },
          "top_p": {
            "type": "number"
          },
          "stop": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ]
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "tool_choice": {},
          "response_format": {
            "type": "object",
            "additionalProperties": true
          },
          "provider": {
            "$ref": "#/components/schemas/ChatProvider"
          },
          "models": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 4,
            "description": "Fallback model ids, tried in order only when the one before cannot be served right now (`no_available_provider`) or is above `provider.max_price`. At most 5 models in `model` and `models` together."
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          }
        }
      },
      "Usage": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "prompt_tokens": {
            "type": "integer"
          },
          "completion_tokens": {
            "type": "integer"
          },
          "total_tokens": {
            "type": "integer"
          },
          "cost_usd": {
            "type": [
              "number",
              "null"
            ],
            "description": "What this request is billed, in US dollars."
          }
        }
      },
      "ChatCompletion": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "const": "chat.completion"
          },
          "created": {
            "type": "integer"
          },
          "model": {
            "type": "string",
            "description": "The model that answered (a fallback or alias target when one was used)."
          },
          "choices": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true,
              "properties": {
                "index": {
                  "type": "integer"
                },
                "message": {
                  "$ref": "#/components/schemas/ChatMessage"
                },
                "finish_reason": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          },
          "usage": {
            "$ref": "#/components/schemas/Usage"
          }
        }
      },
      "ResponsesRequest": {
        "type": "object",
        "required": [
          "model",
          "input"
        ],
        "additionalProperties": true,
        "properties": {
          "model": {
            "type": "string"
          },
          "input": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            ]
          },
          "instructions": {
            "type": "string"
          },
          "stream": {
            "type": "boolean"
          },
          "max_output_tokens": {
            "type": "integer"
          },
          "temperature": {
            "type": "number"
          },
          "top_p": {
            "type": "number"
          },
          "seed": {
            "type": "integer"
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "tool_choice": {},
          "parallel_tool_calls": {
            "type": "boolean"
          },
          "reasoning": {
            "type": "object",
            "properties": {
              "effort": {
                "type": "string"
              }
            },
            "additionalProperties": true
          },
          "text": {
            "type": "object",
            "additionalProperties": true
          },
          "provider": {
            "$ref": "#/components/schemas/ChatProvider"
          },
          "models": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 4,
            "description": "Fallback model ids, tried in order only when the one before cannot be served right now (`no_available_provider`) or is above `provider.max_price`. At most 5 models in `model` and `models` together."
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          }
        }
      },
      "ResponseObject": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "const": "response"
          },
          "created_at": {
            "type": "integer"
          },
          "status": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "store": {
            "const": false
          },
          "output": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "usage": {
            "type": "object",
            "additionalProperties": true,
            "properties": {
              "input_tokens": {
                "type": "integer"
              },
              "output_tokens": {
                "type": "integer"
              },
              "total_tokens": {
                "type": "integer"
              },
              "cost_usd": {
                "type": [
                  "number",
                  "null"
                ]
              }
            }
          }
        }
      },
      "MessagesRequest": {
        "type": "object",
        "required": [
          "model",
          "max_tokens",
          "messages"
        ],
        "additionalProperties": true,
        "description": "Anthropic Messages body.",
        "properties": {
          "model": {
            "type": "string"
          },
          "max_tokens": {
            "type": "integer"
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "role",
                "content"
              ],
              "additionalProperties": true,
              "properties": {
                "role": {
                  "type": "string",
                  "enum": [
                    "user",
                    "assistant"
                  ]
                },
                "content": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  ]
                }
              }
            }
          },
          "system": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            ]
          },
          "stream": {
            "type": "boolean"
          },
          "temperature": {
            "type": "number"
          },
          "stop_sequences": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "tool_choice": {
            "type": "object",
            "additionalProperties": true
          },
          "thinking": {
            "type": "object",
            "additionalProperties": true,
            "description": "`{\"type\": \"enabled\", \"budget_tokens\": 2000}` or `{\"type\": \"adaptive\"}`. Without it, models answer without thinking where they can."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "Message": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "const": "message"
          },
          "role": {
            "const": "assistant"
          },
          "model": {
            "type": "string"
          },
          "content": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "stop_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "usage": {
            "type": "object",
            "additionalProperties": true,
            "properties": {
              "input_tokens": {
                "type": "integer"
              },
              "output_tokens": {
                "type": "integer"
              },
              "cost_usd": {
                "type": [
                  "number",
                  "null"
                ]
              }
            }
          }
        }
      },
      "Pricing": {
        "type": "object",
        "additionalProperties": true,
        "description": "Chat models: `input_usd` / `output_usd` per `1M tokens` (and OpenRouter-style `prompt` / `completion` per token, as strings). Media models: `usd` per `unit`. `list_*` is the model maker's own price.",
        "properties": {
          "unit": {
            "type": "string",
            "examples": [
              "1M tokens",
              "image",
              "second",
              "megapixel",
              "minute",
              "1K characters",
              "job"
            ]
          },
          "input_usd": {
            "type": "number"
          },
          "output_usd": {
            "type": "number"
          },
          "cache_read_usd": {
            "type": "number"
          },
          "cache_write_usd": {
            "type": "number"
          },
          "list_input_usd": {
            "type": "number"
          },
          "list_output_usd": {
            "type": "number"
          },
          "prompt": {
            "type": "string"
          },
          "completion": {
            "type": "string"
          },
          "input_cache_read": {
            "type": "string"
          },
          "input_cache_write": {
            "type": "string"
          },
          "usd": {
            "type": "number"
          },
          "list_usd": {
            "type": "number"
          }
        }
      },
      "Model": {
        "type": "object",
        "required": [
          "id",
          "object",
          "type"
        ],
        "additionalProperties": true,
        "properties": {
          "id": {
            "type": "string",
            "examples": [
              "deepseek/deepseek-v4-flash"
            ]
          },
          "object": {
            "const": "model"
          },
          "type": {
            "type": "string",
            "enum": [
              "chat",
              "image",
              "video",
              "music",
              "speech",
              "transcription"
            ]
          },
          "display_name": {
            "type": "string"
          },
          "owned_by": {
            "type": "string"
          },
          "created": {
            "type": "integer"
          },
          "available": {
            "type": "boolean",
            "description": "`true` when a request for it can be served right now."
          },
          "nsfw": {
            "type": "boolean",
            "description": "`true` for a model made for adult or unfiltered content."
          },
          "endpoints": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The paths that serve it."
          },
          "input_modalities": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "output_modalities": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "context_length": {
            "type": "integer"
          },
          "max_output_tokens": {
            "type": "integer"
          },
          "supports_tools": {
            "type": "boolean"
          },
          "supports_reasoning": {
            "type": "boolean"
          },
          "supports_vision": {
            "type": "boolean"
          },
          "supported_parameters": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "architecture": {
            "type": "object",
            "additionalProperties": true
          },
          "top_provider": {
            "type": "object",
            "additionalProperties": true
          },
          "pricing": {
            "$ref": "#/components/schemas/Pricing"
          },
          "parameters": {
            "type": "object",
            "additionalProperties": true,
            "description": "Media models, on `GET /v1/models/{model_id}`: a JSON Schema of the request body (clip lengths, resolutions, shapes, source pictures)."
          },
          "alias": {
            "type": "string",
            "description": "Set when the model was asked for by an alias."
          }
        }
      },
      "ModelList": {
        "type": "object",
        "required": [
          "object",
          "data"
        ],
        "properties": {
          "object": {
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Model"
            }
          }
        }
      },
      "AliasList": {
        "type": "object",
        "properties": {
          "object": {
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "alias": {
                  "type": "string",
                  "examples": [
                    "best-price:chat"
                  ]
                },
                "model": {
                  "type": "string"
                },
                "typical_request_usd": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "Balance": {
        "type": "object",
        "required": [
          "balance_usd",
          "held_usd",
          "available_usd"
        ],
        "properties": {
          "object": {
            "const": "balance"
          },
          "balance_usd": {
            "type": "number"
          },
          "held_usd": {
            "type": "number",
            "description": "Set aside for requests still running."
          },
          "available_usd": {
            "type": "number",
            "description": "What new requests can use."
          },
          "saved_24h_usd": {
            "type": "number",
            "description": "What the last 24 hours of calls saved against official list prices (left out under a cent)."
          }
        }
      },
      "ImageRequest": {
        "type": "object",
        "required": [
          "model",
          "prompt"
        ],
        "additionalProperties": true,
        "properties": {
          "model": {
            "type": "string",
            "description": "An image model id or `best-price:image` / `fastest:image`."
          },
          "prompt": {
            "type": "string"
          },
          "n": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10
          },
          "size": {
            "type": "string",
            "examples": [
              "1024x1024"
            ]
          },
          "response_format": {
            "type": "string",
            "enum": [
              "url",
              "b64_json"
            ],
            "default": "url"
          },
          "validate": {
            "type": "boolean",
            "description": "`true`: check the request and answer with its price (a `Quote`, HTTP 200). Nothing is made and nothing is charged."
          },
          "max_cost": {
            "type": "number",
            "description": "The most this request may cost, in US dollars. A request that can cost more is refused with `400 max_cost_too_low`."
          },
          "quote_id": {
            "type": "string",
            "description": "A quote from `POST /v1/quote` (valid 15 minutes). The request must ask for the same thing as the quote; it is billed at most the quote's `max_cost_usd`."
          },
          "provider": {
            "type": "object",
            "properties": {
              "max_price": {
                "type": "number",
                "description": "The most one pricing unit (image, second, megapixel, minute, 1K characters or request) may cost, in US dollars."
              }
            },
            "additionalProperties": false,
            "description": "Only `max_price` is accepted on media routes; any other option is refused with `400 unsupported_routing_option`."
          },
          "models": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 4,
            "description": "Fallback model ids, tried in order only when the one before cannot be served right now (`no_available_provider`) or is above `provider.max_price`. At most 5 models in `model` and `models` together."
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          }
        }
      },
      "ImageEditRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ImageRequest"
          },
          {
            "type": "object",
            "properties": {
              "image": {
                "type": "string",
                "description": "An `https://` link, a `data:` URI, plain base64 (PNG, JPEG or WebP) or the id of a file uploaded to `/v1/files`."
              },
              "image_url": {
                "type": "string",
                "description": "An `https://` link, a `data:` URI, plain base64 (PNG, JPEG or WebP) or the id of a file uploaded to `/v1/files`."
              },
              "input_images": {
                "type": "array",
                "maxItems": 8,
                "items": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "url": {
                          "type": "string"
                        },
                        "role": {
                          "type": "string"
                        }
                      }
                    }
                  ]
                },
                "description": "The first is the picture to edit, the rest are references."
              },
              "images": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "image_url": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "JobDelivery": {
        "type": "object",
        "properties": {
          "callback_url": {
            "type": "string",
            "format": "uri",
            "description": "A public `https://` link. When the job has ended and its bill is final, UberLLM POSTs the job JSON to it, signed with `UberLLM-Signature`. `webhook_url` is read the same."
          },
          "output_upload_url": {
            "type": "string",
            "format": "uri",
            "description": "An `https://` link that accepts `PUT` (e.g. a presigned S3/R2/GCS URL); the result is uploaded there."
          },
          "output_upload_urls": {
            "type": "array",
            "maxItems": 4,
            "items": {
              "type": "string",
              "format": "uri"
            }
          }
        }
      },
      "VideoRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/JobDelivery"
          },
          {
            "type": "object",
            "required": [
              "model",
              "prompt"
            ],
            "additionalProperties": true,
            "description": "Each model takes its own clip lengths, resolutions and shapes: see `parameters` on `GET /v1/models/{model_id}`.",
            "properties": {
              "model": {
                "type": "string"
              },
              "prompt": {
                "type": "string"
              },
              "duration_seconds": {
                "type": "number"
              },
              "resolution": {
                "type": "string",
                "examples": [
                  "720p"
                ]
              },
              "aspect_ratio": {
                "type": "string",
                "examples": [
                  "16:9"
                ]
              },
              "audio": {
                "type": "boolean"
              },
              "image_url": {
                "type": "string",
                "description": "First frame (image-to-video models). An `https://` link, a `data:` URI, plain base64 (PNG, JPEG or WebP) or the id of a file uploaded to `/v1/files`."
              },
              "end_image_url": {
                "type": "string",
                "description": "Last frame, for models that blend two pictures."
              },
              "input_images": {
                "type": "array",
                "maxItems": 8,
                "items": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "url": {
                          "type": "string"
                        },
                        "role": {
                          "type": "string",
                          "examples": [
                            "reference"
                          ]
                        }
                      }
                    }
                  ]
                }
              },
              "validate": {
                "type": "boolean",
                "description": "`true`: check the request and answer with its price (a `Quote`, HTTP 200). Nothing is made and nothing is charged."
              },
              "max_cost": {
                "type": "number",
                "description": "The most this request may cost, in US dollars. A request that can cost more is refused with `400 max_cost_too_low`."
              },
              "quote_id": {
                "type": "string",
                "description": "A quote from `POST /v1/quote` (valid 15 minutes). The request must ask for the same thing as the quote; it is billed at most the quote's `max_cost_usd`."
              },
              "provider": {
                "type": "object",
                "properties": {
                  "max_price": {
                    "type": "number",
                    "description": "The most one pricing unit (image, second, megapixel, minute, 1K characters or request) may cost, in US dollars."
                  }
                },
                "additionalProperties": false,
                "description": "Only `max_price` is accepted on media routes; any other option is refused with `400 unsupported_routing_option`."
              },
              "models": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "maxItems": 4,
                "description": "Fallback model ids, tried in order only when the one before cannot be served right now (`no_available_provider`) or is above `provider.max_price`. At most 5 models in `model` and `models` together."
              },
              "metadata": {
                "$ref": "#/components/schemas/Metadata"
              }
            }
          }
        ]
      },
      "MusicRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/JobDelivery"
          },
          {
            "type": "object",
            "required": [
              "model",
              "prompt"
            ],
            "additionalProperties": true,
            "description": "Model-specific fields: see `parameters` on `GET /v1/models/{model_id}`.",
            "properties": {
              "model": {
                "type": "string"
              },
              "prompt": {
                "type": "string"
              },
              "validate": {
                "type": "boolean",
                "description": "`true`: check the request and answer with its price (a `Quote`, HTTP 200). Nothing is made and nothing is charged."
              },
              "max_cost": {
                "type": "number",
                "description": "The most this request may cost, in US dollars. A request that can cost more is refused with `400 max_cost_too_low`."
              },
              "quote_id": {
                "type": "string",
                "description": "A quote from `POST /v1/quote` (valid 15 minutes). The request must ask for the same thing as the quote; it is billed at most the quote's `max_cost_usd`."
              },
              "provider": {
                "type": "object",
                "properties": {
                  "max_price": {
                    "type": "number",
                    "description": "The most one pricing unit (image, second, megapixel, minute, 1K characters or request) may cost, in US dollars."
                  }
                },
                "additionalProperties": false,
                "description": "Only `max_price` is accepted on media routes; any other option is refused with `400 unsupported_routing_option`."
              },
              "models": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "maxItems": 4,
                "description": "Fallback model ids, tried in order only when the one before cannot be served right now (`no_available_provider`) or is above `provider.max_price`. At most 5 models in `model` and `models` together."
              },
              "metadata": {
                "$ref": "#/components/schemas/Metadata"
              }
            }
          }
        ]
      },
      "SpeechRequest": {
        "type": "object",
        "required": [
          "model",
          "input"
        ],
        "additionalProperties": true,
        "properties": {
          "model": {
            "type": "string"
          },
          "input": {
            "type": "string"
          },
          "voice": {
            "type": "string",
            "description": "Each model has its own voices (`GET /v1/models/{model_id}`)."
          },
          "response_format": {
            "type": "string",
            "examples": [
              "mp3",
              "wav"
            ]
          },
          "speed": {
            "type": "number"
          },
          "validate": {
            "type": "boolean",
            "description": "`true`: check the request and answer with its price (a `Quote`, HTTP 200). Nothing is made and nothing is charged."
          },
          "max_cost": {
            "type": "number",
            "description": "The most this request may cost, in US dollars. A request that can cost more is refused with `400 max_cost_too_low`."
          },
          "quote_id": {
            "type": "string",
            "description": "A quote from `POST /v1/quote` (valid 15 minutes). The request must ask for the same thing as the quote; it is billed at most the quote's `max_cost_usd`."
          },
          "provider": {
            "type": "object",
            "properties": {
              "max_price": {
                "type": "number",
                "description": "The most one pricing unit (image, second, megapixel, minute, 1K characters or request) may cost, in US dollars."
              }
            },
            "additionalProperties": false,
            "description": "Only `max_price` is accepted on media routes; any other option is refused with `400 unsupported_routing_option`."
          },
          "models": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 4,
            "description": "Fallback model ids, tried in order only when the one before cannot be served right now (`no_available_provider`) or is above `provider.max_price`. At most 5 models in `model` and `models` together."
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          }
        }
      },
      "TranscriptionRequest": {
        "type": "object",
        "required": [
          "file",
          "model"
        ],
        "properties": {
          "file": {
            "type": "string",
            "contentMediaType": "application/octet-stream",
            "description": "mp3, wav, ogg, flac, m4a/mp4, webm or aac; up to 40 MB."
          },
          "model": {
            "type": "string"
          },
          "language": {
            "type": "string"
          },
          "prompt": {
            "type": "string"
          },
          "temperature": {
            "type": "number"
          },
          "response_format": {
            "type": "string",
            "enum": [
              "json",
              "text",
              "srt",
              "vtt"
            ],
            "default": "json"
          },
          "max_cost": {
            "type": "number"
          },
          "validate": {
            "type": "boolean"
          }
        }
      },
      "Transcription": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "text": {
            "type": "string"
          },
          "duration": {
            "type": "number"
          },
          "usage": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string"
              },
              "seconds": {
                "type": "number"
              },
              "cost_usd": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "max_cost_usd": {
                "type": "number"
              }
            }
          }
        }
      },
      "ImageResponse": {
        "type": "object",
        "required": [
          "created",
          "data"
        ],
        "properties": {
          "created": {
            "type": "integer"
          },
          "model": {
            "type": "string"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string"
                },
                "b64_json": {
                  "type": "string"
                },
                "revised_prompt": {
                  "type": "string"
                }
              }
            }
          },
          "usage": {
            "type": "object",
            "properties": {
              "cost_usd": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "max_cost_usd": {
                "type": "number"
              }
            }
          }
        }
      },
      "Quote": {
        "type": "object",
        "required": [
          "object",
          "model",
          "kind",
          "cost_usd",
          "max_cost_usd"
        ],
        "properties": {
          "object": {
            "const": "quote"
          },
          "id": {
            "type": "string"
          },
          "quote_id": {
            "type": "string",
            "description": "Set by `POST /v1/quote`."
          },
          "model": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "image",
              "video",
              "music",
              "speech",
              "transcription"
            ]
          },
          "valid": {
            "type": "boolean"
          },
          "cost_usd": {
            "type": "number",
            "description": "The listed price of this request: the most it is billed."
          },
          "max_cost_usd": {
            "type": "number",
            "description": "What is held while it runs."
          },
          "unit": {
            "type": "string"
          },
          "units": {
            "type": "number"
          },
          "duration_seconds": {
            "type": "integer"
          },
          "defaults_applied": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "within_max_cost": {
            "type": "boolean"
          },
          "expires_at": {
            "type": "integer"
          },
          "note": {
            "type": "string"
          }
        }
      },
      "MediaJob": {
        "type": "object",
        "required": [
          "id",
          "object",
          "kind",
          "model",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "object": {
            "const": "media.job"
          },
          "kind": {
            "type": "string",
            "enum": [
              "video",
              "music"
            ]
          },
          "model": {
            "type": "string",
            "description": "The model that took the job."
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "succeeded",
              "failed",
              "canceled",
              "expired"
            ]
          },
          "created": {
            "type": "integer"
          },
          "expires_at": {
            "type": "integer"
          },
          "progress": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "poll_url": {
            "type": "string"
          },
          "cancel_url": {
            "type": "string"
          },
          "estimated_cost_usd": {
            "type": "number"
          },
          "estimated_cost_usdc": {
            "type": "string",
            "description": "Millionths of a dollar."
          },
          "max_cost_usd": {
            "type": "number"
          },
          "max_cost_usdc": {
            "type": "string"
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          },
          "quote_id": {
            "type": "string"
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "artifact_index": {
                  "type": "integer"
                },
                "url": {
                  "type": "string"
                },
                "content_type": {
                  "type": "string"
                },
                "duration_seconds": {
                  "type": "number"
                },
                "width": {
                  "type": "integer"
                },
                "height": {
                  "type": "integer"
                },
                "bytes": {
                  "type": "integer"
                }
              }
            }
          },
          "usage": {
            "type": "object",
            "properties": {
              "cost_usd": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "cost_usdc": {
                "type": "string"
              },
              "cost_pending": {
                "type": "boolean"
              },
              "cost_note": {
                "type": "string"
              }
            }
          },
          "error": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "retryable": {
                "type": "boolean"
              }
            }
          },
          "callback": {
            "type": "object",
            "additionalProperties": true
          },
          "output_upload": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "File": {
        "type": "object",
        "required": [
          "id",
          "object",
          "url"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "const": "file"
          },
          "bytes": {
            "type": "integer"
          },
          "content_type": {
            "type": "string"
          },
          "filename": {
            "type": "string"
          },
          "created_at": {
            "type": "integer"
          },
          "expires_at": {
            "type": "integer"
          },
          "url": {
            "type": "string"
          }
        }
      }
    }
  }
}
