Skip to main content
POST
右側のインタラクティブなPlaygroundでは、呼び出しをリアルタイムでテストできます。Authorization(形式:Bearer sk-xxx)にAPIキーを入力し、prompt、seconds、sizeを指定して送信してください。レスポンスとしてタスクidが返されます。動画は以下のクエリエンドポイントから取得してください。
1つのエンドポイント、4つのモード:promptのみ = テキストから動画生成、input_referenceに1枚の画像 = 先頭フレームからの動画生成、input_referenceにJSONエンベロープ = 開始・終了フレーム指定または参照メディアからの動画生成。また、エンベロープでは768p、1:1、または品質ティアを選択することも可能です。詳細についてはOxygenの概要を参照してください。
⚠️ 最もよくある4つの間違い
  1. 必ずsizeを渡すこと:指定しない場合、ゲートウェイはデフォルトで720x1280を適用し、縦向きの出力になります
  2. 詳細パラメータはinput_referenceエンベロープ内に配置すること:トップレベルで有効なのはmodel、prompt、seconds、size、input_referenceのみです。そこに配置されたlast_image、reference_images、resolution、aspect_ratioはエラーを出さずに暗黙的に破棄されます
  3. input_referenceは文字列である必要があります:あらかじめjson.dumps / JSON.stringifyでエンベロープをシリアライズしてください。オブジェクトや配列を渡すと拒否されます
  4. 長さの指定はトップレベルのsecondsでのみ行うこと(4–15):エンベロープ内でdurationを指定すると400が返されます

コード例

Python (requests · 送信 + ポーリング + ダウンロード)

Python (先頭フレーム動画 · リクエストボディ)

Python (先頭および末尾フレーム / 参照メディア · JSONエンベロープ)

cURL

先頭および末尾フレーム(input_reference の値はエスケープされた JSON 文字列である点にご注意ください):

Node.js (ネイティブ fetch)

id をお持ちですか? cURL 1 つで結果を取得

status が completed の場合、video_url は MP4 アドレスとなり、直接ダウンロードできます:

パラメーターリファレンス

トップレベルフィールド(有効なのはこの5つのみ)

input_reference エンベロープキー

エンベロープには**durationを含めることはできず**(トップレベルのsecondsを使用してください)、表にないキーも含めることはできません。また、最初/最後のフレーム(images / last_image)とreference_*を組み合わせることはできません。これらに該当する場合は400(param: input_reference)が返され、課金は発生しません。

解像度と出力サイズ(実測値)

画像から動画への生成(image-to-video)では最初のフレームのアスペクト比に従います。例えば、正方形の最初のフレームの場合、480pでは480×480になります。

レスポンス形式

タスクの作成

タスクの照会(成功)

タスクの照会(失敗)

送信エラー(400)

⚠️ レスポンスに関する注意事項
  • ステータスは queued → in_progress → completed / failed と遷移します
  • 動画は video_url にあり、認証ヘッダーなしでダウンロード可能です。expires_at(約24時間)で有効期限が切れるため、速やかに保存してください
  • completed の直後は、/v1/videos/{id}/content にさらに数秒かかる場合があり(最初は400を返します)、video_url の利用を推奨します
  • usage.unit_price_usd は解像度ごとの参考価格です。実際の課金はお客様の請求に従い、一律1秒あたり $0.02 となります
  • 送信エラーの場合、詳細は message 内の JSON 文字列となっているため、再度パースする必要があります
課金: seconds × \$0.02 はタスクが受け付けられた時点で課金されます。解像度や参照メディアによって価格が変わることはなく、失敗したタスクは自動的に全額返金されます。400を返す送信には課金されず、照会やダウンロードは無料です。概要の料金をご覧ください。

承認

Authorization
string
header
必須

API key from the APIYI console

ボディ

application/json
model
enum<string>
デフォルト:oxygen-1.0
必須

Always oxygen-1.0

利用可能なオプション:
oxygen-1.0
prompt
string
必須

Video description

例:

"A paper boat drifting on a calm pond, soft morning light"

seconds
enum<string>
デフォルト:4
必須

Output length in seconds, integer 4–15, as a string or number. Used for billing; the clip usually runs slightly longer

利用可能なオプション:
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15
size
enum<string>
デフォルト:1280x720

Sets the resolution and orientation. Pass it every time; it defaults to 720x1280 (portrait) when omitted. 1280x720 = 480p landscape, 720x1280 = 480p portrait, 1792x1024 = 768p landscape, 1024x1792 = 768p portrait. For 1:1, use aspect_ratio in the input_reference envelope.

利用可能なオプション:
1280x720,
720x1280,
1792x1024,
1024x1792
input_reference
string

Two forms:

  • Image URL or data URI → first-frame video; aspect ratio follows the first frame
  • JSON string starting with { (envelope) → allowed keys: images (first frame, max 1), last_image (last frame), reference_images (up to 9), reference_videos (up to 3, https only), reference_audios (up to 3, https only), resolution (480p / 768p, wins over size), aspect_ratio (16:9 / 9:16 / 1:1, ignored for image-to-video), quality (high default / normal), prompt_enhance (refine default / format / none), prompt

Must be a string, so serialize the envelope first. No duration and no unknown keys in the envelope; first/last frames cannot be mixed with reference media.

例:

"https://your-cdn.example.com/first.png"

レスポンス

Task accepted

id
string

Task id, used with GET /v1/videos/{id}

object
enum<string>
利用可能なオプション:
video
model
string
status
enum<string>
利用可能なオプション:
queued,
in_progress,
completed,
failed
progress
integer

0–100

seconds
string
size
string
created_at
integer
completed_at
integer
expires_at
integer

When video_url expires (Unix seconds), about 24 hours after completion

video_url
string

Output MP4 URL, downloadable without an auth header; store it promptly

usage
object

Reference billing info; actual billing is a flat $0.02 per second, see your bill

error
object