Sprachtranskription (POST /v1/audio/transcriptions)
Transkribiert Audio in Text im angegebenen Format mit vollständiger OpenAI-API-Wire-Kompatibilität.
HTTP-Anfrage
http
POST /v1/audio/transcriptions
Authorization: Bearer sk-oneasr-...
Content-Type: multipart/form-dataAnfrage-Body (Multipart Form)
| Feld | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
file | binary | Ja | Die Audiodatei (mp3, mp4, wav, m4a, ogg, webm, flac usw.). |
model | string | Ja | Ziel-Engine-/Modellname (z. B. faster-whisper, qwen, whisper-1). |
language | string | Nein | ISO-639-1-Sprachcode (z. B. de, en, zh, ja, ko). |
prompt | string | Nein | Optionaler Leit-Prompt zur Steuerung von Schreibweisen oder Fachbegriffen. |
response_format | string | Nein | Ausgabeformat: json (Standard), text, srt, verbose_json, vtt. |
temperature | number | Nein | Sampling-Temperatur (0.0 bis 1.0, Standard: 0.0). |
timestamp_granularities | array | Nein | Zeitstempel-Granularität für verbose_json: ["word"], ["segment"]. |
Code-Beispiele
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 (Offizielles 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)Antwort (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
}
]
}