Sora 2 動画生成API
APIMaster.aiでsora-2とsora-2-proを呼び出して、テキストから動画、画像から動画を生成します。ポーリングとダウンロードにはAPIMasterのURLを使用します。
Sora 2 動画生成
APIMasterを通じてSora 2で動画を生成します。サポートされているモデル: sora-2、sora-2-pro。名称 sora は sora-2 にマッピングされます。
ベースURL:
https://apimaster.ai/v1はhttps://apimaster.ai/v1です。https://apimaster.ai/v1/videos/...を使用してください — 追加の/v1は付けないでください。
料金(公式価格より20%オフ、秒単位)
課金は再生時間(秒)× 秒単価です。
| モデル | 解像度 | 公式 | APIMaster |
|---|---|---|---|
sora-2 |
720p | $0.10 / sec | $0.08 / sec |
sora-2-pro |
720p | $0.30 / sec | $0.24 / sec |
sora-2-pro |
1024p | $0.50 / sec | $0.40 / sec |
sora-2-pro |
1080p | $0.70 / sec | $0.56 / sec |
例: sora-2 で720pの4秒 ≈ $0.32 ($0.08 × 4)
タスクを送信する
2つのエントリポイント — どちらかを使用してください。
オプションA(推奨): ネイティブJSON
POST https://apimaster.ai/v1/videos/generations
| フィールド | 型 | 必須 | 説明 |
|---|---|---|---|
model |
string | はい | sora-2 / sora-2-pro(または sora) |
prompt |
string | はい | 動画の説明 |
duration |
integer | いいえ | 一般的: 4 / 8 / 12 / 16 / 20、デフォルト 4 |
resolution |
string | いいえ | sora-2: 720p; sora-2-pro: さらに 1024p / 1080p、デフォルト 720p |
aspect_ratio |
string | いいえ | 16:9 / landscape または 9:16 / portrait、デフォルト 16:9 |
image_urls |
string[] | いいえ | 画像から動画へ; 1つの公開URLを推奨 |
curl -s "https://apimaster.ai/v1/videos/generations" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "sora-2",
"prompt": "A waterfall forming a rainbow, cinematic",
"duration": 4,
"resolution": "720p",
"aspect_ratio": "16:9"
}'
送信レスポンス
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_xxxxxxxx"
}
]
}
画像から動画の場合は aspect_ratio を明示的に設定 してください(縦向き → 9:16)。デフォルトは 16:9 です。
オプションB: OpenAI Video互換
POST https://apimaster.ai/v1/videos(JSONまたはマルチパート)
| フィールド | 型 | 必須 | 説明 |
|---|---|---|---|
model |
string | はい | sora-2 / sora-2-pro(または sora) |
prompt |
string | はい | 動画の説明 |
seconds |
string | いいえ | 再生時間。例 "4"; 整数の duration も使用可能、デフォルト 4 |
size |
string | いいえ | ピクセルサイズ — 解像度と向き(下表参照)、デフォルト 720x1280 |
images |
string[] | いいえ | 画像から動画へ; 最大1つのURL。input_reference(単一)も使用可能 |
size の値
| モデル | 横画面 (16:9) | 縦画面 (9:16) |
|---|---|---|
sora-2 |
1280x720 (720p) |
720x1280 (720p) |
sora-2-pro |
1280x720 (720p) / 1792x1024 (1024p) |
720x1280 (720p) / 1024x1792 (1024p) |
無効な
size(例1920x1080)は400 invalid_sizeを返します。OpenAIパスの最大は 1024p です; 1080pの場合はresolution: "1080p"を指定してオプションAを使用してください。
curl -s "https://apimaster.ai/v1/videos" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "sora-2",
"prompt": "A waterfall forming a rainbow, cinematic",
"seconds": "4",
"size": "1280x720"
}'
送信レスポンス
{
"id": "task_xxxxxxxx",
"object": "video",
"model": "sora-2",
"status": "queued"
}
ポーリングとダウンロードには、どちらかのエンドポイントからの task_id / id を使用します。
タスクステータスをポーリングする
GET https://apimaster.ai/v1/videos/{task_id}
curl -s "https://apimaster.ai/v1/videos/task_xxxxxxxx" \
-H "Authorization: Bearer YOUR_API_KEY"
完了例:
{
"id": "task_xxxxxxxx",
"status": "completed",
"url": "https://apimaster.ai/v1/videos/task_xxxxxxxx/content"
}
MP4は
https://apimaster.ai/v1/videos/{task_id}/contentからダウンロードします。
動画をダウンロードする
curl -L "https://apimaster.ai/v1/videos/task_xxxxxxxx/content" \
-H "Authorization: Bearer YOUR_API_KEY" \
-o output.mp4
画像から動画への例
オプションA:
curl -s "https://apimaster.ai/v1/videos/generations" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "sora-2",
"prompt": "Slow push-in, gentle breeze in the hair",
"duration": 8,
"resolution": "720p",
"aspect_ratio": "9:16",
"image_urls": ["https://example.com/reference.jpg"]
}'
オプションB(images フィールド):
curl -s "https://apimaster.ai/v1/videos" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "sora-2",
"prompt": "Slow push-in, gentle breeze in the hair",
"seconds": "8",
"images": ["https://example.com/reference.jpg"]
}'
ポーリングのヒント
- 送信後 10~20秒 待ち、その後 3~5秒 ごとにポーリング
- 通常の所要時間: 1~3分
- 完了後は すぐにMP4を保存 してください
エラーコード
| コード | 意味 |
|---|---|
| 400 | 無効なパラメータ(例: invalid_size) |
| 401 | 無効なAPIキー |
| 402 | 残高不足 |
| 429 | レート制限 |
| 500 / 502 | 一時的なエラー、再試行してください |