Converts audio to text in the specified language.

Endpoint

POST https://api.sambanova.ai/v1/audio/transcriptions

Request parameters

The following table outlines the parameters required to make a transcription request, parameter type, description, and default values.

ParameterTypeDescriptionDefault
modelstringThe ID of the model to use. Only Qwen2-Audio-7B-Instruct is currently available.Required
messagesMessageA list of messages containing role (user/system/assistant), type (text/audio_content), and audio_content (base64 audio content).Required
response_formatstringThe output format is either json or text.json
temperaturenumberSampling temperature between 0 and 1. Higher values (e.g., 0.8) increase randomness, while lower values (e.g., 0.2) make output more focused.0
max_tokensnumberThe maximum number of tokens to generate.1000
filefileAudio file in flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm format. Each single file must not exceed 30 seconds in duration.Required
languagestringThe target language for transcription or translation.Optional
streambooleanEnables streaming responses.false
stream_optionsobjectAdditional streaming configuration (e.g., {“include_usage”: true}).Optional

Request format

CURL

This section provides examples of how to send a request using different methods.

curl --location 'https://api.sambanova.ai/v1/audio/transcriptions' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--form 'model="Qwen2-Audio-7B-Instruct"' \
--form 'language="spanish"' \
--form 'response_format="json"' \
--form 'temperature="0.01"' \
--form 'file=@"/path/to/audio/file.mp3"' \
--form 'stream="true"'

Python

Response format

The API returns a translation of the input audio in the selected format.

JSON

{
    "text": "It's a sound effect of a bell chiming, specifically a church bell."
}

Text

It's a sound effect of a bell chiming, specifically a church bell.