DocsAPI Reference
Endpoints

Transcription

Turn speech into text with the OpenAI transcription API, billed per second of audio.


POST /v1/audio/transcriptions accepts the OpenAI transcription request and forwards it to the provider that serves the requested model. Tokamak changes the model field to the provider's own model id and relays the provider's answer.

Use your Tokamak inference key. Transcription models are priced per second (audio_input_second); openai/gpt-transcribe is the current one. Like every voice model it is left out of the default Models list (add X-PROVIDER-DATA: true to see it). openai/gpt-live-transcribe and openai/gpt-realtime-whisper transcribe only in a Realtime session (intent=transcription); this endpoint refuses them with 400 unsupported_value.

Transcribe a file

curl -sS https://api.tokamak.sh/v1/audio/transcriptions \
  -H "Authorization: Bearer $TOKAMAK_API_KEY" \
  -F "model=openai/gpt-transcribe" \
  -F "[email protected]"
{
  "text": "Hello from the meeting.",
  "languages": [{ "code": "en" }],
  "usage": { "type": "duration", "seconds": 3 }
}

With the OpenAI SDK, only the base URL and the key change:

from openai import OpenAI

client = OpenAI(base_url="https://api.tokamak.sh/v1", api_key=TOKAMAK_API_KEY)
with open("meeting.wav", "rb") as f:
    t = client.audio.transcriptions.create(model="openai/gpt-transcribe", file=f)
print(t.text, t.usage.seconds)

Formats and streaming

  • response_format: json (default) or text. For text, Tokamak asks the provider for JSON, which carries the usage it bills from, and returns the transcript as text/plain the way OpenAI does.
  • srt, vtt, verbose_json and diarized_json are refused with 400 unsupported_value: gpt-transcribe does not offer them, and srt/vtt carry no usage.
  • stream=true returns OpenAI's server-sent events; the last event, transcript.text.done, carries the usage.

Billing and limits

  • Billing is per second of audio, in whole seconds as the provider reports them (usage.seconds, rounded up).
  • Before the request is sent, Tokamak reads the duration from the file's container (WAV, FLAC, MP3, MP4/M4A, Ogg Opus or Vorbis, or WebM, including browser MediaRecorder output) and holds credit for it plus a second. The hold is released at settlement; you are charged only for the reported seconds.
  • A file whose duration cannot be read is refused with 422 when your organization is charged for usage.
  • Files up to 25 MB, as at OpenAI.
  • The recording goes to the provider as uploaded, so a key a guardrail policy applies to gets 403 guardrail_policy_unsupported, unless an organization admin turned on Allow unscreened voice for that policy. A prompt is screened like any text.
  • /v1/audio/translations is not served: OpenAI retires whisper-1 translations on 2027-02-26, and they report no usage. For text read aloud, see Speech.
  • Tokamak's own errors use the OpenAI error shape. Provider errors are returned as the provider sent them.

The settled generation id is returned in the X-Tokamak-Execution-Id response header.

On this page