Create transcription
Troubleshooting
Encountering errors during API calls? See the API Error Codes Reference for a complete list of error types and troubleshooting solutions.
POST https://openqiao.com/api/v1/audio/transcriptionsThe Create transcription endpoint converts input audio into text (Speech-to-Text).
This endpoint takes a JSON request body. The audio is passed inline as base64-encoded bytes (or by URL) in the input_audio object. By default it returns a single JSON response with the transcript and token usage. Set stream to true to receive the transcript incrementally as Server-Sent Events instead.
Request headers
Authorization string *
Bearer Token authentication, formatted as Bearer $OPENQIAO_API_KEY.
Content-Type string *
Request content type, defaults to application/json.
Request
model string *
The model ID to use, in the format <provider>/<model-name>, for example qwen/qwen3-asr-flash.
input_audio object *
The audio to transcribe. Provide either data or url (at least one is required). Contains the following fields:
datastringOptional — the base64-encoded audio bytes. This is the raw base64 string only, not adata:URI.urlstringOptional — a publicly accessible URL to the audio file. Used whendatais not provided.formatstringOptional — the audio container format. One ofwav,mp3,flac,m4a,ogg,webm,aac. Defaults towavwhen omitted.
language string Optional
The language of the input audio as an ISO-639-1 code (e.g. en, ja, zh). Auto-detected when omitted.
enable_itn boolean Optional
Whether to apply inverse text normalization (e.g. rendering spoken numbers as digits) to the transcript. Uses the model's default when omitted.
stream boolean Optional
Whether to stream the transcript, defaults to false.
false— returns a single JSON response with the full transcript and token usage.true— returns the transcript as Server-Sent Events (Content-Type: text/event-stream), matching OpenAI's streaming format. The transcript text is delivered intranscript.text.deltaevents (each carrying an incrementaldelta), followed by atranscript.text.doneevent carrying the fulltextand token usage, and finally a[DONE]event.
Response
Non-streaming (default)
On success, the response is a JSON object with the transcript and token usage:
{
"text": "OpenQiao is an LLM API aggregation service.",
"model": "qwen/qwen3-asr-flash",
"usage": {
"input_tokens": 120,
"output_tokens": 11,
"total_tokens": 131,
"seconds": 3
}
}text— the transcribed text.model— the model slug used to produce the transcription.usage— token usage withinput_tokens,output_tokens, andtotal_tokens. The optionalsecondsfield reports the duration of the transcribed audio in seconds, when the provider returns it.
Streaming (stream: true)
The response is a text/event-stream of Server-Sent Events. Each event is a data: line containing a JSON object:
data: {"type":"transcript.text.delta","delta":"OpenQiao is "}
data: {"type":"transcript.text.delta","delta":"an LLM API aggregation service."}
data: {"type":"transcript.text.done","text":"OpenQiao is an LLM API aggregation service.","usage":{"input_tokens":120,"output_tokens":11,"total_tokens":131,"seconds":3}}
data: [DONE]transcript.text.delta— carries an incremental chunk of transcript text indelta. Concatenating all deltas yields the same text as the non-streamingtextfield.transcript.text.done— carries the fulltextand the tokenusageobject withinput_tokens,output_tokens, andtotal_tokens(andsecondswhen reported).[DONE]— marks the end of the stream.
Providers without a native incremental transcription API emit the full transcript as a single transcript.text.delta followed by transcript.text.done.
On error, the endpoint returns a JSON object instead:
{
"error": {
"code": "...",
"type": "...",
"message": "..."
}
}Errors use standard HTTP status codes (e.g. 400 for an invalid request such as a missing input_audio.data, 403, 404).
# Build the base64 audio from a local file, then POST it as JSON.
AUDIO_B64=$(base64 -w 0 speech.wav)
curl https://openqiao.com/api/v1/audio/transcriptions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENQIAO_API_KEY" \
-d '{
"model": "qwen/qwen3-asr-flash",
"input_audio": {
"data": "'"$AUDIO_B64"'",
"format": "wav"
},
"language": "en"
}'import { readFile } from "node:fs/promises";
// Build the base64 audio from a local file.
const data = (await readFile("speech.wav")).toString("base64");
const response = await fetch("https://openqiao.com/api/v1/audio/transcriptions", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.OPENQIAO_API_KEY}`,
},
body: JSON.stringify({
model: "qwen/qwen3-asr-flash",
input_audio: {
data,
format: "wav",
},
language: "en",
}),
});
const { text } = await response.json();
console.log(text);import base64
import os
import requests
# Build the base64 audio from a local file.
with open("speech.wav", "rb") as f:
data = base64.b64encode(f.read()).decode("utf-8")
response = requests.post(
"https://openqiao.com/api/v1/audio/transcriptions",
headers={
"Content-Type": "application/json",
"Authorization": f"Bearer {os.environ['OPENQIAO_API_KEY']}",
},
json={
"model": "qwen/qwen3-asr-flash",
"input_audio": {
"data": data,
"format": "wav",
},
"language": "en",
},
)
print(response.json()["text"]){
"text": "OpenQiao is an LLM API aggregation service.",
"model": "qwen/qwen3-asr-flash",
"usage": {
"input_tokens": 120,
"output_tokens": 11,
"total_tokens": 131,
"seconds": 3
}
}To receive the transcript as Server-Sent Events, set stream to true:
curl https://openqiao.com/api/v1/audio/transcriptions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENQIAO_API_KEY" \
-d '{
"model": "qwen/qwen3-asr-flash",
"input_audio": {
"url": "https://example.com/speech.mp3",
"format": "mp3"
},
"stream": true
}'Content-Type: text/event-stream
data: {"type":"transcript.text.delta","delta":"OpenQiao is "}
data: {"type":"transcript.text.delta","delta":"an LLM API aggregation service."}
data: {"type":"transcript.text.done","text":"OpenQiao is an LLM API aggregation service.","usage":{"input_tokens":120,"output_tokens":11,"total_tokens":131,"seconds":3}}
data: [DONE]