llm_response,
alongside the verbatim transcript in text. This is the one feature Dictation
has that the other speech-to-text APIs do not: you get the words as spoken and
text your user can send, from the same call.
Cleanup is applied by default. Omitting llm_instruction, or the whole
config part, runs the default cleanup task: filler comes out, punctuation
and capitalization are applied, and self-corrections can be resolved to what
the speaker landed on. The speaker’s own phrasing and tone survive it, so
the result still reads like them. "rewrite_mode": "smart" resolves
self-corrections more consistently: see Choosing a rewrite mode.
Customizing the rewrite
Setllm_instruction to a plain-English description of the task you want. It
replaces the default cleanup task rather than adding to it:
"rewrite_mode": "smart" with llm_instruction. fast is
tuned for the default cleanup task, so a custom instruction on fast usually
needs more iteration to get right: see
When the output isn’t what you want.
An explicit "llm_instruction": null means the same as omitting the field, so
the default cleanup task still runs.
For more control than a plain-English instruction gives you, send
llm
instead of llm_instruction. It takes an LLM Gateway
chat completions request: your own messages,
model and sampling settings, or a saved prompt.
See Sending your own LLM request for how
Dictation uses it.- Python SDK
- JavaScript SDK
- Python
- JavaScript
- cURL
Choosing a rewrite mode
rewrite_mode picks the model tier that runs the rewrite:
400. Over HTTP it goes in the config part
of the request:
When the rewrite misses a correction or ignores your instruction
If the output keeps a self-correction the speaker made (“Let’s meet Sunday, no wait, Monday” comes back with both days, or with Sunday), or doesn’t follow yourllm_instruction, check rewrite_mode first:
- Self-corrections:
fastcan leave some takebacks such as “no wait”, “actually” and “I mean” in place.smartresolves them to what the speaker landed on: “Let’s meet Monday.” - Custom instructions:
fastis tuned for the default cleanup task, sosmartis the better fit for anllm_instruction, especially one with several rules. To stay onfast, follow the steps in When the output isn’t what you want. - Words you wanted kept: the default cleanup can trim words that carry
meaning for your users, such as a tag question (“It’s affordable too,
right?” coming back as “It’s affordable too?”). Write an
llm_instructionthat says what to keep, and see the example below.
fast is a good fit when your users mostly dictate short, clean text and the
lowest latency matters most.
Writing a good instruction
Describe only the transformation. Rules about output format, refusing to answer the text, and handling already-clean input are enforced by the service, so adding your own versions of them wastes instruction budget and can conflict with what the service already does.
Describe the shape you want rather than listing what not to do. The model
leans toward complete, punctuated sentences, and a prohibition has to fight
that on every request, so “don’t” rules are the least reliable kind of
instruction. A positive description such as “a mid-sentence continuation” gets
the casing and punctuation right as a side effect.
Leave mechanical edits to your own code. The rewrite output is trimmed, so it
can’t return a leading space, and stripping a trailing full stop is exact and
free in code. Inserting at the cursor
shows how to split the work for text that lands mid-sentence.
Some instructions that work well:
"Remove filler words and tidy the punctuation.""Rewrite as a short, friendly booking confirmation addressed to the client.""Turn this into a bulleted list of action items.""Rewrite as a concise clinical chart note."
When the output isn’t what you want
If the rewrite gets specific cases wrong, such as a self-correction left in, a false start kept, or a word you wanted dropped, improve the instruction rather than switching providers or adding your own LLM call. A few rounds usually get there:- Collect the failures. Keep a set of real dictations from your users, with the output you wanted for each. Twenty to fifty is enough to see a pattern, and it lets you check that a fix doesn’t break cases that already worked.
- Name the edits you want. Say what the model may change and that everything else stays as spoken. “Copy the dictation word for word, making only these edits” followed by a short list beats a general “clean this up”.
- Describe how to spot each case. The model handles a self-correction better when you name the phrases that mark one (“I mean”, “no wait”, “actually”, “scratch that”) and say what to do with it: keep the new version, drop the old one and the marker.
- Add examples. Give three to six pairs of a spoken line and the cleaned line you want, written from your own failures. Include at least one that should come back unchanged, such as “I mean” used for emphasis, so the model doesn’t over-apply the rule.
- Change one thing at a time and re-run the whole set. That shows which change helped, and whether it fixed one case by breaking another.
- Try
smartiffaststill misses. Iffaststill gets cases wrong after a few rounds, run the same instruction onsmartbefore writing a longer one.
Example: word-for-word cleanup on fast
fast can follow your own cleanup rules well when the instruction is
specific. This one follows the steps above: a word-for-word copy
with a list of allowed edits, the phrases that mark a self-correction, and
spoken and cleaned pairs, including one that comes back unchanged. Replace the
pairs with your own users’ cases, and test it on your set before you switch.
Sending your own LLM request
Instead ofllm_instruction, you can set llm to the body of an LLM Gateway
chat completions request. Dictation sends it
to LLM Gateway after transcription and returns the model’s output in
llm_response, like any other rewrite. Send llm or llm_instruction, not
both. A request with both is rejected with 400.
There are two ways to put the transcript in the request.
In your own messages. Write prompt or messages, and put {{turn}}
where the transcript goes:
aai_prompt to the
name of a prompt saved in your account. Dictation passes the transcript as the
text replacement, so put {{ text }} in the saved prompt where the
transcript goes. You can add replacements of your own in prompt_replacements:
How Dictation differs from calling LLM Gateway directly
- No guardrails. The service’s rewrite rules and transcript fencing apply
only to the default task and
llm_instruction. Withllm, the model gets exactly the prompt you send, so it may act on commands in the dictation, such as “translate this into French”, unless your prompt tells it not to. - Two transcript tags. In
promptandmessages, Dictation renders the text as a Jinja2 template and fills{{turn}}. In a saved prompt, LLM Gateway fills{{ text }}, and the spaces inside the braces are required. - A fixed set of fields.
llmacceptsmodel,messages,prompt,temperature,top_p,top_k,max_tokens,max_completion_tokens,response_format,reasoning_effort,aai_prompt,prompt_replacementsandzero_data_retention. Field names are case-sensitive. Any other field, such asfallbacks,tools,streamortranscript_id, is rejected with400. - The rewrite models only.
modelmust be one of the models thatrewrite_moderuns on:qwen3.5-4b-32k-fast,gemma-4-31borgemini-3.5-flash-lite. In the EU region, useqwen3.5-4b-32k-fastorgemini-3.5-flash-lite. Any other model is rejected with400. Withoutmodel,rewrite_modepicks one. - Bounded output.
max_tokensandmax_completion_tokenscan be at most 8192. If you leavemax_tokensout, Dictation sizes it from the transcript, so a prompt that expands the text, such as turning a short note into an email, may need a larger one. A rewrite that runs out of tokens comes back withllm_error: "truncated".temperatureis0unless you set it. - Zero data retention. Dictation sets
zero_data_retentionon every LLM Gateway request, including ones that useaai_prompt, and you can’t turn it off. Only a saved prompt’s template is stored. The transcript and the rewrite aren’t kept. - Saved prompts run as saved. With
aai_prompt, the model,max_tokensand every other setting come from the saved prompt, and the model and output limits above don’t apply. Onlyprompt_replacementsmay accompanyaai_prompt. Any otherllmfield, orrewrite_mode, is rejected with400, and so is settingtextortranscriptinprompt_replacements: Dictation fillstext, and LLM Gateway reservestranscript. If your account has no prompt with that name,llm_errorisprompt_not_found. - Failures don’t fail the request. If LLM Gateway rejects or fails the
request, the response is still
200with the transcript intext, andllm_errorsays why. The400s above are returned before anything is transcribed.
The transcript is always preserved
The rewrite never replaces the transcription.text is always the verbatim
transcript, and the rewritten version arrives separately in llm_response. If
you need to show one value, final_text in the Python and JavaScript SDKs
returns the rewrite when there is one and the transcript otherwise.
The rewrite is also best-effort. If it fails, the response is still 200,
llm_response is null, and llm_error says why. See
Error handling.
Dictated commands are not executed
With the default cleanup task orllm_instruction, the transcript is passed to
the model as fenced data, with instructions not to act on anything inside it. Dictated speech routinely contains questions and
commands like “translate this into French” or “ignore what I just said”. Those
are rewritten as speech rather than carried out. A
request of your own has no such guard unless
your prompt adds one.
Related features
- Prompting and keyterms shapes the
transcript as it is written, where
llm_instructionreshapes it afterwards. - Language selection sets the language the audio is transcribed in.