> ## 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.

# Suno 视频生成 API

> 通过文字、图片或 Suno 参考音频生成视频，使用 Fetch V2 查询异步结果。

## 输入方式

| 生成方式 | 图片参数 |
| - | - |
| 文生视频 | 仅传提示词和时长，可按需设置分辨率、模型和比例 |
| 从首帧生成 | `first_frame_url` |
| 使用首尾帧 | `first_frame_url` 和 `last_frame_url` |
| 使用参考图 | `reference_image_urls`，最多 9 张 |
| 首帧加参考图 | `first_frame_url` 和 `reference_image_urls` |

图片链接须可通过公网 HTTP(S) 访问。支持 JPEG 和 PNG，每张最多 10 MiB。

任意一种生成方式都可以添加 Suno 参考音频。传入 `song_id` 后，可用 `song_window.start_s` 和 `song_window.end_s` 指定参考区间，区间长度须等于 `duration`。不传时间区间时，从歌曲开头截取所需时长。`lip_sync: true` 需要提供 `song_id`。


## OpenAPI

````yaml openapi/cn/suno.json POST /suno/v1/video/generate
openapi: 3.1.0
info:
  title: TTAPI API DOCS
  version: 1.0.0
  description: Suno 音乐生成相关接口
servers:
  - url: https://api.ttapi.io
security: []
paths:
  /suno/v1/video/generate:
    post:
      summary: 生成视频
      description: 提交异步视频生成任务。可传入文本、图片或 Suno 歌曲作为参考。生成和查询需要 Suno Video 权限的 API 密钥。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SunoVideoGenerateRequest'
            examples:
              text:
                summary: 文生视频
                value:
                  prompt: 纸灯笼缓缓升入星空，镜头随灯笼向上移动。
                  duration: 5
                  resolution: 480p
                  aspect_ratio: '9:16'
                  hookUrl: https://example.com/webhooks/suno-video
              media:
                summary: 首帧、参考图和参考音频
                value:
                  prompt: 以首帧为起点，镜头向前推进，沿用参考图的色调。
                  duration: 5
                  resolution: 720p
                  aspect_ratio: '16:9'
                  first_frame_url: https://example.com/first-frame.jpg
                  reference_image_urls:
                    - https://example.com/reference.jpg
                  song_id: 01234567-89ab-4cde-8f01-23456789abcd
                  song_window:
                    start_s: 2
                    end_s: 7
                  lip_sync: true
      responses:
        '200':
          description: 任务已受理。用 data.jobId 查询处理结果。
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - message
                  - data
                properties:
                  status:
                    type: string
                    enum:
                      - SUCCESS
                  message:
                    type: string
                    description: 受理提示。
                  data:
                    type: object
                    required:
                      - jobId
                    properties:
                      jobId:
                        type: string
                        description: 后续查询使用的任务 ID。
                        pattern: ^video-
              example:
                status: SUCCESS
                message: success
                data:
                  jobId: video-9c64b7e1-f00d-456e-8c56-a0227f5128fb
        '400':
          $ref: '#/components/responses/400Response'
        '401':
          $ref: '#/components/responses/401Response'
        '403':
          description: API 密钥缺少对应产品权限，或请求不符合账号访问限制。
      security:
        - CustomApiKey: []
components:
  schemas:
    SunoVideoGenerateRequest:
      title: 视频生成参数
      type: object
      required:
        - prompt
        - duration
      properties:
        prompt:
          type: string
          description: 描述画面、镜头运动和风格。
          minLength: 1
          maxLength: 30000
        duration:
          type: integer
          minimum: 5
          maximum: 15
          description: 生成时长，单位为秒。
        resolution:
          type:
            - string
            - 'null'
          description: 输出分辨率。480p 对应 fast，720p 对应 standard。
          enum:
            - 480p
            - 720p
          default: 480p
        aspect_ratio:
          type:
            - string
            - 'null'
          description: 画面宽高比
          enum:
            - '1:1'
            - '9:16'
            - '16:9'
            - '4:3'
            - '3:4'
          default: '9:16'
        first_frame_url:
          type: string
          description: 首帧图的公网 HTTP(S) URL。可单独使用、与尾帧组合或与参考图组合。
          format: uri
        last_frame_url:
          type: string
          description: 尾帧图的公网 HTTP(S) URL。需要同时传首帧；首尾帧组合不支持参考图。
          format: uri
        reference_image_urls:
          type: array
          maxItems: 9
          items:
            type: string
            description: 参考图的公网 HTTP(S) URL。
            format: uri
          description: 最多 9 张，可单独使用或与首帧组合。
        song_id:
          type: string
          description: 参考音频的 Suno 歌曲 ID，可与图片输入组合。
        song_window:
          type: object
          description: 参考音频区间，使用时须传 song_id。省略时使用从第 0 秒起、长度与视频相同的片段。
          properties:
            start_s:
              type: number
              minimum: 0
              default: 0
              description: 起始时间，单位为秒，可为小数。
            end_s:
              type: number
              minimum: 0
              description: 结束时间，单位为秒。省略时取 start_s + duration，显式填写时区间长度须等于 duration。
        lip_sync:
          type: boolean
          default: false
          description: 开启口型同步。设为 true 时须传 song_id。
        hookUrl:
          type: string
          format: uri
          description: 可选的 Webhook 回调地址。任务结束后通过 HTTP POST 发送，正文与视频任务 Fetch V2 响应一致。
  responses:
    400Response:
      description: 参数错误
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: FAILED
              message:
                type: string
              data:
                type: object
            required:
              - status
              - message
    401Response:
      description: 授权失败
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: FAILED
              message:
                type: string
                example: Wrong TT-API-KEY or email is not activated.
            required:
              - status
              - message
  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.