- Get Started
- Endpoints
- Song(Udio)
- Kling
- Hailuo
- Flux
- AI Hug
- LLM
- Midjourney
- Faceswap
- TTS
- Trellis
- Luma Dream Machine
- WanX
- Skyreels
- Framepack
- Hunyuan Video
- Mmaudio
- DiffRhythm
- Ace Step
- Tools
- PiAPI Account Management
- Resources
- Legacy Documentation
Kling Sound
POST
https://api.piapi.ai/api/v1/task
Request
Header Params
x-api-key
string
required
Body Params application/json
model
enum<string>
required
kling
Allowed value:
kling
Default:
kling
task_type
enum<string>
required
sound
Allowed value:
sound
Default:
effects
input
object
required
prompt
string
optional
duration
enum<integer>
optional
Allowed values:
510
Default:
10
origin_task_id
string
optional
config
object
optional
webhook_config
object
optional
service_mode
enum<string>
optional
the user chose on the workspace setting of your account.
public
means this task will be processed under PAYG mode.private
means this task will be processed under HYA mode.Allowed values:
publicprivate
Examples
{
"model": "kling",
"task_type": "sound",
"input": {
"prompt": "The audio contains the sound of a lively violin playing a marching tune.",
"duration": 10
},
"config": {
"service_mode": "public",
"webhook_config": {
"endpoint": "https://webhook.site/29649907-dab6-40f5-b059-b11b7a81fec1",
"secret": ""
}
}
}
Request samples
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
cURL
curl --location --request POST 'https://api.piapi.ai/api/v1/task' \
--header 'x-api-key;' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "kling",
"task_type": "sound",
"input": {
"prompt": "The audio contains the sound of a lively violin playing a marching tune.",
"duration": 10
},
"config": {
"service_mode": "public",
"webhook_config": {
"endpoint": "https://webhook.site/29649907-dab6-40f5-b059-b11b7a81fec1",
"secret": ""
}
}
}'
Responses
🟢200Success
application/json
Body
object {0}
Example
{
"timestamp": 1751439504,
"data": {
"task_id": "f8dacb0f-c786-4f8a-beb2-d435a343c928",
"model": "kling",
"task_type": "sound",
"status": "completed",
"config": {
"service_mode": "public",
"webhook_config": {
"endpoint": "https://webhook.site/29649907-dab6-40f5-b059-b11b7a81fec1",
"secret": ""
}
},
"input": {
"duration": 10,
"prompt": "The audio contains the sound of a lively violin playing a marching tune."
},
"output": {
"type": "kwave_txt2audio",
"status": 99,
"works": [
{
"content_type": "audio",
"status": 99,
"type": "kwave_txt2audio",
"cover": {
"resource": "https://s21-kling.klingai.com/kimg/EMXN1y8qSQoGdXBsb2FkEg55bGFiLXN0dW50LXNncBova2xpbmcvYXVkaW8tcmVzb3VyY2UvYXVkaW8tY292ZXIvY292ZXItMngtNi5wbmc.origin?x-kcdn-pid=112372",
"resource_without_watermark": "",
"height": 414,
"width": 414,
"duration": 0
},
"video": {
"resource": "",
"resource_without_watermark": "",
"height": 0,
"width": 0,
"duration": 0
},
"audio": {
"resource": "https://v21-kling.klingai.com/bs2/upload-ylab-stunt-sgp/se/ai_portal_sgp_kwave_txt2audio/fada6732-7c31-4960-aff5-ef2ea45e0abc_audio_mp3.mp3?x-kcdn-pid=112372",
"resource_without_watermark": "https://storage.theapi.app/videos/283410775300625.mp3",
"height": 414,
"width": 414,
"duration": 10057
}
},
{
"content_type": "audio",
"status": 99,
"type": "kwave_txt2audio",
"cover": {
"resource": "https://s21-kling.klingai.com/kimg/EMXN1y8qSQoGdXBsb2FkEg55bGFiLXN0dW50LXNncBova2xpbmcvYXVkaW8tcmVzb3VyY2UvYXVkaW8tY292ZXIvY292ZXItMngtMy5wbmc.origin?x-kcdn-pid=112372",
"resource_without_watermark": "",
"height": 414,
"width": 414,
"duration": 0
},
"video": {
"resource": "",
"resource_without_watermark": "",
"height": 0,
"width": 0,
"duration": 0
},
"audio": {
"resource": "https://v21-kling.klingai.com/bs2/upload-ylab-stunt-sgp/se/ai_portal_sgp_kwave_txt2audio/c9347cf8-f240-4b3e-b864-9db6ee9bdcde_audio_mp3.mp3?x-kcdn-pid=112372",
"resource_without_watermark": "https://storage.theapi.app/videos/283410775305628.mp3",
"height": 414,
"width": 414,
"duration": 10057
}
},
{
"content_type": "audio",
"status": 99,
"type": "kwave_txt2audio",
"cover": {
"resource": "https://s21-kling.klingai.com/kimg/EMXN1y8qSQoGdXBsb2FkEg55bGFiLXN0dW50LXNncBova2xpbmcvYXVkaW8tcmVzb3VyY2UvYXVkaW8tY292ZXIvY292ZXItMngtMi5wbmc.origin?x-kcdn-pid=112372",
"resource_without_watermark": "",
"height": 414,
"width": 414,
"duration": 0
},
"video": {
"resource": "",
"resource_without_watermark": "",
"height": 0,
"width": 0,
"duration": 0
},
"audio": {
"resource": "https://v21-kling.klingai.com/bs2/upload-ylab-stunt-sgp/se/ai_portal_sgp_kwave_txt2audio/b7ed5a41-7fa5-442e-a75e-2cd5ef494b92_audio_mp3.mp3?x-kcdn-pid=112372",
"resource_without_watermark": "https://storage.theapi.app/videos/283410775306630.mp3",
"height": 414,
"width": 414,
"duration": 10057
}
},
{
"content_type": "audio",
"status": 99,
"type": "kwave_txt2audio",
"cover": {
"resource": "https://s21-kling.klingai.com/kimg/EMXN1y8qSQoGdXBsb2FkEg55bGFiLXN0dW50LXNncBova2xpbmcvYXVkaW8tcmVzb3VyY2UvYXVkaW8tY292ZXIvY292ZXItMngtMy5wbmc.origin?x-kcdn-pid=112372",
"resource_without_watermark": "",
"height": 414,
"width": 414,
"duration": 0
},
"video": {
"resource": "",
"resource_without_watermark": "",
"height": 0,
"width": 0,
"duration": 0
},
"audio": {
"resource": "https://v21-kling.klingai.com/bs2/upload-ylab-stunt-sgp/se/ai_portal_sgp_kwave_txt2audio/82561761-b10e-498b-9af3-73824edbc2dc_audio_mp3.mp3?x-kcdn-pid=112372",
"resource_without_watermark": "https://storage.theapi.app/videos/283410775306633.mp3",
"height": 414,
"width": 414,
"duration": 10057
}
}
]
},
"meta": {
"created_at": "2025-07-02T06:54:49.26273132Z",
"started_at": "2025-07-02T06:54:49.971638303Z",
"ended_at": "2025-07-02T06:58:24.599459321Z",
"usage": {
"type": "point",
"frozen": 700000,
"consume": 700000
},
"is_using_private_pool": false
},
"detail": null,
"logs": [],
"error": {
"code": 0,
"raw_message": "",
"message": "",
"detail": null
}
}
}
Modified at 2025-07-02 07:06:54