Text to Speech API: Getting Started Guide

Your first request in curl, Node and Python, how to pick voices, MP3 or WAV at 48 kHz, streaming, limits and errors, and moving over from the ElevenLabs API.

Pablo Giménez
· 9 min read
Two studio microphones side by side in the dark, one black and one lit in yellow. AI-generated image.
Two studio microphones side by side in the dark, one black and one lit in yellow. AI-generated image.

A text to speech API turns text into audio over HTTPS: you send the text and a voice ID with your API key, and the response is the audio file. With Voicefinder it is one synchronous call, POST https://api.voicefinder.io/v1/text-to-speech/{voice_id}, with a JSON body such as {"text": "Hello, world.", "language": "en", "output_format": "mp3"} and your key in the x-api-key header. The body of the response is a 48 kHz MP3 or WAV, already watermarked. If your code already calls the ElevenLabs API, you can keep it: change the base URL and the key, and the official SDK keeps working. This guide walks through the first request in curl, Node and Python, then voices, formats, streaming, limits and migration.

By Pablo Giménez, professional voice-over artist and co-founder of Voicefinder. Every endpoint, header and parameter in this guide is taken from our public API reference as of 29 November 2026.

What you need before the first request

  • An account. The API is included on every plan, the free one too. Free gives 10,000 credits a month for personal use; 1 credit is 1 character.
  • An API key. Create it in Developers, inside your account. Keys start with vf_. Treat it like a password and keep it out of client-side code.
  • A voice ID. Every voice in the catalog has one. You can list them with the API (step 3) or copy one from the studio.

The Voicefinder API developer portal gathers the quickstart, the reference, the guides and the cURL, Node.js and Python samples in one place.

Step 1: create your key and authenticate

Store the key in an environment variable so it never ends up in your repository:

Bash
export VOICEFINDER_API_KEY="vf_…"

The API accepts the key in any of three headers, so you can use whichever your HTTP client or SDK already sends:

HeaderExampleDefault output when used
x-api-keyx-api-key: vf_…WAV
AuthorizationAuthorization: Bearer vf_…WAV
xi-api-keyxi-api-key: vf_… (the ElevenLabs SDK header)MP3

A missing or invalid key returns 401. An account with no credits left returns 402.

Step 2: make your first text to speech request

All three examples below generate the same file with Allison, a General American voice from the catalog (voice ID 6e23c8ad-9b36-4a4c-8d32-43acd6d6ba21). The request asks for MP3 explicitly; without output_format, a request authenticated with x-api-key returns WAV.

curl

Bash
curl -X POST \
  "https://api.voicefinder.io/v1/text-to-speech/6e23c8ad-9b36-4a4c-8d32-43acd6d6ba21" \
  -H "x-api-key: $VOICEFINDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "Hello, world.", "language": "en", "output_format": "mp3"}' \
  -D - -o hello.mp3

-D - prints the response headers, which tell you what you got and what it cost (see the table below).

Node.js (18 or later, no dependencies)

JavaScript
import { writeFile } from "node:fs/promises";

const VOICE_ID = "6e23c8ad-9b36-4a4c-8d32-43acd6d6ba21"; // Allison, General American

const res = await fetch(`https://api.voicefinder.io/v1/text-to-speech/${VOICE_ID}`, {
  method: "POST",
  headers: {
    "x-api-key": process.env.VOICEFINDER_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ text: "Hello, world.", language: "en", output_format: "mp3" }),
});
if (!res.ok) throw new Error((await res.json()).detail.code);
console.log(res.headers.get("x-output-format"), res.headers.get("x-character-count"));
await writeFile("hello.mp3", Buffer.from(await res.arrayBuffer()));

Python (requests)

Python
import os, requests

VOICE_ID = "6e23c8ad-9b36-4a4c-8d32-43acd6d6ba21"  # Allison, General American

res = requests.post(
    f"https://api.voicefinder.io/v1/text-to-speech/{VOICE_ID}",
    headers={"x-api-key": os.environ["VOICEFINDER_API_KEY"]},
    json={"text": "Hello, world.", "language": "en", "output_format": "mp3"},
    timeout=300,
)
res.raise_for_status()
print(res.headers["x-output-format"], res.headers["x-character-count"])
open("hello.mp3", "wb").write(res.content)

What comes back in the headers

HeaderWhat it tells you
content-typeaudio/mpeg or audio/wav
x-output-formatThe real format delivered, for example mp3_48000_192
x-request-id / request-idThe generation ID; use it to download the audio again from your history at no cost
x-character-count / character-costThe characters charged
x-model-idThe model that generated the audio: voyager-1
x-watermarked / x-c2pa-signedThe file carries an inaudible watermark and signed Content Credentials
x-language-warningThe voice has no native recording in the language you asked for and will carry its own accent
x-speed-warning / x-ignored-parametersA setting was clamped or ignored, and which one
X-RateLimit-Limit, -Remaining, -ResetWhere you stand against your plan's limits

Step 3: find the right voice

GET /v1/voices returns the catalog. It accepts language (en returns every English variant), gender (female, male, neutral), age (young, middle_aged, old, child), search (by name), page_size (1 to 100) and next_page_token:

Bash
curl "https://api.voicefinder.io/v1/voices?language=en&gender=female&page_size=20" \
  -H "x-api-key: $VOICEFINDER_API_KEY"

Each voice comes with voice_id, name, language, gender, age_range, a preview_url you can play, its styles and a labels object with the accent (for example "general american", "southern us" or "midwestern"). The API has no accent filter, so filter on labels.accent in your code. Our guide to American accent text to speech explains which US accent suits which job.

Two more endpoints help: GET /v2/voices is the same catalog with token pagination (it is what the ElevenLabs SDK's voices.search() calls), and GET /v1/voices/{voice_id} returns one voice with all its samples and its styles. A style's style_id can be passed in the generation request to use that recorded register of the voice.

Request parameters that matter

Only text is required. These are the parameters you will actually use; the full list is in the API reference, and the OpenAPI spec describes every endpoint for Postman or a client generator.

ParameterValuesNotes
text1 to 10,000 charactersTags and spaces count toward the cap. Long texts are generated in parts and returned as one file.
language (or language_code)en, en-US, eng, English…The language counts; the accent comes from the voice. Default: auto.
output_formatmp3, wav, or names like mp3_44100_128Body or query string. You always get 48 kHz; x-output-format says exactly what.
voice_settings.speed0.85 to 1.25Out-of-range values are clamped. At or below 1.15 gives the cleanest diction.
directionUp to 500 charactersPlain-English direction for the whole text, such as "warm and unhurried; softer on the last sentence". Not read aloud, not charged.
emotion_intensity1 to 6How strongly emotion tags come through. 1 is natural, 3 is marked.
style_idFrom GET /v1/voices/{voice_id}A recorded style of the voice.
seed0 to 2147483647Repeat a take: same text, voice and settings give the same read.
model_idvoyager-1The only model. Any other value is accepted and mapped, with a warning header.

To direct individual sentences, put a tag in square brackets in the text itself: "[cheerful] Your order is on its way. [serious] Please check the address." Tags are not billed as characters, and a sound effect from the catalog (GET /v1/sound-effects), such as [doorbell], can be written into the text the same way.

Try it free

Audio formats: MP3 or WAV at 48 kHz

Every response is MP3 or WAV at 48 kHz. You can ask with ElevenLabs-style names (mp3_44100_128, wav_22050) and you get the MP3 or WAV equivalent; the x-output-format header reports the real format. Raw PCM, μ-law, A-law and Opus return 422, because those formats cannot carry the C2PA credential and we never deliver unmarked audio. For the same reason, do not transcode the file yourself if you need the credential to verify: it is bound to the bytes you received.

Does the API support streaming?

There is a POST /v1/text-to-speech/{voice_id}/stream endpoint with the same body, and it returns the audio in chunks so the SDKs' stream methods work. On Voyager 1, though, the first byte is sent once the whole file has been generated and signed, so it does not lower the time to first audio. Use it when your code already calls a stream method; otherwise the regular endpoint is simpler. A separate low-latency model, Pulsar 1, is announced as coming soon on the text to speech API page.

Long texts, limits and errors

  • Length. Up to 10,000 characters per request (about ten minutes of audio). Above that, split by paragraph and make several requests. A long request can take a few minutes, so set your client timeout to 300 seconds.
  • Rate limits. They depend on the plan: from 1 to 4 simultaneous generations, 10 to 60 generations per minute per key and 20,000 to 1,000,000 characters per hour. Over a limit you get 429 with a Retry-After header.
  • Errors. Every error has the same JSON shape: error with status and message, and detail with a stable code and the request_id. Compare the code in your logic, not the message. On 429 or 503, wait for Retry-After and retry. A 502 is a failed generation and is never charged.

Migrating from the ElevenLabs API

If you already use the ElevenLabs API, migration is two lines. Voicefinder accepts the ElevenLabs field names, headers and output format names, and the official Python and JavaScript SDKs work against our base URL:

Python
from elevenlabs.client import ElevenLabs

client = ElevenLabs(
    api_key="vf_…",
    base_url="https://api.voicefinder.io",
)

audio = client.text_to_speech.convert(
    voice_id="6e23c8ad-9b36-4a4c-8d32-43acd6d6ba21",  # Allison
    text="Same request, new host.",
    model_id="eleven_multilingual_v2",
    language_code="en",
)

with open("speech.mp3", "wb") as f:
    for chunk in audio:
        f.write(chunk)

In JavaScript, the change is the same: new ElevenLabsClient({ apiKey: "vf_…", baseUrl: "https://api.voicefinder.io" }). What maps and what does not:

ElevenLabsVoicefinder
xi-api-keyAccepted, as are x-api-key and Authorization: Bearer
text_to_speech.convertPOST /v1/text-to-speech/{voice_id}
voices.searchGET /v2/voices
model_id: eleven_*Treated as voyager-1, no error, with x-model-id-warning
voice_settings.speed0.85 to 1.25
stability, similarity_boost, styleAccepted with no effect, listed in x-ignored-parameters
mp3_*, wav_*MP3 or WAV at 48 kHz
pcm_*, ulaw_8000, opus_*422: not available, because they cannot carry C2PA

The one thing you must change is the voice IDs: ElevenLabs IDs do not exist in our catalog, so map each of your voices to one of ours with voices.search(). The ElevenLabs-compatible API guide has the REST version of the same call and the full list of differences.

How much does a text to speech API call cost?

One credit is one character of spoken text, from the same balance as the studio, and about 972 characters make a minute of audio. Tags and sound effects are not billed as text, and a failed generation is never charged. Free includes 10,000 credits a month for personal use. Basic ($12 a month, 100,000 credits) adds commercial use, and Plus ($22 a month) includes 200,000 credits, about 206 minutes. If you only use the API, there is also a pay-as-you-go API balance with no plan. Current prices are on the pricing page.

If you generate scripts in bulk, it pays to write them for the ear first; our guide on how to write a voiceover script covers length per minute and has templates you can fill from your own data.

If you only need a file and no code, use text to MP3 or text to speech WAV; and if a term in this guide is new to you, check the AI voice glossary.

FAQ

What is a text to speech API?

A web service you send text to over HTTPS that returns spoken audio. With Voicefinder it is one synchronous call, POST /v1/text-to-speech/{voice_id}, and the response body is the MP3 or WAV file, with no queue to poll.

Is there a free text to speech API?

Yes. The Voicefinder API is included in the Free plan, with 10,000 characters a month for personal use. Commercial use starts on Basic at $12 a month.

How do I authenticate with the Voicefinder TTS API?

Create a key starting with vf_ in Developers, inside your account, and send it in the x-api-key header, as Authorization: Bearer, or in xi-api-key, the header the ElevenLabs SDK uses.

Can I use the ElevenLabs SDK with another API?

With Voicefinder, yes: create the client with your vf_ key and base URL https://api.voicefinder.io. The convert, stream and voice search methods work as they are; you only need voice IDs from our catalog.

Does the text to speech API support streaming?

There is a /stream endpoint that returns the audio in chunks so SDK stream methods work, but on Voyager 1 the first byte goes out once the file is complete and signed, so it does not reduce latency.

What audio formats does the API return?

MP3 or WAV at 48 kHz. ElevenLabs-style names like mp3_44100_128 are accepted, and the x-output-format header reports the real format. PCM, μ-law and Opus are not available because they cannot carry the C2PA credential.

How many characters can I send in one request?

Up to 10,000, counting tags and spaces. Longer texts are split at paragraph boundaries inside the same call and returned as one file, so set a client timeout of about five minutes.

Create a free account and get your API key: 10,000 characters a month

  • text to speech api
  • tts api
  • elevenlabs api
  • text to speech api python
  • elevenlabs api alternative
Written by
Pablo Giménez
AI text to speech

Keep reading.

See all 36 stories →