> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ttapi.io/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Send API requests to https://api.ttapi.io with the TT-API-KEY header. Midjourney account hosting uses https://hold.ttapi.io. Claude Code uses https://cc.ttapi.io.
> Most generation endpoints are asynchronous. The submit response returns a job id. Poll that product's fetch endpoint, or pass a webhook on the submit request. A fetch call does not start a new generation.
> 1 USD = 100 quota. Check the pricing page for that product before estimating cost.
> This file lists the English docs. Follow every /_llms/ link recursively for the API reference, Chinese, and Russian. Open a page's .md URL for the endpoint schema.

# 有声视频-首尾帧

> 有声视频-首尾帧。基于首帧和尾帧两张图片生成带同步音频的视频。支持全部 4 个模型。提交异步任务后返回 id，需通过查询接口获取结果。

这是 **Seedance 视频生成 API** 的有声视频-首尾帧接口。基于首帧和尾帧两张图片生成带同步音频的视频。支持全部 4 个模型。提交异步任务后返回 id，需通过查询接口获取结果。

**使用方式**：在 content 中包含 text（提示词）和两个 image\_url（role=first\_frame 首帧图片，role=last\_frame 尾帧图片），设置 generate\_audio: true。ratio 为 adaptive 自动保持和首帧图片一致。


## OpenAPI

````yaml openapi/cn/seedance-audio-first-last-frame.json POST /sd/api/v3/contents/generations/tasks
openapi: 3.1.0
info:
  title: Seedance 视频生成 API（有声视频-首尾帧）
  version: 1.0.0
  description: 基于首尾帧图片生成有声视频。
servers:
  - url: https://api.ttapi.io
security: []
paths:
  /sd/api/v3/contents/generations/tasks:
    post:
      description: 有声视频-首尾帧。基于首帧和尾帧两张图片生成带同步音频的视频。支持全部 4 个模型。提交异步任务后返回 id，需通过查询接口获取结果。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRequest'
            example:
              model: doubao-seedance-2-0-260128
              content:
                - type: text
                  text: 一个女孩在海边散步
                - type: image_url
                  image_url:
                    url: https://example.com/first.jpg
                  role: first_frame
                - type: image_url
                  image_url:
                    url: https://example.com/last.jpg
                  role: last_frame
              ratio: '16:9'
              duration: 10
              generate_audio: true
              watermark: true
      responses:
        '200':
          description: 任务提交成功
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: 任务 ID
                example:
                  id: cgt-20261021120000-xxxxx
                required:
                  - id
      security:
        - CustomApiKey: []
components:
  schemas:
    CreateRequest:
      type: object
      properties:
        model:
          type: string
          enum:
            - doubao-seedance-2-5-260628
            - doubao-seedance-2-0-260128
            - doubao-seedance-2-0-fast-260128
            - doubao-seedance-2-0-mini-260615
          description: 模型 ID
        content:
          type: array
          items:
            $ref: '#/components/schemas/ContentItem'
          description: >-
            输入内容列表。必须包含 2 个 image_url（role 分别为 first_frame 和 last_frame），可选 text
            和 audio_url
        resolution:
          type: string
          enum:
            - 480p
            - 720p
            - 1080p
            - 4k
          default: 720p
          description: 视频分辨率。Seedance 2.0 可选：480p、720p、1080p、4k，默认 720p
        ratio:
          type: string
          enum:
            - adaptive
            - '16:9'
            - '4:3'
            - '1:1'
            - '3:4'
            - '9:16'
            - '21:9'
          default: adaptive
          description: 视频宽高比。默认 adaptive（自动），也可指定具体宽高比
        duration:
          type: integer
          default: -1
          description: 视频时长（秒）。范围 [4, 15] 或 -1（智能选择）
        generate_audio:
          type: boolean
          default: true
          description: 是否生成同步音频
        watermark:
          type: boolean
          default: false
          description: 是否添加水印
        return_last_frame:
          type: boolean
          default: false
          description: 是否返回尾帧图像
        callback_url:
          type: string
          description: 回调地址
        execution_expires_after:
          type: integer
          default: 172800
          description: 任务超时阈值（秒）。范围 [3600, 259200]
        priority:
          type: integer
          default: 0
          description: 执行优先级。范围 [0, 9]
        safety_identifier:
          type: string
          description: 终端用户标识，不超过 64 字符
        tools:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
                enum:
                  - web_search
          description: 工具配置
        service_tier:
          type: string
          enum:
            - default
          default: default
          description: 服务等级
      required:
        - model
        - content
    ContentItem:
      type: object
      description: 输入内容项
      oneOf:
        - type: object
          properties:
            type:
              type: string
              enum:
                - text
            text:
              type: string
              description: 文本提示词
          required:
            - type
            - text
        - type: object
          properties:
            type:
              type: string
              enum:
                - image_url
            image_url:
              type: object
              properties:
                url:
                  type: string
                  description: >-
                    图片 URL / Base64。格式：jpeg/png/webp/bmp/tiff/gif/heic/heif，大小 <
                    30MB
            role:
              type: string
              enum:
                - first_frame
                - last_frame
              description: 图片用途：first_frame=首帧，last_frame=尾帧
          required:
            - type
            - image_url
            - role
        - type: object
          properties:
            type:
              type: string
              enum:
                - audio_url
            audio_url:
              type: object
              properties:
                url:
                  type: string
                  description: 音频 URL / Base64 / 素材 ID。格式：wav/mp3，时长 [2, 15]s，大小 ≤ 15MB
            role:
              type: string
              enum:
                - reference_audio
              description: 固定为 reference_audio
          required:
            - type
            - audio_url
            - role
  securitySchemes:
    CustomApiKey:
      type: apiKey
      in: header
      name: TT-API-KEY
      description: >-
        请前往 <a href='https://dashboard.ttapi.io' target='_blank'>TTAPI 控制台</a>
        获取 API 密钥。

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.