コンテンツにスキップ

OpenAI動画フォーマット

本ページの概要

OpenAI の動画生成 API を呼び出して動画を生成します。Sora などのモデルに対応しているほか、OpenAI 動画フォーマットを使って可灵、即梦、vidu を呼び出すこともできます。

POST /v1/videos
パラメータ種類必須説明
Authorizationstringはいユーザー認証トークン (Bearer: sk-xxxx)
Content-Typestringはいmultipart/form-data
パラメータ種類必須説明
promptstringはい生成したい動画を説明するテキストプロンプト
modelstringいいえ動画生成モデル。デフォルトは sora-2
secondsstringいいえ動画の長さ(秒)。デフォルトは 4 秒
sizestringいいえ出力解像度。幅x高さの形式で指定。デフォルトは 720x1280
input_referencefileいいえ生成の参考にする任意の画像
Terminal window
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"
{
"id": "video_123",
"object": "video",
"model": "sora-2",
"status": "queued",
"progress": 0,
"created_at": 1712697600,
"size": "1024x1808",
"seconds": "8",
"quality": "standard"
}
フィールド種類説明
idstring動画タスクID
objectstringオブジェクト種別。固定で “video”
modelstring使用したモデル名
statusstringタスク状態(queued: キュー待ち, processing: 処理中, completed: 完了, failed: 失敗)
progressinteger処理進捗(0-100)
created_atinteger作成時のタイムスタンプ
sizestring動画解像度
secondsstring動画の長さ(秒)
qualitystring動画品質

タスク ID に基づいて、動画生成タスクの状態と結果を確認します。

GET /v1/videos/{video_id}
パラメータ種類必須説明
video_idstringはい動画タスクID
Terminal window
curl 'https://你的4All API服务器地址/v1/videos/video_123' \
-H "Authorization: Bearer sk-xxxx"
{
"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"
}
フィールド種類説明
idstring動画タスクID
objectstringオブジェクト種別。固定で “video”
modelstring使用したモデル名
statusstringタスク状態(queued: キュー待ち, processing: 処理中, completed: 完了, failed: 失敗)
progressinteger処理進捗(0-100)
created_atinteger作成時のタイムスタンプ
sizestring動画解像度
secondsstring動画の長さ(秒)
qualitystring動画品質
urlstring動画のダウンロードリンク(完了時)

タスク ID に基づいて、動画生成タスクの詳細情報を取得します。

GET /v1/videos/{video_id}
パラメータ種類必須説明
video_idstringはい取得する動画タスクの識別子
Terminal window
curl 'https://你的4All API服务器地址/v1/videos/video_123' \
-H "Authorization: Bearer sk-xxxx"
{
"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
}
フィールド種類説明
idstring動画タスクの一意な識別子
objectstringオブジェクト種別。固定で “video”
modelstring動画生成に使用したモデル名
statusstring動画タスクの現在のライフサイクル状態
progressinteger生成タスクのおおよその完了率
created_atintegerタスク作成時の Unix タイムスタンプ(秒)
completed_atintegerタスク完了時の Unix タイムスタンプ(秒)。完了済みの場合
expires_atintegerダウンロード可能なリソースの有効期限の Unix タイムスタンプ(秒)。設定されている場合
sizestring生成動画の解像度
secondsstring生成動画クリップの長さ(秒)
qualitystring動画品質
remixed_from_video_idstringこの動画がリミックスの場合、元動画の識別子
errorobject生成に失敗した場合のエラー情報を含むオブジェクト

完了した動画コンテンツをダウンロードします。

GET /v1/videos/{video_id}/content
パラメータ種類必須説明
video_idstringはいダウンロードする動画の識別子
パラメータ種類必須説明
variantstringいいえ返却するダウンロード可能なリソースの種類。デフォルトは MP4 動画
Terminal window
curl 'https://你的4All API服务器地址/v1/videos/video_123/content' \
-H "Authorization: Bearer sk-xxxx" \
-o "video.mp4"

動画ファイルのストリームを直接返します。Content-Type は video/mp4 です。

フィールド種類説明
Content-Typestring動画ファイルの種類。通常は video/mp4
Content-Lengthstring動画ファイルサイズ(バイト)
Content-Dispositionstringファイル डाउनलोड 情報

400 - リクエストパラメータエラー

Section titled “400 - リクエストパラメータエラー”
{
"error": {
"message": "Invalid request parameters",
"type": "invalid_request_error",
"code": "invalid_parameter"
}
}
{
"error": {
"message": "Invalid API key",
"type": "authentication_error",
"code": "invalid_api_key"
}
}
{
"error": {
"message": "Insufficient permissions",
"type": "permission_error",
"code": "insufficient_permissions"
}
}
{
"error": {
"message": "Rate limit exceeded",
"type": "rate_limit_error",
"code": "rate_limit_exceeded"
}
}
{
"error": {
"message": "Internal server error",
"type": "server_error",
"code": "internal_error"
}
}