Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .mintlify/skills/fish-audio-sdk/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
- **TTS models:** the API supports `s1` (deprecated), `s2-pro`, `s2.1-pro` (recommended for production), and `s2.1-pro-free` (free tier). Do not choose `s1` for new code: S1 is deprecated and will be retired on December 31, 2026. After that date, requests that specify `s1` are served by `s2.1-pro` (migration: `https://docs.fish.audio/developer-guide/models-pricing/migrate-from-s1`). The Python SDK (`fish-audio-sdk` 1.4.0 and later) defaults to `s2.1-pro`; its `Model` type names `s1`, `s2-pro`, `s2.1-pro`, `s2.1-pro-free` and `drama-3` and accepts any other string, so no `# type: ignore` is needed (1.3.0 and earlier defaulted to `s2-pro` and typed only `s1` / `s2-pro`). The JS SDK (`fish-audio` 0.2.0) defaults to `"s2.1-pro"`, and its `Backends` type names `s2.1-pro`, `s2.1-pro-free`, `drama-3`, `s2-pro`, `s1` and accepts any other string, so no cast is needed. `fish-audio` 0.1.0 defaulted to the deprecated `"s1"`; if a project is on 0.1.0, upgrade it or pass the model explicitly. `speech-1.5` / `speech-1.6` are **deprecated**. In Python pass `model="s2.1-pro"` (keyword); in JS pass the **positional** `backend` argument.
- **ASR models:** use `transcribe-1-pro` (recommended: speaker turns, long recordings, emotion cues). It is selected by the `model` HTTP header: in JS pass `model: "transcribe-1-pro"` in the `convert()` request (`fish-audio` 0.2.0+), in Python send the header with `RequestOptions(additional_headers=...)`. A request without it is served and billed as `transcribe-1`, the model for short recordings. See [references/speech-to-text.md](references/speech-to-text.md).
- **Audio formats:** `mp3` (default), `wav`, `pcm`, `opus`.
- **Playback in examples:** `play()` shells out to a system audio tool: Python uses **ffmpeg/ffplay** (or `mpv`), JS uses **ffplay**. It is for local/desktop use; in a server, `save()` to a file or stream the bytes instead. See [references/installation.md](references/installation.md).

Check warning on line 24 in .mintlify/skills/fish-audio-sdk/SKILL.md

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'ffplay'?

## Quick start: Python

Expand Down Expand Up @@ -80,10 +80,10 @@

| Task | Reference |
| ------------------------------------------------------------------------- | ------------------------------------------------------------ |
| Install, auth, playback deps, verify a key | [references/installation.md](references/installation.md) |

Check warning on line 83 in .mintlify/skills/fish-audio-sdk/SKILL.md

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'deps'?
| Text-to-Speech (convert, stream, formats, prosody, model select) | [references/text-to-speech.md](references/text-to-speech.md) |
| Voice cloning (instant references + persistent voice models) | [references/voice-cloning.md](references/voice-cloning.md) |
| Speech-to-Text (models, timestamps, fields the SDK drops, realtime in JS) | [references/speech-to-text.md](references/speech-to-text.md) |
| Speech-to-Text (models, timestamps, response fields by SDK version, realtime in JS) | [references/speech-to-text.md](references/speech-to-text.md) |
| Realtime WebSocket TTS (stream text → audio) | [references/websocket.md](references/websocket.md) |
| Errors, retries, and timeouts (the **real** exception types) | [references/errors.md](references/errors.md) |

Expand All @@ -106,7 +106,7 @@
| Update / delete voice | `client.voices.update(id, ...)` / `delete(id)` | `client.voices.update(id, ...)` / `delete(id)` |
| Credit balance | `client.account.get_credits()` | `client.user.get_api_credit()` |
| Subscription package | `client.account.get_package()` | `client.user.get_package()` |
| Choose model | `model="s2.1-pro"` keyword arg | positional `backend` arg, e.g. `convert(req, "s2-pro")` |

Check warning on line 109 in .mintlify/skills/fish-audio-sdk/SKILL.md

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'arg'?

Check warning on line 109 in .mintlify/skills/fish-audio-sdk/SKILL.md

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'arg'?
| ASR model (header) | `RequestOptions(additional_headers=...)` | `convert({ audio, model: "transcribe-1-pro" })` |

## Decision shortcuts
Expand All @@ -125,4 +125,4 @@
- Python `latency` accepts only **`"normal"` or `"balanced"`** (default `"balanced"`); there is no `"low"`.
- The Python client has **no `max_retries`** and does **not** auto-retry; the JS client **does** auto-retry (configurable via per-call `requestOptions.maxRetries`). See [errors](references/errors.md).
- Python defines a `ValidationError` class but **never raises it**, so don't catch it expecting validation failures; a 422 surfaces as `APIError`. The JS SDK throws `UnprocessableEntityError` on 422.
- ASR segment `start` / `end` and `duration` are all in **seconds**. The Python SDK's `ASRResponse` docstring says milliseconds; that is wrong. See [speech-to-text](references/speech-to-text.md).
- ASR segment `start` / `end` and `duration` are all in **seconds**. In `fish-audio-sdk` 1.3.0 and earlier, the `ASRResponse` docstring says milliseconds; that is wrong. See [speech-to-text](references/speech-to-text.md).
8 changes: 4 additions & 4 deletions .mintlify/skills/fish-audio-sdk/references/speech-to-text.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,19 @@
seg.end # float: seconds (can equal start)
```

`duration`, `start`, and `end` are all in **seconds**. The SDK's `ASRResponse` docstring says milliseconds; that is wrong, so do not divide by 1000.
`duration`, `start`, and `end` are all in **seconds**. In `fish-audio-sdk` 1.3.0 and earlier, the `ASRResponse` docstring says milliseconds; that is wrong, so do not divide by 1000.

Segment text has no punctuation, speaker markers, or cues, and can be normalized (for example `35` for `3.5`), so it does not always match `text` character for character. Segments are not speaker turns.

### Fields the Python SDK does not expose
### Fields the Python SDK exposes from 1.4.0

In `fish-audio-sdk` 1.3.0, `ASRResponse` keeps only `text`, `duration`, and `segments`. It silently drops these response fields:
`fish-audio-sdk` 1.4.0 and later return these response fields on `ASRResponse`, each `None` when the API does not send it. In 1.3.0 and earlier, `ASRResponse` keeps only `text`, `duration`, and `segments` and silently drops them:

- `speaker_turns` (`transcribe-1-pro`, when timestamps are requested);
- `request_id` (`transcribe-1-pro`), also sent as the `x-request-id` header;
- `language` (English name, such as `English`) and `language_code` (ISO 639-1, such as `en`), returned when the language is known.

`asr.transcribe()` also cannot send the `transcribe-1-pro` fields `tag_audio_events`, `diarize`, `num_speakers`, `min_speakers`, or `max_speakers`. For any of these, call the API directly. Field semantics are in the `fish-audio-api` skill (`POST /v1/asr`).
`asr.transcribe()` cannot send the `transcribe-1-pro` fields `tag_audio_events`, `diarize`, `num_speakers`, `min_speakers`, or `max_speakers`. For any of these, call the API directly. Field semantics are in the `fish-audio-api` skill (`POST /v1/asr`).

```python
import os
Expand Down Expand Up @@ -183,7 +183,7 @@

## JavaScript realtime: `speechToText.convertRealtime`

`client.speechToText.convertRealtime(request, audioStream, requestOptions?)` (`fish-audio` 0.2.0+, **Node.js only**) streams live 16-bit little-endian mono PCM to `transcribe-stream-1` (Preview) over a WebSocket and returns a `RealtimeSTTStream` **synchronously** (no `await`). Iterate it with `for await`; events are narrowed by `type`, and their fields are the protocol's snake_case names. Guide: `https://docs.fish.audio/features/speech-to-text/realtime`.

Check warning on line 186 in .mintlify/skills/fish-audio-sdk/references/speech-to-text.md

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

'snake_case' looks like code; format it as code.

```ts
import { createReadStream } from "node:fs";
Expand Down Expand Up @@ -219,5 +219,5 @@

- `transcribe-1-pro` accepts recordings up to 60 minutes (longer returns 400 `audio_too_long`). Send long recordings as compressed audio (MP3, Opus, or AAC); a request that is too large returns 413. Send a whole conversation as one file: speaker labels are consistent within one response, not across requests.
- Processing time grows with the length of the recording, and long `transcribe-1-pro` requests can take several minutes. Raise the SDK timeout for long recordings (the examples use 900 s; the defaults are in [errors](errors.md)), and in Node.js also raise the `fetch` header limit shown above.
- `transcribe-1-pro` accepts WAV, MP3, AAC (including M4A/MP4), FLAC, Ogg (Opus or Vorbis), WebM/Matroska, and MOV, including browser recordings, and uses the first audio track of a video file. AIFF, CAF, WMA, AMR, AC-3, and raw (headerless) PCM return 400.

Check warning on line 222 in .mintlify/skills/fish-audio-sdk/references/speech-to-text.md

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'Ogg'?

Check warning on line 222 in .mintlify/skills/fish-audio-sdk/references/speech-to-text.md

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'Vorbis'?

Check warning on line 222 in .mintlify/skills/fish-audio-sdk/references/speech-to-text.md

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'headerless'?
- If you use `transcribe-1`: it is designed for short recordings, up to 50 MiB per request; keep MP3 and Opus files under 25 MiB. For recordings longer than a few minutes, use `transcribe-1-pro`. It accepts WAV, MP3, AAC (including M4A/MP4), FLAC, and Ogg (Opus or Vorbis); convert browser WebM recordings to Ogg/Opus, MP3, or WAV first, or use `transcribe-1-pro`.

Check warning on line 223 in .mintlify/skills/fish-audio-sdk/references/speech-to-text.md

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'Ogg'?

Check warning on line 223 in .mintlify/skills/fish-audio-sdk/references/speech-to-text.md

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'Vorbis'?
7 changes: 4 additions & 3 deletions api-reference/endpoint/openapi-v1/speech-to-text.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,11 @@
`request_options=RequestOptions(additional_headers={"model": "transcribe-1-pro"})`
to `asr.transcribe()`. In JavaScript, pass
`{ headers: { model: "transcribe-1-pro" } }` as the second argument to
`speechToText.convert()`. The Python SDK currently returns only `text`,
`duration`, and `segments`, and neither SDK can send `tag_audio_events`,
`speechToText.convert()`. Neither SDK can send `tag_audio_events`,
`diarize`, or the speaker-count hints. To use them, call the API directly, as
in the examples above. The JavaScript SDK returns the whole response body,
in the examples above. The Python SDK returns the fields listed above
(`fish-audio-sdk` 1.4.0 or later; earlier versions keep only `text`,
`duration`, and `segments`). The JavaScript SDK returns the whole response body,
but its `STTResponse` type declares only `text`, `duration`, and `segments`.
</Note>

Expand Down Expand Up @@ -193,7 +194,7 @@
## Limits

- **Audio length:** up to 60 minutes per request. Longer audio returns 400 with code `audio_too_long`.
- **Request size:** for long recordings, send compressed audio such as MP3, Opus, or AAC. An hour of 128 kbps MP3 is about 55 MiB. A request that is too large returns 413.

Check warning on line 197 in api-reference/endpoint/openapi-v1/speech-to-text.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'kbps'?
- **One conversation per request:** send the whole recording in one request. Timestamps and speaker labels then cover the whole recording. Do not split a conversation, because labels are consistent only within one response.

**If you use `transcribe-1`:** it is designed for short recordings; for recordings longer than a few minutes, use `transcribe-1-pro`. It accepts up to 50 MiB per request; keep MP3 and Opus files under 25 MiB. A request that exceeds the size limit returns 413 or 400. A long request can fail with 503 if it exceeds the processing-time limit. Retry, and if it keeps failing, use `transcribe-1-pro` or split the audio.
Expand All @@ -201,17 +202,17 @@
### Processing time and timeouts

- Processing time grows with the length of the recording. Long `transcribe-1-pro` recordings can take several minutes.
- Set your HTTP client's timeout accordingly. The official SDKs' default timeout can be too short for long recordings, and many HTTP libraries default to even less (httpx defaults to 5 seconds). For long recordings, use a generous timeout, for example 15 minutes: `httpx.Timeout(900.0, connect=10.0)` with httpx, `RequestOptions(timeout=900)` with the Python SDK, or `{ timeoutInSeconds: 900 }` with the JavaScript SDK.

Check warning on line 205 in api-reference/endpoint/openapi-v1/speech-to-text.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'httpx'?

Check warning on line 205 in api-reference/endpoint/openapi-v1/speech-to-text.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'httpx'?
- In Node.js, the built-in `fetch`, which the JavaScript SDK uses, also stops waiting for a response after 5 minutes, even if you set a longer timeout. To wait longer, call `setGlobalDispatcher(new Agent({ headersTimeout: 900_000, bodyTimeout: 900_000 }))` from the `undici` package once at startup. See [Processing time and timeouts](/features/speech-to-text#processing-time-and-timeouts).
- If a long request fails with a 5xx error or the connection drops, retry it.
- Each request holds one of your account's [concurrent request slots](/developer-guide/models-pricing/pricing-and-rate-limits#concurrent-request-limits) until its response is returned.

## Supported audio formats

- `transcribe-1-pro` accepts WAV, MP3, AAC (including M4A/MP4), FLAC, Ogg (Opus or Vorbis), WebM/Matroska, and MOV, including browser recordings. For a video file, it uses the first audio track. Send the original file bytes; no conversion is needed.

Check warning on line 212 in api-reference/endpoint/openapi-v1/speech-to-text.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'Ogg'?

Check warning on line 212 in api-reference/endpoint/openapi-v1/speech-to-text.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'Vorbis'?
- Not supported: AIFF, CAF, WMA, AMR, AC-3, and raw (headerless) PCM. These return 400.

Check warning on line 213 in api-reference/endpoint/openapi-v1/speech-to-text.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'headerless'?

**If you use `transcribe-1`:** it accepts WAV, MP3, AAC (including M4A/MP4), FLAC, and Ogg (Opus or Vorbis). Browser WebM recordings (for example, from `MediaRecorder`) may not be accepted; convert them to Ogg/Opus, MP3, or WAV first.

Check warning on line 215 in api-reference/endpoint/openapi-v1/speech-to-text.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'Ogg'?

Check warning on line 215 in api-reference/endpoint/openapi-v1/speech-to-text.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'Vorbis'?

## Errors

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ if (failed.length > 0) {

</CodeGroup>

Each call returns an [`ASRResponse`](/api-reference/sdk/python/types#asrresponse-objects) with `.text` and `.duration` (seconds). With `transcribe-1-pro`, `text` can contain inline speaker markers such as `<|speaker:0|>` and cues such as `[laughter]`; see [Speaker markers](/features/speech-to-text#speaker-markers) to split it into turns. This recipe skips timestamps; pass `include_timestamps=True` (Python) or `ignore_timestamps: false` (JavaScript) for word-level `.segments`. The Python SDK currently returns only `text`, `duration`, and `segments`; to read `language_code`, call the API directly (see [Direct API](/features/speech-to-text#direct-api-messagepack)).
Each call returns an [`ASRResponse`](/api-reference/sdk/python/types#asrresponse-objects) with `.text` and `.duration` (seconds). With `transcribe-1-pro`, `text` can contain inline speaker markers such as `<|speaker:0|>` and cues such as `[laughter]`; see [Speaker markers](/features/speech-to-text#speaker-markers) to split it into turns. This recipe skips timestamps; pass `include_timestamps=True` (Python) or `ignore_timestamps: false` (JavaScript) for word-level `.segments`. In Python, `.language_code` holds the detected language, or your hint when the language cannot be determined (`fish-audio-sdk` 1.4.0 or later).

A file that fails is recorded with its error, and the loop continues. After the summary, the script exits with a non-zero status if any file failed, so a scheduled job does not report success. A file that failed with 429, a 5xx status, or a network error such as a timeout is worth retrying later with backoff; for other 4xx errors, fix the file or the request first.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<Prerequisites />

The SDKs do not wrap the realtime speech-to-text endpoint yet, so this recipe speaks the WebSocket protocol directly. Install a WebSocket client and a MessagePack library:
This recipe speaks the WebSocket protocol directly, so it needs no SDK. The Python SDK (`fish-audio-sdk` 1.5.0 or later) also wraps this endpoint as `client.asr.stream_websocket()`, and the JavaScript SDK (`fish-audio` 0.2.0 or later, Node.js only) as [`client.speechToText.convertRealtime()`](/api-reference/sdk/javascript/api-reference#speech-to-text). Install a WebSocket client and a MessagePack library:

<CodeGroup>

Expand Down Expand Up @@ -236,7 +236,7 @@

</CodeGroup>

The audio goes in `data` as the raw PCM bytes, which must travel as MessagePack `bin`, not as base64 text: msgpack for Python packs `bytes` as `bin` by default (do not set `use_bin_type=False`), and `@msgpack/msgpack` packs a `Buffer` or `Uint8Array` as `bin`.

Check warning on line 239 in developer-guide/sdk-guide/cookbook/realtime-transcription.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'msgpack'?

The server closes a session after 30 seconds without any client message, but a WebSocket ping counts as one, and Python's `websockets` sends a ping every 20 seconds by default, so the session stays open even if your audio stops; see [Capture audio well](/developer-guide/sdk-guide/cookbook/realtime-voice-agent#capture-audio-well) for a live source that can stall.

Expand Down Expand Up @@ -493,7 +493,7 @@

Install `aiohttp`, put both files in one folder, run `python relay.py`, and open `http://localhost:8080`.

- The page captures audio at the device's own sample rate and sends that rate in `config`; the server converts it, so the page does not resample. The rate must be one of the supported rates.

Check warning on line 496 in developer-guide/sdk-guide/cookbook/realtime-transcription.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'resample'?
- An `AudioWorklet` converts the samples to 16-bit PCM and posts 40 ms per message.
- **Stop** sends `audio_done`, so the server commits the last turn before it closes the connection.
- The relay forwards the API's close code to the page. In production, add your own user authentication, per-user session limits and input checks to the relay.
Expand Down
4 changes: 2 additions & 2 deletions developer-guide/sdk-guide/cookbook/transcribe-to-captions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ Both tabs send the same request and write the same `captions.srt` and `captions.
`speaker_turns`, with each turn's punctuated text and its start and end time.
To keep speakers in separate cues, start a new cue at each turn boundary. In
JavaScript, read `result.speaker_turns`; it is not in the SDK's TypeScript
type. The Python SDK does not return `speaker_turns`; to read it from the API,
see [Speaker turns](/features/speech-to-text#speaker-turns).
type. In Python, read `result.speaker_turns` (`fish-audio-sdk` 1.4.0 or
later). See [Speaker turns](/features/speech-to-text#speaker-turns).
</Tip>

## Related
Expand Down
18 changes: 10 additions & 8 deletions features/speech-to-text.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,15 @@

The response contains `text`, `duration` (seconds), `segments`, and `request_id`, plus [`speaker_turns`](#speaker-turns) when timestamps are requested, and `language_code` and `language` when the language is known. Do not depend on the order of keys in the JSON. If you use `transcribe-1`, rely on `text`, `duration`, `segments`, and the language fields.

The Python SDK currently returns only `text`, `duration`, and `segments`. To read the other fields, call the API directly (see [Direct API](#direct-api-messagepack)).
The Python SDK returns these fields on the result, for example `result.request_id` and `result.language_code` (`fish-audio-sdk` 1.4.0 or later; earlier versions keep only `text`, `duration`, and `segments`).

<Note>
The Python SDK selects Pro through `RequestOptions.additional_headers`;
`asr.transcribe()` has no `model` argument, and it cannot send the
`transcribe-1-pro` fields such as `diarize`. The JavaScript example calls the
REST API directly so the header is explicit. For multipart uploads, let your
In the Python SDK, `model="transcribe-1-pro"` sends the `model` header. The
argument requires `fish-audio-sdk` 1.5.0 or later; on earlier versions, pass
`request_options=RequestOptions(additional_headers={"model": "transcribe-1-pro"})`
instead. `asr.transcribe()` cannot send the `transcribe-1-pro` fields such as
`diarize`. The JavaScript example calls the REST API directly so the header is
explicit. For multipart uploads, let your
HTTP client set `Content-Type` and its boundary.
</Note>

Expand Down Expand Up @@ -366,7 +368,7 @@
- `language_code`: the two-letter ISO 639-1 code, such as `en`. Use it in application logic.
- `language`: the language's English name, such as `English` or `Chinese`. Use it for display.

If the language cannot be determined (for example, very short audio), `language_code` reports your hint, which is not checked against the audio, and `language` may be absent. Responses report one language: for recordings that switch languages, `language` and `language_code` do not list every language spoken. The Python SDK does not return these fields; call the API directly to read them.
If the language cannot be determined (for example, very short audio), `language_code` reports your hint, which is not checked against the audio, and `language` may be absent. Responses report one language: for recordings that switch languages, `language` and `language_code` do not list every language spoken. The Python SDK returns them as `result.language` and `result.language_code` (`fish-audio-sdk` 1.4.0 or later).

<CodeGroup>

Expand Down Expand Up @@ -396,20 +398,20 @@

### Input audio

`transcribe-1-pro` accepts WAV, MP3, AAC (including M4A/MP4), FLAC, Ogg (Opus or Vorbis), WebM/Matroska, and MOV, including browser recordings, and uses the first audio track of a video file. Send the original file bytes; no conversion is needed.

Check warning on line 401 in features/speech-to-text.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'Ogg'?

Check warning on line 401 in features/speech-to-text.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'Vorbis'?

Not supported: AIFF, CAF, WMA, AMR, AC-3, and raw (headerless) PCM. These return 400.

Check warning on line 403 in features/speech-to-text.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'headerless'?

Send audio as `multipart/form-data` (a file upload, shown above) or `application/msgpack` (see [Direct API](#direct-api-messagepack)). Base64-encoded audio in a JSON body is not supported.

If you use `transcribe-1`, send WAV, MP3, AAC (including M4A/MP4), FLAC, or Ogg (Opus or Vorbis), and convert WebM recordings (for example, from a browser's MediaRecorder) to Ogg/Opus, MP3, or WAV first, or use `transcribe-1-pro`.

Check warning on line 407 in features/speech-to-text.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'Ogg'?

Check warning on line 407 in features/speech-to-text.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'Vorbis'?

### Limits

These limits apply to `transcribe-1-pro`:

- Recordings up to 60 minutes long. Longer audio returns 400 `audio_too_long`.
- For long recordings, send compressed audio such as MP3, Opus, or AAC. An hour of 128 kbps MP3 is about 55 MiB. A request that is too large returns 413.

Check warning on line 414 in features/speech-to-text.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'kbps'?
- Very short clips (under about 0.08 seconds) return 400 `audio_too_short`.

If you use `transcribe-1`, send up to 50 MiB per request and keep MP3 and Opus files under 25 MiB; a request that exceeds the size limit returns 413 or 400. `transcribe-1` is designed for short recordings; for recordings longer than a few minutes, use `transcribe-1-pro`. A long request can fail with 503 if it exceeds the processing-time limit. Retry, and if it keeps failing, use `transcribe-1-pro` or split the audio.
Expand All @@ -427,7 +429,7 @@
Set your HTTP client's timeout accordingly. The official SDKs' default timeout can be too short for long recordings, and many HTTP libraries default to even less. To wait up to 15 minutes, as several examples on this page do:

- Python SDK: `RequestOptions(timeout=900)` for one request, or `FishAudio(timeout=900)` for the client.
- httpx: `timeout=httpx.Timeout(900.0, connect=10.0)`. Without it, httpx waits only 5 seconds.

Check warning on line 432 in features/speech-to-text.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'httpx'?

Check warning on line 432 in features/speech-to-text.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'httpx'?
- Node.js: the built-in `fetch` stops waiting for a response after 5 minutes, even if you pass a longer `AbortSignal`. For longer requests, use `fetch` from the `undici` package with a dispatcher that waits longer. `undici` 7 runs on Node.js 20.18.1 and later; `undici` 8 requires Node.js 22.19 or later.

```javascript
Expand Down Expand Up @@ -464,7 +466,7 @@

### Request IDs

`transcribe-1-pro` returns a unique `request_id` in the response body, both on success and on its own errors, and the same value in the `x-request-id` response header. Platform and network-edge errors do not carry it. Log it, and include it when you contact support. The Python SDK does not return it on success; read it with a [direct API call](#direct-api-messagepack), or from the error body as shown in [Errors](#errors).
`transcribe-1-pro` returns a unique `request_id` in the response body, both on success and on its own errors, and the same value in the `x-request-id` response header. Platform and network-edge errors do not carry it. Log it, and include it when you contact support. The Python SDK returns it as `result.request_id` (`fish-audio-sdk` 1.4.0 or later); on an error, read it from the error body as shown in [Errors](#errors).

### Errors

Expand Down Expand Up @@ -558,7 +560,7 @@

### Direct API (MessagePack)

`POST /v1/asr` also accepts a [MessagePack](https://msgpack.org) body instead of multipart form data, the same path the API reference links to for low-overhead, server-side calls. Calling the API directly also gives you the response fields the Python SDK does not return. Pack the audio bytes and options into one payload and set `Content-Type: application/msgpack`:
`POST /v1/asr` also accepts a [MessagePack](https://msgpack.org) body instead of multipart form data, the same path the API reference links to for low-overhead, server-side calls. Calling the API directly also lets you send the request fields the Python SDK cannot, such as `diarize`. Pack the audio bytes and options into one payload and set `Content-Type: application/msgpack`:

```python
import os
Expand Down
2 changes: 1 addition & 1 deletion features/speech-to-text/realtime.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Realtime Speech to Text"
sidebarTitle: "Realtime"
description: "Transcribe live audio turn by turn with transcribe-stream-1: turn detection that knows when the user has finished, backchannel and background awareness, and conversation context"

Check warning on line 4 in features/speech-to-text/realtime.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'backchannel'?
icon: "microphone-lines"
tag: "Preview"
---
Expand Down Expand Up @@ -30,7 +30,7 @@
icon="headset"
href="/developer-guide/sdk-guide/cookbook/realtime-voice-agent"
>
Turn-taking, interruptions and backchannels.

Check warning on line 33 in features/speech-to-text/realtime.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'backchannels'?
</Card>
</CardGroup>

Expand Down Expand Up @@ -76,7 +76,7 @@

## Quick start

The SDKs do not wrap this endpoint; you connect with any WebSocket client and exchange MessagePack messages.
The steps below use the protocol directly: you connect with any WebSocket client and exchange MessagePack messages. The Python SDK (`fish-audio-sdk` 1.5.0 or later) wraps this endpoint as `client.asr.stream_websocket()`, and the JavaScript SDK (`fish-audio` 0.2.0 or later, Node.js only) as [`client.speechToText.convertRealtime()`](/api-reference/sdk/javascript/api-reference#speech-to-text).

<Steps>
<Step title="Connect">
Expand Down Expand Up @@ -143,7 +143,7 @@

With `turn_detection.eager: true`, you receive `eager_end_of_turn` as soon as the turn has probably ended, before the final transcript. Its text is exactly the text `committed` will have, unless `turn_resumed` follows because the user went on. A voice agent can start its LLM on the eager text and save that time.

### Backchannel detection

Check warning on line 146 in features/speech-to-text/realtime.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'Backchannel'?

Tell the server when your agent is speaking with `agent_speaking`. While it speaks, a short "mm-hm", "yeah", "right" or "uh-huh" from the user produces `user_backchannel`: the agent keeps talking. A real interruption produces `user_turn_taken`: the agent stops.

Expand All @@ -169,14 +169,14 @@
| Mode | A turn ends when | Use it for |
| ---------------- | ------------------------------------------------------------------ | -------------------------------------- |
| `auto` (default) | Turn detection judges that the user has finished. | Voice agents and conversations. |
| `vad` | A fixed silence has passed (`silence_timeout_ms`, default 700 ms). | Simple silence-based endpointing. |

Check warning on line 172 in features/speech-to-text/realtime.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'endpointing'?
| `manual` | You send `finalize`. | Push-to-talk, or your own endpointing. |

Check warning on line 173 in features/speech-to-text/realtime.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'endpointing'?

Eager end of turn, backchannel detection and background awareness are available in `auto` mode, when the session starts in `auto` (the default). In `vad` and `manual` mode, and after a later switch to `auto` from another mode, every turn is a user turn. See [Turn detection modes](/api-reference/endpoint/websocket/asr-realtime#turn-detection-modes) for details.

Check warning on line 175 in features/speech-to-text/realtime.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'backchannel'?

## Languages

Smart Turn Detection, including eager end of turn, backchannel detection and background awareness, works on speech in every language. In some languages, a turn can end a little later after the speaker stops.

Check warning on line 179 in features/speech-to-text/realtime.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'backchannel'?

`draft`, `eager_end_of_turn` and `committed` carry the language of their own text as `language_code` when it can be identified, one of 29 [supported codes](/api-reference/endpoint/websocket/asr-realtime#language).

Expand All @@ -194,7 +194,7 @@

### Audio

Send 16-bit little-endian PCM, mono, at 8000, 12000, 16000, 22050, 24000, 32000, 44100 or 48000 Hz. The server converts the sample rate, so you never need to resample. Compressed formats such as Opus or MP3 are not accepted on this endpoint.

Check warning on line 197 in features/speech-to-text/realtime.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'resample'?

### Speakers

Expand All @@ -220,7 +220,7 @@
icon="headset"
href="/developer-guide/sdk-guide/cookbook/realtime-voice-agent"
>
The agent loop: eager replies, interruptions and backchannels.

Check warning on line 223 in features/speech-to-text/realtime.mdx

View check run for this annotation

Mintlify / Mintlify Validation (hanabiaiinc) - vale-spellcheck

Vale.Spelling

Did you really mean 'backchannels'?
</Card>
<Card
title="Stream speech back"
Expand Down
Loading