POST/v1/audio/transcriptions

Transcriptions

Transcribe audio into text.

OpenAI-dialect speech-to-text. The audio upload and the whole request are bounded by the 8 MiB gateway body cap.

Request body (multipart)

FieldTypeRequiredNotes
modelstringyesA speech-to-text model ID from the catalogue (e.g. qwen/qwen3-asr-1.7b).
filefile (binary)yesThe audio file.
languagestringnoISO-639-1 hint.
promptstringnoOptional context/style prompt.
response_formatstringnojson (default), verbose_json, text, srt, vtt.
temperaturenumbernoSampling temperature.
timestamp_granularitiesstring[]noword and/or segment (with verbose_json).

Response formats

  • json / verbose_json → JSON body with provider_metadata.
  • text / srt / vtt → returned verbatim; provider_metadata is in the X-TF-* headers only.

Code sample

curl https://api.<domain>/v1/audio/transcriptions \
  -H "Authorization: Bearer $TOKENFACTORY_API_KEY" \
  -F model=qwen/qwen3-asr-1.7b \
  -F "[email protected]"
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.<domain>/v1",
    api_key=os.environ["TOKENFACTORY_API_KEY"],
)

with open("recording.mp3", "rb") as f:
    transcript = client.audio.transcriptions.create(
        model="qwen/qwen3-asr-1.7b",
        file=f,
    )
print(transcript.text)

JSON response

{
  "text": "Today is a wonderful day…",
  "usage": { "type": "duration", "seconds": 12.3 },
  "provider_metadata": { "provider": "configured-backend" }
}

With response_format: "verbose_json" the body also carries language, duration, segments[], and words[] when the provider reports them. usage is kept exactly as the provider reported it (duration-based or token-based) — never invented.

Errors

Standard error surface — see Errors.

Translations

POST /v1/audio/translations — same contract as transcriptions; the output is English text regardless of the spoken language.

Request body (multipart)

FieldTypeRequiredNotes
modelstringyesAn STT alias.
filefile (binary)yesThe audio file.
promptstringnoOptional context.
response_formatstringnojson (default), verbose_json, text, srt, vtt.
temperaturenumbernoSampling temperature.

Model support

Use this endpoint only with a catalogue model explicitly documented to support translation. Speech-to-text support alone does not establish translation support. Check the model's documented capabilities before using this endpoint.

Response

Same shapes as transcriptions (text + optional verbose fields + usage + provider_metadata; non-JSON formats returned verbatim with side-channel headers).

Errors

Standard error surface — see Errors.

We use strictly necessary cookies to record your choice and run this site. We do not use cookies for advertising or tracking. See the Cookie Policy.