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

# Gemini ビデオ生成例

> Gemini の長時間実行ビデオ生成の例。

## 推奨されるエンドポイント

* [ジェミニ /v1beta/models/{model}:predictLongRunning](/ja/api-reference/endpoints/gemini/video-predict-long-running)
* [ジェミニ /v1beta/operations/{operation_id}](/ja/api-reference/endpoints/gemini/video-operations)

## 最低限のお願い

```json theme={null}
{
  "model": "veo-3.1-generate-preview",
  "prompt": "An 8-second ApiGo product demo animation"
}
```

## cURLの例

```bash theme={null}
curl "https://generativelanguage.googleapis.com/v1beta/models/veo-3.1-generate-preview:predictLongRunning" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "An 8-second ApiGo product demo animation"
  }'
```

## Python の例

```python theme={null}
import requests

create_response = requests.post(
    "https://generativelanguage.googleapis.com/v1beta/models/veo-3.1-generate-preview:predictLongRunning",
    headers={
        "x-goog-api-key": "<GEMINI_API_KEY>",
        "Content-Type": "application/json",
    },
    json={"prompt": "An 8-second ApiGo product demo animation"},
)

operation = create_response.json()
print(operation)
```

## Node.js の例

```js theme={null}
const createResponse = await fetch(
  "https://generativelanguage.googleapis.com/v1beta/models/veo-3.1-generate-preview:predictLongRunning",
  {
    method: "POST",
    headers: {
      "x-goog-api-key": process.env.GEMINI_API_KEY,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      prompt: "An 8-second ApiGo product demo animation"
    }),
  }
);

const operation = await createResponse.json();
console.log(operation);
```

## ベストプラクティス

* 最初のリクエストは最終ビデオではなく操作ハンドルを返します。
* ポーリングと状態マッピングはサーバー上に存在する必要があります
* 操作が完了した後にのみ最終アセットを取得します
