Trellis Data Logo
Developers Doc

Audio Transcriptions API

Sample requests and responses for transcribing audio with the Agentaus API.

Send one audio file and get its transcript back. The whole transcript is returned in one response, or streamed with stream=true.

Endpoint

POST
/api/v1/audio/transcriptions

Create a Transcription

Requires header Authorization: Bearer <token> and a multipart/form-data body with one audio file.
Body parameters
file
Required
file
The audio file. See below.
model
Optional
string
agentaus-models (default). See below.
response_format
Optional
string
json (default) or text. See below.
language
Optional
string
ISO-639-1. See below.
stream
Optional
boolean
false (default). See below.
curl https://<host>/api/v1/audio/transcriptions \
  -H "Authorization: Bearer $API_KEY" \
  -F [email protected] \
  -F model=agentaus-models
Response
{
  "text": "Hello, this is the transcript of the meeting.",
  "usage": {
    "type": "tokens",
    "output_tokens": 25,
    "total_tokens": 25
  }
}

file

Audio file
BehaviorExtension is one of mp3, mpeg, mpga, wav, m4a, mp4, ogg, flac, webm. Not empty, max 200 MB
Other files return 400Bad Request.

model

agentaus-models
BehaviorThe only option (default)
Other values return 400Bad Request.

response_format

json
BehaviorReturns text and usage (default)
text
Behavior200, Content-Type: text/plain, body is the transcript only (no usage)
Other values (verbose_json, srt, vtt, diarized_json) return 400Bad Request.

language

en
BehaviorThe only language for now (default)
Other values return 400Bad Request.

stream

false
BehaviorThe whole transcript is returned in one response (default)
true
BehaviorServer-sent events, see Streaming. response_format is then ignored

Response

response_format: json (default)

json
{
  "text": "Hello, this is the transcript of the meeting.",
  "usage": {
    "type": "tokens",
    "output_tokens": 25,
    "total_tokens": 25
  }
}
text
Typestring
NotesThe transcript
Typeobject
NotesToken usage

usage

Billed per token from your API balance.
type
Typestring
Notes"tokens"
output_tokens
Typeinteger
NotesOutput tokens of the transcription
total_tokens
Typeinteger
NotesEquals output_tokens — no input tokens are counted
json
"usage": { "type": "tokens", "output_tokens": 25, "total_tokens": 25 }

Streaming

200, Content-Type: text/event-stream, one data: <json> event per update:
text
data: {"type":"transcript.text.delta","delta":"Hello, this is"}

data: {"type":"transcript.text.delta","delta":" the transcript of the meeting."}

data: {"type":"transcript.text.done","text":"Hello, this is the transcript of the meeting.","usage":{"type":"tokens","output_tokens":25,"total_tokens":25}}
  • Only text that extends what was already sent goes out as a delta. The transcript.text.done event always has the final text.
  • Errors before the stream starts (400Bad Request, 402Payment Required, 404Not Found, …) are normal responses. After it starts, the status is already 200, so a failure is a last event:
text
data: {"type":"error","error":{"message":...,"type":"server_error",...}}

Errors

json
{
  "error": {
    "message": "Audio file is larger than 200MB",
    "type": "invalid_request_error",
    "param": null,
    "code": null
  }
}
400Bad Request
typeinvalid_request_error
MeaningNo file; unsupported type, empty or larger than 200 MB; unsupported model, response_format or language
401Unauthorized
type—
MeaningPlain-text body, not JSON. Missing, invalid or expired token
402Payment Required
typeinsufficient_quota
MeaningAPI balance too low to reserve the credit: "You exceeded your current quota."
403Forbidden
type—
MeaningPlain-text body, not JSON. No permission
404Not Found
typenot_found_error
MeaningTranscription is not available: "Transcription is not available."
429Too Many Requests
typerate_limit_error
MeaningRate limit exceeded. Retry after Retry-After seconds
500Internal Server Error
typeserver_error
MeaningAny other failure: "Unable to transcribe the audio file"
503Service Unavailable
typeoverloaded_error
Meaning"Platform is at capacity, please retry shortly." Retry after Retry-After seconds
503Service Unavailable
type—
MeaningPlain-text body, not JSON. Backend temporarily unavailable — retry
504Gateway Timeout
typeserver_error
MeaningNo result before the timeout: "Transcription timed out"