Paxa Labs

ถอดเสียงบันทึก

POSThttps://api.paxalabs.com/v1/sttเปิดใน Playground

POST /v1/stt ถอดเสียงบันทึกภาษาไทยหรืออังกฤษเป็นข้อความตามที่พูดจริง พร้อมเวลาระดับคำและช่วงผู้พูดเมื่อร้องขอ คิดเครดิตตามความยาวของเสียงก่อนถอด และคืนให้เมื่อล้มเหลว

ดูเป็น 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
  }
}

ส่งไฟล์เป็น base64 ในฟิลด์ audio ระบบอ่านรูปแบบและความยาวจากไบต์ของไฟล์ รูปแบบไฟล์ที่รองรับ รูปแบบการเขียนสองแบบ สไตล์สองแบบ เวลาระดับคำ ช่วงผู้พูด คลังคำศัพท์ และขีดจำกัดความยาวกับขนาดอยู่ในคู่มือการถอดเสียง

เฮดเดอร์#

authorizationBearer pxa_...จำเป็น

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 ^[!-~]+$

การยืนยันตัวตน

เนื้อหา#

audiostringจำเป็น

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
modelstringจำเป็น

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

1 to 100 charactersตัวอย่าง "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})*$ตัวอย่าง "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.

ค่าเริ่มต้น 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.

ค่าเริ่มต้น "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.

ค่าเริ่มต้น "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.

ตัวอย่าง ["Paxa Labs","กรุงเทพฯ","quarterly review"]

การตอบกลับ#

The transcribed recording.

textstringจำเป็น

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.

ดูฟิลด์ย่อย
words[].textstringจำเป็น

The input text this span covers.

words[].startnumberจำเป็น

Where the span begins in the audio, in seconds.

words[].endnumberจำเป็น

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.

ดูฟิลด์ย่อย
segments[].speakerintegerจำเป็น

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

min 0
segments[].textstringจำเป็น

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

segments[].startnumberจำเป็น

Where the turn begins in the recording, in seconds.

segments[].endnumberจำเป็น

Where the turn ends in the recording, in seconds.

usageobjectจำเป็น

What the request was billed for.

ดูฟิลด์ย่อย
usage.secondsnumberจำเป็น

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

usage.creditsnumberจำเป็น

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.

ข้อผิดพลาด#

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.