Task: Text-to-Video
Overview
- Method:
POST - Path:
/kling/v1/videos/text2video - Content-Type:
application/json
Authentication
- HTTP Bearer:
Authorization: Bearer <token>
Request Parameters
Body Parameters (JSON)
| Parameter | Type | Required | Description |
|---|---|---|---|
| prompt | string | Yes | Positive text prompt, max 2500 characters |
| negative_prompt | string | No | Negative text prompt, max 2500 characters |
| aspect_ratio | string | No | Aspect ratio, enum: 16:9, 9:16, 1:1 |
| callback_url | string | No | Result callback URL |
| cfg_scale | number | No | Creativity scale, range [0,1] |
| mode | string | No | Video mode, enum: std (standard), pro (high quality, costs 3.5x) |
| camera_control | object | No | Camera control settings, includes type/config |
| duration | string | No | Video duration in seconds, enum: 5, 10 |
| model_name | string | No | Model version, enum: kling-v1, kling-v1-5, kling-v1-6, kling-v2-master, kling-v2-1-master, kling-v2-5-turbo |
Example Request
curl Example
bash
curl -X POST "https://api.gpt.ge/kling/v1/videos/text2video" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxx" \
-d '{
"model_name": "kling-v1-6",
"prompt": "A 20-year-old woman with an oval face, delicate features, long black hair, fair skin, atmospheric lighting, wearing a white short dress, sitting on a bench by the street, smiling, flipping her hair",
"mode": "std",
"aspect_ratio": "1:1",
"duration": "5"
}'JavaScript (fetch) Example
javascript
fetch('https://api.gpt.ge/kling/v1/videos/text2video', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer sk-xxxx'
},
body: JSON.stringify({
model_name: 'kling-v1-6',
prompt: 'A 20-year-old woman with an oval face, delicate features, long black hair, fair skin, atmospheric lighting, wearing a white short dress, sitting on a bench by the street, smiling, flipping her hair',
mode: 'std',
aspect_ratio: '1:1',
duration: '5'
})
}).then(r => r.json()).then(console.log)Python Example (requests)
python
import requests
resp = requests.post(
'https://api.gpt.ge/kling/v1/videos/text2video',
headers={
'Content-Type': 'application/json',
'Authorization': 'Bearer sk-xxxx'
},
json={
'model_name': 'kling-v1-6',
'prompt': 'A 20-year-old woman with an oval face, delicate features, long black hair, fair skin, atmospheric lighting, wearing a white short dress, sitting on a bench by the street, smiling, flipping her hair',
'mode': 'std',
'aspect_ratio': '1:1',
'duration': '5'
}
)
print(resp.json())Response Fields
200 Success
| Field | Type | Description |
|---|---|---|
| code | integer | Return code, 0 indicates success |
| message | string | Return message |
| request_id | string | Unique request ID |
| data.task_id | string | Task ID |
| data.task_status | string | Task status, e.g. submitted |
| data.created_at | integer | Creation timestamp |
| data.updated_at | integer | Update timestamp |
| data.task_result.images | array | Result image list |
| data.task_result.videos | null | Video results (empty) |
Response Example
json
{
"code": 0,
"message": "SUCCEED",
"request_id": "CmYgjmbyMToAAAAAAF6svw",
"data": {
"task_id": "CmYgjmbyMToAAAAAAF6svw",
"task_status": "submitted",
"created_at": 1727338013674,
"updated_at": 1727338013674
}
}