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

# Create a Flux 3 video

> Create a Flux 3 text-to-video or image-to-video task through CometAPI with a 720p or 1080p size preset.

Use this endpoint to create a Flux 3 video task. The API returns a task ID, so store the returned `id` for status and content requests.

`POST /v1/videos` uses `multipart/form-data`. Send scalar controls as form fields. Send one reference image as an HTTPS URL or an uploaded file.

Choose only one image input method. Do not send `images` and `input_reference` in the same request.

## Choose an input mode

| Goal                    | Required fields                                      | Optional fields   |
| ----------------------- | ---------------------------------------------------- | ----------------- |
| Text-to-video           | `model=flux-3`, `prompt`                             | `seconds`, `size` |
| HTTPS image-to-video    | `model=flux-3`, `prompt`, one `images` field         | `seconds`, `size` |
| Uploaded image-to-video | `model=flux-3`, `prompt`, one `input_reference` file | `seconds`, `size` |

## Use a reference image

For an HTTPS reference image, send one publicly accessible image URL in the `images` multipart field.

For an uploaded reference image, send one PNG or JPEG file in the `input_reference` multipart field. The file can be up to 20 MB.

Describe the motion, camera behavior, and visual details that the generated video should preserve from the reference image.

## Set duration and size

Set `seconds` to an integer from `5` through `20`. The default is `10` seconds.

Set `size` to one of these exact `WxH` preset values:

| Resolution tier | Size        |
| --------------- | ----------- |
| `720p`          | `1280x720`  |
| `1080p`         | `1920x1080` |

The size value selects the output resolution tier. Encoded text-to-video dimensions can be codec-aligned rather than literal. For image-to-video, the reference image can also determine the final framing and aspect ratio.

## Task flow

<Steps>
  <Step title="Create the task">
    Send the multipart form request and store the returned `id`.
  </Step>

  <Step title="Poll the task">
    Call [Retrieve a Flux 3 video](./retrieve) until `status` is `completed` or `failed`.
  </Step>

  <Step title="Download the result">
    When the task is `completed`, call [Download Flux 3 video content](./retrieve-content) to save the MP4 file.
  </Step>
</Steps>


## OpenAPI

````yaml api/openapi/video/flux-3/post-create.openapi.json POST /v1/videos
openapi: 3.1.0
info:
  title: Flux 3 Video Create API
  version: 1.0.0
  description: >-
    Create a Flux 3 text-to-video or image-to-video task with multipart form
    data.
servers:
  - url: https://api.cometapi.com
security:
  - bearerAuth: []
paths:
  /v1/videos:
    post:
      summary: Create a Flux 3 video task
      description: >-
        Create a Flux 3 video from a text prompt or from a text prompt and one
        reference image.
      operationId: flux_3_create_video
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Flux3CreateRequest'
            encoding:
              images:
                style: form
                explode: true
              input_reference:
                contentType: image/png, image/jpeg
            examples:
              text_to_video:
                summary: Text-to-video
                value:
                  model: flux-3
                  prompt: >-
                    A paper boat glides across a still pond while the camera
                    moves forward.
                  seconds: 5
                  size: 1280x720
              https_image_to_video:
                summary: Image-to-video with an HTTPS image
                value:
                  model: flux-3
                  prompt: >-
                    Animate the reference scene with a slow camera move and
                    natural motion.
                  seconds: 5
                  size: 1280x720
                  images:
                    - >-
                      https://apidoc.cometapi.com/images/image/gemini/6100640_569429.png
              uploaded_image_to_video:
                summary: Image-to-video with an uploaded image
                value:
                  model: flux-3
                  prompt: >-
                    Animate the uploaded scene with a slow camera move and
                    natural motion.
                  seconds: 5
                  size: 1280x720
                  input_reference: '@/path/to/reference.png'
      responses:
        '200':
          description: >-
            Task created. Store the returned id and poll GET
            /v1/videos/{task_id}.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Flux3VideoTask'
              example:
                id: <task_id>
                task_id: <task_id>
                object: video
                model: flux-3
                status: queued
                progress: 0
                created_at: 1779938152
        '400':
          description: >-
            The request is missing a required field or contains an unsupported
            value.
        '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" \
              --form-string 'model=flux-3' \
              --form-string 'prompt=A paper boat glides across a still pond while the camera moves forward.' \
              --form-string 'seconds=5' \
              --form-string 'size=1280x720'
        - lang: Python
          label: Text-to-video
          source: |
            import os

            import requests

            fields = [
                ("model", (None, "flux-3")),
                (
                    "prompt",
                    (
                        None,
                        "A paper boat glides across a still pond while the "
                        "camera moves forward.",
                    ),
                ),
                ("seconds", (None, "5")),
                ("size", (None, "1280x720")),
            ]

            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", "flux-3");
            form.append(
              "prompt",
              "A paper boat glides across a still pond while the camera moves forward.",
            );
            form.append("seconds", "5");
            form.append("size", "1280x720");

            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 image-to-video
          source: |-
            curl https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              --form-string 'model=flux-3' \
              --form-string 'prompt=Animate the reference scene with a slow camera move and natural motion.' \
              --form-string 'seconds=5' \
              --form-string 'size=1280x720' \
              --form-string 'images=https://apidoc.cometapi.com/images/image/gemini/6100640_569429.png'
        - lang: Python
          label: HTTPS image-to-video
          source: |
            import os

            import requests

            fields = [
                ("model", (None, "flux-3")),
                (
                    "prompt",
                    (
                        None,
                        "Animate the reference scene with a slow camera move and "
                        "natural motion.",
                    ),
                ),
                ("seconds", (None, "5")),
                ("size", (None, "1280x720")),
                (
                    "images",
                    (None, "https://apidoc.cometapi.com/images/image/gemini/6100640_569429.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 image-to-video
          source: >
            const form = new FormData();

            form.append("model", "flux-3");

            form.append(
              "prompt",
              "Animate the reference scene with a slow camera move and natural motion.",
            );

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

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

            form.append("images",
            "https://apidoc.cometapi.com/images/image/gemini/6100640_569429.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 image-to-video
          source: |-
            curl https://api.cometapi.com/v1/videos \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              --form-string 'model=flux-3' \
              --form-string 'prompt=Animate the uploaded scene with a slow camera move and natural motion.' \
              --form-string 'seconds=5' \
              --form-string 'size=1280x720' \
              --form 'input_reference=@/path/to/reference.png;type=image/png'
        - lang: Python
          label: Uploaded image-to-video
          source: |
            import os

            import requests

            prompt = (
                "Animate the uploaded scene with a slow camera move and "
                "natural motion."
            )

            with open("/path/to/reference.png", "rb") as reference:
                response = requests.post(
                    "https://api.cometapi.com/v1/videos",
                    headers={
                        "Authorization": "Bearer "
                        + os.environ["COMETAPI_KEY"]
                    },
                    data={
                        "model": "flux-3",
                        "prompt": prompt,
                        "seconds": "5",
                        "size": "1280x720",
                    },
                    files={
                        "input_reference": (
                            "reference.png",
                            reference,
                            "image/png",
                        )
                    },
                    timeout=120,
                )

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

            const reference = await readFile("/path/to/reference.png");
            const form = new FormData();
            form.append("model", "flux-3");
            form.append(
              "prompt",
              "Animate the uploaded scene with a slow camera move and natural motion.",
            );
            form.append("seconds", "5");
            form.append("size", "1280x720");
            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,
            });

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

            console.log(await response.json());
components:
  schemas:
    Flux3CreateRequest:
      type: object
      description: >-
        Flux 3 multipart request. Use one input mode; do not send images and
        input_reference together.
      required:
        - model
        - prompt
      not:
        required:
          - images
          - input_reference
      properties:
        model:
          type: string
          const: flux-3
          default: flux-3
          description: Model ID for this route. Use flux-3.
        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 while the camera moves
            forward.
        seconds:
          type: integer
          minimum: 5
          maximum: 20
          default: 10
          description: >-
            Requested clip duration in whole seconds. Use an integer from 5
            through 20. The default is 10.
        size:
          type: string
          enum:
            - 1280x720
            - 1920x1080
          default: 1280x720
          description: >-
            Resolution preset in exact WxH form. Use 1280x720 for the 720p tier
            or 1920x1080 for the 1080p tier. Encoded dimensions can be
            codec-aligned; image-to-video framing can follow the reference
            image.
        images:
          type: array
          minItems: 1
          maxItems: 1
          items:
            type: string
            format: uri
            pattern: ^https://
            example: https://apidoc.cometapi.com/images/image/gemini/6100640_569429.png
          description: >-
            One publicly accessible HTTPS reference image URL. Send one images
            multipart field for HTTPS image-to-video.
        input_reference:
          type: string
          format: binary
          description: >-
            One PNG or JPEG reference image file for image-to-video. The file
            can be up to 20 MB.
      additionalProperties: false
    Flux3VideoTask:
      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
          const: flux-3
          description: Model ID that the task uses.
        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: >-
            Task completion time as a Unix timestamp in seconds when the task
            provides one.
        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://media.example.com/flux-3-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.

````