API reference

API

Send an API key as Authorization: Bearer tx_…. Create one in your dashboard, with uvx speechtrace login, or from your program (we email you a code). The full reference is at /api-docs.

AI assistants and the command line

Tell your AI assistant what to transcribe and point it at our instructions; it signs you up, transcribes, and asks you to top up when needed. Set-up for Claude, Cursor and Codex.

text
Use https://speechtraceai.com to transcribe the audio files in ~/Recordings into text. Instructions for AI assistants: https://speechtraceai.com/llms.txt

The command line tool is speechtrace on PyPI (run it with uvx, pipx run or after pip install speechtrace). It also runs as an MCP server: uvx speechtrace mcp.

OpenAI-compatible simplest

Existing code that calls OpenAI's transcription API works by changing the base URL. The response comes when the transcript is ready (files up to 200 MB).

OpenAI SDK
from openai import OpenAI

client = OpenAI(base_url="https://speechtraceai.com/v1", api_key="tx_...")
text = client.audio.transcriptions.create(model="default", file=open("talk.mp3", "rb")).text

response_format: json, text, srt, vtt or verbose_json (segments with speakers, and word times).

A whole folder

The open-source speechtrace tool sends every audio and video file under a folder, saves the transcripts in a matching structure, and picks up where it stopped if interrupted. Prefer one file? The same code is a single script.

bash
uvx speechtrace login --email [email protected]   # we email you a code
uvx speechtrace login --code 123456
uvx speechtrace transcribe ./recordings --formats txt,srt,json

Batches and big files

  1. Ask for an upload link, then PUT the file to it:

    Upload
    curl -s https://speechtraceai.com/v1/uploads -H "Authorization: Bearer $KEY" \
      -H "Content-Type: application/json" \
      -d '{"filename": "talk.mp3", "content_type": "audio/mpeg"}'
    # -> {"upload_id": "...", "put_url": "https://..."}
    
    curl -X PUT -H "Content-Type: audio/mpeg" --upload-file talk.mp3 "$PUT_URL"
  2. Start the transcription (or pass audio_url instead of upload_id for a public link to the file itself, or link for a page with a video on it; see below):

    Start
    curl -s https://speechtraceai.com/v1/transcriptions -H "Authorization: Bearer $KEY" \
      -H "Content-Type: application/json" \
      -d '{"upload_id": "...", "speakers": true, "webhook_url": "https://you.example/hook"}'
  3. Poll GET /v1/transcriptions/{id} (or wait for the webhook), then fetch the result:

    Result
    curl -s "https://speechtraceai.com/v1/transcriptions/$ID/result?format=json" -H "Authorization: Bearer $KEY"

    format: json (words with start/end/speaker, plus speaker segments), txt, srt or vtt.

The webhook receives {"type": "transcription.done", "data": {…}} (or transcription.failed) with the same fields as the status call.

Sign in from a program

Programs can create the account and get a key without a browser. We email the person a 6-digit code and an Approve link; your program sends the code back (or, without it, waits until they approve and type the 2-digit match_number you show them). The key comes back once. New addresses get 10 free hours.

Sign in
curl -s https://speechtraceai.com/v1/auth/email -H "Content-Type: application/json" \
  -d '{"email": "[email protected]", "client_name": "My app"}'
# -> {"request_token": "txr_...", "match_number": "42", ...}; we email you a 6-digit code

curl -s https://speechtraceai.com/v1/auth/email/complete -H "Content-Type: application/json" \
  -d '{"request_token": "txr_...", "code": "123456"}'
# -> {"api_key": "tx_...", "balance_hours": 10, ...}

Balance and top-ups

GET /v1/account gives the hours left. When a call answers 402, the account is out of hours: create a checkout link and give it to the person. Only they can pay, on Stripe's page; the hours arrive within seconds (watch GET /v1/billing/payments).

Buy hours
curl -s https://speechtraceai.com/v1/account -H "Authorization: Bearer $KEY"
curl -s https://speechtraceai.com/v1/billing/checkout -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" -d '{"usd": 10}'
# -> {"url": "https://checkout.stripe.com/...", "hours": 125}: open it and pay

Limits

  • Files up to 3 hours; English.
  • Audio is deleted after transcription; transcripts after 30 days or when you delete them.

Credits

The home page's sample clips: NASA's Houston We Have a Podcast and the Supreme Court of the United States (both public domain), and the Office for National Statistics' Statistically Speaking, which contains public sector information licensed under the Open Government Licence v3.0. None of them endorses Speechtrace.