The Kling text-to-video endpoint accepts a text prompt and asynchronously generates a video clip. Submit a task, receive a task_id and platform_id, then poll until the status reaches succeed. The request and response format matches the official Kling API exactly.
export TOKEN="oh-xxxxxxxxxxxxxxxx"
Authorization: Bearer <TOKEN>
Content-Type: application/json
Endpoint
POST https://aiapi.fhddos.com/kling/v1/videos/text2video
Request Parameters
| Parameter | Type | Required | Description |
|---|
model_name | string | No | Model to use (default: kling-v1). See supported models below. |
prompt | string | Yes | Text description of the video. Max 2500 characters. |
negative_prompt | string | No | Elements to exclude from the video. |
cfg_scale | number | No | Generation freedom [0, 1]. Only supported on kling-v1, kling-v1-5, kling-v1-6. |
mode | string | No | Generation quality: std (standard) or pro (professional). Default: std. |
sound | string | No | Generate audio: on or off. Only supported on kling-v2-6. |
camera_control | object | No | Camera motion configuration. See Camera Control below. |
aspect_ratio | string | No | Output aspect ratio: 16:9, 9:16, or 1:1. Default: 16:9. |
duration | string | No | Video length in seconds: "5" or "10". Default: "5". |
watermark_info | object | No | Watermark settings. |
callback_url | string | No | Webhook URL for status notifications. |
external_task_id | string | No | Your own task ID for idempotency and business correlation. |
Supported Models
| Model | Notes |
|---|
kling-v1 | Baseline, widely compatible |
kling-v1-5 | Improved quality |
kling-v1-6 | Supports multi-image reference and multimodal editing |
kling-v2-master | Advanced video generation |
kling-v2-1 | Professional generation |
kling-v2-1-master | Professional with enhanced quality |
kling-v2-5 | Latest generation |
kling-v2-5-turbo | Latest generation, faster |
kling-v2-6 | Audio and motion control support |
Camera Control
The camera_control object configures how the camera moves throughout the video:
{
"camera_control": {
"type": "simple",
"config": {
"horizontal": 5
}
}
}
type Value | Description |
|---|
simple | Custom single-axis motion — requires config |
down_back | Camera moves down and backward |
forward_up | Camera moves forward and upward |
right_turn_forward | Pan right while moving forward |
left_turn_forward | Pan left while moving forward |
When type is simple, the config object may contain exactly one non-zero field:
| Field | Range | Axis |
|---|
horizontal | [-10, 10] | Left–right pan |
vertical | [-10, 10] | Up–down tilt |
pan | [-10, 10] | Camera rotation around vertical axis |
tilt | [-10, 10] | Camera rotation around horizontal axis |
roll | [-10, 10] | Camera rotation around depth axis |
zoom | [-10, 10] | Zoom in/out |
When type is simple, only one config field may be non-zero. Setting multiple non-zero fields will cause the request to fail.
Examples
Simple Text-to-Video
curl --request POST \
--url https://aiapi.fhddos.com/kling/v1/videos/text2video \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model_name": "kling-v1",
"prompt": "A man picks up a book and reads with a focused expression",
"mode": "std",
"duration": "5",
"aspect_ratio": "16:9"
}'
Response:
{
"code": 0,
"message": "success",
"request_id": "req_1735558800_abc123",
"data": {
"task_id": "task_01JGHK...",
"task_status": "submitted",
"created_at": 1735558800000,
"updated_at": 1735558800000
}
}
With Camera Motion
Use a preset camera movement with kling-v2-master in pro mode:
curl --request POST \
--url https://aiapi.fhddos.com/kling/v1/videos/text2video \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model_name": "kling-v2-master",
"prompt": "Sunset over mountains, golden light spreading across valleys",
"mode": "pro",
"duration": "10",
"aspect_ratio": "16:9",
"camera_control": {
"type": "forward_up"
}
}'
Custom Camera Axis (Simple Mode)
Control a single camera axis with a numeric value:
curl --request POST \
--url https://aiapi.fhddos.com/kling/v1/videos/text2video \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model_name": "kling-v1-6",
"prompt": "A timelapse of clouds rolling over a city skyline",
"mode": "std",
"duration": "5",
"camera_control": {
"type": "simple",
"config": {
"horizontal": 5
}
}
}'
Audio Generation (kling-v2-6)
Generate a video with synchronized audio using the latest model:
curl --request POST \
--url https://aiapi.fhddos.com/kling/v1/videos/text2video \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model_name": "kling-v2-6",
"prompt": "A calm ocean scene with gentle waves and seagulls in the distance",
"mode": "std",
"duration": "5",
"aspect_ratio": "16:9",
"sound": "on"
}'
With External Task ID (Idempotency)
Pass your own external_task_id to safely retry submissions:
curl --request POST \
--url https://aiapi.fhddos.com/kling/v1/videos/text2video \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model_name": "kling-v1",
"prompt": "A fox running through an autumn forest",
"mode": "std",
"duration": "5",
"external_task_id": "my-video-job-001"
}'
Task Status
| Status | Description |
|---|
submitted | Task accepted and queued |
processing | Video is being generated |
succeed | Video is ready — check task_result for the URL |
failed | Generation failed — check task_status_msg for the reason |
Polling for Completion
Query the task status using the task_id from the creation response:
curl "https://aiapi.fhddos.com/kling/v1/videos/text2video/$TASK_ID" \
-H "Authorization: Bearer $TOKEN"
When task_status is succeed, the response will include a task_result.videos array with the video URL and duration.
For full response field documentation, see Task Query.
Constraints Summary
prompt must be 2500 characters or fewer
cfg_scale is only supported on kling-v1, kling-v1-5, and kling-v1-6 — not on kling-v2 series
sound is only supported on kling-v2-6
camera_control.type = simple requires exactly one non-zero field in config