Skip to content

docs: fix TTS model header — optional, default s2.1-pro, document fallback - #110

Closed
M2Night wants to merge 1 commit into
mainfrom
docs/fix-tts-model-header-default
Closed

docs: fix TTS model header — optional, default s2.1-pro, document fallback#110
M2Night wants to merge 1 commit into
mainfrom
docs/fix-tts-model-header-default

Conversation

@M2Night

@M2Night M2Night commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

The model header on the TTS endpoints (/v1/tts and /v1/tts/stream/with-timestamp) was documented as required with default s2.1-pro-free. Live testing shows both are wrong:

  • The header is optional — omitting it returns 200.
  • The actual server-side fallback is s2.1-pro (paid tier), not s2.1-pro-free. An unrecognized value (e.g. a typo like s2pro) does not error; it silently falls back to s2.1-pro as well.

This PR updates api-reference/openapi.json accordingly and adds one sentence documenting the fallback behavior:

If omitted or set to an unrecognized value, the request falls back to s2.1-pro.

Test evidence

All four requests returned 200 from us-san-jose, each with a distinct traceparent (per the observability docs) so the backend can confirm which model actually served them. ratelimit-limit-concurrency was captured to distinguish free vs paid tier:

# Scenario model sent trace-id Concurrency header Reading
1 Header omitted 5e56d2de69a1a713a62e369c01aa8e92 100 paid tier (fallback)
2 Typo s2pro 9027a9d2f50f325d9ccdce983e524f4b 100 paid tier (fallback, no error)
3 Valid s2-pro 9a40d052f02ec2cfbf05eb70a1b1b452 100 paid tier
4 Valid s2.1-pro aaa50a97136c81c78926b47011379de6 100 paid tier

Note for maintainers

openapi.json is refreshed from upstream by npm run update:openapi, so the same fix (required=False, default="s2.1-pro", fallback sentence in the description) should also land in the backend FastAPI parameter definition — otherwise the next schema sync will revert this.

The /v1/voice-design model header is intentionally untouched.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • API Updates
    • The model header is now optional for text-to-speech requests.
    • Requests that omit the header or provide an unrecognized model now default to s2.1-pro.
    • Updated API documentation to reflect the new default behavior.

Live tests (trace IDs 5e56d2de…, 9027a9d2…, 9a40d052…, aaa50a97…) show
the model header is not required and unrecognized/omitted values fall
back to s2.1-pro, not s2.1-pro-free.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The OpenAPI contract makes the model header optional for two TTS endpoints, changes its default to s2.1-pro, and documents fallback behavior for omitted or unrecognized values.

Changes

TTS model contract

Layer / File(s) Summary
Update TTS model header defaults
api-reference/openapi.json
The model header is optional for both TTS endpoints, defaults to s2.1-pro, and documents fallback behavior while retaining the existing enum values.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • fishaudio/docs#51: Updates the allowed model values for the TTS header.
  • fishaudio/docs#55: Updates the TTS model header’s default, description, and allowed behavior.
  • fishaudio/docs#95: Updates the TTS endpoint model header contract in the OpenAPI schema.

Suggested reviewers: fishaudio-bot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main TTS model header documentation change and its new default/fallback behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/fix-tts-model-header-default

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mintlify

mintlify Bot commented Jul 30, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
hanabiaiinc 🟢 Ready View Preview Jul 30, 2026, 10:52 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@api-reference/openapi.json`:
- Around line 2475-2476: Update the model-header documentation in the
text-to-speech feature content to state that it is optional and defaults to
s2.1-pro when omitted or unrecognized, aligning it with the OpenAPI description;
otherwise defer the OpenAPI contract change until both descriptions agree.
- Around line 2475-2478: Align both TTS model schemas with their documented
fallback behavior: update the model parameters at api-reference/openapi.json
lines 2475-2478 and 2653-2656 to accept arbitrary string values while retaining
the s2.1-pro default, or remove the unrecognized-value fallback wording from
both descriptions. Apply the same choice consistently to /v1/tts and
/v1/tts/stream/with-timestamp.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 200897cb-3faf-4def-b736-45a047b949f3

📥 Commits

Reviewing files that changed from the base of the PR and between 1ac2cfe and 84a4f83.

📒 Files selected for processing (1)
  • api-reference/openapi.json

Comment on lines +2475 to +2476
"description": "Specify which TTS model to use. Use `s2.1-pro-free` for the free developer tier. If omitted or set to an unrecognized value, the request falls back to `s2.1-pro`.",
"required": false,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Update the feature documentation in the same change.

features/text-to-speech.mdx:268 still states that the model header is required on every /v1/tts request, contradicting this optional-header contract. Update that documentation or defer this OpenAPI change until both public descriptions agree.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@api-reference/openapi.json` around lines 2475 - 2476, Update the model-header
documentation in the text-to-speech feature content to state that it is optional
and defaults to s2.1-pro when omitted or unrecognized, aligning it with the
OpenAPI description; otherwise defer the OpenAPI contract change until both
descriptions agree.

Comment on lines +2475 to +2478
"description": "Specify which TTS model to use. Use `s2.1-pro-free` for the free developer tier. If omitted or set to an unrecognized value, the request falls back to `s2.1-pro`.",
"required": false,
"schema": {
"default": "s2.1-pro-free",
"default": "s2.1-pro",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Tracked OpenAPI files:"
git ls-files | rg '(^|/)openapi\.json$|api-reference/' || true

echo
echo "Relevant snippets:"
python3 - <<'PY'
from pathlib import Path
p=Path("api-reference/openapi.json")
if not p.exists():
    print(f"{p} missing")
    raise SystemExit
text=p.read_text(encoding="utf-8").splitlines()
for start,end in ((2475,2478),(2653,2656)):
    print(f"\n--- {p}:{start}-{end} ---")
    for i in range(start, end+1):
        print(f"{i}: {text[i-1]}")

print("\nSearch for fallback wording and model enum occurrences:")
import re
matches=[]
for i,line in enumerate(text, start=1):
    if "falls back" in line or "fall back" in line or "s2.1-pro-free" in line or "s2.1-pro" in line:
        matches.append((i,line))
for i,line in matches[:80]:
    print(f"{i}: {line}")
PY

echo
echo "Inspect surrounding schema definitions with Python JSON parsing:"
python3 - <<'PY'
import json
from pathlib import Path
p=Path("api-reference/openapi.json")
data=json.loads(p.read_text())
def find_paths(obj, key=None, path=()):
    if isinstance(obj, dict):
        for k,v in obj.items():
            if k == key:
                print(f"KEY {key} at {path}.{k}")
            yield from find_paths(v, key, f"{path}.{k}")
        for k,v in obj.items():
            yield from find_paths(v, key, f"{path}.{k}")
    elif isinstance(obj, list):
        for idx,v in enumerate(obj):
            yield from find_paths(v, key, path=f"{path}[{idx}]")

# Navigate likely paths around TTS endpoints
try:
    paths=json.loads(p.read_text())[ "paths"]
    for path in paths:
        if "tts" in path.lower():
            print(f"\nPATH {path}")
            for method,params in paths[path].items():
                print(f"  {method.upper()}")
                if "requestBody" in params:
                    print(json.dumps(params["requestBody"], indent=2)[:1200])
                if "parameters" in params:
                    for par in params["parameters"]:
                        if "model" in par.get("name","").lower() or "model" in str(par.get("schema",{})).lower():
                            print("  parameter:", json.dumps(par, indent=2))
except Exception as e:
    print("PATH traversal failed:", e)

print("\nAll enum arrays containing model values:")
def walk(o,path=""):
    if isinstance(o, dict):
        if o.get("enum") is not None:
            v=o["enum"]
            if any("s2" in str(x).lower() or "tts" in path.lower() or "model" in path.lower() for x in v):
                print(f"{path}: {v}")
        for k,v in o.items():
            walk(v, f"{path}.{k}")
    elif isinstance(o, list):
        for i,v in enumerate(o):
            walk(v, f"{path}[{i}]")
walk(data)
PY

Repository: fishaudio/docs

Length of output: 11456


Don’t promise unknown-model fallback while the schemas limit model values.

Both TTS endpoint headers document that unrecognized model values fall back to s2.1-pro, but each model parameter schema has a closed enum (s1, s2-pro, s2.1-pro, s2.1-pro-free). Make the schemas allow any string/default-driven value, or remove the fallback language from both /v1/tts and /v1/tts/stream/with-timestamp.

📍 Affects 1 file
  • api-reference/openapi.json#L2475-L2478 (this comment)
  • api-reference/openapi.json#L2653-L2656
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@api-reference/openapi.json` around lines 2475 - 2478, Align both TTS model
schemas with their documented fallback behavior: update the model parameters at
api-reference/openapi.json lines 2475-2478 and 2653-2656 to accept arbitrary
string values while retaining the s2.1-pro default, or remove the
unrecognized-value fallback wording from both descriptions. Apply the same
choice consistently to /v1/tts and /v1/tts/stream/with-timestamp.

@M2Night M2Night closed this Jul 30, 2026
@M2Night
M2Night deleted the docs/fix-tts-model-header-default branch July 30, 2026 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant