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

# Gemini Omni 1.1 Flash Video Generation

>  - Google's official Gemini Omni 1.1 Flash all-in-one multimodal video generation model
- Supports text-to-video, image-to-video, multi-subject references, first-and-last-frame interpolation, video editing, and extension
- Supports 360p / 720p / 1080p / 4K, 24fps, 3–10 second output with generated audio
- Asynchronous task API; query the generated result by task ID after submission 

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://api.apimart.ai/v1/videos/generations \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "model": "gemini-omni-1.1-flash",
      "prompt": "A marble rolling fast on a chain reaction style track, continuous smooth shot.",
      "aspect_ratio": "16:9",
      "resolution": "1080p"
    }'
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.apimart.ai/v1/videos/generations"

  payload = {
      "model": "gemini-omni-1.1-flash",
      "prompt": "A marble rolling fast on a chain reaction style track, continuous smooth shot.",
      "aspect_ratio": "16:9",
      "resolution": "1080p"
  }

  headers = {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json"
  }

  response = requests.post(url, json=payload, headers=headers)

  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const url = "https://api.apimart.ai/v1/videos/generations";

  const payload = {
    model: "gemini-omni-1.1-flash",
    prompt: "A marble rolling fast on a chain reaction style track, continuous smooth shot.",
    aspect_ratio: "16:9",
    resolution: "1080p"
  };

  const headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
  };

  fetch(url, {
    method: "POST",
    headers: headers,
    body: JSON.stringify(payload)
  })
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error("Error:", error));
  ```

  ```go Go theme={null}
  package main

  import (
      "bytes"
      "encoding/json"
      "fmt"
      "io/ioutil"
      "net/http"
  )

  func main() {
      url := "https://api.apimart.ai/v1/videos/generations"

      payload := map[string]interface{}{
          "model":        "gemini-omni-1.1-flash",
          "prompt":       "A marble rolling fast on a chain reaction style track, continuous smooth shot.",
          "aspect_ratio": "16:9",
          "resolution":   "1080p",
      }

      jsonData, _ := json.Marshal(payload)

      req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
      req.Header.Set("Authorization", "Bearer <token>")
      req.Header.Set("Content-Type", "application/json")

      client := &http.Client{}
      resp, err := client.Do(req)
      if err != nil {
          panic(err)
      }
      defer resp.Body.Close()

      body, _ := ioutil.ReadAll(resp.Body)
      fmt.Println(string(body))
  }
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "code": 200,
    "data": [
      {
        "status": "submitted",
        "task_id": "task_01KS1H7ZYSJWH1N779S2FSHTKA"
      }
    ]
  }
  ```

  ```json 400 theme={null}
  {
    "error": {
      "code": 400,
      "message": "Invalid request parameters",
      "type": "invalid_request_error"
    }
  }
  ```

  ```json 401 theme={null}
  {
    "error": {
      "code": 401,
      "message": "Authentication failed. Check your API key.",
      "type": "authentication_error"
    }
  }
  ```

  ```json 402 theme={null}
  {
    "error": {
      "code": 402,
      "message": "Insufficient account balance. Top up and try again.",
      "type": "payment_required"
    }
  }
  ```

  ```json 429 theme={null}
  {
    "error": {
      "code": 429,
      "message": "Too many requests. Try again later.",
      "type": "rate_limit_error"
    }
  }
  ```
</ResponseExample>

## Authentication

<ParamField header="Authorization" type="string" required>
  All endpoints require authentication with a Bearer token.

  Get an API key:

  Visit the [API Key management page](https://apimart.ai/keys) to get your API key.

  Add it to the request header:

  ```
  Authorization: Bearer YOUR_API_KEY
  ```
</ParamField>

## Request parameters

<ParamField body="model" type="string" required>
  Video generation model name. Must be `gemini-omni-1.1-flash`.
</ParamField>

<ParamField body="prompt" type="string">
  Text instructions. For text-to-video, describe the scene. For image-to-video, video editing, or extension, describe the motion, style, or requested edit.

  <Note>
    Provide at least one of `prompt` or media (`image_urls`, first/last frame images, or `video_urls`).
  </Note>
</ParamField>

<ParamField body="resolution" type="string" default="720p">
  Output video resolution. Values are case-insensitive.

  Available values:

  * `360p`
  * `720p` (default)
  * `1080p`
  * `4k`

  `2160p` is treated as `4k`. The resolution determines the task's deposit tier and primary video output cost.

  <Warning>
    An unsupported resolution returns an `invalid_resolution` error.
  </Warning>
</ParamField>

<ParamField body="aspect_ratio" type="string" default="16:9">
  Video aspect ratio, used to select landscape or portrait output.

  Supported:

  * `16:9` - Landscape (default)
  * `9:16` - Portrait

  Other values are treated as `16:9`.

  <Warning>
    When `video_urls` is provided, the output usually follows the input video's aspect ratio, so `aspect_ratio` may not take effect.
  </Warning>
</ParamField>

<ParamField body="image_urls" type="array<string>">
  Reference image array. Only publicly accessible HTTP/HTTPS URLs are supported.

  * Provide 1 image: used as the video's starting frame by default
  * Provide multiple images: used as multi-subject or style references; describe each image's purpose and relationships in `prompt`

  <Warning>
    `image_urls` and first/last frame images can contain at most 10 images in total.
  </Warning>
</ParamField>

<ParamField body="first_frame_image" type="string">
  First-frame image. Only publicly accessible HTTP/HTTPS URLs are supported.

  * Provided alone: uses the image as the video's starting frame
  * Provided with `last_frame_image`: generates a video that transitions smoothly from the first frame to the last frame
</ParamField>

<ParamField body="last_frame_image" type="string">
  Last-frame image. Only publicly accessible HTTP/HTTPS URLs are supported, and it must be provided with `first_frame_image`.

  <Warning>
    Providing only `last_frame_image` returns an `invalid_frame_images` error. Use the same aspect ratio for both frame images and match it to `aspect_ratio`.
  </Warning>
</ParamField>

<Note>
  For first-frame or first-and-last-frame generation, the following methods have the same effect. **Choose one; do not provide both**:

  * Use `first_frame_image` / `last_frame_image`
  * Use `image_with_roles` with `role` set to `first_frame` / `last_frame`
</Note>

<ParamField body="image_with_roles" type="array<object>">
  Image array with roles. It is an equivalent alternative to `first_frame_image` / `last_frame_image` and can also declare reference images.

  <Expandable title="image_with_roles element">
    <ParamField body="url" type="string" required>
      A publicly accessible image HTTP/HTTPS URL.
    </ParamField>

    <ParamField body="role" type="string" required>
      Image role:

      * `first_frame`: First frame
      * `last_frame`: Last frame; a first frame must also be present
      * `reference`: Reference image; other roles that are not first or last frame are also treated as references
    </ParamField>
  </Expandable>

  Example:

  ```json theme={null}
  [
    {"url": "https://example.com/start.jpg", "role": "first_frame"},
    {"url": "https://example.com/end.jpg", "role": "last_frame"}
  ]
  ```

  <Note>
    If `image_urls` is also provided, it takes precedence for reference images and is not combined with references in `image_with_roles`. All effective images, including first and last frames, are limited to 10 in total.
  </Note>
</ParamField>

<ParamField body="video_urls" type="array<string>">
  Array of videos to edit or extend. Currently, at most one video can be provided, and it must be no longer than 10 seconds.

  Only publicly accessible direct HTTP/HTTPS video URLs are supported. YouTube links are not supported.

  <Warning>
    `video_urls` and `extend_from_task_id` are mutually exclusive. Provide only one.
  </Warning>
</ParamField>

<ParamField body="metadata" type="object">
  Additional parameters used to explicitly specify the generation intent.

  <Expandable title="metadata fields">
    <ParamField body="task" type="string">
      Available task types:

      * `text_to_video`: Text-to-video
      * `image_to_video`: Image-to-video
      * `reference_to_video`: Reference-to-video
      * `edit`: Video editing
      * `extend`: Video extension

      If omitted, the system infers the task from the inputs and prompt.
    </ParamField>
  </Expandable>

  <Note>
    For first-and-last-frame interpolation, the model infers the task automatically and the platform does not pass `metadata.task`.
  </Note>
</ParamField>

<ParamField body="extend_from_task_id" type="string">
  The local `task_id` of the previous generation task. Use it for conversational editing or further extension without re-uploading the previous video.

  The referenced task must belong to the current user, have succeeded, and be a Gemini Omni model task.

  <Warning>
    `extend_from_task_id` and `video_urls` are mutually exclusive. Provide only one.
  </Warning>
</ParamField>

<Warning>
  This model has no `duration` parameter. The model determines each output's duration from the content, typically 3–10 seconds. To control pacing, describe it in `prompt` using natural language or time ranges.
</Warning>

## Response

<ResponseField name="code" type="integer">
  Response status code. `200` indicates success.
</ResponseField>

<ResponseField name="data" type="array">
  Returned task array.

  <Expandable title="Array element">
    <ResponseField name="status" type="string">
      Initial task status. A successful submission returns `submitted`.
    </ResponseField>

    <ResponseField name="task_id" type="string">
      Unique task identifier used to query task status and results.
    </ResponseField>
  </Expandable>
</ResponseField>

## Query task result

Video generation is asynchronous. After submission returns a `task_id`, use [Get task status](/en/api-reference/tasks/status) to query progress and results.

```bash cURL theme={null}
curl --request GET \
  --url https://api.apimart.ai/v1/tasks/task_01KS1H7ZYSJWH1N779S2FSHTKA \
  --header 'Authorization: Bearer <token>'
```

Poll every 5–10 seconds and stop when the status becomes `completed` or `failed`. Set the overall client timeout to 10 minutes.

### Successful result example

```json theme={null}
{
  "code": 200,
  "data": {
    "id": "task_01KS1H7ZYSJWH1N779S2FSHTKA",
    "status": "completed",
    "progress": 100,
    "cost": 1.52,
    "credits_cost": 15.2,
    "result": {
      "videos": [
        {
          "url": ["https://cdn.example.com/gemini_omni_xxx.mp4"],
          "expires_at": 1788518400
        }
      ]
    }
  }
}
```

## Use cases

### Use case 1: Text-to-video (4K)

```json theme={null}
{
  "model": "gemini-omni-1.1-flash",
  "prompt": "a blue butterfly landing on a flower, macro, soft light, no dialogue",
  "aspect_ratio": "9:16",
  "resolution": "4k"
}
```

### Use case 2: First-and-last-frame interpolation

```json theme={null}
{
  "model": "gemini-omni-1.1-flash",
  "prompt": "smooth transition, camera slowly pushes in",
  "first_frame_image": "https://example.com/start.jpg",
  "last_frame_image": "https://example.com/end.jpg",
  "resolution": "720p"
}
```

### Use case 3: Multi-subject references

```json theme={null}
{
  "model": "gemini-omni-1.1-flash",
  "prompt": "the cat playfully bats at the ball of yarn",
  "image_urls": [
    "https://example.com/cat.png",
    "https://example.com/yarn.png"
  ],
  "resolution": "720p"
}
```

### Use case 4: Declare first and last frames with image roles

```json theme={null}
{
  "model": "gemini-omni-1.1-flash",
  "prompt": "a smooth cinematic transition from sunrise to a starry night",
  "image_with_roles": [
    {"url": "https://example.com/sunrise.jpg", "role": "first_frame"},
    {"url": "https://example.com/night.jpg", "role": "last_frame"}
  ],
  "resolution": "1080p"
}
```

### Use case 5: Video editing

```json theme={null}
{
  "model": "gemini-omni-1.1-flash",
  "prompt": "Make the violin invisible. Keep everything else the same.",
  "video_urls": ["https://example.com/clip.mp4"]
}
```

Use short, specific prompts for video editing. To change only one part, add `Keep everything else the same` to preserve consistency elsewhere.

### Use case 6: Conversational extension

```json theme={null}
{
  "model": "gemini-omni-1.1-flash",
  "prompt": "Extend this video: the camera pans across the mountains.",
  "extend_from_task_id": "task_01AAA"
}
```
