跳转到主要内容
POST
/
kling
/
v1
/
audio
/
video-to-audio
Create a Kling video-to-audio task
curl --request POST \
  --url https://api.cometapi.com/kling/v1/audio/video-to-audio \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "video_url": "https://xxxxx.mp4"
}
'
{
  "code": 123,
  "message": "<string>",
  "data": {
    "task_id": "<string>",
    "task_status": "<string>",
    "created_at": 123,
    "updated_at": 123
  }
}
使用此端点可根据源视频生成音频结果。

调用前须知

  • 发送 video_idvideo_url 其中之一,但不要同时发送两者
  • 当源片段并非最初来自 Kling 时,请使用 video_url
  • 除非你的集成需要,否则请将 callback_urlexternal_task_id 保持为可选

任务流程

1

提交源视频

发送 Kling 的 video_id 或可访问的 video_url,然后保存返回的任务 id。
2

轮询任务

继续使用 Kling 音频查询路径访问单条查询,直到任务进入终态。
3

持久化输出

如果你需要稳定保存或进行下游处理,请存储最终的音频资产。
完整参数参考请参阅官方 Kling 文档

授权

Authorization
string
header
必填

Bearer token authentication. Use your CometAPI key.

请求体

application/json
video_id
string
默认值:861034216165875784
必填

ID of a Kling-generated video. Only videos created within the last 30 days with a duration of 3–20 seconds are supported. Mutually exclusive with video_url — exactly one must be provided.

external_task_id
string
默认值:audio-video-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
默认值:https://example.com/webhook

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

video_url
string
默认值:http://runwaycdn.rixapi.com/attachments/video/runway/20241015/82bc23c83b5c32e75059c8328df5cffb.mp4

Accessible URL of the source video. Accepted formats: MP4, MOV. Max 100 MB, 720p or 1080p resolution, duration 3–20 seconds. Mutually exclusive with video_id — exactly one must be provided.

响应

200 - application/json

Task accepted.

code
integer
必填

Error code; specific error code definition

message
string
必填

Error message

data
object
必填