Référence APISynthèse vocaleSynthèse vocale (synchrone)
Synthèse vocale synchrone v2
Contrat HTTP v2 de compatibilité pour les clients existants.
V2 est conservé uniquement pour les clients existants. Les nouvelles intégrations utilisent v3.
Endpoint
POST /api/open/v2/speech/ttsURL complète :
https://fishaudio.org/api/open/v2/speech/ttsAuthentification et en-têtes
Authorization: Bearer FISHAUDIO_API_KEY
Content-Type: application/json
X-Request-Id: YOUR_STABLE_REQUEST_IDChamps de requête
| field | type | required | constraints |
|---|---|---|---|
text | string | yes | 1–10,000 |
voiceId | string | yes | must support modelId |
modelId | string | no | public model ID |
format | string | no | mp3, wav, ogg; default mp3 |
speed | number | no | 0.5–2; default 1 |
volume | number | no | -20–20; default 0 |
pitch | number | no | -12–12 |
stability | number | no | 0.5–1.5 |
similarity | number | no | 0.5–1.5 |
language | string | no | 1–64 characters in v3 |
emotion | string | no | 1–64 characters in v3 |
instruction | string | no | up to 1,600 characters |
textNormalization | boolean | no | structured-text normalization |
V2 also accepts legacy engineModelId, version, qwenModel, and minimaxEmotion fields. Do not use them in new clients.
curl
curl "https://fishaudio.org/api/open/v2/speech/tts" \
-H "Authorization: Bearer $FISHAUDIO_API_KEY" \
-H "Content-Type: application/json" \
-H "X-Request-Id: legacy-tts-001" \
-d '{"text":"Hello","voiceId":"00a1b221-6137-4b73-ad62-b0cbce134167","modelId":"fishaudio-s21pro-flash","format":"mp3"}' --output speech.mp3Réponse réussie
Une réussite renvoie des octets audio. Vérifiez le statut HTTP puis Content-Type ; les erreurs sont en JSON.
Erreurs et nouvelles tentatives
400 requête invalide ; 401 clé invalide ; 402 quota insuffisant ; 404 ressource absente ; 409 conflit d’idempotence ; 413 trop volumineux ; 429 limite ; 500 échec.
Migration
Les clients v1/v2 restent compatibles. Les nouvelles intégrations utilisent v3. Migration guide.