OpenAI動画フォーマット
OpenAI 動画フォーマット
Section titled “OpenAI 動画フォーマット”本ページの概要
OpenAI 動画フォーマット
Section titled “OpenAI 動画フォーマット”OpenAI の動画生成 API を呼び出して動画を生成します。Sora などのモデルに対応しているほか、OpenAI 動画フォーマットを使って可灵、即梦、vidu を呼び出すこともできます。
動画を生成する
Section titled “動画を生成する”API エンドポイント
Section titled “API エンドポイント”POST /v1/videosリクエストヘッダー
Section titled “リクエストヘッダー”| パラメータ | 種類 | 必須 | 説明 |
|---|---|---|---|
| Authorization | string | はい | ユーザー認証トークン (Bearer: sk-xxxx) |
| Content-Type | string | はい | multipart/form-data |
リクエストパラメータ
Section titled “リクエストパラメータ”| パラメータ | 種類 | 必須 | 説明 |
|---|---|---|---|
| prompt | string | はい | 生成したい動画を説明するテキストプロンプト |
| model | string | いいえ | 動画生成モデル。デフォルトは sora-2 |
| seconds | string | いいえ | 動画の長さ(秒)。デフォルトは 4 秒 |
| size | string | いいえ | 出力解像度。幅x高さの形式で指定。デフォルトは 720x1280 |
| input_reference | file | いいえ | 生成の参考にする任意の画像 |
リクエスト例
Section titled “リクエスト例”curl https://你的4All API服务器地址/v1/videos \ -H "Authorization: Bearer sk-xxxx" \ -F "model=sora-2" \ -F "prompt=A calico cat playing a piano on stage"レスポンス形式
Section titled “レスポンス形式”200 - 成功レスポンス
Section titled “200 - 成功レスポンス”{ "id": "video_123", "object": "video", "model": "sora-2", "status": "queued", "progress": 0, "created_at": 1712697600, "size": "1024x1808", "seconds": "8", "quality": "standard"}レスポンスフィールドの説明
Section titled “レスポンスフィールドの説明”| フィールド | 種類 | 説明 |
|---|---|---|
| id | string | 動画タスクID |
| object | string | オブジェクト種別。固定で “video” |
| model | string | 使用したモデル名 |
| status | string | タスク状態(queued: キュー待ち, processing: 処理中, completed: 完了, failed: 失敗) |
| progress | integer | 処理進捗(0-100) |
| created_at | integer | 作成時のタイムスタンプ |
| size | string | 動画解像度 |
| seconds | string | 動画の長さ(秒) |
| quality | string | 動画品質 |
動画を照会する
Section titled “動画を照会する”タスク ID に基づいて、動画生成タスクの状態と結果を確認します。
API エンドポイント
Section titled “API エンドポイント”GET /v1/videos/{video_id}パスパラメータ
Section titled “パスパラメータ”| パラメータ | 種類 | 必須 | 説明 |
|---|---|---|---|
| video_id | string | はい | 動画タスクID |
リクエスト例
Section titled “リクエスト例”curl 'https://你的4All API服务器地址/v1/videos/video_123' \ -H "Authorization: Bearer sk-xxxx"レスポンス形式
Section titled “レスポンス形式”200 - 成功レスポンス
Section titled “200 - 成功レスポンス”{ "id": "video_123", "object": "video", "model": "sora-2", "status": "completed", "progress": 100, "created_at": 1712697600, "size": "1024x1808", "seconds": "8", "quality": "standard", "url": "https://example.com/video.mp4"}レスポンスフィールドの説明
Section titled “レスポンスフィールドの説明”| フィールド | 種類 | 説明 |
|---|---|---|
| id | string | 動画タスクID |
| object | string | オブジェクト種別。固定で “video” |
| model | string | 使用したモデル名 |
| status | string | タスク状態(queued: キュー待ち, processing: 処理中, completed: 完了, failed: 失敗) |
| progress | integer | 処理進捗(0-100) |
| created_at | integer | 作成時のタイムスタンプ |
| size | string | 動画解像度 |
| seconds | string | 動画の長さ(秒) |
| quality | string | 動画品質 |
| url | string | 動画のダウンロードリンク(完了時) |
動画タスクの状態を取得する
Section titled “動画タスクの状態を取得する”タスク ID に基づいて、動画生成タスクの詳細情報を取得します。
API エンドポイント
Section titled “API エンドポイント”GET /v1/videos/{video_id}パスパラメータ
Section titled “パスパラメータ”| パラメータ | 種類 | 必須 | 説明 |
|---|---|---|---|
| video_id | string | はい | 取得する動画タスクの識別子 |
リクエスト例
Section titled “リクエスト例”curl 'https://你的4All API服务器地址/v1/videos/video_123' \ -H "Authorization: Bearer sk-xxxx"レスポンス形式
Section titled “レスポンス形式”200 - 成功レスポンス
Section titled “200 - 成功レスポンス”{ "id": "video_123", "object": "video", "model": "sora-2", "status": "completed", "progress": 100, "created_at": 1712697600, "completed_at": 1712698000, "expires_at": 1712784400, "size": "1024x1808", "seconds": "8", "quality": "standard", "remixed_from_video_id": null, "error": null}レスポンスフィールドの説明
Section titled “レスポンスフィールドの説明”| フィールド | 種類 | 説明 |
|---|---|---|
| id | string | 動画タスクの一意な識別子 |
| object | string | オブジェクト種別。固定で “video” |
| model | string | 動画生成に使用したモデル名 |
| status | string | 動画タスクの現在のライフサイクル状態 |
| progress | integer | 生成タスクのおおよその完了率 |
| created_at | integer | タスク作成時の Unix タイムスタンプ(秒) |
| completed_at | integer | タスク完了時の Unix タイムスタンプ(秒)。完了済みの場合 |
| expires_at | integer | ダウンロード可能なリソースの有効期限の Unix タイムスタンプ(秒)。設定されている場合 |
| size | string | 生成動画の解像度 |
| seconds | string | 生成動画クリップの長さ(秒) |
| quality | string | 動画品質 |
| remixed_from_video_id | string | この動画がリミックスの場合、元動画の識別子 |
| error | object | 生成に失敗した場合のエラー情報を含むオブジェクト |
動画コンテンツを取得する
Section titled “動画コンテンツを取得する”完了した動画コンテンツをダウンロードします。
API エンドポイント
Section titled “API エンドポイント”GET /v1/videos/{video_id}/contentパスパラメータ
Section titled “パスパラメータ”| パラメータ | 種類 | 必須 | 説明 |
|---|---|---|---|
| video_id | string | はい | ダウンロードする動画の識別子 |
クエリパラメータ
Section titled “クエリパラメータ”| パラメータ | 種類 | 必須 | 説明 |
|---|---|---|---|
| variant | string | いいえ | 返却するダウンロード可能なリソースの種類。デフォルトは MP4 動画 |
リクエスト例
Section titled “リクエスト例”curl 'https://你的4All API服务器地址/v1/videos/video_123/content' \ -H "Authorization: Bearer sk-xxxx" \ -o "video.mp4"レスポンス形式
Section titled “レスポンス形式”200 - 成功レスポンス
Section titled “200 - 成功レスポンス”動画ファイルのストリームを直接返します。Content-Type は video/mp4 です。
レスポンスヘッダーの説明
Section titled “レスポンスヘッダーの説明”| フィールド | 種類 | 説明 |
|---|---|---|
| Content-Type | string | 動画ファイルの種類。通常は video/mp4 |
| Content-Length | string | 動画ファイルサイズ(バイト) |
| Content-Disposition | string | ファイル डाउनलोड 情報 |
エラーレスポンス
Section titled “エラーレスポンス”400 - リクエストパラメータエラー
Section titled “400 - リクエストパラメータエラー”{ "error": { "message": "Invalid request parameters", "type": "invalid_request_error", "code": "invalid_parameter" }}401 - 認証なし
Section titled “401 - 認証なし”{ "error": { "message": "Invalid API key", "type": "authentication_error", "code": "invalid_api_key" }}403 - 権限なし
Section titled “403 - 権限なし”{ "error": { "message": "Insufficient permissions", "type": "permission_error", "code": "insufficient_permissions" }}429 - リクエスト頻度制限
Section titled “429 - リクエスト頻度制限”{ "error": { "message": "Rate limit exceeded", "type": "rate_limit_error", "code": "rate_limit_exceeded" }}500 - サーバー内部エラー
Section titled “500 - サーバー内部エラー”{ "error": { "message": "Internal server error", "type": "server_error", "code": "internal_error" }}