curl --request POST \
--url https://api.slng.ai/v1/tts/fish/tts:s2.1-pro \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "Hello from Fish Audio S2.1 Pro.",
"reference_id": "9a9cf47702da476aa4629e2506d4a857",
"format": "mp3"
}
'import requests
url = "https://api.slng.ai/v1/tts/fish/tts:s2.1-pro"
payload = {
"text": "Hello from Fish Audio S2.1 Pro.",
"reference_id": "9a9cf47702da476aa4629e2506d4a857",
"format": "mp3"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
text: 'Hello from Fish Audio S2.1 Pro.',
reference_id: '9a9cf47702da476aa4629e2506d4a857',
format: 'mp3'
})
};
fetch('https://api.slng.ai/v1/tts/fish/tts:s2.1-pro', 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.slng.ai/v1/tts/fish/tts:s2.1-pro",
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([
'text' => 'Hello from Fish Audio S2.1 Pro.',
'reference_id' => '9a9cf47702da476aa4629e2506d4a857',
'format' => 'mp3'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.slng.ai/v1/tts/fish/tts:s2.1-pro"
payload := strings.NewReader("{\n \"text\": \"Hello from Fish Audio S2.1 Pro.\",\n \"reference_id\": \"9a9cf47702da476aa4629e2506d4a857\",\n \"format\": \"mp3\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.slng.ai/v1/tts/fish/tts:s2.1-pro")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"Hello from Fish Audio S2.1 Pro.\",\n \"reference_id\": \"9a9cf47702da476aa4629e2506d4a857\",\n \"format\": \"mp3\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.slng.ai/v1/tts/fish/tts:s2.1-pro")
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"] = 'application/json'
request.body = "{\n \"text\": \"Hello from Fish Audio S2.1 Pro.\",\n \"reference_id\": \"9a9cf47702da476aa4629e2506d4a857\",\n \"format\": \"mp3\"\n}"
response = http.request(request)
puts response.read_body"<string>"{
"error": "Validation error",
"details": "Missing required field: text"
}{
"error": "TTS service error",
"upstream_status": 400,
"details": "Fish Audio TTS error: 400 Bad Request - Invalid reference_id"
}{
"error": "TTS service error",
"upstream_status": 400,
"details": "Fish Audio TTS error: 400 Bad Request - Invalid reference_id"
}{
"error": "TTS service error",
"upstream_status": 400,
"details": "Fish Audio TTS error: 400 Bad Request - Invalid reference_id"
}{
"error": "TTS service error",
"upstream_status": 400,
"details": "Fish Audio TTS error: 400 Bad Request - Invalid reference_id"
}{
"error": "TTS service error",
"upstream_status": 400,
"details": "Fish Audio TTS error: 400 Bad Request - Invalid reference_id"
}Fish Audio TTS S2.1 Pro
Synthesize speech with Fish Speech S2.1 Pro over one-shot HTTP. Returns binary audio in the requested format. MessagePack requests may include inline reference audio for voice cloning.
curl --request POST \
--url https://api.slng.ai/v1/tts/fish/tts:s2.1-pro \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "Hello from Fish Audio S2.1 Pro.",
"reference_id": "9a9cf47702da476aa4629e2506d4a857",
"format": "mp3"
}
'import requests
url = "https://api.slng.ai/v1/tts/fish/tts:s2.1-pro"
payload = {
"text": "Hello from Fish Audio S2.1 Pro.",
"reference_id": "9a9cf47702da476aa4629e2506d4a857",
"format": "mp3"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
text: 'Hello from Fish Audio S2.1 Pro.',
reference_id: '9a9cf47702da476aa4629e2506d4a857',
format: 'mp3'
})
};
fetch('https://api.slng.ai/v1/tts/fish/tts:s2.1-pro', 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.slng.ai/v1/tts/fish/tts:s2.1-pro",
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([
'text' => 'Hello from Fish Audio S2.1 Pro.',
'reference_id' => '9a9cf47702da476aa4629e2506d4a857',
'format' => 'mp3'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.slng.ai/v1/tts/fish/tts:s2.1-pro"
payload := strings.NewReader("{\n \"text\": \"Hello from Fish Audio S2.1 Pro.\",\n \"reference_id\": \"9a9cf47702da476aa4629e2506d4a857\",\n \"format\": \"mp3\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.slng.ai/v1/tts/fish/tts:s2.1-pro")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"Hello from Fish Audio S2.1 Pro.\",\n \"reference_id\": \"9a9cf47702da476aa4629e2506d4a857\",\n \"format\": \"mp3\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.slng.ai/v1/tts/fish/tts:s2.1-pro")
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"] = 'application/json'
request.body = "{\n \"text\": \"Hello from Fish Audio S2.1 Pro.\",\n \"reference_id\": \"9a9cf47702da476aa4629e2506d4a857\",\n \"format\": \"mp3\"\n}"
response = http.request(request)
puts response.read_body"<string>"{
"error": "Validation error",
"details": "Missing required field: text"
}{
"error": "TTS service error",
"upstream_status": 400,
"details": "Fish Audio TTS error: 400 Bad Request - Invalid reference_id"
}{
"error": "TTS service error",
"upstream_status": 400,
"details": "Fish Audio TTS error: 400 Bad Request - Invalid reference_id"
}{
"error": "TTS service error",
"upstream_status": 400,
"details": "Fish Audio TTS error: 400 Bad Request - Invalid reference_id"
}{
"error": "TTS service error",
"upstream_status": 400,
"details": "Fish Audio TTS error: 400 Bad Request - Invalid reference_id"
}{
"error": "TTS service error",
"upstream_status": 400,
"details": "Fish Audio TTS error: 400 Bad Request - Invalid reference_id"
}Authorizations
API key issued by SLNG. Pass as Authorization: Bearer <token>.
Headers
Target world part override. Auto-selected if not provided.
eu Body
Fish Audio TTS request. Shared by one-shot and streaming synthesis.
Text to synthesize. S2-family variants support multi-speaker dialogue markers.
1Fish Audio voice-model ID. For multi-speaker synthesis, provide one ID per speaker as an array.
Inline reference audio for voice cloning. MessagePack-only, as the entries carry binary audio.
Show child attributes
Show child attributes
Prosody controls.
Show child attributes
Show child attributes
Sampling temperature.
0 <= x <= 1Nucleus sampling probability mass.
0 <= x <= 1Target chunk length for synthesis.
100 <= x <= 300Whether to normalize input text before synthesis.
Output audio format.
wav, pcm, mp3, opus Output sample rate in Hz. Defaults to the provider default for the chosen format when omitted.
8000, 16000, 24000, 32000, 44100, 48000 MP3 bitrate in kbps (used when format is mp3).
64, 128, 192 Opus bitrate in bps (used when format is opus). -1000 selects the provider default.
-1000, 24000, 32000, 48000, 64000 Latency/quality trade-off.
low, normal, balanced Maximum number of new tokens to generate.
Penalty applied to repeated tokens.
Minimum chunk length for synthesis.
0 <= x <= 100Whether generation is conditioned on previously generated chunks.
Early-stop threshold for generation.
0 <= x <= 1Optional feature flags.
Response
Synthesis successful. Returns binary audio in the format requested via format.
Binary audio data.
Was this page helpful?