fishaudio.core.client_wrapper
HTTP client wrapper for managing requests and authentication. Install the Python SDK first:pip install fish-audio-sdk.
BaseClientWrapper Objects
get_headers
ClientWrapper Objects
request
method- HTTP method (GET, POST, etc.)path- API endpoint pathrequest_options- Optional request-level overridesstream- If True, return as soon as the response headers arrive and leave the body unread. The caller must consume it withiter_bytes()and then callclose()on the response.**kwargs- Additional arguments to pass to httpx.request
APIError- On non-2xx responses
client
close
AsyncClientWrapper Objects
request
method- HTTP method (GET, POST, etc.)path- API endpoint pathrequest_options- Optional request-level overridesstream- If True, return as soon as the response headers arrive and leave the body unread. The caller must consume it withaiter_bytes()and then callaclose()on the response.**kwargs- Additional arguments to pass to httpx.request
APIError- On non-2xx responses
client
close
fishaudio.core.request_options
Request-level options for API calls.RequestOptions Objects
timeout- Override the client’s default timeout (in seconds)max_retries- Accepted but not used: the client does not retry requestsadditional_headers- Additional headers to include in the requestadditional_query_params- Additional query parameters to include
get_timeout
fishaudio.core.iterators
Audio stream wrappers with collection utilities.AudioStream Objects
.collect() method to gather all chunks into a single bytes object.
Examples:
__init__
iterator- The underlying iterator of audio byteson_close- Called by close() to release the underlying resource, for example the open HTTP response
__iter__
close
collect
AsyncAudioStream Objects
.collect() method to gather all chunks into a single bytes object.
Examples:
__init__
async_iterator- The underlying async iterator of audio byteson_close- Awaited by aclose() to release the underlying resource, for example the open HTTP response
__aiter__
aclose
collect
TTSTimestampStream Objects
TTSTimestampEvent objects as the server produces them.
While you iterate, segments holds the timings received so far, measured
from the start of the complete audio. Alternatively, call collect()
instead of iterating to get the complete audio with its final timings.
Examples:
__init__
iterator- The underlying iterator of eventson_close- Called by close() to release the underlying resource, for example the open HTTP response
segments
close
collect
segments when the stream ends.
Returns:
TTSTimestampResult with the complete audio and final timings. When
the API has no timings for the text, segments is empty and
duration is None; the audio is still complete.
Raises:
RuntimeError- If iteration has already started
AsyncTTSTimestampStream Objects
TTSTimestampEvent objects as the server produces them.
While you iterate, segments holds the timings received so far, measured
from the start of the complete audio. Alternatively, call collect()
instead of iterating to get the complete audio with its final timings.
Examples:
__init__
async_iterator- The underlying async iterator of eventson_close- Awaited by aclose() to release the underlying resource, for example the open HTTP response
segments
aclose
collect
segments when the stream ends.
Returns:
TTSTimestampResult with the complete audio and final timings. When
the API has no timings for the text, segments is empty and
duration is None; the audio is still complete.
Raises:
RuntimeError- If iteration has already started
fishaudio.core.websocket_options
WebSocket-level options for WebSocket connections.WebSocketOptions Objects
keepalive_ping_timeout_seconds- Maximum delay the client will wait for an answer to its Ping event. If the delay is exceeded, WebSocketNetworkError will be raised and the connection closed. Default: 20 seconds.keepalive_ping_interval_seconds- Interval at which the client will automatically send a Ping event to keep the connection alive. Default: 20 seconds.Nonekeeps the default; it does not turn the pings off.max_message_size_bytes- Message size in bytes to receive from the server. Default: 65536 bytes (64 KiB).queue_size- Size of the queue where received messages will be held until they are consumed. If the queue is full, the client will stop receiving messages from the server until the queue has room available. Default: 512.

