Skip to content

Whisper: Speech-to-Text API ​

The Speech-to-Text API allows you to transcribe audio into text. The API also provides endpoints to list available models.

Limitations

File Size Limit: Maximum file size is 10MB per audio file.

The Whisper Large V3 Turbo is the fastest version of the Whisper speech-to-text model, accessible through the same Digital Marketplace plan. It provides OpenAI-compatible API endpoints for transcribing audio into text with improved processing speed.

Endpoints ​

1. Create Transcription ​

POST /v1/audio/transcriptions

Description ​

Transcribes audio into the input language with faster processing times.

Request Body ​
json
{
  "file": "*.wav/*.mp3",
  "model": "openai/whisper-large-v3-turbo",
  "language": "en",
  "prompt": "Transcribe using only lowercase letters",
  "response_format": "json",
  "temperature": 0,
  "timestamp_granularities": ["segment"]
}
FieldTypeRequiredDescription
filestringYesThe audio file to transcribe (flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, webm)
modelstringYesID of the model to use. Use openai/whisper-large-v3-turbo
languagestringNoLanguage of the input audio in ISO-639-1 format (e.g., en). Auto-detected if omitted
promptstringNoOptional text to guide the model's style or continue a previous segment
response_formatstringNoFormat of the output (json, text, srt, verbose_json, or vtt). Default: json
temperaturenumberNoSampling temperature (0-1). Default: 0
timestamp_granularitiesarrayNoTimestamp granularity (word, segment). Default: ["segment"]. Requires verbose_json
streambooleanNoEnable streaming output. Default: false
Response Formats ​

json (default) — Standard transcription response

json
{
  "text": "Hello, this is a transcription.",
  "usage": {
    "type": "duration",
    "seconds": 6
  }
}

verbose_json — Detailed transcription with segments and words

json
{
  "text": "Hello, this is a transcription.",
  "language": "en",
  "duration": "5.42",
  "segments": [
    {
      "id": 0,
      "seek": 0,
      "start": 0.0,
      "end": 2.5,
      "text": "Hello, this is a transcription",
      "tokens": [50364, 938, 428, 307, 275, 28347],
      "temperature": 0.0,
      "avg_logprob": -0.245,
      "compression_ratio": 1.235,
      "no_speech_prob": null
    }
  ],
  "words": null
}

Note: no_speech_prob is currently always null (not yet supported).

text — Plain text response (same structure as json)

json
{
  "text": "Hello, this is a transcription.",
  "usage": {
    "type": "duration",
    "seconds": 6
  }
}

stream — Streaming response (when stream: true)

json
{
  "id": "trsc-<uuid>",
  "object": "transcription.chunk",
  "created": 1715000000,
  "model": "openai/whisper-large-v3-turbo",
  "choices": [
    {
      "delta": { "content": "Hello" },
      "finish_reason": null,
      "stop_reason": null
    }
  ],
  "usage": null
}

2. List Models ​

GET /v1/models

Description ​

Lists all available models and their metadata.

Response ​
json
{
  "object": "list",
  "data": [
    {
      "id": "openai/whisper-large-v3-turbo",
      "object": "model",
      "created": 1672531200,
      "owned_by": "SwissAI"
    }
  ]
}

Example Code Snippets ​

Note:
The production URL for this API is available in the corresponding plan for this model in the Digital Marketplace. Both Whisper models (Faster Whisper Large V3 and Whisper Large V3 Turbo) are accessible through the same Digital Marketplace plan. To retrieve the URL:

  1. Navigate to the Digital Marketplace.
  2. Go to the Documentation section.
  3. Select the plan associated with the Whisper model.
  4. Locate the production URL provided in the plan details.
  5. Set up the environment variable API_URL to the production URL retrieved.

How to retrieve the production URL

1. Using curl ​

Create Transcription ​
bash
curl -X POST $API_URL/audio/transcriptions \
-H "Authorization: Bearer $YOUR_API_KEY" \
-H "Content-Type: multipart/form-data" \
-F "file=@path/to/audio.wav" \
-F "model=openai/whisper-large-v3-turbo" \
-F "language=en" \
-F "response_format=json" \
-F "temperature=0"
List Models ​
bash
curl -X GET $API_URL/v1/models \
-H "Authorization: Bearer YOUR_API_KEY"

2. Using Python (OpenAI Client) ​

Create Transcription ​
python
import os
import openai

client = openai.OpenAI(
    api_key=os.getenv("YOUR_API_KEY"),
    base_url=os.getenv("API_URL") + "/v1",
)

audio_file = open("Your-Audio-File.mp3", "rb")
transcript = client.audio.transcriptions.create(
    model="openai/whisper-large-v3-turbo",
    file=audio_file,
)

print(transcript.text)
List Models ​
python
import os
import openai

client = openai.OpenAI(
    api_key=os.getenv("YOUR_API_KEY"),
    base_url=os.getenv("API_URL") + "/v1",
)

response = client.models.list()
print(response)

Replace YOUR_API_KEY with your actual API key to authenticate the requests. You can follow the procedure in Inference Endpoints Overview