> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.beatapi.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.beatapi.io/_mcp/server.

# Gemini Omni 1.1 Flash

POST https://api.beatapi.io/v1/videos/tasks
Content-Type: application/json

テキスト、先頭フレーム、先頭・末尾フレーム、または最大 10 枚の参照画像と 3 本の参照動画から、720p・1080p・4K で 3～10 秒の音声付き動画を生成します。- 非同期：作成リクエストはタスク ID を返し、タスクが成功すると動画を取得できます。
- 1 つのモデル ID で 4 種類の入力に対応します：テキストのみ、先頭フレーム 1 枚、`images` の先頭・末尾フレーム、または最大 10 枚の `reference_images` と任意で最大 3 本の `reference_videos`。フレームと参照は同時に使えません。
- 長さは 3～10 秒、画面比率は `16:9` または `9:16` です。`duration` は秒単位の整数です。
- すべての動画に音声が付きます。音声をオフにするスイッチはなく、参照音声も受け付けません。
- 解像度とリクエストした秒数に応じて課金されます。失敗したタスクは無料です。POST/v1/videos/tasks試してみるこのモデルをテスト画面で開きます。BeatAPI の API キーを入力するとタスクを作成できます。実際に呼び出され、ご自身の残高から課金されます。## エンドポイントと認証`POST https://api.beatapi.io/v1/videos/tasks`Authorization
string
必須BeatAPI の API キーを `Bearer <BEATAPI_API_KEY>` の形式で送信します。キーは[ダッシュボード](https://beatapi.io/dashboard)で作成できます。キーはサーバー側で保管し、ブラウザーやモバイルアプリに含めないでください。ボディは JSON で送信し、`Content-Type: application/json` を指定します。`Idempotency-Key` は任意です。論理的に 1 件のリクエストごとに一意の値（255 文字以内）を送り、まったく同じボディを再試行するときだけ再利用してください。24 時間以内に同じキーと同じボディで再試行すると、最初のレスポンスが `Idempotent-Replayed: true` 付きで再度返されます。同じキーで異なるボディを送ると `409 idempotency_conflict` が返ります。2xx 以外のレスポンスは保存されないため、400 や 402 の後の再試行は改めて実行されます。## リクエストの流れ下記のパラメーターをエンドポイントに `POST` します。`201` が返れば、タスクが受け付けられ、料金が残高から仮確保されたことを意味します。処理はバックグラウンドで実行されます。`data.id` を保存してください。`GET /v1/tasks/{task_id}` を呼び出し、`status` が `succeeded` または `failed` になるまで、呼び出しの間隔を `data.poll_after_seconds`（画像は 5 秒、動画は 8 秒）だけ空けてください。あるいは `task.succeeded` と `task.failed` の[Webhook](/webhooks)を登録することもできます。処理タイムアウトで停止したタスクはイベントを送信しないため、フォールバックとしてポーリングも続けてください。`succeeded` の場合は、すべての `data.output.media[].url` をダウンロードし、必要なファイルを保存してください。結果 URL がいつまで利用できるかは保証されません。`failed` の場合は、`data.error_code` と `data.error_message` を確認してください。仮確保された金額は残高に戻されます。`data.retryable` は、同じリクエストをもう一度送れば成功する可能性があるかどうかを示します。## 入力モード| モード       | 必須の入力                                           | 備考                                                                                     |
| --------- | ----------------------------------------------- | -------------------------------------------------------------------------------------- |
| テキストから動画  | `model`、`prompt`                                | `images`、`reference_images`、`reference_videos` は送らないでください。                             |
| 先頭フレーム    | `model`、`prompt`、`images`（リンク 1 個）              | 動画はこの画像から始まります。                                                                        |
| 先頭・末尾フレーム | `model`、`prompt`、`images`（リンク 2 個）              | 1 個目のリンクが最初の画面、2 個目が最後の画面です。順序は入れ替えられません。                                              |
| 参照画像と参照動画 | `model`、`prompt`、`reference_images`（リンク 1～10 個） | 必要に応じて `reference_videos` を最大 3 本追加できます。参照動画を送るときは参照画像が 1 枚以上必要です。`images` とは同時に使えません。 |## リクエストパラメーターmodel
string
必須実行するモデルです。**値**：`gemini-omni-1.1-flash`**値が正しくない場合**- 指定がない：`"model" is required`
- 画像モデルをこのエンドポイントに送った：`"model" nano-banana-2 is served by POST /v1/images/tasks, not this endpoint`prompt
string
必須動画の内容です。動き、カメラ、場面、入れたいセリフや音を書きます。**長さ**：1–5000 文字- 長さは文字数で数えます（日本語・中国語・韓国語の 1 文字は 1 文字）。
- 参照素材を使う場合は、それぞれから何を使うかをプロンプトに書いてください。例：「1 枚目の参照画像の女性」「参照動画のカメラワーク」。**値が正しくない場合**- 指定がない：`"prompt" is required`
- 空、または上限より長い：`"prompt" has an unsupported length`
- 文字列ではない：`"prompt" must be a string`images
string[]
任意フレームです。リンク 1 個は先頭フレーム、2 個は順に先頭フレームと末尾フレームです。省略可能：テキストから動画を作る場合や参照素材を送る場合は送らないでください。**要素数**：1–2  \
各要素は公開されている `https://` の URL です。ローカルファイルは先に [アップロード](/quick-guide#upload-an-input-file)（`POST /v1/files`）し、返された `data.url` を渡してください。- 各リンクは公開された `https://` URL である必要があります。
- 動画の始まりや終わりではなく、参考にさせたいだけの画像は `reference_images` に入れてください。**値が正しくない場合**- リンクが 3 個以上：`"images" accepts at most 2 items`
- 空の配列：`"images" requires at least 1 item`
- 配列ではない：`"images" must be an array`
- https\:// のリンクではない：`"images[0]" must be a public HTTPS URL`
- `reference_images` または `reference_videos` と同時に送った：`Cannot combine "images" with reference inputs in one task`reference_images
string[]
任意動画に使う人物、商品、スタイル、場面の画像を 1～10 枚指定します。**要素数**：1–10  \
各要素は公開されている `https://` の URL です。ローカルファイルは先に [アップロード](/quick-guide#upload-an-input-file)（`POST /v1/files`）し、返された `data.url` を渡してください。- 各リンクは公開された `https://` URL である必要があります。
- `reference_videos` を送るときは必須です。**値が正しくない場合**- リンクが 11 個以上：`"reference_images" accepts at most 10 items`
- 空の配列：`"reference_images" requires at least 1 item`
- 配列ではない：`"reference_images" must be an array`
- `images` と同時に送った：`Cannot combine "images" with reference inputs in one task`reference_videos
string[]
任意新しい動画が動き、カメラワーク、被写体の参考にする動画を 1～3 本指定します。**要素数**：1–3  \
各要素は公開されている `https://` の URL です。ローカルファイルは先に [アップロード](/quick-guide#upload-an-input-file)（`POST /v1/files`）し、返された `data.url` を渡してください。- 各リンクは MP4、MOV、WebM ファイルを指す公開された `https://` URL である必要があります。
- `reference_images` のリンクが 1 個以上あるときだけ送れます。
- 参照動画は料金に影響しません。課金されるのは新しい動画の秒数です。**値が正しくない場合**- `reference_images` なしで送った：`Gemini Omni 1.1 Flash "reference_videos" need at least one image in "reference_images"`
- リンクが 4 個以上：`"reference_videos" accepts at most 3 items`
- `images` と同時に送った：`Cannot combine "images" with reference inputs in one task`duration
integer
任意デフォルト: 5動画の長さ（秒、整数）です。**デフォルト**：`5`  \
**範囲**：3–10- 省略すると `5` が使われ、その秒数で課金されます。
- 秒数で課金されるため（「料金」を参照）、料金を左右する主な要素です。**値が正しくない場合**- 3～10 の範囲外、整数ではない、または文字列で送った：`"duration" is outside its supported range`aspect_ratio
string
任意デフォルト: 16:9動画の画面比率です。横長の `16:9` または縦長の `9:16` です。**指定できる値**：`16:9`, `9:16`  \
**デフォルト**：`16:9`- 省略すると `16:9` が使われます。
- フレームを送る場合も適用されます。先頭フレームと同じ比率を選んでください。**値が正しくない場合**- リストにない値：`"aspect_ratio" must be one of: [16:9 9:16]`resolution
string
任意デフォルト: 720p出力解像度です。高い解像度ほど 1 秒あたりの料金が上がります。**指定できる値**：`720p`, `1080p`, `4k`  \
**デフォルト**：`720p`- 省略すると `720p` が使われます。
- `4k` と `4K` は同じ区分です。**値が正しくない場合**- リストにない値（例：`480p` や `720P`）：`"resolution" must be one of: [720p 1080p 4k 4K]`ゲートウェイはタスク作成前に、次の組み合わせも確認します。- `images` と参照メディアのフィールドは同時に使用できません。
- `images` はフレームです。1 枚なら先頭フレーム、2 枚なら順に先頭フレームと末尾フレームです。
- `reference_videos` を送るときは、`reference_images` に画像が 1 枚以上必要です。
- 音声のオン・オフを切り替える設定はありません。参照音声には対応していません。## 入力メディアの上限ゲートウェイはタスク作成前にすべての入力を読み取り、次の上限を超えるものは、その入力を示す `400 bad_request` で拒否します。課金はされません。| メディア | タスク作成前に確認される上限  |
| ---- | --------------- |
| 画像   | 1 件あたり 20 MB 以下 |
| 動画   | 1 件あたり 64 MB 以下 |- ゲートウェイはタスクを作成する前に、各リンク先ファイルのサイズを確認します。上限を超えるファイルは、どのファイルかを示す 400 で拒否され、料金はかかりません。例：`images[0] is 25.0 MB; this model takes images up to 20 MB.`
- リンク先のホストが 4xx エラーを返した場合や、ファイルが空の場合も同じように拒否されます：`<field>[<n>] could not be downloaded: <reason>.`
- タスク作成後にモデルがリンクを利用できなかった場合、タスクは失敗し（通常は `bad_request`）、全額返金されます。
- ローカルのファイルは、`POST /v1/files` でアップロードし、返された `data.url` を渡してください。## このモデルが受け付けないフィールド次のフィールドを送ると、無視されるのではなく、課金前に拒否されます。- `reference_audios`、`generate_audio`、`seed`、`quality`、`sound`、`task_type`、`output_format`、`watermark` など他の動画モデルのフィールド → `field "generate_audio" is not supported by model gemini-omni-1.1-flash`（送ったフィールド名が入ります）。音声は毎回生成されるため、切り替えるものはありません。
- 動画エンドポイントがまったく認識しないフィールド → `unknown field: <name>`。## リクエスト例```bash title="cURL"
curl --request POST \
  --url https://api.beatapi.io/v1/videos/tasks \
  --header "Authorization: Bearer $BEATAPI_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "gemini-omni-1.1-flash",
  "prompt": "A dramatic product reveal of a glass water bottle, slow orbiting camera, soft studio reflections",
  "duration": 5,
  "aspect_ratio": "16:9",
  "resolution": "720p"
}'
``````python title="Python"
import os
import requests

response = requests.post(
    "https://api.beatapi.io/v1/videos/tasks",
    headers={"Authorization": f"Bearer {os.environ['BEATAPI_API_KEY']}"},
    json={
      "model": "gemini-omni-1.1-flash",
      "prompt": "A dramatic product reveal of a glass water bottle, slow orbiting camera, soft studio reflections",
      "duration": 5,
      "aspect_ratio": "16:9",
      "resolution": "720p"
    },
    timeout=60,
)
body = response.json()
if not response.ok:
    raise RuntimeError(f"{response.status_code} {body['error']['code']}: {body['error']['message']}")
task = body["data"]
print(task["id"], task["status"])
``````javascript title="JavaScript"
const response = await fetch('https://api.beatapi.io/v1/videos/tasks', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.BEATAPI_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "model": "gemini-omni-1.1-flash",
    "prompt": "A dramatic product reveal of a glass water bottle, slow orbiting camera, soft studio reflections",
    "duration": 5,
    "aspect_ratio": "16:9",
    "resolution": "720p"
  }),
});
const body = await response.json();
if (!response.ok) throw new Error(`${response.status} ${body.error.code}: ${body.error.message}`);
console.log(body.data.id, body.data.status);
```### テキストから動画テキストだけから 5 秒・720p の横長クリップを生成します。```bash
curl --request POST \
  --url https://api.beatapi.io/v1/videos/tasks \
  --header "Authorization: Bearer $BEATAPI_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "gemini-omni-1.1-flash",
  "prompt": "A dramatic product reveal of a glass water bottle, slow orbiting camera, soft studio reflections",
  "duration": 5,
  "aspect_ratio": "16:9",
  "resolution": "720p"
}'
```### 先頭フレーム1 枚の画像から始まる 5 秒・720p のクリップです。```bash
curl --request POST \
  --url https://api.beatapi.io/v1/videos/tasks \
  --header "Authorization: Bearer $BEATAPI_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "gemini-omni-1.1-flash",
  "prompt": "The singer turns toward the camera and smiles, hair moving in the breeze, warm spotlights",
  "images": [
    "https://cdn.beatapi.io/samples/neon-singer.png"
  ],
  "duration": 5,
  "resolution": "720p"
}'
```### 先頭・末尾フレーム1 枚目の画像から 2 枚目の画像へ移る 8 秒・1080p のクリップです。```bash
curl --request POST \
  --url https://api.beatapi.io/v1/videos/tasks \
  --header "Authorization: Bearer $BEATAPI_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "gemini-omni-1.1-flash",
  "prompt": "The camera pulls away from the singer and glides across the stage to the bottle on a table",
  "images": [
    "https://cdn.beatapi.io/samples/neon-singer.png",
    "https://cdn.beatapi.io/samples/smart-bottle.png"
  ],
  "duration": 8,
  "aspect_ratio": "16:9",
  "resolution": "1080p"
}'
```### 参照画像と参照動画 1 本参照画像 2 枚と参照動画 1 本から、8 秒・720p の縦長クリップを生成します。```bash
curl --request POST \
  --url https://api.beatapi.io/v1/videos/tasks \
  --header "Authorization: Bearer $BEATAPI_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "gemini-omni-1.1-flash",
  "prompt": "The singer from the first reference image lifts the bottle from the second toward the camera, following the camera move of the reference video",
  "reference_images": [
    "https://cdn.beatapi.io/samples/neon-singer.png",
    "https://cdn.beatapi.io/samples/smart-bottle.png"
  ],
  "reference_videos": [
    "https://your-cdn.example.com/clips/source.mp4"
  ],
  "duration": 8,
  "aspect_ratio": "9:16",
  "resolution": "720p"
}'
```## レスポンス### タスクの作成（201）タスクオブジェクトです。タスクが成功するまで `output` は `null` です。「実行中」と記載されたフィールドは、タスクの完了後に表示されなくなります。```json
{
  "data": {
    "id": "task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ",
    "object": "task",
    "task_kind": "video",
    "capability_id": "gemini-omni-1.1-flash",
    "capability_version": 1,
    "media_type": "video",
    "model": "gemini-omni-1.1-flash",
    "status": "queued",
    "stage": "queued",
    "created_at": 1791993600,
    "updated_at": 1791993600,
    "completed_at": null,
    "poll_after_seconds": 8,
    "output": null,
    "usage": {
      "credits_reserved": 0.3,
      "credits_settled": 0,
      "credits_refunded": 0,
      "credits_charged": 0.3,
      "billable_duration_seconds": 5
    },
    "request_id": "req_5f0c2a9e4b7d4e31",
    "error_code": null,
    "error_message": null
  }
}
```| フィールド                                  | 型                 | 説明                                                                                            |
| -------------------------------------- | ----------------- | --------------------------------------------------------------------------------------------- |
| `data.id`                              | `string`          | タスク ID です。`task_` の後に英数字 32 文字が続きます。ポーリングや Webhook イベントとの照合に使います。                             |
| `data.object`                          | `string`          | 常に `task` です。                                                                                 |
| `data.task_kind`                       | `string`          | `image` または `video` です。                                                                       |
| `data.capability_id`                   | `string`          | 送信したモデル ID です。                                                                                |
| `data.capability_version`              | `integer`         | モデルの仕様バージョンです。現在は `1` です。                                                                     |
| `data.media_type`                      | `string`          | `image` または `video` です。                                                                       |
| `data.model`                           | `string`          | 送信したモデル ID です（`capability_id` と同じ）。                                                           |
| `data.status`                          | `string`          | `queued`、`processing`、`succeeded`、`failed` のいずれかです。最終状態は後ろの 2 つだけです。                          |
| `data.stage`                           | `string`          | `status` と同じ値です。古いクライアント向けに残されています。                                                           |
| `data.created_at`                      | `integer`         | タスクの作成日時（Unix 秒）です。                                                                           |
| `data.updated_at`                      | `integer`         | 最終更新日時（Unix 秒）です。                                                                             |
| `data.completed_at`                    | `integer \| null` | タスクの完了日時（Unix 秒）です。実行中は `null` です。                                                            |
| `data.poll_after_seconds`              | `integer`         | 実行中のみ。次のポーリングまでに待つ秒数です（画像は 5、動画は 8）。                                                          |
| `data.typical_seconds`                 | `object`          | 実行中のみ、直近のタスクが十分にある場合に含まれます。直近 `window` の `samples` 件のタスクについて、完了までの時間（秒）の `p50` と `p90` を示します。 |
| `data.output`                          | `object \| null`  | 結果です。`status` が `succeeded` になるまでは `null` です。下の出力フィールドを参照してください。                              |
| `data.usage.credits_reserved`          | `number`          | タスク作成時に残高から仮確保された金額（USD）です。                                                                   |
| `data.usage.credits_charged`           | `number`          | このタスクの料金（USD）です。失敗したタスクでは `0` です。                                                             |
| `data.usage.credits_settled`           | `number`          | 最終的に差し引かれた金額（USD）です。タスクが成功した時点で設定され、それ以外では `0` です。                                            |
| `data.usage.credits_refunded`          | `number`          | 残高に戻された金額（USD）です。失敗したタスクでは、返金が記録された時点で仮確保した金額と一致します。                                          |
| `data.usage.billable_duration_seconds` | `integer`         | 動画のみ。料金の算定に使われた秒数です。モデルが長さを報告しない場合は含まれません。                                                    |
| `data.request_id`                      | `string`          | リクエスト ID です。サポートに問い合わせる際に添えてください。                                                             |
| `data.error_code`                      | `string \| null`  | 失敗コードです。タスクが失敗した場合以外は `null` です。                                                              |
| `data.error_message`                   | `string \| null`  | 何が問題で、何を変更すればよいかを示します。タスクが失敗した場合以外は `null` です。                                                |### 完了したタスク`GET /v1/tasks/{task_id}` は HTTP 200 と `status: "succeeded"` を返し、結果は `data.output` に入ります。```json
{
  "data": {
    "id": "task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ",
    "object": "task",
    "task_kind": "video",
    "capability_id": "gemini-omni-1.1-flash",
    "capability_version": 1,
    "media_type": "video",
    "model": "gemini-omni-1.1-flash",
    "status": "succeeded",
    "stage": "succeeded",
    "created_at": 1791993600,
    "updated_at": 1791993690,
    "completed_at": 1791993690,
    "output": {
      "media": [
        {
          "type": "video",
          "url": "https://media.beatapi.io/outputs/task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ/0.mp4",
          "mime_type": "video/mp4"
        }
      ],
      "r2_url": "https://media.beatapi.io/outputs/task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ/0.mp4"
    },
    "usage": {
      "credits_reserved": 0.3,
      "credits_settled": 0.3,
      "credits_refunded": 0,
      "credits_charged": 0.3,
      "billable_duration_seconds": 5
    },
    "request_id": "req_5f0c2a9e4b7d4e31",
    "error_code": null,
    "error_message": null
  }
}
```#### 出力フィールド| フィールド                      | 型          | 説明                                                   |
| -------------------------- | ---------- | ---------------------------------------------------- |
| `output.media`             | `object[]` | 生成されたファイルです。このモデルでは音声付きの動画 1 本です。                    |
| `output.media[].type`      | `string`   | 常に `video` です。                                       |
| `output.media[].url`       | `string`   | 保存された動画への HTTPS リンクです。ダウンロードして保管してください。保存期間は保証されません。 |
| `output.media[].mime_type` | `string`   | `video/mp4` です。                                      |
| `output.r2_url`            | `string`   | 旧クライアント向けの同じ動画 URL です。`media` を読んでください。              |### 失敗したタスク失敗したタスクも、`GET /v1/tasks/{task_id}` では HTTP 200 になります。失敗はボディに示されます。仮確保された金額は全額戻されるため、課金されません。```json
{
  "data": {
    "id": "task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ",
    "object": "task",
    "task_kind": "video",
    "capability_id": "gemini-omni-1.1-flash",
    "capability_version": 1,
    "media_type": "video",
    "model": "gemini-omni-1.1-flash",
    "status": "failed",
    "stage": "failed",
    "created_at": 1791993600,
    "updated_at": 1791993690,
    "completed_at": 1791993690,
    "output": null,
    "usage": {
      "credits_reserved": 0.3,
      "credits_settled": 0,
      "credits_refunded": 0.3,
      "credits_charged": 0,
      "billable_duration_seconds": 5
    },
    "retryable": true,
    "request_id": "req_5f0c2a9e4b7d4e31",
    "error_code": "processing_failed",
    "error_message": "The task failed during processing on our side. Retry; a failed task is refunded."
  }
}
```| フィールド                | 型         | 説明                                                                                                                                                                                                         |
| -------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data.error_code`    | `string`  | `bad_request` と `content_policy_violation`（リクエストを修正してください）、または `processing_unavailable`、`processing_timeout`、`processing_failed`、`result_transfer_failed`（時間をおいて再試行してください）のいずれかです。[エラー](/errors)を参照してください。 |
| `data.error_message` | `string`  | 問題と対処方法を示す文です。                                                                                                                                                                                             |
| `data.retryable`     | `boolean` | 失敗したタスクにのみ含まれます。同じリクエストをもう一度送れば成功する可能性がある場合は `true` です。                                                                                                                                                    |
| `data.usage`         | `object`  | 返金が記録された時点（通常はタスクが失敗した瞬間）で、`credits_charged` と `credits_settled` は `0` になり、`credits_refunded` は `credits_reserved` と一致します。                                                                                 |## 完全なコード例タスクを作成し、サーバーが示すポーリング間隔で完了を待ち、結果の URL を出力します。環境変数に `BEATAPI_API_KEY` を設定し、`requests` をインストールしてください。```python
import os
import time
import uuid

import requests

API = "https://api.beatapi.io"
HEADERS = {"Authorization": f"Bearer {os.environ['BEATAPI_API_KEY']}"}


def create_task(body: dict) -> dict:
    # One Idempotency-Key per logical request: a retry with the same key cannot create a second task.
    headers = {**HEADERS, "Idempotency-Key": str(uuid.uuid4())}
    for attempt in range(3):
        response = requests.post(f"{API}/v1/videos/tasks", headers=headers, json=body, timeout=60)
        if response.status_code in (429, 503) and attempt < 2:
            time.sleep(int(response.headers.get("Retry-After", 10)))
            continue
        break
    try:
        payload = response.json()
    except ValueError:  # an edge error page is not JSON
        response.raise_for_status()
        raise
    if not response.ok:
        error = payload["error"]
        raise RuntimeError(f"{response.status_code} {error['code']}: {error['message']} (request_id={error.get('request_id')})")
    return payload["data"]


def wait_for_task(task_id: str, timeout_seconds: int = 1800) -> dict:
    deadline = time.monotonic() + timeout_seconds
    while time.monotonic() < deadline:
        response = requests.get(f"{API}/v1/tasks/{task_id}", headers=HEADERS, timeout=30)
        if response.status_code == 429 or response.status_code >= 500:
            time.sleep(int(response.headers.get("Retry-After", 10)))
            continue
        response.raise_for_status()
        task = response.json()["data"]
        if task["status"] in ("succeeded", "failed"):
            return task
        time.sleep(task.get("poll_after_seconds", 5))
    raise TimeoutError(f"task {task_id} is still running; keep polling later")


task = create_task({
  "model": "gemini-omni-1.1-flash",
  "prompt": "A dramatic product reveal of a glass water bottle, slow orbiting camera, soft studio reflections",
  "duration": 5,
  "aspect_ratio": "16:9",
  "resolution": "720p"
})
print("created", task["id"])
task = wait_for_task(task["id"])
if task["status"] == "failed":
    raise SystemExit(f"{task['error_code']}: {task['error_message']}")
for item in task["output"]["media"]:
    print(item["url"])
```## 課金- 料金は、解像度とリクエストした秒数（`duration`、省略時は 5）に応じて決まります。1 秒あたりの料金は 720p より 1080p、1080p より 4K が高くなります。入力の種類、`aspect_ratio`、フレームや参照素材の数は料金に影響しません。
- 下の表は 8 秒のクリップの料金です。他の長さは、解像度ごとの同じ単価で 1 秒単位で計算されます。
- 料金はタスク作成時に確保されます。`data.usage.billable_duration_seconds` に計算の基になった秒数が表示されます。
- 失敗したタスク（送信後にモデレーションで拒否されたものを含む）は全額返金されます。現在の定価です。[料金](https://beatapi.io/pricing)ページと同じ金額です。割引を個別に契約しているアカウントでは、より低い金額になります。実際に課金された金額は、タスクの `data.usage` で確認できます。| オプション       | 定価（USD） |
| ----------- | ------- |
| 8 秒 · 720p  | \$0.48  |
| 8 秒 · 1080p | \$0.72  |
| 8 秒 · 4K    | \$1.44  |## よくあるエラー| エラーまたは症状                                                                                     | 原因                                                                                  | 対処                                                                           |
| -------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| 400 `Cannot combine "images" with reference inputs in one task`                              | 1 つのリクエストに、`images` のフレームと `reference_images` または `reference_videos` の参照素材の両方があります。 | フレームを `images` に入れるか、参照素材だけを送るか、どちらか一方にしてください。                               |
| 400 `Gemini Omni 1.1 Flash "reference_videos" need at least one image in "reference_images"` | 参照動画を送りましたが、参照画像がありません。                                                             | `reference_images` にリンクを 1 個以上追加してください。                                      |
| 400 `"images" accepts at most 2 items`                                                       | フレームが 3 枚以上あります。                                                                    | 先頭フレーム、または先頭・末尾フレームだけを送り、他の画像は `reference_images` に入れてください。                  |
| 400 `"reference_images" accepts at most 10 items`                                            | 参照画像が 11 枚以上です。                                                                     | 最大 10 枚にしてください。                                                              |
| 400 `"duration" is outside its supported range`                                              | 3 未満、10 超、小数、または文字列です。                                                              | `8` のように、3～10 の整数を送ってください。                                                   |
| 400 `"resolution" must be one of: [720p 1080p 4k 4K]`                                        | `480p`、または `720P` のような大文字表記です。                                                      | `720p`、`1080p`、`4k` のいずれかを送ってください。                                           |
| 400 `"aspect_ratio" must be one of: [16:9 9:16]`                                             | `1:1`、`21:9`、またはこのモデルにない比率です。                                                       | `16:9` または `9:16` を送ってください。                                                  |
| 400 `field "reference_audios" is not supported by model gemini-omni-1.1-flash`               | 参照音声、`generate_audio`、その他の動画モデルのフィールドは拒否されます。                                       | そのフィールドを削除してください。音声はすべての動画で生成されます。                                           |
| タスクが `failed` となり、`bad_request` が返る                                                          | モデルが取得または利用できなかったリンクです（非公開や期限切れのリンク、種類の違うファイルなど）。                                   | 実在する画像や動画への公開 HTTPS リンクを使うか、`POST /v1/files` でアップロードしてください。失敗したタスクは返金されています。 |
| タスクが `failed` となり、`content_policy_violation` が返る                                             | プロンプト、入力素材、または生成結果がモデレーションで拒否されました。                                                 | プロンプトまたは入力素材を変更してください。そのまま再試行しても再び失敗します。料金はかかりません。                           |
| 402 `insufficient_credits`                                                                   | 残高が、このリクエストで確保される料金を下回っています。4K の長いクリップが最も高額です。                                      | チャージするか、`duration` を短くするか、より低い `resolution` を使ってください。                        |## HTTP エラー早見表タスクが作られる前のエラーは、2xx 以外のレスポンスで返されます。課金はされません。`error.code` または `error.retryable` で処理を分岐してください。`message` には問題の内容が示されます。全一覧と再試行のルールは[エラー](/errors)にあります。```json
{
  "error": {
    "code": "bad_request",
    "message": "\"prompt\" is required",
    "retryable": false,
    "request_id": "req_5f0c2a9e4b7d4e31"
  }
}
```| HTTP ステータス | `error.code`                                                                                  | 対処方法                                                                             |
| ---------- | --------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| 400        | `bad_request`, `content_policy_violation`                                                     | リクエストを修正してください。メッセージにフィールド名が示されます。そのまま再試行しないでください。                               |
| 401        | `missing_api_key`, `invalid_api_key`（古いクライアントでは `unauthorized` が返ることがあります）                    | 有効なキーを `Authorization: Bearer <key>` で送信してください。                                  |
| 402        | `insufficient_credits`                                                                        | 残高をチャージするか、キーのクォータを引き上げてから、再度送信してください。                                           |
| 403        | `forbidden`                                                                                   | このキーまたはアカウントでは、このモデルを利用できない可能性があります（たとえば、無料クレジットは一部のモデルにのみ使えます）。そのまま再試行しないでください。 |
| 404        | `not_found`                                                                                   | `GET /v1/tasks/{task_id}` の場合：このキーのアカウントに該当するタスクが存在しません。ID を確認してください。            |
| 409        | `idempotency_conflict`                                                                        | 新しい `Idempotency-Key` を使うか、同じキーの最初のリクエストが完了するまで待ってください。                          |
| 429        | `rate_limit_exceeded`                                                                         | `Retry-After` の秒数（`error.retry_after_seconds` にも含まれます）だけ待ってから再試行してください。          |
| 500        | `internal_error`                                                                              | バックオフを入れて再試行してください。解消しない場合は、`request_id` を添えてサポートにお問い合わせください。                    |
| 503        | `processing_unavailable`, `processing_timeout`, `processing_failed`, `result_transfer_failed` | 課金はされていません。指数バックオフで再試行してください。                                                    |

Reference: https://docs.beatapi.io/api-reference/video-api/gemini-omni-1-1-flash

## Authentication

- `Authorization` header (bearer token, required) — API キーを `Authorization: Bearer <BEATAPI_API_KEY>` として送信してください。

## Servers

- `https://api.beatapi.io` (Direct, default)
- `https://api.beatapi.io` (API)

## Request

### Headers

- `Idempotency-Key` (string, optional) — ボディは JSON で送信し、`Content-Type: application/json` を指定します。`Idempotency-Key` は任意です。論理的に 1 件のリクエストごとに一意の値（255 文字以内）を送り、まったく同じボディを再試行するときだけ再利用してください。24 時間以内に同じキーと同じボディで再試行すると、最初のレスポンスが `Idempotent-Replayed: true` 付きで再度返されます。同じキーで異なるボディを送ると `409 idempotency_conflict` が返ります。2xx 以外のレスポンスは保存されないため、400 や 402 の後の再試行は改めて実行されます。

### Body (application/json)

This endpoint expects a GeminiOmni11FlashVideoRequest.

- `model` (enum, required) — 実行するモデルです。 **値**：`gemini-omni-1.1-flash` **値が正しくない場合** - 指定がない：`"model" is required` - 画像モデルをこのエンドポイントに送った：`"model" nano-banana-2 is served by POST /v1/images/tasks, not this endpoint`
  - Allowed values: `gemini-omni-1.1-flash`
- `prompt` (string, required) — 動画の内容です。動き、カメラ、場面、入れたいセリフや音を書きます。 **長さ**：1–5000 文字 - 長さは文字数で数えます（日本語・中国語・韓国語の 1 文字は 1 文字）。 - 参照素材を使う場合は、それぞれから何を使うかをプロンプトに書いてください。例：「1 枚目の参照画像の女性」「参照動画のカメラワーク」。 **値が正しくない場合** - 指定がない：`"prompt" is required` - 空、または上限より長い：`"prompt" has an unsupported length` - 文字列ではない：`"prompt" must be a string`
- `aspect_ratio` (enum, optional, default: 16:9) — 動画の画面比率です。横長の `16:9` または縦長の `9:16` です。 **指定できる値**：`16:9`, `9:16` **デフォルト**：`16:9` - 省略すると `16:9` が使われます。 - フレームを送る場合も適用されます。先頭フレームと同じ比率を選んでください。 **値が正しくない場合** - リストにない値：`"aspect_ratio" must be one of: [16:9 9:16]`
  - Allowed values: `16:9`, `9:16`
- `duration` (integer, optional, default: 5) — 動画の長さ（秒、整数）です。 **デフォルト**：`5` **範囲**：3–10 - 省略すると `5` が使われ、その秒数で課金されます。 - 秒数で課金されるため（「料金」を参照）、料金を左右する主な要素です。 **値が正しくない場合** - 3～10 の範囲外、整数ではない、または文字列で送った：`"duration" is outside its supported range`
- `images` (list of string, optional) — フレームです。リンク 1 個は先頭フレーム、2 個は順に先頭フレームと末尾フレームです。省略可能：テキストから動画を作る場合や参照素材を送る場合は送らないでください。 **要素数**：1–2 各要素は公開されている `https://` の URL です。ローカルファイルは先に [アップロード](/quick-guide#upload-an-input-file)（`POST /v1/files`）し、返された `data.url` を渡してください。 - 各リンクは公開された `https://` URL である必要があります。 - 動画の始まりや終わりではなく、参考にさせたいだけの画像は `reference_images` に入れてください。 **値が正しくない場合** - リンクが 3 個以上：`"images" accepts at most 2 items` - 空の配列：`"images" requires at least 1 item` - 配列ではない：`"images" must be an array` - https:// のリンクではない：`"images[0]" must be a public HTTPS URL` - `reference_images` または `reference_videos` と同時に送った：`Cannot combine "images" with reference inputs in one task`
- `reference_images` (list of string, optional) — 動画に使う人物、商品、スタイル、場面の画像を 1～10 枚指定します。 **要素数**：1–10 各要素は公開されている `https://` の URL です。ローカルファイルは先に [アップロード](/quick-guide#upload-an-input-file)（`POST /v1/files`）し、返された `data.url` を渡してください。 - 各リンクは公開された `https://` URL である必要があります。 - `reference_videos` を送るときは必須です。 **値が正しくない場合** - リンクが 11 個以上：`"reference_images" accepts at most 10 items` - 空の配列：`"reference_images" requires at least 1 item` - 配列ではない：`"reference_images" must be an array` - `images` と同時に送った：`Cannot combine "images" with reference inputs in one task`
- `reference_videos` (list of string, optional) — 新しい動画が動き、カメラワーク、被写体の参考にする動画を 1～3 本指定します。 **要素数**：1–3 各要素は公開されている `https://` の URL です。ローカルファイルは先に [アップロード](/quick-guide#upload-an-input-file)（`POST /v1/files`）し、返された `data.url` を渡してください。 - 各リンクは MP4、MOV、WebM ファイルを指す公開された `https://` URL である必要があります。 - `reference_images` のリンクが 1 個以上あるときだけ送れます。 - 参照動画は料金に影響しません。課金されるのは新しい動画の秒数です。 **値が正しくない場合** - `reference_images` なしで送った：`Gemini Omni 1.1 Flash "reference_videos" need at least one image in "reference_images"` - リンクが 4 個以上：`"reference_videos" accepts at most 3 items` - `images` と同時に送った：`Cannot combine "images" with reference inputs in one task`
- `resolution` (enum, optional, default: 720p) — 出力解像度です。高い解像度ほど 1 秒あたりの料金が上がります。 **指定できる値**：`720p`, `1080p`, `4k` **デフォルト**：`720p` - 省略すると `720p` が使われます。 - `4k` と `4K` は同じ区分です。 **値が正しくない場合** - リストにない値（例：`480p` や `720P`）：`"resolution" must be one of: [720p 1080p 4k 4K]`
  - Allowed values: `720p`, `1080p`, `4k`

## Response

### 201

タスクオブジェクトです。タスクが成功するまで `output` は `null` です。「実行中」と記載されたフィールドは、タスクの完了後に表示されなくなります。

- `map from string to any`

## Errors

### 400 Bad Request Error

`bad_request`, `content_policy_violation` リクエストを修正してください。メッセージにフィールド名が示されます。そのまま再試行しないでください。

- `map from string to any`

### 401 Unauthorized Error

`missing_api_key`, `invalid_api_key`（古いクライアントでは `unauthorized` が返ることがあります） 有効なキーを `Authorization: Bearer <key>` で送信してください。

- `map from string to any`

### 402 Payment Required Error

`insufficient_credits` 残高をチャージするか、キーのクォータを引き上げてから、再度送信してください。

- `map from string to any`

### 403 Forbidden Error

`forbidden` このキーまたはアカウントでは、このモデルを利用できない可能性があります（たとえば、無料クレジットは一部のモデルにのみ使えます）。そのまま再試行しないでください。

- `map from string to any`

### 409 Conflict Error

`idempotency_conflict` 新しい `Idempotency-Key` を使うか、同じキーの最初のリクエストが完了するまで待ってください。

- `map from string to any`

### 429 Too Many Requests Error

`rate_limit_exceeded` `Retry-After` の秒数（`error.retry_after_seconds` にも含まれます）だけ待ってから再試行してください。

- `map from string to any`

### 500 Internal Server Error

`internal_error` バックオフを入れて再試行してください。解消しない場合は、`request_id` を添えてサポートにお問い合わせください。

- `map from string to any`

### 503 Service Unavailable Error

`processing_unavailable`, `processing_timeout`, `processing_failed`, `result_transfer_failed` 課金はされていません。指数バックオフで再試行してください。

- `map from string to any`

## Examples

### テキストから動画

**Request**

```json
{
  "model": "gemini-omni-1.1-flash",
  "prompt": "A dramatic product reveal of a glass water bottle, slow orbiting camera, soft studio reflections",
  "aspect_ratio": "16:9",
  "duration": 5,
  "resolution": "720p"
}
```

**Response**

```json
{
  "data": {
    "capability_id": "gemini-omni-1.1-flash",
    "capability_version": 1,
    "completed_at": null,
    "created_at": 1791993600,
    "error_code": null,
    "error_message": null,
    "id": "task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ",
    "media_type": "video",
    "model": "gemini-omni-1.1-flash",
    "object": "task",
    "output": null,
    "poll_after_seconds": 8,
    "request_id": "req_5f0c2a9e4b7d4e31",
    "stage": "queued",
    "status": "queued",
    "task_kind": "video",
    "updated_at": 1791993600,
    "usage": {
      "billable_duration_seconds": 5,
      "credits_charged": 0.3,
      "credits_refunded": 0,
      "credits_reserved": 0.3,
      "credits_settled": 0
    }
  }
}
```

**SDK Code**

```python テキストから動画
import requests

url = "https://api.beatapi.io/v1/videos/tasks"

payload = {
    "model": "gemini-omni-1.1-flash",
    "prompt": "A dramatic product reveal of a glass water bottle, slow orbiting camera, soft studio reflections",
    "aspect_ratio": "16:9",
    "duration": 5,
    "resolution": "720p"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript テキストから動画
const url = 'https://api.beatapi.io/v1/videos/tasks';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"model":"gemini-omni-1.1-flash","prompt":"A dramatic product reveal of a glass water bottle, slow orbiting camera, soft studio reflections","aspect_ratio":"16:9","duration":5,"resolution":"720p"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go テキストから動画
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.beatapi.io/v1/videos/tasks"

	payload := strings.NewReader("{\n  \"model\": \"gemini-omni-1.1-flash\",\n  \"prompt\": \"A dramatic product reveal of a glass water bottle, slow orbiting camera, soft studio reflections\",\n  \"aspect_ratio\": \"16:9\",\n  \"duration\": 5,\n  \"resolution\": \"720p\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby テキストから動画
require 'uri'
require 'net/http'

url = URI("https://api.beatapi.io/v1/videos/tasks")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"model\": \"gemini-omni-1.1-flash\",\n  \"prompt\": \"A dramatic product reveal of a glass water bottle, slow orbiting camera, soft studio reflections\",\n  \"aspect_ratio\": \"16:9\",\n  \"duration\": 5,\n  \"resolution\": \"720p\"\n}"

response = http.request(request)
puts response.read_body
```

```java テキストから動画
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.beatapi.io/v1/videos/tasks")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"model\": \"gemini-omni-1.1-flash\",\n  \"prompt\": \"A dramatic product reveal of a glass water bottle, slow orbiting camera, soft studio reflections\",\n  \"aspect_ratio\": \"16:9\",\n  \"duration\": 5,\n  \"resolution\": \"720p\"\n}")
  .asString();
```

```php テキストから動画
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.beatapi.io/v1/videos/tasks', [
  'body' => '{
  "model": "gemini-omni-1.1-flash",
  "prompt": "A dramatic product reveal of a glass water bottle, slow orbiting camera, soft studio reflections",
  "aspect_ratio": "16:9",
  "duration": 5,
  "resolution": "720p"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp テキストから動画
using RestSharp;

var client = new RestClient("https://api.beatapi.io/v1/videos/tasks");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"model\": \"gemini-omni-1.1-flash\",\n  \"prompt\": \"A dramatic product reveal of a glass water bottle, slow orbiting camera, soft studio reflections\",\n  \"aspect_ratio\": \"16:9\",\n  \"duration\": 5,\n  \"resolution\": \"720p\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift テキストから動画
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "model": "gemini-omni-1.1-flash",
  "prompt": "A dramatic product reveal of a glass water bottle, slow orbiting camera, soft studio reflections",
  "aspect_ratio": "16:9",
  "duration": 5,
  "resolution": "720p"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.beatapi.io/v1/videos/tasks")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### 先頭フレーム

**Request**

```json
{
  "model": "gemini-omni-1.1-flash",
  "prompt": "The singer turns toward the camera and smiles, hair moving in the breeze, warm spotlights",
  "duration": 5,
  "images": [
    "https://cdn.beatapi.io/samples/neon-singer.png"
  ],
  "resolution": "720p"
}
```

**Response**

```json
{
  "data": {
    "capability_id": "gemini-omni-1.1-flash",
    "capability_version": 1,
    "completed_at": null,
    "created_at": 1791993600,
    "error_code": null,
    "error_message": null,
    "id": "task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ",
    "media_type": "video",
    "model": "gemini-omni-1.1-flash",
    "object": "task",
    "output": null,
    "poll_after_seconds": 8,
    "request_id": "req_5f0c2a9e4b7d4e31",
    "stage": "queued",
    "status": "queued",
    "task_kind": "video",
    "updated_at": 1791993600
  }
}
```

**SDK Code**

```python 先頭フレーム
import requests

url = "https://api.beatapi.io/v1/videos/tasks"

payload = {
    "model": "gemini-omni-1.1-flash",
    "prompt": "The singer turns toward the camera and smiles, hair moving in the breeze, warm spotlights",
    "duration": 5,
    "images": ["https://cdn.beatapi.io/samples/neon-singer.png"],
    "resolution": "720p"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript 先頭フレーム
const url = 'https://api.beatapi.io/v1/videos/tasks';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"model":"gemini-omni-1.1-flash","prompt":"The singer turns toward the camera and smiles, hair moving in the breeze, warm spotlights","duration":5,"images":["https://cdn.beatapi.io/samples/neon-singer.png"],"resolution":"720p"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go 先頭フレーム
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.beatapi.io/v1/videos/tasks"

	payload := strings.NewReader("{\n  \"model\": \"gemini-omni-1.1-flash\",\n  \"prompt\": \"The singer turns toward the camera and smiles, hair moving in the breeze, warm spotlights\",\n  \"duration\": 5,\n  \"images\": [\n    \"https://cdn.beatapi.io/samples/neon-singer.png\"\n  ],\n  \"resolution\": \"720p\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby 先頭フレーム
require 'uri'
require 'net/http'

url = URI("https://api.beatapi.io/v1/videos/tasks")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"model\": \"gemini-omni-1.1-flash\",\n  \"prompt\": \"The singer turns toward the camera and smiles, hair moving in the breeze, warm spotlights\",\n  \"duration\": 5,\n  \"images\": [\n    \"https://cdn.beatapi.io/samples/neon-singer.png\"\n  ],\n  \"resolution\": \"720p\"\n}"

response = http.request(request)
puts response.read_body
```

```java 先頭フレーム
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.beatapi.io/v1/videos/tasks")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"model\": \"gemini-omni-1.1-flash\",\n  \"prompt\": \"The singer turns toward the camera and smiles, hair moving in the breeze, warm spotlights\",\n  \"duration\": 5,\n  \"images\": [\n    \"https://cdn.beatapi.io/samples/neon-singer.png\"\n  ],\n  \"resolution\": \"720p\"\n}")
  .asString();
```

```php 先頭フレーム
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.beatapi.io/v1/videos/tasks', [
  'body' => '{
  "model": "gemini-omni-1.1-flash",
  "prompt": "The singer turns toward the camera and smiles, hair moving in the breeze, warm spotlights",
  "duration": 5,
  "images": [
    "https://cdn.beatapi.io/samples/neon-singer.png"
  ],
  "resolution": "720p"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp 先頭フレーム
using RestSharp;

var client = new RestClient("https://api.beatapi.io/v1/videos/tasks");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"model\": \"gemini-omni-1.1-flash\",\n  \"prompt\": \"The singer turns toward the camera and smiles, hair moving in the breeze, warm spotlights\",\n  \"duration\": 5,\n  \"images\": [\n    \"https://cdn.beatapi.io/samples/neon-singer.png\"\n  ],\n  \"resolution\": \"720p\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift 先頭フレーム
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "model": "gemini-omni-1.1-flash",
  "prompt": "The singer turns toward the camera and smiles, hair moving in the breeze, warm spotlights",
  "duration": 5,
  "images": ["https://cdn.beatapi.io/samples/neon-singer.png"],
  "resolution": "720p"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.beatapi.io/v1/videos/tasks")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### 先頭・末尾フレーム

**Request**

```json
{
  "model": "gemini-omni-1.1-flash",
  "prompt": "The camera pulls away from the singer and glides across the stage to the bottle on a table",
  "aspect_ratio": "16:9",
  "duration": 8,
  "images": [
    "https://cdn.beatapi.io/samples/neon-singer.png",
    "https://cdn.beatapi.io/samples/smart-bottle.png"
  ],
  "resolution": "1080p"
}
```

**Response**

```json
{
  "data": {
    "capability_id": "gemini-omni-1.1-flash",
    "capability_version": 1,
    "completed_at": null,
    "created_at": 1791993600,
    "error_code": null,
    "error_message": null,
    "id": "task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ",
    "media_type": "video",
    "model": "gemini-omni-1.1-flash",
    "object": "task",
    "output": null,
    "poll_after_seconds": 8,
    "request_id": "req_5f0c2a9e4b7d4e31",
    "stage": "queued",
    "status": "queued",
    "task_kind": "video",
    "updated_at": 1791993600
  }
}
```

**SDK Code**

```python 先頭・末尾フレーム
import requests

url = "https://api.beatapi.io/v1/videos/tasks"

payload = {
    "model": "gemini-omni-1.1-flash",
    "prompt": "The camera pulls away from the singer and glides across the stage to the bottle on a table",
    "aspect_ratio": "16:9",
    "duration": 8,
    "images": ["https://cdn.beatapi.io/samples/neon-singer.png", "https://cdn.beatapi.io/samples/smart-bottle.png"],
    "resolution": "1080p"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript 先頭・末尾フレーム
const url = 'https://api.beatapi.io/v1/videos/tasks';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"model":"gemini-omni-1.1-flash","prompt":"The camera pulls away from the singer and glides across the stage to the bottle on a table","aspect_ratio":"16:9","duration":8,"images":["https://cdn.beatapi.io/samples/neon-singer.png","https://cdn.beatapi.io/samples/smart-bottle.png"],"resolution":"1080p"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go 先頭・末尾フレーム
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.beatapi.io/v1/videos/tasks"

	payload := strings.NewReader("{\n  \"model\": \"gemini-omni-1.1-flash\",\n  \"prompt\": \"The camera pulls away from the singer and glides across the stage to the bottle on a table\",\n  \"aspect_ratio\": \"16:9\",\n  \"duration\": 8,\n  \"images\": [\n    \"https://cdn.beatapi.io/samples/neon-singer.png\",\n    \"https://cdn.beatapi.io/samples/smart-bottle.png\"\n  ],\n  \"resolution\": \"1080p\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby 先頭・末尾フレーム
require 'uri'
require 'net/http'

url = URI("https://api.beatapi.io/v1/videos/tasks")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"model\": \"gemini-omni-1.1-flash\",\n  \"prompt\": \"The camera pulls away from the singer and glides across the stage to the bottle on a table\",\n  \"aspect_ratio\": \"16:9\",\n  \"duration\": 8,\n  \"images\": [\n    \"https://cdn.beatapi.io/samples/neon-singer.png\",\n    \"https://cdn.beatapi.io/samples/smart-bottle.png\"\n  ],\n  \"resolution\": \"1080p\"\n}"

response = http.request(request)
puts response.read_body
```

```java 先頭・末尾フレーム
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.beatapi.io/v1/videos/tasks")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"model\": \"gemini-omni-1.1-flash\",\n  \"prompt\": \"The camera pulls away from the singer and glides across the stage to the bottle on a table\",\n  \"aspect_ratio\": \"16:9\",\n  \"duration\": 8,\n  \"images\": [\n    \"https://cdn.beatapi.io/samples/neon-singer.png\",\n    \"https://cdn.beatapi.io/samples/smart-bottle.png\"\n  ],\n  \"resolution\": \"1080p\"\n}")
  .asString();
```

```php 先頭・末尾フレーム
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.beatapi.io/v1/videos/tasks', [
  'body' => '{
  "model": "gemini-omni-1.1-flash",
  "prompt": "The camera pulls away from the singer and glides across the stage to the bottle on a table",
  "aspect_ratio": "16:9",
  "duration": 8,
  "images": [
    "https://cdn.beatapi.io/samples/neon-singer.png",
    "https://cdn.beatapi.io/samples/smart-bottle.png"
  ],
  "resolution": "1080p"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp 先頭・末尾フレーム
using RestSharp;

var client = new RestClient("https://api.beatapi.io/v1/videos/tasks");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"model\": \"gemini-omni-1.1-flash\",\n  \"prompt\": \"The camera pulls away from the singer and glides across the stage to the bottle on a table\",\n  \"aspect_ratio\": \"16:9\",\n  \"duration\": 8,\n  \"images\": [\n    \"https://cdn.beatapi.io/samples/neon-singer.png\",\n    \"https://cdn.beatapi.io/samples/smart-bottle.png\"\n  ],\n  \"resolution\": \"1080p\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift 先頭・末尾フレーム
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "model": "gemini-omni-1.1-flash",
  "prompt": "The camera pulls away from the singer and glides across the stage to the bottle on a table",
  "aspect_ratio": "16:9",
  "duration": 8,
  "images": ["https://cdn.beatapi.io/samples/neon-singer.png", "https://cdn.beatapi.io/samples/smart-bottle.png"],
  "resolution": "1080p"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.beatapi.io/v1/videos/tasks")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### 参照画像と参照動画 1 本

**Request**

```json
{
  "model": "gemini-omni-1.1-flash",
  "prompt": "The singer from the first reference image lifts the bottle from the second toward the camera, following the camera move of the reference video",
  "aspect_ratio": "9:16",
  "duration": 8,
  "reference_images": [
    "https://cdn.beatapi.io/samples/neon-singer.png",
    "https://cdn.beatapi.io/samples/smart-bottle.png"
  ],
  "reference_videos": [
    "https://your-cdn.example.com/clips/source.mp4"
  ],
  "resolution": "720p"
}
```

**Response**

```json
{
  "data": {
    "capability_id": "gemini-omni-1.1-flash",
    "capability_version": 1,
    "completed_at": null,
    "created_at": 1791993600,
    "error_code": null,
    "error_message": null,
    "id": "task_7Qm2Xc9LpR4vT8sKa1Nf6YbH3eWdJ0uZ",
    "media_type": "video",
    "model": "gemini-omni-1.1-flash",
    "object": "task",
    "output": null,
    "poll_after_seconds": 8,
    "request_id": "req_5f0c2a9e4b7d4e31",
    "stage": "queued",
    "status": "queued",
    "task_kind": "video",
    "updated_at": 1791993600
  }
}
```

**SDK Code**

```python 参照画像と参照動画 1 本
import requests

url = "https://api.beatapi.io/v1/videos/tasks"

payload = {
    "model": "gemini-omni-1.1-flash",
    "prompt": "The singer from the first reference image lifts the bottle from the second toward the camera, following the camera move of the reference video",
    "aspect_ratio": "9:16",
    "duration": 8,
    "reference_images": ["https://cdn.beatapi.io/samples/neon-singer.png", "https://cdn.beatapi.io/samples/smart-bottle.png"],
    "reference_videos": ["https://your-cdn.example.com/clips/source.mp4"],
    "resolution": "720p"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript 参照画像と参照動画 1 本
const url = 'https://api.beatapi.io/v1/videos/tasks';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"model":"gemini-omni-1.1-flash","prompt":"The singer from the first reference image lifts the bottle from the second toward the camera, following the camera move of the reference video","aspect_ratio":"9:16","duration":8,"reference_images":["https://cdn.beatapi.io/samples/neon-singer.png","https://cdn.beatapi.io/samples/smart-bottle.png"],"reference_videos":["https://your-cdn.example.com/clips/source.mp4"],"resolution":"720p"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go 参照画像と参照動画 1 本
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.beatapi.io/v1/videos/tasks"

	payload := strings.NewReader("{\n  \"model\": \"gemini-omni-1.1-flash\",\n  \"prompt\": \"The singer from the first reference image lifts the bottle from the second toward the camera, following the camera move of the reference video\",\n  \"aspect_ratio\": \"9:16\",\n  \"duration\": 8,\n  \"reference_images\": [\n    \"https://cdn.beatapi.io/samples/neon-singer.png\",\n    \"https://cdn.beatapi.io/samples/smart-bottle.png\"\n  ],\n  \"reference_videos\": [\n    \"https://your-cdn.example.com/clips/source.mp4\"\n  ],\n  \"resolution\": \"720p\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby 参照画像と参照動画 1 本
require 'uri'
require 'net/http'

url = URI("https://api.beatapi.io/v1/videos/tasks")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"model\": \"gemini-omni-1.1-flash\",\n  \"prompt\": \"The singer from the first reference image lifts the bottle from the second toward the camera, following the camera move of the reference video\",\n  \"aspect_ratio\": \"9:16\",\n  \"duration\": 8,\n  \"reference_images\": [\n    \"https://cdn.beatapi.io/samples/neon-singer.png\",\n    \"https://cdn.beatapi.io/samples/smart-bottle.png\"\n  ],\n  \"reference_videos\": [\n    \"https://your-cdn.example.com/clips/source.mp4\"\n  ],\n  \"resolution\": \"720p\"\n}"

response = http.request(request)
puts response.read_body
```

```java 参照画像と参照動画 1 本
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.beatapi.io/v1/videos/tasks")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"model\": \"gemini-omni-1.1-flash\",\n  \"prompt\": \"The singer from the first reference image lifts the bottle from the second toward the camera, following the camera move of the reference video\",\n  \"aspect_ratio\": \"9:16\",\n  \"duration\": 8,\n  \"reference_images\": [\n    \"https://cdn.beatapi.io/samples/neon-singer.png\",\n    \"https://cdn.beatapi.io/samples/smart-bottle.png\"\n  ],\n  \"reference_videos\": [\n    \"https://your-cdn.example.com/clips/source.mp4\"\n  ],\n  \"resolution\": \"720p\"\n}")
  .asString();
```

```php 参照画像と参照動画 1 本
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.beatapi.io/v1/videos/tasks', [
  'body' => '{
  "model": "gemini-omni-1.1-flash",
  "prompt": "The singer from the first reference image lifts the bottle from the second toward the camera, following the camera move of the reference video",
  "aspect_ratio": "9:16",
  "duration": 8,
  "reference_images": [
    "https://cdn.beatapi.io/samples/neon-singer.png",
    "https://cdn.beatapi.io/samples/smart-bottle.png"
  ],
  "reference_videos": [
    "https://your-cdn.example.com/clips/source.mp4"
  ],
  "resolution": "720p"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp 参照画像と参照動画 1 本
using RestSharp;

var client = new RestClient("https://api.beatapi.io/v1/videos/tasks");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"model\": \"gemini-omni-1.1-flash\",\n  \"prompt\": \"The singer from the first reference image lifts the bottle from the second toward the camera, following the camera move of the reference video\",\n  \"aspect_ratio\": \"9:16\",\n  \"duration\": 8,\n  \"reference_images\": [\n    \"https://cdn.beatapi.io/samples/neon-singer.png\",\n    \"https://cdn.beatapi.io/samples/smart-bottle.png\"\n  ],\n  \"reference_videos\": [\n    \"https://your-cdn.example.com/clips/source.mp4\"\n  ],\n  \"resolution\": \"720p\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift 参照画像と参照動画 1 本
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "model": "gemini-omni-1.1-flash",
  "prompt": "The singer from the first reference image lifts the bottle from the second toward the camera, following the camera move of the reference video",
  "aspect_ratio": "9:16",
  "duration": 8,
  "reference_images": ["https://cdn.beatapi.io/samples/neon-singer.png", "https://cdn.beatapi.io/samples/smart-bottle.png"],
  "reference_videos": ["https://your-cdn.example.com/clips/source.mp4"],
  "resolution": "720p"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.beatapi.io/v1/videos/tasks")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```