Skip to main content

POST /v1/audio/transcriptions

Transcribes an audio file into text. The request body must be sent as multipart/form-data with the audio file included as a form field. This endpoint maps to the createTranscription operation and is compatible with the OpenAI Whisper API.

Request headers

string
The provider to route the request to (e.g. openai). Required when not using a config.
string
Your provider API key.
string
A JSON config object or config ID that defines routing, fallbacks, retries, and more.
string
A virtual key ID from Portkey Cloud.

Request body

This endpoint accepts multipart/form-data. The audio file must be uploaded as a file field named file.
file
required
The audio file to transcribe. Supported formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, webm. Maximum file size is 25 MB.
string
required
The speech-to-text model to use (e.g. whisper-1, gpt-4o-transcribe).
string
The language of the audio, in ISO-639-1 format (e.g. en, fr, de). Providing the language improves accuracy and latency.
string
Optional text to guide the model’s style or provide context. The prompt should match the language of the audio.
string
default:"json"
The format of the transcription output. One of json, text, srt, verbose_json, or vtt.
number
default:"0"
Sampling temperature between 0 and 1. Higher values produce more varied output. Set to 0 for deterministic transcription.
string[]
The granularity of timestamps to include. Requires response_format to be verbose_json. Accepts word and/or segment.

Response

The response format depends on the response_format parameter. json (default)
string
The transcribed text.
verbose_json
string
The full transcribed text.
string
The detected language of the audio.
number
The duration of the audio file in seconds.
object[]
Segment-level transcription data, present when timestamp_granularities includes segment.
object[]
Word-level transcription data, present when timestamp_granularities includes word.
text, srt, vtt — Plain-text or subtitle format strings.

Code examples