Speech Transcriptions (POST /v1/audio/transcriptions)
Transcribes audio into text in the specified format with complete OpenAI API wire compatibility.
HTTP Request
http
POST /v1/audio/transcriptions
Authorization: Bearer sk-oneasr-...
Content-Type: multipart/form-dataRequest Body (Multipart Form)
| Field | Type | Required | Description |
|---|---|---|---|
file | binary | Yes | The audio file object (mp3, mp4, wav, m4a, ogg, webm, flac, etc.). |
model | string | Yes | Target engine/model name (e.g. faster-whisper, qwen, whisper-1). |
language | string | No | ISO-639-1 language code (e.g. en, zh, ja, de, ko). |
prompt | string | No | Optional guide prompt to steer spelling or domain vocabulary. |
response_format | string | No | Output format: json (default), text, srt, verbose_json, vtt. |
temperature | number | No | Sampling temperature (0.0 to 1.0, default: 0.0). |
timestamp_granularities | array | No | Granularities for verbose_json: ["word"], ["segment"]. |
Code Examples
cURL
bash
curl -X POST http://localhost:8000/v1/audio/transcriptions \
-H "Authorization: Bearer sk-oneasr-v1-xxx" \
-F file="@podcast.mp3" \
-F model="faster-whisper" \
-F response_format="verbose_json"Python (Official OpenAI SDK)
python
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:8000/v1",
api_key="sk-oneasr-v1-xxx"
)
with open("speech.mp3", "rb") as f:
result = client.audio.transcriptions.create(
model="faster-whisper",
file=f,
response_format="verbose_json"
)
print(result.text)Response (verbose_json)
json
{
"task": "transcribe",
"language": "english",
"duration": 5.24,
"text": "Welcome to OneASR private voice gateway.",
"segments": [
{
"id": 0,
"seek": 0,
"start": 0.0,
"end": 5.2,
"text": "Welcome to OneASR private voice gateway.",
"tokens": [50364, 4843, 284, 1530, 50589],
"temperature": 0.0,
"avg_logprob": -0.12,
"compression_ratio": 1.1,
"no_speech_prob": 0.001
}
]
}