This document introduces the integration guide for the Fish TTS API. This interface is fully compatible with the Fish Audio Official OpenAPI, allowing you to directly migrate existing code callingDocumentation Index
Fetch the complete documentation index at: https://docs.xhuoapi.ai/llms.txt
Use this file to discover all available pages before exploring further.
https://api.fish.audio/v1/tts to https://api.xhuoapi.ai/v1/fish/tts by simply replacing the authentication information without modifying the request body structure.
Application Process
To use the API, you need to apply for the corresponding service on the Fish TTS API page. After entering the page, click the “Acquire” button. If you are not logged in or registered, you will be automatically redirected to the login page to register and log in. After logging in or registering, you will be automatically returned to the current page. A free quota is granted upon the first application, allowing free use of the API.Differences from the Official API
This API retains the request and response fields of the Fish Audio official API with the following minor enhancements for better integration on our platform:- Authentication method: Uses
Authorization: Bearer {token}, where{token}is the key applied for on our platform, not the Fish official key. - TTS model selection: Specified via the HTTP request header
model, options ares1ors2-pro, with the default beings2-pro. This is consistent with Fish official. - Default
latencyvalue: The upstream/fish/v1/ttsreturns an error iflatencyis not provided. This interface automatically addslatency=normalif omitted, consistent with Fish official default behavior. - Asynchronous callback (platform extension): When an additional
callback_urlfield is included in the request body, the API immediately returns{task_id, started_at}. After the upstream process completes, the full result{audio_url, ...}is POSTed as JSON to the specified URL. The Fish official API does not support this field; including it triggers our asynchronous process.
text, reference_id, references, prosody, format, sample_rate, mp3_bitrate, chunk_length, temperature, top_p, etc.) are transparently passed upstream, behaving exactly as documented by Fish official.
Basic Usage
The minimal request only requires thetext field. Example CURL:
audio_url: The generated audio URL, which can be downloaded or played directly.latency_ms(optional): Upstream processing time in milliseconds.
reference_id in the request body:
Asynchronous Callback
Since Fish TTS generation may take a long time for lengthy texts and maintaining long connections consumes system resources, this API provides asynchronous callback capability (an extension beyond Fish official API). The overall flow is: the client includes an additionalcallback_url field in the request body. The API immediately returns a response containing task_id. When the upstream generation completes, the final audio_url and other fields are POSTed as JSON to the callback_url, including the same task_id to associate the asynchronous result with the original task.
Request example:
callback_url will receive the complete result:
task_id.
Error Handling
This interface preserves Fish official HTTP status codes for errors but uses a unified platform response format consistent with the/fish/audios and /fish/voices series:
400 token_mismatched: Bad request, possibly due to missing or invalid parameters.400 api_not_implemented: Bad request, possibly due to missing or invalid parameters.401 invalid_token: Unauthorized, invalid or missing authorization token.429 too_many_requests: Too many requests, rate limit exceeded.500 api_error: Internal server error.

