Skip to main content
POST
/
kling
/
v1
/
audio
/
text-to-audio
cURL
curl https://api.cometapi.com/kling/v1/audio/text-to-audio \
  -H "Authorization: Bearer $COMETAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
      "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
  }
}
Use this endpoint to generate a short audio clip from a text prompt through Kling.

Before you call it

  • Keep prompt concise and direct
  • Start with duration between 3 and 10 seconds
  • Treat callback_url and external_task_id as optional integration helpers, not core requirements

Task flow

1

Submit the audio task

Send the text prompt and duration, then save the returned task id.
2

Poll the task

Continue with Get a Kling task using the Kling audio query path until the task reaches a terminal state.
3

Store the audio output

Persist the final audio asset if you need it beyond the provider delivery window.
For the complete parameter reference, see the official Kling documentation.

Authorizations

Authorization
string
header
required

Bearer token authentication. Use your CometAPI key.

Body

application/json
prompt
string
required

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

duration
integer
required

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

external_task_id
string

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

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

Response

200 - application/json

Task accepted.

code
integer
required

Error code; specific error code definition

message
string
required

Error message

data
object
required