Blog

AI Text-to-Speech API: Pricing and Code (2026)

Unicorn API Team · · 10 min read

Diagram of an AI text-to-speech pipeline from script to API call to finished audio waveform

AI text-to-speech has quietly become one of the most reliable things you can do with a model: give it a script, get back audio that most listeners will not identify as synthetic. The gap between the free web tools that dominate search results and a production API is not voice quality any more. It is control, cost per character, and whether you can run a thousand jobs on a schedule without clicking anything.

What is AI text-to-speech?

AI text-to-speech (often shortened to TTS) is the conversion of written text into spoken audio using a neural network. The older approach, concatenative synthesis, chopped recordings of a human voice actor into small units and glued them back together in new orders. It worked, and it always sounded like it worked: flat prosody, audible seams, a robotic cadence that no amount of post-processing fixed.

Modern AI text-to-speech models skip the glue. They are trained on thousands of hours of paired text and audio, and they predict the acoustic output for a sentence end to end. Because the model sees the whole sentence before it speaks, it can place emphasis, pause where a human would breathe, and raise its pitch at a question mark. That single architectural change is why 2026-era synthetic narration passes unnoticed in podcasts and e-learning courses.

Three things a good model gives you that a 2015 TTS engine could not:

  • Prosody from context. Intonation follows meaning, not a lookup table. “I never said she took the money” lands differently depending on surrounding sentences, and the model picks up on that.
  • Voice identity as a parameter. A voice is an ID you pass in, not a separate engine you install. Swapping narrators is a one-field change.
  • Cross-language transfer. The same voice can read Spanish, Japanese or German while keeping its timbre, which is what makes AI text-to-speech practical for dubbing.

How does an AI text-to-speech model actually work?

Under the hood, an AI text-to-speech request goes through two stages. First the text is normalised and converted into a sequence of linguistic tokens: phonemes, stress markers, punctuation signals. “Dr. Chen paid $4.50 in 2026” has to become something a model can pronounce, which means deciding that “Dr.” is “doctor”, “$4.50” is “four dollars fifty”, and “2026” is “twenty twenty-six” rather than “two thousand and twenty six”. Normalisation errors are the single most common source of a bad take.

Second, an acoustic model turns those tokens into a waveform, conditioned on a voice embedding: a numeric fingerprint of how a particular speaker sounds. The embedding is why one model can produce hundreds of distinct voices. It is also why voice cloning is possible at all, and why consent matters: an embedding derived from someone’s recordings carries their identity.

Most APIs expose a few knobs on top of this. Stability controls how much the model is allowed to vary its delivery between runs: low stability gives expressive, sometimes erratic reads, high stability gives consistent, flatter ones. Speed scales the tempo. Style pushes the model toward more dramatic delivery. Language code forces a pronunciation system rather than letting the model infer one from the characters, which matters when a name is ambiguous across languages.

Two-stage diagram showing text converted to phoneme tokens and then to an audio waveform
A neural speech model predicts audio directly from text instead of stitching recorded fragments together.

Which AI text-to-speech models are worth using?

Unicorn API carries the ElevenLabs line, which is the reference point most people compare other AI text-to-speech systems against. There are three models, and they are genuinely for different jobs rather than being tiers of the same thing.

ModelPriceBilling unitBest for
Text to Speech Turbo V2.56 credits per 1,000 charactersPer request, multiplied by the number of 1,000-character blocksLong narration, bulk article-to-audio, low-latency app features
Text to Speech Multilingual V212 credits per 1,000 charactersPer request, multiplied by the number of 1,000-character blocksDubbing, expressive reads, non-English scripts where accent accuracy matters
Text to Dialogue V314 creditsFlat, per requestTwo or more speakers, conversational scenes, ad scripts

Turbo V2.5 is the default choice. It takes the same input fields as Multilingual V2 (text, voice, speed, style, stability, similarity_boost, timestamps, language_code, previous_text, next_text) at half the price, and it returns audio faster. Multilingual V2 earns its premium when you need a voice to hold its character across languages or when you want more range out of the delivery.

Dialogue V3 is the odd one out, and the pricing reflects it: a flat 14 credits per request regardless of how long the exchange is. Instead of a single text string it takes a dialogue array, where each entry has its own text and voice. The model generates the whole conversation in one pass, so turn-taking and overlap sound natural in a way that splicing separate single-voice renders never quite does.

All three live in the same catalog as the image, video and chat models, so you can browse them at /models or try a voice in the browser at /studio/audio before writing any code. If you want a deeper look at voice selection and settings specifically, the ElevenLabs AI voices breakdown covers that ground, and the text-to-speech reader post covers the document-reading use case.

How to call an AI text-to-speech API in code

Every media model on Unicorn API follows the same two-step shape, and AI text-to-speech is no exception. You POST a job, then poll it until it succeeds. Create a key at /keys and export it as UNICORN_API_KEY first.

The minimal create call:

curl -X POST https://api.unicornapi.net/v1/jobs \
  -H "Authorization: Bearer $UNICORN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "elevenlabs-text-to-speech-turbo-2-5",
    "input": {
      "text": "The second stage of the pipeline is where most teams lose a week."
    }
  }'

That returns a job object with an id and a status. Poll it:

curl https://api.unicornapi.net/v1/jobs/JOB_ID \
  -H "Authorization: Bearer $UNICORN_API_KEY"

When status is "succeeded", the audio file is at outputs[0].url. Here is the whole loop in Python, with a voice ID and the settings you will actually want for narration:

import os, time, requests

BASE = "https://api.unicornapi.net"
HEADERS = {"Authorization": f"Bearer {os.environ['UNICORN_API_KEY']}"}

def speak(text, voice="EkK5I93UQWFDigLMpZcX", previous_text=None):
    body = {
        "model": "elevenlabs-text-to-speech-turbo-2-5",
        "input": {
            "text": text,
            "voice": voice,
            "stability": 0.5,
            "speed": 1.0,
            "timestamps": True,
        },
    }
    if previous_text:
        body["input"]["previous_text"] = previous_text

    job = requests.post(f"{BASE}/v1/jobs", json=body, headers=HEADERS).json()

    while True:
        job = requests.get(f"{BASE}/v1/jobs/{job['id']}", headers=HEADERS).json()
        if job["status"] == "succeeded":
            return job["outputs"][0]["url"]
        if job["status"] == "failed":
            raise RuntimeError(job.get("error", "job failed"))
        time.sleep(1)

paragraphs = [
    "Neural speech models predict audio directly from text.",
    "That is why they can place emphasis where a human would.",
]

prev = None
for p in paragraphs:
    print(speak(p, previous_text=prev))
    prev = p

Two details in that snippet do real work. timestamps: True returns word-level timing data with the audio, which you need for captions or lip sync and which costs nothing extra to request up front. previous_text tells the model what was just said, so the opening of each chunk carries the right intonation instead of resetting to a cold start. There is a matching next_text field for the sentence that follows. If you are splitting a long script, pass both.

Before running a large batch, price it exactly:

curl -X POST https://api.unicornapi.net/v1/models/price \
  -H "Authorization: Bearer $UNICORN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "elevenlabs-text-to-speech-multilingual-v2",
    "input": {"text": "...your full script...", "voice": "EkK5I93UQWFDigLMpZcX"}
  }'

That gives the credit cost of the exact request before you spend anything, which beats estimating character counts by hand. Full request and response schemas are in the docs.

Generating multi-speaker dialogue instead of single-voice narration

If your script has two people in it, generating each line separately and concatenating the files is the obvious approach and the wrong one. The seams show up as unnatural gaps, mismatched energy between turns, and responses that do not react to what came before. Dialogue V3 takes the whole exchange at once:

const res = await fetch("https://api.unicornapi.net/v1/jobs", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.UNICORN_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model: "elevenlabs-text-to-dialogue-v3",
    input: {
      dialogue: [
        { text: "So the job just sits there at queued?", voice: "EkK5I93UQWFDigLMpZcX" },
        { text: "For about two seconds, then it flips to running.", voice: "21m00Tcm4TlvDq8ikWAM" },
        { text: "Right, and that is when the credits are counted.", voice: "EkK5I93UQWFDigLMpZcX" },
      ],
      stability: 0.6,
      language_code: "en",
    },
  }),
});

let job = await res.json();
while (job.status !== "succeeded" && job.status !== "failed") {
  await new Promise(r => setTimeout(r, 1000));
  job = await (await fetch(`https://api.unicornapi.net/v1/jobs/${job.id}`, {
    headers: { "Authorization": `Bearer ${process.env.UNICORN_API_KEY}` },
  })).json();
}

console.log(job.outputs[0].url);

Because the price is flat at 14 credits per request, a three-line exchange and a forty-line scene cost the same. That makes Dialogue V3 unusually cheap for long conversational content and slightly wasteful for a single short line, where Turbo V2.5 at 6 credits would do. Check the price endpoint if you are unsure which side of the line your script falls on.

Comparison of single-voice narration and two-speaker dialogue generation
Dialogue models handle turn-taking inside one request, so timing between speakers sounds natural.

What does AI text-to-speech cost per minute of audio?

Character counts are awkward to reason about, so convert them. Speech runs around 150 words per minute, and English averages roughly six characters per word including spaces. One minute of audio is therefore close to 900 characters, or a single billing block.

On a monthly plan, credits cost $0.01 each, so:

  • Turbo V2.5: about 6 credits a minute, roughly $0.06 per minute of finished audio.
  • Multilingual V2: about 12 credits a minute, roughly $0.12 per minute.
  • Dialogue V3: 14 credits per request, so the per-minute figure drops the longer the scene.

Scaled up, a Starter plan at $25 is 2,500 credits, which is on the order of 400,000 characters through Turbo V2.5: about seven hours of narration. The same plan through Multilingual V2 is about three and a half hours. Top-up credits cost $0.015 each and never expire, which is the right option for bursty work like a one-off audiobook.

The billing detail that catches people: the multiplier is ceil(length / 1000), so a 1,020-character request is charged as two blocks. If you are chunking a script anyway, cutting at sentence boundaries just under 1,000 characters wastes nothing. Padding a 980-character chunk with a closing sentence doubles its cost.

Free text to speech voices and where they stop being free

Search for AI text-to-speech and the first page is almost entirely free web tools: paste text, pick a voice, download an MP3. They are genuinely useful, and worth using for exactly one thing, which is auditioning voices before you commit. The limits that make them unsuitable for anything beyond that are consistent across providers:

  • Monthly character caps. Free tiers typically allow enough for a few minutes of audio per month. One chapter of an audiobook exhausts them.
  • Commercial-use restrictions. Free output is often licensed for personal projects only, which excludes client work, ads and monetised video.
  • No automation. A browser tool cannot be called from a build step, a CMS webhook or a nightly job.
  • Quality tiers. The best voices are frequently reserved for paid plans, so the free preview is not what you would ship.

The honest framing is that free text to speech voices solve the demo problem and paid AI text-to-speech APIs solve the production problem. If your output is a single narrated slide deck, a free tool is the correct answer and you should use it. If you are generating audio for every article you publish, six cents a minute through an API is cheaper than your time spent clicking.

The other reason to go through an API: audio rarely ships alone. A video needs a voice track, background music and sometimes a sound effect. On one key you can run AI text-to-speech alongside Ai Music API Sounds for short sound beds at about 3 credits per track, Ai Music API Mashup at 12 credits, or helpers like Ai Music API Generate Lyrics and Ai Music API Boost Music Style at 1 credit each. Same billing, same job shape, one invoice.

Common mistakes with AI text-to-speech, and how to avoid them

Most bad synthetic audio is a text problem, not a model problem. The failures repeat:

  1. Sending raw source text. Markdown asterisks, footnote numbers, URLs and table remnants all get read aloud or mangled. Strip and normalise before the request.
  2. Leaving numbers and abbreviations ambiguous. Write “twenty twenty-six” if that is what you want, expand “e.g.” and “approx.”, and respell stubborn proper nouns phonetically.
  3. Chunking without context. Splitting a script into separate requests and ignoring previous_text and next_text produces audio that resets its energy every paragraph.
  4. Stability set wrong for the job. Low stability for an audiobook means inconsistent delivery across chapters. High stability for an ad read means a flat, uninterested voice. Test both ends on one paragraph before generating a hundred.
  5. Forgetting timestamps. Deciding you need captions after a 5,000-character render means paying for it twice. Ask for timing data on the first pass.
  6. Cloning without permission. Celebrity and colleague voice clones are the fastest route to a legal problem and are prohibited by provider terms. Use licensed voices, or your own with documented consent.
  7. Not retrying failed jobs. Jobs can fail. Your polling loop should detect "failed" status and retry the single chunk rather than the whole script.

A sensible first project: pick one 500-word page, run it through Turbo V2.5 with timestamps on, listen to the whole thing at normal speed, and note every word you would fix. That list becomes your normalisation step, and the normalisation step is what makes the rest of your AI text-to-speech pipeline boring and dependable. When you want to drive it from an editor or agent rather than a script, the MCP integration exposes the same models to Cursor and Claude Code directly.

Frequently asked questions

What is the best AI text-to-speech model?

There is no single best model, only the best fit for a job. For long narration where cost matters, ElevenLabs Text to Speech Turbo V2.5 at 6 credits per 1,000 characters is hard to beat. For dubbing or emotional range across languages, Multilingual V2 at 12 credits gives finer control. For two or more speakers in one take, use Text to Dialogue V3.

Is AI text-to-speech free?

Most consumer tools offer a free tier with a monthly character cap, a watermark or a restriction on commercial use. Those limits are fine for testing a voice and poor for shipping a product. API access is not free, but it is cheap and predictable: a minute of speech from Turbo V2.5 is about 6 credits, or roughly six cents on a monthly plan.

How much text can I send in one AI text-to-speech request?

Billing is per 1,000-character block, rounded up, so a 2,500-character script costs three blocks. In practice you should split long scripts into paragraph-sized chunks anyway, because shorter requests finish faster and a retry only re-runs one chunk. Use the previous_text and next_text fields so each chunk keeps the right intonation at its edges.

Can AI text-to-speech clone a specific person's voice?

Technically yes, and legally it depends entirely on consent. Cloning your own voice or a voice you have written permission to use is normal practice for narration and dubbing. Cloning a celebrity, a colleague or anyone else without permission exposes you to publicity-rights and fraud claims, and most providers ban it in their terms.

How do I get word-level timing for captions?

Set timestamps to true in the input for Text to Speech Multilingual V2 or Turbo V2.5. The job returns timing data alongside the audio URL, which you can convert into SRT or VTT subtitles or use to sync an animation to the voice track. Asking for timestamps after the fact means paying for the generation twice.

Does AI text-to-speech handle numbers and abbreviations correctly?

Usually, but not always. Models guess at "Dr.", "2026", "IV" and currency symbols from context, and they guess wrong often enough that you should normalise text before sending it. Write out numbers, expand abbreviations, and spell proper nouns phonetically if the model mispronounces them. This is cheaper than regenerating a finished voiceover.