Speech
Turn text into speech, in English and Japanese voices. POST the text to /v1/audio/speech with your API key and get an MP3 or WAV back, decoded and checked before it is billed. The body has the fields of OpenAI's speech request (model, voice, input, response_format, speed), and a few of our own.
One line
Send the model, a voice, the text and its language. The answer is the audio itself (audio/mpeg, or audio/wav), and its headers carry what was measured and billed:
x-fm-duration-secondsthe length of the decoded audio, in seconds.x-fm-charactersthe characters billed.x-fm-chargewhat the line was billed, and the currency.x-fm-checksthe checks, for example tail=quiet; length=ok.
curl -sS -X POST https://api.fastmetal.ai/v1/audio/speech \
-H "Authorization: Bearer $FASTMETAL_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "qwen/qwen3-tts", "voice": "ono-anna", "input": "This plan is built for SEO and AEO.", "language": "en", "pronunciations": {"SEO": "S-E-O"}}' \
-o line.mp3 -D headers.txtWith "delivery": "json" the answer is JSON instead: the audio as base64 under audio, duration_seconds, characters, the charge (amount, currency, characters, unit, minimum, rounding and price_version) and the checks.
Fields
modelRequired. A speech model from the price list below.voiceA voice id of the model, from /v1/audio/voices. Without it, the model's default voice for the language. A voice that is not on the list is refused.inputRequired. The text to speak, at most the characters a line in the price table below (what one call has time for, under the model's own limit), counted after the pronunciation map.languageen or ja, or auto where the model detects the language itself. Without it, auto on a model that detects it.pronunciationsOptional. Text to replace before the line is spoken (below).response_formatmp3 (the default) or wav.speed1, or a value in the model's speed range where it has one.deliverybinary (the default) or json.
Any other field is refused with a 400 before anything is charged, stream_format and instructions included.
A text may hold tab and line feed but no other control character, so send line feeds, not CRLF line endings; no format character (zero-width spaces and joiners, the soft hyphen, the byte order mark, bidi marks), so an emoji sequence joined with a zero-width joiner is refused; no private-use character, unassigned code point or unpaired surrogate; and it must keep at least one letter or digit after the pronunciation map. A text that breaks a rule is refused with a 400 that says which, before anything is charged. The map's keys and values refuse the same characters and every control character, tab and line feed included; an entry needs no letter of its own.
Characters and the price
A line is billed per character, with a minimum: the larger of the minimum and its characters times the price per character, rounded up to 0.0001 of the unit. A character is every Unicode code point of the text sent, spaces and punctuation included, counted after the pronunciation map. A line over the model's characters, after the map, is refused with a 400 that names the limit, before anything is charged.
| Model | Per character | Per 1,000 characters | At least, a line | Characters a line, at most (speed 1) | Voices |
|---|---|---|---|---|---|
Qwen3-TTS qwen/qwen3-tts | $0.0000211 | $0.0211 | $0.000211 | 831 English, 480 Japanese or 480 auto-detected | 9 |
Inworld TTS-2 inworld/tts-2 | $0.000036925 | $0.036925 | $0.00037 | 1,584 English, 792 Japanese or 792 auto-detected | 127 |
Prices before tax, from the catalog the gateway bills by. A USD key pays the cents prices of the same catalog. The pricing page lists the same rows.
The time a call may take
The speech service gives each call 90 seconds from when it receives it. Each model's pace is measured per language, and a line, or a batch, estimated to need more than 84 seconds of that time is refused with a 400 before anything is charged; the message names how many characters, or how many such lines, fit. That is why a line holds the characters in the price table, fewer than a model's own limit; the table is at speed 1, a request that names no language counts as auto-detected, and a slower speed holds fewer. A batch makes 3 lines at a time. The quote answers the same estimate for free (time: estimated_seconds, limit_seconds and max_characters per language). An answer the speech service has ready only after the 90 seconds is not delivered: the call answers 504 with the code past_time_budget, and nothing is charged. Now and then a text makes a model run long: such a line is cut and not billed. Text made mostly of digits or symbols is read out much longer than its character count: keep such a line to about 200 characters, and split a longer one into several lines. One account (all its keys together) may have 2 speech requests in progress and send 60 lines a minute, a batch counting each of its lines: a request over either is refused whole with a 429 (account_requests, account_lines) before anything is made, and nothing is charged. An account is paused on one model for 10 minutes when its lines fail at the speech service 3 times in 10 minutes there (account_paused_on_model), or when the speech service counts one of its lines as longer than it was charged for (account_paused_overcount), and on every model for 10 minutes when the speech service refuses 10 of its lines in 10 minutes (account_paused): its requests answer 429 before anything is sent, nothing is charged, and the message says how many seconds are left. Separate accounts are paused separately, and nothing one account does stops a model for anyone else.
A free price check
POST /v1/audio/quote with the same body and "op": "speech" (or "speech_batch" for a batch) answers what the call would be charged, line by line, with the characters counted after the map, and how long it is estimated to take against the time a call may take. It holds and bills nothing.
curl -sS -X POST https://api.fastmetal.ai/v1/audio/quote \
-H "Authorization: Bearer $FASTMETAL_API_KEY" \
-H "Content-Type: application/json" \
-d '{"op": "speech", "model": "qwen/qwen3-tts", "voice": "ono-anna", "input": "This plan is built for SEO and AEO.", "language": "en"}'Up to 12 lines in one call
POST /v1/audio/speech/batch with the model, a voice and a pronunciation map for every line, and items: 1 to 12 lines, each with its own input and language and, if you like, its own voice. All the lines together take at most 12,000 characters, after the map.
curl -sS -X POST https://api.fastmetal.ai/v1/audio/speech/batch \
-H "Authorization: Bearer $FASTMETAL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen/qwen3-tts",
"voice": "ono-anna",
"pronunciations": {"SEO": "エスイーオー", "AEO": "エーイーオー"},
"items": [
{"input": "SEOとAEOに対応", "language": "ja"},
{"input": "This plan is built for SEO and AEO.", "language": "en", "voice": "ono-anna"}
]
}'The answer is JSON with one result per line, in order: the audio as base64 (MP3), its duration, characters, charge and checks, or that line's error with its code. The call is billed the sum of the lines delivered. A line that fails is not billed, and when every line fails the answer is a 502 and nothing is billed.
Pronunciations
pronunciations maps text to what to say instead, for every line of the request. It is applied once, from the left, the longest key first, and a replacement is never replaced again. Matching is case-sensitive. A key that starts or ends with an ASCII letter or digit matches only where the character beside it is not an ASCII letter or digit, so SEO is replaced in "SEO and AEO" and in "SEOとAEO", but not inside "SEOUL". A Japanese key matches anywhere. At most 50 entries, keys of 1 to 64 characters and values of 1 to 128.
In English: this line is spoken as "built for S-E-O and SEOUL" and billed 25 characters, the characters of the text after the map.
{
"model": "qwen/qwen3-tts",
"voice": "ono-anna",
"input": "built for SEO and SEOUL",
"language": "en",
"pronunciations": {
"SEO": "S-E-O"
}
}In Japanese, acronyms are where voices most often go wrong, so give them a reading in kana. This line is spoken as "エスイーオーとエーイーオーに対応" and billed 16 characters.
{
"model": "qwen/qwen3-tts",
"voice": "ono-anna",
"input": "SEOとAEOに対応",
"language": "ja",
"pronunciations": {
"SEO": "エスイーオー",
"AEO": "エーイーオー"
}
}Voices and previews
GET /v1/audio/voices lists every voice of the speech models, under the names they are published with, filtered by language (?language=ja) and by model (?model=...). Each voice gives the languages it speaks, which languages it is the model's default voice for, and a link to a short preview in each language, served from FastMetal: one fixed sentence per language, so a voice can be heard before anything is bought.
curl -sS "https://api.fastmetal.ai/v1/audio/voices?language=ja&model=qwen/qwen3-tts" \
-H "Authorization: Bearer $FASTMETAL_API_KEY"Where a voice's language comes from is given per language under language_sources: documented, when the model's own documentation says so, or measured, when a transcription of the voice's own preview in that language matched the sentence it was given. A voice that no source describes for a language is not listed for it, though it is still sold.
The checks
Every clip is decoded and checked before it is billed:
- duration_seconds: the length of the decoded audio.
- tail: the last 150 ms. loud when its RMS level is -32 dBFS or above, with the warning tail_loud: the speech may have been cut off at the end.
- length: the duration against the characters at the language's usual speaking rate. short below half the expected time, long above two and a half times it plus a second, each with its warning.
- peak_dbfs and loudness_lufs: the true peak and the integrated loudness.
A warning is information, not a refund. A clip that can be decoded is delivered and billed once, with its warnings, and nothing is made again automatically. A clip that cannot be decoded, or no clip at all, is a failure and is not billed.
When a line is billed
A line is billed once FastMetal holds the whole checked clip. A caller that disconnects after that is still billed, and so is a download the caller cuts short. A request refused before the model is called costs nothing, and so does a line the model fails to make.
Over MCP
The MCP server has three tools for speech:
list_voicesthe voices, filtered by model and language, with their previews. Free.generate_speechone line (text) or 1 to 12 lines in one call (lines), with a model, a voice, the language and a pronunciation map. Each clip comes back as a link with its id, its length and its checks. dry_run: true answers the price for free and makes nothing.get_audioa clip again by its id, with a new link, for 24 hours after it was made; with no id, the clips the key made in the last 24 hours, newest first (at most 50), with what each was billed: the way back to a call whose answer did not arrive.
generate_speech answers within 45 seconds, except when a made clip could not be stored and must come back in the answer itself: then it also waits for the call's records to be written, each step bounded. A call that could not start in that time is refused and not billed. A call not finished by then answers pending, with its call id and the id of every clip, and goes on: get_audio with a clip id then reports the clip as pending, ready (with its link), failed or unknown. A clip is billed only once it is made. If our server stops while a call is pending (a restart or an update), its clips are reported unknown once it can no longer be running: the call may have been billed (get_audio shows its quote), so check your balance before you make it again.
dry_run exists on generate_speech only. A clip is read by the key that made it, or by a key of the same account with whole-library access (set on the keys page). Setting up the MCP server: the MCP guide.
Errors
400A field that is not accepted, a value out of range, a voice that is not on the list, a line over its characters, a line or batch that would take longer than a call may, a character the text rules refuse, a map over its limits, or text with nothing to speak.413The request body is larger than 1 MiB.429budget_exceeded: the price does not fit what is left of the key's budget. From the speech service, nothing charged, its code at the top of the body beside its error: account_requests (the account already has 2 requests in progress: retry when one ends), account_lines (the account has sent 60 lines this minute: retry in a minute), capacity (the speech service is at its limit: retry shortly), or a pause of the account, account_paused_on_model, account_paused_overcount or account_paused (see the time a call may take, above): the message says when to retry.502With one of the speech service's codes (listed below) at the top of the body, beside its error message, the speech service's own refusal, and nothing was charged: the model could not make the clip (host_failed), the speech service is unavailable right now (host_unavailable: try again later), the clip could not be decoded (clip_unusable), or no line of a batch could be made (no_line_made). A 5xx without one of them there (a code inside an error object is not one) can mean the connection failed after the clip was made, which may have been charged, so check the balance before you retry.503Speech is not available right now, its price could not be confirmed, or the speech service is busy (host_busy), and nothing was charged; a 503 with one of those codes at the top of the body, beside its error message, is always the speech service's own refusal. Without one it can also be a failure on the way back, as for a 502: check the balance, then retry.504With the code past_time_budget, the answer was ready only after the time a call may take: nothing was charged; send shorter lines, or fewer at once. Any other 504 is a failure on the way, as for a 502: check the balance before you retry.
Every refusal of the speech service carries one of these codes beside its error message, at the top of the body for a whole call and in the line's own entry under items for a line of a delivered batch, and none of them was charged: not_found, audio_disabled, unauthorized, speech_unavailable, internal_error, query_not_supported, request_late, request_too_large, body_unreadable, body_invalid_json, body_not_object, plane_unavailable, pricing_updating, invalid_request, account_requests, account_lines, account_paused, account_paused_on_model, account_paused_overcount, capacity, not_started_time, not_started_paused, host_cut_line_limit, host_cut_time_budget, host_no_answer, host_busy, host_unavailable, host_refused_line, host_failed, host_no_audio, clip_unusable, out_of_time, batch_too_large, no_line_made, past_time_budget, query_unreadable, query_param_not_allowed, query_param_twice, invalid_model, invalid_language.