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

# 5. Video Generation

> Generate videos from prompts and optional media references.

Video Generation creates video clips from text prompts and optional references. Use it when you want generated footage or reference-guided video changes from the canvas.

## How It Works

Describe the shot, subject, style, camera motion, and desired duration. Mosaic sends the prompt and selected compatible references to the generation model, then returns a video asset that can feed downstream tiles.

Use Video Generation for:

* Product shots and cinematic b-roll
* Social clips from a creative prompt
* Reference-guided motion from uploaded images or clips
* Sound-enabled generated scenes

Seedance 2 supports selected image, video, and audio references. Gemini Omni Flash supports prompt-only generation, selected image references, or one selected video reference. For Gemini Omni Flash, use either selected images or one selected video, not both. Selected video input uses the first 10 seconds and does not include audio.

## API Usage

Create an agent shell:

```bash theme={null}
curl -X POST "https://api.mosaic.so/agent/create" \
  -H "Authorization: Bearer mk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Seedance product shot",
    "visibility": "private"
  }'
```

Add a Video Generation node:

```bash theme={null}
curl -X POST "https://api.mosaic.so/agent/AGENT_ID/update" \
  -H "Authorization: Bearer mk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "operations": [
      {
        "op": "create_node",
        "node_type_id": "a2eb3ec2-da7a-4f97-94d2-a9a537548522",
        "params_used": {
          "prompt": "A cinematic handheld shot of a matte black water bottle on a mountain trail at sunrise",
          "model": "seedance-2",
          "resolution": "1080p",
          "duration": "8",
          "aspect_ratio": "9:16",
          "generate_audio": true
        }
      }
    ]
  }'
```

Then run the agent:

```bash theme={null}
curl -X POST "https://api.mosaic.so/agent/AGENT_ID/run" \
  -H "Authorization: Bearer mk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "callback_url": "https://your-webhook.com/mosaic"
  }'
```

## API Info

<AccordionGroup>
  <Accordion title="Node Params & API Details" icon="code">
    * **Node ID:** `a2eb3ec2-da7a-4f97-94d2-a9a537548522`

    ### Node params

    | Param              | Type                                                                                                                       | Required | Default                                                 | Notes                                                                                                                                                                                    |
    | ------------------ | -------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | `prompt`           | `string`                                                                                                                   | Yes      | `""`                                                    | Generation prompt.                                                                                                                                                                       |
    | `model`            | `"seedance-2" \| "gemini-omni-flash"`                                                                                      | No       | `"seedance-2"`                                          | Video model.                                                                                                                                                                             |
    | `resolution`       | `"1080p" \| "4k"`                                                                                                          | No       | `"1080p"`                                               | Seedance 2 output resolution. 4K is billed at 2x normal Seedance. Gemini Omni Flash outputs 720p.                                                                                        |
    | `duration`         | `"auto" \| "4" ... "15"` for Seedance 2; `"3" ... "10"` for Gemini Omni Flash                                              | No       | `"auto"` for Seedance 2; `"8"` for Gemini Omni Flash    | Duration in seconds. Gemini Omni Flash ignores this when a video reference is selected because the selected video supplies the timing.                                                   |
    | `aspect_ratio`     | `"auto" \| "21:9" \| "16:9" \| "4:3" \| "1:1" \| "3:4" \| "9:16"` for Seedance 2; `"16:9" \| "9:16"` for Gemini Omni Flash | No       | `"auto"` for Seedance 2; `"16:9"` for Gemini Omni Flash | Output aspect ratio. Gemini Omni Flash ignores this when a video reference is selected because the selected video supplies the aspect ratio.                                             |
    | `generate_audio`   | `boolean`                                                                                                                  | No       | `true`                                                  | Seedance 2 only. Generate synchronized audio when supported.                                                                                                                             |
    | `selected_context` | `{images:string[],videos:string[],audio:string[]}`                                                                         | No       | empty lists                                             | Selected upstream references. Seedance 2 supports image, video, and audio references. Gemini Omni Flash supports up to 10 selected images or one selected video; audio is not supported. |

    ### Example

    ```json theme={null}
    {
      "prompt": "A cinematic macro shot of coffee pouring into a glass mug",
      "model": "seedance-2",
      "resolution": "1080p",
      "duration": "8",
      "aspect_ratio": "16:9",
      "generate_audio": true
    }
    ```

    For 4K output, use:

    ```json theme={null}
    {
      "prompt": "A cinematic macro shot of coffee pouring into a glass mug",
      "model": "seedance-2",
      "resolution": "4k",
      "duration": "8",
      "aspect_ratio": "16:9",
      "generate_audio": true
    }
    ```

    4K Seedance generations are billed at 2x normal Seedance.

    For Gemini Omni Flash with image references, use selected images and set duration/aspect ratio:

    ```json theme={null}
    {
      "prompt": "Animate the selected product image into a slow cinematic turntable shot",
      "model": "gemini-omni-flash",
      "duration": "8",
      "aspect_ratio": "16:9",
      "selected_context": {
        "images": ["upstream-image-context-key"]
      }
    }
    ```

    For Gemini Omni Flash with video reference, select one upstream video. The selected video input uses the first 10 seconds; duration and aspect ratio come from that video.

    ```json theme={null}
    {
      "prompt": "Change the background to a bright studio while keeping the subject motion",
      "model": "gemini-omni-flash",
      "selected_context": {
        "videos": ["upstream-video-context-key"]
      }
    }
    ```
  </Accordion>
</AccordionGroup>
