{
  "openapi": "3.1.0",
  "info": {
    "title": "SeedAudio API",
    "version": "1.0.0",
    "description": "A paid credit pack or an active paid subscription unlocks access. 75 credits/minute, rounded up, minimum 10, reservation/cap 150. Failed delivery returns the reservation; original expiry is preserved. A refunded or disputed purchase no longer unlocks new tasks; for a subscription this applies to the current period's payment and lasts until the next period is paid. Other paid purchases still unlock access. Recovery window 60 minutes. Per account: 6 creates/minute, 60 queries and downloads/minute, 2 in-flight tasks. A 503 may mean activation is incomplete."
  },
  "servers": [
    {
      "url": "https://seedaudio.now"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "paths": {
    "/api/v1/audio/generations": {
      "post": {
        "summary": "Create or replay an audio task",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            },
            "description": "Unique per account and API version for the record lifetime. Reuse on retry with identical normalized input. Different input returns 409."
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Maximum 32 KiB. Unknown fields are rejected.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AudioInput"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Task accepted, or the same existing task returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AudioTask"
                }
              }
            }
          },
          "400": {
            "description": "Request rejected; inspect error.code. A 429 response includes Retry-After: 60.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected; inspect error.code. A 429 response includes Retry-After: 60.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Request rejected; inspect error.code. A 429 response includes Retry-After: 60.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request rejected; inspect error.code. A 429 response includes Retry-After: 60.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected; inspect error.code. A 429 response includes Retry-After: 60.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request rejected; inspect error.code. A 429 response includes Retry-After: 60.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request rejected; inspect error.code. A 429 response includes Retry-After: 60.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request rejected; inspect error.code. A 429 response includes Retry-After: 60.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Request rejected; inspect error.code. A 429 response includes Retry-After: 60.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/audio/generations/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "summary": "Query your task; poll every 5 seconds",
        "responses": {
          "200": {
            "description": "Task status. succeeded requires private storage and billing completion.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AudioTask"
                }
              }
            }
          },
          "401": {
            "description": "Request rejected; inspect error.code. A 429 response includes Retry-After: 60.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected; inspect error.code. A 429 response includes Retry-After: 60.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request rejected; inspect error.code. A 429 response includes Retry-After: 60.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Request rejected; inspect error.code. A 429 response includes Retry-After: 60.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/audio/generations/{id}/content": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "summary": "Authenticated private audio download",
        "parameters": [
          {
            "in": "header",
            "name": "Range",
            "schema": {
              "type": "string"
            },
            "description": "Single byte range only."
          }
        ],
        "responses": {
          "200": {
            "description": "Audio bytes. No redirects and no-store.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "206": {
            "description": "Partial audio; Content-Range and Content-Length included."
          },
          "401": {
            "description": "Request rejected; inspect error.code. A 429 response includes Retry-After: 60.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected; inspect error.code. A 429 response includes Retry-After: 60.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request rejected; inspect error.code. A 429 response includes Retry-After: 60.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "416": {
            "description": "Unsatisfiable range; Content-Range: bytes */size."
          },
          "429": {
            "description": "Request rejected; inspect error.code. A 429 response includes Retry-After: 60.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Request rejected; inspect error.code. A 429 response includes Retry-After: 60.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "head": {
        "summary": "Read audio metadata without a body",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Audio bytes. No redirects and no-store.",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "206": {
            "description": "Partial audio; Content-Range and Content-Length included."
          },
          "401": {
            "description": "Request rejected; inspect error.code. A 429 response includes Retry-After: 60.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request rejected; inspect error.code. A 429 response includes Retry-After: 60.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Request rejected; inspect error.code. A 429 response includes Retry-After: 60.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "416": {
            "description": "Unsatisfiable range; Content-Range: bytes */size."
          },
          "429": {
            "description": "Request rejected; inspect error.code. A 429 response includes Retry-After: 60.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Request rejected; inspect error.code. A 429 response includes Retry-After: 60.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "An active SeedAudio account API key."
      }
    },
    "schemas": {
      "AudioInput": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "prompt"
        ],
        "properties": {
          "model": {
            "type": "string",
            "enum": [
              "seed-audio-1.0"
            ],
            "default": "seed-audio-1.0"
          },
          "prompt": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048,
            "description": "Unicode code points; cannot be whitespace only."
          },
          "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",
            "maxItems": 3,
            "default": [],
            "items": {
              "type": "string",
              "format": "uri",
              "maxLength": 2048,
              "pattern": "^https://"
            },
            "description": "Public HTTPS only. No credentials or internal addresses; a voice consumes one slot. Up to 10 MB and 30 seconds each."
          },
          "image_url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048,
            "pattern": "^https://"
          },
          "output_format": {
            "type": "string",
            "enum": [
              "mp3",
              "wav",
              "pcm",
              "ogg_opus"
            ],
            "default": "mp3"
          },
          "sample_rate": {
            "type": "integer",
            "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
          }
        },
        "allOf": [
          {
            "if": {
              "required": [
                "voice"
              ]
            },
            "then": {
              "properties": {
                "audio_references": {
                  "maxItems": 2
                }
              }
            }
          },
          {
            "if": {
              "required": [
                "image_url"
              ]
            },
            "then": {
              "not": {
                "required": [
                  "voice"
                ]
              },
              "properties": {
                "audio_references": {
                  "maxItems": 0
                }
              }
            }
          }
        ]
      },
      "AudioTask": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "object",
          "model",
          "status",
          "billing",
          "output",
          "usage",
          "error"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "const": "audio.generation"
          },
          "model": {
            "const": "seed-audio-1.0"
          },
          "status": {
            "enum": [
              "queued",
              "processing",
              "succeeded",
              "failed"
            ]
          },
          "billing": {
            "type": "object",
            "required": [
              "reserved_credits",
              "charged_credits",
              "refunded_credits"
            ],
            "properties": {
              "reserved_credits": {
                "type": "integer",
                "const": 150
              },
              "charged_credits": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0,
                "maximum": 150
              },
              "refunded_credits": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0,
                "maximum": 150
              }
            }
          },
          "output": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "url": {
                "type": "string",
                "format": "uri",
                "description": "Authenticated same-site content URL, not a public media URL."
              },
              "format": {
                "enum": [
                  "mp3",
                  "wav",
                  "pcm",
                  "ogg_opus"
                ]
              },
              "sample_rate": {
                "enum": [
                  8000,
                  16000,
                  24000,
                  32000,
                  44100,
                  48000
                ]
              },
              "duration": {
                "type": "number",
                "exclusiveMinimum": 0
              }
            }
          },
          "usage": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "audio_seconds": {
                "type": "number",
                "exclusiveMinimum": 0
              }
            }
          },
          "error": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}
