What you will learn How to use the audio and image paths, and the one thing that only works here.
Chat and embeddings in the previous chapter return text. Audio and images return files, which changes how you handle them.
Forget --output and binary data floods your terminal. A common mistake.
Feeding in a long script at once takes a while, and a failure midway means starting over. Generating per paragraph and joining is more robust.
Joining is a job for an audio tool in the terminal.
This is the first step of turning a meeting recording into meeting notes.
graph TD
A["Recording"] --> B["Speech → text"]
B --> C["Raw transcript"]
C --> D["Hand to a task<br/>'organise into action items'"]
D --> E["Meeting notes"]The second step is creating a task via the REST API. Joining the model API to the task API like this is the shape you will use most often in practice.
This is not in the OpenAI specification, so its path is not under /v1/ either.
Register your own voice, or a chosen one, and select it as the voice. It lets
you produce many pieces consistently in the same voice.
⚠ A voice is personal data. Cloning someone else's voice requires their consent. That holds for internal material too, and more so for anything published. Do not make one without consent.
The response carries image addresses. Downloading and saving them is a separate step.
For many images, keep the prompts in a file.
That buys you three things.
| Reason | |
|---|---|
| Reproducibility | you can produce the same result again |
| Selective redo | regenerate only the ones you dislike |
| Consistency | apply style fields across all of them |
Bury the prompts in code and you lose all three.
| Path | Use |
|---|---|
/v1/images/inpainting | redraw part of it |
/v1/images/upscale | raise the resolution |
Generate many at low resolution, upscale only the keepers — better on both time and cost.
This is what tangles most often in practice.
| Principle | Why |
|---|---|
| Separate input and output by folder | what to delete on a rerun is obvious |
| Exclude output from git | binaries bloat the repository |
| Sequence numbers or dates in filenames | essential where order matters |
| Work | Feel |
|---|---|
| A short sentence of speech | seconds |
| A long script | minutes |
| One image | seconds to minutes |
| Dozens of images | ten minutes or more |
So work like this is better run on a schedule with only the result checked. It is not something to sit and wait for.
Three of fifty failed and the whole batch runs again. Make it skip files that already exist. That requires predictable filenames.
A great image comes out and you do not know which prompt made it. Keep the input file alongside.
Written above, but worth repeating. Cloned voices presume consent.
1. Why split a long script for speech?
Because all at once takes a while and a failure midway means starting over. Per paragraph, you regenerate only what failed.
2. What do you gain by keeping image prompts in a file?
Reproducibility, selective redo, and consistency. You can make the same result again, regenerate only what you dislike, and apply style fields across everything.
3. What must you confirm before using a cloned voice?
The consent of the voice's owner. A voice is personal data, and cloning without consent is not acceptable even for internal material.
Now make all of this run by itself → Building pipelines with schedules
curl -X POST http://localhost:27777/api/ai/v1/audio/speech \ -H "Authorization: Bearer $HT_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "<model name>", "input": "Hello. Here is today'\''s update.", "voice": "<voice>" }' \ --output out.wav✗ the whole script at once✓ one wav per paragraph → a file list → joincurl -X POST http://localhost:27777/api/ai/v1/audio/transcriptions \ -H "Authorization: Bearer $HT_KEY" \ -F file=@meeting.m4a \ -F model="<model name>"/api/voice-profilescurl -X POST http://localhost:27777/api/ai/v1/images/generations \ -H "Authorization: Bearer $HT_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "<model name>", "prompt": "a single glass capsule floating, centered, dark background" }'[ { "subject": "...", "composition": "centered", "mood": "solemn" }, { "subject": "...", "composition": "low angle", "mood": "tense" }]working-directory/ prompts.json ← input (version controlled) out/ ← output (excluded from version control) img-001.png voice-001.wav