> ## 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 Flash 動画生成

>  - Google 公式 Gemini Omni Flash オールインワンマルチモーダル動画生成モデル
- テキストから動画、画像から動画、動画から動画（編集）をサポートし、テキスト + 画像 + 動画の混合入力が可能
- 720p / 24fps、3～10 秒、音声付きの出力。対話型のマルチターン編集に対応
- 非同期タスク API。送信後、タスク ID で生成結果を照会します 

<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-flash-preview",
      "prompt": "a red apple on a wooden table, short cinematic clip",
      "aspect_ratio": "16:9"
    }'
  ```

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

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

  payload = {
      "model": "gemini-omni-flash-preview",
      "prompt": "a red apple on a wooden table, short cinematic clip",
      "aspect_ratio": "16:9"
  }

  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-flash-preview",
    prompt: "a red apple on a wooden table, short cinematic clip",
    aspect_ratio: "16:9"
  };

  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-flash-preview",
          "prompt":       "a red apple on a wooden table, short cinematic clip",
          "aspect_ratio": "16:9",
      }

      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": "リクエストパラメータが無効です",
      "type": "invalid_request_error"
    }
  }
  ```

  ```json 401 theme={null}
  {
    "error": {
      "code": 401,
      "message": "認証に失敗しました。API キーを確認してください",
      "type": "authentication_error"
    }
  }
  ```

  ```json 402 theme={null}
  {
    "error": {
      "code": 402,
      "message": "アカウント残高が不足しています。チャージしてから再試行してください",
      "type": "payment_required"
    }
  }
  ```

  ```json 429 theme={null}
  {
    "error": {
      "code": 429,
      "message": "リクエストが多すぎます。しばらくしてから再試行してください",
      "type": "rate_limit_error"
    }
  }
  ```
</ResponseExample>

## 認証

<ParamField header="Authorization" type="string" required>
  すべてのリクエストで Bearer Token 認証が必要です。

  API Key の取得：

  [API Key 管理ページ](https://apimart.ai/keys) にアクセスして API Key を取得してください。

  リクエスト時に次のヘッダーを追加します：

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

## リクエストパラメータ

<ParamField body="model" type="string" required>
  動画生成モデル名。固定値は `gemini-omni-flash-preview` です。
</ParamField>

<ParamField body="prompt" type="string" required>
  テキスト指示。テキストから動画の場合はシーンの説明、画像 / 動画から動画の場合は動作 / スタイル / 編集の指示です。

  <Note>
    `prompt` と参照素材（`image_urls` / `video_urls`）は **少なくともいずれか一方** を指定してください。
  </Note>
</ParamField>

<ParamField body="image_urls" type="array<string>">
  参照画像。最大 **16 枚**。各項目は `http(s)://` URL です。

  JPEG / PNG に対応しています。複数の被写体（例：「猫 + 毛糸玉」）の場合は複数枚を指定し、それらがどのように相互作用するかを `prompt` で記述できます。
</ParamField>

<ParamField body="video_urls" type="array<string>">
  参照 / 編集対象の動画。**最大 1 本**（複数動画の参照には非対応）。`http(s)://` の直リンク、または `data:video/...`を指定できます。

  <Warning>
    参照動画は 1 ～ 24 秒。公式では **3 秒以下** を推奨しています。
  </Warning>
</ParamField>

<ParamField body="aspect_ratio" type="string" default="16:9">
  動画のアスペクト比。出力画面の向きを実際に制御します。

  対応値：

  * `16:9` - 横向き（デフォルト）
  * `9:16` - 縦向き

  その他の値は `16:9` として扱われます。
</ParamField>

<ParamField body="resolution" type="string" default="720p">
  動画解像度。現在は `720p` のみ対応しています。
</ParamField>

<ParamField body="extend_from_task_id" type="string">
  直前のタスク ID：前回の生成タスクの \*\* `task_id`\*\* を指定します。
</ParamField>

## レスポンス

<ResponseField name="code" type="integer">
  レスポンスステータスコード。成功時は `200` です。
</ResponseField>

<ResponseField name="data" type="array">
  タスク配列を返します。

  <Expandable title="配列要素">
    <ResponseField name="status" type="string">
      タスクの初期ステータス。送信成功時は `submitted` です。
    </ResponseField>

    <ResponseField name="task_id" type="string">
      タスクの一意識別子。タスクステータスと結果の照会に使用します。
    </ResponseField>
  </Expandable>
</ResponseField>

## タスク結果の照会

動画生成は非同期タスクです。送信後に `task_id` が返されます。[タスクステータス取得](/ja/api-reference/tasks/status) API を使用して生成の進捗と結果を照会します。

### 成功結果の例

```json theme={null}
{
  "code": 200,
  "data": {
    "id": "task_01KS1H7ZYSJWH1N779S2FSHTKA",
    "status": "completed",
    "progress": 100,
    "created": 1779246294,
    "completed": 1779246334,
    "actual_time": 40,
    "estimated_time": 60,
    "cost": 1.0,
    "credits_cost": 10,
    "result": {
      "videos": [
        {
          "url": ["https://cdn.example.com/gemini_omni_xxx.mp4"],
          "expires_at": 1779332760
        }
      ]
    }
  }
}
```

## ユースケース

### シナリオ 1：テキストから動画

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

### シナリオ 2：画像から動画

```json theme={null}
{
  "model": "gemini-omni-flash-preview",
  "prompt": "turn this drawing into realistic footage, use it only as a motion guide",
  "image_urls": ["https://example.com/sketch.jpg"]
}
```

### シナリオ 3：動画から動画

```json theme={null}
{
  "model": "gemini-omni-flash-preview",
  "prompt": "when the person touches the mirror, make it ripple like liquid",
  "video_urls": ["https://example.com/clip.mp4"]
}
```
