Bach Video Generation
Bach Video Generation
Bach video generation API generates high-quality videos from text, keyframes, or reference assets. It is suited for content creation, film previews, brand promotion, e-commerce advertising, and other scenarios requiring flexible control over visuals and style.
Three generation modes are currently supported (specified by input.task):
- Text to Video (
t2v): Generate a video directly from a text description; this is the default whentaskis omitted - First/Last Frame (
i2v): Specify the opening and/or closing frame to generate a smoothly transitioned video - Multimodal Reference (
r2v): Combine image, video, and audio references to preserve visual subjects, camera rhythm, and sound atmosphere
Reference assets must be publicly accessible HTTP/HTTPS URLs. Base64 is not supported.
- Base URL:
https://api-gen-na.bach.art/api/vdr - Authentication: API Key (Bearer Token). Include
Authorization: Bearer <API_KEY>in the request header
Create Generation Task
Endpoint Information
- Protocol: HTTPS
- Request Path:
/video/v2 - Request Method: POST
- Request Format: application/json
- Response Format: application/json
Request Headers
Content-Type
Type: string | Required: Yes | Default: None
Data exchange format.
- Fixed value:
application/json
Authorization
Type: string | Required: Yes | Default: None
Authentication information, Bearer Token scheme.
- Format:
Bearer <API_KEY> - [Note] There is a single space between
Bearerand<API_KEY>.
Request Body
model_name
Type: string | Required: Yes
Set the model name which is used to generate the video.
enhance_prompt
Type: bool | Required: No | Default: true
Whether to enhance the prompt.
When true: the prompt is enhanced
When false: the prompt is not enhanced
callback_url
Type: string | Required: No | Default: None
Callback URL notified with the result of this task
- Must be a valid HTTP or HTTPS URL.
- Must not exceed 500 characters.
- If configured, the server proactively sends notifications whenever the task status changes.
input
Type: object | Required: Yes | Default: None
Video generation parameters.
- For the structure, see
inputProperties below.
input Properties
task
Type: string | Required: No | Default: t2v
Generation mode. Enum values: t2v, i2v, r2v.
prompt
Type: string | Required: Yes | Default: None
Positive text prompt, i.e., the description of the video content.
- Must not exceed 6,500 characters.
duration
Type: integer | Required: No | Default: 8
Duration of the generated video, in seconds (s).
Value range: 5 ~ 15.
generate_audio
Type: bool | Required: No | Default: false
Whether to generate audio along with the video.
- When
true: synchronized audio generation is enabled - When
false: synchronized audio generation is disabled
aspect_ratio
Type: string | Required: No | Default: See description
Aspect ratio of the generated video (width:height).
Enum values: 16:9, 9:16, 1:1, auto.
- Text to Video (
t2v), Multimodal Reference (r2v): defaults to16:9when omitted. - First/Last Frame (
i2v): fixed toauto.
resolution
Type: string | Required: No | Default: 720p
Output resolution.
Enum values: 720p, 1080p.
seed
Type: integer | Required: No | Default: None
Random seed.
Value range: 1 ~ 100000.
image_url
Type: string | Required: Conditionally required | Default: None
First-frame image URL, the starting reference frame of the generated video.
- Used only in
i2v. - Must be a publicly accessible HTTP/HTTPS URL.
- [Note] If
end_image_urlis not provided,image_urlis required.
end_image_url
Type: string | Required: Conditionally required | Default: None
Last-frame image URL, the closing target frame of the generated video.
- Used only in
i2v. - Must be a publicly accessible HTTP/HTTPS URL.
- [Note] If
image_urlis not provided,end_image_urlis required; when both are provided, the video generates a natural transition between the first and last frames.
reference_inputs
Type: array | Required: Conditionally required | Default: None
Reference assets.
- Used only in
r2v. - For the item structure, see
reference_inputsItems below.
[Important] Prompt references (
r2v) Use@Image1/@Video1/@Audio1to reference the items inreference_inputsin the order the assets appear.
<a id="reference_inputs-items"></a>
reference_inputs Items
type
Type: string | Required: Yes | Default: None
Asset type.
Enum values: image / video / audio.
url
Type: string | Required: Yes | Default: None
Asset URL.
- Must be a publicly accessible HTTP/HTTPS URL.
[Important] Multimodal Reference (
r2v)
reference_inputsmust not be empty- Optional
start_time(in seconds, ≥ 0)
Request Examples
Text to Video (t2v)
curl --location --request POST 'https://api-gen-na.bach.art/api/vdr/video/v2' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"model_name": "$PREFERRED_MODEL_NAME",
"enhance_prompt": true,
"input": {
"task": "t2v",
"prompt": "A cinematic daytime street scene.",
"duration": 8,
"generate_audio": false,
"seed": 1101,
"aspect_ratio": "16:9",
"resolution": "720p"
}
}'
First/Last Frame (i2v)
curl --location --request POST 'https://api-gen-na.bach.art/api/vdr/video/v2' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"model_name": "$PREFERRED_MODEL_NAME",
"input": {
"task": "i2v",
"prompt": "Continue naturally between the endpoint frames.",
"duration": 8,
"generate_audio": false,
"seed": 1101,
"image_url": "https://example.com/first.png",
"end_image_url": ""
}
}'
Multimodal Reference (r2v)
curl --location --request POST 'https://api-gen-na.bach.art/api/vdr/video/v2' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"model_name": "$PREFERRED_MODEL_NAME",
"input": {
"task": "r2v",
"prompt": "Use @Video1 as motion reference and @Audio1 as audio reference.",
"duration": 8,
"seed": 1101,
"reference_inputs": [
{ "type": "video", "url": "https://example.com/input.mp4" },
{ "type": "audio", "url": "https://example.com/reference.mp3" }
]
}
}'
Response Body
{
"code": 200, // Status code; 200 on success, non-200 on failure — see message for details
"data": {
"task_id": "550e8400-e29b-41d4-a716-446655440000", // Task ID, used to query the result
"status": "TASK_PENDING", // Task status; for enum values see "Task Status Enum Values"
"created_at": 1778313600 // Task creation time, Unix timestamp, in seconds
},
"timestamp": 1778313600 // Response time, Unix timestamp, in seconds
}
code
Type: integer
Status code. 200 on success; non-200 on failure, with the specific reason in message.
message
Type: string
Result description. Typically omitted on success (code: 200).
task_id
Type: string
Task ID, used to query the result.
status
Type: string
Task status; for enum values see Task Status Enum Values.
created_at
Type: number
Task creation time, Unix timestamp, in seconds.
timestamp
Type: number
Response time, Unix timestamp, in seconds.
Query Task (Single)
Endpoint Information
- Protocol: HTTPS
- Request Path:
/video/v2/{task_id} - Request Method: GET
- Request Format: application/json
- Response Format: application/json
Queries the processing progress and result of the specified task. On successful generation, the video download URL is returned.
Request Headers
Content-Type
Type: string | Required: Yes | Default: None
Data exchange format.
- Fixed value:
application/json
Authorization
Type: string | Required: Yes | Default: None
Authentication information, Bearer Token scheme.
- Format:
Bearer <API_KEY> - [Note] There is a single space between
Bearerand<API_KEY>.
Path Parameters
task_id
Type: string | Required: Yes | Default: None
The task ID returned when the task was created.
- [Note] This is a path parameter; place the value directly in the request path.
Request Example
curl --location --request GET 'https://api-gen-na.bach.art/api/vdr/video/v2/550e8400-e29b-41d4-a716-446655440000' \
--header 'Authorization: Bearer YOUR_API_KEY'
Response Body
{
"code": 200, // Status code; 200 on success
"data": {
"task_id": "550e8400-e29b-41d4-a716-446655440000", // Task ID
"status": "TASK_SUCCEEDED", // Task status; for enum values see "Task Status Enum Values"
"created_at": 1778313600, // Task creation time, Unix timestamp, in seconds
"started_at": 1778313610, // Processing start time, Unix timestamp, in seconds
"completed_at": 1778313700, // Completion time, Unix timestamp, in seconds
"video_url": "https://example.com/result.mp4", // Download URL of the generated video; returned only when status is TASK_SUCCEEDED
"usage": { // Usage; returned only in terminal states
"video_output": 5 // Duration of this video in seconds; equals the duration at creation on success, 0 on failure
}
},
"timestamp": 1778313700 // Response time, Unix timestamp, in seconds
}
task_id
Type: string
Task ID.
status
Type: string
Task status; for enum values see Task Status Enum Values.
created_at
Type: number
Task creation time, Unix timestamp, in seconds.
started_at
Type: number
Processing start time, Unix timestamp, in seconds.
completed_at
Type: number
Completion time, Unix timestamp, in seconds.
video_url
Type: string
Download URL of the generated video.
- [Note] Returned only when the status is
TASK_SUCCEEDED.
usage
Type: object
Usage.
- Returned only in terminal states.
video_outputis the duration of this video in seconds; it equals thedurationspecified at creation on success, and0on failure.
Task Status Enum Values
TASK_PENDING: Task submitted, awaiting processingTASK_PROCESSING: Task is being processedTASK_SUCCEEDED: Video generated successfullyTASK_FAILED: Video generation failed
Appendix: Authentication and Token Generation
All API requests must include Authorization in the request header.
Authorization: Bearer <API_TOKEN>
API_TOKEN is generated from an AccessKey and a SecretKey. The JWT uses the HS256 signing algorithm and follows the RFC 7519 standard.
Generating a Token
The following example is written in Python and demonstrates how to generate an API Token using the industry-standard JWT Bearer Token approach.
# Python example: generate a JWT Bearer Token
import jwt
from datetime import datetime, timedelta
ak = "" # Enter your AccessKey
sk = "" # Enter your SecretKey
def generate_token(ak: str, sk: str) -> str:
now = datetime.now()
headers = {
"alg": "HS256",
"typ": "JWT",
}
payload = {
"iss": ak,
"nbf": int((now - timedelta(seconds=5)).timestamp()),
"exp": int((now + timedelta(days=10)).timestamp()),
}
return jwt.encode(payload, sk.encode("utf-8"), headers=headers)
api_token = generate_token(ak, sk)
print(api_token)
Security Recommendations
- Never expose your
SecretKeyin browsers, mobile clients, or public repositories. - Generate the Token on your server side, and have the server make requests to the Bach API.
- If authentication fails, first check whether the Token has expired, whether the signature is correct, and whether there is a single space between
Bearerand the Token.
- Version: v2.0
- Last Updated: 2026-09-04
- © 2026 Video Rebirth team. All rights reserved.