Good open text-to-speech models now sound close to a studio narrator, but they want a real GPU. If your computer doesn’t have one, you can rent one by the second from Modal and run ComfyUI on it. Claude Code can write nearly all of that setup for you.
This guide covers the setup from your side of the keyboard: what you create yourself, what you ask Claude for, and the decisions that affect quality and cost. It doesn’t depend on a particular model or voice. Once it runs, you can point it at whichever speech model suits you, or at image and video models too. It is the companion to our guide on making motion graphics videos with Claude Code, which is where we use the voice.
An example of what you get: one line straight out of the model, and the same line after a simple mastering pass.
The pieces
- Modal runs your code in containers on cloud GPUs. You describe the container in Python. It starts when a request comes in, shuts down when idle, and bills by the second.
- ComfyUI is an open source node editor for running image, video and audio models. You get a browser UI to experiment in, and an API that scripts can call.
- Custom nodes add models to ComfyUI. For speech, a node pack such as TTS Audio Suite brings in several open text-to-speech engines.
- Claude Code writes the Modal app, the client script and the audio processing, and runs the commands with you.
Step 1: the parts only you can do
Claude can write all the code, but some steps involve your accounts, your money and your tokens. Do these yourself:
- Create a Modal account and add a payment method.
- Install the client and log in:
pip install modal, thenmodal setup. This opens your browser. - Create a Hugging Face account and an access token with read permission. Some models are gated, so accept their terms on the model page first.
- Store your secrets in Modal from your own terminal, so they never pass through a chat: one for the Hugging Face token, and one for a username and password for the ComfyUI page. For example:
modal secret create huggingface-secret HF_TOKEN=...
The password matters more than it looks. A Modal web endpoint is public. Anyone who finds the URL could run jobs on your GPU, on your bill, unless the page asks for a login.
Step 2: ask Claude Code for the app
Open Claude Code in an empty folder and describe what you want. Be clear about the decisions and leave the plumbing to Claude. A prompt along these lines works:
Set up ComfyUI on Modal in this folder.
- One Modal app. Build the image in code and pin ComfyUI and every custom node to a commit.
- Install these custom nodes: <the node packs for the models you want>.
- Keep models in one Modal volume, and outputs, inputs and saved workflows in another.
- Put the ComfyUI web page behind a login, using the secret <name>.
- Use a <GPU type> GPU and shut the container down after <N> minutes without requests.
- Write a small Python script that sends a workflow to the API, waits for it,
downloads the outputs and unloads the models.
- Write a smoke test that builds the image and checks that every custom node imports.
Explain each modal command I need to run, and what it will cost per hour.
Claude writes the files and walks you through modal deploy, which prints the URL of your ComfyUI page. You don’t need to read every line it writes. Do read the GPU setting and the idle timer, because those two decide the bill.
Two decisions are yours:
- The GPU. Bigger GPUs cost more per hour. A speech model needs far less memory than a video model, so pick the smallest GPU your models fit on and check the price on Modal’s pricing page. If you plan to run video models in the same app later, you may want a larger one.
- The idle timer. A cold start takes a minute or two. A longer idle window suits a session of trying things in the browser. A script that only generates and exits can use a short one.
Step 3: find a voice, then keep it
Speech models usually offer three ways to get a voice: built-in preset speakers, a voice designed from a written description, or a clone of a reference recording. Ask Claude to generate the same line several ways, listen, and pick.
Two lessons apply whichever model you use:
- Make it repeatable. A designed voice can come out slightly different each time, even with the same settings. Once you like a take, keep that audio and its exact transcript, and use it as the reference for cloning from then on. With a fixed seed, the voice stays the same across videos.
- Only clone what you may use. Use a voice you designed, recorded yourself, or have written permission to use. Don’t clone a real person without consent.
Step 4: audition and steer
For each video, give Claude the final script and ask for every line in a few variations (different seeds or settings). Once the GPU is warm, a line takes seconds. Then listen and say what is wrong in plain words: “too slow and flat, it needs more rhythm”, “warmer”, “less breathy”. Claude adjusts the settings, tries other variants, or changes the speed of the takes afterwards.
Two habits save retakes:
- Spell names the way they sound. Models stumble on brand names and invented words. Writing them phonetically in the script, with hyphens where needed, usually fixes the pronunciation.
- Check the words, not just the sound. Ask Claude to run a speech-to-text pass on every take and compare it with the script. You also get the timing of each word, which you need when you put the voice on the picture.
Step 5: master it by ear
A raw take sounds like a podcast. Describe the sound you want and let Claude build it, usually with ffmpeg filters alone:
Master these takes for a <trailer / explainer / calm narrator> voice-over:
<deeper, warmer, brighter, drier...>. Normalise the loudness for <platform>.
Give me a before and after of one line.
Judge it by listening, not by the filter list. If something sounds off, such as echo, harshness or a boomy low end, say so in those words. You heard one result at the top of this post.
Step 6: put the voice on the picture
In your video project, ask Claude to place each line on the frame where it belongs, time the animation to the spoken words, and lower the sound effects while the voice speaks. The motion graphics guide covers that side: how to make motion graphics videos with Claude Code.
Keep the bill small
| While running | a per-hour GPU price, billed by the second |
| While idle | nothing, once the container has shut down |
| A voice session | a cold start, then seconds per line |
| Storage | models live in a volume; check your plan’s allowance before you download large ones |
Before you close the laptop, open the Modal dashboard and check that nothing is still running. A container stays up until its idle timer runs out, so when you are done for the day, stop it from the dashboard, or ask Claude to.
If you would like help with a setup like this, or with getting AI-built software into production, run our free technical diagnostic or write to us.