Skip to main content
POST
The interactive Playground on the right lets you test calls live. Enter your API key under Authorization (format Bearer sk-xxx), fill in prompt, seconds, and size, and send. The response is a task id; fetch the video with the query endpoint below.
One endpoint, four modes: prompt only = text-to-video; one image in input_reference = first-frame video; a JSON envelope in input_reference = first-and-last-frame or reference media video, and the envelope can also select 320p or 1:1. See the Oxygen Overview for the full picture.
⚠️ The four most common mistakes
  1. Always pass size: without it the gateway defaults to 720x1280 and you get portrait output
  2. Put advanced parameters in the input_reference envelope: only model, prompt, seconds, size, and input_reference take effect at the top level; last_image, reference_images, resolution, and aspect_ratio placed there are silently dropped with no error
  3. input_reference must be a string: serialize the envelope with json.dumps / JSON.stringify first; passing an object or array is rejected
  4. Set the length only with top-level seconds (4–15); duration inside the envelope returns 400

Code Examples

Python (requests · submit + poll + download)

Python (first-frame video · request body)

Python (first and last frame / reference media · JSON envelope)

cURL

First and last frame (note that the value of input_reference is an escaped JSON string):

Node.js (native fetch)

Have an id? One cURL to get the result

When status is completed, video_url is the MP4 address and can be downloaded directly:

Parameter Reference

Top-level fields (only these five take effect)

input_reference envelope keys

The envelope cannot contain duration (use top-level seconds) or any key not in the table, and first/last frames (images / last_image) cannot be combined with reference_*. Any of these returns 400 (param: input_reference) with no charge.

Resolution and output size (measured)

Image-to-video follows the first frame’s aspect ratio; for example, a square first frame gives 480×480 at 480p.

Response Format

Create task

Query task (success)

Query task (failure)

Submission error (400)

⚠️ Response notes
  • Status goes queued → in_progress → completed / failed
  • The video is at video_url, downloadable without an auth header; it expires at expires_at (about 24 hours), so store it promptly
  • Right after completed, /v1/videos/{id}/content may need a few more seconds (it returns 400 at first); prefer video_url
  • usage.unit_price_usd is a per-resolution reference price; actual billing follows your bill: a flat $0.02 per second
  • For submission errors, the detail is a JSON string inside message and needs to be parsed again
Billing: seconds × \$0.02 is charged when the task is accepted; resolution and reference media do not change the price, and failed tasks are refunded in full automatically. Submissions that return 400 are not charged, and queries and downloads are free. See Pricing in the overview.

Authorizations

Authorization
string
header
required

API key from the APIYI console

Body

application/json
model
enum<string>
default:oxygen-1.0
required

Always oxygen-1.0

Available options:
oxygen-1.0
prompt
string
required

Video description

Example:

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

seconds
enum<string>
default:4
required

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

Available options:
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15
size
enum<string>
default: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 320p or 1:1, use resolution / aspect_ratio in the input_reference envelope.

Available options:
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 (320p / 480p / 768p, wins over size), aspect_ratio (16:9 / 9:16 / 1:1, ignored for image-to-video), 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.

Example:

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

Response

Task accepted

id
string

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

object
enum<string>
Available options:
video
model
string
status
enum<string>
Available options:
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