Skip to main content
POST
cURL
使用此端点通过 Kling 根据文本提示生成一段简短的音频片段。

调用前准备

  • 保持 prompt 简洁直接
  • duration 初始设置在 3 到 10 秒之间
  • callback_urlexternal_task_id 视为可选的集成辅助参数,而非核心必需项

任务流程

1

提交音频任务

发送文本提示和时长,然后保存返回的任务 id。
2

轮询任务

继续使用 获取 Kling 任务,并通过 Kling 音频查询路径持续检查,直到任务进入终态。
3

保存音频输出

如果你需要在提供商交付窗口之外继续使用最终音频资源,请将其持久化存储。
有关完整的参数参考,请参阅 Kling 官方文档

授权

Authorization
string
header
必填

Bearer token authentication. Use your CometAPI key.

请求体

application/json
prompt
string
必填

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

duration
integer
必填

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.

响应

200 - application/json

Task accepted.

code
integer
必填

Error code; specific error code definition

message
string
必填

Error message

data
object
必填