Transcribe a recording

POSThttps://api.paxalabs.com/v1/sttOpen in playground

POST /v1/stt transcribes a recording of Thai or English speech verbatim, with word timestamps and speaker turns on request. Charged in credits by recording length before transcription, refunded on failure.

View as Markdown
# Encode without line wrapping: wrapped base64 breaks the JSON string.
AUDIO=$(base64 < meeting.m4a | tr -d '\n')
# --max-time covers an hour-long recording; curl defaults to no limit.
curl -X POST https://api.paxalabs.com/v1/stt \
  --max-time 300 \
  -H "Authorization: Bearer $PAXA_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"audio\": \"$AUDIO\", \"model\": \"paxa-stt-lite-v1-preview\"}"
{
  "text": "สวัสดีค่ะคุณสมชายยอดชำระของท่านจำนวน พันสองร้อยห้าสิบ บาทครบกำหนดวันที่ สิบห้า สิงหาคมนี้ชำระผ่านแอปได้ตลอด ยี่สิบสี่ ชั่วโมงค่ะ",
  "usage": {
    "seconds": 10.25,
    "credits": 1.43
  }
}

Send the file as base64 in audio. The format and the length are read from the bytes. The transcription guide covers the formats, the two conventions, the two styles, word timestamps, speaker turns, the vocabulary, and the length and size limits.

Headers#

authorizationBearer pxa_...Required

Authorization: Bearer pxa_... (recommended).

x-api-keypxa_...

Alternative to the Authorization header. Ignored when Authorization is present.

idempotency-keystring

Makes a retry safe. Two requests carrying the same key charge once and synthesize the same content. One request per key runs at a time. A concurrent duplicate answers 409 idempotency_in_flight. Reuse a key only to retry an identical request. A changed payload is rejected with 422. Accepts up to 200 printable ASCII characters.

1 to 200 characterspattern ^[!-~]+$

Authentication

Body#

audiostringRequired

The recording to transcribe, as the base64 encoding of an MP3, WAV, FLAC, Ogg (Opus or Vorbis), M4A, AAC, or WebM file. The format and the length are read from the file itself. No declared field is consulted. Cost is 500 credits per hour of audio, 8.33 per minute, billed by exact length with a minimum of 0.1 credits per request, charged before transcription and refunded automatically when transcription fails. A recording may run up to 60 minutes, and longer answers 400 audio_too_long. The decoded file may be up to 26,214,400 bytes, and larger answers 413 audio_too_large. A file that cannot be read as one of the seven formats, or whose length cannot be read from its container, answers 400 audio_invalid. A recording with no speech is delivered as an empty transcript and billed for its length. GET /v1/models reports the ceilings as max_duration_seconds and max_bytes.

1 to 41,000,000 characters
modelstringRequired

Transcription model id, for example paxa-stt-lite-v1-preview. GET /v1/models lists the served catalog.

1 to 100 charactersExample "paxa-stt-lite-v1-preview"
languagestring

The language the recording is expected to be in, as a BCP 47 tag such as "th" or "en". The hint filters nothing. Speech in any other language is still transcribed as spoken, and a Thai recording that switches into English mid-sentence needs no setting. Omitted, the model detects the language itself. Set the tag when detection has picked the wrong language for a recording.

up to 16 characterspattern ^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$Example "th"
timestamps"word"

Adds a words array to the response, one span per word with its start and end in seconds on the recording's own clock. Thai words are segmented for you. Latin words and numerals arrive whole. The span shape matches the speech API's timing spans. Captions round-trip between the two. Costs nothing extra. Omitted, the response carries the transcript alone.

diarizationboolean

true adds a segments array to the response, one entry per speaker turn with its speaker number, text, and start and end in seconds. Speakers are numbered from 0 in order of first appearance. Nobody is identified. With word timestamps on as well, every word span names its speaker too. Costs nothing extra. A diarized recording is read in one pass, which is slower to return and holds the recording under 9 minutes. One that long or longer answers 400 diarization_audio_too_long, uncharged. The same recording transcribes normally with this field off. GET /v1/models reports the ceiling as diarization_limit_seconds.

Default false
style"verbatim" or "clean"

How faithfully the transcript follows the recording. "verbatim", the default, writes exactly what was said: fillers, false starts, and self-corrections included. "clean" drops fillers and merges broken phrases into one, for a transcript that reads more easily. It is a readability choice. A clean transcript departs further from what was said, and our own measurement found it less exact. Any other value answers 400 validation.

Default "verbatim"
convention"spoken" or "written"

How the transcript writes what was said. "spoken", the default, writes numbers as they were said (สามสิบเปอร์เซ็นต์) and a word said twice as two words, which is what a verbatim transcript, a subtitle, or a language model reading the text needs. "written" keeps display conventions: digits and units (30%), the repetition mark ๆ, for dictated text that will be read on a page. The word timestamps are the same under both.

Default "spoken"
vocabularyarray of strings

Terms the recording is likely to contain that the model should recognize as written: product names, people, places, jargon, in Thai or English. Up to 50 terms of 50 characters each, and a longer list or term answers 400 validation. The terms bias recognition and are never inserted; a term that was not said does not appear. Costs nothing extra and combines with every other option.

Example ["Paxa Labs","กรุงเทพฯ","quarterly review"]

Response#

The transcribed recording.

textstringRequired

The transcript, verbatim in the language spoken, with no labels, timestamps, or sound annotations. Empty when the recording carried no speech.

wordsarray of objects

One span per recognized word, in spoken order, each with its text and its start and end in seconds. Present when the request set timestamps to "word"; empty for a recording with no speech. Each span names its speaker when the request set diarization to true.

Show properties
words[].textstringRequired

The input text this span covers.

words[].startnumberRequired

Where the span begins in the audio, in seconds.

words[].endnumberRequired

Where the span ends in the audio, in seconds.

words[].speakerinteger

The speaker, numbered from 0 in order of first appearance in the recording. Nobody is identified.

min 0
segmentsarray of objects

One entry per speaker turn, in spoken order. Present when the request set diarization to true; empty for a recording with no speech.

Show properties
segments[].speakerintegerRequired

The speaker, numbered from 0 in order of first appearance in the recording. Nobody is identified.

min 0
segments[].textstringRequired

The turn's text, exactly as the transcript renders it. Consecutive phrases of one speaker are one turn.

segments[].startnumberRequired

Where the turn begins in the recording, in seconds.

segments[].endnumberRequired

Where the turn ends in the recording, in seconds.

usageobjectRequired

What the request was billed for.

Show properties
usage.secondsnumberRequired

Length of the recording this request was billed for, in seconds, exact to a thousandth.

usage.creditsnumberRequired

What this delivery cost, in credits, exact to a hundredth. An idempotent replay reports the ORIGINAL request's charge, since that one charge is what paid for this delivery too; your balance moves only once.

Errors#

400validationThe request body or headers failed validation against the endpoint schema.
400unknown_modelThe model field does not name a served model.
400audio_invalidThe audio field could not be read as an MP3, WAV, FLAC, Ogg, M4A, AAC, or WebM recording, or its length could not be read from the container. A damaged or truncated file answers this code. Nothing was charged.
413audio_too_largeThe decoded recording exceeds the model's size ceiling. Nothing was charged.
400audio_too_longThe recording is longer than the model's per-request ceiling. Nothing was charged.
400diarization_audio_too_longThe recording reaches the length at which speaker attribution stops, which is well below the transcription ceiling. Nothing was charged.
401unauthorizedThe request carried no API key, or the key is invalid or disabled.
402insufficient_creditsThe account does not have enough credits for this request. Nothing was charged.
403key_limitThis API key reached its spending cap. Nothing was charged.
409idempotency_in_flightAnother request with this Idempotency-Key is in flight right now.
409idempotency_refundedThe original request under this Idempotency-Key failed and was refunded.
422idempotency_mismatchThis Idempotency-Key was already used for a different request.
422content_blockedThe upstream safety system declined to process this content. The charge was refunded.
429rate_limitedRequests per minute for the plan are exhausted. One window covers the whole account, across every product and every key.
429concurrency_limitedThe account holds the plan's full count of concurrent requests for this product. Nothing was charged. Each product is limited separately, and an open live connection holds one speech slot.
500internalRequest state was inconsistent on the server.
502provider_errorModel inference failed after the request was charged.
503provider_unavailableThe model behind this endpoint is not available right now. Nothing was charged.