# Text to Speech API | Fish Audio

> For the complete documentation index, see [llms.txt](/llms.txt). Markdown is available with `Accept: text/markdown` and `.md` URL variants.

Source: /docs/api-reference/model-apis-fish-audio-text-to-speech

# Fish Audio Text to Speech

POST

/

v4beta

/

txt2speech

Try it

Fish Audio Text to Speech

cURL

```
curl --request POST \
--url https://api.novita.ai/v4beta/txt2speech \
--header 'Authorization: ' \
--header 'Content-Type: ' \
--data '
{
"text": "",
"temperature": 123,
"top_p": 123,
"references": {
"text": ""
},
"reference_id": {},
"prosody": {
"speed": 123,
"volume": 123
},
"chunk_length": 123,
"normalize": true,
"format": {},
"sample_rate": {},
"mp3_bitrate": {},
"opus_bitrate": {},
"latency": {}
}
'
```

```
import requests

url = "https://api.novita.ai/v4beta/txt2speech"

payload = {
"text": "",
"temperature": 123,
"top_p": 123,
"references": { "text": "" },
"reference_id": {},
"prosody": {
"speed": 123,
"volume": 123
},
"chunk_length": 123,
"normalize": True,
"format": {},
"sample_rate": {},
"mp3_bitrate": {},
"opus_bitrate": {},
"latency": {}
}
headers = {
"Content-Type": "",
"Authorization": ""
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

```
const options = {
method: 'POST',
headers: {'Content-Type': '', Authorization: ''},
body: JSON.stringify({
text: '',
temperature: 123,
top_p: 123,
references: {text: ''},
reference_id: {},
prosody: {speed: 123, volume: 123},
chunk_length: 123,
normalize: true,
format: {},
sample_rate: {},
mp3_bitrate: {},
opus_bitrate: {},
latency: {}
})
};

fetch('https://api.novita.ai/v4beta/txt2speech', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
```

```
"https://api.novita.ai/v4beta/txt2speech",
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' => '',
'temperature' => 123,
'top_p' => 123,
'references' => [
'text' => ''
],
'reference_id' => [

],
'prosody' => [
'speed' => 123,
'volume' => 123
],
'chunk_length' => 123,
'normalize' => true,
'format' => [

],
'sample_rate' => [

],
'mp3_bitrate' => [

],
'opus_bitrate' => [

],
'latency' => [

]
]),
CURLOPT_HTTPHEADER => [
"Authorization: ",
"Content-Type: "
],
]);

$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.novita.ai/v4beta/txt2speech"

payload := strings.NewReader("{\n \"text\": \"\",\n \"temperature\": 123,\n \"top_p\": 123,\n \"references\": {\n \"text\": \"\"\n },\n \"reference_id\": {},\n \"prosody\": {\n \"speed\": 123,\n \"volume\": 123\n },\n \"chunk_length\": 123,\n \"normalize\": true,\n \"format\": {},\n \"sample_rate\": {},\n \"mp3_bitrate\": {},\n \"opus_bitrate\": {},\n \"latency\": {}\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "")
req.Header.Add("Authorization", "")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
```

```
HttpResponse response = Unirest.post("https://api.novita.ai/v4beta/txt2speech")
.header("Content-Type", "")
.header("Authorization", "")
.body("{\n \"text\": \"\",\n \"temperature\": 123,\n \"top_p\": 123,\n \"references\": {\n \"text\": \"\"\n },\n \"reference_id\": {},\n \"prosody\": {\n \"speed\": 123,\n \"volume\": 123\n },\n \"chunk_length\": 123,\n \"normalize\": true,\n \"format\": {},\n \"sample_rate\": {},\n \"mp3_bitrate\": {},\n \"opus_bitrate\": {},\n \"latency\": {}\n}")
.asString();
```

```
require 'uri'
require 'net/http'

url = URI("https://api.novita.ai/v4beta/txt2speech")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = ''
request["Authorization"] = ''
request.body = "{\n \"text\": \"\",\n \"temperature\": 123,\n \"top_p\": 123,\n \"references\": {\n \"text\": \"\"\n },\n \"reference_id\": {},\n \"prosody\": {\n \"speed\": 123,\n \"volume\": 123\n },\n \"chunk_length\": 123,\n \"normalize\": true,\n \"format\": {},\n \"sample_rate\": {},\n \"mp3_bitrate\": {},\n \"opus_bitrate\": {},\n \"latency\": {}\n}"

response = http.request(request)
puts response.read_body
```

For best results, upload reference audio using the [create model](/docs/api-reference/model-apis-fish-audio-voice-cloning) before using this one. This improves speech quality and reduces latency.

Fish Audio converts text into speech.
Audio formats supported:

-
WAV / PCM

Sample Rate: 8kHz, 16kHz, 24kHz, 32kHz, 44.1kHz

- Default Sample Rate: 44.1kHz

- 16-bit, mono

-
MP3

Sample Rate: 32kHz, 44.1kHz

- Default Sample Rate: 44.1kHz

- mono

- Bitrate: 64kbps, 128kbps (default), 192kbps

-
Opus

Sample Rate: 48kHz

- Default Sample Rate: 48kHz

- mono

- Bitrate: -1000 (auto), 24kbps, 32kbps (default), 48kbps, 64kbps

##

[​](#request-headers)

Request Headers

[​](#param-content-type)

Content-Type

string

required

Enum: `application/json`

[​](#param-authorization)

Authorization

string

required

Bearer authentication format, for example: Bearer {{API Key}}.

[​](#param-model)

model

enum<string>

default:"s1"

Specify which TTS model to use. Only supports model: `s1`.

##

[​](#request-body)

Request Body

[​](#param-text)

text

string

required

Text to be converted to speech.

[​](#param-temperature)

temperature

number

Controls randomness in the speech generation. Higher values (e.g., 1.0) make the output more random, while lower values (e.g., 0.1) make it more deterministic. We recommend `0.9` for `s1` model.Required range: `0 <= x <= 1`

[​](#param-top-p)

top_p

number

Controls diversity via nucleus sampling. Lower values (e.g., 0.1) make the output more focused, while higher values (e.g., 1.0) allow more diversity. We recommend `0.9` for `s1` model.Required range: `0 <= x <= 1`

[​](#param-references)

references

ReferenceAudio · object[] | null

References to be used for the speech, this requires MessagePack serialization, this will override reference_voices and reference_texts.

Show properties

[​](#param-audio)

audio

file

required

Reference audio file.

[​](#param-text-1)

text

string

required

Reference text corresponding to the audio.

[​](#param-reference-id)

reference_id

string | null

ID of the reference model to be used for the speech.

[​](#param-prosody)

prosody

ProsodyControl · object

Prosody to be used for the speech.

Show properties

[​](#param-speed)

speed

number

default:1

Speech speed control.

[​](#param-volume)

volume

number

default:0

Speech volume control.

[​](#param-chunk-length)

chunk_length

integer

default:200

Chunk length to be used for the speech.Required range: `100 <= x <= 300`

[​](#param-normalize)

normalize

boolean

default:true

Whether to normalize the speech, this will reduce the latency but may reduce performance on numbers and dates.

[​](#param-format)

format

enum<string>

default:"mp3"

Format to be used for the speech.Available options: `wav`, `pcm`, `mp3`, `opus`

[​](#param-sample-rate)

sample_rate

integer | null

Sample rate to be used for the speech.

[​](#param-mp3-bitrate)

mp3_bitrate

enum<integer>

default:128

MP3 Bitrate to be used for the speech.Available options: `64`, `128`, `192`

[​](#param-opus-bitrate)

opus_bitrate

enum<integer>

default:32

Opus Bitrate to be used for the speech.Available options: `-1000`, `24`, `32`, `48`, `64`

[​](#param-latency)

latency

enum<string>

default:"normal"

Latency to be used for the speech, balanced will reduce the latency but may lead to performance degradation.Available options: `normal`, `balanced`

##

[​](#response)

Response

The API will directly return the audio stream in the format specified by the `format` parameter (default: mp3).

Last modified on May 6, 2026
