Naar hoofdinhoud gaan
POST
/
kling
/
v1
/
audio
/
text-to-audio
Create a Kling text-to-audio task
curl --request POST \
  --url https://api.cometapi.com/kling/v1/audio/text-to-audio \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "prompt": "Soft ambient ocean waves at sunrise.",
  "duration": 5
}
'
{
  "code": 0,
  "message": "SUCCEED",
  "data": {
    "task_id": "861254119619698760",
    "task_status": "submitted",
    "task_info": {},
    "created_at": 1773367502225,
    "updated_at": 1773367502225
  }
}

Documentation Index

Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt

Use this file to discover all available pages before exploring further.

Gebruik dit endpoint om via Kling een korte audioclip te genereren op basis van een tekstprompt.

Voordat je het aanroept

  • Houd prompt beknopt en duidelijk
  • Begin met duration tussen 3 en 10 seconden
  • Beschouw callback_url en external_task_id als optionele integratiehulpen, niet als essentiële vereisten

Taakverloop

1

Dien de audiotaak in

Verstuur de tekstprompt en duur, en sla vervolgens de geretourneerde task id op.
2

Poll de taak

Ga verder met Individual Queries via het Kling-audioquerypad totdat de taak een eindstatus bereikt.
3

Sla de audio-output op

Bewaar het definitieve audio-item als je het nodig hebt buiten het leveringsvenster van de provider.
Zie voor de volledige parameterreferentie de officiële Kling-documentatie.

Autorisaties

Authorization
string
header
vereist

Bearer token authentication. Use your CometAPI key.

Body

application/json
prompt
string
standaard:Hello
vereist

Text prompt describing the audio to generate. Max 200 characters.

duration
integer
standaard:5
vereist

Duration of the generated audio in seconds. Range: 3.0–10.0, supports one decimal place.

external_task_id
string
standaard:audio-text-task-001

Optional user-defined task ID for your own tracking. Does not replace the system-generated task ID. Must be unique per account.

callback_url
string
standaard:https://example.com/webhook

Webhook URL for task status notifications. The server sends a callback when the task status changes.

Respons

200 - application/json

Task accepted.

code
integer
vereist

Error code; specific error code definition

message
string
vereist

Error message

data
object
vereist