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

# 图生视频 - 基于首帧

> 图生视频 - 基于首帧图像生成视频

这是 **HappyHorse 视频 API** 的图生视频接口，基于首帧图像生成视频。


## OpenAPI

````yaml openapi/cn/happyhorse-image-to-video.json POST /happyhorse/api/v1/services/aigc/video-generation/video-synthesis
openapi: 3.1.0
info:
  title: HappyHorse Image-to-Video API
  version: 1.0.0
  description: HappyHorse 图生视频接口 - 基于首帧图像生成视频
servers:
  - url: https://api.ttapi.io
security: []
paths:
  /happyhorse/api/v1/services/aigc/video-generation/video-synthesis:
    post:
      description: 图生视频 - 基于首帧图像生成视频
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImageToVideoRequest'
      responses:
        '200':
          $ref: '#/components/responses/HappyHorseSuccessResponse'
          description: 成功响应
      security:
        - CustomApiKey: []
components:
  schemas:
    ImageToVideoRequest:
      type: object
      properties:
        model:
          type: string
          description: 模型名称。支持 happyhorse-1.0-i2v 和 happyhorse-1.1-i2v。
          default: happyhorse-1.0-i2v
          example: happyhorse-1.0-i2v
          enum:
            - happyhorse-1.0-i2v
            - happyhorse-1.1-i2v
        input:
          type: object
          description: 输入信息。图生视频需要提供首帧图像。
          properties:
            prompt:
              type: string
              description: >-
                文本提示词。用于描述期望生成的视频内容。支持任何语言输入，长度不超过 5000 个非中文字符或 2500
                个中文字符，超过部分将自动截断。
            media:
              type: array
              description: 输入媒体列表。有且仅有 1 张首帧图像。
              items:
                type: object
                properties:
                  type:
                    type: string
                    description: 媒体素材类型。固定值：first_frame（首帧）。
                    enum:
                      - first_frame
                    example: first_frame
                  url:
                    type: string
                    description: >-
                      首帧图像 URL。支持 HTTP 或 HTTPS 协议。图像限制：格式
                      JPEG/JPG/PNG/WEBP；分辨率宽高不小于 300 像素；宽高比 1:2.5 至
                      2.5:1；文件大小不超过 10MB。
                required:
                  - type
                  - url
          required:
            - media
        parameters:
          type: object
          description: 视频处理参数。
          properties:
            resolution:
              type: string
              description: 分辨率档位。
              default: 1080P
              enum:
                - 720P
                - 1080P
              example: 720P
            duration:
              type: integer
              description: 视频时长（秒），范围 [3, 15]。
              default: 5
              minimum: 3
              maximum: 15
              example: 5
            watermark:
              type: boolean
              description: 是否添加水印。
              default: true
              example: false
            seed:
              type: integer
              description: 随机种子，范围 [0, 2147483647]。
              minimum: 0
              maximum: 2147483647
              example: 12345
      required:
        - model
        - input
  responses:
    HappyHorseSuccessResponse:
      description: 请求成功
      content:
        application/json:
          schema:
            type: object
            properties:
              output:
                type: object
                description: 任务输出信息
                properties:
                  task_status:
                    type: string
                    description: 任务状态
                    enum:
                      - PENDING
                      - RUNNING
                      - SUCCEEDED
                      - FAILED
                      - CANCELED
                      - UNKNOWN
                    example: PENDING
                  task_id:
                    type: string
                    description: 任务 ID。查询有效期 24 小时。
                    example: 0385dc79-5ff8-4d82-bcb6-xxxxxx
              request_id:
                type: string
                description: 请求唯一标识。可用于请求明细溯源和问题排查。
                example: 4909100c-7b5a-9f92-bfe5-xxxxxx
            example:
              output:
                task_status: PENDING
                task_id: 0385dc79-5ff8-4d82-bcb6-xxxxxx
              request_id: 4909100c-7b5a-9f92-bfe5-xxxxxx
            required:
              - output
              - request_id
  securitySchemes:
    CustomApiKey:
      type: apiKey
      in: header
      name: TT-API-KEY
      description: >-
        请前往 <a href='https://dashboard.ttapi.io' target='_blank'>TTAPI 控制台</a>
        获取 API 密钥。

````