{
  "openapi": "3.1.0",
  "info": {
    "title": "Seed Audio API",
    "version": "1.0.0",
    "description": "Create Seed Audio 1.0 generations and poll for results."
  },
  "servers": [{ "url": "https://seedaudio.co/api/v1" }],
  "security": [{ "bearerAuth": [] }],
  "paths": {
    "/audio/generations": {
      "post": {
        "summary": "Create an audio generation",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": { "type": "string", "maxLength": 128 }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CreateAudioGeneration" }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Generation accepted",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AudioGeneration" }
              }
            }
          },
          "400": { "$ref": "#/components/responses/ApiError" },
          "401": { "$ref": "#/components/responses/ApiError" },
          "402": { "$ref": "#/components/responses/ApiError" },
          "403": { "$ref": "#/components/responses/ApiError" },
          "409": { "$ref": "#/components/responses/ApiError" },
          "429": { "$ref": "#/components/responses/ApiError" }
        }
      }
    },
    "/audio/generations/{id}": {
      "get": {
        "summary": "Get an audio generation",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": {
            "description": "Current generation state",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AudioGeneration" }
              }
            }
          },
          "401": { "$ref": "#/components/responses/ApiError" },
          "404": { "$ref": "#/components/responses/ApiError" },
          "429": { "$ref": "#/components/responses/ApiError" }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": { "type": "http", "scheme": "bearer" }
    },
    "schemas": {
      "CreateAudioGeneration": {
        "type": "object",
        "required": ["model", "prompt"],
        "properties": {
          "model": { "type": "string", "const": "seed-audio-1.0" },
          "prompt": { "type": "string", "minLength": 1, "maxLength": 2048 },
          "voice": { "type": "string" },
          "audio_references": {
            "type": "array",
            "maxItems": 3,
            "items": { "type": "string", "format": "uri" }
          },
          "image_url": { "type": "string", "format": "uri" },
          "output_format": {
            "type": "string",
            "enum": ["mp3", "wav", "pcm", "ogg_opus"],
            "default": "mp3"
          },
          "sample_rate": {
            "type": "integer",
            "enum": [8000, 16000, 24000, 32000, 44100, 48000]
          },
          "speed": { "type": "number" },
          "volume": { "type": "number" },
          "pitch": { "type": "number" }
        }
      },
      "AudioGeneration": {
        "type": "object",
        "required": ["id", "object", "model", "status"],
        "properties": {
          "id": { "type": "string" },
          "object": { "type": "string", "const": "audio.generation" },
          "model": { "type": "string", "const": "seed-audio-1.0" },
          "status": {
            "type": "string",
            "enum": ["queued", "processing", "succeeded", "failed", "canceled"]
          },
          "created_at": { "type": ["string", "null"], "format": "date-time" },
          "updated_at": { "type": ["string", "null"], "format": "date-time" },
          "output": { "type": ["object", "null"] },
          "usage": { "type": ["object", "null"] },
          "billing": { "type": "object" },
          "error": { "type": ["object", "null"] }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "required": ["code", "message", "request_id"],
            "properties": {
              "code": { "type": "string" },
              "message": { "type": "string" },
              "request_id": { "type": "string" }
            }
          }
        }
      }
    },
    "responses": {
      "ApiError": {
        "description": "API error",
        "content": {
          "application/json": {
            "schema": { "$ref": "#/components/schemas/Error" }
          }
        }
      }
    }
  }
}
