> ## 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-reference-to-video.json POST /happyhorse/api/v1/services/aigc/video-generation/video-synthesis
openapi: 3.1.0
info:
  title: HappyHorse Reference-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/ReferenceToVideoRequest'
      responses:
        '200':
          $ref: '#/components/responses/HappyHorseSuccessResponse'
          description: 成功响应
      security:
        - CustomApiKey: []
components:
  schemas:
    ReferenceToVideoRequest:
      type: object
      properties:
        model:
          type: string
          description: 模型名称。支持 happyhorse-1.0-r2v 和 happyhorse-1.1-r2v。
          default: happyhorse-1.0-r2v
          example: happyhorse-1.0-r2v
          enum:
            - happyhorse-1.0-r2v
            - happyhorse-1.1-r2v
        input:
          type: object
          description: 输入信息。参考生视频需要提供提示词和参考图像。
          properties:
            prompt:
              type: string
              description: >-
                文本提示词。用来描述生成视频中期望包含的元素和视觉特点。支持任何语言输入，长度不超过 5000 个非中文字符或 2500
                个中文字符，超过部分会自动截断。参考指代：在 prompt 中通过 character1、character2 标识指代
                media 数组中对应位置的参考图像。
            media:
              type: array
              description: 参考图像列表。1 至 9 张，按数组顺序对应 prompt 中的 character1、character2 等。
              items:
                type: object
                properties:
                  type:
                    type: string
                    description: 媒体素材类型。固定值：reference_image。
                    enum:
                      - reference_image
                    example: reference_image
                  url:
                    type: string
                    description: >-
                      参考图像 URL。支持 HTTP/HTTPS。图像限制：格式 JPEG/JPG/PNG/WEBP；短边不低于 400
                      像素；文件大小不超过 10MB。
                required:
                  - type
                  - url
          required:
            - prompt
            - media
        parameters:
          type: object
          description: 视频处理参数。
          properties:
            resolution:
              type: string
              description: 分辨率档位。
              default: 1080P
              enum:
                - 720P
                - 1080P
              example: 720P
            ratio:
              type: string
              description: 宽高比。
              default: '16:9'
              enum:
                - '16:9'
                - '9:16'
                - '3:4'
                - '4:3'
                - '1:1'
              example: '16:9'
            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 密钥。

````