openapi: 3.1.0
info:
  title: HappyHorse 1.0
  version: '1.0'
  description: HappyHorse 1.0 video generation model. Supports text-to-video, image-to-video (first frame), reference-to-video (multi-image), and video editing (video + reference images).
servers:
- url: https://openapi.imini.ai/imini/router
components:
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: |
        Pass `Authorization: Bearer <YOUR_API_KEY>` in the request header. Go to the [API Keys management page](https://imini.ai/api-keys) to create and manage API Keys.
security:
- ApiKeyAuth: []
paths:
  /v1/videos/generate:
    post:
      summary: HappyHorse 1.0
      operationId: generateHappyHorse10
      security:
      - ApiKeyAuth: []
      description: |
        Submit an asynchronous video generation task. You will need to poll the query endpoint to retrieve the result.

        > Model ID: `dashscope/happyhorse-1.0` · Underlying: HappyHorse 1.0

        **Supported input modes** (auto-dispatched by input shape, no explicit flag required):
        - **Text-to-video**: pass `prompt` only
        - **Image-to-video (first frame)**: 1 image with `reference_type=first_frame` (does not accept `aspect_ratio`; output ratio follows the first frame)
        - **Reference-to-video**: 1–9 images with `reference_type=asset`. Use `character1`, `character2`, … in `prompt` to refer to the N-th reference image (order matches the array)
        - **Video edit**: 1 `reference_video` + 0–5 images with `reference_type=asset`. Edits the source video per `prompt` (style transfer, local replacement, etc.). Does **not** accept `aspect_ratio` / `duration`; output length follows the source video, capped at 15 seconds.

        > These four modes are **mutually exclusive** and cannot be mixed. First+last frame, feature-reference video, reference audio, and the `generate_audio` flag are **not supported**. Audio control in video-edit mode is exposed via `extra_params.audio_setting`.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - model
              properties:
                model:
                  type: string
                  description: Fixed value `dashscope/happyhorse-1.0`.
                prompt:
                  type: string
                  description: |
                    Prompt, up to **5000** characters. Supports Chinese, English, Japanese, Korean, and other languages.

                    > In reference-to-video mode, use `character1`, `character2`, … in the prompt to refer to the N-th image in `reference_images` (order matches the array).
                  example: A miniature city built from cardboard and bottle caps comes alive at night, with a cardboard train rolling past lit by tiny string lights.
                resolution:
                  type: string
                  description: Output resolution. Defaults to `1080P`.
                  default: 1080P
                  enum:
                  - 720P
                  - 1080P
                aspect_ratio:
                  type: string
                  description: |
                    Output aspect ratio. Defaults to `16:9`. **Only accepted by text-to-video and reference-to-video.** Image-to-video (first frame) follows the first frame; video edit follows the source video.
                  default: '16:9'
                  enum:
                  - '16:9'
                  - '9:16'
                  - '1:1'
                  - '4:3'
                  - '3:4'
                duration:
                  type: integer
                  description: |
                    Video duration (seconds). Defaults to `5`, integer in `3 ~ 15`. **Not accepted in video-edit mode** (output length follows the source video, capped at 15s).
                  default: 5
                  minimum: 3
                  maximum: 15
                reference_images:
                  type: array
                  description: |
                    Reference image list. The combination of `reference_type` and `reference_videos` determines the input mode:
                    - **Image-to-video (first frame)**: 1 `first_frame`
                    - **Reference-to-video**: 1–9 `asset`, no `reference_videos`
                    - **Video edit**: 0–5 `asset` together with 1 `reference_videos`

                    > Image requirements: format `jpg` / `jpeg` / `png` / `webp`; public URL or `data:image/` base64; first-frame mode requires width/height ≥ 300 px, aspect ratio between 1:2.5 and 2.5:1, ≤ 10 MB per image; reference-to-video requires shorter side ≥ 400 px, 720P or higher recommended.
                  maxItems: 9
                  items:
                    type: object
                    required:
                    - url
                    properties:
                      url:
                        type: string
                        description: |
                          Image address, supports two forms:
                          **1)** Public URL (`http://` or `https://`);
                          **2)** Data URI base64 (starting with `data:image/`).
                      reference_type:
                        type: string
                        description: |-
                          Reference type:
                          - `asset` — generic asset reference (default)
                          - `first_frame` — first frame

                          Omitted, null, empty or unknown strings are treated as asset.
                        default: asset
                        enum:
                        - asset
                        - first_frame
                reference_videos:
                  type: array
                  description: |
                    Editing requires exactly 1 video explicitly marked reference_type=edit_source, optionally with 0-5 asset images. Ordinary asset videos are ignored and do not trigger editing.

                    > Video requirements: format `mp4` / `mov` (H.264 recommended); duration 3 ~ 60s (anything beyond 15s is auto-truncated to the first 15s); long side ≤ 2160 px, short side ≥ 320 px; aspect ratio 1:2.5 ~ 2.5:1; ≤ 100 MB; FPS > 8.
                  maxItems: 1
                  items:
                    type: object
                    required:
                    - url
                    properties:
                      url:
                        type: string
                        description: Public URL of the video; base64 not supported.
                      reference_type:
                        type: string
                        description: |-
                          asset: reference video (default).
                          edit_source: the original video to edit; select this explicitly for editing.
                          This model only consumes edit_source; ordinary asset videos are ignored.
                          Omitted, null, empty or unknown strings are treated as asset.
                        default: asset
                        enum:
                        - asset
                        - edit_source
                extra_params:
                  type: object
                  description: |
                    Model extension parameters, all optional:
                    - `audio_setting` — string, **only effective in video-edit mode**. Audio handling strategy:
                      - `auto` (default): decided by the model
                      - `origin`: keep the original audio of the source video
                  additionalProperties: true
                  properties:
                    audio_setting:
                      type: string
                      enum:
                      - auto
                      - origin
                      default: auto
            examples:
              "Text to Video":
                summary: Text to Video
                value:
                  model: dashscope/happyhorse-1.0
                  prompt: A miniature city built from cardboard and bottle caps comes alive at night, with a cardboard train rolling past lit by tiny string lights.
                  resolution: 720P
                  aspect_ratio: 16:9
                  duration: 5
              "Image to Video (first frame)":
                summary: Image to Video - First Frame
                value:
                  model: dashscope/happyhorse-1.0
                  prompt: A cat is running on the grass.
                  reference_images:
                  - url: https://cdn.translate.alibaba.com/r/wanx-demo-1.png
                    reference_type: first_frame
                  resolution: 720P
                  duration: 5
              "Reference Images to Video":
                summary: Reference Images (character1 / character2)
                value:
                  model: dashscope/happyhorse-1.0
                  prompt: A woman in a red qipao character1 gracefully unfolds a folding fan character2; her tasseled earrings character3 sway with each turn of her head.
                  reference_images:
                  - url: https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/mvzfud/hh-v2v-girl.jpg
                    reference_type: asset
                  - url: https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/fvuihk/hh-v2v2-folding-fan.jpg
                    reference_type: asset
                  - url: https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260424/imerii/hh-v2v-earrings.jpg
                    reference_type: asset
                  resolution: 720P
                  aspect_ratio: 16:9
                  duration: 5
              "Video Edit":
                summary: Video Edit (instruction + reference image)
                value:
                  model: dashscope/happyhorse-1.0
                  prompt: Dress the horse-headed character in the video with the striped sweater shown in the reference image.
                  reference_videos:
                  - url: https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260409/dozxak/Wan_Video_Edit_33_1.mp4
                    reference_type: edit_source
                  reference_images:
                  - url: https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260415/hynnff/wan-video-edit-clothes.webp
                    reference_type: asset
                  resolution: 720P
                  extra_params:
                    audio_setting: origin
      responses:
        '200':
          description: Submission accepted (asynchronous mode)
          content:
            application/json:
              schema:
                type: object
                properties:
                  task_id:
                    type: string
                    description: Unique task ID, used for polling.
                    example: task_2044275355061448704
                  model:
                    type: string
                    description: Model ID used for this task.
                    example: dashscope/happyhorse-1.0
                  created_at:
                    type: string
                    description: Task creation time (ISO 8601)
                    example: '2026-04-27T10:43:20.233Z'
                  request_id:
                    type: string
                    description: Unique request ID.
                    example: 67e2e394-cf6f-4998-b293-ebf20d14dc26
        '400':
          description: Validation Error (e.g. invalid parameter, invalid prompt)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        description: Error code
                        example: INVALID_PARAMETER
                      message:
                        type: string
                        description: Error message details
                        example: aspect_ratio is not accepted in I2V mode (output follows first_frame)
                      status:
                        type: integer
                        description: HTTP status code
                        example: 400
                      request_id:
                        type: string
                        description: Unique request identifier
                        example: req_abc123
