Skip to main content
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.

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 Individual Queries 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
default:Hello
required

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

duration
integer
default:5
required

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

external_task_id
string
default: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
default:https://example.com/webhook

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