Text to Video
POST /api/tasks/text2video
X-Api-Key: sk-live-xxxx
Content-Type: application/json
Idempotency-Key: optional, see below
Text to Video needs only a text description (prompt), with no images to prepare. The system generates entirely new footage based on the description.
How it differs from Image to Video and Reference to Video:
| Image to Video | Reference to Video | Text to Video | |
|---|---|---|---|
| API | POST /api/tasks/video-generation |
POST /api/tasks/reference2video |
POST /api/tasks/text2video |
| Images needed | 1, used as the first frame of the video | Depends on the model; used as a reference for how characters and scenes look | None, and you can't include any |
| What people look like | Follows the image | Follows the reference images | Appearance can only be described in text; you can't specify a particular person's face |
| Aspect ratio | Follows the image | Depends on the model | Set with aspect_ratio |
Task type (type) |
1 |
4 |
5 |
Text to Video has no input images, so it doesn't go through the Pre-generation Age Check and doesn't accept age_declared.
The credits actually charged are the credits value in the response. Videos are billed in 5-second billing units, and anything shorter than 5 seconds counts as 5 seconds. See Credits and Billing.
Supported models
| Model | Video length | Aspect ratio | Audio |
|---|---|---|---|
| YUYU_M6 | 5 or 10 seconds | 9:16, 16:9, 1:1, 3:4, 4:3, 2:3 (default 9:16) |
Not adjustable |
YUYU_M6 can also turn on prompt enhancement (prompt_enhance), which costs additional credits. See the model page for details.
Common parameters
For model-specific fields (such as duration and aspect_ratio), see each model's page.
| Field | Type | Required | Description |
|---|---|---|---|
model |
string | Yes | Currently only YUYU_M6 |
prompt |
string | Yes | Describes the footage, the people's appearance, and the action you want |
payload |
object | No | Custom data, such as your order number. The system never reads or modifies it, and returns it as-is when you query the task and in webhook notifications |
callback_url |
string | No | The URL to notify when the task finishes. Must start with https://, up to 2000 characters. See Callbacks (Webhook) |
If model is a model that doesn't exist, you get 422: Unknown model alias: {model}. Parameters not listed on a model's page (including images) return 422; they are not ignored.
Idempotency-Key
Prevents creating duplicate tasks. Send a custom string in this header. We recommend a value that never repeats in your system, such as an order number:
Idempotency-Key: order-20261021-00042
If you send the same request repeatedly within a short time with the same API key and the same Idempotency-Key, only one task is created and credits are charged only once. Subsequent duplicate requests return 200 OK with the original task.
Without this header, every request creates a new task.
Response and download
On success, you get 201 Created with the task data, and type is 5. For the data format, see Query Tasks and Download Results.
When the task completes, the video field in result is named video. Download it the same way as for Image to Video, using the url in files. You can also send callback_url to receive a completion notification via Callbacks (Webhook) instead.
Errors
| Status code | Cause | Response |
|---|---|---|
422 |
Invalid parameters, such as a missing prompt, a wrong type, including images, or aspect_ratio not one of the allowed values |
The errors field lists the reason for each field |
422 |
model is a model that doesn't exist |
{ "message": "Unknown model alias: {model}" } |
402 |
Not enough credits | { "message": "Insufficient credits to complete this charge." } |
429 |
Too many Text to Video tasks waiting in the queue | { "message": "Too many pending tasks of this type; please retry later." }. Use the Retry-After header in the response to decide when to retry |
For all error codes, see Error Reference.