From f8c1ac7db8b508db5a20a2d4a419174cbaadc287 Mon Sep 17 00:00:00 2001 From: Felix Lu <58391009+lumpinif@users.noreply.github.com> Date: Tue, 24 Nov 2026 21:59:20 -0800 Subject: [PATCH 1/4] feat: add s3-pro model Add s3-pro to the Model Literal so type checkers accept it, show it in the README model examples, and pin the model header in a unit test. The default model is unchanged. Co-Authored-By: Claude Fable 5.2 --- README.md | 6 ++++++ src/fishaudio/types/shared.py | 2 +- tests/unit/test_tts.py | 12 ++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fbd31e8..521c877 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,12 @@ drama_audio = client.tts.convert( text="Expressive speech", model="drama-3", ) + +# S3 Pro +s3_audio = client.tts.convert( + text="S3 Pro speech", + model="s3-pro", +) ``` **With custom voice:** diff --git a/src/fishaudio/types/shared.py b/src/fishaudio/types/shared.py index 0628f9f..675d7d2 100644 --- a/src/fishaudio/types/shared.py +++ b/src/fishaudio/types/shared.py @@ -22,7 +22,7 @@ class PaginatedResponse(BaseModel, Generic[T]): # Model types -Model = Literal["s1", "s2-pro", "s2.1-pro", "s2.1-pro-free", "drama-3"] +Model = Literal["s1", "s2-pro", "s2.1-pro", "s2.1-pro-free", "drama-3", "s3-pro"] # Deprecated models DEPRECATED_MODELS = {"speech-1.5", "speech-1.6"} diff --git a/tests/unit/test_tts.py b/tests/unit/test_tts.py index 859d90d..a32e2ab 100644 --- a/tests/unit/test_tts.py +++ b/tests/unit/test_tts.py @@ -111,6 +111,18 @@ def test_convert_with_drama_3(self, tts_client, mock_client_wrapper): call_args = mock_client_wrapper.request.call_args assert call_args[1]["headers"]["model"] == "drama-3" + def test_convert_with_s3_pro(self, tts_client, mock_client_wrapper): + """Test the s3-pro model is sent as the model header.""" + mock_response = Mock() + mock_response.iter_bytes.return_value = iter([b"audio"]) + mock_client_wrapper.request.return_value = mock_response + + audio = tts_client.convert(text="Hello world", model="s3-pro") + + assert audio == b"audio" + call_args = mock_client_wrapper.request.call_args + assert call_args[1]["headers"]["model"] == "s3-pro" + def test_convert_with_reference_id(self, tts_client, mock_client_wrapper): """Test TTS with reference voice ID.""" mock_response = Mock() From 8b3bf085d0b30eb3a614f2d61351395e96d6fcfe Mon Sep 17 00:00:00 2001 From: Felix Lu <58391009+lumpinif@users.noreply.github.com> Date: Mon, 30 Nov 2026 07:17:58 -0800 Subject: [PATCH 2/4] feat(tts): default to s3-pro Behaviour change: when no model is passed, convert, stream, stream_websocket, stream_with_timestamps and convert_with_timestamps (sync and async) now send "model: s3-pro" instead of "model: s2.1-pro". Callers who need the previous behaviour pass model="s2.1-pro". Tests pin the default on the HTTP, WebSocket and timestamp paths. --- README.md | 15 ++++++--------- src/fishaudio/resources/tts.py | 20 ++++++++++---------- tests/unit/test_tts.py | 8 ++++---- tests/unit/test_tts_realtime.py | 4 ++-- tests/unit/test_tts_timestamps.py | 23 +++++++++++++++++++++++ 5 files changed, 45 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 257c695..8288ca3 100644 --- a/README.md +++ b/README.md @@ -91,9 +91,12 @@ asyncio.run(main()) **Selecting a model:** ```python -# Recommended for production -production_audio = client.tts.convert( - text="Production speech", +# S3 Pro ("s3-pro") is used when no model is set +audio = client.tts.convert(text="Default model speech") + +# S2.1 Pro: the default in 1.7.x and earlier +s21_audio = client.tts.convert( + text="S2.1 Pro speech", model="s2.1-pro", ) @@ -108,12 +111,6 @@ drama_audio = client.tts.convert( text="Expressive speech", model="drama-3", ) - -# S3 Pro -s3_audio = client.tts.convert( - text="S3 Pro speech", - model="s3-pro", -) ``` **With custom voice:** diff --git a/src/fishaudio/resources/tts.py b/src/fishaudio/resources/tts.py index 73d83f2..73c4e67 100644 --- a/src/fishaudio/resources/tts.py +++ b/src/fishaudio/resources/tts.py @@ -145,7 +145,7 @@ def stream( latency: Optional[LatencyMode] = None, speed: Optional[float] = None, config: TTSConfig = TTSConfig(), - model: Union[Model, str] = "s2.1-pro", + model: Union[Model, str] = "s3-pro", request_options: Optional[RequestOptions] = None, ) -> AudioStream: """ @@ -234,7 +234,7 @@ def convert( latency: Optional[LatencyMode] = None, speed: Optional[float] = None, config: TTSConfig = TTSConfig(), - model: Union[Model, str] = "s2.1-pro", + model: Union[Model, str] = "s3-pro", request_options: Optional[RequestOptions] = None, ) -> bytes: """ @@ -296,7 +296,7 @@ def stream_with_timestamps( latency: Optional[LatencyMode] = None, speed: Optional[float] = None, config: TTSConfig = TTSConfig(), - model: Union[Model, str] = "s2.1-pro", + model: Union[Model, str] = "s3-pro", request_options: Optional[RequestOptions] = None, ) -> TTSTimestampStream: """ @@ -381,7 +381,7 @@ def convert_with_timestamps( latency: Optional[LatencyMode] = None, speed: Optional[float] = None, config: TTSConfig = TTSConfig(), - model: Union[Model, str] = "s2.1-pro", + model: Union[Model, str] = "s3-pro", request_options: Optional[RequestOptions] = None, ) -> TTSTimestampResult: """ @@ -445,7 +445,7 @@ def stream_websocket( latency: Optional[LatencyMode] = None, speed: Optional[float] = None, config: TTSConfig = TTSConfig(), - model: Union[Model, str] = "s2.1-pro", + model: Union[Model, str] = "s3-pro", max_workers: int = 10, ws_options: Optional[WebSocketOptions] = None, ) -> Iterator[bytes]: @@ -608,7 +608,7 @@ async def stream( latency: Optional[LatencyMode] = None, speed: Optional[float] = None, config: TTSConfig = TTSConfig(), - model: Union[Model, str] = "s2.1-pro", + model: Union[Model, str] = "s3-pro", request_options: Optional[RequestOptions] = None, ) -> AsyncAudioStream: """ @@ -698,7 +698,7 @@ async def convert( latency: Optional[LatencyMode] = None, speed: Optional[float] = None, config: TTSConfig = TTSConfig(), - model: Union[Model, str] = "s2.1-pro", + model: Union[Model, str] = "s3-pro", request_options: Optional[RequestOptions] = None, ) -> bytes: """ @@ -761,7 +761,7 @@ async def stream_with_timestamps( latency: Optional[LatencyMode] = None, speed: Optional[float] = None, config: TTSConfig = TTSConfig(), - model: Union[Model, str] = "s2.1-pro", + model: Union[Model, str] = "s3-pro", request_options: Optional[RequestOptions] = None, ) -> AsyncTTSTimestampStream: """ @@ -847,7 +847,7 @@ async def convert_with_timestamps( latency: Optional[LatencyMode] = None, speed: Optional[float] = None, config: TTSConfig = TTSConfig(), - model: Union[Model, str] = "s2.1-pro", + model: Union[Model, str] = "s3-pro", request_options: Optional[RequestOptions] = None, ) -> TTSTimestampResult: """ @@ -912,7 +912,7 @@ async def stream_websocket( latency: Optional[LatencyMode] = None, speed: Optional[float] = None, config: TTSConfig = TTSConfig(), - model: Union[Model, str] = "s2.1-pro", + model: Union[Model, str] = "s3-pro", ws_options: Optional[WebSocketOptions] = None, ): """ diff --git a/tests/unit/test_tts.py b/tests/unit/test_tts.py index a32e2ab..7b64532 100644 --- a/tests/unit/test_tts.py +++ b/tests/unit/test_tts.py @@ -63,7 +63,7 @@ def test_stream_basic(self, tts_client, mock_client_wrapper): # Check headers assert call_args[1]["headers"]["Content-Type"] == "application/msgpack" - assert call_args[1]["headers"]["model"] == "s2.1-pro" # default model + assert call_args[1]["headers"]["model"] == "s3-pro" # default model # Check payload was msgpack encoded assert "content" in call_args[1] @@ -85,7 +85,7 @@ def test_convert_basic(self, tts_client, mock_client_wrapper): # Verify request was made correctly mock_client_wrapper.request.assert_called_once() call_args = mock_client_wrapper.request.call_args - assert call_args[1]["headers"]["model"] == "s2.1-pro" + assert call_args[1]["headers"]["model"] == "s3-pro" def test_convert_with_free_model(self, tts_client, mock_client_wrapper): """Test the free s2.1-pro-free model is sent as the model header.""" @@ -549,7 +549,7 @@ async def async_iter_bytes(): assert call_args[0][0] == "POST" assert call_args[0][1] == "/v1/tts" - assert call_args[1]["headers"]["model"] == "s2.1-pro" + assert call_args[1]["headers"]["model"] == "s3-pro" @pytest.mark.asyncio async def test_convert_basic(self, async_tts_client, async_mock_client_wrapper): @@ -575,7 +575,7 @@ async def async_iter_bytes(): # Verify request was made async_mock_client_wrapper.request.assert_called_once() call_args = async_mock_client_wrapper.request.call_args - assert call_args[1]["headers"]["model"] == "s2.1-pro" + assert call_args[1]["headers"]["model"] == "s3-pro" @pytest.mark.asyncio async def test_convert_with_reference_id( diff --git a/tests/unit/test_tts_realtime.py b/tests/unit/test_tts_realtime.py index 9e2a425..7a0f27f 100644 --- a/tests/unit/test_tts_realtime.py +++ b/tests/unit/test_tts_realtime.py @@ -92,7 +92,7 @@ def test_stream_websocket_basic( # Verify WebSocket connection was created mock_connect_ws.assert_called_once() assert mock_connect_ws.call_args[0][0] == "/v1/tts/live" - assert mock_connect_ws.call_args[1]["headers"]["model"] == "s2.1-pro" + assert mock_connect_ws.call_args[1]["headers"]["model"] == "s3-pro" @pytest.mark.filterwarnings("ignore::DeprecationWarning") @patch("fishaudio.resources.tts.connect_ws") @@ -426,7 +426,7 @@ async def text_stream(): # Verify WebSocket connection was created mock_aconnect_ws.assert_called_once() assert mock_aconnect_ws.call_args[0][0] == "/v1/tts/live" - assert mock_aconnect_ws.call_args[1]["headers"]["model"] == "s2.1-pro" + assert mock_aconnect_ws.call_args[1]["headers"]["model"] == "s3-pro" @pytest.mark.filterwarnings("ignore::DeprecationWarning") @pytest.mark.asyncio diff --git a/tests/unit/test_tts_timestamps.py b/tests/unit/test_tts_timestamps.py index ff3e028..c0858e7 100644 --- a/tests/unit/test_tts_timestamps.py +++ b/tests/unit/test_tts_timestamps.py @@ -392,6 +392,17 @@ def handler(request): ) assert seen["timeout"]["read"] == 12.5 + def test_default_model_is_s3_pro(self): + seen = {} + + def handler(request): + seen["request"] = request + return httpx.Response(200, stream=_SyncBody(BODY)) + + _sync_tts(handler).stream_with_timestamps(text="Hello world.").close() + + assert seen["request"].headers["model"] == "s3-pro" + class TestAsyncTimestamps: async def test_request_path_and_headers(self): @@ -412,6 +423,18 @@ def handler(request): assert request.headers["model"] == "s2-pro" assert ormsgpack.unpackb(request.content)["format"] == "wav" + async def test_default_model_is_s3_pro(self): + seen = {} + + def handler(request): + seen["request"] = request + return httpx.Response(200, stream=_AsyncBody(BODY)) + + stream = await _async_tts(handler).stream_with_timestamps(text="Hello world.") + await stream.aclose() + + assert seen["request"].headers["model"] == "s3-pro" + async def test_events_are_typed_and_arrive_incrementally(self): body = _AsyncBody(BODY) stream = await _async_tts(_ok(body)).stream_with_timestamps(text="Hi") From 5b22931a19f5cefd970270e2eb16bab27c6191a5 Mon Sep 17 00:00:00 2001 From: Felix Lu <58391009+lumpinif@users.noreply.github.com> Date: Tue, 1 Dec 2026 01:03:47 -0800 Subject: [PATCH 3/4] fix(types): point the speech-1.5/1.6 deprecation warning at s3-pro s3-pro is now the default model; the warning still sent users to s2.1-pro. The s1 warning keeps s2.1-pro: that is the model s1 requests are served by after December 31, 2026. --- src/fishaudio/types/shared.py | 2 +- tests/unit/test_deprecated_models.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fishaudio/types/shared.py b/src/fishaudio/types/shared.py index 1dfd571..878cf9a 100644 --- a/src/fishaudio/types/shared.py +++ b/src/fishaudio/types/shared.py @@ -40,7 +40,7 @@ def _get_response_headers(model: BaseModel) -> httpx.Headers: Model = Literal["s1", "s2-pro", "s2.1-pro", "s2.1-pro-free", "drama-3", "s3-pro"] # Deprecated models, mapped to the warning shown when one is used. -_SPEECH_1_MESSAGE = "Model '{model}' is deprecated. Use 's2.1-pro' instead." +_SPEECH_1_MESSAGE = "Model '{model}' is deprecated. Use 's3-pro' instead." _S1_MESSAGE = ( "Model 's1' is deprecated and will be retired on December 31, 2026. " "After that date, requests that specify 's1' are served by 's2.1-pro' " diff --git a/tests/unit/test_deprecated_models.py b/tests/unit/test_deprecated_models.py index 2b55dd5..5ca5115 100644 --- a/tests/unit/test_deprecated_models.py +++ b/tests/unit/test_deprecated_models.py @@ -260,7 +260,7 @@ def test_each_model_shows_once(self): assert [str(w.message) for w in _deprecation_warnings(record)] == [ S1_MESSAGE, - "Model 'speech-1.5' is deprecated. Use 's2.1-pro' instead.", + "Model 'speech-1.5' is deprecated. Use 's3-pro' instead.", ] def test_always_filter_shows_every_call(self): From 1a64623531c44541557bff96d12b42ae02d550af Mon Sep 17 00:00:00 2001 From: Felix Lu <58391009+lumpinif@users.noreply.github.com> Date: Tue, 1 Dec 2026 22:32:11 -0800 Subject: [PATCH 4/4] test(websocket): expect s3-pro in the default handshake headers The handshake-headers test from main wrote out the old default model; on this branch the default is s3-pro. --- tests/unit/test_websocket_headers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/test_websocket_headers.py b/tests/unit/test_websocket_headers.py index 81965de..caa391b 100644 --- a/tests/unit/test_websocket_headers.py +++ b/tests/unit/test_websocket_headers.py @@ -123,7 +123,7 @@ def test_the_default_handshake_headers(path): """What a call without ws_options sends, written out.""" sent = handshake(path) - model = "transcribe-stream-1" if "asr" in path else "s2.1-pro" + model = "transcribe-stream-1" if "asr" in path else "s3-pro" assert [name for name, _ in sent] == [ "accept", "accept-encoding",