Text to Video
Text to Video API
Description
The Text to Video API generates videos directly from text prompts. Use prompt to describe the main subject, scene atmosphere, camera movement, and visual style, and use parameters such as duration, resolution, aspect_ratio, and fps to control the output video's length, quality, aspect ratio, and frame rate. This endpoint is ideal for quickly turning creative scripts, ad concepts, story fragments, or visual treatments into playable video content.
Use Cases
- Quickly generate video drafts from text ideas, storyboard descriptions, or marketing scripts.
- Explore visual styles and camera effects directly through prompts, without any image assets.
- Generate short video assets for product promotion, social media content, proof-of-concept, and creative pitches.
Endpoint Information
| Item | Description |
|---|---|
| Create task | POST /videos/text2video |
| Query task | GET /videos/text2video/{task_id} |
| Authentication | Bearer Token |
The full request URL consists of the base URL and the endpoint path; see API Basics.
Create Task
Request Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model_name | string | Yes | - | Model name. bach-1.0-preview is recommended |
prompt | string | Yes | - | Video content description, up to 10,000 characters |
negative_prompt | string | No | - | Content you do not want to appear in the video, up to 10,000 characters |
resolution | string | Yes | - | Output resolution. Allowed values: 720p, 1080p |
aspect_ratio | string | No | 16:9 | Aspect ratio. Allowed values: 16:9, 9:16, 1:1 |
duration | integer | No | 6 | Video duration, range 1-6 seconds |
fps | integer | No | 30 | Video frame rate. Allowed values: 24, 30 |
cfg_scale | number | No | 5.0 | Prompt guidance strength, range 1.0-15.0 |
enhance_prompt | boolean | No | true | Whether to enable prompt enhancement |
generate_audio | boolean | No | false | Whether to generate audio |
audio_prompt | string | No | - | Audio description, up to 200 characters; only effective when generate_audio=true |
callback_url | string | No | - | Callback URL invoked when the task completes; must be an HTTP/HTTPS URL, up to 500 characters |
seed | integer | No | - | Random seed, range 0-10000000; if omitted, handled by the system |
Constraints:
promptis required;resolutiononly supports720pand1080p;durationsupports1-6seconds;fpsonly supports24and30.
Request Example
bash
Copycurl -X POST '<BASE_URL>/videos/text2video' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <API_TOKEN>' \
-d '{
"model_name": "bach-1.0-preview",
"prompt": "Sunset over the sea, golden light spilling across the water, camera slowly pushing forward, cinematic look",
"negative_prompt": "blurry, low quality, distorted frames",
"resolution": "1080p",
"aspect_ratio": "16:9",
"duration": 6,
"fps": 30,
"generate_audio": false
}'
Success Response
json
Copy{
"code": 200,
"data": {
"task_id": "550e8400-e29b-41d4-a716-446655440000",
"created_at": 1778313600,
"status": "TASK_PENDING"
},
"timestamp": 1778313600
}
| Field | Type | Description |
|---|---|---|
task_id | string | Task ID, used to query the result |
created_at | number | Task creation time, Unix timestamp in seconds |
status | string | Task status; see Task Status |
Query Task
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
task_id | string | Yes | Task ID returned by the create-task endpoint |
Request Example
bash
Copycurl -X GET '<BASE_URL>/videos/text2video/550e8400-e29b-41d4-a716-446655440000' \
-H 'Authorization: Bearer <API_TOKEN>'
Success Response
json
Copy{
"code": 200,
"data": {
"task_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "TASK_SUCCEEDED",
"created_at": 1778313600,
"started_at": 1778313610,
"completed_at": 1778313700,
"video_url": "https://example.com/result.mp4"
},
"timestamp": 1778313700
}
| Field | Type | Description |
|---|---|---|
task_id | string | Task ID |
status | string | Task status; see Task Status |
created_at | number | Task creation time, Unix timestamp in seconds |
started_at | number | Time the task started processing, Unix timestamp in seconds |
completed_at | number | Task completion time, Unix timestamp in seconds |
video_url | string | Generated video URL |
Notes
- Text to Video requires no image input; if you want to generate a video from an existing image, use the Image to Video API.
- We recommend that
promptinclude the subject, action, scene, camera, and style; the clearer the description, the more stable the results. - If you need a task completion notification, pass a
callback_url— see Using Callbacks for the callback protocol; otherwise, retrieve the task status via the query endpoint.
Related Documents
On this page