curl --request POST \
--url https://us-east.api.slng.ai/v1/tts/fish/tts:s2-pro \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "Hello from Fish Audio S2 Pro.",
"reference_id": "9a9cf47702da476aa4629e2506d4a857",
"format": "mp3"
}
'import requests
url = "https://us-east.api.slng.ai/v1/tts/fish/tts:s2-pro"
payload = {
"text": "Hello from Fish Audio S2 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 Pro.',
reference_id: '9a9cf47702da476aa4629e2506d4a857',
format: 'mp3'
})
};
fetch('https://us-east.api.slng.ai/v1/tts/fish/tts:s2-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://us-east.api.slng.ai/v1/tts/fish/tts:s2-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 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://us-east.api.slng.ai/v1/tts/fish/tts:s2-pro"
payload := strings.NewReader("{\n \"text\": \"Hello from Fish Audio S2 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://us-east.api.slng.ai/v1/tts/fish/tts:s2-pro")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"Hello from Fish Audio S2 Pro.\",\n \"reference_id\": \"9a9cf47702da476aa4629e2506d4a857\",\n \"format\": \"mp3\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://us-east.api.slng.ai/v1/tts/fish/tts:s2-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 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 S2 Pro
Synthesize speech with Fish Speech S2 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://us-east.api.slng.ai/v1/tts/fish/tts:s2-pro \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "Hello from Fish Audio S2 Pro.",
"reference_id": "9a9cf47702da476aa4629e2506d4a857",
"format": "mp3"
}
'import requests
url = "https://us-east.api.slng.ai/v1/tts/fish/tts:s2-pro"
payload = {
"text": "Hello from Fish Audio S2 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 Pro.',
reference_id: '9a9cf47702da476aa4629e2506d4a857',
format: 'mp3'
})
};
fetch('https://us-east.api.slng.ai/v1/tts/fish/tts:s2-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://us-east.api.slng.ai/v1/tts/fish/tts:s2-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 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://us-east.api.slng.ai/v1/tts/fish/tts:s2-pro"
payload := strings.NewReader("{\n \"text\": \"Hello from Fish Audio S2 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://us-east.api.slng.ai/v1/tts/fish/tts:s2-pro")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"Hello from Fish Audio S2 Pro.\",\n \"reference_id\": \"9a9cf47702da476aa4629e2506d4a857\",\n \"format\": \"mp3\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://us-east.api.slng.ai/v1/tts/fish/tts:s2-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 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>.
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. This enum is the union across formats; the gateway rejects a rate the selected format does not accept before contacting the provider. wav and pcm accept 8000, 16000, 24000, 32000, and 44100; mp3 accepts 32000 and 44100; opus accepts 48000 only. Omit or send null for the format default (48000 for opus, 44100 otherwise).
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.