Skip to main content
Video generation uses asynchronous tasks: first create a task, then query progress using the task ID.
APIONE web video generation page

APIONE web video generation settings for generation mode, model, aspect ratio, resolution, and duration.

APIONE model marketplace video model list

The video category in the model marketplace shows available video models, billing units, input/output types, and channels.

Before submitting, query /v1/models with your current key and confirm that the list contains the target video model. Also verify the model’s create, status, and result fields. If no video model is listed, first check the key group and permissions in the console; do not use another gateway’s model ID or response format as a substitute.

Before running examples

Install Python 3, then install the dependency with the same interpreter that will run the example:
If your system uses python3, use python3 for both installation and execution. Windows users can use py -m pip install requests and py example.py. Activate your virtual environment first, if applicable. Create a key on the API Keys page, copy a model ID that supports video generation from the available model list, then set the variables in the terminal where you will run the script. The uppercase values below are placeholders to replace.
Variables only apply to the current terminal and child processes it starts. Run the examples in the same terminal; IDEs, containers, and new terminals need separate configuration. Do not commit real keys to source control.

1. Query model parameters

Confirm the generation modes supported by the model, as well as fields for duration, aspect ratio, resolution, reference material, etc.

2. Create a task

Save the task ID from the response. A successful create response only means the task was accepted, not that the video has already been generated.

3. Query status

Continue waiting, read the result, or handle failure according to the response status. Polling should use intervals and a total deadline; do not make high-frequency continuous requests.

4. Get the result

After the task completes, read the result address or result object from the status response. Download and save it to your own storage; the validity period of result addresses depends on the actual response and model rules.

Failure handling

  • Parameter error: query model parameters, correct fields, and recreate.
  • Content rejection: adjust prompt or reference material.
  • Upstream failure: record task ID and request ID, retry a limited number of times after reasonable waiting.
  • Status unchanged for a long time: stop high-frequency polling and contact support with the task ID.
Do not directly repeat creation while the task status is unknown, to avoid duplicate videos and duplicate charges.

Task lifecycle

Python create example

Find the task ID from the actual response after creation. Different models or interface versions may have different wrapper layers; when integrating for the first time, save the full response first, then determine the parsing path.

Node.js query example

Use Node.js 18 or higher (built-in fetch). Find the actual task ID from the create response, set APIONE_VIDEO_TASK_ID, then query; it is different from the model ID and request trace ID. Use the same API Key that created the task when querying.
Save the JavaScript below as example.mjs. Run node example.mjs in the same terminal where this page’s environment variables are set. Node.js 18 or higher with built-in fetch requires no extra dependencies.

Polling strategy

The application should set fixed or gradually increasing intervals, and a maximum wait time. For example, wait a few seconds first, then reduce query frequency according to task duration. If the status response provides a suggested wait time, prefer that value. Polling code needs to handle: network failures, 429, 5xx, unknown statuses, user cancellation, page refresh, and service restart. Task IDs should be persisted; do not keep them only in browser memory.

Result download

After the task completes, first check whether the result object exists, then download the file. After downloading, verify HTTP status, file size, media type, actual duration, and decodability. If MOV is needed but the model only returns MP4, transcode in your own processing pipeline rather than just changing the extension.

Batch generation suggestions

  • Validate with a single request first, then gradually increase concurrency.
  • Use your own local ID and state machine for each business task.
  • Limit account-level concurrency to avoid media tasks crowding out text requests.
  • Record the model, parameter summary, cost, and result path for each task.
  • Classify failed tasks: parameters, content moderation, upstream, timeout, download failure.
Next: Media parameters, Request reliability, Troubleshooting.