> ## 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-video-edit.json POST /happyhorse/api/v1/services/aigc/video-generation/video-synthesis
openapi: 3.1.0
info:
  title: HappyHorse Video Edit 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/VideoEditRequest'
      responses:
        '200':
          $ref: '#/components/responses/HappyHorseSuccessResponse'
          description: 成功响应
      security:
        - CustomApiKey: []
components:
  schemas:
    VideoEditRequest:
      type: object
      properties:
        model:
          type: string
          description: 模型名称。固定值：happyhorse-1.0-video-edit
          default: happyhorse-1.0-video-edit
          example: happyhorse-1.0-video-edit
        input:
          type: object
          description: 输入信息。视频编辑需要提供待编辑视频、参考图像和提示词。
          properties:
            prompt:
              type: string
              description: >-
                文本提示词。用来描述对视频的编辑意图，如风格转换、局部替换等。支持任何语言输入，长度不超过 5000 个非中文字符或 2500
                个中文字符，超过部分会自动截断。
            media:
              type: array
              description: 媒体素材列表。必须包含 1 个 video 类型元素；可选包含 0 至 5 个 reference_image 类型元素。
              items:
                oneOf:
                  - type: object
                    description: 待编辑的视频
                    properties:
                      type:
                        type: string
                        description: 媒体素材类型。固定值：video。
                        enum:
                          - video
                        example: video
                      url:
                        type: string
                        description: >-
                          待编辑视频 URL。支持 HTTP/HTTPS。视频限制：格式 MP4/MOV（建议 H.264
                          编码）；时长 3 至 60 秒；长边不超过 2160 像素；文件大小不超过 100MB。
                    required:
                      - type
                      - url
                  - type: object
                    description: 参考图像
                    properties:
                      type:
                        type: string
                        description: 媒体素材类型。固定值：reference_image。
                        enum:
                          - reference_image
                        example: reference_image
                      url:
                        type: string
                        description: >-
                          参考图像 URL。支持 HTTP/HTTPS。图像限制：格式 JPEG/JPG/PNG/WEBP；宽高不小于
                          300 像素；文件大小不超过 10MB。
                    required:
                      - type
                      - url
          required:
            - prompt
            - media
        parameters:
          type: object
          description: 视频编辑参数。
          properties:
            resolution:
              type: string
              description: 分辨率档位。
              default: 1080P
              enum:
                - 720P
                - 1080P
              example: 720P
            watermark:
              type: boolean
              description: 是否添加水印。
              default: true
              example: false
            audio_setting:
              type: string
              description: 声音控制。auto：模型控制；origin：保留原声。
              default: auto
              enum:
                - auto
                - origin
              example: auto
            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 密钥。

````