> ## 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.2-flash-ext 動画生成

>  - gemini-omni-1.2-flash-ext 統合動画生成モデル
- テキストから動画、先頭フレームからの動画生成、先頭・末尾フレームからの動画生成、複数画像参照、動画の編集と延長に対応
- 360p/720p/1080p/4k 解像度、3〜15 秒の長さに対応し、秒単位で課金
- 非同期タスク API。送信後、タスク ID で生成結果を照会します 

```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.2-flash-ext",
    "prompt": "Aerial shot over a misty mountain lake at sunrise.",
    "duration": 10,
    "resolution": "1080p",
    "aspect_ratio": "9:16"
  }'
```

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

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

payload = {
    "model": "gemini-omni-1.2-flash-ext",
    "prompt": "Aerial shot over a misty mountain lake at sunrise.",
    "duration": 10,
    "resolution": "1080p",
    "aspect_ratio": "9:16"
}

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.2-flash-ext",
  prompt: "Aerial shot over a misty mountain lake at sunrise.",
  duration: 10,
  resolution: "1080p",
  aspect_ratio: "9:16"
};

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.2-flash-ext",
        "prompt":       "Aerial shot over a misty mountain lake at sunrise.",
        "duration":     10,
        "resolution":   "1080p",
        "aspect_ratio": "9:16",
    }

    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))
}
```

```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"
  }
}
```

## 認証

**Authorization** `string` *required*

すべてのリクエストで Bearer Token 認証が必要です。

API Key の取得：

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

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

```
Authorization: Bearer YOUR_API_KEY
```

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

**model** `string` *required*

動画生成モデル名。`gemini-omni-1.2-flash-ext` 固定です。

**prompt** `string` *required*

動画の内容説明または編集指示。前後の空白を除いて空にすることはできません。テキストから動画ではシーン、人物、動作、カメラ、音声を記述し、画像や動画を指定する場合は動き、スタイル、変更内容を記述します。

例：`"Aerial shot over a misty mountain lake at sunrise."`

> [!WARNING]
>
> 先頭フレーム、複数画像参照、編集、延長を含むすべてのモードで `prompt` は必須です。省略すると 400 エラーが返されます。

**duration** `integer` (default: 10)

動画の長さ（秒）。整数で指定します。

* テキストから動画 / 先頭フレーム / 複数画像参照：出力の長さ、`3`–`15`
* 先頭・末尾フレーム：出力の長さ、`3`–`10`
* 延長（`extend`）：**追加部分**の長さ、`3`–`10`
* 編集（`edit`）：指定不可。出力の長さは元動画に従います

別名 `seconds` も使用できます。両方を指定する場合は同じ値にしてください。

> [!WARNING]
>
> 編集モードで `duration` を指定すると `video edit does not accept duration` エラーが返されます。

**resolution** `string` (default: 720p)

動画の解像度。大文字・小文字は区別せず、秒単価を決定します。

指定可能な値：

* `360p`
* `720p`
* `1080p`
* `4k`（`2160p` も可）

> [!WARNING]
>
> それ以外の解像度を指定すると 400 エラーが返されます。

**aspect\_ratio** `string` (default: 16:9)

`16:9`（横長、デフォルト）と `9:16`（縦長）のみ対応しています。その他の値は 400 エラーが返されます。

**omni\_reference\_task\_type** `string`

タスクタイプ。素材の使い方を指定します。

指定可能な値：

* `edit` - 動画を編集します。`video_urls` または `extend_from_task_id` と併用します
* `extend` - 動画の末尾に新しい内容を追加して延長します。`video_urls` または `extend_from_task_id` と併用します
* `reference` - 複数画像参照。`image_urls` と併用します
* `text_to_video` / `image_to_video` / `reference_to_video` - テキストから動画 / 先頭フレーム / 参照画像
* `auto` - 入力から自動判定します。動画を指定した場合は `edit` として扱われます

動画を指定しない場合は省略でき、入力から自動判定されます。

> [!WARNING]
>
> `video_urls` または `extend_from_task_id` を指定する場合、タスクタイプ（`omni_reference_task_type`、または互換フィールド `generation_type`）が必須です。省略すると 400 エラーが返されます。`edit` または `extend` を明示的に指定することを推奨します。`auto` は `edit` として扱われます。

**generation\_type** `string`

互換フィールドで、`omni_reference_task_type` と同等です。指定可能な値：`frame`（`image_to_video` と同じ）、`reference`、`edit`、`extend`。

> [!WARNING]
>
> `generation_type` と `omni_reference_task_type` を同時に指定することはできません。

**image\_urls** `array\<url\>`

複数画像参照（人物、商品、スタイルなど）用の参照画像配列。1〜10 枚に対応します。

公開アクセス可能な HTTP/HTTPS 画像 URL のみ対応します。ローカル画像は先にアップロードして公開 URL を取得してから指定してください。現在 Base64 Data URL には対応しておらず、指定すると 400 エラーが返されます。

画像が 1 枚だけの場合、扱いはタスクタイプによって異なります：

* `omni_reference_task_type` を省略：参照画像として扱います
* `omni_reference_task_type` が `auto` または `image_to_video`：先頭フレームとして扱います

先頭フレームから生成する場合は、画像の枚数に頼らず `first_frame_image` を直接使用することを推奨します。

> [!WARNING]
>
> `image_urls` は `first_frame_image` または `last_frame_image` と同時に指定できず、`image_urls` 内の画像が先頭フレームとして扱われることはありません。また、編集・延長時は画像を指定できません。

**first\_frame\_image** `string`

先頭フレーム画像。生成される動画の最初のフレームがこの画像になります。公開アクセス可能な HTTP/HTTPS 画像 URL のみ対応し、Base64 Data URL には対応していません。

`last_frame_image` と同時に指定すると、先頭・末尾フレームからの動画生成になります。

**last\_frame\_image** `string`

末尾フレーム画像。先頭・末尾フレームからの動画生成に使用し、動画は先頭フレームからこの画像へと遷移します。公開アクセス可能な HTTP/HTTPS 画像 URL のみ対応し、Base64 Data URL には対応していません。

先頭・末尾フレームモードでは：

* `duration` は `3`–`10` に対応し、省略時は 10 秒
* `system_prompt` と `negative_prompt` は指定できません

> [!WARNING]
>
> `last_frame_image` は `first_frame_image` と同時に指定する必要があります。末尾フレームのみを指定すると `last_frame_image requires first_frame_image` エラーが返されます。`image_urls` とは同時に指定できません。

**image\_with\_roles** `array\<object\>`

ロール付きの画像配列で、`first_frame_image` / `last_frame_image` / `image_urls` と同等の書き方です。

**配列要素**

**url** `string` *required*

公開アクセス可能な HTTP/HTTPS 画像 URL。Base64 Data URL には対応していません。

**role** `string`

`first_frame` は先頭フレーム、`last_frame` は末尾フレームです（各 1 枚のみ）。その他の値または空の場合は参照画像として扱います。

**video\_urls** `array\<url\>`

編集または延長する動画の配列。動画は 1 本のみ対応します。単一値フィールド `video_url` も使用でき、どちらか一方を指定します。

公開アクセス可能な HTTP/HTTPS 動画 URL のみ対応します。形式は MP4 / MOV / WebM、長さ 15 秒以内、サイズ 64 MB 以内です。

> [!WARNING]
>
> `video_urls` を指定する場合はタスクタイプが必須です。`omni_reference_task_type` に `edit` または `extend` を指定することを推奨します（`auto` は `edit` として扱われます）。省略すると 400 エラーが返されます。動画を 2 本以上指定すると 400 エラーが返されます。

**extend\_from\_task\_id** `string`

本プラットフォームのタスク ID（`task_01…`）。以前に完了した自分の `gemini-omni-1.2-flash-ext` タスクをもとに、動画を再アップロードせずに編集または延長を続けられます。

利用条件：

* タスクが現在のアカウントに属している
* タスクのモデルが `gemini-omni-1.2-flash-ext` である
* タスクのステータスが `completed` である
* 元のタスクを生成したチャネルが引き続き利用可能である（利用できない場合は 503 `source_channel_unavailable` が返されます）
* 元の成果物が 15 秒以内である（編集・延長の両方に適用）。編集モードでは長さを判別できることも必要です

チャネルが利用できない場合や元の成果物の長さを判別できない場合は、元の成果物をダウンロードし、`video_urls` でアップロードしてください。元の成果物が 15 秒を超える場合は、15 秒以内にカットしてからアップロードしてください。

> [!WARNING]
>
> `extend_from_task_id` は `video_urls` と同時に指定できません。また、タスクタイプが必須で、`omni_reference_task_type` に `edit` または `extend` を指定することを推奨します（`auto` は `edit` として扱われます）。

**negative\_prompt** `string`

画面に表示したくない内容。

例：`"people, cars, color"`

> [!WARNING]
>
> 先頭・末尾フレームモードでは `negative_prompt` を指定できません。

**system\_prompt** `string`

システム指示。画面スタイルの固定や文字の表示禁止などに使用します。文字列で指定してください。

例：`"Render as a black-and-white silent film."`

> [!WARNING]
>
> 先頭・末尾フレームモードでは `system_prompt` を指定できません。

## レスポンス

**code** `integer`

レスポンスステータスコード。成功時は `200` です。

**data** `array`

タスク配列を返します。

**配列要素**

**status** `string`

タスクの初期ステータス。送信成功時は `submitted` です。

**task\_id** `string`

タスクの一意識別子。タスクステータスと結果の照会に使用します。

## タスク結果の照会

動画生成は非同期タスクです。送信後に `task_id` が返されるので、[タスクステータスの取得](https://docs.apimart.ai/ja/api-reference/tasks/status.md) API で生成の進捗と結果を照会してください。

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

5〜10 秒ごとにポーリングし、クライアントのタイムアウトは 10 分以上に設定することを推奨します。生成時間の目安（待ち時間を含む）：360p 15 秒で約 46 秒、1080p 15 秒で約 99 秒、4k 15 秒で約 4〜5 分です。生成中は完了まで進捗が長時間 10% のままになることがあります。

### 成功結果の例

```json theme={null}
{
  "code": 200,
  "data": {
    "id": "task_01KS1H7ZYSJWH1N779S2FSHTKA",
    "status": "completed",
    "progress": 100,
    "actual_time": 99,
    "cost": 0.695,
    "result": {
      "videos": [
        {
          "url": ["https://cdn.example.com/videos/abc.mp4"]
        }
      ]
    }
  }
}
```

動画 URL は `data.result.videos[0].url[0]` です。`data.actual_time` はタスクの処理時間（秒）で、動画の長さではありません。出力は MP4（H.264、24fps）で、AAC 音声トラックと SynthID の不可視透かしを含みます。4k ではまれに音声トラックが含まれないことがあります。

### 失敗結果の例

```json theme={null}
{
  "code": 200,
  "data": {
    "id": "task_01KS1H7ZYSJWH1N779S2FSHTKA",
    "status": "failed",
    "progress": 100,
    "cost": 0,
    "error": {
      "code": "task_failed",
      "message": "content_rejected",
      "type": "task_failed"
    }
  }
}
```

タスクが失敗した場合は全額返金されます。

## 料金

秒単位の課金です：料金 = 選択した解像度の秒単価 × 課金秒数。すべてのモードで、リクエストした解像度の料金で課金されます。実際の単価は [料金ページ](https://apimart.ai/pricing) をご確認ください。

| モード | 課金秒数 |
| - | - |
| テキストから動画 / 先頭フレーム / 複数画像参照 | `duration`。省略時は 10 秒 |
| 先頭・末尾フレーム | `duration`（最大 10 秒）。省略時は 10 秒 |
| 編集 | 元動画の長さ（コンテナ誤差 0.15 秒を差し引いて切り上げ、最低 1 秒。例：8.019 秒は 8 秒、8.3 秒は 9 秒） |
| 延長 | 追加秒数 `duration`。省略時は 10 秒。元動画部分は課金されません |

## ユースケース

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

```json theme={null}
{
  "model": "gemini-omni-1.2-flash-ext",
  "prompt": "Aerial shot over a misty mountain lake at sunrise.",
  "duration": 15,
  "resolution": "1080p",
  "aspect_ratio": "9:16"
}
```

### シナリオ 2：先頭フレームから動画

```json theme={null}
{
  "model": "gemini-omni-1.2-flash-ext",
  "prompt": "The camera slowly pushes in.",
  "duration": 6,
  "aspect_ratio": "9:16",
  "first_frame_image": "https://example.com/start.jpg"
}
```

### シナリオ 3：先頭・末尾フレームから動画

```json theme={null}
{
  "model": "gemini-omni-1.2-flash-ext",
  "prompt": "The flower bud slowly opens into full bloom.",
  "duration": 8,
  "aspect_ratio": "16:9",
  "first_frame_image": "https://example.com/bud.jpg",
  "last_frame_image": "https://example.com/bloom.jpg"
}
```

先頭・末尾フレームモードでは `duration` は 3–10 秒に対応し、省略時は 10 秒です。`system_prompt` / `negative_prompt` は指定できません。

### シナリオ 4：複数画像参照

```json theme={null}
{
  "model": "gemini-omni-1.2-flash-ext",
  "prompt": "The cat bats at the ball of yarn.",
  "duration": 8,
  "image_urls": [
    "https://example.com/cat.png",
    "https://example.com/yarn.png"
  ]
}
```

### シナリオ 5：動画編集

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

編集時は `duration` を指定しません。出力の長さは元動画に従います。

### シナリオ 6：動画延長

```json theme={null}
{
  "model": "gemini-omni-1.2-flash-ext",
  "prompt": "Continue the scene: the dancer bows.",
  "video_urls": ["https://example.com/clip.mp4"],
  "omni_reference_task_type": "extend",
  "duration": 4
}
```

### シナリオ 7：既存タスクをもとに延長

```json theme={null}
{
  "model": "gemini-omni-1.2-flash-ext",
  "prompt": "Extend this video: the camera pans across the mountains.",
  "extend_from_task_id": "task_01KS1H7ZYSJWH1N779S2FSHTKA",
  "omni_reference_task_type": "extend",
  "duration": 6
}
```

### シナリオ 8：システム指示とネガティブプロンプト

```json theme={null}
{
  "model": "gemini-omni-1.2-flash-ext",
  "prompt": "A busy city street at noon.",
  "system_prompt": "Render as a black-and-white silent film.",
  "negative_prompt": "people, cars, color",
  "duration": 6
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.