TokenRa
中文Get API Key

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

POSThttps://tokenra.io/v1/audio/transcriptions
Accepts multipart/form-data. Returns the transcript synchronously in the response body. No Content-Type: application/json header needed.

Parameters

Request parameters

ParameterTypeRequiredDefaultDescription
filefileYes—The audio file to transcribe. Supported formats: mp3, wav, m4a, flac, ogg, webm, mp4. Send as the file form field.
modelstringYes—Must be whisper-1.
languagestringNoautoISO-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_formatstringNojsonOutput format. One of json, text, srt, vtt, verbose_json.
promptstringNo—Optional text to guide the model’s style or suggest domain-specific vocabulary.
temperaturenumberNo0Sampling temperature between 0 and 1. Higher values produce more varied output.

Response formats

response_format options

ValueReturnsUse when
json{"text": "transcript"}Default; easiest to parse programmatically.
textPlain UTF-8 stringYou just need the raw transcript with no envelope.
srtSubRip subtitle fileEmbedding subtitles in video editing software.
vttWebVTT subtitle fileWeb video captions via the HTML <track> element.
verbose_jsonJSON with language, duration, segments and wordsPer-segment or per-word timestamps for alignment.

Examples

Code examples

cURL

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)

Python
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)

JavaScript
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

HTTPCodeCause
400invalid_request_errorMissing file or model field, or unsupported file format.
401invalid_api_keyAPI key missing or revoked.
402insufficient_quotaAccount balance too low to cover the estimated cost.
403permission_deniedToken does not have access to whisper-1.
503model_not_foundNo 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.