Dokumentacja API
Fish Audio Utwórz głos
Użyj punktu końcowego create voice, aby otrzymać wynik w tej samej odpowiedzi.
01
Omówienie
Użyj punktu końcowego create voice i odczytaj wynik z tej samej odpowiedzi.
Szybki start
- Utwórz klucz API i ustaw go jako RUNAPI_API_KEY.
- Wyślij żądanie POST, którego treść odpowiada schematowi żądania.
- Odczytaj wynik z treści pomyślnej odpowiedzi.
Punkt końcowy
- Bazowy URL
https://runapi.ai- Wersja API
v1- Uwierzytelnianie
Authorization: Bearer YOUR_API_TOKEN
02
Obsługiwane modele
Otwórz stronę modelu, aby zapoznać się z aktualnymi cenami, limitami żądań i szczegółami dotyczącymi użytku komercyjnego.
03
Treść JSONSchemat żądania
Wysyłaj wyłącznie pola zadeklarowane dla tego punktu końcowego.
Treść żądania2 pola
namestring
Wymagane
source_audio_urlstring
Wymagane
04
HTTP 200Odpowiedź sukcesu
POST /api/v1/fish_audio/voices
Schemat odpowiedzi
JSON
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"voice": {
"properties": {
"name": {
"type": "string"
},
"state": {
"enum": [
"created",
"training",
"trained",
"failed"
],
"type": "string"
},
"voice_id": {
"type": "string"
}
},
"required": [
"voice_id",
"state"
],
"type": "object",
"unevaluatedProperties": false
}
},
"required": [
"voice",
"billing"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
JSON
{
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"voice": {
"name": "Studio Narrator",
"state": "trained",
"voice_id": "voice_reference_narrator"
}
}
05
HTTP 401Błędy
POST /api/v1/fish_audio/voices
Schemat odpowiedzi
JSON
{
"properties": {
"error": {
"description": "Czytelny dla człowieka komunikat o błędzie.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
JSON
{
"error": "Authentication required"
}
06
HTTP 400Błędy
POST /api/v1/fish_audio/voices
Schemat odpowiedzi
JSON
{
"oneOf": [
{
"properties": {
"error": {
"description": "Czytelny dla człowieka komunikat o błędzie.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
},
{
"properties": {
"error": {
"description": "Czytelne dla człowieka podsumowanie walidacji.",
"type": "string"
},
"errors": {
"additionalProperties": {
"items": {
"type": "string"
},
"type": "array"
},
"description": "Komunikaty walidacyjne identyfikowane przez publiczne pole żądania, z tablicą czytelnych dla człowieka ciągów znaków dla każdego pola.",
"type": "object"
}
},
"required": [
"error",
"errors"
],
"type": "object",
"unevaluatedProperties": false
}
]
}
Przykład odpowiedzi
JSON
{
"error": "Validation failed",
"errors": {
"name": [
"is required"
]
}
}
07
HTTP 402Błędy
POST /api/v1/fish_audio/voices
Schemat odpowiedzi
JSON
{
"properties": {
"error": {
"description": "Czytelny dla człowieka komunikat o błędzie.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
JSON
{
"error": "Insufficient balance"
}
08
HTTP 429Błędy
POST /api/v1/fish_audio/voices
Schemat odpowiedzi
JSON
{
"properties": {
"error": {
"description": "Czytelny dla człowieka komunikat o błędzie.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
JSON
{
"error": "API key credit limit exceeded"
}
09
HTTP 409Błędy
POST /api/v1/fish_audio/voices
Schemat odpowiedzi
JSON
{
"properties": {
"error": {
"description": "Czytelny dla człowieka komunikat o błędzie.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
JSON
{
"error": "The request uses features that are not supported for the selected model"
}
10
HTTP 429Błędy
POST /api/v1/fish_audio/voices
Schemat odpowiedzi
JSON
{
"properties": {
"error": {
"description": "Czytelny dla człowieka komunikat o błędzie.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
JSON
{
"error": "Rate limit reached. Please retry later."
}
11
HTTP 503Błędy
POST /api/v1/fish_audio/voices
Schemat odpowiedzi
JSON
{
"properties": {
"error": {
"description": "Czytelny dla człowieka komunikat o błędzie.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
JSON
{
"error": "Service under maintenance, please try again later"
}
12
HTTP 504Błędy
POST /api/v1/fish_audio/voices
Schemat odpowiedzi
JSON
{
"properties": {
"error": {
"description": "Czytelny dla człowieka komunikat o błędzie.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
JSON
{
"error": "The request timed out"
}
13
Wygenerowane przykłady kodu
Używaj bezpośrednio cURL lub zainstaluj SDK dla swojego języka. Każdy przykład przesyła zwalidowane żądanie pokazane w tej dokumentacji.
Instalacja
Shell
pip install runapi-fish-audio
PYTHON
import os
from runapi.fish_audio import FishAudioClient
client = FishAudioClient(api_key=os.environ["RUNAPI_API_KEY"])
result = client.create_voice.run(
name="Studio Narrator",
source_audio_url="https://cdn.runapi.ai/public/samples/voice.mp3"
)