Speech-to-Text
curl --request POST \
--url https://api.example.com/tts/stt \
--header 'Content-Type: application/json' \
--data '
{
"api_key": "<string>"
}
'import requests
url = "https://api.example.com/tts/stt"
payload = { "api_key": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({api_key: '<string>'})
};
fetch('https://api.example.com/tts/stt', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/tts/stt",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'api_key' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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.example.com/tts/stt"
payload := strings.NewReader("{\n \"api_key\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
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.example.com/tts/stt")
.header("Content-Type", "application/json")
.body("{\n \"api_key\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/tts/stt")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"api_key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"text": "<string>",
"language": "<string>"
}Text-to-Speech
Speech-to-Text
Transcribe audio files to text using OpenAI Whisper API
POST
/
tts
/
stt
Speech-to-Text
curl --request POST \
--url https://api.example.com/tts/stt \
--header 'Content-Type: application/json' \
--data '
{
"api_key": "<string>"
}
'import requests
url = "https://api.example.com/tts/stt"
payload = { "api_key": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({api_key: '<string>'})
};
fetch('https://api.example.com/tts/stt', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/tts/stt",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'api_key' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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.example.com/tts/stt"
payload := strings.NewReader("{\n \"api_key\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
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.example.com/tts/stt")
.header("Content-Type", "application/json")
.body("{\n \"api_key\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/tts/stt")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"api_key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"text": "<string>",
"language": "<string>"
}
Transcribe audio files to text using OpenAI’s Whisper API. Supports multiple audio formats and automatically detects language.
Request
file
required
Audio file to transcribe (MP3, WAV, FLAC, etc.)
string
required
Your GistMag API key
Response
string
The transcribed text from the audio file
string
The detected or specified language code (e.g., “en”, “es”, “fr”) or “auto” if auto-detected
Credit Cost
5 credits per minute of audio (rounded up to the nearest minute). For example:- 30 seconds of audio = 5 credits (1 minute)
- 2.5 minutes of audio = 15 credits (3 minutes)
Example Request
curl -X POST https://api.gistmag.co.uk/tts/stt \
-F "audio=@recording.wav" \
-F "api_key=your_api_key_here"
const formData = new FormData();
formData.append('audio', audioFile);
formData.append('api_key', 'your_api_key_here');
const response = await fetch('https://api.gistmag.co.uk/tts/stt', {
method: 'POST',
body: formData
});
const result = await response.json();
console.log(result.text); // Transcribed text
import requests
with open('recording.wav', 'rb') as audio_file:
files = {'audio': audio_file}
data = {'api_key': 'your_api_key_here'}
response = requests.post(
'https://api.gistmag.co.uk/tts/stt',
files=files,
data=data
)
result = response.json()
print(result['text']) # Transcribed text
Supported Audio Formats
OpenAI Whisper supports a wide range of audio formats:- MP3
- WAV
- M4A
- FLAC
- OGG
- WebM
- And many other common audio formats
Notes
- The API automatically detects the language in the audio (or you can specify it)
- Audio is processed securely and not stored
- Maximum file size: 25MB (OpenAI Whisper limit)
- Uses OpenAI’s Whisper-1 model for high-quality transcription