Translates audio content to a specified language.

Endpoint

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

Request parameters

The following table outlines the parameters required to make an audio translation 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

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

CURL

curl --location 'https://api.sambanova.ai/v1/audio/translations' \
--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": "Es un efecto de sonido de una campana sonando, específicamente una campana de iglesia."
}

Text

Es un efecto de sonido de una campana sonando, específicamente una campana de iglesia.