Speech to Text (Beta) - Uplift AI API Docs
Transcribe audio file
cURL
curl -X POST "https://api.upliftai.org/v1/transcribe/speech-to-text" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@/path/to/audio.mp3" \
-F "model=scribe" \
-F "language=ur"
Python
import requests
url = "https://api.upliftai.org/v1/transcribe/speech-to-text"
files = {'file': open('audio.mp3', 'rb')}
data = {
'model': 'scribe-mini', # Use cost-effective model
'language': 'ur',
'domain': 'phone-commerce' # Optimize for e-commerce
}
headers = {
'Authorization': 'Bearer YOUR_API_KEY'
}
response = requests.post(url, files=files, data=data, headers=headers)
result = response.json()
print(f"Transcription: {result['text']}")
JavaScript
const form = new FormData();
form.append('file', '<string>');
form.append('model', 'scribe');
form.append('language', 'ur');
const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
options.body = form;
fetch('https://api.upliftai.org/v1/transcribe/speech-to-text', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, [\
CURLOPT_URL => "https://api.upliftai.org/v1/transcribe/speech-to-text",\
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=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nscribe\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\nur\r\n-----011000010111000001101001--",\
CURLOPT_HTTPHEADER => [\
"Authorization: <api-key>",\
"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;
}
?>
Go
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.upliftai.org/v1/transcribe/speech-to-text"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nscribe\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\nur\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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))
}
Java
HttpResponse<String> response = Unirest.post("https://api.upliftai.org/v1/transcribe/speech-to-text")
.header("Authorization", "<api-key>")
.header("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nscribe\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\nur\r\n-----011000010111000001101001--")
.asString();
Ruby
require 'uri'
require 'net/http'
url = URI("https://api.upliftai.org/v1/transcribe/speech-to-text")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nscribe\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\nur\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body
Response
{
"text": "آج کا موسم کیسا ہے؟ میں نے سنا ہے کہ بارش ہونے والی ہے۔"
}
Authorization
- Authorization: string, header, required - API key with format "Bearer sk_api_..."
Body
- file: file, required - Audio file to transcribe (max 25MB)
- model: enum, default: scribe - AI model to use
- Available options:
scribe, scribe-mini
- language: enum, default: ur - Language of the audio
- domain: enum - Domain-specific optimization
- Available options:
phone-commerce, farming
Response
- 200: application/json - Successful transcription
- text: string - Transcribed text from the audio