{
  "openapi": "3.1.0",
  "info": {
    "title": "Revana API",
    "version": "2026-10-31",
    "description": "One API key for image and video models. Prepaid credits, 100 credits = $1; only the route that succeeds is charged. Every model in /data/models.json takes the same request shape: `input` is SeedanceInput for seedance-2.5 and ModelInput for the others, whose allowed values, defaults and prices are listed per model in /data/models.json. An unknown model id answers 422 model_not_available; a model whose routes are all down at the moment, 503 model_unavailable. Every response carries an X-Request-Id header (req_ followed by 20 hex digits); every error body repeats it as error.request_id, so quote it when asking for help. Every error has a stable machine-readable error.code; every 429 and 503 carries Retry-After in seconds. Price a request first with POST /v1/generations/quote (free; nothing is created or held). Retrying: after a timeout or a 5xx on a create, resend the same body with the same Idempotency-Key, which returns the generation already made instead of starting (and charging) another. After a generation has failed, start again with a new key: the old key keeps answering the failed generation."
  },
  "servers": [
    {
      "url": "https://api.revana.si"
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "paths": {
    "/v1/generations": {
      "get": {
        "operationId": "listGenerations",
        "summary": "List your generations",
        "description": "Every generation on the key's account, newest first, a page at a time: the account's other keys' and the dashboard's too, not only this key's. Pass the previous page's next_before as before to get the next one; has_more is true only when an older generation exists. A generation still being confirmed with a provider shows, and filters, as running.",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Only generations created before this time: the previous page's next_before."
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "queued",
                "running",
                "succeeded",
                "failed"
              ]
            }
          },
          {
            "name": "model",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "A model id."
          }
        ],
        "responses": {
          "200": {
            "description": "One page.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "object",
                    "data",
                    "has_more",
                    "next_before"
                  ],
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Generation"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_before": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "Pass as before for the next page; null on the last."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "A query parameter is wrong or unknown. Codes: invalid_request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key. Codes: unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "429": {
            "description": "Over the per-second read burst guard. Codes: rate_limited.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createGeneration",
        "summary": "Submit a generation",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "example": "3f0c9a2e-6c1b-4f53-9d43-1f2a7b8c9d10",
            "description": "Resending the same key and body returns the same generation instead of starting another. The same key with a different body is 409 idempotency_conflict. Make one key per request, once (a UUID), and send it again on every resend after a timeout, a dropped connection, a 429 or a 5xx: the request is never made or charged twice. After a generation has failed, send it again with a new key: the old one keeps answering the failed generation."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GenerationRequest"
              },
              "examples": {
                "text_to_video": {
                  "summary": "A 5 second 720p Seedance 2.5 clip, capped at $1.50",
                  "value": {
                    "model": "seedance-2.5",
                    "input": {
                      "prompt": "A slow dolly shot through a neon-lit night market in the rain, steam rising from food stalls",
                      "resolution": "720p",
                      "duration": 5,
                      "aspect_ratio": "16:9"
                    },
                    "max_cost_usd": 1.5
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Generation"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "200": {
            "description": "An Idempotency-Key replay: the generation it created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Generation"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "400": {
            "description": "Malformed request. Codes: invalid_request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key. Codes: unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "402": {
            "description": "The available balance does not cover reserved_usd. Codes: insufficient_credits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "403": {
            "description": "The account is paused, the key cannot generate yet, or the account's free credit needs a saved card first (add one in the dashboard, then retry). Codes: account_disabled, generation_not_enabled, card_required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "409": {
            "description": "Idempotency-Key reused with a different body. Codes: idempotency_conflict.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "413": {
            "description": "Body over 1 MB. Codes: body_too_large.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "422": {
            "description": "The input cannot run as asked. Nothing is charged. Codes: invalid_input, max_cost_exceeded, model_not_available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "429": {
            "description": "Over the per-second burst guard (honour Retry-After), or too many generations in progress. Codes: rate_limited, concurrency_limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "503": {
            "description": "Busy, or no route up. Retry after Retry-After with the same Idempotency-Key. Codes: busy, model_unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "500": {
            "description": "Server error. Safe to retry with the same Idempotency-Key. Codes: server_error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          }
        }
      }
    },
    "/v1/generations/quote": {
      "post": {
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GenerationRequest"
              }
            }
          }
        },
        "operationId": "quoteGeneration",
        "summary": "Price a generation (free)",
        "description": "Takes the same body as POST /v1/generations and answers what it would cost, worked out exactly as the create will (input admitted, media measured, routes priced). Nothing is created, held or charged, and it answers even before an account may generate. quoted_usd is the first route's price; reserved_usd is the most that can be held, should a backup route (billed at its provider's cost plus one cent) deliver instead.",
        "responses": {
          "200": {
            "description": "The price.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Quote"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "400": {
            "description": "Malformed request. Codes: invalid_request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key. Codes: unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "403": {
            "description": "The account is paused. Codes: account_disabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "413": {
            "description": "Body over 1 MB. Codes: body_too_large.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "422": {
            "description": "The input cannot run as asked, or every route is priced above max_cost_usd. Codes: invalid_input, model_not_available, max_cost_exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "429": {
            "description": "Over the per-second burst guard. Codes: rate_limited.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "503": {
            "description": "Busy measuring references, or no route up. Codes: busy, model_unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "500": {
            "description": "Server error. Codes: server_error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          }
        }
      }
    },
    "/v1/generations/{id}": {
      "get": {
        "operationId": "getGeneration",
        "summary": "Get a generation",
        "parameters": [
          {
            "$ref": "#/components/parameters/id"
          }
        ],
        "responses": {
          "200": {
            "description": "The generation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Generation"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key. Codes: unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "404": {
            "description": "No generation with this id on your account. Codes: not_found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "429": {
            "description": "Over the per-second burst guard. Codes: rate_limited.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          }
        }
      }
    },
    "/v1/generations/{id}/content": {
      "get": {
        "operationId": "getGenerationContent",
        "summary": "Download the result (the first file)",
        "parameters": [
          {
            "$ref": "#/components/parameters/id"
          }
        ],
        "responses": {
          "302": {
            "description": "A redirect to a short-lived file URL.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "200": {
            "description": "The file: a video for video models, a picture for picture models.",
            "content": {
              "video/mp4": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/jpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/webp": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "404": {
            "description": "No generation with this id on your account. Codes: not_found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "409": {
            "description": "Not succeeded yet. Codes: not_ready.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          }
        }
      }
    },
    "/v1/generations/{id}/content/{n}": {
      "get": {
        "operationId": "getGenerationContentN",
        "summary": "Download file n of a result with several files",
        "parameters": [
          {
            "$ref": "#/components/parameters/id"
          },
          {
            "name": "n",
            "in": "path",
            "required": true,
            "description": "2 or more: the position of the file in output.urls.",
            "schema": {
              "type": "integer",
              "minimum": 2,
              "maximum": 99
            }
          }
        ],
        "responses": {
          "302": {
            "description": "A redirect to a short-lived file URL.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "200": {
            "description": "The file: a video for video models, a picture for picture models.",
            "content": {
              "video/mp4": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/jpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/webp": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "404": {
            "description": "No generation with this id on your account, or it has fewer files. Codes: not_found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "409": {
            "description": "Not succeeded yet. Codes: not_ready.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          }
        }
      }
    },
    "/v1/models": {
      "get": {
        "operationId": "listModels",
        "summary": "List the models you can generate with now",
        "security": [],
        "description": "No key needed. Every model /v1/generations accepts at this moment, with its tasks, options and price (the same fields as /data/models.json). A model missing here answers 422 model_not_available. With a customer key (Authorization: Bearer sr_live_...), prices are that account's own (its price book) and the response carries X-Revana-Price-Book; without one, the public prices. Language models (kind text) are listed too; they run on /v1/chat/completions, not /v1/generations. Prices listed per second are the plain rates: some inputs cost more (Seedance 2.5 with a first frame is $0.11 / $0.25 / $0.55 a second), so price a specific request with POST /v1/generations/quote.",
        "responses": {
          "200": {
            "description": "The models.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "id",
                          "object"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "object": {
                            "const": "model"
                          },
                          "name": {
                            "type": "string"
                          },
                          "maker": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "image",
                              "video",
                              "audio",
                              "text"
                            ]
                          },
                          "tasks": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "options": {
                            "type": "object"
                          },
                          "price": {
                            "type": "object"
                          },
                          "endpoint": {
                            "type": "string",
                            "description": "Language models (kind text) only: /v1/chat/completions. Every other model runs on /v1/generations."
                          },
                          "owned_by": {
                            "type": "string",
                            "description": "Language models only, as OpenAI lists them."
                          }
                        }
                      }
                    }
                  }
                }
              }
            },
            "headers": {
              "X-Revana-Price-Book": {
                "description": "With a customer key: the price book the prices come from.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          }
        }
      }
    },
    "/v1/balance": {
      "get": {
        "operationId": "getBalance",
        "summary": "What the key's account can spend",
        "description": "available is what a new generation can reserve; held is reserved by generations still running; balance is both. Credits are 100 to the dollar, rounded so available never reads higher than it is.",
        "responses": {
          "200": {
            "description": "The balance.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "object",
                    "currency",
                    "available_usd",
                    "held_usd",
                    "balance_usd",
                    "available_credits",
                    "held_credits",
                    "balance_credits"
                  ],
                  "properties": {
                    "object": {
                      "const": "balance"
                    },
                    "currency": {
                      "const": "usd"
                    },
                    "available_usd": {
                      "type": "number"
                    },
                    "held_usd": {
                      "type": "number"
                    },
                    "balance_usd": {
                      "type": "number"
                    },
                    "spent_usd": {
                      "type": "number"
                    },
                    "available_credits": {
                      "type": "integer"
                    },
                    "held_credits": {
                      "type": "integer"
                    },
                    "balance_credits": {
                      "type": "integer"
                    },
                    "price_tier": {
                      "type": "string",
                      "description": "Present when the account has a volume price tier."
                    },
                    "price_tier_until": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time",
                      "description": "When that tier lapses."
                    }
                  }
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "401": {
            "description": "Missing or invalid key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          }
        }
      }
    },
    "/v1/uploads": {
      "post": {
        "operationId": "createUpload",
        "summary": "A link for a local reference file",
        "description": "Answers a presigned upload_url: PUT the file's bytes there within an hour with exactly upload_headers (its content type and length are signed). Then pass url, an api.revana.si link good for 14 days that redirects to the file, as a reference to /v1/generations. image/* up to 30 MB, video/* up to 50 MB, audio/* up to 15 MB. Free.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "content_type",
                  "bytes"
                ],
                "properties": {
                  "content_type": {
                    "type": "string",
                    "examples": [
                      "image/png"
                    ]
                  },
                  "bytes": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "filename": {
                    "type": "string",
                    "maxLength": 200
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The upload.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "id",
                    "object",
                    "url",
                    "expires_at",
                    "upload_url",
                    "upload_method",
                    "upload_headers",
                    "upload_expires_at",
                    "content_type",
                    "bytes",
                    "filename"
                  ],
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^upl_"
                    },
                    "object": {
                      "const": "upload"
                    },
                    "url": {
                      "type": "string",
                      "format": "uri",
                      "description": "https://api.revana.si/v1/uploads/…: no key needed, answers a redirect to the file until expires_at (14 days)."
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "upload_url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "upload_method": {
                      "const": "PUT"
                    },
                    "upload_headers": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "upload_expires_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "content_type": {
                      "type": "string"
                    },
                    "bytes": {
                      "type": "integer"
                    },
                    "filename": {
                      "type": "string"
                    }
                  }
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "400": {
            "description": "Not an image, video or audio type, or a bad body.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "401": {
            "description": "Missing or invalid key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "413": {
            "description": "Larger than the reference limit for its kind (too_large).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "503": {
            "description": "Uploads are not available (uploads_unavailable).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          }
        }
      }
    },
    "/v1/queue/revana/{model_id}": {
      "post": {
        "operationId": "submitQueueRequest",
        "summary": "Submit model input directly to the asynchronous queue",
        "description": "Same billing and admission as generations. See https://revana.si/queue.md for fal aliases and compatibility limits. Callback URLs are public HTTPS on port 443; callback notifications are unsigned, so verify by authenticated result retrieval.",
        "security": [
          {
            "bearer": []
          },
          {
            "queueKey": []
          }
        ],
        "parameters": [
          {
            "name": "model_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "An id returned by GET /v1/models."
          },
          {
            "name": "fal_webhook",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uri"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "example": "3f0c9a2e-6c1b-4f53-9d43-1f2a7b8c9d10",
            "description": "Make one key per request, once (a UUID), and send it again on every resend after a timeout, a dropped connection, a 429 or a 5xx: a replay with the same input answers 200 with the same request, never a second paid job. Changing the input, endpoint or webhook with that key is 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "Raw model input fields, plus optional max_wait_s and max_cost_usd. max_cost_usd is the most you will pay: routes priced above it are skipped (none left: max_cost_exceeded). If the first route cannot make a job, a backup route within the hold is used; a request is never charged more than its hold. See the model catalog."
              },
              "examples": {
                "seedance": {
                  "summary": "A 5 second 720p Seedance 2.5 clip, capped at $2",
                  "value": {
                    "prompt": "A fox walks through snow",
                    "duration": 5,
                    "resolution": "720p",
                    "max_cost_usd": 2
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "request_id",
                    "status",
                    "status_url",
                    "response_url"
                  ],
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "gateway_request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "IN_QUEUE",
                        "IN_PROGRESS",
                        "COMPLETED"
                      ]
                    },
                    "status_url": {
                      "type": "string"
                    },
                    "response_url": {
                      "type": "string"
                    },
                    "cancel_url": {
                      "type": "string",
                      "description": "Cancellation is unsupported (405)."
                    },
                    "error": {
                      "type": "string"
                    },
                    "error_type": {
                      "type": "string"
                    }
                  }
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "200": {
            "description": "Idempotent replay",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "request_id",
                    "status",
                    "status_url",
                    "response_url"
                  ],
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "gateway_request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "IN_QUEUE",
                        "IN_PROGRESS",
                        "COMPLETED"
                      ]
                    },
                    "status_url": {
                      "type": "string"
                    },
                    "response_url": {
                      "type": "string"
                    },
                    "cancel_url": {
                      "type": "string",
                      "description": "Cancellation is unsupported (405)."
                    },
                    "error": {
                      "type": "string"
                    },
                    "error_type": {
                      "type": "string"
                    }
                  }
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "409": {
            "description": "Key reused for different input, endpoint or webhook",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "422": {
            "description": "Unsupported input or unsafe callback URL",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "503": {
            "description": "Service or callback worker unavailable",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "403": {
            "description": "The account is paused, the key cannot generate yet, or the account's free credit needs a saved card first (add one in the dashboard, then retry). Codes: account_disabled, generation_not_enabled, card_required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueError"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "400": {
            "description": "Malformed request, or a bad fal_webhook. Codes: invalid_request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueError"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key (Key or Bearer). Codes: unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueError"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "402": {
            "description": "The available balance does not cover the hold. Codes: insufficient_credits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueError"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "413": {
            "description": "Body over 1 MB. Codes: body_too_large.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueError"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "429": {
            "description": "Over the per-second burst guard, or too many requests in progress. Codes: rate_limited, concurrency_limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueError"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "500": {
            "description": "Server error. Safe to retry with the same Idempotency-Key. Codes: server_error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueError"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          }
        }
      }
    },
    "/v1/queue/revana/{model_id}/requests/{request_id}/status": {
      "get": {
        "operationId": "getQueueStatus",
        "summary": "Get queue status",
        "security": [
          {
            "bearer": []
          },
          {
            "queueKey": []
          }
        ],
        "parameters": [
          {
            "name": "model_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "An id returned by GET /v1/models."
          },
          {
            "name": "request_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Queue state; failures are COMPLETED with error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "request_id",
                    "status",
                    "status_url",
                    "response_url"
                  ],
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "gateway_request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "IN_QUEUE",
                        "IN_PROGRESS",
                        "COMPLETED"
                      ]
                    },
                    "status_url": {
                      "type": "string"
                    },
                    "response_url": {
                      "type": "string"
                    },
                    "cancel_url": {
                      "type": "string",
                      "description": "Cancellation is unsupported (405)."
                    },
                    "error": {
                      "type": "string"
                    },
                    "error_type": {
                      "type": "string"
                    }
                  }
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "404": {
            "description": "No request owned by this account at this endpoint",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key. Codes: unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueError"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "429": {
            "description": "Over the per-second read burst guard. Codes: rate_limited.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueError"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          }
        }
      }
    },
    "/v1/queue/revana/{model_id}/requests/{request_id}": {
      "get": {
        "operationId": "getQueueResult",
        "summary": "Get final model output",
        "security": [
          {
            "bearer": []
          },
          {
            "queueKey": []
          }
        ],
        "parameters": [
          {
            "name": "model_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "An id returned by GET /v1/models."
          },
          {
            "name": "request_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Image images[], video video{}, or audio audio{} and audios[]; file URLs require this account API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "409": {
            "description": "Still processing",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "422": {
            "description": "Generation failed",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "404": {
            "description": "No request owned by this account at this endpoint",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key. Codes: unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueError"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "429": {
            "description": "Over the per-second read burst guard. Codes: rate_limited.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueError"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          }
        }
      }
    },
    "/v1/queue/revana/{model_id}/requests/{request_id}/content": {
      "get": {
        "operationId": "getQueueContent",
        "summary": "Download the first output",
        "security": [
          {
            "bearer": []
          },
          {
            "queueKey": []
          }
        ],
        "parameters": [
          {
            "name": "model_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "An id returned by GET /v1/models."
          },
          {
            "name": "request_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Media bytes",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "302": {
            "description": "Short-lived storage redirect after authentication",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "409": {
            "description": "Not ready",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "404": {
            "description": "No request owned by this account at this endpoint",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key. Codes: unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueError"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "429": {
            "description": "Over the per-second read burst guard. Codes: rate_limited.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueueError"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          }
        }
      }
    },
    "/v1/status": {
      "get": {
        "operationId": "getStatus",
        "summary": "Service status (no key)",
        "security": [],
        "description": "Each model's status (operational, degraded, outage), its numbered routes, uptime, median latency, 30 days of daily uptime and the last week's incidents. Cached for 30 seconds. The same data as https://revana.si/status.",
        "responses": {
          "200": {
            "description": "The status.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          }
        }
      }
    },
    "/v1/uploads/{folder}/{upload_id}/{filename}": {
      "get": {
        "operationId": "readUpload",
        "summary": "An upload's lasting link (no key)",
        "security": [],
        "description": "The url POST /v1/uploads hands back. Answers 302 to a fresh one-hour storage link on every read, for 14 days (expires_at). Pass it as a reference; there is no need to call it yourself.",
        "parameters": [
          {
            "name": "folder",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-f]{16}$"
            }
          },
          {
            "name": "upload_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^upl_[0-9a-f]{24}$"
            }
          },
          {
            "name": "filename",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_][A-Za-z0-9._-]{0,79}$"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Redirect to the file.",
            "headers": {
              "Location": {
                "schema": {
                  "type": "string",
                  "format": "uri"
                }
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "404": {
            "description": "No such upload, or uploads are off. Codes: not_found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          }
        }
      }
    },
    "/v1/chat/completions": {
      "post": {
        "operationId": "createChatCompletion",
        "summary": "Chat completion (OpenAI-compatible)",
        "description": "OpenAI's Chat Completions request and answer (stream: true for server-sent events), for the language models /v1/models lists with kind text, billed per token on the same credits. Errors here use OpenAI's shape, {error: {message, type, code, param}}, not the Error schema. See https://revana.si/chat for the models and fields.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "model",
                  "messages"
                ],
                "properties": {
                  "model": {
                    "type": "string"
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  },
                  "stream": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The completion (application/json), or a text/event-stream when stream is true.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "400": {
            "description": "Malformed request. Codes: invalid_request.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key. Codes: unauthorized.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "402": {
            "description": "Not enough credit. Codes: insufficient_credits.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "429": {
            "description": "Over the burst guard. Codes: rate_limited.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "503": {
            "description": "No route can serve the model right now. Codes: model_unavailable, busy.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "An API key from https://revana.si/dashboard."
      },
      "queueKey": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization",
        "description": "Queue paths accept Key sr_live_… or Bearer sr_live_…."
      }
    },
    "parameters": {
      "id": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^[\\w-]{1,80}$"
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message",
              "request_id"
            ],
            "properties": {
              "code": {
                "type": "string",
                "description": "Stable and machine-readable; the message is for people and may change."
              },
              "message": {
                "type": "string"
              },
              "request_id": {
                "type": "string",
                "pattern": "^req_[0-9a-f]{20}$",
                "description": "The X-Request-Id of this response."
              }
            }
          }
        }
      },
      "GenerationRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "model",
          "input"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "A model id from /data/models.json.",
            "examples": [
              "seedance-2.5"
            ]
          },
          "input": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/SeedanceInput"
              },
              {
                "$ref": "#/components/schemas/NemesisInput"
              },
              {
                "$ref": "#/components/schemas/ModelInput"
              }
            ],
            "description": "SeedanceInput for seedance-2.5. NemesisInput for nemesis (a 4-30 s clip, rendered as a Seedance 2.5 edit at its rate plus $0.02 a second) and nemesis-lite (a 2-15 s clip, rendered on Wan 3.0 at its rate plus $0.02 a second); both are billed per second of clip in plus video out. ModelInput for every other model. Unknown fields, and values the model does not offer, are refused with 422 invalid_input before anything is charged."
          },
          "task": {
            "type": "string",
            "enum": [
              "video_edit",
              "video_extend"
            ],
            "description": "What to do with input.video_url, on video models. video_edit changes the clip and keeps its length (seedance-2.5, wan-2.7-videoedit, wan-2.7, happyhorse-1.0, kling-3.0-omni, kling-4.0, wan-3.0); video_extend continues it (pixverse-v6). Only the routes that do that task are used; a model without one answers 422 invalid_input naming the models that do. Leave it out to keep each model's own behaviour. Also accepted as input.task."
          },
          "max_cost_usd": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 100,
            "default": 100,
            "description": "The most this generation may cost. Routes above it are skipped."
          },
          "max_wait_s": {
            "type": "integer",
            "minimum": 1,
            "maximum": 86400,
            "description": "Routes expected to take longer than this many seconds are skipped, and once it has passed no new route is tried. A route already running may finish (up to 40 minutes) and is charged if it delivers."
          }
        }
      },
      "SeedanceInput": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "prompt"
        ],
        "description": "Input for seedance-2.5.",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 30000
          },
          "resolution": {
            "enum": [
              "480p",
              "720p",
              "1080p"
            ],
            "default": "720p"
          },
          "duration": {
            "type": "integer",
            "minimum": 4,
            "maximum": 30,
            "default": 5,
            "description": "Seconds. Not with video_url."
          },
          "aspect_ratio": {
            "enum": [
              "16:9",
              "9:16",
              "1:1",
              "4:3",
              "3:4",
              "21:9",
              "adaptive"
            ],
            "default": "16:9"
          },
          "audio": {
            "type": "boolean",
            "default": false
          },
          "image_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 4096,
            "description": "Exact first frame. Not with reference media."
          },
          "end_image_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 4096,
            "description": "Last frame. Needs image_url."
          },
          "image_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri",
              "maxLength": 4096,
              "description": "A public https URL that downloads directly."
            },
            "minItems": 1,
            "maxItems": 30,
            "description": "Reference images."
          },
          "video_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 4096,
            "description": "A 4-30 s clip to edit; the result keeps its length."
          },
          "video_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri",
              "maxLength": 4096,
              "description": "A public https URL that downloads directly."
            },
            "minItems": 1,
            "maxItems": 10,
            "description": "Reference clips, 30 s in all."
          },
          "audio_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri",
              "maxLength": 4096,
              "description": "A public https URL that downloads directly."
            },
            "minItems": 1,
            "maxItems": 10,
            "description": "Reference sound, 30 s in all."
          }
        }
      },
      "NemesisInput": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "video_url",
          "image_urls"
        ],
        "description": "Input for nemesis: restages a clip with your people, products and places (its movement, timing and camera, played by the references). Priced at a Seedance 2.5 edit's rate plus $0.02 a second, per second of the clip in plus the video out. The result keeps the clip's length and shape.",
        "properties": {
          "video_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 4096,
            "description": "The 4-30 s clip to restage."
          },
          "image_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri",
              "maxLength": 4096
            },
            "minItems": 1,
            "maxItems": 8,
            "description": "Reference pictures."
          },
          "roles": {
            "type": "array",
            "items": {
              "enum": [
                "person",
                "product",
                "location",
                "look"
              ]
            },
            "minItems": 1,
            "maxItems": 8,
            "description": "One per picture, in order. Default: every picture is a person."
          },
          "target_frame": {
            "type": "boolean",
            "description": "Before the render, the clip's first frame is redrawn with the change already made, in the same pose, size and light, and sent as the first reference, so hair, face and clothes stay true to the pictures. Default: true for nemesis, false for nemesis-lite. Free."
          },
          "guide": {
            "enum": [
              "people",
              "scene",
              "clip"
            ],
            "description": "nemesis-lite only (nemesis always edits the clip itself). clip (default with a target frame): follows the clip's own picture. people (default without one): the people are replaced and the background kept (a clip with nobody in it is refused, not charged). scene: everything seen comes from the references and prompt."
          },
          "sound": {
            "enum": [
              "none",
              "original"
            ],
            "description": "original (default on nemesis): the clip's own sound is put back on the result. none (default on nemesis-lite): a silent result."
          },
          "face_mesh": {
            "type": "boolean",
            "description": "Traces every face in the clip so the new face keeps its expressions, eyes and lips; never shown in the result. nemesis-lite only. Default: true with guide people, false with scene and clip."
          },
          "resolution": {
            "enum": [
              "480p",
              "720p",
              "1080p"
            ],
            "default": "720p"
          },
          "prompt": {
            "type": "string",
            "maxLength": 5000,
            "description": "Optional direction."
          }
        }
      },
      "Generation": {
        "type": "object",
        "required": [
          "id",
          "object",
          "model",
          "status",
          "output",
          "quoted_usd",
          "cost_usd",
          "attempts",
          "error",
          "created_at",
          "completed_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "examples": [
              "gen_3f9a1c0d2b7e4a5f6c81"
            ]
          },
          "object": {
            "const": "generation"
          },
          "model": {
            "type": "string"
          },
          "status": {
            "enum": [
              "queued",
              "running",
              "succeeded",
              "failed"
            ]
          },
          "message": {
            "type": "string",
            "description": "Only while a result is being confirmed with a provider."
          },
          "output": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "urls": {
                "type": "array",
                "items": {
                  "type": "string",
                  "format": "uri"
                }
              },
              "duration_s": {
                "type": "number"
              },
              "width": {
                "type": "integer"
              },
              "height": {
                "type": "integer"
              },
              "has_audio": {
                "type": "boolean"
              },
              "durations_s": {
                "type": "array",
                "items": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "description": "Audio only: the length of each file in urls, in order."
              }
            },
            "description": "Null until succeeded. urls lists every file (a picture model can return several, a music model two: /content, /content/2, ...). Pictures carry width and height; videos also duration_s and has_audio; audio carries duration_s (the first file) and durations_s (each)."
          },
          "quoted_usd": {
            "type": "number",
            "description": "The price on the route tried first. If a dearer backup route makes it instead, the charge is that route's price, up to reserved_usd."
          },
          "reserved_usd": {
            "type": [
              "number",
              "null"
            ],
            "description": "Held from the balance while it runs: the dearest route that may run, so the most it can cost. Set max_cost_usd to quoted_usd to skip dearer backups."
          },
          "cost_usd": {
            "type": [
              "number",
              "null"
            ],
            "description": "The charge once succeeded, 0 once failed, else null."
          },
          "attempts": {
            "type": "integer"
          },
          "error": {
            "type": [
              "object",
              "null"
            ],
            "description": "When failed. message is written to show the person who asked; retryable says whether the same request can work later.",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "content_policy",
                  "invalid_input",
                  "model_declined",
                  "reference_changed",
                  "max_cost_exceeded",
                  "model_busy",
                  "model_unavailable",
                  "timeout",
                  "all_routes_failed",
                  "review_required",
                  "processing_failed"
                ]
              },
              "message": {
                "type": "string"
              },
              "retryable": {
                "type": "boolean",
                "description": "true: send the same request again later. false: the request has to change."
              },
              "reason": {
                "type": "string",
                "enum": [
                  "sexual",
                  "minors",
                  "copyright",
                  "real_person",
                  "other"
                ],
                "description": "Only on content_policy: the rule the model cited."
              }
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "ModelInput": {
        "type": "object",
        "additionalProperties": false,
        "description": "The input of every model other than seedance-2.5. Which fields and values a model takes, and its defaults, are in /data/models.json (options, tasks, price).",
        "properties": {
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 30000,
            "description": "What to generate. Required unless the model only transforms media (an upscaler)."
          },
          "negative_prompt": {
            "type": "string",
            "maxLength": 5000,
            "description": "What to avoid, on models that take it."
          },
          "image_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 4096,
            "description": "The start frame (image to video) or the picture to edit (image to image)."
          },
          "end_image_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 4096,
            "description": "The last frame, on models with first and last frame. Needs image_url."
          },
          "image_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri",
              "maxLength": 4096
            },
            "minItems": 1,
            "maxItems": 30,
            "description": "Reference pictures, up to the model's max_input_images."
          },
          "video_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 4096,
            "description": "A clip to transform or extend, on models that take one. Its length is measured and may be billed."
          },
          "audio_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 4096,
            "description": "A sound to drive the video (talking avatars, lip sync)."
          },
          "resolution": {
            "type": "string",
            "description": "One of the model's resolutions, e.g. 720p, 1080p, 1K, 2K, 4K."
          },
          "aspect_ratio": {
            "type": "string",
            "description": "One of the model's aspect ratios, e.g. 16:9, 9:16, 1:1."
          },
          "duration": {
            "type": "integer",
            "minimum": 1,
            "maximum": 300,
            "description": "Video length in seconds: one of the model's durations. Per-second models are billed for it."
          },
          "audio": {
            "type": "boolean",
            "description": "Generate sound, on models that offer it. Changes the price on some models."
          },
          "quality": {
            "type": "string",
            "description": "A quality tier, on models that price by one (e.g. low, medium, high)."
          },
          "seed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4294967295,
            "description": "A seed, on models that take one."
          },
          "num_images": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10,
            "default": 1,
            "description": "Picture models only: how many pictures to make, up to the model's options.max_images in /data/models.json (usually 4). Also accepted as n. The price and the hold are per picture; only the pictures delivered are charged, the rest is released. output.urls lists them all."
          },
          "lyrics": {
            "type": "string",
            "minLength": 1,
            "maxLength": 5000,
            "description": "Music models only: the words to sing. Not with instrumental."
          },
          "style": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000,
            "description": "Music models only: the genre and sound, such as \"indie folk, warm vocals\". A music request needs style or lyrics; prompt (at most 3000 characters there) is the idea."
          },
          "instrumental": {
            "type": "boolean",
            "default": false,
            "description": "Music models only: true for no vocals. Not with lyrics."
          }
        }
      },
      "QueueError": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Error"
          },
          {
            "type": "object",
            "properties": {
              "detail": {
                "type": "string",
                "description": "The message again, where fal clients look for it."
              }
            }
          }
        ]
      },
      "Quote": {
        "type": "object",
        "required": [
          "object",
          "model",
          "currency",
          "quoted_usd",
          "reserved_usd",
          "estimated_seconds"
        ],
        "properties": {
          "object": {
            "const": "quote"
          },
          "model": {
            "type": "string"
          },
          "currency": {
            "const": "usd"
          },
          "quoted_usd": {
            "type": "number",
            "description": "The price of the route tried first: what a successful generation normally costs."
          },
          "reserved_usd": {
            "type": [
              "number",
              "null"
            ],
            "description": "The hold a create would take: the most it can be charged if a dearer backup route delivers. Never above max_cost_usd."
          },
          "estimated_seconds": {
            "type": [
              "number",
              "null"
            ],
            "description": "How long the first route usually takes."
          },
          "available_usd": {
            "type": "number",
            "description": "With a customer key: what the account can spend now."
          },
          "enough_credit": {
            "type": "boolean",
            "description": "With a customer key: whether available_usd covers reserved_usd, so a create would not be refused 402."
          }
        }
      }
    },
    "headers": {
      "X-Request-Id": {
        "description": "This response's id (req_ followed by 20 hex digits). Error bodies repeat it as error.request_id.",
        "schema": {
          "type": "string",
          "pattern": "^req_[0-9a-f]{20}$"
        }
      },
      "Retry-After": {
        "description": "Seconds to wait before trying again.",
        "schema": {
          "type": "integer",
          "minimum": 1
        }
      }
    }
  }
}
