Kling Text to Audio
Sound effects and ambience without leaving the graph
- auth
- audio
- audio_file
- url
- task_id
Kling is best known for video, but its API covers audio too, and this node is the text-to-audio piece: you type a description, it returns generated audio. "Wind through a pine forest at dusk," "a ticking mechanical clock," "distant thunder" - that's the territory. It's a sound-effects and ambience generator, not a voice or a song (Kling has separate nodes for TTS and voice cloning). If you're scoring a video you generated locally and need foley that doesn't exist in your library, this is the node that makes it without leaving the canvas.
The KB's audio-generation.md maps this corner well: local foley models (MMAudio, HunyuanVideo-Foley) exist, but they lean video-driven, and for pure "give me a sound for this scene" the hosted route is dead simple. Kling's audio is 1 to 30 seconds per call, which covers one-shot effects and short ambience loops.
How it works
Like all Kling generation, it's a task-based API: the node submits your prompt and duration to the text-to-audio endpoint, gets back a task ID, and polls until the job completes (Kling jobs are asynchronous - the pack's client handles the polling internally). Then it downloads the resulting audio file as MP3 to your ComfyUI output directory and returns it as a standard AUDIO tensor plus the file path, URL, and task ID.
Inputs and outputs that matter
auth- the KLING_AUTH object from the Authentication node. Every Kling node needs the wire.prompt- the sound description. Be concrete about what the sound is and its character: "heavy rain on a tin roof" lands better than "weather."duration- 1 to 30 seconds. Default 5. Longer durations cost more and take longer to generate; for a quick effect, 5 is plenty.
Outputs: audio (AUDIO - wire to a save/preview node), audio_file (the saved file path), url (hosted URL), and task_id (the async job ID, useful for tracking).
How to install it
Pack-level:
cd ComfyUI/custom_nodes
git clone https://github.com/IxMxAMAR/ComfyUI-API-Toolkit
cd ComfyUI-API-Toolkit
pip install -r requirements.txt
or "API Toolkit" in ComfyUI Manager. Kling service needs requests and PyJWT. No downloads.
Common issues
The standard Kling error map applies: 1102 (out of credits - audio jobs bill the same account), 1200/1201 (server busy or hiccup; the pack retries transient codes with backoff, so wait it out), and content-policy flags on prompts Kling deems unsuitable.
Two practical notes. First, this node is asynchronous by nature - don't expect instant output; a 30-second audio job can take a while, and the node blocks while polling, so your workflow waits. Second, it's per-call billed and the pack's API nodes always re-execute on Queue, so every Queue is a fresh audio generation. If you're iterating on a prompt, do it deliberately rather than spamming the run button.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| auth | KLING_AUTH | — | |
| prompt | STRING | Text description of the audio to generate. | |
| duration | INT | 51–30 | Audio duration in seconds. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| audio | AUDIO | — |
| audio_file | STRING | — |
| url | STRING | — |
| task_id | STRING | — |