Transcription
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
Transcription is the process of converting audio or speech into text. With the available model, you can automatically recognize speech from: voice messages, interviews and podcasts, calls and meetings, videos and streams, and voice recordings.
This is convenient for creating subtitles, searching through audio, automating customer support, and processing voice content. Currently, the following model is available for transcription:
whisper-1
The model supports many languages, is capable of recognizing noisy speech, and is well-suited for both short and long audio files.
Supported File Formats
The API supports popular audio formats: mp3, mp4, mpeg, mpga, m4a, wav, webm.
Transcription Example
- JS
- Python
- Go
- cURL
import OpenAI from 'openai';
import fs from 'fs';
const openai = new OpenAI({
apiKey: 'YOUR_BOTHUB_API_KEY',
baseURL: 'https://openai.bothub.chat/v1'
});
async function main() {
const { text } = await openai.audio.transcriptions.create({
file: fs.createReadStream("/path/to/file.mp3"),
model: "whisper-1",
});
console.log(text)
}
main();
from openai import OpenAI
client = OpenAI(
api_key='YOUR_BOTHUB_API_KEY',
base_url='https://openai.bothub.chat/v1'
)
audio_file = open("/path/to/file.mp3", "rb")
transcript = client.audio.transcriptions.create(
model="whisper-1",
file=audio_file
)
print(transcript.text)
package main
import (
"context"
"fmt"
"os"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAPIKey("YOUR_BOTHUB_API_KEY"),
option.WithBaseURL("https://openai.bothub.chat/v1"),
)
file, err := os.Open("/path/to/file.mp3")
if err != nil {
panic(err)
}
defer file.Close()
transcription, err := client.Audio.Transcriptions.New(context.Background(), openai.AudioTranscriptionNewParams{
Model: openai.AudioModelWhisper1,
File: openai.File(file, "file.mp3", "audio/mpeg"),
})
if err != nil {
panic(err)
}
fmt.Println(transcription.Text)
}
curl https://openai.bothub.chat/v1/audio/transcriptions \
-H "Authorization: Bearer YOUR_BOTHUB_API_KEY" \
-H "Content-Type: multipart/form-data" \
-F file="@/path/to/file.mp3" \
-F model="whisper-1"
Main Parameters
| Parameter | Type | Description |
|---|---|---|
file | file | Audio file for transcription |
model | string | Speech recognition model (whisper-1) |
language | string | Audio language in ISO-639-1 format (optional) |
prompt | string | Additional context to improve recognition |
response_format | string | Response format (json, text, srt, verbose_json, vtt) |
temperature | number | Randomness/variability level of generation |
Recommendations
For more accurate transcription, it is recommended to:
- use a high-quality audio source
- minimize background noise
- specify the language using the
languageparameter - split long recordings into several parts
You can view the official OpenAI documentation here