curl --request POST \
--url https://api.fish.audio/model \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "tts",
"title": "<string>",
"train_mode": "fast",
"voices": [
"<string>"
],
"visibility": "public",
"description": "<string>",
"cover_image": "<string>",
"texts": [
"<string>"
],
"tags": [
"<string>"
],
"enhance_audio_quality": true,
"generate_sample": false
}
'import requests
url = "https://api.fish.audio/model"
payload = {
"type": "tts",
"title": "<string>",
"train_mode": "fast",
"voices": ["<string>"],
"visibility": "public",
"description": "<string>",
"cover_image": "<string>",
"texts": ["<string>"],
"tags": ["<string>"],
"enhance_audio_quality": True,
"generate_sample": False
}
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({
type: 'tts',
title: '<string>',
train_mode: 'fast',
voices: ['<string>'],
visibility: 'public',
description: '<string>',
cover_image: '<string>',
texts: ['<string>'],
tags: ['<string>'],
enhance_audio_quality: true,
generate_sample: false
})
};
fetch('https://api.fish.audio/model', 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.fish.audio/model",
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([
'type' => 'tts',
'title' => '<string>',
'train_mode' => 'fast',
'voices' => [
'<string>'
],
'visibility' => 'public',
'description' => '<string>',
'cover_image' => '<string>',
'texts' => [
'<string>'
],
'tags' => [
'<string>'
],
'enhance_audio_quality' => true,
'generate_sample' => false
]),
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.fish.audio/model"
payload := strings.NewReader("{\n \"type\": \"tts\",\n \"title\": \"<string>\",\n \"train_mode\": \"fast\",\n \"voices\": [\n \"<string>\"\n ],\n \"visibility\": \"public\",\n \"description\": \"<string>\",\n \"cover_image\": \"<string>\",\n \"texts\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"enhance_audio_quality\": true,\n \"generate_sample\": false\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.fish.audio/model")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"tts\",\n \"title\": \"<string>\",\n \"train_mode\": \"fast\",\n \"voices\": [\n \"<string>\"\n ],\n \"visibility\": \"public\",\n \"description\": \"<string>\",\n \"cover_image\": \"<string>\",\n \"texts\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"enhance_audio_quality\": true,\n \"generate_sample\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fish.audio/model")
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 \"type\": \"tts\",\n \"title\": \"<string>\",\n \"train_mode\": \"fast\",\n \"voices\": [\n \"<string>\"\n ],\n \"visibility\": \"public\",\n \"description\": \"<string>\",\n \"cover_image\": \"<string>\",\n \"texts\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"enhance_audio_quality\": true,\n \"generate_sample\": false\n}"
response = http.request(request)
puts response.read_body{
"_id": "<string>",
"type": "svc",
"title": "<string>",
"state": "created",
"tags": [
"<string>"
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"visibility": "public",
"like_count": 123,
"mark_count": 123,
"shared_count": 123,
"task_count": 123,
"author": {
"_id": "<string>",
"nickname": "<string>",
"avatar": "<string>"
},
"description": "",
"cover_image": "",
"train_mode": "full",
"samples": [],
"languages": [],
"lock_visibility": false,
"dmca_taken_down": false,
"default_text": "",
"source": "<string>",
"quality": {
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"audios": [
{
"filename": "<string>",
"duration_ms": 123,
"language": "unknown",
"quality": {},
"quality_passed": false,
"quality_reason": ""
}
]
},
"unliked": false,
"liked": false,
"marked": false
}{
"status": 123,
"message": "<string>"
}[
{
"loc": [
"<string>"
],
"type": "<string>",
"msg": "<string>",
"ctx": "<string>",
"in": "path"
}
]Create Model
Create a new voice model
curl --request POST \
--url https://api.fish.audio/model \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "tts",
"title": "<string>",
"train_mode": "fast",
"voices": [
"<string>"
],
"visibility": "public",
"description": "<string>",
"cover_image": "<string>",
"texts": [
"<string>"
],
"tags": [
"<string>"
],
"enhance_audio_quality": true,
"generate_sample": false
}
'import requests
url = "https://api.fish.audio/model"
payload = {
"type": "tts",
"title": "<string>",
"train_mode": "fast",
"voices": ["<string>"],
"visibility": "public",
"description": "<string>",
"cover_image": "<string>",
"texts": ["<string>"],
"tags": ["<string>"],
"enhance_audio_quality": True,
"generate_sample": False
}
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({
type: 'tts',
title: '<string>',
train_mode: 'fast',
voices: ['<string>'],
visibility: 'public',
description: '<string>',
cover_image: '<string>',
texts: ['<string>'],
tags: ['<string>'],
enhance_audio_quality: true,
generate_sample: false
})
};
fetch('https://api.fish.audio/model', 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.fish.audio/model",
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([
'type' => 'tts',
'title' => '<string>',
'train_mode' => 'fast',
'voices' => [
'<string>'
],
'visibility' => 'public',
'description' => '<string>',
'cover_image' => '<string>',
'texts' => [
'<string>'
],
'tags' => [
'<string>'
],
'enhance_audio_quality' => true,
'generate_sample' => false
]),
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.fish.audio/model"
payload := strings.NewReader("{\n \"type\": \"tts\",\n \"title\": \"<string>\",\n \"train_mode\": \"fast\",\n \"voices\": [\n \"<string>\"\n ],\n \"visibility\": \"public\",\n \"description\": \"<string>\",\n \"cover_image\": \"<string>\",\n \"texts\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"enhance_audio_quality\": true,\n \"generate_sample\": false\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.fish.audio/model")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"tts\",\n \"title\": \"<string>\",\n \"train_mode\": \"fast\",\n \"voices\": [\n \"<string>\"\n ],\n \"visibility\": \"public\",\n \"description\": \"<string>\",\n \"cover_image\": \"<string>\",\n \"texts\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"enhance_audio_quality\": true,\n \"generate_sample\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fish.audio/model")
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 \"type\": \"tts\",\n \"title\": \"<string>\",\n \"train_mode\": \"fast\",\n \"voices\": [\n \"<string>\"\n ],\n \"visibility\": \"public\",\n \"description\": \"<string>\",\n \"cover_image\": \"<string>\",\n \"texts\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"enhance_audio_quality\": true,\n \"generate_sample\": false\n}"
response = http.request(request)
puts response.read_body{
"_id": "<string>",
"type": "svc",
"title": "<string>",
"state": "created",
"tags": [
"<string>"
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"visibility": "public",
"like_count": 123,
"mark_count": 123,
"shared_count": 123,
"task_count": 123,
"author": {
"_id": "<string>",
"nickname": "<string>",
"avatar": "<string>"
},
"description": "",
"cover_image": "",
"train_mode": "full",
"samples": [],
"languages": [],
"lock_visibility": false,
"dmca_taken_down": false,
"default_text": "",
"source": "<string>",
"quality": {
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"audios": [
{
"filename": "<string>",
"duration_ms": 123,
"language": "unknown",
"quality": {},
"quality_passed": false,
"quality_reason": ""
}
]
},
"unliked": false,
"liked": false,
"marked": false
}{
"status": 123,
"message": "<string>"
}[
{
"loc": [
"<string>"
],
"type": "<string>",
"msg": "<string>",
"ctx": "<string>",
"in": "path"
}
]multipart/form-data for regular REST
requests. Let your HTTP client set the multipart Content-Type boundary
automatically.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Model type, tts is for text to speech
"tts"Model title or name
Model train mode, for TTS model, fast means model instantly available after creation
"fast"Upload voices files that will be used to tune the model
Model visibility, public will be shown in the discovery page, unlist allows anyone with the link to access, private only be visible to the creator
public, unlist, private Model description
Model cover image, this is required if the model is public
Texts corresponding to the voices, if unspecified, ASR will be performed on the voices
Model tags
Enhance audio quality
Generate default text
Response
Document created, URL follows
svc, tts created, training, trained, failed public, unlist, private Show child attributes
Show child attributes
fast, full Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?

