> ## 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.

# OpenAIビデオ生成例

> OpenAI の非同期ビデオ生成の例。

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

* [OpenAI /v1/videos](/ja/api-reference/endpoints/openai/video)
* [OpenAI /v1/videos/{video_id}](/ja/api-reference/endpoints/openai/video-status)
* [OpenAI /v1/videos/{video_id}/content](/ja/api-reference/endpoints/openai/video-content)

## 最低限のお願い

```json theme={null}
{
  "model": "sora-2",
  "prompt": "An 8-second ApiGo product demo animation",
  "seconds": 8,
  "size": "1280x720"
}
```

## cURLの例

```bash theme={null}
curl https://maas.apigo.ai/v1/videos \
  -H "Authorization: Bearer $YOUR API KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sora-2",
    "prompt": "An 8-second ApiGo product demo animation",
    "seconds": 8,
    "size": "1280x720"
  }'
```

## Python の例

```python theme={null}
import requests

response = requests.post(
    "https://maas.apigo.ai/v1/videos",
    headers={
        "Authorization": "Bearer <YOUR API KEY>",
        "Content-Type": "application/json",
    },
    json={
        "model": "sora-2",
        "prompt": "An 8-second ApiGo product demo animation",
        "seconds": 8,
        "size": "1280x720",
    },
)

print(response.json())
```

## Node.js の例

```js theme={null}
const response = await fetch("https://maas.apigo.ai/v1/videos", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.YOUR API KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model: "sora-2",
    prompt: "An 8-second ApiGo product demo animation",
    seconds: 8,
    size: "1280x720",
  }),
});

console.log(await response.json());
```

## ベストプラクティス

* 作成、ステータス、およびコンテンツの取得を別のステップとして扱う
* バックオフを使用して適切な間隔でポーリングする
* バックエンドを介して大規模なダウンロードまたは一時 URL をプロキシします。
