{
  "openapi": "3.1.0",
  "info": {
    "title": "Generation API",
    "version": "1.0.0",
    "summary": "Create generations with the site's models and fetch the results.",
    "description": "Create a generation with one of the site's models, follow it until it ends, and download its results.\n\nSend an API key from the API keys page as `Authorization: Bearer sk_…` with every request. Keep the key on your server: never put it in a browser or an app. A key that may only read lists, reads and downloads; a key that may generate also creates and cancels. The API spends paid credits only.\n\nCreating a generation needs an `Idempotency-Key` header. The same key with the same request returns the same generation, so a request whose answer was lost can be sent again safely; the same key with a different request is a 409. Use an id from your own system, and keep it until you have an answer.\n\nA generation is `queued`, then `processing`, and ends `succeeded`, `partially_succeeded`, `failed` or `canceled`. Read it every 5 to 10 seconds until it ends. Its outputs link to files on this site; the links a key gets are signed and open without the key for an hour.\n\nAn error is `{\"error\": {\"code\": …, \"message\": …}}`, with a code from `x-error-codes`. A 429 or 503 says in `Retry-After` how many seconds to wait before sending the request again.\n\n## Models\n\n- `seed-audio-1.0`, Seed Audio 1.0 (audio): 75 credits per minute, at most 150 a request, at least 10 for a result.\n\n## Limits\n\n- One request reserves at most what the most expensive request of the enabled models costs. A key may be set lower, and `max_credits` lowers it for one request (400 `request_limit_exceeded`).\n- A key spends at most 5000 credits a UTC day, and all keys of an account together 10000, unless set otherwise on the API keys page (429 `key_daily_limit_exceeded` or `account_daily_limit_exceeded`, until the next UTC day).\n- Per key and per account, 20 creates and cancels and 240 reads and downloads a minute (429 `rate_limited`).\n- At most 2 of an account's generations run at once (429 `too_many_active`).\n- A request body is at most 32 KiB."
  },
  "servers": [
    {
      "url": "/"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Generations",
      "description": "Create, read and cancel."
    },
    {
      "name": "Files",
      "description": "The files a generation delivered."
    }
  ],
  "paths": {
    "/api/v1/generations": {
      "get": {
        "operationId": "listGenerations",
        "tags": [
          "Generations"
        ],
        "summary": "List generations",
        "description": "The account's generations, newest first, a page at a time. Text generations are not listed: read them by id.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Module"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of generations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenerationList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        }
      },
      "post": {
        "operationId": "createGeneration",
        "tags": [
          "Generations"
        ],
        "summary": "Create a generation",
        "description": "Reserves, from paid credits, the most the request can cost and queues the generation; settling charges what was delivered and returns the rest. Needs a key that may generate (`generations:write`).",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateGenerationRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The generation: new, or the one this `Idempotency-Key` made for the same request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Generation"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error400"
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "402": {
            "$ref": "#/components/responses/Error402"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "409": {
            "$ref": "#/components/responses/Error409"
          },
          "413": {
            "$ref": "#/components/responses/Error413"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        }
      }
    },
    "/api/v1/generations/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/GenerationId"
        }
      ],
      "get": {
        "operationId": "getGeneration",
        "tags": [
          "Generations"
        ],
        "summary": "Get a generation",
        "responses": {
          "200": {
            "description": "The generation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Generation"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        }
      }
    },
    "/api/v1/generations/{id}/cancel": {
      "parameters": [
        {
          "$ref": "#/components/parameters/GenerationId"
        }
      ],
      "post": {
        "operationId": "cancelGeneration",
        "tags": [
          "Generations"
        ],
        "summary": "Cancel a generation",
        "description": "Cancels a generation not yet sent to its model and returns its credits; one already sent cannot be canceled (409 `not_cancelable`). Needs a key that may generate (`generations:write`).",
        "responses": {
          "200": {
            "description": "The canceled generation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Generation"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error401"
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "409": {
            "$ref": "#/components/responses/Error409"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        }
      }
    },
    "/api/media/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/MediaId"
        }
      ],
      "get": {
        "operationId": "downloadMedia",
        "tags": [
          "Files"
        ],
        "summary": "Download a result file",
        "description": "An output's file, by the key or by the signed link in its `url` (at most an hour, without the key and from any address). Images, audio, video and text open in a browser; other files download.",
        "security": [
          {
            "bearerAuth": []
          },
          {}
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/LinkVersion"
          },
          {
            "$ref": "#/components/parameters/LinkExpires"
          },
          {
            "$ref": "#/components/parameters/LinkSignature"
          },
          {
            "$ref": "#/components/parameters/Range"
          }
        ],
        "responses": {
          "200": {
            "description": "The file, as the output's `content_type`.",
            "content": {
              "*/*": {}
            }
          },
          "206": {
            "description": "The byte range asked for.",
            "content": {
              "*/*": {}
            }
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "409": {
            "$ref": "#/components/responses/Error409"
          },
          "410": {
            "$ref": "#/components/responses/Error410"
          },
          "416": {
            "description": "The range cannot be served; `Content-Range` gives the size."
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        }
      },
      "head": {
        "operationId": "headMedia",
        "tags": [
          "Files"
        ],
        "summary": "Check a result file",
        "description": "The headers of the file the GET would send.",
        "security": [
          {
            "bearerAuth": []
          },
          {}
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/LinkVersion"
          },
          {
            "$ref": "#/components/parameters/LinkExpires"
          },
          {
            "$ref": "#/components/parameters/LinkSignature"
          }
        ],
        "responses": {
          "200": {
            "description": "The file is ready."
          },
          "403": {
            "$ref": "#/components/responses/Error403"
          },
          "404": {
            "$ref": "#/components/responses/Error404"
          },
          "409": {
            "$ref": "#/components/responses/Error409"
          },
          "410": {
            "$ref": "#/components/responses/Error410"
          },
          "429": {
            "$ref": "#/components/responses/Error429"
          },
          "500": {
            "$ref": "#/components/responses/Error500"
          },
          "503": {
            "$ref": "#/components/responses/Error503"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "sk_ and 43 characters",
        "description": "An API key from the API keys page: `sk_` and 43 letters, digits, `-` or `_`. Keep it on your server."
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "description": "Names the request: the same key with the same request returns the same generation. 1 to 128 letters, digits, dots, colons, underscores or hyphens.",
        "schema": {
          "type": "string",
          "pattern": "^[A-Za-z0-9._:-]{1,128}$"
        }
      },
      "GenerationId": {
        "name": "id",
        "in": "path",
        "required": true,
        "description": "The generation's id.",
        "schema": {
          "type": "string"
        }
      },
      "MediaId": {
        "name": "id",
        "in": "path",
        "required": true,
        "description": "The output's id.",
        "schema": {
          "type": "string",
          "pattern": "^[a-f0-9-]{36}$"
        }
      },
      "Limit": {
        "name": "limit",
        "in": "query",
        "description": "Generations on a page.",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 50,
          "default": 20
        }
      },
      "Cursor": {
        "name": "cursor",
        "in": "query",
        "description": "The `next_cursor` of the page before.",
        "schema": {
          "type": "string"
        }
      },
      "Module": {
        "name": "module",
        "in": "query",
        "description": "Only this module's generations.",
        "schema": {
          "type": "string",
          "enum": [
            "image",
            "video",
            "audio"
          ]
        }
      },
      "LinkVersion": {
        "name": "v",
        "in": "query",
        "description": "A signed link's version (part of the `url` an output gives).",
        "schema": {
          "type": "integer"
        }
      },
      "LinkExpires": {
        "name": "expires",
        "in": "query",
        "description": "When a signed link stops working, in Unix seconds.",
        "schema": {
          "type": "integer"
        }
      },
      "LinkSignature": {
        "name": "sig",
        "in": "query",
        "description": "A signed link's signature.",
        "schema": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        }
      },
      "Range": {
        "name": "Range",
        "in": "header",
        "description": "One byte range, such as `bytes=0-1023`.",
        "schema": {
          "type": "string"
        }
      }
    },
    "headers": {
      "RetryAfter": {
        "description": "Seconds to wait before sending the request again.",
        "required": true,
        "schema": {
          "type": "integer",
          "minimum": 0
        }
      }
    },
    "responses": {
      "Error400": {
        "description": "The request is not valid. Codes: `invalid_request`, `invalid_input`, `request_limit_exceeded`, `request_failed`, `captcha_required`, `reference_unavailable`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "Error401": {
        "description": "The API key is missing, unknown or no longer valid. Codes: `invalid_credential`, `credential_revoked`, `unauthorized`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "Error402": {
        "description": "Not enough paid credits. Codes: `insufficient_credits`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "Error403": {
        "description": "The key or the account may not do this. Codes: `insufficient_scope`, `ip_not_allowed`, `invalid_origin`, `forbidden`, `not_eligible`, `email_unverified`, `generation_restricted`, `trial_paused`, `captcha_failed`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "Error404": {
        "description": "No such generation, file or model. Codes: `model_unavailable`, `not_found`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "Error409": {
        "description": "The request conflicts with the generation or file as it is now. Codes: `idempotency_conflict`, `not_cancelable`, `not_ready`, `storage_quota_exceeded`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "Error410": {
        "description": "The file was kept for the retention period and has been deleted. Codes: `expired`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "Error413": {
        "description": "The request is too large. Codes: `request_too_large`, `reference_too_large`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "Error429": {
        "description": "Too many requests, or a limit is reached: wait `Retry-After` seconds. Codes: `key_daily_limit_exceeded`, `account_daily_limit_exceeded`, `rate_limited`, `too_many_active`, `too_many_under_review`.",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "Error500": {
        "description": "Something went wrong on the site. Codes: `internal_error`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "Error503": {
        "description": "Not available right now: wait `Retry-After` seconds, then send the same request again. Codes: `busy`, `paused`, `temporarily_unavailable`, `api_unavailable`, `retry`, `unavailable`, `captcha_unavailable`, `reference_storage_unavailable`.",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      }
    },
    "schemas": {
      "CreateGenerationRequest": {
        "description": "A request for one of the enabled models: its `model` id and its own `input`.",
        "oneOf": [
          {
            "title": "Seed Audio 1.0",
            "description": "Seed Audio 1.0 (audio): 75 credits per minute, at most 150 a request, at least 10 for a result. Below normal speed the prompt holds fewer characters: its limit times `speed`. A `voice` takes one of the three reference slots, and `image_url` cannot be combined with a voice or `audio_references`. A reference is a file this account uploaded on the site (its `/api/user/references/…` path), one of the site’s sample voices, or an https link from a source the site allows. A request breaking these rules is refused with 400 `invalid_input` before anything is reserved.",
            "type": "object",
            "properties": {
              "model": {
                "type": "string",
                "const": "seed-audio-1.0"
              },
              "input": {
                "type": "object",
                "properties": {
                  "prompt": {
                    "type": "string",
                    "maxLength": 2048,
                    "pattern": "\\S"
                  },
                  "voice": {
                    "type": "string",
                    "enum": [
                      "stokie_en",
                      "vivi_mixed_en_zh_ja_es_id",
                      "mindy_en_es_id_pt_zh",
                      "kian_en_zh",
                      "cedric_en_zh",
                      "sophie_en_zh",
                      "jean_en_zh",
                      "magnus_en_zh",
                      "mabel_en_zh",
                      "nadia_en_zh",
                      "opal_en_zh",
                      "pearl_en_zh",
                      "quentin_en_zh",
                      "corinne_mixed_en_zh",
                      "esther_mixed_en_zh",
                      "lyla_mixed_en_zh",
                      "tracy_es_zh",
                      "sandy_es_mixed_en_zh",
                      "felix_zh",
                      "celeste_zh",
                      "monkey_king_zh"
                    ]
                  },
                  "audio_references": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "\\S"
                    },
                    "maxItems": 3
                  },
                  "image_url": {
                    "type": "string",
                    "maxLength": 2048
                  },
                  "output_format": {
                    "type": "string",
                    "enum": [
                      "mp3",
                      "wav",
                      "pcm",
                      "ogg_opus"
                    ],
                    "default": "mp3"
                  },
                  "sample_rate": {
                    "type": "integer",
                    "minimum": 8000,
                    "maximum": 48000,
                    "enum": [
                      8000,
                      16000,
                      24000,
                      32000,
                      44100,
                      48000
                    ],
                    "default": 24000
                  },
                  "speed": {
                    "type": "number",
                    "minimum": 0.5,
                    "maximum": 2,
                    "default": 1
                  },
                  "volume": {
                    "type": "number",
                    "minimum": 0.5,
                    "maximum": 2,
                    "default": 1
                  },
                  "pitch": {
                    "type": "integer",
                    "minimum": -12,
                    "maximum": 12,
                    "default": 0
                  },
                  "multilingual": {
                    "type": "boolean",
                    "default": false
                  }
                },
                "required": [
                  "prompt"
                ],
                "additionalProperties": false
              },
              "max_credits": {
                "type": "integer",
                "minimum": 1,
                "description": "The most this request may reserve. It only lowers the limit of the key and of the model."
              }
            },
            "required": [
              "model",
              "input"
            ],
            "additionalProperties": false,
            "x-model": {
              "id": "seed-audio-1.0",
              "name": "Seed Audio 1.0",
              "module": "audio",
              "price": {
                "unit": "minute",
                "credits": 75,
                "max_credits": 150,
                "min_credits": 10
              },
              "trial": {
                "credits": 10,
                "website_only": true
              }
            }
          }
        ]
      },
      "Generation": {
        "type": "object",
        "description": "A generation as its account sees it.",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "const": "generation"
          },
          "model": {
            "type": "string",
            "description": "The model's id."
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "processing",
              "succeeded",
              "partially_succeeded",
              "failed",
              "canceled"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "outputs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GenerationOutput"
            }
          },
          "billing": {
            "type": "object",
            "description": "Credits reserved when the generation was created, and, once settled, charged and returned.",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "full",
                  "trial"
                ]
              },
              "reserved_credits": {
                "type": "integer",
                "minimum": 0
              },
              "charged_credits": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0
              },
              "refunded_credits": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0
              }
            },
            "required": [
              "mode",
              "reserved_credits",
              "charged_credits",
              "refunded_credits"
            ],
            "additionalProperties": false
          },
          "review": {
            "description": "Set while the generation waits for a manual check, which holds its credits.",
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "pending": {
                    "type": "boolean",
                    "const": true
                  },
                  "since": {
                    "type": "string",
                    "format": "date-time"
                  }
                },
                "required": [
                  "pending",
                  "since"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "held_credits": {
            "type": "integer",
            "minimum": 0
          },
          "error": {
            "description": "Why a failed or canceled generation ended.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/GenerationError"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "object",
          "model",
          "status",
          "created_at",
          "finished_at",
          "outputs",
          "billing",
          "review",
          "held_credits",
          "error"
        ],
        "additionalProperties": false
      },
      "GenerationOutput": {
        "type": "object",
        "description": "One output. `url` is set once it is delivered and the generation settled; past the retention period the file is deleted, its status is `expired` and `url` is null.",
        "properties": {
          "id": {
            "type": "string"
          },
          "index": {
            "type": "integer",
            "minimum": 0
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "delivered",
              "failed",
              "withheld",
              "expired"
            ]
          },
          "url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "content_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "bytes": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "duration_seconds": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0
          },
          "width": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "height": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          }
        },
        "required": [
          "id",
          "index",
          "status",
          "url",
          "content_type",
          "bytes",
          "duration_seconds",
          "width",
          "height"
        ],
        "additionalProperties": false
      },
      "GenerationList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Generation"
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "The `cursor` of the next page; null on the last one."
          }
        },
        "required": [
          "object",
          "items",
          "next_cursor"
        ],
        "additionalProperties": false
      },
      "GenerationError": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "credential_revoked",
              "invalid_input",
              "model_unavailable",
              "canceled",
              "submission_expired",
              "model_busy",
              "content_rejected",
              "result_expired",
              "generation_failed",
              "delivery_failed",
              "trial_limit_exceeded"
            ]
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "additionalProperties": false
      },
      "Error": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "invalid_credential",
              "credential_revoked",
              "insufficient_scope",
              "ip_not_allowed",
              "unauthorized",
              "invalid_origin",
              "forbidden",
              "invalid_request",
              "invalid_input",
              "request_too_large",
              "idempotency_conflict",
              "model_unavailable",
              "not_found",
              "method_not_allowed",
              "not_cancelable",
              "not_ready",
              "expired",
              "request_limit_exceeded",
              "not_eligible",
              "email_unverified",
              "insufficient_credits",
              "generation_restricted",
              "trial_paused",
              "key_daily_limit_exceeded",
              "account_daily_limit_exceeded",
              "rate_limited",
              "too_many_active",
              "too_many_under_review",
              "busy",
              "paused",
              "temporarily_unavailable",
              "api_unavailable",
              "retry",
              "unavailable",
              "internal_error",
              "request_failed",
              "captcha_required",
              "captcha_failed",
              "captcha_unavailable",
              "reference_unavailable",
              "reference_too_large",
              "reference_storage_unavailable",
              "storage_quota_exceeded"
            ]
          },
          "message": {
            "type": "string"
          },
          "required_scope": {
            "type": "string",
            "description": "`insufficient_scope`: the permission the key lacks (`generations:read`, `generations:write` or `account:read`)."
          },
          "ends_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "`generation_restricted`: when the pause ends; null while it waits for a review."
          }
        },
        "required": [
          "code",
          "message"
        ],
        "additionalProperties": false
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "$ref": "#/components/schemas/Error"
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      }
    }
  },
  "x-models": [
    {
      "id": "seed-audio-1.0",
      "name": "Seed Audio 1.0",
      "module": "audio",
      "price": {
        "unit": "minute",
        "credits": 75,
        "max_credits": 150,
        "min_credits": 10
      },
      "trial": {
        "credits": 10,
        "website_only": true
      }
    }
  ],
  "x-error-codes": [
    {
      "code": "invalid_credential",
      "status": 401,
      "where": [
        "response"
      ],
      "audience": "key",
      "meaning": "The API key is missing, malformed, unknown, revoked or replaced.",
      "action": "check_key"
    },
    {
      "code": "credential_revoked",
      "status": 401,
      "where": [
        "response",
        "task"
      ],
      "audience": "key",
      "meaning": "The API key was revoked or rotated while the request ran; a queued task of a revoked key is canceled and refunded.",
      "action": "check_key"
    },
    {
      "code": "insufficient_scope",
      "status": 403,
      "where": [
        "response"
      ],
      "audience": "key",
      "meaning": "The API key lacks the permission this request needs (`required_scope`).",
      "action": "check_key"
    },
    {
      "code": "ip_not_allowed",
      "status": 403,
      "where": [
        "response"
      ],
      "audience": "key",
      "meaning": "The API key cannot be used from this address (its IP allowlist).",
      "action": "check_key"
    },
    {
      "code": "unauthorized",
      "status": 401,
      "where": [
        "response"
      ],
      "audience": "website",
      "meaning": "Sign in again.",
      "action": "fix_request"
    },
    {
      "code": "invalid_origin",
      "status": 403,
      "where": [
        "response"
      ],
      "audience": "website",
      "meaning": "A website request must come from the site itself.",
      "action": "fix_request"
    },
    {
      "code": "forbidden",
      "status": 403,
      "where": [
        "response"
      ],
      "audience": "all",
      "meaning": "The request came without a trusted client address.",
      "action": "contact_support"
    },
    {
      "code": "invalid_request",
      "status": 400,
      "where": [
        "response"
      ],
      "audience": "all",
      "meaning": "The request is malformed: its JSON, headers (Idempotency-Key, Content-Type) or query.",
      "action": "fix_request"
    },
    {
      "code": "invalid_input",
      "status": 400,
      "where": [
        "response",
        "task"
      ],
      "audience": "all",
      "meaning": "The input does not fit the model's fields, or the model could not use it.",
      "action": "fix_request"
    },
    {
      "code": "request_too_large",
      "status": 413,
      "where": [
        "response"
      ],
      "audience": "all",
      "meaning": "The request body is too large.",
      "action": "fix_request"
    },
    {
      "code": "idempotency_conflict",
      "status": 409,
      "where": [
        "response"
      ],
      "audience": "all",
      "meaning": "This Idempotency-Key was used with a different request.",
      "action": "fix_request"
    },
    {
      "code": "model_unavailable",
      "status": 404,
      "where": [
        "response",
        "task"
      ],
      "audience": "all",
      "meaning": "The model is unknown or not available now.",
      "action": "fix_request"
    },
    {
      "code": "not_found",
      "status": 404,
      "where": [
        "response"
      ],
      "audience": "all",
      "meaning": "No such route, task or file for this account.",
      "action": "fix_request"
    },
    {
      "code": "method_not_allowed",
      "status": 405,
      "where": [
        "response"
      ],
      "audience": "all",
      "meaning": "The route does not take this method (see `Allow`).",
      "action": "fix_request"
    },
    {
      "code": "not_cancelable",
      "status": 409,
      "where": [
        "response"
      ],
      "audience": "all",
      "meaning": "The task was already sent to the model, or has ended.",
      "action": "fix_request"
    },
    {
      "code": "not_ready",
      "status": 409,
      "where": [
        "response"
      ],
      "audience": "all",
      "meaning": "The file is not ready yet.",
      "action": "wait_retry_after"
    },
    {
      "code": "expired",
      "status": 410,
      "where": [
        "response"
      ],
      "audience": "all",
      "meaning": "The file was kept for the retention period and has been deleted.",
      "action": "fix_request"
    },
    {
      "code": "request_limit_exceeded",
      "status": 400,
      "where": [
        "response"
      ],
      "audience": "all",
      "meaning": "The request would cost more than its `max_credits`, or than the key's or the site's single-request cap.",
      "action": "fix_request"
    },
    {
      "code": "not_eligible",
      "status": 403,
      "where": [
        "response"
      ],
      "audience": "key",
      "meaning": "Generating through the API needs a paid account.",
      "action": "use_paid_credits"
    },
    {
      "code": "email_unverified",
      "status": 403,
      "where": [
        "response"
      ],
      "audience": "website",
      "meaning": "Verify the email address to generate.",
      "action": "fix_request"
    },
    {
      "code": "insufficient_credits",
      "status": 402,
      "where": [
        "response"
      ],
      "audience": "all",
      "meaning": "Not enough credits; the open API spends paid credits only.",
      "action": "use_paid_credits"
    },
    {
      "code": "generation_restricted",
      "status": 403,
      "where": [
        "response"
      ],
      "audience": "all",
      "meaning": "Generating is paused for this account after repeated content refusals (`ends_at`).",
      "action": "contact_support"
    },
    {
      "code": "trial_paused",
      "status": 403,
      "where": [
        "response"
      ],
      "audience": "website",
      "meaning": "Website trials are paused for this account after several trial outputs went past the trial limits (`ends_at`); a request without `trial` is not affected.",
      "action": "fix_request"
    },
    {
      "code": "key_daily_limit_exceeded",
      "status": 429,
      "where": [
        "response"
      ],
      "audience": "key",
      "meaning": "The API key's daily spending limit is reached.",
      "action": "wait_retry_after",
      "retryAfter": {
        "kind": "next_utc_day"
      }
    },
    {
      "code": "account_daily_limit_exceeded",
      "status": 429,
      "where": [
        "response"
      ],
      "audience": "key",
      "meaning": "The account's daily spending limit for the API is reached.",
      "action": "wait_retry_after",
      "retryAfter": {
        "kind": "next_utc_day"
      }
    },
    {
      "code": "rate_limited",
      "status": 429,
      "where": [
        "response"
      ],
      "audience": "all",
      "meaning": "Too many requests in a short time.",
      "action": "wait_retry_after",
      "retryAfter": {
        "kind": "window"
      }
    },
    {
      "code": "too_many_active",
      "status": 429,
      "where": [
        "response"
      ],
      "audience": "all",
      "meaning": "Too many of the account’s tasks are running.",
      "action": "wait_retry_after",
      "retryAfter": {
        "kind": "fixed",
        "seconds": 30
      }
    },
    {
      "code": "too_many_under_review",
      "status": 429,
      "where": [
        "response"
      ],
      "audience": "all",
      "meaning": "Some of the account’s tasks wait for a manual check.",
      "action": "wait_retry_after",
      "retryAfter": {
        "kind": "fixed",
        "seconds": 3600
      }
    },
    {
      "code": "busy",
      "status": 503,
      "where": [
        "response"
      ],
      "audience": "all",
      "meaning": "Too many tasks are running on the site right now.",
      "action": "wait_retry_after",
      "retryAfter": {
        "kind": "fixed",
        "seconds": 30
      }
    },
    {
      "code": "paused",
      "status": 503,
      "where": [
        "response"
      ],
      "audience": "all",
      "meaning": "Generation is paused for now.",
      "action": "wait_retry_after",
      "retryAfter": {
        "kind": "fixed",
        "seconds": 60
      }
    },
    {
      "code": "temporarily_unavailable",
      "status": 503,
      "where": [
        "response"
      ],
      "audience": "all",
      "meaning": "The request could not be completed now.",
      "action": "retry_same_key",
      "retryAfter": {
        "kind": "fixed",
        "seconds": 60
      }
    },
    {
      "code": "api_unavailable",
      "status": 503,
      "where": [
        "response"
      ],
      "audience": "all",
      "meaning": "Generation is not available yet on this site.",
      "action": "wait_retry_after",
      "retryAfter": {
        "kind": "fixed",
        "seconds": 60
      }
    },
    {
      "code": "retry",
      "status": 503,
      "where": [
        "response"
      ],
      "audience": "all",
      "meaning": "Something changed while the request ran.",
      "action": "retry_same_key",
      "retryAfter": {
        "kind": "fixed",
        "seconds": 60
      }
    },
    {
      "code": "unavailable",
      "status": 503,
      "where": [
        "response"
      ],
      "audience": "all",
      "meaning": "Files are temporarily unavailable.",
      "action": "wait_retry_after",
      "retryAfter": {
        "kind": "fixed",
        "seconds": 60
      }
    },
    {
      "code": "internal_error",
      "status": 500,
      "where": [
        "response"
      ],
      "audience": "all",
      "meaning": "Something went wrong on the site.",
      "action": "retry_same_key"
    },
    {
      "code": "request_failed",
      "status": 400,
      "where": [
        "response"
      ],
      "audience": "all",
      "meaning": "The request was refused for a reason without a code of its own.",
      "action": "contact_support"
    },
    {
      "code": "captcha_required",
      "status": 400,
      "where": [
        "response"
      ],
      "audience": "website",
      "meaning": "Complete the security check.",
      "action": "fix_request"
    },
    {
      "code": "captcha_failed",
      "status": 403,
      "where": [
        "response"
      ],
      "audience": "website",
      "meaning": "The security check did not pass.",
      "action": "fix_request"
    },
    {
      "code": "captcha_unavailable",
      "status": 503,
      "where": [
        "response"
      ],
      "audience": "website",
      "meaning": "The security check is unavailable.",
      "action": "wait_retry_after",
      "retryAfter": {
        "kind": "fixed",
        "seconds": 60
      }
    },
    {
      "code": "reference_unavailable",
      "status": 400,
      "where": [
        "response"
      ],
      "audience": "all",
      "meaning": "A referenced upload is gone or not the account’s.",
      "action": "fix_request"
    },
    {
      "code": "reference_too_large",
      "status": 413,
      "where": [
        "response"
      ],
      "audience": "all",
      "meaning": "Referenced uploads must total at most 10 MB.",
      "action": "fix_request"
    },
    {
      "code": "reference_storage_unavailable",
      "status": 503,
      "where": [
        "response"
      ],
      "audience": "all",
      "meaning": "Reference storage is unavailable.",
      "action": "wait_retry_after",
      "retryAfter": {
        "kind": "fixed",
        "seconds": 60
      }
    },
    {
      "code": "storage_quota_exceeded",
      "status": 409,
      "where": [
        "response"
      ],
      "audience": "all",
      "meaning": "The account’s storage is full.",
      "action": "contact_support"
    },
    {
      "code": "canceled",
      "status": null,
      "where": [
        "task"
      ],
      "audience": "all",
      "meaning": "The task was canceled before it was sent; its credits returned.",
      "action": "fix_request"
    },
    {
      "code": "submission_expired",
      "status": null,
      "where": [
        "task"
      ],
      "audience": "all",
      "meaning": "The task could not be sent in time; its credits returned.",
      "action": "retry_same_key"
    },
    {
      "code": "model_busy",
      "status": null,
      "where": [
        "task"
      ],
      "audience": "all",
      "meaning": "The model was busy; its credits returned.",
      "action": "wait_retry_after"
    },
    {
      "code": "content_rejected",
      "status": null,
      "where": [
        "task"
      ],
      "audience": "all",
      "meaning": "Content safety checks declined the prompt or the output.",
      "action": "fix_request"
    },
    {
      "code": "result_expired",
      "status": null,
      "where": [
        "task"
      ],
      "audience": "all",
      "meaning": "The result could not be saved in time.",
      "action": "contact_support"
    },
    {
      "code": "generation_failed",
      "status": null,
      "where": [
        "task"
      ],
      "audience": "all",
      "meaning": "The generation failed.",
      "action": "contact_support"
    },
    {
      "code": "delivery_failed",
      "status": null,
      "where": [
        "task"
      ],
      "audience": "all",
      "meaning": "The result could not be delivered; its credits returned.",
      "action": "contact_support"
    },
    {
      "code": "trial_limit_exceeded",
      "status": null,
      "where": [
        "task"
      ],
      "audience": "website",
      "meaning": "The trial output went past the trial limits and was not delivered; its credits returned.",
      "action": "fix_request"
    }
  ]
}
