SawFox Lab

TTS API documentation

Updated on November 24, 2026

You send a text and you get an audio file back. Everything you need to know is on this page.

1. At a glance

StyleForLanguages
narrationstorytelling, history, documentariesall 7
darkdark tone, investigations, true crimeall 7
kidsstories for childrenall 7
bedtimebedtime stories, soft voiceall 7
newsnews bulletins, current affairsall 7
educationallessons and explanations for adultsall 7
trailermovie trailers, film voice-overall 7
customer_servicecustomer service, switchboard, welcome messagesall 7
conversationalnatural everyday voice, like a conversationall 7
meditationmeditation, relaxation, slow and soothing voiceall 7
asmrASMR, soft whispered voiceall 7

The exact list, voice by voice and language by language, is always given by GET /v1/voices (section 5).

2. Your key

Every request carries your API key, which starts with sfl_. You create it in your account.

text
Authorization: Bearer sfl_your_key

The X-API-Key: sfl_your_key header is also accepted.

Keep your key secret: never put it in a web page or an app that other people can open. If a key has leaked, delete it in your account and create a new one.

3. First request

bash
curl https://api.sawfoxlab.com/v1/speech \
  -H "Authorization: Bearer sfl_your_key" \
  -H "Content-Type: application/json" \
  -d '{"text": "Once upon a time, in a village by the sea…", "language": "en", "voice": "clara", "style": "bedtime"}' \
  --output story.mp3

In Python:

python
import requests

r = requests.post(
    "https://api.sawfoxlab.com/v1/speech",
    headers={"Authorization": "Bearer sfl_your_key"},
    json={"text": "Hello and welcome.", "language": "en", "voice": "oliver", "style": "narration"},
)
r.raise_for_status()
open("hello.mp3", "wb").write(r.content)
print("characters:", r.headers["X-Characters"], "| charged:", r.headers["X-Charged"])

In JavaScript (Node 18 or later, .mjs file):

javascript
import { writeFileSync } from "node:fs";

const r = await fetch("https://api.sawfoxlab.com/v1/speech", {
  method: "POST",
  headers: { "Authorization": "Bearer sfl_your_key", "Content-Type": "application/json" },
  body: JSON.stringify({ text: "Bonjour et bienvenue.", language: "fr", voice: "katia", style: "news" }),
});
if (!r.ok) throw new Error((await r.json()).error);
writeFileSync("bonjour.mp3", Buffer.from(await r.arrayBuffer()));

4. POST /v1/speech — generate audio

Request body (JSON)

FieldTypeRequiredDefaultDescription
textstringyes—The text to read, from 1 to 20,000 characters. It can contain tags (section 6).
languagestringyes—fr, en, de, es, it, pt or nl.
voicestringyes—The voice name, for example clara. The list is given by GET /v1/voices. Your custom voices: custom:… (section 5).
stylestringnonarrationnarration, dark, kids, bedtime, news, educational, trailer, customer_service, conversational, meditation or asmr (languages of each style: section 1). Note: conversational is a style; do not confuse it with the natural value of the rhythm field. With one of your custom voices (custom:…), the style has no effect on the sound: set none, or leave any style. none is only for custom voices.
modestringnostudiostudio (complete file) or flash (streamed audio).
formatstringnomp3Studio: mp3, opus or wav. Studio streaming (stream: true): mp3 or pcm. Flash: mp3 or pcm.
streambooleannofalseStudio only: the audio is streamed instead of sent as a complete file, with the same realism. Flash is always streamed.
speednumberno0Speed in percent, from -10 to +10. Decimals are allowed (-2.5).
rhythmstringnodepends on the voicenatural, punchy1 or punchy2, in Studio and in Flash. The “punchy” rhythms tighten the pauses for a livelier tone. For one passage only: the <RHYTHM> tag (section 6).
expressivenessnumbernothe voice's ownExpressiveness, from 0 (calm) to 1 (very expressive).
pacingnumbernothe voice's ownThe voice's pacing, from 0 to 1.
variabilitynumberno0.5How much one generation differs from the next, from 0 to 2. The higher it is, the more two readings of the same text differ.
fluencybooleannofalse“Improve text flow”: improves pronunciation, at the cost of slight changes to the text.
prioritybooleannofalsePriority queue: your request goes before the others (higher price, section 8).

To keep the voice's setting without removing the line, use null or "none" (both mean the same); a real value always applies.

Response

On success (code 200), the response body is the audio itself (audio/mpeg, audio/ogg, audio/wav or audio/pcm).

HeaderContent
X-CharactersThe number of characters billed.
X-ChargedThe amount charged, for example 0.000412 EUR.
X-BalanceYour balance after the request (Studio without streaming only).
X-Sample-Rate, X-Sample-FormatIn pcm only (Flash, or Studio streaming): 24000 and s16le-mono.

Studio, Studio streaming or Flash?

StudioStudio streaming (stream: true)Flash
What you getThe complete file, in one goStreamed audio: it starts as soon as the first seconds are ready, the rest arrives while you listenStreamed audio, from the first seconds
RealismThe bestThe same as StudioVery good
Formatsmp3, opus, wavmp3, pcm (24 kHz, 16-bit, mono)mp3, pcm (24 kHz, 16-bit, mono)
rhythm settingYesYesYes
ForAudiobooks, videos, podcastsListening to a long Studio text without waiting for the endVoice assistants, live reading

**Why no wav in streaming?** A WAV file starts with the total size of the audio, which is not known yet when the beginning is sent. pcm is exactly the same audio, without that header. To get a .wav file at the end, add the standard 44-byte WAV header in front of the data (24,000 Hz, 16-bit, mono).

Python example, Studio streaming, each chunk written as soon as it arrives:

python
import requests

with requests.post(
    "https://api.sawfoxlab.com/v1/speech",
    headers={"Authorization": "Bearer sfl_your_key"},
    json={"text": "Once upon a time…", "language": "en", "voice": "clara", "style": "narration",
          "mode": "studio", "stream": True, "format": "mp3"},
    stream=True,
) as r:
    r.raise_for_status()
    with open("story_stream.mp3", "wb") as f:
        for morceau in r.iter_content(chunk_size=None):
            f.write(morceau)

5. Voices — GET /v1/voices

No key is needed.

bash
curl https://api.sawfoxlab.com/v1/voices
json
{"voices": [
  {"voice": "alexandre", "languages": {"fr": ["narration", "dark", "kids", "bedtime", "news", "educational", "trailer", "customer_service", "conversational", "meditation", "asmr"], "en": ["…"]}},
  …
]}

The 11 voices are: alexandre, andreas, anna, antonio, charles, clara, diana, giulia, katia, oliver and paola.

Every voice speaks all 7 languages with a real native accent. All 11 styles exist in all 7 languages, for all 11 voices. If you request a voice that does not exist in a style and a language, the API answers 400 with the message unknown voice … (see GET /v1/voices), and nothing is charged.

Always rely on GET /v1/voices: if a voice is ever replaced, its old name keeps working and gets a similar voice.

Your custom voices

The voices you create in your account are used with their custom:… identifier, in the voice field or in a <VOICE custom:…> tag. Each one speaks the language chosen when it was created, and only with your account. GET /v1/custom-voices (with your key) gives the list.

Base voice: when you create a voice, you can pick one of our 11 voices as a starting point (andreas, alexandre, oliver, charles, antonio, giulia, katia, diana, paola, clara, anna); your description transforms it, and its gender is kept (no need to choose female or male). Without a choice, the starting voice is picked automatically from your description and the gender you give. Through the API: POST /v1/custom-voices with name, description, language and base_voice (or gender: female or male, required without base_voice). You can also start from one of your own custom voices to make a variant: base_voice = its identifier (custom:…); its starting voice and gender are kept.

Each voice can keep its own settings: expressiveness, pacing, variability, speed and rhythm, with the same values as in POST /v1/speech. Set them in your account, or through the API: PATCH /v1/custom-voices/{id} with {"settings": {"expressiveness": 0.6, "speed": -3, "rhythm": "natural"}}.

6. Tags — staging your text

Tags are written directly in text, in upper or lower case. A badly written tag is rejected with a clear 400 error, before anything is charged. You can try them all in the playground of your account.

TagEffectExample
...A 0.5-second pause.And then... nothing.
<SILENCE>A 0.5-second silence. <SILENCE x2> = 1 second, <SILENCE x3> = 1.5 seconds… up to <SILENCE x30> = 15 seconds. Speed (speed, <SPEED>) does not change the length of silences.End of chapter. <SILENCE x3> Chapter two.
<VOICE nom> … </VOICE>The passage is read by another voice, in the same language and style. Ideal for dialogue.<VOICE oliver>Who's there?</VOICE> <VOICE diana>It's me.</VOICE>
<STYLE nom> … </STYLE>The passage is read by the same voice in another style.Good evening. <STYLE news>Here are the headlines.</STYLE>
<LANG code> … </LANG>The passage is read in another language, with that language's real accent and the same voice. Handy for a language lesson.Repeat after me: <LANG fr>Bonjour.</LANG>
<SPEED +8> … </SPEED>The passage is read 8% faster (from -30 to +30). Add gradual to speed up or slow down progressively: <SPEED +15 gradual>.<SPEED -10>Slowly…</SPEED>
<VOLUME +30> … </VOLUME>The passage is 30% louder (from -100 to +100).<VOLUME -50>he whispered</VOLUME>
<RHYTHM punchy2> … </RHYTHM>The passage takes another rhythm: natural, punchy1 or punchy2, like the rhythm field, but for this passage only. ... and <SILENCE> keep their length.He walked in. <RHYTHM punchy2>A door, a scream, then nothing.</RHYTHM>
<DIGITS> … </DIGITS>Digits are read one by one, or two by two if grouped that way: phone numbers, codes. Only digits, spaces and - . / ( ) + are allowed inside, 30 digits at most.Call <DIGITS>555 123 4567</DIGITS>.

Rules:

7. Your account — GET /v1/account

bash
curl https://api.sawfoxlab.com/v1/account -H "Authorization: Bearer sfl_your_key"
json
{"name": "My studio", "currency": "EUR", "balance": 12.418, "simultaneous_limit": 20}

simultaneous_limit is the number of requests that can be in progress at the same time for your account. It is 20 by default. Write to us if you need more.

8. Pricing and billing

QueuePrice
Standard€4 per million characters
Priority (priority: true)€5 per million characters

9. Already using another service? Compatible endpoints

Keep your code and your tools: just change the base address and the key. Those services' voice names are accepted and mapped to one of our voices. Our own voice names work too. If you don't specify the language, it is detected from the text.

FormatEndpointAccepted keyWhat changes with us
OpenAIPOST /v1/audio/speechAuthorization: Bearer sfl_…model: "tts-1" gives Flash mode, other models give Studio mode. Extra optional fields: language, style, priority (via extra_body in the OpenAI SDKs). instructions is ignored: use style. speed goes from 0.25 to 4, mapped to our range of -10% to +10%.
ElevenLabsPOST /v1/text-to-speech/{voice_id} and …/streamxi-api-key: sfl_…/stream gives Flash when the format allows it. In voice_settings, only speed is used. Extra fields: style, priority. All the usual output_format values are accepted (mp3_*, opus_*, wav_*, pcm_*, ulaw_8000, alaw_8000).
Google CloudPOST /v1/text:synthesize (and /v1beta1/…)x-goog-api-key: sfl_… (never in the URL)text, ssml or markup are accepted. SSML is translated into our tags. Extra fields: style, priority.
AzurePOST /cognitiveservices/v1Ocp-Apim-Subscription-Key: sfl_…The body is SSML, with the X-Microsoft-OutputFormat header. POST /sts/v1.0/issueToken is provided for tools that ask for a token.

Example with the OpenAI SDK (Python):

python
from openai import OpenAI

client = OpenAI(base_url="https://api.sawfoxlab.com/v1", api_key="sfl_your_key")
with client.audio.speech.with_streaming_response.create(
    model="tts-1-hd", voice="clara", input="Hello everyone.",
    extra_body={"language": "en", "style": "narration"},
) as r:
    r.stream_to_file("hello.mp3")

On these endpoints, errors are returned in the format of the imitated service, so your tools understand them.

10. Errors

On /v1/speech, an error is returned as {"error": "}.

CodeMeaningWhat to do
400The request is not valid: unknown voice for this language or style, format not possible in this mode, badly written tag… The message says exactly what.Fix the request. Nothing was charged.
401Missing or invalid key.Check the Authorization header.
402Insufficient balance. The message gives the price of the request and your balance.Top up your account.
422A field has a wrong type or an out-of-range value (for example speed: 50). The details are in detail.Fix the field indicated.
429Too many simultaneous requests for your account.Wait for a request to finish, or write to us to raise the limit.
502Generation failed. You were not charged.Try again.

11. Good to know