Skip to content

fish-audio-sdk: v1.9.1

Choose a tag to compare

@fishaudio-bot fishaudio-bot released this 04 Dec 17:06
e6aa7c7

1.9.1 (2026-12-04)

Bug Fixes

  • tts: give the realtime TTS connection one owner (#213) (2cdf163)
  • websocket: accept the API's audio messages under httpx-ws 0.10 (#215) (05ea8be)

Upgrade notes

Realtime text to speech (tts.stream_websocket(), sync and async) now has one owner for its connection. Errors you caught on 1.9.0 are still caught: WebSocketError, httpx_ws.WebSocketNetworkError for a lost connection, httpx_ws.WebSocketUpgradeError for a refused handshake, and your own text source's exceptions. What can differ for your code:

  • The server's finish ends the session. If your text source is still waiting for its next item when the server finishes, the SDK stops waiting: an async pull is cancelled and a generator source is closed, and work the source shares with something else (a task it awaits) is cancelled with it. Use asyncio.shield() for work that must finish. On 1.9.0 the stream waited for your source, for ever if it never ended.
  • After an error, audio you have not read yet is not delivered. If your text source fails or the connection breaks while audio is waiting to be read, the stream raises that error at once. A slow caller can get fewer chunks before the same error than on 1.9.0.
  • A generator text source is closed when the stream ends, so its finally runs then; on 1.9.0 it ran at garbage collection.
  • An error while closing the connection after the stream ended is logged, not raised (logger fishaudio.resources.realtime, debug level).
  • A lost connection raises WebSocketError("WebSocket connection lost") with httpx-ws's exception as __cause__. It is also an httpx_ws.WebSocketNetworkError when that is the cause, so both except clauses catch it.
  • httpx-ws 0.10 (what pip install gives on Python 3.11+) closed the connection on audio messages over 64 KiB. The SDK now sets a 64 MiB limit of its own; WebSocketOptions(max_message_size_bytes=...) still wins.
  • httpx-ws's in-process ASGIWebSocketTransport on httpx-ws 0.7.2 and 0.8.0: leaving the httpx.AsyncClient after an async stream raises a cancel-scope RuntimeError. Real network connections and httpx-ws 0.8.1+ are not affected.