Fish Audio Docs
API ReferenciaTexto a vozTexto a voz (síncrono)
Back to site

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/tts

URL completa:

https://fishaudio.org/api/open/v2/speech/tts

Autenticación y encabezados

Authorization: Bearer FISHAUDIO_API_KEY
Content-Type: application/json
X-Request-Id: YOUR_STABLE_REQUEST_ID

Campos de solicitud

fieldtyperequiredconstraints
textstringyes1–10,000
voiceIdstringyesmust support modelId
modelIdstringnopublic model ID
formatstringnomp3, wav, ogg; default mp3
speednumberno0.5–2; default 1
volumenumberno-20–20; default 0
pitchnumberno-12–12
stabilitynumberno0.5–1.5
similaritynumberno0.5–1.5
languagestringno1–64 characters in v3
emotionstringno1–64 characters in v3
instructionstringnoup to 1,600 characters
textNormalizationbooleannostructured-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.mp3

Respuesta 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.