Audio · OpenAI
Whisper-1 API Docs: Parameters and Examples
Whisper-1 is OpenAI’s speech-to-text model served on TokenRa behind the standard /v1/audio/transcriptions endpoint. Send an audio file as multipart/form-data and get a transcript back synchronously. No task polling, no async loop. Billed per audio minute at $9 per million tokens (1 000 tokens per minute).
- Model ID
whisper-1- Provider
- OpenAI
- Mode
- Synchronous
- Input price
- $9 / 1M tokens
- Output price
- $0
- Rate
- 1 000 tokens/min
Endpoint
API endpoint
multipart/form-data. Returns the transcript synchronously in the response body. No Content-Type: application/json header needed.Parameters
Request parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
file | file | Yes | — | The audio file to transcribe. Supported formats: mp3, wav, m4a, flac, ogg, webm, mp4. Send as the file form field. |
model | string | Yes | — | Must be whisper-1. |
language | string | No | auto | ISO-639-1 language code, e.g. en, zh, ja. The model auto-detects if omitted, but providing it speeds up processing and reduces errors on short clips. |
response_format | string | No | json | Output format. One of json, text, srt, vtt, verbose_json. |
prompt | string | No | — | Optional text to guide the model’s style or suggest domain-specific vocabulary. |
temperature | number | No | 0 | Sampling temperature between 0 and 1. Higher values produce more varied output. |
Response formats
response_format options
| Value | Returns | Use when |
|---|---|---|
json | {"text": "transcript"} | Default; easiest to parse programmatically. |
text | Plain UTF-8 string | You just need the raw transcript with no envelope. |
srt | SubRip subtitle file | Embedding subtitles in video editing software. |
vtt | WebVTT subtitle file | Web video captions via the HTML <track> element. |
verbose_json | JSON with language, duration, segments and words | Per-segment or per-word timestamps for alignment. |
Examples
Code examples
cURL
curl https://tokenra.io/v1/audio/transcriptions -H "Authorization: Bearer $TOKENRA_API_KEY" -F file=@audio.mp3 -F model="whisper-1"Python (openai SDK)
from openai import OpenAI
client = OpenAI(
api_key="YOUR_TOKENRA_API_KEY",
base_url="https://tokenra.io/v1",
)
with open("audio.mp3", "rb") as f:
transcript = client.audio.transcriptions.create(
model="whisper-1",
file=f,
response_format="text", # or "json", "srt", "vtt", "verbose_json"
language="en", # optional; auto-detected if omitted
)
print(transcript)JavaScript (fetch)
const form = new FormData();
form.append("file", fs.createReadStream("audio.mp3"));
form.append("model", "whisper-1");
const res = await fetch("https://tokenra.io/v1/audio/transcriptions", {
method: "POST",
headers: { Authorization: "Bearer " + process.env.TOKENRA_API_KEY },
body: form,
});
const data = await res.json();
console.log(data.text);Errors
Error codes
| HTTP | Code | Cause |
|---|---|---|
| 400 | invalid_request_error | Missing file or model field, or unsupported file format. |
| 401 | invalid_api_key | API key missing or revoked. |
| 402 | insufficient_quota | Account balance too low to cover the estimated cost. |
| 403 | permission_denied | Token does not have access to whisper-1. |
| 503 | model_not_found | No available channel for whisper-1 in your group. |
FAQ
Frequently asked questions
How is billing calculated?
One minute of audio equals 1 000 tokens, billed at $9 per million tokens. A five-minute recording costs $0.045. Output tokens are always zero.
What audio formats are supported?
mp3, wav, m4a, flac, ogg, webm, and mp4. Files without a recognized extension may cause the duration estimator to fail and return an error.
Do I need to specify the language?
No. Auto-detection is built in. Specifying language with an ISO-639-1 code speeds up processing and reduces errors on short clips or non-dominant languages.
How do I get subtitles?
Set response_format to srt or vtt. For per-word timestamps use verbose_json.
Is there a file size limit?
The default upload limit is 32 MB. Files longer than about 90 minutes may exceed it; split long recordings first.