Speech to text
OpenRouter's speech-to-text API: one audio file in, its text out, never streamed. Send the audio as base64 in input_audio, or as an OpenAI multipart upload with the audio in a file part and every other field as a text part. The file is at most 25 MiB in wav, mp3, flac, ogg, webm, m4a, aac or pcm; its duration is measured before any provider is called, and a file that cannot be read is a 400, never billed. A call bills the seconds of audio. GET /api/v1/models?output_modalities=transcription lists the models your key can call, each with verbose_json.
curl -X POST https://api.llm.buzz/api/v1/audio/transcriptions \
-H "Authorization: Bearer $LLM_BUZZ_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/whisper-large-v3-turbo",
"input_audio": {
"data": "BASE64_AUDIO",
"format": "mp3"
}
}'{
"text": "Thanks for calling.",
"usage": {
"seconds": 12.48,
"cost": 0.000041558
}
}{
"error": {
"code": 400,
"message": "...",
"metadata": {
"error_type": "invalid_request",
"gateway_code": "invalid_request",
"param": "messages"
}
}
}{
"error": {
"code": 401,
"message": "A valid gateway Bearer key is required. Send the virtual key as 'Authorization: Bearer <key>'.",
"metadata": {
"error_type": "authentication",
"gateway_code": "invalid_key"
}
}
}{
"error": {
"code": 402,
"message": "...",
"metadata": {
"error_type": "payment_required",
"gateway_code": "insufficient_credits"
}
}
}{
"error": {
"code": 404,
"message": "The requested model does not exist or is not granted to this key. GET /api/v1/models lists the model aliases available to this key.",
"metadata": {
"error_type": "not_found",
"gateway_code": "model_not_found",
"param": "model"
}
}
}Authorization
An inference key, as Authorization: Bearer KEY.
Body application/json
modelstringrequiredA speech-to-text model from
GET /api/v1/models?output_modalities=transcription, such asopenai/whisper-large-v3-turbo.input_audioobjectrequireddata(the audio in base64) andformat. Aurlis a 400: send the bytes.response_formatstringjson(the default:textandusage) orverbose_json, which addstask,language,duration,segmentsandwords, on a model whoseverbose_jsonistrue.jsonverbose_jsonlanguagestringAn ISO-639-1 code such as
en; omitted, the provider detects it.temperaturenumber0 to 1.
timestamp_granularitiesstring[]Sent with
verbose_jsononly.providerobjectThe audio routes read only the data policy fields;
order,only,ignore,allow_fallbacksandsortare accepted and ignored. With the OpenAI SDK, send it inextra_body.Show 2 child fields
zdrbooleantruekeeps the request on providers that declare 0 days of retention.data_collectionstringdenykeeps the request on providers that declare no training and 0 days of retention.allowdeny
Response 200
The text, with usage.seconds (what the call billed) and usage.cost in US dollars. The X-Generation-Id header names the call's generation record.
Errors
400A field is missing or malformed (
invalid_request, withmetadata.param), or the model cannot do what the request asks (unsupported_capability).401No key, or the key is unknown, expired, revoked or disabled.
402Your balance is spent and the model is not free, or the request could cost more than your balance.
404No model has this name, or your key may not call it.
413The file is over 25 MiB (
request_too_large). Send a shorter file.