Skip to main content

Speech To Text Endpoint

Overview

Speech-to-Text transforms audio into written transcription, allowing spoken language to be converted into text for various applications.

Request

--request POST 'https://modelslab.com/api/v6/whisper/transcribe' \

Make a POST request to https://modelslab.com/api/v6/whisper/transcribe endpoint and pass the required parameters as a request body.

Body Attributes

ParameterDescriptionValues
keyYour API Key used for request authorizationstring
audio_urlURL of the audio file to be transcribed.File (wav, mp3, flac, opus), max duration: 65 seconds string (URL)
input_languageThe language code of the audio content.string (ISO 639-1, e.g., 'en', 'es', 'fr')
timestamp_levelSpecifies the level of detail for timestamps in the transcription.'word', 'sentence', or null (default: null)
webhookSet a URL to receive a POST API call once the audio generation is complete.URL
track_idThis ID is returned in the response to the webhook API call. Used to identify the webhook request.integral value

Input Languages Supported

"Afrikaans": "af",
"Arabic": "ar",
"Belarusian": "be",
"Bengali": "bn",
"Bulgarian": "bg",
"Chinese": "zh",
"Czech": "cs",
"Danish": "da",
"Dutch": "nl",
"English": "en",
"Finnish": "fi",
"French": "fr",
"German": "de",
"Greek": "el",
"Hebrew": "he",
"Hindi": "hi",
"Hungarian": "hu",
"Indonesian": "id",
"Italian": "it",
"Japanese": "ja",
"Kannada": "kn",
"Korean": "ko",
"Malayalam": "ml",
"Marathi": "mr",
"Nepali": "ne",
"Panjabi": "pa",
"Persian": "fa",
"Polish": "pl",
"Portuguese": "pt",
"Romanian": "ro",
"Russian": "ru",
"Serbian": "sr",
"Spanish": "es",
"Swedish": "sv",
"Tagalog": "tl",
"Tamil": "ta",
"Telugu": "te",
"Thai": "th",
"Turkish": "tr",
"Ukrainian": "uk",
"Urdu": "ur",
"Vietnamese": "vi",
"Welsh": "cy"
info

Whisper supports several languages, but performance may vary due to factors like limited training data, script complexity, and regional dialects, potentially affecting transcription accuracy.

Example

Body

Body
{
"key": "",
"audio_url": "https://pub-f3505056e06f40d6990886c8e14102b2.r2.dev/audio/tom_hanks_1.wav",
"input_language": "en",
"timestamp_level": null,
"webhook": null,
"track_id": null
}

Request

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
"key": "",
"audio_url": "https://pub-f3505056e06f40d6990886c8e14102b2.r2.dev/audio/tom_hanks_1.wav",
"input_language": "en",
"timestamp_level": null,
"webhook": null,
"track_id": null
});

var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};

fetch("https://modelslab.com/api/v6/whisper/transcribe", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Response

{
"status": "success",
"eta": 5,
"id": 330711,
"output": [
"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/2966b901-d93a-4b3b-a2f5-db2b6ea081a8.txt"
],
"proxy_links": [
"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/2966b901-d93a-4b3b-a2f5-db2b6ea081a8.txt"
],
"meta": {
"input_language": "en",
"timestamp_level": null,
"file_id": "2966b901-d93a-4b3b-a2f5-db2b6ea081a8",
"duration": 11.311,
"audio_url": "https://pub-f3505056e06f40d6990886c8e14102b2.r2.dev/audio/tom_hanks_1.wav"
}
}