ComfyUI Node

TTS WebUI via API

The raw TTS node that talks to any model in your TTS WebUI server

By rsxdalv·Created 10 months ago·Updated 10 months ago· 5
TTS WebUI via API
    • audio
    • wav_path
    • metadata_json
    textHello from ComfyUI
    api_basehttp://127.0.0.1:7778
    modelkokoro
    voicerandom
    speed1.00
    params_json{}
    api_key
    timeout_sec120
    channels_firsttrue
    also_save_wavfalse
    save_prefixtts
    return_metadatatrue
    advanced_request_json

    If you only install one node from this pack, make it this one. "TTS WebUI via API" is the generic jack-of-all-trades: a raw OpenAI-style client that can drive any model your TTS WebUI server has loaded, with no dedicated node required. When a new TTS model lands in the server before this pack adds a wrapper for it, this is the node you reach for.

    The naming is the trap

    Despite the "OpenAI-style" framing, this thing calls no external API and needs no OpenAI key. It POSTs a JSON body to your own local server at http://127.0.0.1:7778/v1/audio/speech and converts the WAV that comes back into a ComfyUI AUDIO object - a torch waveform tensor plus sample rate - so you can wire it straight into an audio preview or save node.

    The actual model, the GPU work, and the weights all live in that server (the sibling project rsxdalv/TTS-WebUI, same author). This node is the remote control, not the engine. The upside: ComfyUI stays light, the heavy Python/transformers dependencies stay out of your ComfyUI env, and you can drive a server on another machine over your LAN.

    The inputs that matter

    • text - what you want spoken. The obvious one.
    • model - a string naming whatever model the server exposes (defaults to kokoro).
    • voice - defaults to random, which is exactly what it sounds like. Put a named voice here if the server has one you like.
    • speed - 0.25 to 4.0.
    • params_json - a JSON object passed through to the server as model params, e.g. {"temperature": 0.7}.

    The killer feature is advanced_request_json. Put a full JSON body in it and the node sends it verbatim, overriding everything else. That's your escape hatch for model options that don't have dedicated fields, and it's great for poking the API by hand when a server-side model needs a parameter nobody thought to expose.

    Outputs

    You get three: audio (AUDIO, the thing you wire into playback/save), wav_path (STRING, empty unless you tick also_save_wav, which writes to ComfyUI's output/audio folder), and metadata_json (STRING with the request model, api_base, status code, and - when saved - sample rate and duration).

    Installing it

    ComfyUI Manager → search "TTS WebUI API nodes for ComfyUI", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/rsxdalv/ComfyUI-TTS-Webui
    

    then restart ComfyUI. Dependencies are just requests, numpy, torch - all already in any ComfyUI environment, so there's no separate pip step and the node downloads nothing. Models live in the server.

    When it breaks

    • Connection refused: the TTS WebUI server isn't running on 127.0.0.1:7778. Start it and load a model there first. If the server is elsewhere, point api_base at it - the node appends /v1/audio/speech itself.
    • First request stalls past the timeout: the server is loading or downloading the model on first use. Bump timeout_sec (max 600).
    • Model/voice 4xx: you asked for something the server doesn't have loaded. Check the server's model and voice lists.
    • API key: only if your server demands one - either the api_key input, the TTS_WEBUI_OPENAI_API_KEY env var, or a tts_api_key.txt file sitting next to the pack folder. Fun leftover: the README still mentions SAI_API_KEY backward-compat from this repo's earlier life as a Stability API template, but the shipped code only reads the TTS env var and the key file.

    One last thing: channels_first defaults to True, meaning the waveform comes back as (C, N). It only matters if a downstream audio node is picky about channel order - leave it alone unless you're getting weird mono/stereo behaviour.

    CategoryAudio/TTS

    Inputs (13)

    NameTypeDefaultDescription
    textSTRINGHello from ComfyUI
    api_baseSTRINGhttp://127.0.0.1:7778
    modelSTRINGkokoro
    voiceSTRINGrandom
    speedFLOAT1.000.25–4
    params_jsonSTRING{}
    api_keyoptSTRING
    timeout_secoptINT1201–600
    channels_firstoptBOOLEANtrue
    also_save_wavoptBOOLEANfalse
    save_prefixoptSTRINGtts
    return_metadataoptBOOLEANtrue
    advanced_request_jsonoptSTRING

    Outputs (3)

    NameTypeDescription
    audioAUDIO
    wav_pathSTRING
    metadata_jsonSTRING