Platform notice: all DeepSeek models are now live. New users receive trial credits on sign-up.
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

HeaderRequiredDescription
AuthorizationYesBearer sk-tp-..., create an API Key in the console
Content-TypeYesapplication/json

1. Create a subject

POST /api/v1/subject/create
ParameterTypeRequiredDescription
element_namestringYesSubject name, ≤ 20 chars
element_descriptionstringYesSubject description, ≤ 100 chars
reference_typestringYesimage_refer or video_refer
element_image_listobjectConditional{ "frontal_image": "...", "refer_images": [{ "image_url": "..." }] }; 1 frontal + 1–3 reference images, jpg / png, ≤ 10 MB, short side ≥ 300 px
element_video_listobjectConditional{ "refer_videos": [{ "video_url": "..." }] }; MP4 / MOV, 3–8 s, 1080P, ≤ 200 MB; a video with sound automatically triggers voice customization
element_voice_idstringNoAssociate an existing voice ID
tag_listarrayNoTags such as [{ "tag_id": "o_101" }]
callback_urlstringNoTask status callback URL
external_task_idstringNoYour own task ID for reconciliation
{ "task_id": "1234567890" }

2. Query a subject

POST /api/v1/subject/query
ParameterTypeRequiredDescription
task_idstringEitherTask ID returned by create
external_task_idstringEitherThe custom task ID passed at creation
{
  "task_id": "1234567890",
  "task_status": "succeed",
  "task_result": {
    "elements": [
      {
        "element_id": "987654",
        "element_name": "Hero A",
        "reference_type": "image_refer",
        "element_voice_info": { "voice_id": "v-1", "voice_name": "Hero A voice", "trial_url": "https://example.com/trial.mp3" },
        "status": "succeed"
      }
    ]
  }
}

task_status values: submitted / processing / succeed / failed; the failure reason is in task_status_msg.

3. Create a custom voice

POST /api/v1/custom-voice/create
ParameterTypeRequiredDescription
voice_namestringYesVoice name, ≤ 20 chars
voice_urlstringEitherAudio or video URL: mp3 / wav / mp4 / mov, 5–30 s, single clean speaker
video_idstringEitherExisting video ID (strictly mutually exclusive with voice_url)
callback_urlstringNoTask status callback URL
external_task_idstringNoYour own task ID
{ "task_id": "1234567891" }

4. Query a custom voice

POST /api/v1/custom-voice/query
ParameterTypeRequiredDescription
task_idstringEitherTask ID returned by create
external_task_idstringEitherThe custom task ID passed at creation
{
  "task_id": "1234567891",
  "task_status": "succeed",
  "task_result": {
    "voices": [{ "voice_id": "v-1", "voice_name": "Hero A voice", "trial_url": "https://example.com/trial.mp3" }]
  }
}

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_id are available once task_status is succeed.
  • 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_id has not been verified.

Errors

StatusDescription
400Invalid parameters: missing required fields, both voice_url and video_id sent, invalid assets
401API Key invalid or revoked (including parents)
404Task not found
429Rate limited, retry later
503No direct Kling channel configured, or the channel is degraded

On this page

OpenRuler