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

# Opprett en Wan-video

> Opprett en Wan-video fra tekst, referansemedier eller første og siste bilder via CometAPI, og hent deretter oppgavestatusen og last ned MP4-filen.

Opprett en Wan-video fra tekst, referansemedier eller første og siste bilder. Lagre den returnerte `id` for å hente oppgavestatusen og laste ned den fullførte videoen.

`POST /v1/videos` bruker `multipart/form-data`. Send en eksplisitt heltallsverdi for `seconds` og en `size` i `WxH`-format.

## Velg en inndatamodus

Alle moduser krever `model` og `prompt`. Tilgjengelige medieinnganger avhenger av modellen:

| Mål                             | Modell-ID-er                                 | Mediefelter                                          |
| ------------------------------- | -------------------------------------------- | ---------------------------------------------------- |
| Tekst-til-video                 | `wan2.6`, `wan2.7`, `wan3.0`, `wan3.0-prime` | Utelat mediefelter                                   |
| Bilde-til-video                 | `wan2.7`, `wan3.0`, `wan3.0-prime`           | `input_reference` URL-er eller opplastede bildefiler |
| Referansevideo                  | `wan2.6`                                     | `reference_videos` kun                               |
| Bilde- og videoreferanser       | `wan2.7`, `wan3.0`, `wan3.0-prime`           | `input_reference` med `reference_videos`             |
| Bilde-, video- og lydreferanser | `wan3.0`, `wan3.0-prime`                     | Bilde-/videoreferanser med `reference_audios`        |
| Første og siste bilder          | `wan2.7`, `wan3.0`, `wan3.0-prime`           | `first_frame`, valgfritt `last_frame`                |

For å finne en Wan-modell-ID som er tilgjengelig for API-nøkkelen din, bruker du [List tilgjengelige modeller](/no/guides/how-to-list-available-models).

## Bruk referansebilder

For `wan2.7`, `wan3.0` og `wan3.0-prime` sender du referansebilder via `input_reference` som offentlig tilgjengelige HTTPS-URL-er eller opplastede filer.
For flere bilder gjentar du feltet i bilderekkefølge, med én URL eller fil per felt.

Bruk enten bare URL-er eller bare filer i `input_reference`. Send hver URL separat i stedet for å kombinere URL-er i en kommaseparert verdi.
Bruk PNG- eller JPEG-bilder på opptil 20 MB hver.

Én enkelt `input_reference`-URL eller -fil bruker arbeidsflyten for bilde-til-video. Bildet styrer komposisjon og utseende; bruk prompten til å beskrive bevegelse og kamerabevegelser.

For `wan3.0` og `wan3.0-prime` sender du maksimalt 10 referansebilder via `input_reference`, enten du bruker URL-er eller opplastede filer.

## Bruk referansevideoer og lyd

Send videoer via `reference_videos` og lydklipp via `reference_audios`, og gjenta hvert felt én gang per inndata.
Hver inndata kan være en offentlig tilgjengelig HTTPS-URL eller en opplastet fil.

Bruk MP4-filer med H.264-kodet video som videoreferanser. Bruk separate MP3-filer som lydreferanser.

Ulike felt kan bruke ulike inndatatyper, for eksempel en bilde-URL sammen med opplastede videoer. I `reference_videos` eller `reference_audios` bruker du enten bare URL-er eller bare filer.

Du kan laste opp opptil fem videofiler, hver på maksimalt 50 MiB (50 × 1024 × 1024 byte).
Du kan laste opp opptil fem lydfiler, hver på maksimalt 15 MiB (15 × 1024 × 1024 byte).

### Wan 2.6-videoreferanser

Send én til tre `reference_videos`, hver på 2–30 sekunder, opptil 30 MB og med minst 16 fps.
Disse grensene gjelder både URL-er og opplastede videoer. I Prompt refererer du til motiver som `@Video1`, `@Video2` og `@Video3` i inndatarekkefølge.

For denne modusen utelater du `input_reference`, `reference_audios`, `first_frame` og `last_frame`. Sett `seconds` til `5` eller `10`.

Disse eksemplene oppretter en fem sekunder lang video fra to videoreferanser. Erstatt medie-URL-ene eller filnavnene med inndataene dine:

<CodeGroup>
  ```bash Wan 2.6 reference video URLs theme={null}
  curl https://api.cometapi.com/v1/videos \
    -H "Authorization: Bearer $COMETAPI_KEY" \
    -F 'model=wan2.6' \
    --form-string 'prompt=Keep @Video1 and @Video2 recognizable as they walk.' \
    -F 'seconds=5' \
    -F 'size=1280x720' \
    -F 'reference_videos=https://your-media-host/reference-1.mp4' \
    -F 'reference_videos=https://your-media-host/reference-2.mp4'
  ```

  ```bash Wan 2.6 uploaded reference videos theme={null}
  curl https://api.cometapi.com/v1/videos \
    -H "Authorization: Bearer $COMETAPI_KEY" \
    -F 'model=wan2.6' \
    --form-string 'prompt=Keep @Video1 and @Video2 recognizable as they walk.' \
    -F 'seconds=5' \
    -F 'size=1280x720' \
    -F 'reference_videos=@reference-1.mp4;type=video/mp4' \
    -F 'reference_videos=@reference-2.mp4;type=video/mp4'
  ```
</CodeGroup>

### Wan 2.7-bilde- og videoreferanser

Kombiner bilde- og videoreferanser for å styre motivets utseende og bevegelse. Sett `seconds` til et heltall fra `2` til og med `10`. Utelat `reference_audios`.

Bruk to bilde-URL-er eller to opplastede bilder med en videoreferanse:

<CodeGroup>
  ```bash Wan 2.7 image and video URLs theme={null}
  curl \
    https://api.cometapi.com/v1/videos \
    -H "Authorization: Bearer $COMETAPI_KEY" \
    -F 'model=wan2.7' \
    -F 'prompt=Preserve the image subjects and follow the video motion.' \
    -F 'seconds=5' \
    -F 'size=1280x720' \
    -F 'input_reference=https://your-image-host/reference-1.png' \
    -F 'input_reference=https://your-image-host/reference-2.jpg' \
    -F 'reference_videos=https://your-media-host/reference.mp4'
  ```

  ```bash Wan 2.7 uploaded images and video theme={null}
  curl https://api.cometapi.com/v1/videos \
    -H "Authorization: Bearer $COMETAPI_KEY" \
    -F 'model=wan2.7' \
    -F 'prompt=Preserve the image subjects and follow the video motion.' \
    -F 'seconds=5' \
    -F 'size=1280x720' \
    -F 'input_reference=@reference-1.png;type=image/png' \
    -F 'input_reference=@reference-2.jpg;type=image/jpeg' \
    -F 'reference_videos=@reference.mp4;type=video/mp4'
  ```
</CodeGroup>

### Wan 3.0-bilde-, video- og lydreferanser

For `wan3.0` og `wan3.0-prime` kombinerer du bilde- og videoreferanser med lydreferanser for å styre utseende, bevegelse og rytme.

Send maksimalt fem videoreferanser med en samlet varighet på maksimalt 15 sekunder. Hver video må ha minst 16 fps.
Send maksimalt fem lydreferanser med en samlet varighet på maksimalt 15 sekunder. Tell video- og lydvarighet hver for seg.

Sett `seconds` for utdata til et heltall fra `2` til og med `30`.

Bruk to bilde-URL-er eller to opplastede bilder med én video og to lydklipp:

<CodeGroup>
  ```bash Wan 3.0 image, video, and audio URLs theme={null}
  curl \
    https://api.cometapi.com/v1/videos \
    -H "Authorization: Bearer $COMETAPI_KEY" \
    -F 'model=wan3.0' \
    -F 'prompt=Preserve image subjects, video motion, and audio rhythm.' \
    -F 'seconds=5' \
    -F 'size=1280x720' \
    -F 'input_reference=https://your-image-host/reference-1.png' \
    -F 'input_reference=https://your-image-host/reference-2.jpg' \
    -F 'reference_videos=https://your-media-host/reference.mp4' \
    -F 'reference_audios=https://your-media-host/reference-1.mp3' \
    -F 'reference_audios=https://your-media-host/reference-2.mp3'
  ```

  ```bash Wan 3.0 uploaded images, video, and audio theme={null}
  curl https://api.cometapi.com/v1/videos \
    -H "Authorization: Bearer $COMETAPI_KEY" \
    -F 'model=wan3.0' \
    -F 'prompt=Preserve image subjects, video motion, and audio rhythm.' \
    -F 'seconds=5' \
    -F 'size=1280x720' \
    -F 'input_reference=@reference-1.png;type=image/png' \
    -F 'input_reference=@reference-2.jpg;type=image/jpeg' \
    -F 'reference_videos=@reference.mp4;type=video/mp4' \
    -F 'reference_audios=@reference-1.mp3;type=audio/mpeg' \
    -F 'reference_audios=@reference-2.mp3;type=audio/mpeg'
  ```
</CodeGroup>

## Bruk første og siste bilde

For `wan2.7`, `wan3.0` og `wan3.0-prime` sender du `first_frame` for startbildet og eventuelt `last_frame` for sluttbildet.
Hvert felt godtar én offentlig tilgjengelig HTTPS-URL til en PNG- eller JPEG-fil, eller én opplastet PNG- eller JPEG-fil.

For rammainndata i Wan 2.7 bestemmer startbildet sideforholdet, mens `size` velger nivået for utdataoppløsning.

Send rammainndata i en separat forespørsel fra `input_reference`, `reference_videos` og `reference_audios`.

Disse Wan 2.7-eksemplene oppretter en overgang mellom start- og sluttrammer:

<CodeGroup>
  ```bash Wan 2.7 first and last frame URLs theme={null}
  curl https://api.cometapi.com/v1/videos \
    -H "Authorization: Bearer $COMETAPI_KEY" \
    -F 'model=wan2.7' \
    -F 'prompt=Move smoothly from the opening frame to the ending frame.' \
    -F 'seconds=5' \
    -F 'size=1280x720' \
    -F 'first_frame=https://your-image-host/first-frame.png' \
    -F 'last_frame=https://your-image-host/last-frame.jpg'
  ```

  ```bash Wan 2.7 uploaded first and last frames theme={null}
  curl https://api.cometapi.com/v1/videos \
    -H "Authorization: Bearer $COMETAPI_KEY" \
    -F 'model=wan2.7' \
    -F 'prompt=Move smoothly from the opening frame to the ending frame.' \
    -F 'seconds=5' \
    -F 'size=1280x720' \
    -F 'first_frame=@first-frame.png;type=image/png' \
    -F 'last_frame=@last-frame.jpg;type=image/jpeg'
  ```
</CodeGroup>

Disse Wan 3.0-eksemplene oppretter en overgang mellom start- og sluttrammer:

<CodeGroup>
  ```bash Wan 3.0 first and last frame URLs theme={null}
  curl https://api.cometapi.com/v1/videos \
    -H "Authorization: Bearer $COMETAPI_KEY" \
    -F 'model=wan3.0' \
    -F 'prompt=Move smoothly from the opening frame to the ending frame.' \
    -F 'seconds=5' \
    -F 'size=1280x720' \
    -F 'first_frame=https://your-image-host/first-frame.png' \
    -F 'last_frame=https://your-image-host/last-frame.jpg'
  ```

  ```bash Wan 3.0 uploaded first and last frames theme={null}
  curl https://api.cometapi.com/v1/videos \
    -H "Authorization: Bearer $COMETAPI_KEY" \
    -F 'model=wan3.0' \
    -F 'prompt=Move smoothly from the opening frame to the ending frame.' \
    -F 'seconds=5' \
    -F 'size=1280x720' \
    -F 'first_frame=@first-frame.png;type=image/png' \
    -F 'last_frame=@last-frame.jpg;type=image/jpeg'
  ```
</CodeGroup>

## Angi varighet og størrelse

Send `seconds` som et heltall innenfor området som gjelder for modellen og inndatamodusen.

| Modell-ID                | Inndatamodus                   | `seconds`        | Standard                                                       |
| ------------------------ | ------------------------------ | ---------------- | -------------------------------------------------------------- |
| `wan3.0`, `wan3.0-prime` | Tekst, referanser eller bilder | heltall `2`–`30` | `5` sekunder, `1920x1080`                                      |
| `wan2.7`                 | Tekst                          | heltall `2`–`15` | `5` sekunder, `1920x1080`                                      |
| `wan2.7`                 | Bilder                         | heltall `2`–`15` | `5` sekunder, `1080p`-nivå; sideforholdet følger åpningsbildet |
| `wan2.7`                 | Bilde-/videoreferanser         | heltall `2`–`10` | `5` sekunder, `1920x1080`                                      |
| `wan2.6`                 | Tekst                          | `5`, `10`, `15`  | `5` sekunder, `1920x1080`                                      |
| `wan2.6`                 | Videoreferanser                | `5`, `10`        | `5` sekunder, `1920x1080`                                      |

Angi `size` til én av WxH-verdiene nedenfor for målmodellen.

Størrelsesverdiene for Wan 3.0 gjelder også for `wan3.0-prime`.

### Størrelsesverdier for Wan 3.0

| Oppløsningsnivå | Sideforhold | `size` (`WxH`) |
| --------------- | ----------- | -------------- |
| `480p`          | `16:9`      | `832x480`      |
|                 | `9:16`      | `480x832`      |
|                 | `1:1`       | `624x624`      |
| `720p`          | `16:9`      | `1280x720`     |
|                 | `9:16`      | `720x1280`     |
|                 | `1:1`       | `960x960`      |
|                 | `4:3`       | `1088x832`     |
|                 | `3:4`       | `832x1088`     |
| `1080p`         | `16:9`      | `1920x1080`    |
|                 | `9:16`      | `1080x1920`    |
|                 | `1:1`       | `1440x1440`    |
|                 | `4:3`       | `1632x1248`    |
|                 | `3:4`       | `1248x1632`    |

### Størrelsesverdier for Wan 2.7

| Oppløsningsnivå | Sideforhold | `size` (`WxH`) |
| --------------- | ----------- | -------------- |
| `720p`          | `16:9`      | `1280x720`     |
|                 | `9:16`      | `720x1280`     |
| `1080p`         | `16:9`      | `1920x1080`    |
|                 | `9:16`      | `1080x1920`    |
|                 | `1:1`       | `1440x1440`    |

### Størrelsesverdier for Wan 2.6

| Oppløsningsnivå | Sideforhold | `size` (`WxH`) |
| --------------- | ----------- | -------------- |
| `720p`          | `16:9`      | `1280x720`     |
|                 | `9:16`      | `720x1280`     |
|                 | `4:3`       | `1088x832`     |
|                 | `3:4`       | `832x1088`     |
| `1080p`         | `16:9`      | `1920x1080`    |
|                 | `9:16`      | `1080x1920`    |
|                 | `1:1`       | `1440x1440`    |
|                 | `4:3`       | `1632x1248`    |
|                 | `3:4`       | `1248x1632`    |

## Oppgaveflyt

<Steps>
  <Step title="Opprett oppgaven">
    Send multipart-skjemaanmodningen og lagre den returnerte `id`.
  </Step>

  <Step title="Sjekk oppgaven jevnlig">
    Kall [Hent en Wan-video](./retrieve) til `status` er `completed`, `failed` eller `error`.
  </Step>

  <Step title="Last ned resultatet">
    Når oppgaven har status `completed`, kall [Hent Wan-videoinnhold](./retrieve-content) for å laste ned MP4-filen.
  </Step>
</Steps>


## OpenAPI

````yaml api/openapi/video/wan/post-create.openapi.json POST /v1/videos
openapi: 3.1.0
info:
  title: Wan Video Create API
  version: 1.0.0
  description: >-
    Create an asynchronous Wan video task from text, reference media, or first
    and last frames through CometAPI. Save the returned id, poll GET
    /v1/videos/{task_id}, and download the completed MP4 file.
servers:
  - url: https://api.cometapi.com
security:
  - bearerAuth: []
paths:
  /v1/videos:
    post:
      summary: Create a Wan video task
      description: >-
        Create a Wan video task from text, reference media, or first and last
        frames. Send fields as multipart/form-data. Repeat input_reference with
        one publicly accessible HTTPS image URL or uploaded image file per
        field. Use all URLs or all files within input_reference. Send reference
        video or audio URLs or files through reference_videos or
        reference_audios. Submit frame inputs separately from reference media.
      operationId: wan_create_video
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/WanCreateRequest'
            encoding:
              input_reference:
                style: form
                explode: true
                contentType: text/plain, image/png, image/jpeg
              reference_videos:
                style: form
                explode: true
              reference_audios:
                style: form
                explode: true
              first_frame:
                style: form
              last_frame:
                style: form
            examples:
              text_to_video:
                summary: Text-to-video
                value:
                  model: wan3.0
                  prompt: >-
                    A small robot walks through a bright greenhouse with smooth
                    camera movement.
                  seconds: 5
                  size: 1920x1080
              image_to_video:
                summary: Image-to-video with an uploaded reference image
                value:
                  model: wan3.0
                  prompt: Animate the uploaded image.
                  seconds: 5
                  size: 1920x1080
                  input_reference:
                    - '@reference.png'
              wan26_reference_video_urls:
                summary: Wan 2.6 reference video URLs
                value:
                  model: wan2.6
                  prompt: Keep @Video1 and @Video2 recognizable as they walk.
                  seconds: 5
                  size: 1280x720
                  reference_videos:
                    - https://your-media-host/reference-1.mp4
                    - https://your-media-host/reference-2.mp4
              wan26_reference_video_files:
                summary: Wan 2.6 uploaded reference videos
                value:
                  model: wan2.6
                  prompt: Keep @Video1 and @Video2 recognizable as they walk.
                  seconds: 5
                  size: 1280x720
                  reference_videos:
                    - '@reference-1.mp4'
                    - '@reference-2.mp4'
              wan27_image_video_urls:
                summary: Wan 2.7 image and video URLs
                value:
                  model: wan2.7
                  prompt: Preserve the image subjects and follow the video motion.
                  seconds: 5
                  size: 1280x720
                  reference_videos:
                    - https://your-media-host/reference.mp4
                  input_reference:
                    - https://your-image-host/reference-1.png
                    - https://your-image-host/reference-2.jpg
              wan27_image_video_files:
                summary: Wan 2.7 uploaded images and video
                value:
                  model: wan2.7
                  prompt: Preserve the image subjects and follow the video motion.
                  seconds: 5
                  size: 1280x720
                  input_reference:
                    - '@reference-1.png'
                    - '@reference-2.jpg'
                  reference_videos:
                    - '@reference.mp4'
              wan30_image_video_audio_urls:
                summary: Wan 3.0 image, video, and audio URLs
                value:
                  model: wan3.0
                  prompt: Preserve image subjects, video motion, and audio rhythm.
                  seconds: 5
                  size: 1280x720
                  reference_videos:
                    - https://your-media-host/reference.mp4
                  reference_audios:
                    - https://your-media-host/reference-1.mp3
                    - https://your-media-host/reference-2.mp3
                  input_reference:
                    - https://your-image-host/reference-1.png
                    - https://your-image-host/reference-2.jpg
              wan30_image_video_audio_files:
                summary: Wan 3.0 uploaded images, video, and audio
                value:
                  model: wan3.0
                  prompt: Preserve image subjects, video motion, and audio rhythm.
                  seconds: 5
                  size: 1280x720
                  input_reference:
                    - '@reference-1.png'
                    - '@reference-2.jpg'
                  reference_videos:
                    - '@reference.mp4'
                  reference_audios:
                    - '@reference-1.mp3'
                    - '@reference-2.mp3'
              wan27_first_last_frame_urls:
                summary: Wan 2.7 first and last frame URLs
                value:
                  model: wan2.7
                  prompt: Move smoothly from the opening frame to the ending frame.
                  seconds: 5
                  size: 1280x720
                  first_frame: https://your-image-host/first-frame.png
                  last_frame: https://your-image-host/last-frame.jpg
              wan27_first_last_frame_files:
                summary: Wan 2.7 uploaded first and last frames
                value:
                  model: wan2.7
                  prompt: Move smoothly from the opening frame to the ending frame.
                  seconds: 5
                  size: 1280x720
                  first_frame: '@first-frame.png'
                  last_frame: '@last-frame.jpg'
              wan30_first_last_frame_urls:
                summary: Wan 3.0 first and last frame URLs
                value:
                  model: wan3.0
                  prompt: Move smoothly from the opening frame to the ending frame.
                  seconds: 5
                  size: 1280x720
                  first_frame: https://your-image-host/first-frame.png
                  last_frame: https://your-image-host/last-frame.jpg
              wan30_first_last_frame_files:
                summary: Wan 3.0 uploaded first and last frames
                value:
                  model: wan3.0
                  prompt: Move smoothly from the opening frame to the ending frame.
                  seconds: 5
                  size: 1280x720
                  first_frame: '@first-frame.png'
                  last_frame: '@last-frame.jpg'
      responses:
        '200':
          description: >-
            Task created. Store the returned id and poll GET
            /v1/videos/{task_id}.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WanVideoTask'
              example:
                id: task_example
                task_id: task_example
                object: video
                model: wan3.0
                status: queued
                progress: 0
                created_at: 1779938152
        '400':
          description: >-
            The request is missing a required field or contains a value that the
            selected model cannot use.
        '401':
          description: The API key is missing or invalid.
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: Shell
          label: Text-to-video
          source: |-
            curl https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              -F model=wan3.0 \
              -F 'prompt=A small robot walks through a bright greenhouse with smooth camera movement.' \
              -F seconds=5 \
              -F size=1920x1080
        - lang: Python
          label: Text-to-video
          source: |
            import os
            import requests

            fields = [
                ("model", (None, "wan3.0")),
                ("prompt", (None, "A small robot walks through a bright greenhouse with smooth camera movement.")),
                ("seconds", (None, "5")),
                ("size", (None, "1920x1080")),
            ]

            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
          source: >
            const form = new FormData();

            form.append("model", "wan3.0");

            form.append("prompt", "A small robot walks through a bright
            greenhouse with smooth camera movement.");

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

            form.append("size", "1920x1080");


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


            const result = await response.json();

            console.log(result);
        - lang: Shell
          label: Image-to-video
          source: |-
            curl https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              -F 'model=wan3.0' \
              -F 'prompt=Animate the uploaded image.' \
              -F 'seconds=5' \
              -F 'size=1920x1080' \
              -F 'input_reference=@reference.png;type=image/png'
        - lang: Python
          label: Image-to-video
          source: |
            import os

            import requests

            with open("reference.png", "rb") as reference:
                response = requests.post(
                    "https://api.cometapi.com/v1/videos",
                    headers={
                        "Authorization": "Bearer "
                        + os.environ["COMETAPI_KEY"]
                    },
                    data={
                        "model": "wan3.0",
                        "prompt": "Animate the uploaded image.",
                        "seconds": "5",
                        "size": "1920x1080",
                    },
                    files={
                        "input_reference": (
                            "reference.png",
                            reference,
                            "image/png",
                        )
                    },
                    timeout=120,
                )

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

            const reference = await readFile("reference.png");
            const form = new FormData();
            form.append("model", "wan3.0");
            form.append("prompt", "Animate the uploaded image.");
            form.append("seconds", "5");
            form.append("size", "1920x1080");
            form.append(
              "input_reference",
              new Blob([reference], { type: "image/png" }),
              "reference.png",
            );

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

            const result = await response.json();
            console.log(result);
        - lang: Shell
          label: Wan 2.6 reference video URLs
          source: |-
            curl https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              -F 'model=wan2.6' \
              --form-string 'prompt=Keep @Video1 and @Video2 recognizable as they walk.' \
              -F 'seconds=5' \
              -F 'size=1280x720' \
              -F 'reference_videos=https://your-media-host/reference-1.mp4' \
              -F 'reference_videos=https://your-media-host/reference-2.mp4'
        - lang: Python
          label: Wan 2.6 reference video URLs
          source: |
            import os

            import requests

            fields = [
                ("model", (None, "wan2.6")),
                (
                    "prompt",
                    (None, "Keep @Video1 and @Video2 recognizable as they walk."),
                ),
                ("seconds", (None, "5")),
                ("size", (None, "1280x720")),
                ("reference_videos", (None, "https://your-media-host/reference-1.mp4")),
                ("reference_videos", (None, "https://your-media-host/reference-2.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: Wan 2.6 reference video URLs
          source: >
            const form = new FormData();

            form.append("model", "wan2.6");

            form.append(
              "prompt",
              "Keep @Video1 and @Video2 recognizable as they walk.",
            );

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

            form.append("size", "1280x720");

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

            form.append("reference_videos",
            "https://your-media-host/reference-2.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: Wan 2.6 uploaded reference videos
          source: |-
            curl https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              -F 'model=wan2.6' \
              --form-string 'prompt=Keep @Video1 and @Video2 recognizable as they walk.' \
              -F 'seconds=5' \
              -F 'size=1280x720' \
              -F 'reference_videos=@reference-1.mp4;type=video/mp4' \
              -F 'reference_videos=@reference-2.mp4;type=video/mp4'
        - lang: Python
          label: Wan 2.6 uploaded reference videos
          source: |
            import os
            from contextlib import ExitStack

            import requests

            with ExitStack() as stack:
                fields = [
                    ("model", (None, "wan2.6")),
                    (
                        "prompt",
                        (None, "Keep @Video1 and @Video2 recognizable as they walk."),
                    ),
                    ("seconds", (None, "5")),
                    ("size", (None, "1280x720")),
                    (
                        "reference_videos",
                        (
                            "reference-1.mp4",
                            stack.enter_context(open("reference-1.mp4", "rb")),
                            "video/mp4",
                        ),
                    ),
                    (
                        "reference_videos",
                        (
                            "reference-2.mp4",
                            stack.enter_context(open("reference-2.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: Wan 2.6 uploaded reference videos
          source: |
            import { readFile } from "node:fs/promises";

            const form = new FormData();
            form.append("model", "wan2.6");
            form.append(
              "prompt",
              "Keep @Video1 and @Video2 recognizable as they walk.",
            );
            form.append("seconds", "5");
            form.append("size", "1280x720");
            form.append(
              "reference_videos",
              new Blob([await readFile("reference-1.mp4")], {
                type: "video/mp4",
              }),
              "reference-1.mp4",
            );
            form.append(
              "reference_videos",
              new Blob([await readFile("reference-2.mp4")], {
                type: "video/mp4",
              }),
              "reference-2.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: Wan 2.7 image and video URLs
          source: |
            curl \
              https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              --form-string model=wan2.7 \
              --form-string 'prompt=Preserve the image subjects and follow the video motion.' \
              --form-string seconds=5 \
              --form-string size=1280x720 \
              --form-string reference_videos=https://your-media-host/reference.mp4 \
              --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: Wan 2.7 image and video URLs
          source: |
            import os

            import requests

            fields = [
                ("model", (None, "wan2.7")),
                (
                    "prompt",
                    (
                        None,
                        "Preserve the image subjects and follow the video motion."
                    ),
                ),
                ("seconds", (None, "5")),
                ("size", (None, "1280x720")),
                ("reference_videos", (None, "https://your-media-host/reference.mp4")),
                ("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: Wan 2.7 image and video URLs
          source: >
            const form = new FormData();

            form.append("model", "wan2.7");

            form.append(
              "prompt",
              "Preserve the image subjects and follow the video motion.",
            );

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

            form.append("size", "1280x720");

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

            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: Wan 2.7 uploaded images and video
          source: |-
            curl https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              -F 'model=wan2.7' \
              -F 'prompt=Preserve the image subjects and follow the video motion.' \
              -F 'seconds=5' \
              -F 'size=1280x720' \
              -F 'input_reference=@reference-1.png;type=image/png' \
              -F 'input_reference=@reference-2.jpg;type=image/jpeg' \
              -F 'reference_videos=@reference.mp4;type=video/mp4'
        - lang: Python
          label: Wan 2.7 uploaded images and video
          source: |
            import os
            from contextlib import ExitStack

            import requests

            with ExitStack() as stack:
                fields = [
                    ("model", (None, "wan2.7")),
                    (
                        "prompt",
                        (None, "Preserve the image subjects and follow the video motion."),
                    ),
                    ("seconds", (None, "5")),
                    ("size", (None, "1280x720")),
                    (
                        "input_reference",
                        (
                            "reference-1.png",
                            stack.enter_context(open("reference-1.png", "rb")),
                            "image/png",
                        ),
                    ),
                    (
                        "input_reference",
                        (
                            "reference-2.jpg",
                            stack.enter_context(open("reference-2.jpg", "rb")),
                            "image/jpeg",
                        ),
                    ),
                    (
                        "reference_videos",
                        (
                            "reference.mp4",
                            stack.enter_context(open("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: Wan 2.7 uploaded images and video
          source: |
            import { readFile } from "node:fs/promises";

            const form = new FormData();
            form.append("model", "wan2.7");
            form.append(
              "prompt",
              "Preserve the image subjects and follow the video motion.",
            );
            form.append("seconds", "5");
            form.append("size", "1280x720");
            form.append(
              "input_reference",
              new Blob([await readFile("reference-1.png")], {
                type: "image/png",
              }),
              "reference-1.png",
            );
            form.append(
              "input_reference",
              new Blob([await readFile("reference-2.jpg")], {
                type: "image/jpeg",
              }),
              "reference-2.jpg",
            );
            form.append(
              "reference_videos",
              new Blob([await readFile("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: Wan 3.0 image, video, and audio URLs
          source: |
            curl \
              https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              --form-string model=wan3.0 \
              --form-string 'prompt=Preserve image subjects, video motion, and audio rhythm.' \
              --form-string seconds=5 \
              --form-string size=1280x720 \
              --form-string reference_videos=https://your-media-host/reference.mp4 \
              --form-string reference_audios=https://your-media-host/reference-1.mp3 \
              --form-string reference_audios=https://your-media-host/reference-2.mp3 \
              --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: Wan 3.0 image, video, and audio URLs
          source: |
            import os

            import requests

            fields = [
                ("model", (None, "wan3.0")),
                (
                    "prompt",
                    (
                        None,
                        "Preserve image subjects, video motion, and audio rhythm."
                    ),
                ),
                ("seconds", (None, "5")),
                ("size", (None, "1280x720")),
                ("reference_videos", (None, "https://your-media-host/reference.mp4")),
                ("reference_audios", (None, "https://your-media-host/reference-1.mp3")),
                ("reference_audios", (None, "https://your-media-host/reference-2.mp3")),
                ("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: Wan 3.0 image, video, and audio URLs
          source: >
            const form = new FormData();

            form.append("model", "wan3.0");

            form.append(
              "prompt",
              "Preserve image subjects, video motion, and audio rhythm.",
            );

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

            form.append("size", "1280x720");

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

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

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

            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: Wan 3.0 uploaded images, video, and audio
          source: |-
            curl https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              -F 'model=wan3.0' \
              -F 'prompt=Preserve image subjects, video motion, and audio rhythm.' \
              -F 'seconds=5' \
              -F 'size=1280x720' \
              -F 'input_reference=@reference-1.png;type=image/png' \
              -F 'input_reference=@reference-2.jpg;type=image/jpeg' \
              -F 'reference_videos=@reference.mp4;type=video/mp4' \
              -F 'reference_audios=@reference-1.mp3;type=audio/mpeg' \
              -F 'reference_audios=@reference-2.mp3;type=audio/mpeg'
        - lang: Python
          label: Wan 3.0 uploaded images, video, and audio
          source: |
            import os
            from contextlib import ExitStack

            import requests

            with ExitStack() as stack:
                fields = [
                    ("model", (None, "wan3.0")),
                    (
                        "prompt",
                        (None, "Preserve image subjects, video motion, and audio rhythm."),
                    ),
                    ("seconds", (None, "5")),
                    ("size", (None, "1280x720")),
                    (
                        "input_reference",
                        (
                            "reference-1.png",
                            stack.enter_context(open("reference-1.png", "rb")),
                            "image/png",
                        ),
                    ),
                    (
                        "input_reference",
                        (
                            "reference-2.jpg",
                            stack.enter_context(open("reference-2.jpg", "rb")),
                            "image/jpeg",
                        ),
                    ),
                    (
                        "reference_videos",
                        (
                            "reference.mp4",
                            stack.enter_context(open("reference.mp4", "rb")),
                            "video/mp4",
                        ),
                    ),
                    (
                        "reference_audios",
                        (
                            "reference-1.mp3",
                            stack.enter_context(open("reference-1.mp3", "rb")),
                            "audio/mpeg",
                        ),
                    ),
                    (
                        "reference_audios",
                        (
                            "reference-2.mp3",
                            stack.enter_context(open("reference-2.mp3", "rb")),
                            "audio/mpeg",
                        ),
                    ),
                ]

                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: Wan 3.0 uploaded images, video, and audio
          source: |
            import { readFile } from "node:fs/promises";

            const form = new FormData();
            form.append("model", "wan3.0");
            form.append(
              "prompt",
              "Preserve image subjects, video motion, and audio rhythm.",
            );
            form.append("seconds", "5");
            form.append("size", "1280x720");
            form.append(
              "input_reference",
              new Blob([await readFile("reference-1.png")], {
                type: "image/png",
              }),
              "reference-1.png",
            );
            form.append(
              "input_reference",
              new Blob([await readFile("reference-2.jpg")], {
                type: "image/jpeg",
              }),
              "reference-2.jpg",
            );
            form.append(
              "reference_videos",
              new Blob([await readFile("reference.mp4")], {
                type: "video/mp4",
              }),
              "reference.mp4",
            );
            form.append(
              "reference_audios",
              new Blob([await readFile("reference-1.mp3")], {
                type: "audio/mpeg",
              }),
              "reference-1.mp3",
            );
            form.append(
              "reference_audios",
              new Blob([await readFile("reference-2.mp3")], {
                type: "audio/mpeg",
              }),
              "reference-2.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: Wan 2.7 first and last frame URLs
          source: |-
            curl https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              -F 'model=wan2.7' \
              -F 'prompt=Move smoothly from the opening frame to the ending frame.' \
              -F 'seconds=5' \
              -F 'size=1280x720' \
              -F 'first_frame=https://your-image-host/first-frame.png' \
              -F 'last_frame=https://your-image-host/last-frame.jpg'
        - lang: Python
          label: Wan 2.7 first and last frame URLs
          source: |
            import os

            import requests

            fields = [
                ("model", (None, "wan2.7")),
                (
                    "prompt",
                    (None, "Move smoothly from the opening frame to the ending frame."),
                ),
                ("seconds", (None, "5")),
                ("size", (None, "1280x720")),
                ("first_frame", (None, "https://your-image-host/first-frame.png")),
                ("last_frame", (None, "https://your-image-host/last-frame.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: Wan 2.7 first and last frame URLs
          source: >
            const form = new FormData();

            form.append("model", "wan2.7");

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

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

            form.append("size", "1280x720");

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

            form.append("last_frame", "https://your-image-host/last-frame.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: Wan 2.7 uploaded first and last frames
          source: |-
            curl https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              -F 'model=wan2.7' \
              -F 'prompt=Move smoothly from the opening frame to the ending frame.' \
              -F 'seconds=5' \
              -F 'size=1280x720' \
              -F 'first_frame=@first-frame.png;type=image/png' \
              -F 'last_frame=@last-frame.jpg;type=image/jpeg'
        - lang: Python
          label: Wan 2.7 uploaded first and last frames
          source: |
            import os
            from contextlib import ExitStack

            import requests

            with ExitStack() as stack:
                fields = [
                    ("model", (None, "wan2.7")),
                    (
                        "prompt",
                        (None, "Move smoothly from the opening frame to the ending frame."),
                    ),
                    ("seconds", (None, "5")),
                    ("size", (None, "1280x720")),
                    (
                        "first_frame",
                        (
                            "first-frame.png",
                            stack.enter_context(open("first-frame.png", "rb")),
                            "image/png",
                        ),
                    ),
                    (
                        "last_frame",
                        (
                            "last-frame.jpg",
                            stack.enter_context(open("last-frame.jpg", "rb")),
                            "image/jpeg",
                        ),
                    ),
                ]

                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: Wan 2.7 uploaded first and last frames
          source: |
            import { readFile } from "node:fs/promises";

            const form = new FormData();
            form.append("model", "wan2.7");
            form.append(
              "prompt",
              "Move smoothly from the opening frame to the ending frame.",
            );
            form.append("seconds", "5");
            form.append("size", "1280x720");
            form.append(
              "first_frame",
              new Blob([await readFile("first-frame.png")], {
                type: "image/png",
              }),
              "first-frame.png",
            );
            form.append(
              "last_frame",
              new Blob([await readFile("last-frame.jpg")], {
                type: "image/jpeg",
              }),
              "last-frame.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: Wan 3.0 first and last frame URLs
          source: |-
            curl https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              -F 'model=wan3.0' \
              -F 'prompt=Move smoothly from the opening frame to the ending frame.' \
              -F 'seconds=5' \
              -F 'size=1280x720' \
              -F 'first_frame=https://your-image-host/first-frame.png' \
              -F 'last_frame=https://your-image-host/last-frame.jpg'
        - lang: Python
          label: Wan 3.0 first and last frame URLs
          source: |
            import os

            import requests

            fields = [
                ("model", (None, "wan3.0")),
                (
                    "prompt",
                    (None, "Move smoothly from the opening frame to the ending frame."),
                ),
                ("seconds", (None, "5")),
                ("size", (None, "1280x720")),
                ("first_frame", (None, "https://your-image-host/first-frame.png")),
                ("last_frame", (None, "https://your-image-host/last-frame.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: Wan 3.0 first and last frame URLs
          source: >
            const form = new FormData();

            form.append("model", "wan3.0");

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

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

            form.append("size", "1280x720");

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

            form.append("last_frame", "https://your-image-host/last-frame.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: Wan 3.0 uploaded first and last frames
          source: |-
            curl https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              -F 'model=wan3.0' \
              -F 'prompt=Move smoothly from the opening frame to the ending frame.' \
              -F 'seconds=5' \
              -F 'size=1280x720' \
              -F 'first_frame=@first-frame.png;type=image/png' \
              -F 'last_frame=@last-frame.jpg;type=image/jpeg'
        - lang: Python
          label: Wan 3.0 uploaded first and last frames
          source: |
            import os
            from contextlib import ExitStack

            import requests

            with ExitStack() as stack:
                fields = [
                    ("model", (None, "wan3.0")),
                    (
                        "prompt",
                        (None, "Move smoothly from the opening frame to the ending frame."),
                    ),
                    ("seconds", (None, "5")),
                    ("size", (None, "1280x720")),
                    (
                        "first_frame",
                        (
                            "first-frame.png",
                            stack.enter_context(open("first-frame.png", "rb")),
                            "image/png",
                        ),
                    ),
                    (
                        "last_frame",
                        (
                            "last-frame.jpg",
                            stack.enter_context(open("last-frame.jpg", "rb")),
                            "image/jpeg",
                        ),
                    ),
                ]

                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: Wan 3.0 uploaded first and last frames
          source: |
            import { readFile } from "node:fs/promises";

            const form = new FormData();
            form.append("model", "wan3.0");
            form.append(
              "prompt",
              "Move smoothly from the opening frame to the ending frame.",
            );
            form.append("seconds", "5");
            form.append("size", "1280x720");
            form.append(
              "first_frame",
              new Blob([await readFile("first-frame.png")], {
                type: "image/png",
              }),
              "first-frame.png",
            );
            form.append(
              "last_frame",
              new Blob([await readFile("last-frame.jpg")], {
                type: "image/jpeg",
              }),
              "last-frame.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());
components:
  schemas:
    WanCreateRequest:
      type: object
      required:
        - model
        - prompt
      properties:
        model:
          type: string
          description: >-
            Wan model ID: wan2.6, wan2.7, wan3.0, or wan3.0-prime. Use wan2.6
            for text or reference-video input. Use wan2.7 for text, image/video
            references, or frame inputs. Use wan3.0 or wan3.0-prime to also
            include reference audio.
          example: wan3.0
        prompt:
          type: string
          description: >-
            Text prompt that describes the video to generate. Describe the
            appearance and motion to preserve from references, or the transition
            between first_frame and last_frame. For wan2.6 video references, use
            @Video1, @Video2, and @Video3 in input order.
          example: >-
            A small robot walks through a bright greenhouse with smooth camera
            movement.
        seconds:
          type: integer
          minimum: 2
          maximum: 30
          description: >-
            Requested output duration in whole seconds. Send an explicit
            integer. For wan2.6 reference-to-video, use 5 or 10; text-to-video
            also accepts 15. For wan2.7 reference-to-video, use 2 through 10;
            text and frame inputs accept 2 through 15. For wan3.0 and
            wan3.0-prime, use 2 through 30. Default is 5.
          example: 5
        size:
          type: string
          description: >-
            Supported WxH size values. For wan3.0 and wan3.0-prime: 832x480,
            480x832, 624x624, 640x480, 480x640, 1280x720, 720x1280, 960x960,
            1088x832, 832x1088, 1920x1080, 1080x1920, 1440x1440, 1632x1248,
            1248x1632. For wan2.6: 1280x720, 720x1280, 1088x832, 832x1088,
            1920x1080, 1080x1920, 1440x1440, 1632x1248, 1248x1632. For wan2.7:
            1280x720, 720x1280, 1920x1080, 1080x1920, 1440x1440. Default is
            1920x1080. For Wan 2.7 frame inputs, the opening image determines
            the aspect ratio; size selects the output resolution tier.
          example: 1920x1080
        input_reference:
          description: >-
            PNG or JPEG reference images for wan2.7, wan3.0, and wan3.0-prime.
            Repeat input_reference with one publicly accessible HTTPS image URL
            or uploaded image file per field. Use all URLs or all files within
            this field. Do not combine URLs into a comma-separated value. A
            single URL or file uses the image-to-video workflow. Each image can
            be up to 20 MB. For wan3.0 and wan3.0-prime, send at most 10
            reference images, whether you use URLs or uploaded files. Image and
            video references can share a request; reference audio requires
            wan3.0 or wan3.0-prime. Submit frame inputs separately. Omit for
            text-to-video and wan2.6 reference-to-video. 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
              items:
                type: string
                format: uri
                pattern: ^https://
                description: One publicly accessible HTTPS reference image URL.
            - title: Image files
              type: array
              minItems: 1
              items:
                type: string
                format: binary
                description: One uploaded reference image file.
        reference_videos:
          type: array
          minItems: 1
          items:
            anyOf:
              - type: string
                format: uri
                pattern: ^https://
              - type: string
                format: binary
          description: >-
            Reference videos for wan2.6, wan2.7, wan3.0, and wan3.0-prime.
            Repeat reference_videos with publicly accessible HTTPS URLs or
            uploaded MP4 files with H.264 video. Use one input type within this
            field: all URLs or all files. For wan2.6, send 1 to 3 clips, each 2
            to 30 seconds and up to 30 MB, with at least 16 fps; omit image,
            audio, and frame fields. For wan2.7, combine video references with
            image references. For wan3.0 and wan3.0-prime, send at most 5 clips
            totaling at most 15 seconds, with at least 16 fps. Video uploads are
            limited to 5 files, each at most 50 MiB (50 x 1024 x 1024 bytes);
            the lower wan2.6 limits still apply. Submit frame inputs separately.
        reference_audios:
          type: array
          minItems: 1
          items:
            anyOf:
              - type: string
                format: uri
                pattern: ^https://
              - type: string
                format: binary
          description: >-
            Reference audio for wan3.0 and wan3.0-prime, combined with image or
            video references. Repeat reference_audios with publicly accessible
            HTTPS MP3 URLs or uploaded MP3 files. Use one input type within this
            field: all URLs or all files. Send at most 5 audio references
            totaling at most 15 seconds, counted separately from reference video
            duration. Audio uploads are limited to 5 files, each at most 15 MiB
            (15 x 1024 x 1024 bytes). Submit frame inputs separately. Omit for
            wan2.6 and wan2.7.
        first_frame:
          anyOf:
            - type: string
              format: uri
              pattern: ^https://
            - type: string
              format: binary
          description: >-
            Opening frame for wan2.7, wan3.0, and wan3.0-prime, as one publicly
            accessible HTTPS PNG or JPEG URL or one uploaded PNG or JPEG file.
            Use first_frame alone or add last_frame to guide the ending. Submit
            frame inputs in a separate request from input_reference,
            reference_videos, and reference_audios. Omit for wan2.6. For Wan 2.7
            frame inputs, the opening image determines the aspect ratio; size
            selects the output resolution tier.
        last_frame:
          anyOf:
            - type: string
              format: uri
              pattern: ^https://
            - type: string
              format: binary
          description: >-
            Ending frame for wan2.7, wan3.0, and wan3.0-prime, as one publicly
            accessible HTTPS PNG or JPEG URL or one uploaded PNG or JPEG file.
            Use with first_frame to guide the ending. Submit frame inputs in a
            separate request from input_reference, reference_videos, and
            reference_audios. Omit for wan2.6. For Wan 2.7 frame inputs, the
            opening image determines the aspect ratio; size selects the output
            resolution tier.
      additionalProperties: false
    WanVideoTask:
      type: object
      required:
        - id
        - object
        - model
        - status
        - progress
        - created_at
      properties:
        id:
          type: string
          description: Task ID. Use this value with retrieve and content endpoints.
          example: task_example
        task_id:
          type: string
          description: Compatibility alias for id when present.
          example: task_example
        object:
          type: string
          description: Object type. Video tasks return video.
          example: video
        model:
          type: string
          description: Model ID used for the task.
          example: wan3.0
        status:
          type: string
          description: >-
            Task lifecycle status. Poll until the value is completed, failed, or
            error.
          enum:
            - queued
            - in_progress
            - completed
            - failed
            - error
          example: queued
        progress:
          type: integer
          minimum: 0
          maximum: 100
          description: Task progress as a coarse percentage.
          example: 0
        created_at:
          type: integer
          description: Task creation time as a Unix timestamp in seconds.
          example: 1779938152
        completed_at:
          type: integer
          description: >-
            Task completion time as a Unix timestamp in seconds. This field
            appears on completed tasks.
          example: 1779938219
        video_url:
          type: string
          description: Temporary video delivery URL. This field appears on completed tasks.
          example: <temporary-video-url>
        error:
          type: object
          description: Failure details. This field appears when the task fails.
          additionalProperties: true
      additionalProperties: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer authentication. Use your CometAPI API key.

````