# Gemini Omni API ドキュメント

> AI Studio API で Gemini Omni モデルを使用して動画を生成します。

## 概要

AI Studio API を使用して Gemini Omni の生成タスクを作成し、タスク状態を確認します。処理は非同期です。まずタスクを作成して `taskId` を取得し、その後タスク API で結果を確認します。

## 認証

すべてのリクエストで `Authorization` ヘッダーに API Key が必要です。

```http
Authorization: Bearer YOUR_API_KEY
```

## 利用可能なモデル

| modelId | バージョン | プロバイダー | 実行モデル |
| --- | --- | --- | --- |
| `video:am-omni-flash-ext` | Gemini Omni Flash Lite | Omni-Flash-Ext | Omni-Flash-Ext |

## 1. 生成タスクを作成

### エンドポイント

```http
POST https://localhost:3000/api/ai-studio/execute
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY
```

### リクエスト例

```json
{
  "modelId": "video:am-omni-flash-ext",
  "isPublic": true,
  "payload": {
    "model": "Omni-Flash-Ext",
    "prompt": "a girl is dancing happily in a sunny garden",
    "duration": 10,
    "resolution": "1080p",
    "aspect_ratio": "9:16"
  }
}
```

### 成功レスポンス

```json
{
  "success": true,
  "data": {
    "modelId": "video:am-omni-flash-ext",
    "generationId": "generation-id",
    "reservedCredits": 20,
    "taskId": "provider-task-id",
    "state": "queued"
  }
}
```

## 2. タスク状態を確認

### エンドポイント

```http
GET https://localhost:3000/api/ai-studio/tasks/{taskId}
Authorization: Bearer YOUR_API_KEY
```

### 成功レスポンス

```json
{
  "success": true,
  "data": {
    "generationId": "generation-id",
    "taskId": "provider-task-id",
    "modelId": "video:am-omni-flash-ext",
    "state": "succeeded",
    "mediaUrls": [
      "https://example.com/result.mp4"
    ],
    "reservedCredits": 20,
    "refundedCredits": 0
  }
}
```

## リクエストフィールド

### Gemini Omni Flash Lite

#### Payload フィールド

| フィールド | タイプ | 必須 | デフォルト / 例 | 選択肢 | 説明 |
| --- | --- | --- | --- | --- | --- |
| `model` | enum | はい | `"Omni-Flash-Ext"` | Omni-Flash-Ext | Video generation model name. Must be Omni-Flash-Ext. |
| `prompt` | string | はい | `"a girl is dancing happily in a sunny garden"` | - | Video content description. Describe the scene, subject, action, environment, camera movement, visual style, and audio cues in detail. |
| `duration` | enum | いいえ | `6` | 4, 6, 8, 10 | Video duration in seconds. Supported values are 4, 6, 8, and 10. Do not pass duration together with video_urls. |
| `resolution` | enum | いいえ | `"720p"` | 720p, 1080p, 4k | Video resolution. Values are case-insensitive. Supported values are 720p, 1080p, and 4k. |
| `aspect_ratio` | enum | いいえ | `"16:9"` | 16:9, 9:16 | Video aspect ratio. Common values are 16:9 for landscape and 9:16 for portrait. |
| `generation_type` | enum | いいえ | `"reference"` | frame, reference | Generation type for image inputs. Use frame for first-frame mode with one image, or reference for one or three reference images. |
| `image_urls` | string[] | いいえ | `["https://example.com/character.jpg"]` | - | Reference image URL array. Omit or pass an empty array for text-to-video, pass 1 image for image-to-video, or pass 3 images for reference image fusion. Two images are not supported. |
| `video_urls` | string[] | いいえ | `["https://example.com/reference.mp4"]` | - | Reference video URL array. Omit it or provide one publicly accessible HTTP/HTTPS video URL. Do not pass video_urls together with duration. |

#### input フィールド

_このモデルのフィールド設定はありません。_

## 価格

生成タスクの作成時にクレジットが予約されます。作成レスポンスの `reservedCredits` が、そのリクエストで予約されたクレジット数です。

| モデル | タイプ | 仕様 | 価格 | 課金 |
| --- | --- | --- | --- | --- |
| Gemini Omni 1.1 Flash | テキスト/画像から動画 | 360p | 45 クレジット | 生成ごとの固定価格 |
| Gemini Omni 1.1 Flash | テキスト/画像から動画 | 360p | 60 クレジット | 生成ごとの固定価格 |
| Gemini Omni 1.1 Flash | テキスト/画像から動画 | 360p | 75 クレジット | 生成ごとの固定価格 |
| Gemini Omni 1.1 Flash | テキスト/画像から動画 | 360p | 90 クレジット | 生成ごとの固定価格 |
| Gemini Omni 1.1 Flash | 動画から動画 | 360p | 120 クレジット | （入力秒数 + 出力秒数）× 120 |
| Gemini Omni 1.1 Flash | テキスト/画像から動画 | 720p | 45 クレジット | 生成ごとの固定価格 |
| Gemini Omni 1.1 Flash | テキスト/画像から動画 | 720p | 60 クレジット | 生成ごとの固定価格 |
| Gemini Omni 1.1 Flash | テキスト/画像から動画 | 720p | 75 クレジット | 生成ごとの固定価格 |
| Gemini Omni 1.1 Flash | テキスト/画像から動画 | 720p | 90 クレジット | 生成ごとの固定価格 |
| Gemini Omni 1.1 Flash | 動画から動画 | 720p | 120 クレジット | （入力秒数 + 出力秒数）× 120 |
| Gemini Omni 1.1 Flash | テキスト/画像から動画 | 1080p | 45 クレジット | 生成ごとの固定価格 |
| Gemini Omni 1.1 Flash | テキスト/画像から動画 | 1080p | 60 クレジット | 生成ごとの固定価格 |
| Gemini Omni 1.1 Flash | テキスト/画像から動画 | 1080p | 75 クレジット | 生成ごとの固定価格 |
| Gemini Omni 1.1 Flash | テキスト/画像から動画 | 1080p | 90 クレジット | 生成ごとの固定価格 |
| Gemini Omni 1.1 Flash | 動画から動画 | 1080p | 120 クレジット | （入力秒数 + 出力秒数）× 120 |
| Gemini Omni 1.1 Flash | テキスト/画像から動画 | 4k | 105 クレジット | 生成ごとの固定価格 |
| Gemini Omni 1.1 Flash | テキスト/画像から動画 | 4k | 120 クレジット | 生成ごとの固定価格 |
| Gemini Omni 1.1 Flash | テキスト/画像から動画 | 4k | 135 クレジット | 生成ごとの固定価格 |
| Gemini Omni 1.1 Flash | テキスト/画像から動画 | 4k | 150 クレジット | 生成ごとの固定価格 |
| Gemini Omni 1.1 Flash | 動画から動画 | 4k | 180 クレジット | （入力秒数 + 出力秒数）× 180 |
| Gemini Omni Flash 1.1 Text to Video | テキストから動画 | 360p | 6 クレジット/秒 | 出力秒数 × 6 |
| Gemini Omni Flash 1.1 Text to Video | テキストから動画 | 720p | 20 クレジット/秒 | 出力秒数 × 20 |
| Gemini Omni Flash 1.1 Text to Video | テキストから動画 | 1080p | 30 クレジット/秒 | 出力秒数 × 30 |
| Gemini Omni Flash 1.1 Text to Video | テキストから動画 | 4k | 60 クレジット/秒 | 出力秒数 × 60 |
| Gemini Omni Flash 1.1 Image to Video | 画像から動画 | 360p | 6 クレジット/秒 | 出力秒数 × 6 |
| Gemini Omni Flash 1.1 Image to Video | 画像から動画 | 720p | 20 クレジット/秒 | 出力秒数 × 20 |
| Gemini Omni Flash 1.1 Image to Video | 画像から動画 | 1080p | 30 クレジット/秒 | 出力秒数 × 30 |
| Gemini Omni Flash 1.1 Image to Video | 画像から動画 | 4k | 60 クレジット/秒 | 出力秒数 × 60 |
| Gemini Omni Flash 1.1 Reference to Video | テキスト/画像から動画 | 360p | 6 クレジット/秒 | 出力秒数 × 6 |
| Gemini Omni Flash 1.1 Reference to Video | テキスト/画像から動画 | 720p | 20 クレジット/秒 | 出力秒数 × 20 |
| Gemini Omni Flash 1.1 Reference to Video | テキスト/画像から動画 | 1080p | 30 クレジット/秒 | 出力秒数 × 30 |
| Gemini Omni Flash 1.1 Reference to Video | テキスト/画像から動画 | 4k | 60 クレジット/秒 | 出力秒数 × 60 |
| Gemini Omni Flash 1.1 Video Edit | テキスト/画像から動画 | 360p | 6 クレジット | 生成ごとの固定価格 |
| Gemini Omni Flash 1.1 Video Edit | テキスト/画像から動画 | 720p | 20 クレジット | 生成ごとの固定価格 |
| Gemini Omni Flash 1.1 Video Edit | テキスト/画像から動画 | 1080p | 30 クレジット | 生成ごとの固定価格 |
| Gemini Omni Flash 1.1 Video Edit | テキスト/画像から動画 | 4k | 60 クレジット | 生成ごとの固定価格 |
| Gemini Omni Flash Lite | テキスト/画像から動画 | 720p | 30 クレジット | 生成ごとの固定価格 |
| Gemini Omni Flash Lite | テキスト/画像から動画 | 1080p | 30 クレジット | 生成ごとの固定価格 |
| Gemini Omni Flash Lite | テキスト/画像から動画 | 720p | 34 クレジット | 生成ごとの固定価格 |
| Gemini Omni Flash Lite | テキスト/画像から動画 | 1080p | 34 クレジット | 生成ごとの固定価格 |
| Gemini Omni Flash Lite | テキスト/画像から動画 | 720p | 36 クレジット | 生成ごとの固定価格 |
| Gemini Omni Flash Lite | テキスト/画像から動画 | 1080p | 36 クレジット | 生成ごとの固定価格 |
| Gemini Omni Flash Lite | テキスト/画像から動画 | 720p | 40 クレジット | 生成ごとの固定価格 |
| Gemini Omni Flash Lite | テキスト/画像から動画 | 1080p | 40 クレジット | 生成ごとの固定価格 |
| Gemini Omni Flash Lite | テキスト/画像から動画 | 4k | 60 クレジット | 生成ごとの固定価格 |
| Gemini Omni Flash Lite | テキスト/画像から動画 | 4k | 68 クレジット | 生成ごとの固定価格 |
| Gemini Omni Flash Lite | テキスト/画像から動画 | 4k | 72 クレジット | 生成ごとの固定価格 |
| Gemini Omni Flash Lite | テキスト/画像から動画 | 4k | 80 クレジット | 生成ごとの固定価格 |
| Gemini Omni Video | テキスト/画像から動画 | 720p | 30 クレジット | 生成ごとの固定価格 |
| Gemini Omni Video | テキスト/画像から動画 | 720p | 40 クレジット | 生成ごとの固定価格 |
| Gemini Omni Video | テキスト/画像から動画 | 720p | 50 クレジット | 生成ごとの固定価格 |
| Gemini Omni Video | テキスト/画像から動画 | 720p | 60 クレジット | 生成ごとの固定価格 |
| Gemini Omni Video | テキスト/画像から動画 | 1080p | 30 クレジット | 生成ごとの固定価格 |
| Gemini Omni Video | テキスト/画像から動画 | 1080p | 40 クレジット | 生成ごとの固定価格 |
| Gemini Omni Video | テキスト/画像から動画 | 1080p | 50 クレジット | 生成ごとの固定価格 |
| Gemini Omni Video | テキスト/画像から動画 | 1080p | 60 クレジット | 生成ごとの固定価格 |
| Gemini Omni Video | テキスト/画像から動画 | 4k | 70 クレジット | 生成ごとの固定価格 |
| Gemini Omni Video | テキスト/画像から動画 | 4k | 80 クレジット | 生成ごとの固定価格 |
| Gemini Omni Video | テキスト/画像から動画 | 4k | 90 クレジット | 生成ごとの固定価格 |
| Gemini Omni Video | テキスト/画像から動画 | 4k | 100 クレジット | 生成ごとの固定価格 |
| Gemini Omni Video | 動画から動画 | 720p | 80 クレジット | （入力秒数 + 出力秒数）× 80 |
| Gemini Omni Video | 動画から動画 | 1080p | 80 クレジット | （入力秒数 + 出力秒数）× 80 |
| Gemini Omni Video | 動画から動画 | 4k | 120 クレジット | （入力秒数 + 出力秒数）× 120 |
| Gemini Omni Character | テキスト/画像から動画 | - | 1 クレジット | 生成ごとの固定価格 |
| Gemini Omni Audio | テキスト/画像から動画 | - | 1 クレジット | 生成ごとの固定価格 |

## 一般的なエラー

| ステータス | 意味 |
| --- | --- |
| `400` | Invalid request payload |
| `401` | Missing or invalid API key |
| `402` | Insufficient credits or plan limit |
| `404` | Model or task not found |
| `429` | Rate limit exceeded |
| `500` | Server error |
