> ## Documentation Index
> Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Tạo video MiniMax H3

> Tạo tác vụ video MiniMax H3 hoặc H3-Max bằng văn bản, media tham chiếu hoặc khung hình đầu và cuối thông qua CometAPI

Tạo video MiniMax H3 hoặc H3-Max từ văn bản, media tham chiếu hoặc khung hình đầu và cuối. Lưu `id` được trả về để kiểm tra tác vụ và tải xuống video đã hoàn tất.

`POST /v1/videos` sử dụng `multipart/form-data`. Gửi các tùy chọn điều khiển dưới dạng trường biểu mẫu và lặp lại từng trường tham chiếu một lần cho mỗi đầu vào media.

## Chọn một model

Đặt `model` thành một trong các ID model sau. Chọn kích thước request từ bảng model tương ứng trong [Thiết lập thời lượng và kích thước](#set-duration-and-size).

| ID model         | Các mức độ phân giải |
| ---------------- | -------------------- |
| `minimax-h3`     | `768P`, `2K`         |
| `minimax-h3-max` | `480P`, `768P`       |

## Chọn chế độ đầu vào

Cả hai model đều sử dụng các trường bên dưới. Đặt `model` thành ID model mà bạn đã chọn.

| Mục tiêu                                | Trường bắt buộc                                                                | Trường tùy chọn                     |
| --------------------------------------- | ------------------------------------------------------------------------------ | ----------------------------------- |
| Chuyển văn bản thành video              | `model`, `prompt`                                                              | `seconds`, `size`                   |
| Hình ảnh tham chiếu                     | `model`, `prompt`, một hoặc nhiều URL hoặc tệp `input_reference`               | `seconds`, `size`                   |
| URL, data URI hoặc tệp video tham chiếu | `model`, `prompt`, một hoặc nhiều trường `reference_videos`                    | `seconds`, `size`                   |
| Âm thanh tham chiếu kèm hình ảnh        | `model`, `prompt`, `input_reference`, một hoặc nhiều trường `reference_audios` | `seconds`, `size`                   |
| URL của khung hình đầu và cuối          | `model`, `prompt`, `first_frame`                                               | `last_frame`, `seconds`, `size`     |
| Khung hình đầu và cuối đã tải lên       | `model`, `prompt`, `first_frame` tệp                                           | `last_frame` tệp, `seconds`, `size` |

Các mẫu request H3-Max bao gồm chuyển văn bản thành video ở cả hai mức độ phân giải, hình ảnh tham chiếu, tham chiếu hình ảnh/video/âm thanh kết hợp, cùng khung hình đầu và cuối.

## Sử dụng hình ảnh tham chiếu

Gửi hình ảnh tham chiếu qua `input_reference` dưới dạng URL HTTPS có thể truy cập công khai hoặc tệp đã tải lên. Với nhiều hình ảnh, hãy lặp lại trường theo thứ tự hình ảnh, với một URL hoặc tệp cho mỗi trường.

Chỉ dùng toàn bộ URL hoặc toàn bộ tệp trong trường này. Gửi riêng từng URL thay vì kết hợp các URL thành một giá trị được phân tách bằng dấu phẩy.

Bạn có thể gửi tối đa chín hình ảnh tham chiếu PNG hoặc JPEG, dù dùng URL hay tệp đã tải lên. Giữ mỗi hình ảnh đã tải lên ở mức 20 MiB hoặc thấp hơn.

Trong Prompt, hãy mô tả các chi tiết trực quan mà video được tạo cần giữ lại.

## Sử dụng video và audio tham chiếu

Gửi `reference_videos` và `reference_audios` dưới dạng giá trị văn bản multipart hoặc tệp đã tải lên, bằng các định dạng bên dưới.
Lặp lại mỗi trường một lần cho mỗi đầu vào, chỉ sử dụng giá trị văn bản hoặc chỉ tệp trong trường đó. Không kết hợp các đầu vào thành một giá trị phân tách bằng dấu phẩy.

Các trường khác nhau có thể dùng các loại đầu vào khác nhau, chẳng hạn như URL hình ảnh cùng với tệp audio đã tải lên.
Để kết hợp các tham chiếu hình ảnh, video và audio, hãy gửi `input_reference`, `reference_videos` và `reference_audios` trong cùng một yêu cầu.

| Trường             | Đầu vào                                                                    | Định dạng                                         |
| ------------------ | -------------------------------------------------------------------------- | ------------------------------------------------- |
| `reference_videos` | URL MP4 HTTPS trực tiếp, có thể truy cập công khai hoặc tệp MP4 đã tải lên | MP4 với video H.264; bản âm thanh AAC là tùy chọn |
| `reference_videos` | URI dữ liệu Base64 hoàn chỉnh trong một trường văn bản                     | `data:video/mp4;base64,<BASE64_MP4>`              |
| `reference_audios` | URL MP3 HTTPS trực tiếp, có thể truy cập công khai hoặc tệp MP3 đã tải lên | MP3                                               |

Chỉ gửi tối đa 12 đầu vào tham chiếu tổng cộng, bao gồm không quá ba video và ba đoạn audio.
Mỗi video hoặc đoạn audio phải dài từ 2–15 giây. Tổng thời lượng video và tổng thời lượng audio đều phải không quá 15 giây.

Ghép audio tham chiếu với ít nhất một hình ảnh thông qua `input_reference`.
Mô tả chuyển động, thời điểm hoặc âm thanh mà video được tạo cần tuân theo.

Giữ mỗi MP4 đã tải lên ở mức không quá 50 MiB và mỗi MP3 đã tải lên ở mức không quá 15 MiB. Một MiB là 1024 × 1024 byte.

Các mẫu yêu cầu ở đầu trang này hiển thị URL MP4, URI dữ liệu MP4 và URL MP3 được ghép với một hình ảnh.

### Tải video tham chiếu lên

Tải tệp MP4 lên để định hướng cấu trúc cảnh quay và chuyển động:

```bash theme={null}
curl \
  https://api.cometapi.com/v1/videos \
  -H "Authorization: Bearer $COMETAPI_KEY" \
  --form-string 'model=minimax-h3' \
  --form-string 'prompt=Follow the uploaded reference video shot structure and motion. No text.' \
  --form-string 'seconds=5' \
  --form-string 'size=1344x768' \
  --form 'reference_videos=@/path/to/reference.mp4;type=video/mp4'
```

### Tải audio tham chiếu lên cùng với một hình ảnh

Ghép URL hình ảnh tham chiếu với tệp MP3 đã tải lên:

```bash theme={null}
curl \
  https://api.cometapi.com/v1/videos \
  -H "Authorization: Bearer $COMETAPI_KEY" \
  --form-string 'model=minimax-h3' \
  --form-string 'prompt=Animate the reference image and synchronize the motion with the uploaded reference audio. No text.' \
  --form-string 'seconds=5' \
  --form-string 'size=1344x768' \
  --form-string 'input_reference=https://your-image-host/reference.png' \
  --form 'reference_audios=@/path/to/reference.mp3;type=audio/mpeg'
```

## Đặt khung hình đầu tiên và cuối cùng

Gửi `first_frame` cho hình ảnh mở đầu và tùy chọn một `last_frame` cho hình ảnh kết thúc.
Mỗi trường chấp nhận một URL PNG HTTPS trực tiếp, có thể truy cập công khai hoặc một tệp PNG đã tải lên. Giữ mỗi PNG đã tải lên ở mức không quá 20 MiB (20 × 1024 × 1024 byte).

Không kết hợp các trường khung hình với các trường hình ảnh, video hoặc audio tham chiếu. Hãy dùng một yêu cầu riêng để tạo nội dung dựa trên khung hình.

Với đầu vào khung hình, `size` chọn cấp độ độ phân giải. Dịch vụ có thể chuẩn hóa kích thước đầu ra cuối cùng dựa trên các khung hình được cung cấp.
Tiếp tục gửi `size` ở dạng `WxH`.

<Note>
  Lưu `id` được trả về. Thăm dò tác vụ cho đến khi `status` là `completed` hoặc
  `failed`. Khi tác vụ hoàn tất, hãy tải xuống nội dung video.
</Note>

## Thiết lập thời lượng và kích thước

Đối với cả hai model, hãy đặt `seconds` thành một số nguyên từ `5` đến `15`. Giá trị mặc định là `5` giây.

Chọn độ phân giải và tỷ lệ khung hình từ bảng dành cho model của bạn, sau đó gửi giá trị tương ứng **Kích thước yêu cầu** dưới dạng `size` theo định dạng `WxH`.
Đối với các yêu cầu văn bản và phương tiện tham chiếu, `size` chọn cấp độ phân giải và tỷ lệ khung hình.
Dịch vụ có thể chuẩn hóa kích thước đầu ra cuối cùng dựa trên kích thước được yêu cầu và phương tiện tham chiếu được cung cấp.

### Kích thước cho `minimax-h3`

Sử dụng các kích thước yêu cầu này với `model=minimax-h3`:

| Độ phân giải | Tỷ lệ khung hình | Kích thước yêu cầu |
| ------------ | ---------------- | ------------------ |
| `768P`       | `21:9`           | `1536x672`         |
| `768P`       | `16:9`           | `1344x768`         |
| `768P`       | `4:3`            | `1024x768`         |
| `768P`       | `1:1`            | `768x768`          |
| `768P`       | `3:4`            | `768x1024`         |
| `768P`       | `9:16`           | `768x1344`         |
| `2K`         | `21:9`           | `2912x1280`        |
| `2K`         | `16:9`           | `2544x1456`        |
| `2K`         | `4:3`            | `1920x1440`        |
| `2K`         | `1:1`            | `1440x1440`        |
| `2K`         | `3:4`            | `1440x1920`        |
| `2K`         | `9:16`           | `1440x2560`        |

### Kích thước cho `minimax-h3-max`

Sử dụng các kích thước yêu cầu này với `model=minimax-h3-max`:

| Độ phân giải | Tỷ lệ khung hình | Kích thước yêu cầu |
| ------------ | ---------------- | ------------------ |
| `480P`       | `21:9`           | `1120x480`         |
| `480P`       | `16:9`           | `864x480`          |
| `480P`       | `4:3`            | `640x480`          |
| `480P`       | `1:1`            | `480x480`          |
| `480P`       | `3:4`            | `480x640`          |
| `480P`       | `9:16`           | `480x864`          |
| `768P`       | `21:9`           | `1792x768`         |
| `768P`       | `16:9`           | `1360x768`         |
| `768P`       | `4:3`            | `1024x768`         |
| `768P`       | `1:1`            | `768x768`          |
| `768P`       | `3:4`            | `768x1024`         |
| `768P`       | `9:16`           | `768x1360`         |

## Luồng tác vụ

<Steps>
  <Step title="Tạo tác vụ">
    Gửi yêu cầu biểu mẫu multipart và lưu trữ `id` được trả về.
  </Step>

  <Step title="Thăm dò tác vụ">
    Gọi [Truy xuất video MiniMax H3](./retrieve) cho đến khi `status` là `completed` hoặc `failed`.
  </Step>

  <Step title="Tải xuống kết quả">
    Khi tác vụ ở trạng thái `completed`, hãy gọi [Tải xuống nội dung video MiniMax H3](./retrieve-content) để lưu tệp MP4.
  </Step>
</Steps>


## OpenAPI

````yaml api/openapi/video/minimax-h3/post-create.openapi.json POST /v1/videos
openapi: 3.1.0
info:
  title: MiniMax H3 Video Create API
  version: 1.0.0
  description: >-
    Create an asynchronous MiniMax H3 or H3-Max video task from text, reference
    media, or first and last frames through CometAPI. Send the request as
    multipart/form-data, then use the returned id to retrieve the task and
    download its completed MP4 file.
servers:
  - url: https://api.cometapi.com
security:
  - bearerAuth: []
paths:
  /v1/videos:
    post:
      summary: Create a MiniMax H3 video task
      description: >-
        Create a MiniMax H3 or H3-Max video task from text, reference images,
        reference video or audio, or first and last frames. Repeat
        input_reference with one publicly accessible HTTPS image URL or uploaded
        image file per field, up to nine images. Use all URLs or all files
        within input_reference. Send size in WxH form using the table for the
        selected model. The service can normalize the final output dimensions.
      operationId: minimax_h3_create_video
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/MiniMaxH3CreateRequest'
            encoding:
              input_reference:
                contentType: text/plain, image/png, image/jpeg
                style: form
                explode: true
              reference_videos:
                style: form
                explode: true
                contentType: text/plain, video/mp4
              reference_audios:
                style: form
                explode: true
                contentType: text/plain, audio/mpeg
              first_frame:
                style: form
              last_frame:
                style: form
            examples:
              text_2544x1456:
                summary: Text-to-video at 2544x1456
                value:
                  model: minimax-h3
                  prompt: >-
                    A paper boat glides across a still pond, daylight, locked
                    camera, no text.
                  seconds: 5
                  size: 2544x1456
              text_1344x768:
                summary: Text-to-video at 1344x768
                value:
                  model: minimax-h3
                  prompt: >-
                    A cinematic view of clouds moving over green mountains,
                    locked camera, no text.
                  seconds: 5
                  size: 1344x768
              url_reference_image:
                summary: HTTPS reference images at 1344x768
                value:
                  model: minimax-h3
                  prompt: >-
                    The referenced characters walk together through a city
                    street. Preserve their appearance and use natural motion. No
                    text.
                  seconds: 5
                  size: 1344x768
                  input_reference:
                    - https://your-image-host/reference-1.png
                    - https://your-image-host/reference-2.jpg
              uploaded_reference_images:
                summary: Uploaded reference images
                value:
                  model: minimax-h3
                  prompt: >-
                    The uploaded reference characters walk together through a
                    city street. Preserve their appearance and use natural
                    motion. No text.
                  seconds: 5
                  size: 2544x1456
                  input_reference:
                    - '@/path/to/reference-1.png'
                    - '@/path/to/reference-2.jpg'
              https_reference_video:
                summary: HTTPS MP4 reference video
                value:
                  model: minimax-h3
                  prompt: >-
                    Follow the reference clip's shot structure and motion. No
                    text.
                  seconds: 5
                  size: 1344x768
                  reference_videos:
                    - https://your-media-host/reference.mp4
              https_reference_audio:
                summary: HTTPS MP3 reference audio with an image
                value:
                  model: minimax-h3
                  prompt: >-
                    Animate the reference image and synchronize the motion with
                    the reference audio. No text.
                  seconds: 5
                  size: 1344x768
                  reference_audios:
                    - https://your-media-host/reference.mp3
                  input_reference: https://your-image-host/reference.png
              https_first_last_frames:
                summary: HTTPS first and last frames
                value:
                  model: minimax-h3
                  prompt: >-
                    Move naturally from the opening frame to the ending frame.
                    No text.
                  seconds: 5
                  size: 1344x768
                  first_frame: https://your-image-host/first-frame.png
                  last_frame: https://your-image-host/last-frame.png
              uploaded_first_last_frames:
                summary: Uploaded first and last frames
                value:
                  model: minimax-h3
                  prompt: >-
                    Move naturally from the uploaded opening frame to the
                    uploaded ending frame. No text.
                  seconds: 5
                  size: 1344x768
                  first_frame: <binary PNG file>
                  last_frame: <binary PNG file>
              uploaded_reference_video:
                summary: Uploaded MP4 reference video
                value:
                  model: minimax-h3
                  prompt: >-
                    Follow the uploaded reference video shot structure and
                    motion. No text.
                  seconds: 5
                  size: 1344x768
                  reference_videos:
                    - '@/path/to/reference.mp4'
              uploaded_reference_audio_with_image:
                summary: Uploaded MP3 reference audio with an image
                value:
                  model: minimax-h3
                  prompt: >-
                    Animate the reference image and synchronize the motion with
                    the uploaded reference audio. No text.
                  seconds: 5
                  size: 1344x768
                  reference_audios:
                    - '@/path/to/reference.mp3'
                  input_reference: https://your-image-host/reference.png
              h3_max_text_480p:
                summary: 'H3-Max: text-to-video at 480P'
                value:
                  model: minimax-h3-max
                  prompt: A paper boat crosses a pond. Fixed camera. No text.
                  seconds: 5
                  size: 864x480
              h3_max_text_768p:
                summary: 'H3-Max: text-to-video at 768P'
                value:
                  model: minimax-h3-max
                  prompt: A paper boat crosses a pond. Fixed camera. No text.
                  seconds: 5
                  size: 1360x768
              h3_max_reference_images:
                summary: 'H3-Max: HTTPS reference images'
                value:
                  model: minimax-h3-max
                  prompt: The two reference characters walk through a park. No text.
                  seconds: 5
                  size: 1360x768
                  input_reference:
                    - https://your-image-host/reference-1.png
                    - https://your-image-host/reference-2.jpg
              h3_max_mixed_references:
                summary: 'H3-Max: image, video, and audio references'
                value:
                  model: minimax-h3-max
                  prompt: >-
                    Use the image for the subject, video for motion, and audio
                    for sound.
                  seconds: 5
                  size: 1360x768
                  input_reference:
                    - https://your-image-host/reference.png
                  reference_videos:
                    - https://your-media-host/reference.mp4
                  reference_audios:
                    - https://your-media-host/reference.mp3
              h3_max_first_last_frames:
                summary: 'H3-Max: first and last frames'
                value:
                  model: minimax-h3-max
                  prompt: Move from the opening frame to the ending frame. No text.
                  seconds: 5
                  size: 1360x768
                  first_frame: https://your-image-host/first-frame.png
                  last_frame: https://your-image-host/last-frame.png
      responses:
        '200':
          description: >-
            Task created. Store the returned id and use it in retrieve and
            content requests.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MiniMaxH3VideoTask'
              example:
                id: <task_id>
                task_id: <task_id>
                object: video
                model: minimax-h3
                status: queued
                progress: 0
                created_at: 1779938152
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: Shell
          label: Text-to-video at 2544x1456
          source: |-
            curl \
              https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              --form-string 'model=minimax-h3' \
              --form-string 'prompt=A paper boat glides across a still pond, daylight, locked camera, no text.' \
              --form-string 'seconds=5' \
              --form-string 'size=2544x1456'
        - lang: Python
          label: Text-to-video at 2544x1456
          source: |
            import os

            import requests

            fields = [
                ("model", (None, "minimax-h3")),
                (
                    "prompt",
                    (
                        None,
                        "A paper boat glides across a still pond, daylight, "
                        "locked camera, no text.",
                    ),
                ),
                ("seconds", (None, "5")),
                ("size", (None, "2544x1456")),
            ]

            response = requests.post(
                "https://api.cometapi.com/v1/videos",
                headers={
                    "Authorization": "Bearer " + os.environ["COMETAPI_KEY"]
                },
                files=fields,
                timeout=120,
            )
            response.raise_for_status()
            print(response.json())
        - lang: JavaScript
          label: Text-to-video at 2544x1456
          source: |
            const form = new FormData();
            form.append("model", "minimax-h3");
            form.append(
              "prompt",
              "A paper boat glides across a still pond, daylight, " +
                "locked camera, no text.",
            );
            form.append("seconds", "5");
            form.append("size", "2544x1456");

            const response = await fetch("https://api.cometapi.com/v1/videos", {
              method: "POST",
              headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` },
              body: form,
            });

            if (!response.ok) {
              throw new Error(await response.text());
            }

            console.log(await response.json());
        - lang: Shell
          label: Text-to-video at 1344x768
          source: |-
            curl \
              https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              --form-string 'model=minimax-h3' \
              --form-string 'prompt=A cinematic view of clouds moving over green mountains, locked camera, no text.' \
              --form-string 'seconds=5' \
              --form-string 'size=1344x768'
        - lang: Python
          label: Text-to-video at 1344x768
          source: |
            import os

            import requests

            fields = [
                ("model", (None, "minimax-h3")),
                (
                    "prompt",
                    (
                        None,
                        "A cinematic view of clouds moving over green mountains, "
                        "locked camera, no text.",
                    ),
                ),
                ("seconds", (None, "5")),
                ("size", (None, "1344x768")),
            ]

            response = requests.post(
                "https://api.cometapi.com/v1/videos",
                headers={
                    "Authorization": "Bearer " + os.environ["COMETAPI_KEY"]
                },
                files=fields,
                timeout=120,
            )
            response.raise_for_status()
            print(response.json())
        - lang: JavaScript
          label: Text-to-video at 1344x768
          source: |
            const form = new FormData();
            form.append("model", "minimax-h3");
            form.append(
              "prompt",
              "A cinematic view of clouds moving over green mountains, " +
                "locked camera, no text.",
            );
            form.append("seconds", "5");
            form.append("size", "1344x768");

            const response = await fetch("https://api.cometapi.com/v1/videos", {
              method: "POST",
              headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` },
              body: form,
            });

            if (!response.ok) {
              throw new Error(await response.text());
            }

            console.log(await response.json());
        - lang: Shell
          label: HTTPS reference images at 1344x768
          source: |
            curl \
              https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              --form-string model=minimax-h3 \
              --form-string 'prompt=The referenced characters walk together through a city street. Preserve their appearance and use natural motion. No text.' \
              --form-string seconds=5 \
              --form-string size=1344x768 \
              --form-string input_reference=https://your-image-host/reference-1.png \
              --form-string input_reference=https://your-image-host/reference-2.jpg
        - lang: Python
          label: HTTPS reference images at 1344x768
          source: |
            import os

            import requests

            fields = [
                ("model", (None, "minimax-h3")),
                (
                    "prompt",
                    (
                        None,
                        "The referenced characters walk together through a city street. "
                        "Preserve their appearance and use natural motion. No text."
                    ),
                ),
                ("seconds", (None, "5")),
                ("size", (None, "1344x768")),
                ("input_reference", (None, "https://your-image-host/reference-1.png")),
                ("input_reference", (None, "https://your-image-host/reference-2.jpg")),
            ]

            response = requests.post(
                "https://api.cometapi.com/v1/videos",
                headers={
                    "Authorization": "Bearer " + os.environ["COMETAPI_KEY"]
                },
                files=fields,
                timeout=120,
            )

            response.raise_for_status()
            print(response.json())
        - lang: JavaScript
          label: HTTPS reference images at 1344x768
          source: >
            const form = new FormData();

            form.append("model", "minimax-h3");

            form.append(
              "prompt",
              "The referenced characters walk together through a city street. " +
                "Preserve their appearance and use natural motion. No text.",
            );

            form.append("seconds", "5");

            form.append("size", "1344x768");

            form.append("input_reference",
            "https://your-image-host/reference-1.png");

            form.append("input_reference",
            "https://your-image-host/reference-2.jpg");


            const response = await fetch("https://api.cometapi.com/v1/videos", {
              method: "POST",
              headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` },
              body: form,
            });


            if (!response.ok) {
              throw new Error(await response.text());
            }


            console.log(await response.json());
        - lang: Shell
          label: Uploaded reference images
          source: |-
            curl \
              https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              --form-string 'model=minimax-h3' \
              --form-string 'prompt=The uploaded reference characters walk together through a city street. Preserve their appearance and use natural motion. No text.' \
              --form-string 'seconds=5' \
              --form-string 'size=2544x1456' \
              --form 'input_reference=@/path/to/reference-1.png;type=image/png' \
              --form 'input_reference=@/path/to/reference-2.jpg;type=image/jpeg'
        - lang: Python
          label: Uploaded reference images
          source: |
            import os
            from contextlib import ExitStack

            import requests

            prompt = (
                "The uploaded reference characters walk together through a city street. "
                "Preserve their appearance and use natural motion. No text."
            )

            with ExitStack() as stack:
                files = [
                    (
                        "input_reference",
                        (
                            "reference-1.png",
                            stack.enter_context(
                                open("/path/to/reference-1.png", "rb")
                            ),
                            "image/png",
                        ),
                    ),
                    (
                        "input_reference",
                        (
                            "reference-2.jpg",
                            stack.enter_context(
                                open("/path/to/reference-2.jpg", "rb")
                            ),
                            "image/jpeg",
                        ),
                    ),
                ]
                response = requests.post(
                    "https://api.cometapi.com/v1/videos",
                    headers={
                        "Authorization": "Bearer "
                        + os.environ["COMETAPI_KEY"]
                    },
                    data={
                        "model": "minimax-h3",
                        "prompt": prompt,
                        "seconds": "5",
                        "size": "2544x1456",
                    },
                    files=files,
                    timeout=120,
                )

            response.raise_for_status()
            print(response.json())
        - lang: JavaScript
          label: Uploaded reference images
          source: |
            import { readFile } from "node:fs/promises";

            const firstReference = await readFile("/path/to/reference-1.png");
            const secondReference = await readFile("/path/to/reference-2.jpg");

            const form = new FormData();
            form.append("model", "minimax-h3");
            form.append(
              "prompt",
              "The uploaded reference characters walk together through a city street. " +
                "Preserve their appearance and use natural motion. No text.",
            );
            form.append("seconds", "5");
            form.append("size", "2544x1456");
            form.append(
              "input_reference",
              new Blob([firstReference], { type: "image/png" }),
              "reference-1.png",
            );
            form.append(
              "input_reference",
              new Blob([secondReference], { type: "image/jpeg" }),
              "reference-2.jpg",
            );

            const response = await fetch("https://api.cometapi.com/v1/videos", {
              method: "POST",
              headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` },
              body: form,
            });

            if (!response.ok) {
              throw new Error(await response.text());
            }

            console.log(await response.json());
        - lang: Shell
          label: HTTPS MP4 reference video
          source: |-
            curl \
              https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              --form-string 'model=minimax-h3' \
              --form-string 'prompt=Follow the reference clip shot structure and motion. No text.' \
              --form-string 'seconds=5' \
              --form-string 'size=1344x768' \
              --form-string 'reference_videos=https://your-media-host/reference.mp4'
        - lang: Python
          label: HTTPS MP4 reference video
          source: |
            import os

            import requests

            fields = [
                ("model", (None, "minimax-h3")),
                (
                    "prompt",
                    (
                        None,
                        "Follow the reference clip shot structure and motion. "
                        "No text.",
                    ),
                ),
                ("seconds", (None, "5")),
                ("size", (None, "1344x768")),
                (
                    "reference_videos",
                    (None, "https://your-media-host/reference.mp4"),
                ),
            ]

            response = requests.post(
                "https://api.cometapi.com/v1/videos",
                headers={
                    "Authorization": "Bearer " + os.environ["COMETAPI_KEY"]
                },
                files=fields,
                timeout=120,
            )
            response.raise_for_status()
            print(response.json())
        - lang: JavaScript
          label: HTTPS MP4 reference video
          source: |
            const form = new FormData();
            form.append("model", "minimax-h3");
            form.append(
              "prompt",
              "Follow the reference clip shot structure and motion. No text.",
            );
            form.append("seconds", "5");
            form.append("size", "1344x768");
            form.append(
              "reference_videos",
              "https://your-media-host/reference.mp4",
            );

            const response = await fetch("https://api.cometapi.com/v1/videos", {
              method: "POST",
              headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` },
              body: form,
            });

            if (!response.ok) {
              throw new Error(await response.text());
            }

            console.log(await response.json());
        - lang: Shell
          label: MP4 reference video data URI
          source: |-
            curl \
              https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              --form-string 'model=minimax-h3' \
              --form-string 'prompt=Follow the reference clip shot structure and motion. No text.' \
              --form-string 'seconds=5' \
              --form-string 'size=1344x768' \
              --form 'reference_videos=<-;type=text/plain' \
              < <(printf 'data:video/mp4;base64,'; openssl base64 -A -in /path/to/reference.mp4)
        - lang: Python
          label: MP4 reference video data URI
          source: |
            import base64
            import os
            from pathlib import Path

            import requests

            video_base64 = base64.b64encode(
                Path("/path/to/reference.mp4").read_bytes()
            ).decode("ascii")
            fields = [
                ("model", (None, "minimax-h3")),
                (
                    "prompt",
                    (
                        None,
                        "Follow the reference clip shot structure and motion. "
                        "No text.",
                    ),
                ),
                ("seconds", (None, "5")),
                ("size", (None, "1344x768")),
                (
                    "reference_videos",
                    (None, "data:video/mp4;base64," + video_base64),
                ),
            ]

            response = requests.post(
                "https://api.cometapi.com/v1/videos",
                headers={
                    "Authorization": "Bearer " + os.environ["COMETAPI_KEY"]
                },
                files=fields,
                timeout=120,
            )
            response.raise_for_status()
            print(response.json())
        - lang: JavaScript
          label: MP4 reference video data URI
          source: |
            import { readFile } from "node:fs/promises";

            const videoBase64 = (
              await readFile("/path/to/reference.mp4")
            ).toString("base64");

            const form = new FormData();
            form.append("model", "minimax-h3");
            form.append(
              "prompt",
              "Follow the reference clip shot structure and motion. No text.",
            );
            form.append("seconds", "5");
            form.append("size", "1344x768");
            form.append(
              "reference_videos",
              `data:video/mp4;base64,${videoBase64}`,
            );

            const response = await fetch("https://api.cometapi.com/v1/videos", {
              method: "POST",
              headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` },
              body: form,
            });

            if (!response.ok) {
              throw new Error(await response.text());
            }

            console.log(await response.json());
        - lang: Shell
          label: HTTPS MP3 reference audio with an image
          source: |
            curl \
              https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              --form-string model=minimax-h3 \
              --form-string 'prompt=Animate the reference image and synchronize the motion with the reference audio. No text.' \
              --form-string seconds=5 \
              --form-string size=1344x768 \
              --form-string reference_audios=https://your-media-host/reference.mp3 \
              --form-string input_reference=https://your-image-host/reference.png
        - lang: Python
          label: HTTPS MP3 reference audio with an image
          source: |
            import os

            import requests

            fields = [
                ("model", (None, "minimax-h3")),
                (
                    "prompt",
                    (
                        None,
                        "Animate the reference image and synchronize the motion with the "
                        "reference audio. No text."
                    ),
                ),
                ("seconds", (None, "5")),
                ("size", (None, "1344x768")),
                ("reference_audios", (None, "https://your-media-host/reference.mp3")),
                ("input_reference", (None, "https://your-image-host/reference.png")),
            ]

            response = requests.post(
                "https://api.cometapi.com/v1/videos",
                headers={
                    "Authorization": "Bearer " + os.environ["COMETAPI_KEY"]
                },
                files=fields,
                timeout=120,
            )

            response.raise_for_status()
            print(response.json())
        - lang: JavaScript
          label: HTTPS MP3 reference audio with an image
          source: >
            const form = new FormData();

            form.append("model", "minimax-h3");

            form.append(
              "prompt",
              "Animate the reference image and synchronize the motion with the " +
              "reference audio. No text.",
            );

            form.append("seconds", "5");

            form.append("size", "1344x768");

            form.append("reference_audios",
            "https://your-media-host/reference.mp3");

            form.append("input_reference",
            "https://your-image-host/reference.png");


            const response = await fetch("https://api.cometapi.com/v1/videos", {
              method: "POST",
              headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` },
              body: form,
            });


            if (!response.ok) {
              throw new Error(await response.text());
            }


            console.log(await response.json());
        - lang: Shell
          label: HTTPS first and last frames
          source: |-
            curl \
              https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              --form-string 'model=minimax-h3' \
              --form-string 'prompt=Move naturally from the opening frame to the ending frame. No text.' \
              --form-string 'seconds=5' \
              --form-string 'size=1344x768' \
              --form-string 'first_frame=https://your-image-host/first-frame.png' \
              --form-string 'last_frame=https://your-image-host/last-frame.png'
        - lang: Python
          label: HTTPS first and last frames
          source: |
            import os

            import requests

            fields = [
                ("model", (None, "minimax-h3")),
                (
                    "prompt",
                    (
                        None,
                        "Move naturally from the opening frame to the ending "
                        "frame. No text.",
                    ),
                ),
                ("seconds", (None, "5")),
                ("size", (None, "1344x768")),
                (
                    "first_frame",
                    (None, "https://your-image-host/first-frame.png"),
                ),
                (
                    "last_frame",
                    (None, "https://your-image-host/last-frame.png"),
                ),
            ]

            response = requests.post(
                "https://api.cometapi.com/v1/videos",
                headers={
                    "Authorization": "Bearer " + os.environ["COMETAPI_KEY"]
                },
                files=fields,
                timeout=120,
            )
            response.raise_for_status()
            print(response.json())
        - lang: JavaScript
          label: HTTPS first and last frames
          source: |
            const form = new FormData();
            form.append("model", "minimax-h3");
            form.append(
              "prompt",
              "Move naturally from the opening frame to the ending frame. No text.",
            );
            form.append("seconds", "5");
            form.append("size", "1344x768");
            form.append(
              "first_frame",
              "https://your-image-host/first-frame.png",
            );
            form.append(
              "last_frame",
              "https://your-image-host/last-frame.png",
            );

            const response = await fetch("https://api.cometapi.com/v1/videos", {
              method: "POST",
              headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` },
              body: form,
            });

            if (!response.ok) {
              throw new Error(await response.text());
            }

            console.log(await response.json());
        - lang: Shell
          label: Uploaded first and last frames
          source: |-
            curl \
              https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              --form-string 'model=minimax-h3' \
              --form-string 'prompt=Move naturally from the uploaded opening frame to the uploaded ending frame. No text.' \
              --form-string 'seconds=5' \
              --form-string 'size=1344x768' \
              --form 'first_frame=@/path/to/first-frame.png;type=image/png' \
              --form 'last_frame=@/path/to/last-frame.png;type=image/png'
        - lang: Python
          label: Uploaded first and last frames
          source: |
            import os
            from contextlib import ExitStack

            import requests

            prompt = (
                "Move naturally from the uploaded opening frame to the uploaded "
                "ending frame. No text."
            )

            with ExitStack() as stack:
                files = {
                    "first_frame": (
                        "first-frame.png",
                        stack.enter_context(
                            open("/path/to/first-frame.png", "rb")
                        ),
                        "image/png",
                    ),
                    "last_frame": (
                        "last-frame.png",
                        stack.enter_context(
                            open("/path/to/last-frame.png", "rb")
                        ),
                        "image/png",
                    ),
                }
                response = requests.post(
                    "https://api.cometapi.com/v1/videos",
                    headers={
                        "Authorization": "Bearer "
                        + os.environ["COMETAPI_KEY"]
                    },
                    data={
                        "model": "minimax-h3",
                        "prompt": prompt,
                        "seconds": "5",
                        "size": "1344x768",
                    },
                    files=files,
                    timeout=120,
                )

            response.raise_for_status()
            print(response.json())
        - lang: JavaScript
          label: Uploaded first and last frames
          source: |
            import { readFile } from "node:fs/promises";

            const firstFrame = await readFile("/path/to/first-frame.png");
            const lastFrame = await readFile("/path/to/last-frame.png");

            const form = new FormData();
            form.append("model", "minimax-h3");
            form.append(
              "prompt",
              "Move naturally from the uploaded opening frame to the uploaded " +
                "ending frame. No text.",
            );
            form.append("seconds", "5");
            form.append("size", "1344x768");
            form.append(
              "first_frame",
              new Blob([firstFrame], { type: "image/png" }),
              "first-frame.png",
            );
            form.append(
              "last_frame",
              new Blob([lastFrame], { type: "image/png" }),
              "last-frame.png",
            );

            const response = await fetch("https://api.cometapi.com/v1/videos", {
              method: "POST",
              headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` },
              body: form,
            });

            if (!response.ok) {
              throw new Error(await response.text());
            }

            console.log(await response.json());
        - lang: Shell
          label: Uploaded MP4 reference video
          source: |
            curl \
              https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              --form-string 'model=minimax-h3' \
              --form-string 'prompt=Follow the uploaded reference video shot structure and motion. No text.' \
              --form-string 'seconds=5' \
              --form-string 'size=1344x768' \
              --form 'reference_videos=@/path/to/reference.mp4;type=video/mp4'
        - lang: Python
          label: Uploaded MP4 reference video
          source: |
            import os
            from contextlib import ExitStack

            import requests

            prompt = (
                "Follow the uploaded reference video shot structure and motion. No "
                "text."
            )

            with ExitStack() as stack:
                fields = [
                    ("model", (None, "minimax-h3")),
                    ("prompt", (None, prompt)),
                    ("seconds", (None, "5")),
                    ("size", (None, "1344x768")),
                    (
                        "reference_videos",
                        (
                            "reference.mp4",
                            stack.enter_context(
                                open("/path/to/reference.mp4", "rb")
                            ),
                            "video/mp4",
                        ),
                    ),
                ]

                response = requests.post(
                    "https://api.cometapi.com/v1/videos",
                    headers={
                        "Authorization": "Bearer " + os.environ["COMETAPI_KEY"]
                    },
                    files=fields,
                    timeout=120,
                )

            response.raise_for_status()
            print(response.json())
        - lang: JavaScript
          label: Uploaded MP4 reference video
          source: |
            import { readFile } from "node:fs/promises";

            const form = new FormData();
            form.append("model", "minimax-h3");
            form.append(
              "prompt",
              "Follow the uploaded reference video shot structure and motion. No " +
              "text.",
            );
            form.append("seconds", "5");
            form.append("size", "1344x768");
            form.append(
              "reference_videos",
              new Blob([await readFile("/path/to/reference.mp4")], {
                type: "video/mp4",
              }),
              "reference.mp4",
            );

            const response = await fetch("https://api.cometapi.com/v1/videos", {
              method: "POST",
              headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` },
              body: form,
            });

            if (!response.ok) {
              throw new Error(await response.text());
            }

            console.log(await response.json());
        - lang: Shell
          label: Uploaded MP3 reference audio with an image
          source: |
            curl \
              https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              --form-string model=minimax-h3 \
              --form-string 'prompt=Animate the reference image and synchronize the motion with the uploaded reference audio. No text.' \
              --form-string seconds=5 \
              --form-string size=1344x768 \
              --form 'reference_audios=@/path/to/reference.mp3;type=audio/mpeg' \
              --form-string input_reference=https://your-image-host/reference.png
        - lang: Python
          label: Uploaded MP3 reference audio with an image
          source: |
            import os
            from contextlib import ExitStack

            import requests

            with ExitStack() as stack:
                fields = [
                    ("model", (None, "minimax-h3")),
                    (
                        "prompt",
                        (
                            None,
                            "Animate the reference image and synchronize the motion with "
                            "the uploaded reference audio. No text."
                        ),
                    ),
                    ("seconds", (None, "5")),
                    ("size", (None, "1344x768")),
                    (
                        "reference_audios",
                        (
                            "reference.mp3",
                            stack.enter_context(open("/path/to/reference.mp3", "rb")),
                            "audio/mpeg",
                        ),
                    ),
                    ("input_reference", (None, "https://your-image-host/reference.png")),
                ]

                response = requests.post(
                    "https://api.cometapi.com/v1/videos",
                    headers={
                        "Authorization": "Bearer " + os.environ["COMETAPI_KEY"]
                    },
                    files=fields,
                    timeout=120,
                )

            response.raise_for_status()
            print(response.json())
        - lang: JavaScript
          label: Uploaded MP3 reference audio with an image
          source: >
            import { readFile } from "node:fs/promises";


            const form = new FormData();

            form.append("model", "minimax-h3");

            form.append(
              "prompt",
              "Animate the reference image and synchronize the motion with the " +
              "uploaded reference audio. No text.",
            );

            form.append("seconds", "5");

            form.append("size", "1344x768");

            form.append(
              "reference_audios",
              new Blob([await readFile("/path/to/reference.mp3")], {
                type: "audio/mpeg",
              }),
              "reference.mp3",
            );

            form.append("input_reference",
            "https://your-image-host/reference.png");


            const response = await fetch("https://api.cometapi.com/v1/videos", {
              method: "POST",
              headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` },
              body: form,
            });


            if (!response.ok) {
              throw new Error(await response.text());
            }


            console.log(await response.json());
        - lang: Shell
          label: 'H3-Max: text-to-video at 480P'
          source: |
            PROMPT='A paper boat crosses a pond. Fixed camera. No '
            PROMPT="$PROMPT"'text.'

            curl \
              https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              --form-string 'model=minimax-h3-max' \
              --form-string "prompt=$PROMPT" \
              --form-string 'seconds=5' \
              --form-string 'size=864x480'
        - lang: Python
          label: 'H3-Max: text-to-video at 480P'
          source: |
            import os

            import requests

            fields = [
                ("model", (None, "minimax-h3-max")),
                ("prompt", (None, "A paper boat crosses a pond. Fixed camera. No text.")),
                ("seconds", (None, "5")),
                ("size", (None, "864x480")),
            ]

            response = requests.post(
                "https://api.cometapi.com/v1/videos",
                headers={
                    "Authorization": "Bearer " + os.environ["COMETAPI_KEY"]
                },
                files=fields,
                timeout=120,
            )
            response.raise_for_status()
            print(response.json())
        - lang: JavaScript
          label: 'H3-Max: text-to-video at 480P'
          source: >
            const form = new FormData();

            form.append("model", "minimax-h3-max");

            form.append("prompt", "A paper boat crosses a pond. Fixed camera. No
            text.");

            form.append("seconds", "5");

            form.append("size", "864x480");


            const response = await fetch(
              "https://api.cometapi.com/v1/videos",
              {
                method: "POST",
                headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` },
                body: form,
              },
            );


            if (!response.ok) {
              throw new Error(await response.text());
            }


            console.log(await response.json());
        - lang: Shell
          label: 'H3-Max: text-to-video at 768P'
          source: |
            PROMPT='A paper boat crosses a pond. Fixed camera. No '
            PROMPT="$PROMPT"'text.'

            curl \
              https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              --form-string 'model=minimax-h3-max' \
              --form-string "prompt=$PROMPT" \
              --form-string 'seconds=5' \
              --form-string 'size=1360x768'
        - lang: Python
          label: 'H3-Max: text-to-video at 768P'
          source: |
            import os

            import requests

            fields = [
                ("model", (None, "minimax-h3-max")),
                ("prompt", (None, "A paper boat crosses a pond. Fixed camera. No text.")),
                ("seconds", (None, "5")),
                ("size", (None, "1360x768")),
            ]

            response = requests.post(
                "https://api.cometapi.com/v1/videos",
                headers={
                    "Authorization": "Bearer " + os.environ["COMETAPI_KEY"]
                },
                files=fields,
                timeout=120,
            )
            response.raise_for_status()
            print(response.json())
        - lang: JavaScript
          label: 'H3-Max: text-to-video at 768P'
          source: >
            const form = new FormData();

            form.append("model", "minimax-h3-max");

            form.append("prompt", "A paper boat crosses a pond. Fixed camera. No
            text.");

            form.append("seconds", "5");

            form.append("size", "1360x768");


            const response = await fetch(
              "https://api.cometapi.com/v1/videos",
              {
                method: "POST",
                headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` },
                body: form,
              },
            );


            if (!response.ok) {
              throw new Error(await response.text());
            }


            console.log(await response.json());
        - lang: Shell
          label: 'H3-Max: HTTPS reference images'
          source: |
            PROMPT='The two reference characters walk through a '
            PROMPT="$PROMPT"'park. No text.'
            IMAGE_URL_1="https://your-image-host/reference-1.png"
            IMAGE_URL_2="https://your-image-host/reference-2.jpg"

            curl \
              https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              --form-string 'model=minimax-h3-max' \
              --form-string "prompt=$PROMPT" \
              --form-string 'seconds=5' \
              --form-string 'size=1360x768' \
              --form-string "input_reference=$IMAGE_URL_1" \
              --form-string "input_reference=$IMAGE_URL_2"
        - lang: Python
          label: 'H3-Max: HTTPS reference images'
          source: |
            import os

            import requests

            fields = [
                ("model", (None, "minimax-h3-max")),
                (
                    "prompt",
                    (
                        None,
                        "The two reference characters walk through a park. No text."
                    ),
                ),
                ("seconds", (None, "5")),
                ("size", (None, "1360x768")),
                ("input_reference", (None, "https://your-image-host/reference-1.png")),
                ("input_reference", (None, "https://your-image-host/reference-2.jpg")),
            ]

            response = requests.post(
                "https://api.cometapi.com/v1/videos",
                headers={
                    "Authorization": "Bearer " + os.environ["COMETAPI_KEY"]
                },
                files=fields,
                timeout=120,
            )
            response.raise_for_status()
            print(response.json())
        - lang: JavaScript
          label: 'H3-Max: HTTPS reference images'
          source: >
            const form = new FormData();

            form.append("model", "minimax-h3-max");

            form.append(
              "prompt",
              "The two reference characters walk through a park. No text.",
            );

            form.append("seconds", "5");

            form.append("size", "1360x768");

            form.append("input_reference",
            "https://your-image-host/reference-1.png");

            form.append("input_reference",
            "https://your-image-host/reference-2.jpg");


            const response = await fetch(
              "https://api.cometapi.com/v1/videos",
              {
                method: "POST",
                headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` },
                body: form,
              },
            );


            if (!response.ok) {
              throw new Error(await response.text());
            }


            console.log(await response.json());
        - lang: Shell
          label: 'H3-Max: image, video, and audio references'
          source: |
            PROMPT='Use the image for the subject, video for motion, '
            PROMPT="$PROMPT"'and audio for sound.'
            IMAGE_URL="https://your-image-host/reference.png"
            VIDEO_URL="https://your-media-host/reference.mp4"
            AUDIO_URL="https://your-media-host/reference.mp3"

            curl \
              https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              --form-string 'model=minimax-h3-max' \
              --form-string "prompt=$PROMPT" \
              --form-string 'seconds=5' \
              --form-string 'size=1360x768' \
              --form-string "input_reference=$IMAGE_URL" \
              --form-string "reference_videos=$VIDEO_URL" \
              --form-string "reference_audios=$AUDIO_URL"
        - lang: Python
          label: 'H3-Max: image, video, and audio references'
          source: |
            import os

            import requests

            fields = [
                ("model", (None, "minimax-h3-max")),
                (
                    "prompt",
                    (
                        None,
                        "Use the image for the subject, video for motion, and audio "
                        "for sound."
                    ),
                ),
                ("seconds", (None, "5")),
                ("size", (None, "1360x768")),
                ("input_reference", (None, "https://your-image-host/reference.png")),
                ("reference_videos", (None, "https://your-media-host/reference.mp4")),
                ("reference_audios", (None, "https://your-media-host/reference.mp3")),
            ]

            response = requests.post(
                "https://api.cometapi.com/v1/videos",
                headers={
                    "Authorization": "Bearer " + os.environ["COMETAPI_KEY"]
                },
                files=fields,
                timeout=120,
            )
            response.raise_for_status()
            print(response.json())
        - lang: JavaScript
          label: 'H3-Max: image, video, and audio references'
          source: >
            const form = new FormData();

            form.append("model", "minimax-h3-max");

            form.append(
              "prompt",
              "Use the image for the subject, video for motion, and audio for sound.",
            );

            form.append("seconds", "5");

            form.append("size", "1360x768");

            form.append("input_reference",
            "https://your-image-host/reference.png");

            form.append("reference_videos",
            "https://your-media-host/reference.mp4");

            form.append("reference_audios",
            "https://your-media-host/reference.mp3");


            const response = await fetch(
              "https://api.cometapi.com/v1/videos",
              {
                method: "POST",
                headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` },
                body: form,
              },
            );


            if (!response.ok) {
              throw new Error(await response.text());
            }


            console.log(await response.json());
        - lang: Shell
          label: 'H3-Max: first and last frames'
          source: |
            PROMPT='Move from the opening frame to the ending frame. '
            PROMPT="$PROMPT"'No text.'
            FIRST_FRAME_URL="https://your-image-host/first-frame.png"
            LAST_FRAME_URL="https://your-image-host/last-frame.png"

            curl \
              https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              --form-string 'model=minimax-h3-max' \
              --form-string "prompt=$PROMPT" \
              --form-string 'seconds=5' \
              --form-string 'size=1360x768' \
              --form-string "first_frame=$FIRST_FRAME_URL" \
              --form-string "last_frame=$LAST_FRAME_URL"
        - lang: Python
          label: 'H3-Max: first and last frames'
          source: |
            import os

            import requests

            fields = [
                ("model", (None, "minimax-h3-max")),
                (
                    "prompt",
                    (
                        None,
                        "Move from the opening frame to the ending frame. No text."
                    ),
                ),
                ("seconds", (None, "5")),
                ("size", (None, "1360x768")),
                ("first_frame", (None, "https://your-image-host/first-frame.png")),
                ("last_frame", (None, "https://your-image-host/last-frame.png")),
            ]

            response = requests.post(
                "https://api.cometapi.com/v1/videos",
                headers={
                    "Authorization": "Bearer " + os.environ["COMETAPI_KEY"]
                },
                files=fields,
                timeout=120,
            )
            response.raise_for_status()
            print(response.json())
        - lang: JavaScript
          label: 'H3-Max: first and last frames'
          source: >
            const form = new FormData();

            form.append("model", "minimax-h3-max");

            form.append(
              "prompt",
              "Move from the opening frame to the ending frame. No text.",
            );

            form.append("seconds", "5");

            form.append("size", "1360x768");

            form.append("first_frame",
            "https://your-image-host/first-frame.png");

            form.append("last_frame", "https://your-image-host/last-frame.png");


            const response = await fetch(
              "https://api.cometapi.com/v1/videos",
              {
                method: "POST",
                headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` },
                body: form,
              },
            );


            if (!response.ok) {
              throw new Error(await response.text());
            }


            console.log(await response.json());
components:
  schemas:
    MiniMaxH3CreateRequest:
      type: object
      required:
        - model
        - prompt
      properties:
        model:
          type: string
          default: minimax-h3
          description: >-
            Model ID for the video task. Use minimax-h3 for 768P or 2K, or
            minimax-h3-max for 480P or 768P. Choose size from the matching model
            table.
          enum:
            - minimax-h3
            - minimax-h3-max
        prompt:
          type: string
          minLength: 1
          description: >-
            Text that describes the scene, motion, camera behavior, and visual
            details that the video should preserve.
          default: >-
            A paper boat glides across a still pond, daylight, locked camera, no
            text.
        seconds:
          type: integer
          minimum: 5
          maximum: 15
          default: 5
          description: >-
            Requested clip duration in whole seconds. Use an integer from 5
            through 15. The default is 5.
        size:
          type: string
          pattern: ^[1-9][0-9]*x[1-9][0-9]*$
          examples:
            - 1536x672
            - 1344x768
            - 1024x768
            - 768x768
            - 768x1024
            - 768x1344
            - 2912x1280
            - 2544x1456
            - 1920x1440
            - 1440x1440
            - 1440x1920
            - 1440x2560
            - 1120x480
            - 864x480
            - 640x480
            - 480x480
            - 480x640
            - 480x864
            - 1792x768
            - 1360x768
            - 768x1360
          description: >-
            Requested size in WxH form. For text and reference-media requests,
            size selects the resolution tier and framing aspect ratio. With
            first or last frames, size selects the resolution tier. Use the
            matching model table: minimax-h3 uses 768P or 2K; minimax-h3-max
            uses 480P or 768P. For example, use 1344x768 for H3 at 768P, 864x480
            for H3-Max at 480P, or 1360x768 for H3-Max at 768P. The service can
            normalize the final output dimensions.
        input_reference:
          description: >-
            PNG or JPEG reference images. Repeat input_reference with one
            publicly accessible HTTPS image URL or uploaded image file per
            field. Send up to nine reference images, whether you use URLs or
            uploaded files. Use all URLs or all files within this field. Do not
            combine URLs into a comma-separated value. Keep each uploaded image
            at or below 20 MiB. Do not combine this field with first_frame or
            last_frame. Across images, videos, and audio, send at most 12
            reference inputs. Each reference video or audio clip must be 2–15
            seconds; keep the combined video duration and combined audio
            duration at or below 15 seconds each. Submit images in the order you
            want to reference them in the prompt.
          anyOf:
            - title: Single image URL
              type: string
              format: uri
              pattern: ^https://
              description: One publicly accessible HTTPS image URL.
            - title: Image URLs
              type: array
              minItems: 1
              maxItems: 9
              items:
                type: string
                format: uri
                pattern: ^https://
                description: One publicly accessible HTTPS reference image URL.
            - title: Image files
              type: array
              minItems: 1
              maxItems: 9
              items:
                type: string
                format: binary
                description: One uploaded reference image file.
        reference_videos:
          type: array
          minItems: 1
          maxItems: 3
          items:
            anyOf:
              - type: string
                format: uri
                pattern: ^(https://|data:video/mp4;base64,)
                example: https://your-media-host/reference.mp4
              - type: string
                format: binary
          description: >-
            Reference video inputs. Repeat reference_videos with a direct
            publicly accessible HTTPS MP4 URL or an uploaded MP4 file. Use only
            text values or only files within this field. Each uploaded file can
            be up to 50 MiB. Send no more than three video inputs. A complete
            data:video/mp4;base64,... URI is also accepted as a text value. Use
            MP4 with H.264 video; an AAC audio track is optional. Do not combine
            this field with first_frame or last_frame. Across images, videos,
            and audio, send at most 12 reference inputs. Each reference video or
            audio clip must be 2–15 seconds; keep the combined video duration
            and combined audio duration at or below 15 seconds each.
        reference_audios:
          type: array
          minItems: 1
          maxItems: 3
          items:
            anyOf:
              - type: string
                format: uri
                pattern: ^https://
                example: https://your-media-host/reference.mp3
              - type: string
                format: binary
          description: >-
            Reference audio inputs. Repeat reference_audios with a direct
            publicly accessible HTTPS MP3 URL or an uploaded MP3 file. Use only
            text values or only files within this field. Each uploaded file can
            be up to 15 MiB. Send no more than three audio inputs. Pair
            reference audio with at least one reference image. Do not combine
            this field with first_frame or last_frame. Across images, videos,
            and audio, send at most 12 reference inputs. Each reference video or
            audio clip must be 2–15 seconds; keep the combined video duration
            and combined audio duration at or below 15 seconds each.
        first_frame:
          description: >-
            Opening frame input as one direct publicly accessible HTTPS PNG URL
            or one uploaded PNG file at or below 20 MiB (20 x 1024 x 1024
            bytes). Do not combine frame fields with reference media fields.
          anyOf:
            - type: string
              format: uri
              pattern: ^https://
              example: https://your-image-host/first-frame.png
            - type: string
              format: binary
        last_frame:
          description: >-
            Optional ending frame input, used with first_frame, as one direct
            publicly accessible HTTPS PNG URL or one uploaded PNG file at or
            below 20 MiB (20 x 1024 x 1024 bytes). Do not combine frame fields
            with reference media fields.
          anyOf:
            - type: string
              format: uri
              pattern: ^https://
              example: https://your-image-host/last-frame.png
            - type: string
              format: binary
      dependentRequired:
        last_frame:
          - first_frame
      additionalProperties: false
    MiniMaxH3VideoTask:
      type: object
      required:
        - id
        - object
        - model
        - status
        - progress
        - created_at
      properties:
        id:
          type: string
          description: Task ID. Use this value as task_id in retrieve and content requests.
          example: <task_id>
        task_id:
          type: string
          description: >-
            Compatibility alias for id. This field can be omitted from retrieve
            responses.
          example: <task_id>
        object:
          type: string
          const: video
          description: Object type for the asynchronous video task.
        model:
          type: string
          description: Model ID that the task uses.
          enum:
            - minimax-h3
            - minimax-h3-max
        status:
          type: string
          enum:
            - queued
            - in_progress
            - completed
            - failed
          description: Task lifecycle status. Poll until the value is completed or failed.
        progress:
          type: integer
          minimum: 0
          maximum: 100
          description: Task progress as a coarse percentage.
        created_at:
          type: integer
          format: int64
          description: Task creation time as a Unix timestamp in seconds.
        completed_at:
          type: integer
          format: int64
          description: >-
            Unix timestamp returned by the platform. Use status, not this field,
            to decide when polling can stop.
        expires_at:
          type: integer
          format: int64
          description: >-
            Result expiration time as a Unix timestamp in seconds when the task
            provides one.
        video_url:
          type: string
          format: uri
          description: Video delivery URL. This field appears on completed tasks.
          example: https://your-media-host/result.mp4
        error:
          type: object
          description: Failure details. This field appears when the task fails.
          properties:
            message:
              type: string
              description: Human-readable failure description.
            code:
              type: string
              description: Failure code when the task provides one.
          additionalProperties: true
      additionalProperties: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer authentication. Use your CometAPI API key.

````