Skip to main content

Audio Translation

Available Models

A full list of models can be viewed on the Models page or retrieved dynamically via API endpoints: https://openai.bothub.chat/v1/models and https://bothub.chat/api/v2/replicate/v1/models

The audio translation API allows you to convert speech from audio files into text in English. Unlike standard transcription, where the result is returned in the language of the original recording, translation always returns text in English, regardless of the source audio's language.

This capability is especially useful when processing interviews, calls, podcasts, video recordings, and other multilingual content. For example, you can automatically get English subtitles for videos or translate voice messages for further analysis.

The whisper-1 model is used for audio translation. It is built on OpenAI's Whisper and supports a large number of languages, and also handles noisy speech and long recordings well.


Supported Formats​

The API supports mp3, mp4, mpeg, mpga, m4a, wav, and webm formats.


Basic Example​

import OpenAI from "openai";
import fs from "fs";

const openai = new OpenAI({
apiKey: "<your_access_token>",
baseURL: "https://openai.bothub.chat/v1",
});

async function main() {
const translation = await openai.audio.translations.create({
file: fs.createReadStream("/path/to/audio.mp3"),
model: "whisper-1",
});

console.log(translation.text);
}

main();

Advanced JSON Response​

In addition to a standard text response, the API supports the verbose_json format. It allows you to obtain additional information about the translation result, including text segments, timestamps, and service metadata.

To use the advanced response format, pass the parameter response_format: "verbose_json".

const translation = await openai.audio.translations.create({
file: fs.createReadStream("/path/to/audio.mp3"),
model: "whisper-1",
response_format: "verbose_json",
});

console.log(translation.text);
console.log(translation.segments);

Main Parameters​

ParameterTypeDescription
filefileAudio file for translation
modelstringTranslation model (whisper-1)
promptstringAdditional context to improve quality
response_formatstringResponse format (json, text, verbose_json, srt, vtt)
temperaturenumberRandomness/variability level of generation

Recommendations​

info

For more accurate results, it is recommended to use recordings with high-quality audio and minimal background noise. If you are working with long audio files, it is better to split them into several parts. Use the verbose_json format to work with timecodes and text segments.