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

ItemDescription
Create taskPOST /videos/text2video
Query taskGET /videos/text2video/{task_id}
AuthenticationBearer Token

The full request URL consists of the base URL and the endpoint path; see API Basics.

Create Task

Request Parameters

ParameterTypeRequiredDefaultDescription
model_namestringYes-Model name. bach-1.0-preview is recommended
promptstringYes-Video content description, up to 10,000 characters
negative_promptstringNo-Content you do not want to appear in the video, up to 10,000 characters
resolutionstringYes-Output resolution. Allowed values: 720p, 1080p
aspect_ratiostringNo16:9Aspect ratio. Allowed values: 16:9, 9:16, 1:1
durationintegerNo6Video duration, range 1-6 seconds
fpsintegerNo30Video frame rate. Allowed values: 24, 30
cfg_scalenumberNo5.0Prompt guidance strength, range 1.0-15.0
enhance_promptbooleanNotrueWhether to enable prompt enhancement
generate_audiobooleanNofalseWhether to generate audio
audio_promptstringNo-Audio description, up to 200 characters; only effective when generate_audio=true
callback_urlstringNo-Callback URL invoked when the task completes; must be an HTTP/HTTPS URL, up to 500 characters
seedintegerNo-Random seed, range 0-10000000; if omitted, handled by the system

Constraints: prompt is required; resolution only supports 720p and 1080p; duration supports 1-6 seconds; fps only supports 24 and 30.

Request Example

bash
Copy
curl -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
}
FieldTypeDescription
task_idstringTask ID, used to query the result
created_atnumberTask creation time, Unix timestamp in seconds
statusstringTask status; see Task Status

Query Task

Path Parameters

ParameterTypeRequiredDescription
task_idstringYesTask ID returned by the create-task endpoint

Request Example

bash
Copy
curl -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
}
FieldTypeDescription
task_idstringTask ID
statusstringTask status; see Task Status
created_atnumberTask creation time, Unix timestamp in seconds
started_atnumberTime the task started processing, Unix timestamp in seconds
completed_atnumberTask completion time, Unix timestamp in seconds
video_urlstringGenerated 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 prompt include 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.
Previous
Error Codes
Next
Image to Video
On this page
Text to Video | bach.art | bach.art