Skip to content

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)

ParameterTypeRequiredDescription
promptstringYesPositive text prompt, max 2500 characters
negative_promptstringNoNegative text prompt, max 2500 characters
aspect_ratiostringNoAspect ratio, enum: 16:9, 9:16, 1:1
callback_urlstringNoResult callback URL
cfg_scalenumberNoCreativity scale, range [0,1]
modestringNoVideo mode, enum: std (standard), pro (high quality, costs 3.5x)
camera_controlobjectNoCamera control settings, includes type/config
durationstringNoVideo duration in seconds, enum: 5, 10
model_namestringNoModel 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

FieldTypeDescription
codeintegerReturn code, 0 indicates success
messagestringReturn message
request_idstringUnique request ID
data.task_idstringTask ID
data.task_statusstringTask status, e.g. submitted
data.created_atintegerCreation timestamp
data.updated_atintegerUpdate timestamp
data.task_result.imagesarrayResult image list
data.task_result.videosnullVideo 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
  }
}