import fs from 'fs';
import SambaNova from 'sambanova';
const client = new SambaNova({
apiKey: process.env['SAMBANOVA_API_KEY'], // This is the default and can be omitted
});
const transcriptionResponse = await client.audio.transcriptions.create({
file: fs.createReadStream('path/to/file'),
model: 'Whisper-Large-v3',
});
console.log(transcriptionResponse.text);import os
from sambanova import SambaNova
client = SambaNova(
api_key=os.environ.get("SAMBANOVA_API_KEY"), # This is the default and can be omitted
)
transcription_response = client.audio.transcriptions.create(
file=b"Example data",
model="Whisper-Large-v3",
)
print(transcription_response.text)curl --request POST \
--url https://api.sambanova.ai/v1/audio/transcriptions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form model=Whisper-Large-v3 \
--form file=@example-file \
--form 'prompt=Please transcribe carefully, including pauses and hesitations.' \
--form language=es \
--form response_format=json<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sambanova.ai/v1/audio/transcriptions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nWhisper-Large-v3\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary audio file, e.g. \"sample.wav\")\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nPlease transcribe carefully, including pauses and hesitations.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\nes\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"response_format\"\r\n\r\njson\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data; boundary=---011000010111000001101001"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sambanova.ai/v1/audio/transcriptions"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nWhisper-Large-v3\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary audio file, e.g. \"sample.wav\")\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nPlease transcribe carefully, including pauses and hesitations.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\nes\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"response_format\"\r\n\r\njson\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sambanova.ai/v1/audio/transcriptions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nWhisper-Large-v3\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary audio file, e.g. \"sample.wav\")\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nPlease transcribe carefully, including pauses and hesitations.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\nes\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"response_format\"\r\n\r\njson\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sambanova.ai/v1/audio/transcriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nWhisper-Large-v3\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary audio file, e.g. \"sample.wav\")\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nPlease transcribe carefully, including pauses and hesitations.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\nes\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"response_format\"\r\n\r\njson\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_bodyTranscribes audio into the input language.
import fs from 'fs';
import SambaNova from 'sambanova';
const client = new SambaNova({
apiKey: process.env['SAMBANOVA_API_KEY'], // This is the default and can be omitted
});
const transcriptionResponse = await client.audio.transcriptions.create({
file: fs.createReadStream('path/to/file'),
model: 'Whisper-Large-v3',
});
console.log(transcriptionResponse.text);import os
from sambanova import SambaNova
client = SambaNova(
api_key=os.environ.get("SAMBANOVA_API_KEY"), # This is the default and can be omitted
)
transcription_response = client.audio.transcriptions.create(
file=b"Example data",
model="Whisper-Large-v3",
)
print(transcription_response.text)curl --request POST \
--url https://api.sambanova.ai/v1/audio/transcriptions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form model=Whisper-Large-v3 \
--form file=@example-file \
--form 'prompt=Please transcribe carefully, including pauses and hesitations.' \
--form language=es \
--form response_format=json<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sambanova.ai/v1/audio/transcriptions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nWhisper-Large-v3\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary audio file, e.g. \"sample.wav\")\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nPlease transcribe carefully, including pauses and hesitations.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\nes\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"response_format\"\r\n\r\njson\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data; boundary=---011000010111000001101001"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sambanova.ai/v1/audio/transcriptions"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nWhisper-Large-v3\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary audio file, e.g. \"sample.wav\")\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nPlease transcribe carefully, including pauses and hesitations.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\nes\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"response_format\"\r\n\r\njson\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sambanova.ai/v1/audio/transcriptions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nWhisper-Large-v3\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary audio file, e.g. \"sample.wav\")\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nPlease transcribe carefully, including pauses and hesitations.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\nes\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"response_format\"\r\n\r\njson\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sambanova.ai/v1/audio/transcriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nWhisper-Large-v3\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n(binary audio file, e.g. \"sample.wav\")\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nPlease transcribe carefully, including pauses and hesitations.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\nes\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"response_format\"\r\n\r\njson\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_bodyAuthorizations
SambaNova API key, sent as a bearer token in the Authorization header (Authorization: Bearer <key>). Default authentication scheme used by the SambaNova SDK across every OpenAI compatible endpoint.
Body
Audio to transcribe and parameters
Transcription request object
The audio file object to transcribe or translate, in one of these formats: FLAC, MP3, MP4, MPEG, MPGA, M4A, Ogg, WAV, or WebM format. File size limit is 25MB.
Optional text prompt provided to influence transcription Translation style or vocabulary. Example: “Please transcribe carefully, including pauses and hesitations.”
Optional language of the input audio. Supplying the input language in ISO-639-1 (e.g. en) format will improve accuracy and latency.
en, zh, de, es, ru, ko, fr, ja, pt, tr, pl, ca, nl, ar, sv, it, id, hi, fi, vi, he, uk, el, ms, cs, ro, da, hu, ta, no, th, ur, hr, bg, lt, la, mi, ml, cy, sk, te, fa, lv, bn, sr, az, sl, kn, et, mk, br, eu, is, hy, ne, mn, bs, kk, sq, sw, gl, mr, pa, si, km, sn, yo, so, af, oc, ka, be, tg, sd, gu, am, yi, lo, uz, fo, ht, ps, tk, nn, mt, sa, lb, my, bo, tl, mg, as, tt, haw, ln, ha, ba, jw, su, yue The format of the output. json and verbose_json return a JSON object (verbose_json adds task, language, duration and segments); text, srt and vtt return plain text.
json, text, verbose_json, srt, vtt The timestamp granularities to populate. Requires response_format set to verbose_json. Only segment is supported; segment timings are approximate within each 30-second audio chunk.
segment Response
Successful Response
Transcription response json object
audio file text transcription
The task performed. Only returned with response_format set to verbose_json.
transcribe, translate The language of the input audio. Only returned with response_format set to verbose_json.
The duration of the input audio in seconds. Only returned with response_format set to verbose_json.
Segments of the transcribed text with their timings. Only returned with response_format set to verbose_json.
Show child attributes
Show child attributes

