Nodes/ComfyUI-AI-CustomURL/Generate Speech (AI CustomURL)
ComfyUI Node

Generate Speech (AI CustomURL)

Turn a text wire into an AUDIO output with one hosted TTS call

By bowtiedbluefin·Created 10 months ago·Updated 10 months ago· 3
Generate Speech (AI CustomURL)
    • audio
    • file_path
    base_urlhttps://api.openai.com/v1
    api_key
    modeltts-1
    input
    voicealloy
    response_formatmp3
    speed1.00
    advanced_params_json

    Somewhere between "image" and "video" there's a third thing ComfyUI workflows keep wanting: a voiceover. This node gives you one with a single API call - it posts your text to POST /audio/speech on an OpenAI-compatible endpoint (tts-1 by default) and returns a proper AUDIO output plus the path to the saved file. So you can chain text generation → speech → video in one graph and end up with a narrated clip, no local TTS model eating your VRAM.

    How it works

    The mechanism is refreshingly simple. It sends model, input (your text), voice, and speed to the endpoint, gets raw audio bytes back, writes them to a temp file with the right extension, and then loads them through torchaudio into ComfyUI's AUDIO structure - a {waveform, sample_rate} dict. The file_path output gives you the on-disk location if you'd rather grab the file directly.

    There's a graceful fallback worth knowing: if torchaudio can't decode the format for any reason, the node doesn't hard-fail - it returns the string audio_bytes_saved in the audio slot plus the valid file path, so the bytes are still on disk for you to use elsewhere.

    The inputs that matter

    • base_url + api_key + model - the standard pack trio. tts-1 on OpenAI; tts-kokoro if you're pointed at Venice.
    • input - the text to speak. It's the multiline field, so paste freely.
    • voice - OpenAI voices are alloy, echo, fable, onyx, nova, shimmer. It's a free-text string, so compatible providers accept their own names.
    • response_format - mp3 (default), opus, aac, flac, wav, pcm. Pick wav if you're feeding the audio into processing that doesn't want lossy compression.
    • speed - 0.25× to 4×. 1.0 is normal.

    The optional advanced_params_json merges extra fields into the request - that's where the Speech Advanced Parameters node plugs in.

    Installing it

    ComfyUI Manager → search "AI CustomURL" → Install, restart. Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/bowtiedbluefin/ComfyUI-AI-CustomURL
    cd ComfyUI-AI-CustomURL
    pip install -r requirements.txt
    

    API-only, no model downloads. Dependencies are requests, aiohttp, pillow, numpy, torch, torchaudio, and opencv-python - and yes, torchaudio is the one that actually earns its place here.

    Common issues and the honest caveats

    • The advanced speech params do nothing on OpenAI. pitch, stability, emotion are ElevenLabs-style parameters that tts-1's endpoint doesn't accept. They only matter on compatible providers that support them - the README's Venice tts-kokoro example is the kind of endpoint that might.
    • Format mismatch on the AUDIO output. Not every downstream audio node expects the same sample rate or channel layout; if your consumer node complains, check the sample_rate the dict carries.
    • Same auth/typo failures as everywhere - 401 on a wrong key, "model not found" on a wrong name.

    Like the rest of this pack it's a small single-author project with almost no community footprint as of writing. For a quick, dependency-free way to add narration to a ComfyUI video pipeline, it does the job cleanly.

    Categoryai_customurl

    Inputs (8)

    NameTypeDefaultDescription
    base_urlSTRINGhttps://api.openai.com/v1
    api_keySTRING
    modelSTRINGtts-1
    inputSTRING
    voiceSTRINGalloy
    response_formatCOMBOmp36 options: mp3, opus, aac, flac, wav, pcm
    speedFLOAT1.000.25–4
    advanced_params_jsonoptSTRING

    Outputs (2)

    NameTypeDescription
    audioAUDIO
    file_pathSTRING