API ReferenciaTexto a vozTexto a voz (síncrono)
Texto a voz síncrono v2
Contrato HTTP v2 de compatibilidad para clientes existentes.
V2 se mantiene solo para clientes existentes. Las integraciones nuevas usan v3.
Endpoint
POST /api/open/v2/speech/ttsURL completa:
https://fishaudio.org/api/open/v2/speech/ttsAutenticación y encabezados
Authorization: Bearer FISHAUDIO_API_KEY
Content-Type: application/json
X-Request-Id: YOUR_STABLE_REQUEST_IDCampos de solicitud
| 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.mp3Respuesta correcta
Una respuesta correcta contiene audio binario. Comprueba el estado HTTP y Content-Type; los errores son JSON.
Errores y reintentos
400 solicitud inválida; 401 clave inválida; 402 cuota insuficiente; 404 recurso inexistente; 409 conflicto de idempotencia; 413 solicitud grande; 429 límite; 500 fallo.
Migration
Los clientes v1/v2 siguen siendo compatibles. Las integraciones nuevas usan v3. Migration guide.