Repository navigation
fix(tts): accept latency "low"; save to a file first in the README quick start - #204
Conversation
The API accepts latency "low" (OpenAPI enum: low, normal, balanced), and the TypeScript SDK already offers it, but LatencyMode only allowed "normal" and "balanced", so TTSConfig and TTSRequest rejected it. What the docstrings say about "low" follows the S3 Pro model card and a live check on 2026-12-02 (median time to first audio bytes, 8 runs): s3-pro 0.26 s with low vs 0.29 s with balanced; s3-pro-free accepts it without a speed-up (the model card: not available there); s2.1-pro showed no speed-up either.
play() runs ffplay and raises DependencyError when it is not on PATH, so the first example failed on a clean machine after a paid request. The quick start now saves to output.mp3. Playing is an optional block that reads that file and names its requirements (ffplay, or the [utils] extra with use_ffmpeg=False, plus PortAudio on Linux). The [utils] install comment says what it adds.
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
🟡 Changes recommended
The TTSRequest docstring contradicts the newly supported "low" option, which could mislead users and generated documentation.
1 open issue
What changed in this PR
Adds support for the API’s "low" latency mode and updates the README quick start to save audio before optional playback.
Changes:
- Expands latency typing, validation, and request handling.
- Updates TTS documentation and latency examples.
- Adds tests for latency values and payload propagation.
- Revises README playback and dependency guidance.
| File | Description |
|---|---|
| tests/unit/test_types.py | Tests accepted and rejected latency values and configuration handling. |
| tests/unit/test_tts.py | Tests propagation of the "low" latency value in TTS request payloads. |
| src/fishaudio/types/tts.py | Updates TTS model latency documentation and supported values. |
| src/fishaudio/types/shared.py | Adds "low" to the LatencyMode type. |
| src/fishaudio/resources/tts.py | Documents the "low" latency option across TTS methods. |
| README.md | Revises quick-start examples to save generated audio before optional playback. |
Review effort: Lite
| latency: Generation mode. Options: "normal", "balanced". Default: "balanced" | ||
| "low" is also accepted; it gives earlier first audio on s3-pro. |
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|

Before.
LatencyModewasLiteral["normal", "balanced"], soTTSConfig(latency="low")andTTSRequest(latency="low")raised a validation error. The API accepts"low"(OpenAPI enumlow, normal, balanced), and the TypeScript SDK offers it.play(audio)first.playrunsffplayand raisesDependencyErrorwhen it is missing, so the first example failed on a clean machine or server after a paid request.After.
LatencyModeisLiteral["low", "normal", "balanced"]. The docstrings say whatlowdoes (S3 Pro model card plus a live check):s3-pro;s3-pro-free, which accepts it without a speed-up;s2.1-proshowed no speed-up either.output.mp3. Playing is an optional block that reads that file and names what it needs:ffplayon PATH, or the[utils]extra withuse_ffmpeg=False(plus PortAudio on Linux). The[utils]install comment says what it adds.How verified.
s3-pro0.26 s withlowvs 0.29 s withbalanced.s3-pro-freeands2.1-pro: no measurable difference. All return 200.convert(latency="low"),TTSConfig(latency="low")andstream_websocket(..., latency="low")all succeed.LatencyModenames all three values; config and request accept each one and reject an unknown one;"low"reaches the request body from a parameter and from config.Who wrote the changed lines.
LatencyModeand the docstrings: James Ding (2025-11, SDK rewrite).[utils]line: Felix Lu.The legacy
fish_audio_sdkpackage is not changed; it gets no updates.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Summary by CodeRabbit
"low"latency option, which can provide earlier first audio on s3-pro.