Fish Audio Text-to-Speech
Generate speech with the S2 Pro models, instant voice cloning, and mp3 or wav output.
Overview
Use the text to speech endpoint and read the result from the same response.
Quick start
- Create an API key and set it as RUNAPI_API_KEY.
- Send a POST request whose body matches the request schema.
- Read the result from the successful response body.
Endpoint
- Base URL
https://runapi.ai- API version
v1- Authentication
Authorization: Bearer YOUR_API_TOKEN
Supported models
Open a model page for current pricing, rate limits, and commercial-usage details.
Request schema
Send only the fields declared for this endpoint.
s19 fields
bitrate_kbpsintegerMP3 bitrate. Not accepted for WAV output.
Allowed values:64, 128, 192
Default: 128
modelstringModel slug.
output_formatstringOutput audio format.
Allowed values:mp3, wav
Default: mp3
referencesarrayOne temporary voice-cloning sample. Cannot be combined with voice_id. Omit, use null, or [] for no sample.
Item limit:1
references[].audiostringPublicly accessible HTTPS audio URL. Must remain valid while queued and read by the provider.
references[].textstringExact transcript that matches the reference audio word for word.
sample_rate_hzintegerOutput sample rate. MP3 supports 32000 and 44100 Hz; WAV supports every listed value.
Allowed values:8000, 16000, 24000, 32000, 44100
Default: 44100
textstringvoice_idstrings2-pro9 fields
bitrate_kbpsintegerMP3 bitrate. Not accepted for WAV output.
Allowed values:64, 128, 192
Default: 128
modelstringModel slug.
output_formatstringOutput audio format.
Allowed values:mp3, wav
Default: mp3
referencesarrayOne temporary voice-cloning sample. Cannot be combined with voice_id. Omit, use null, or [] for no sample.
Item limit:1
references[].audiostringPublicly accessible HTTPS audio URL. Must remain valid while queued and read by the provider.
references[].textstringExact transcript that matches the reference audio word for word.
sample_rate_hzintegerOutput sample rate. MP3 supports 32000 and 44100 Hz; WAV supports every listed value.
Allowed values:8000, 16000, 24000, 32000, 44100
Default: 44100
textstringvoice_idstrings2.1-pro9 fields
bitrate_kbpsintegerMP3 bitrate. Not accepted for WAV output.
Allowed values:64, 128, 192
Default: 128
modelstringModel slug.
output_formatstringOutput audio format.
Allowed values:mp3, wav
Default: mp3
referencesarrayOne temporary voice-cloning sample. Cannot be combined with voice_id. Omit, use null, or [] for no sample.
Item limit:1
references[].audiostringPublicly accessible HTTPS audio URL. Must remain valid while queued and read by the provider.
references[].textstringExact transcript that matches the reference audio word for word.
sample_rate_hzintegerOutput sample rate. MP3 supports 32000 and 44100 Hz; WAV supports every listed value.
Allowed values:8000, 16000, 24000, 32000, 44100
Default: 44100
textstringvoice_idstringConditional rules
These requirements apply when all listed conditions match.
-
When
references present- Required
- Not accepted
voice_id
-
When
output_format = wav- Required
- Not accepted
bitrate_kbps
-
When
output_format = mp3- Required
- Not accepted
-
When
output_format absent- Required
- Not accepted
Success response
POST /api/v1/fish_audio/text_to_speech
Response schema
{
"properties": {
"audios": {
"items": {
"properties": {
"format": {
"type": "string"
},
"mime_type": {
"type": "string"
},
"size_bytes": {
"type": "integer"
},
"url": {
"type": "string",
"x-runapi-generated-media": true
}
},
"required": [
"url",
"format",
"mime_type",
"size_bytes"
],
"type": "object",
"unevaluatedProperties": false
},
"type": "array"
},
"id": {
"type": "string"
},
"status": {
"enum": [
"completed"
],
"type": "string"
}
},
"required": [
"id",
"status",
"audios"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"audios": [
{
"format": "mp3",
"mime_type": "audio/mpeg",
"size_bytes": 128,
"url": "https://file.runapi.ai/reference-audio.mp3"
}
],
"id": "tsk_reference_demo",
"status": "completed"
}
Errors
POST /api/v1/fish_audio/text_to_speech
Response schema
{
"properties": {
"error": {
"description": "Human-readable error message.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"error": "Authentication required"
}
Errors
POST /api/v1/fish_audio/text_to_speech
Response schema
{
"oneOf": [
{
"properties": {
"error": {
"description": "Human-readable error message.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
},
{
"properties": {
"error": {
"description": "Human-readable validation summary.",
"type": "string"
},
"errors": {
"additionalProperties": {
"items": {
"type": "string"
},
"type": "array"
},
"description": "Validation messages keyed by public request field, with an array of human-readable strings for each field.",
"type": "object"
}
},
"required": [
"error",
"errors"
],
"type": "object",
"unevaluatedProperties": false
}
]
}
Response example
{
"error": "model must be one of: s1, s2-pro, s2.1-pro"
}
Errors
POST /api/v1/fish_audio/text_to_speech
Response schema
{
"properties": {
"error": {
"description": "Human-readable error message.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"error": "Insufficient balance"
}
Errors
POST /api/v1/fish_audio/text_to_speech
Response schema
{
"properties": {
"error": {
"description": "Human-readable error message.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"error": "API key credit limit exceeded"
}
Errors
POST /api/v1/fish_audio/text_to_speech
Response schema
{
"properties": {
"error": {
"description": "Human-readable error message.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"error": "The request uses features that are not supported for the selected model"
}
Errors
POST /api/v1/fish_audio/text_to_speech
Response schema
{
"properties": {
"error": {
"description": "Human-readable error message.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"error": "Rate limit reached. Please retry later."
}
Errors
POST /api/v1/fish_audio/text_to_speech
Response schema
{
"properties": {
"error": {
"description": "Human-readable error message.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"error": "Service under maintenance, please try again later"
}
Errors
POST /api/v1/fish_audio/text_to_speech
Response schema
{
"properties": {
"error": {
"description": "Human-readable error message.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"error": "The request timed out"
}
Generated Code Samples
Use cURL directly, or install an SDK for your language. Each sample submits the validated request shown in this reference.
Install
pip install runapi-fish-audio
import os
from runapi.fish_audio import FishAudioClient
client = FishAudioClient(api_key=os.environ["RUNAPI_API_KEY"])
result = client.text_to_speech.run(
model="s1",
text="Welcome to RunAPI."
)