The speech to text API ranked #1 for streaming accuracy

Phone numbers, emails, and UUIDs come back right the first time, even with background noise, and built-in turn detection tells your agent when the caller is done.
transcribe.py
with client.stt.auto_finalize.websocket(
    model="ink-2",
    encoding="pcm_s16le",
    sample_rate=16000,
) as ws:
    ws.send_raw(audio_chunk)
    for event in ws:
        if event.type == "turn.end":
            print(event.transcript)

wss://api.cartesia.ai/stt/turns/websocket

Full example

Talk and watch it transcribe

Click or press Space to start a transcription
Tap to start a transcription
Need a topic?
What's something new you've been meaning to try?

Speech to text in Python: your first transcript

Install the SDK

Use Python 3.9 or later. The websockets extra adds realtime streaming.

Terminal
python3 -m pip install -U "cartesia[websockets]"

Set your API key

Create a key in the Cartesia playground and store it in an environment variable, so it never sits in your code.

macOS / Linux
export CARTESIA_API_KEY="your-api-key"

Using PowerShell?$env:CARTESIA_API_KEY="your-api-key"

Transcribe a recording

Save this script as transcribe.py next to a mono, 16-bit WAV file named call.wav, then run it. The script streams the audio at the speed it was recorded and prints each finished turn.

Terminal
python3 transcribe.py

For live audio, send microphone or phone-call chunks as they arrive instead of reading a file.

Model
ink-2
Endpoint
/stt/turns/websocket
transcribe.py
import os
import time
import wave

from cartesia import Cartesia

client = Cartesia(api_key=os.environ["CARTESIA_API_KEY"])

with wave.open("call.wav", "rb") as audio:
    sample_rate = audio.getframerate()
    frames_per_chunk = sample_rate // 10  # 100 ms of audio

    with client.stt.auto_finalize.websocket(
        model="ink-2",
        encoding="pcm_s16le",
        sample_rate=sample_rate,
    ) as ws:
        while chunk := audio.readframes(frames_per_chunk):
            ws.send_raw(chunk)
            time.sleep(0.1)  # send audio as fast as it was recorded
        ws.send({"type": "close"})

        for event in ws:
            if event.type == "turn.end":
                print(event.transcript)
            elif event.type == "error":
                raise RuntimeError(event.message)

Pick the endpoint that fits your audio

Stream live audio over a WebSocket. Upload a finished recording in one HTTP request.

Voice agents

/stt/turns/websocket

Transport
WebSocket
Returns
Turn events with full transcripts

Cartesia decides when the speaker is done and sends a turn.end event with the whole turn.

Read the turn detection guide

Your own turn control

/stt/websocket

Transport
WebSocket
Returns
Transcript updates

Use this when your app already runs a voice activity detector or push-to-talk. Send finalize when the speaker stops to get the transcript right away.

Read the realtime API reference

Recorded files

/stt

Transport
HTTP
Returns
One transcript

Upload a whole WAV or MP3 file and get one transcript back, with optional word timestamps.

Read the batch API reference

Accurate where voice agents usually break

Callers read out card numbers, spell their names, and pause mid-sentence. Your agent needs a correct transcript at each of those moments.

Ranked #1 for streaming accuracy

Ink-2, Cartesia's streaming speech-to-text model, writes phone numbers, emails, and UUIDs correctly and stays accurate on noisy phone lines without a separate noise filter.

Turn detection without a VAD

Ink-2 decides when a turn is over from what the caller says, so you can drop your separate voice activity detector (VAD). A turn.eager_end event lets your LLM start a reply before the turn is confirmed.

Your product's words, spelled right

Keyterm prompting biases recognition toward the names and jargon your callers use. Pass up to 100 terms on each connection.

SDKs and voice agent frameworks

Official Python and JavaScript SDKs handle the WebSocket for you, and Cartesia's Pipecat and LiveKit integrations add Ink-2 to an existing agent.

Where speech to text sits in a voice agent

Ink-2 sits between the caller's audio and your LLM, and its turn events tell the agent when to reply.

01

Your audio

Stream microphone, browser, or phone-call audio as raw PCM, μ-law, or A-law, at the sample rate your source already uses.

02

Ink-2

Writes the transcript while the caller talks and sends turn.end when the caller has finished.

03

Your agent

Passes the finished turn to your LLM. Start the reply on turn.eager_end to answer sooner, and drop it if turn.resume arrives.

Enterprise-grade security.From Cloud to Local.

  • HIPAA compliant badge

    HIPAA compliant

  • SOC 2 Type 2 badge

    SOC 2 Type 2

  • GDPR badge

    GDPR

  • PCI badge

    PCI

Add speech to text to your product

A free account includes up to 111 minutes of Ink-2 transcription a month. Talk to us about volume pricing, on-prem deployment, or a BAA.

Speech to text API FAQs

Which speech to text API is best?

For live conversations like voice agents, pick the API that is accurate while it streams and knows when the speaker is done. Ink-2 is ranked #1 for streaming speech-to-text accuracy and detects turns itself, so one model replaces a transcription model plus a voice activity detector.

Is there a free speech to text API?

Yes. A free Cartesia account includes monthly credits that cover up to 111 minutes of Ink-2 transcription through the API, and paid plans add more. To try speech to text without writing code, use the free online tool.

How much does the Cartesia speech to text API cost?

Transcription with Ink-2 costs 3 credits per second of audio, drawn from your plan's monthly credits. The free plan covers up to 111 minutes a month, and the pricing page lists the minutes each paid plan includes.

How do I convert speech to text in Python?

Install the SDK with pip install "cartesia[websockets]", set CARTESIA_API_KEY, and open a WebSocket with client.stt.auto_finalize.websocket(model="ink-2", ...). Send raw audio chunks with send_raw and read each finished transcript from the turn.end events. The Python section of this page has a complete script.

Can I transcribe audio files with the Cartesia speech to text API?

Yes. The batch endpoint takes a whole recording, such as a WAV or MP3 file, in one HTTP request and returns one transcript, with optional word timestamps. The realtime WebSocket only accepts audio as fast as it was recorded, so batch is the faster way to transcribe a file.

What languages does the Cartesia speech to text API support?

Ink-2 transcribes English, Spanish, French, Hindi, and Japanese, and detects which of them is being spoken.

What is a speech to text API?

A speech to text API (also called an STT, speech recognition, or transcription API) takes audio from your app and returns the words as text. A streaming API returns the transcript while the speaker is still talking, which is what voice agents and live captions need.

Can I run Cartesia's speech to text API in my own infrastructure?

Yes. Ink-2 deploys on-prem (including air-gapped environments), in your own VPC on AWS, GCP, or Azure, or as an OEM license embedded in your product. These deployments, and zero data retention, are available under enterprise contracts.