Api reference
Subjects and custom voices (Kling)
Create and query Kling subjects and custom voices to keep characters and voices consistent in video generation.
🧭 Not live yet. The endpoints open once a direct Kling channel is configured in the console. The contract below is final, so you can integrate ahead of time.
Same API Key authentication as chat / video. Creation is asynchronous: you get a task_id and poll the query endpoint for the result.
Authentication
| Header | Required | Description |
|---|---|---|
| Authorization | Yes | Bearer sk-tp-..., create an API Key in the console |
| Content-Type | Yes | application/json |
1. Create a subject
| Parameter | Type | Required | Description |
|---|---|---|---|
| element_name | string | Yes | Subject name, ≤ 20 chars |
| element_description | string | Yes | Subject description, ≤ 100 chars |
| reference_type | string | Yes | image_refer or video_refer |
| element_image_list | object | Conditional | { "frontal_image": "...", "refer_images": [{ "image_url": "..." }] }; 1 frontal + 1–3 reference images, jpg / png, ≤ 10 MB, short side ≥ 300 px |
| element_video_list | object | Conditional | { "refer_videos": [{ "video_url": "..." }] }; MP4 / MOV, 3–8 s, 1080P, ≤ 200 MB; a video with sound automatically triggers voice customization |
| element_voice_id | string | No | Associate an existing voice ID |
| tag_list | array | No | Tags such as [{ "tag_id": "o_101" }] |
| callback_url | string | No | Task status callback URL |
| external_task_id | string | No | Your own task ID for reconciliation |
2. Query a subject
| Parameter | Type | Required | Description |
|---|---|---|---|
| task_id | string | Either | Task ID returned by create |
| external_task_id | string | Either | The custom task ID passed at creation |
task_status values: submitted / processing / succeed / failed; the failure reason is in task_status_msg.
3. Create a custom voice
| Parameter | Type | Required | Description |
|---|---|---|---|
| voice_name | string | Yes | Voice name, ≤ 20 chars |
| voice_url | string | Either | Audio or video URL: mp3 / wav / mp4 / mov, 5–30 s, single clean speaker |
| video_id | string | Either | Existing video ID (strictly mutually exclusive with voice_url) |
| callback_url | string | No | Task status callback URL |
| external_task_id | string | No | Your own task ID |
4. Query a custom voice
| Parameter | Type | Required | Description |
|---|---|---|---|
| task_id | string | Either | Task ID returned by create |
| external_task_id | string | Either | The custom task ID passed at creation |
Usage
Pass element_id / voice_id to Kling video generation to keep the character and voice consistent.
Limits and notes
- Creation is asynchronous;
element_id/voice_idare available oncetask_statusissucceed. - The platform does not bill these endpoints today; the upstream may charge per call.
- Compatibility with Kling video models is decided upstream; our Kling video path currently goes through the haoee proxy, and whether it accepts
element_id/voice_idhas not been verified.
Errors
| Status | Description |
|---|---|
| 400 | Invalid parameters: missing required fields, both voice_url and video_id sent, invalid assets |
| 401 | API Key invalid or revoked (including parents) |
| 404 | Task not found |
| 429 | Rate limited, retry later |
| 503 | No direct Kling channel configured, or the channel is degraded |