{
  "openapi": "3.1.0",
  "info": {
    "title": "TokLab Seedance 2.5 Flash",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.toklab.ai/v1"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/videos/generations": {
      "post": {
        "operationId": "createSeedanceFlashTask",
        "summary": "Generate or edit a video",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VideoRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "400": {
            "description": "Request error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Request error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "402": {
            "description": "Request error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Request error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Request error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Request error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/tasks/{task_id}": {
      "get": {
        "operationId": "getSeedanceFlashTask",
        "parameters": [
          {
            "name": "task_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Task state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                }
              }
            }
          },
          "401": {
            "description": "Request error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Request error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "VideoRequest": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "const": "dreamina-seedance-2-5-flash"
          },
          "content": {
            "minItems": 1,
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "text"
                    },
                    "text": {
                      "type": "string"
                    }
                  },
                  "required": ["type", "text"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "image_url"
                    },
                    "image_url": {
                      "type": "object",
                      "properties": {
                        "url": {
                          "type": "string",
                          "format": "uri"
                        }
                      },
                      "required": ["url"],
                      "additionalProperties": false
                    },
                    "role": {
                      "type": "string",
                      "enum": ["first_frame", "last_frame", "reference_image"]
                    }
                  },
                  "required": ["type", "image_url", "role"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "video_url"
                    },
                    "video_url": {
                      "type": "object",
                      "properties": {
                        "url": {
                          "type": "string",
                          "format": "uri"
                        }
                      },
                      "required": ["url"],
                      "additionalProperties": false
                    },
                    "role": {
                      "type": "string",
                      "const": "reference_video"
                    }
                  },
                  "required": ["type", "video_url", "role"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "audio_url"
                    },
                    "audio_url": {
                      "type": "object",
                      "properties": {
                        "url": {
                          "type": "string",
                          "format": "uri"
                        }
                      },
                      "required": ["url"],
                      "additionalProperties": false
                    },
                    "role": {
                      "type": "string",
                      "const": "reference_audio"
                    }
                  },
                  "required": ["type", "audio_url", "role"],
                  "additionalProperties": false
                }
              ]
            },
            "description": "A nonempty text prompt is required. Either first_frame plus optional last_frame, or references (up to 10 images, 5 videos, 5 audios); frames cannot mix with references. Edit requires exactly one video. JPEG/PNG/WebP ≤30MB; MP4/MOV ≤200MB, 24–60FPS, 2–30s (edit 4–30s), total ≤30s; WAV/MP3 ≤15MB, 2–30s each and ≤30s total. Image/video edges 300–6000px, ratio 0.4–2.5; video pixels 409600–8295044. Prompt maximum 10000 tokens; no public tokenizer specified."
          },
          "resolution": {
            "type": "string",
            "enum": ["480p", "720p"],
            "default": "720p"
          },
          "ratio": {
            "type": "string",
            "enum": ["16:9", "4:3", "1:1", "3:4", "9:16", "21:9", "adaptive"],
            "description": "Text/reference generation: six fixed ratios, default 16:9. First/last-frame generation and edit: adaptive only (default)."
          },
          "duration": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991,
            "oneOf": [
              {
                "type": "integer",
                "minimum": 4,
                "maximum": 30
              },
              {
                "const": -1
              }
            ],
            "description": "Generation defaults to 5 seconds (4–30). Edit permits only -1 or omission and preserves source duration."
          },
          "generate_audio": {
            "type": "boolean",
            "default": true
          },
          "omni_reference_task_type": {
            "type": "string",
            "enum": ["generate", "edit"],
            "default": "generate"
          },
          "content_filter": {
            "type": "boolean",
            "const": true,
            "default": true
          }
        },
        "required": ["model", "content"],
        "additionalProperties": false
      },
      "Task": {
        "type": "object",
        "required": ["id", "model", "status", "created_at"],
        "properties": {
          "id": {
            "type": "string"
          },
          "model": {
            "const": "dreamina-seedance-2-5-flash"
          },
          "status": {
            "enum": ["processing", "completed", "failed"]
          },
          "created_at": {
            "type": "integer"
          },
          "finished_at": {
            "type": "integer"
          },
          "output": {
            "type": "object",
            "properties": {
              "video_url": {
                "type": "string",
                "format": "uri"
              },
              "content": {
                "type": "object",
                "properties": {
                  "video_url": {
                    "type": "string",
                    "format": "uri"
                  }
                }
              },
              "resolution": {
                "enum": ["480p", "720p"]
              },
              "duration": {
                "type": "number"
              },
              "ratio": {
                "type": "string"
              },
              "generate_audio": {
                "type": "boolean"
              }
            }
          },
          "error": {
            "$ref": "#/components/schemas/Error"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": ["code", "message"],
        "properties": {
          "code": {
            "type": "integer"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "required": ["error"],
        "properties": {
          "error": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}
