diff --git a/.mintlify/skills/fish-audio-api/SKILL.md b/.mintlify/skills/fish-audio-api/SKILL.md index abae43bf..697e742e 100644 --- a/.mintlify/skills/fish-audio-api/SKILL.md +++ b/.mintlify/skills/fish-audio-api/SKILL.md @@ -20,7 +20,7 @@ This file condenses those into rules an agent can apply directly. - Optional distributed tracing for inference APIs: see `https://docs.fish.audio/api-reference/observability`. - Get API keys: `https://fish.audio/app/api-keys` - Never hardcode keys. Read from an env var like `FISH_API_KEY`. -- Errors are JSON with at least `{status, message}` (for example 401 / 402 / 404 / 429). Speech-to-text errors from `transcribe-1-pro` also carry `code` and `request_id`. Errors from the network edge in front of the API (some 413 and 5xx responses) may not be JSON. `422` validation errors, on the endpoints that return them, are an array of `{loc, type, msg, ctx, in}`. +- Errors are JSON with at least `{status, message}` (for example 401 / 402 / 404 / 429). Speech-to-text errors from `transcribe-1-pro` and `transcribe-2-pro` also carry `code` and `request_id`. Errors from the network edge in front of the API (some 413 and 5xx responses) may not be JSON. `422` validation errors, on the endpoints that return them, are an array of `{loc, type, msg, ctx, in}`. ## Endpoint map @@ -202,29 +202,33 @@ await pipeline(Readable.fromWeb(res.body), createWriteStream("out.mp3")); Synchronous: one audio file per request, and the JSON response arrives when the whole file has been transcribed. -Use `transcribe-1-pro`, the recommended model, and select it with the `model` header on every request. This section describes `transcribe-1-pro`; for the differences on `transcribe-1`, see "If you use `transcribe-1`" at the end of this section. +Use `transcribe-1-pro`, the recommended model, and select it with the `model` header on every request. This section describes `transcribe-1-pro`. `transcribe-2-pro` takes the same fields and returns the same response format, and adds `text_format`, `verbatim`, and `keyterms`; see "If you use `transcribe-2-pro`". For the differences on `transcribe-1`, see "If you use `transcribe-1`" at the end of this section. -Guide: `https://docs.fish.audio/features/speech-to-text`. The `/v1/asr` entry in `openapi.json` currently does not list the `transcribe-1-pro` fields, `request_id`, `speaker_turns`, or the error `code`; where it is less complete or disagrees, follow this section. +Guide: `https://docs.fish.audio/features/speech-to-text`. The `/v1/asr` entry in `openapi.json` currently does not list the Pro model fields, `request_id`, `speaker_turns`, or the error `code`; where it is less complete or disagrees, follow this section. Headers: - `Authorization: Bearer ` (required). - `model: transcribe-1-pro` (recommended): recordings up to 60 minutes, including multi-speaker conversations, with speaker markers, `speaker_turns`, and emotion and vocal-event cues. Write the value exactly, in lowercase. The header is optional, but a missing or unrecognized value (for example `Transcribe-1-Pro` or `transcribe-1pro`) is served and billed as `transcribe-1`, and no error is returned; if you expected Pro but `text` has no speaker markers and you did not send `diarize=false`, check the header. `model` is a header only; a `model` form field is ignored. +- `model: transcribe-2-pro`: the same kinds of recordings and the same response format as `transcribe-1-pro`, plus `text_format`, `verbatim`, and `keyterms`, and the `language` hint is passed to the model. Write it exactly too: a misspelled value such as `transcribe-2` or `transcribe-2pro` is served and billed as `transcribe-1`, and `text_format`, `verbatim`, and `keyterms` are then ignored. - Body encoding: `multipart/form-data` (let the HTTP client set `Content-Type` and the boundary) or `Content-Type: application/msgpack`. Base64-encoded audio in a JSON body is not supported. Request fields (the same names in multipart and MessagePack): -| Field | Default | Notes | -| ------------------------------ | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `audio` | — (required) | Exactly one audio file: a multipart file part, or MessagePack `bin`. The format is read from the bytes, not the file name. | -| `language` | unset | Optional hint, a lowercase ISO 639-1 code such as `en`, `zh`, or `ja`. Detection still runs, and the hint does not force the transcript language. Other forms, such as `en-US` or `English`, may be rejected with 400. | -| `ignore_timestamps` | `true` | `false` returns word-level `segments` and, unless `diarize=false`, `speaker_turns`; it adds processing time. Multipart: any value other than `true` (case-insensitive), including `1` or an empty value, means `false`. MessagePack: a boolean. | -| `tag_audio_events` | `true` | `false` removes bracketed cues such as `[laughter]` or `[高兴]` from `text` and `speaker_turns`. Timestamps, `duration`, and billing do not change. | -| `diarize` | `auto` | `auto` or `true`: return `speaker_turns` when timestamps are requested. `false`: omit `speaker_turns` and the speaker markers in `text`; the rest of the transcript does not change. | -| `num_speakers` | unset | Expected number of speakers, an integer ≥ 1. A best-effort hint that may have no effect on short recordings. Cannot be combined with `min_speakers` or `max_speakers`. | -| `min_speakers`, `max_speakers` | unset | Bounds on the number of speakers, integers ≥ 1, with `min_speakers` ≤ `max_speakers`. Same best-effort rule. | - -Multipart values: `tag_audio_events` is `true` or `false` and `diarize` is `auto`, `true`, or `false` (both case-insensitive); speaker counts are digits. MessagePack values: `tag_audio_events` is a boolean, `diarize` is a boolean or `"auto"`/`"true"`/`"false"`, and speaker counts are integers. An invalid value, `tag_audio_events`, `diarize`, or a speaker count sent twice in a multipart form, or a speaker count with `diarize=false` returns 400 `invalid_parameter`. +| Field | Default | Notes | +| ------------------------------ | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `audio` | — (required) | Exactly one audio file: a multipart file part, or MessagePack `bin`. The format is read from the bytes, not the file name. | +| `language` | unset | Optional hint, a lowercase ISO 639-1 code such as `en`, `zh`, or `ja`. Detection still runs, and the hint does not force the transcript language. | +| `ignore_timestamps` | `true` | `false` returns word-level `segments` and, unless `diarize=false`, `speaker_turns`; it adds processing time. Multipart: any value other than `true` (case-insensitive), including `1` or an empty value, means `false`. MessagePack: a boolean. | +| `tag_audio_events` | `true` | `false` removes bracketed cues such as `[laughter]` or `[高兴]` from `text` and `speaker_turns`. Timestamps, `duration`, and billing do not change. | +| `diarize` | `auto` | `auto` or `true`: return `speaker_turns` when timestamps are requested. `false`: omit `speaker_turns` and the speaker markers in `text`; the rest of the transcript does not change. | +| `num_speakers` | unset | Expected number of speakers, an integer ≥ 1. A best-effort hint that may have no effect on short recordings. Cannot be combined with `min_speakers` or `max_speakers`. | +| `min_speakers`, `max_speakers` | unset | Bounds on the number of speakers, integers ≥ 1, with `min_speakers` ≤ `max_speakers`. Same best-effort rule. | +| `text_format` | `written` | `transcribe-2-pro` only. `written`: numbers, dates, times, and amounts in digits and symbols (`3:30`, `20%`). `spoken`: in words, as said (`twenty-five dollars`). | +| `verbatim` | `true` | `transcribe-2-pro` only. `true` keeps filler words, stutters, repetitions, and false starts. `false` leaves out filler sounds, stutters, accidental repetitions, and short false starts; it only removes words, never rewords, and keeps meaningful words and short replies such as `Mm-hmm`. | +| `keyterms` | unset | `transcribe-2-pro` only. Up to 128 words or short phrases for the transcript to spell as listed. Multipart: repeat the field once per term. MessagePack: an array of strings. Rules under "If you use `transcribe-2-pro`". | + +Multipart values: `tag_audio_events` and `verbatim` are `true` or `false`, `diarize` is `auto`, `true`, or `false`, and `text_format` is `written` or `spoken` (all case-insensitive); speaker counts are digits. MessagePack values: `tag_audio_events` and `verbatim` are booleans, `diarize` is a boolean or `"auto"`/`"true"`/`"false"`, `text_format` is `"written"` or `"spoken"`, speaker counts are integers, and `keyterms` is an array of strings. An invalid value, any of these fields except `keyterms` sent twice in a multipart form, or a speaker count with `diarize=false` returns 400 `invalid_parameter`. `transcribe-1-pro` ignores `text_format`, `verbatim`, and `keyterms`. Limits and formats: @@ -353,12 +357,23 @@ for (const turn of result.speaker_turns ?? []) { MessagePack instead of multipart: send `msgpack.packb({"audio": audio_bytes, "ignore_timestamps": False}, use_bin_type=True)` with `Content-Type: application/msgpack` and the same `model: transcribe-1-pro` header; values are typed (booleans, integers), and `audio` must be raw bytes (`bin`). +### If you use `transcribe-2-pro` + +Send `model: transcribe-2-pro`. Everything above applies, including the response, limits, formats, and errors, with these additions: + +- `text_format`, `verbatim`, and `keyterms` (see the fields table) apply to the whole recording and do not change the price. +- `verbatim=false`: the model decides what counts as a filler or a false start, so it can occasionally leave one in or remove a short word that was meant. +- `text_format=spoken` is not always followed when `keyterms` is also sent: numbers can come back in digits. For spoken numbers, send no key terms. +- `keyterms` rules, each a 400 `invalid_parameter` whose `message` names the rule and the term's index (`keyterms[3]`, from 0), never the term: at most 128 terms, repeats counted; each term at most 50 characters and 8 space-separated words after trimming and collapsing whitespace, and not empty; no ASCII comma, none of `\ < > [ ] { }`, no control or invisible formatting characters (tabs, line breaks; U+200C and U+200D are accepted); not starting with `style:`, `format:`, `verbatim:`, `tags:`, `language hint:`, or `glossary:` in any case; a repeated term is used once, but two that differ only in case or width are refused; all the terms together must fit in 1024 tokens: long Chinese or Japanese terms reach that well before 128 terms (at about 32 to 37 terms of 32 characters each), and the refusal then says the terms are too long in total for the 1024-token limit, with the token count; send fewer or shorter terms. List only terms likely to be spoken: an unsaid term can occasionally appear in the transcript. Key terms have been tested on short Chinese, Japanese, and English clips. +- In curl, send each term with `--form-string "keyterms=..."` so a term starting with `@` is not read as a file. +- `language`: the hint is passed to the model and guides the transcription; send it when you know the language. It can be an ISO 639-1 or 639-3 code, an English name, or a locale such as `pt-BR`, in any case. An unrecognized hint (for example `auto`) is ignored, never an error. A recognized hint is reported as the response's `language` and `language_code` (`pt` for `pt-BR`) when the transcript agrees with it (no language detected, the hint's language detected, or, for a language detection cannot identify, the transcript mostly in that language's script); otherwise the detected language is reported (Chinese speech sent `ja` returns `Chinese` / `zh`). A wrong hint can still change the transcript, and one in the same script as the speech is not always caught (English sent `az` can return `Azerbaijani`), so send the language actually spoken. For `bs`, `hr`, and `sr`, `language` is `Bosnian/Croatian/Serbian` and `language_code` is the code sent. + ### If you use `transcribe-1` `transcribe-1` is for general transcription of short recordings, and it serves every request whose `model` header is missing or not an exact match. It differs from `transcribe-1-pro` as follows: -- Fields: send only `audio`, `language`, and `ignore_timestamps`. The other fields apply to `transcribe-1-pro`; send them only with `model: transcribe-1-pro`. -- Response: `text`, `duration`, `segments`, and, when the language is known, `language` and `language_code`. Speaker markers, `speaker_turns`, and `request_id` are `transcribe-1-pro` features. +- Fields: send only `audio`, `language`, and `ignore_timestamps`. The other fields apply to the Pro models; send them only with `model: transcribe-1-pro` or `model: transcribe-2-pro`. +- Response: `text`, `duration`, `segments`, and, when the language is known, `language` and `language_code`. Speaker markers, `speaker_turns`, and `request_id` are Pro model features. - Errors: rely only on `status` and `message`. - Limits: up to 50 MiB per request; keep MP3 and Opus files under 25 MiB. A request over the size limit returns 413 or 400. For recordings longer than a few minutes, use `transcribe-1-pro`. A long request can fail with 503 when it exceeds the processing-time limit; retry, and if it keeps failing, use `transcribe-1-pro` or split the audio. - Formats: WAV, MP3, AAC (including M4A/MP4), FLAC, and Ogg (Opus or Vorbis). Convert WebM recordings (for example, from a browser's MediaRecorder) to Ogg/Opus, MP3, or WAV first, or use `transcribe-1-pro`. @@ -629,7 +644,7 @@ S2-Pro and the S2.1-Pro models use free-form `[bracket]` natural-language tags i - Numeric param out of range (`temperature`, `top_p`, `chunk_length`, `min_chunk_length`, `prosody.speed`, `early_stop_threshold`). - `mp3_bitrate` / `opus_bitrate` set without matching `format`. - WebSocket: a `finish` event with `reason: "error"` means the server failed mid-stream. Surface the message and reconnect rather than retrying on the same socket. -- `POST /v1/asr` (`transcribe-1-pro`): branch on the HTTP status and on `code`, never on `message`. New `code` values may be added; handle unknown codes by HTTP status. With `transcribe-1`, rely only on `status` and `message`. +- `POST /v1/asr` (`transcribe-1-pro`, `transcribe-2-pro`): branch on the HTTP status and on `code`, never on `message`. New `code` values may be added; handle unknown codes by HTTP status. With `transcribe-1`, rely only on `status` and `message`. - 400 → fix the request; do not retry. Codes: `invalid_request` (unreadable body, missing or repeated `audio`), `invalid_parameter` (bad or conflicting field values), `invalid_audio` (undecodable or unsupported format), `audio_too_long` (over 60 minutes), `audio_too_short` (under about 0.08 s). - 413 → request too large (`request_too_large`). It may come from the network edge without a JSON body. Send compressed audio. - 415 → unsupported `Content-Type` (`unsupported_media_type`). Use `multipart/form-data` or `application/msgpack`. diff --git a/.mintlify/skills/fish-audio-sdk/SKILL.md b/.mintlify/skills/fish-audio-sdk/SKILL.md index 957a8ffe..6b6f2918 100644 --- a/.mintlify/skills/fish-audio-sdk/SKILL.md +++ b/.mintlify/skills/fish-audio-sdk/SKILL.md @@ -20,6 +20,7 @@ If the user wants raw `curl` / HTTP / WebSocket without installing an SDK, use t - **Base URL:** `https://api.fish.audio` (override with `base_url=` in Python / `baseUrl:` in JS). - **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). +- **`transcribe-2-pro`:** another ASR model, selected the same way as `transcribe-1-pro` with the header value `transcribe-2-pro`. It returns the same response format; its `text_format`, `verbatim`, and `keyterms` fields need raw HTTP (see the `fish-audio-api` skill). - **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). diff --git a/.mintlify/skills/fish-audio-sdk/references/speech-to-text.md b/.mintlify/skills/fish-audio-sdk/references/speech-to-text.md index 5c7eb35a..4535fe73 100644 --- a/.mintlify/skills/fish-audio-sdk/references/speech-to-text.md +++ b/.mintlify/skills/fish-audio-sdk/references/speech-to-text.md @@ -5,13 +5,14 @@ Both SDKs wrap `POST /v1/asr`: one audio file per request, and the response arri ## Choose a model - `transcribe-1-pro` (recommended): recordings up to 60 minutes, including multi-speaker conversations. `text` contains inline `<|speaker:N|>` markers and bracketed emotion or vocal-event cues such as `[laughter]` or `[高兴]`, and the API returns structured `speaker_turns` when you request timestamps. +- `transcribe-2-pro`: the same kinds of recordings and the same response format as `transcribe-1-pro`, plus the request fields `text_format` (written or spoken numbers), `verbatim`, and `keyterms`, and the `language` hint is passed to the model. Neither SDK can send those three fields; call the API directly (see the `fish-audio-api` skill). - `transcribe-1`: general transcription of short recordings. It serves every request whose `model` header is missing or not an exact match. -Select `transcribe-1-pro` with the `model` header: +Select `transcribe-1-pro` with the `model` header (select `transcribe-2-pro` the same way): - Python: `request_options=RequestOptions(additional_headers={"model": "transcribe-1-pro"})`, with `from fishaudio.core import RequestOptions`. - JavaScript: pass `model: "transcribe-1-pro"` in the `convert` request (`fish-audio` 0.2.0+; on 0.1.0, pass `{ headers: { model: "transcribe-1-pro" } }` as the second argument). -- Write the value exactly, in lowercase. A missing or unrecognized value (for example `Transcribe-1-Pro` or `transcribe-1pro`) is served and billed as `transcribe-1`, and no error is returned. If you expected `transcribe-1-pro` but the transcript has no speaker markers and you did not send `diarize=false`, check the header. +- Write the value exactly, in lowercase. A missing or unrecognized value (for example `Transcribe-1-Pro`, `transcribe-1pro`, or `transcribe-2`) is served and billed as `transcribe-1`, and no error is returned. If you expected a Pro model but the transcript has no speaker markers and you did not send `diarize=false`, check the header. ## Python: `client.asr.transcribe` @@ -39,12 +40,12 @@ for seg in result.segments: Keyword params: -| Param | Type | Default | Notes | -| -------------------- | ------------------------ | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `audio` | `bytes` | — (required) | Raw file bytes; the format is detected from the content. The SDK sends them as MessagePack. | -| `language` | `str` | auto-detect | Optional hint, a lowercase ISO 639-1 code (`"en"`, `"zh"`, `"ja"`). Detection still runs, and the hint does not force the transcript language. `"en-US"` or `"English"` may be rejected with 400. | -| `include_timestamps` | `bool` | `True` | `True` (default) requests word-level timestamps, which adds processing time; pass `False` when you only need text (`segments` is then empty). | -| `request_options` | `RequestOptions \| None` | `None` | Per-request `timeout` and headers. Select the model here: `RequestOptions(additional_headers={"model": "transcribe-1-pro"})`. | +| Param | Type | Default | Notes | +| -------------------- | ------------------------ | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- | +| `audio` | `bytes` | — (required) | Raw file bytes; the format is detected from the content. The SDK sends them as MessagePack. | +| `language` | `str` | auto-detect | Optional hint, a lowercase ISO 639-1 code (`"en"`, `"zh"`, `"ja"`). Detection still runs, and the hint does not force the transcript language. | +| `include_timestamps` | `bool` | `True` | `True` (default) requests word-level timestamps, which adds processing time; pass `False` when you only need text (`segments` is then empty). | +| `request_options` | `RequestOptions \| None` | `None` | Per-request `timeout` and headers. Select the model here: `RequestOptions(additional_headers={"model": "transcribe-1-pro"})`. | ### Response shape (`ASRResponse`) @@ -70,7 +71,7 @@ Segment text has no punctuation, speaker markers, or cues, and can be normalized - `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()` 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 Pro model fields `tag_audio_events`, `diarize`, `num_speakers`, `min_speakers`, or `max_speakers`, or the `transcribe-2-pro` fields `text_format`, `verbatim`, or `keyterms`. For any of these, call the API directly. Field semantics are in the `fish-audio-api` skill (`POST /v1/asr`). ```python import os diff --git a/api-reference/endpoint/openapi-v1/speech-to-text.mdx b/api-reference/endpoint/openapi-v1/speech-to-text.mdx index 1d687a25..40237104 100644 --- a/api-reference/endpoint/openapi-v1/speech-to-text.mdx +++ b/api-reference/endpoint/openapi-v1/speech-to-text.mdx @@ -1,11 +1,13 @@ --- openapi: post /v1/asr title: "Speech to Text" -description: "Transcribe audio with transcribe-1-pro, the recommended speech-to-text model: request and response fields, speaker turns, limits, formats, and errors" +description: "Transcribe audio with transcribe-1-pro, the recommended speech-to-text model, or transcribe-2-pro: request and response fields, speaker turns, text format, verbatim, key terms, limits, formats, and errors" icon: "microphone" iconType: "solid" --- +{/* TODO(owner): decide which model the docs label "recommended". Every page that names the ASR models still recommends transcribe-1-pro; transcribe-2-pro is listed beside it without a label. */} + This BETA endpoint transcribes one audio file per request. Send the audio as `multipart/form-data` (a file upload) or `application/msgpack`. Base64-encoded @@ -16,12 +18,13 @@ iconType: "solid" Send `POST https://api.fish.audio/v1/asr` with `Authorization: Bearer ` and a **`model` HTTP header** that selects the model. The request is synchronous: the response arrives when the whole file has been transcribed. -| Header value | Use it for | -| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `transcribe-1-pro` | Recommended. Recordings up to 60 minutes, including multi-speaker conversations: speaker markers and speaker turns, with emotion and vocal-event cues preserved. | -| `transcribe-1` | General transcription of short recordings. Used when the `model` header is missing or not an exact match. | +| Header value | Use it for | +| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `transcribe-1-pro` | Recommended. Recordings up to 60 minutes, including multi-speaker conversations: speaker markers and speaker turns, with emotion and vocal-event cues preserved. | +| `transcribe-2-pro` | Recordings up to 60 minutes, with the same speaker markers, speaker turns, and cues as `transcribe-1-pro`. Adds `text_format`, `verbatim`, and `keyterms`, and uses your `language` hint. | +| `transcribe-1` | General transcription of short recordings. Used when the `model` header is missing or not an exact match. | -Send `model: transcribe-1-pro` with every request, written exactly, in lowercase. If the header is missing, or its value is not an exact match (for example `Transcribe-1-Pro` or `transcribe-1pro`), the request is served and billed as `transcribe-1`, and no error is returned. If you expected `transcribe-1-pro` but the transcript has no speaker markers and you did not send `diarize=false`, check the header. This applies to the API playground on this page too: set its `model` header to `transcribe-1-pro`. +`transcribe-1-pro` and `transcribe-2-pro` are the Pro models. Send `model: transcribe-1-pro` or `model: transcribe-2-pro` with every request, written exactly, in lowercase. If the header is missing, or its value is not an exact match (for example `Transcribe-1-Pro`, `transcribe-2pro`, or `transcribe-2`), the request is served and billed as `transcribe-1`, and no error is returned; `text_format`, `verbatim`, and `keyterms` are then ignored. If you expected a Pro model but the transcript has no speaker markers and you did not send `diarize=false`, check the header. This applies to the API playground on this page too: set its `model` header to the model you want. The model belongs in the header for both multipart and MessagePack requests; a `model` field in the request body is ignored. See [Limits](#limits) for recording length and request size. @@ -31,27 +34,32 @@ To link the request to your own distributed trace, also send a W3C `traceparent` Multipart and MessagePack bodies use the same field names. Multipart values are text; MessagePack values are typed. -| Field | Required | Default | Description | -| ------------------------------ | -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `audio` | Yes | — | Exactly one audio file per request: a file upload for multipart, or binary bytes for MessagePack. The format is detected from the file contents, not the file name. See [Supported audio formats](#supported-audio-formats). | -| `language` | No | Unset | Optional language hint, as a lowercase ISO 639-1 code such as `en`, `zh`, or `ja`. The language is detected automatically either way. An empty multipart value counts as unset. See [Language](#language). | -| `ignore_timestamps` | No | `true` | Default `true` (no timestamps). Set to `false` to get word-level `segments` and `speaker_turns`. Timestamps add processing time. | -| `tag_audio_events` | No | `true` | `true`: bracketed emotion and vocal-event cues such as `[laughter]` or `[高兴]` stay in `text` and in `speaker_turns`. `false`: the cues are removed. Timestamps, `duration`, and billing do not change. | -| `diarize` | No | `auto` | `auto` or `true`: return `speaker_turns` when timestamps are requested. `false`: omit `speaker_turns` and the speaker markers in `text`; the rest of the transcript does not change. | -| `num_speakers` | No | Unset | The expected number of speakers, an integer of 1 or more. Cannot be combined with `min_speakers` or `max_speakers`. | -| `min_speakers`, `max_speakers` | No | Unset | Lower and upper bounds on the number of speakers, integers of 1 or more. `min_speakers` must not exceed `max_speakers`. | +| Field | Required | Default | Description | +| ------------------------------ | -------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `audio` | Yes | — | Exactly one audio file per request: a file upload for multipart, or binary bytes for MessagePack. The format is detected from the file contents, not the file name. See [Supported audio formats](#supported-audio-formats). | +| `language` | No | Unset | Optional language hint, as a lowercase ISO 639-1 code such as `en`, `zh`, or `ja`. With `transcribe-1-pro`, the language is detected automatically either way; `transcribe-2-pro` also passes the hint to the model. An empty multipart value counts as unset. See [Language](#language). | +| `ignore_timestamps` | No | `true` | Default `true` (no timestamps). Set to `false` to get word-level `segments` and `speaker_turns`. Timestamps add processing time. | +| `tag_audio_events` | No | `true` | `true`: bracketed emotion and vocal-event cues such as `[laughter]` or `[高兴]` stay in `text` and in `speaker_turns`. `false`: the cues are removed. Timestamps, `duration`, and billing do not change. | +| `diarize` | No | `auto` | `auto` or `true`: return `speaker_turns` when timestamps are requested. `false`: omit `speaker_turns` and the speaker markers in `text`; the rest of the transcript does not change. | +| `num_speakers` | No | Unset | The expected number of speakers, an integer of 1 or more. Cannot be combined with `min_speakers` or `max_speakers`. | +| `min_speakers`, `max_speakers` | No | Unset | Lower and upper bounds on the number of speakers, integers of 1 or more. `min_speakers` must not exceed `max_speakers`. | +| `text_format` | No | `written` | `transcribe-2-pro` only. `written`: numbers, dates, times, and amounts in digits and symbols, such as `3:30` or `20%`. `spoken`: in words, as they were said, such as `twenty-five dollars`. See [Text format](#text-format). | +| `verbatim` | No | `true` | `transcribe-2-pro` only. `true`: filler words, stutters, repetitions, and false starts stay in the transcript. `false`: filler sounds, stutters, accidental repetitions, and short false starts are left out; nothing is reworded. See [Verbatim](#verbatim). | +| `keyterms` | No | Unset | `transcribe-2-pro` only. Up to 128 words or short phrases, such as names and product terms, for the transcript to spell as you list them. In multipart forms, repeat the field once per term. See [Key terms](#key-terms). | In multipart forms, send `true` or `false` for `ignore_timestamps`. Any value other than `true` (case-insensitive), including `1` or an empty value, is read as `false` and turns timestamps on. In MessagePack, send a boolean; a string or `nil` returns 400. Speaker-count hints are applied on a best-effort basis: they guide speaker identification on longer recordings and may have no effect on short ones. They cannot be sent with `diarize=false`. -`tag_audio_events`, `diarize`, and the speaker-count hints are validated strictly: +`tag_audio_events`, `diarize`, the speaker-count hints, `text_format`, `verbatim`, and `keyterms` are validated strictly: + +- In multipart forms, `tag_audio_events` and `verbatim` take `true` or `false`, `diarize` takes `auto`, `true`, or `false`, and `text_format` takes `written` or `spoken`, in any letter case. Speaker counts take digits only. Send each of these fields at most once. `keyterms` is the exception: send it once per term. +- In MessagePack, send `tag_audio_events` and `verbatim` as booleans, `diarize` as a boolean or one of the lowercase strings `auto`, `true`, or `false`, `text_format` as the string `written` or `spoken`, speaker counts as integers, not floats or strings, and `keyterms` as an array of strings. `nil` means the default; for `keyterms`, `nil` and an empty array mean no key terms. +- Any other value, a repeated multipart field, or a conflicting combination returns 400 with code `invalid_parameter`. So does a key term that breaks the [key term rules](#key-terms). -- In multipart forms, `tag_audio_events` takes `true` or `false`, and `diarize` takes `auto`, `true`, or `false`, in any letter case. Speaker counts take digits only. Send each field at most once. -- In MessagePack, send `tag_audio_events` as a boolean, `diarize` as a boolean or one of the lowercase strings `auto`, `true`, or `false`, and speaker counts as integers, not floats or strings. `nil` means the default. -- Any other value, a repeated multipart field, or a conflicting combination returns 400 with code `invalid_parameter`. +`text_format`, `verbatim`, and `keyterms` apply to `transcribe-2-pro` only. `transcribe-1-pro` ignores them. -**If you use `transcribe-1`:** send `audio`, `language`, and `ignore_timestamps`. The other fields apply to `transcribe-1-pro`; send them only with `model: transcribe-1-pro`. +**If you use `transcribe-1`:** send `audio`, `language`, and `ignore_timestamps`. The other fields apply to the Pro models; send them only with `model: transcribe-1-pro` or `model: transcribe-2-pro`. ### Examples @@ -75,25 +83,63 @@ curl --request POST https://api.fish.audio/v1/asr \ --form tag_audio_events=false ``` +With `transcribe-2-pro`, you can also send a language hint and list key terms, one `keyterms` field per term: + +```bash +curl --request POST https://api.fish.audio/v1/asr \ + --header "Authorization: Bearer $FISH_API_KEY" \ + --header "model: transcribe-2-pro" \ + --form audio=@earnings-call.mp3 \ + --form language=en \ + --form-string keyterms=Kubernetes \ + --form-string "keyterms=Fish Audio" +``` + +`--form-string` sends each term as plain text, even one that starts with `@`, which `--form` would read as a file to upload. + Let your HTTP client set the multipart `Content-Type` and boundary. For MessagePack, set `Content-Type: application/msgpack` and encode `audio` as binary bytes. See the [Speech to Text guide](/features/speech-to-text#direct-api-messagepack) for an example. +### Text format + +With `transcribe-2-pro`, `text_format` changes how the model writes numbers, dates, times, and amounts, for the whole recording. `written` (the default) writes them in digits and symbols, such as `3:30` or `20%`; in Chinese transcripts, numbers are usually Arabic digits. `spoken` writes them in words, as they were said, such as `twenty-five dollars`. `spoken` is not always followed when the request also has `keyterms`: numbers, dates, and amounts can then come back in digits and symbols, as with `written`. If you need spoken numbers, send the request without key terms. + +### Verbatim + +With `transcribe-2-pro`, `verbatim` controls filler words and disfluencies, for the whole recording. `true` (the default) keeps filler words, stutters, repetitions, and false starts. `false` leaves out filler sounds, stutters, accidental repetitions, and short false starts. It only removes words, and never rewords or replaces them: meaningful words stay, and so does a short reply such as `Mm-hmm`. The model decides what counts as a filler or a false start, so it can occasionally leave one in or remove a short word that was meant. + +### Key terms + +With `transcribe-2-pro`, send `keyterms` to list words or short phrases that may be spoken in the recording, such as names, products, and technical terms, so the transcript spells them as you list them. List only terms that are likely to occur: a listed term that is never said can occasionally appear in the transcript. Key terms have been tested on short Chinese, Japanese, and English clips. + +- **Encoding:** in multipart forms, repeat the `keyterms` field once per term. In MessagePack, send an array of strings. +- **Count:** at most 128 terms per request, repeated terms included. +- **Length:** each term at most 50 characters and 8 words, counted after leading and trailing whitespace is removed and each run of whitespace inside it is read as one space. Words are separated by spaces, so a Chinese or Japanese term without spaces is one word. An empty term is refused. +- **Characters:** a term cannot contain an ASCII comma (`,`), any of `\ < > [ ] { }`, or control and invisible formatting characters, such as tabs, line breaks, or zero-width spaces. The zero-width non-joiner and joiner (U+200C, U+200D) and full-width punctuation such as `,` and `、` are accepted. +- **Reserved starts:** a term cannot start with `style:`, `format:`, `verbatim:`, `tags:`, `language hint:`, or `glossary:`, in any letter case. +- **Duplicates:** a term listed twice is used once. Two terms that differ only in letter case or character width, such as `ABC` and `ABC`, are refused. +- **Total size:** all the terms together must fit in the model's limit of 1024 tokens. Long Chinese or Japanese terms reach it well before 128 terms, at about 32 to 37 terms of 32 characters each, and so can a few long terms in rare scripts. The error message then says the terms are too long in total for the 1024-token limit and gives the list's token count; send fewer or shorter terms. + +A term that breaks a rule returns 400 with code `invalid_parameter`. The `message` names the rule and the term's position in the request, such as `keyterms[3]`, counted from 0, but never the term itself. Key terms do not change the price. With key terms, `text_format=spoken` is not always followed; see [Text format](#text-format). + +{/* TODO(owner): decide whether key terms are labelled Beta. */} + ## Read the response A successful response (HTTP 200) is a JSON object: -| Field | Description | -| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `text` | The full transcript, with inline speaker markers such as `<\|speaker:0\|>` (none with `diarize=false`) and, unless `tag_audio_events=false`, bracketed emotion and vocal-event cues such as `[高兴]` (happy) or `[laughter]`. See [Multi-speaker response format](#multi-speaker-response-format). | -| `duration` | Length of the audio in seconds, including silence. | -| `segments` | Word-level timestamps: an array of `{ "text", "start", "end" }`, with times in seconds. Empty (`[]`) when `ignore_timestamps=true` (the default), when no speech was found, or when timing is temporarily unavailable. See [Segments](#segments). | -| `speaker_turns` | The transcript as timed speaker turns. Returned when `ignore_timestamps=false` and `diarize` is not `false`; otherwise absent. See [Speaker turns](#speaker-turns). | -| `language` | The detected language's English name, such as `English` or `Chinese`. Omitted when it cannot be determined. Intended for display. | -| `language_code` | Two-letter ISO 639-1 code for the language, such as `en`. Omitted when unknown. If the language cannot be determined and you sent a `language` hint, this reports your hint. See [Language](#language). | -| `request_id` | A unique ID for this request, also present in `transcribe-1-pro` error bodies and in the `x-request-id` response header. Platform and network-edge errors do not carry it. Include it when you contact support. | +| Field | Description | +| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `text` | The full transcript, with inline speaker markers such as `<\|speaker:0\|>` (none with `diarize=false`) and, unless `tag_audio_events=false`, bracketed emotion and vocal-event cues such as `[高兴]` (happy) or `[laughter]`. See [Multi-speaker response format](#multi-speaker-response-format). | +| `duration` | Length of the audio in seconds, including silence. | +| `segments` | Word-level timestamps: an array of `{ "text", "start", "end" }`, with times in seconds. Empty (`[]`) when `ignore_timestamps=true` (the default), when no speech was found, or when timing is temporarily unavailable. See [Segments](#segments). | +| `speaker_turns` | The transcript as timed speaker turns. Returned when `ignore_timestamps=false` and `diarize` is not `false`; otherwise absent. See [Speaker turns](#speaker-turns). | +| `language` | The detected language's English name, such as `English` or `Chinese`. With `transcribe-2-pro`, the language of your `language` hint when the model recognizes it and the transcript agrees with it. Omitted when it cannot be determined. Intended for display. | +| `language_code` | Two-letter ISO 639-1 code for the language, such as `en`. Omitted when unknown. If the language cannot be determined and you sent a `language` hint, this reports your hint. With `transcribe-2-pro`, it reports the language of a hint the model recognizes, such as `pt` for `pt-BR`, when the transcript agrees with it. See [Language](#language). | +| `request_id` | A unique ID for this request, also present in Pro model error bodies and in the `x-request-id` response header. Platform and network-edge errors do not carry it. Include it when you contact support. | A field that is not returned is absent from the JSON, never `null`. Do not depend on the order of keys in the JSON. -**If you use `transcribe-1`:** rely on `text`, `duration`, `segments`, `language`, and `language_code`. Speaker markers, `speaker_turns`, and `request_id` are `transcribe-1-pro` features. +**If you use `transcribe-1`:** rely on `text`, `duration`, `segments`, `language`, and `language_code`. Speaker markers, `speaker_turns`, and `request_id` are features of the Pro models. Both SDKs select `transcribe-1-pro` through the `model` header. In Python, @@ -101,17 +147,19 @@ A field that is not returned is absent from the JSON, never `null`. Do not depen `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()`. 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 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`. + `speechToText.convert()`. Select `transcribe-2-pro` the same way. Neither SDK + can send `tag_audio_events`, `diarize`, the speaker-count hints, + `text_format`, `verbatim`, or `keyterms`. To use them, call the API + directly, as 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`. ### Multi-speaker response format -`transcribe-1-pro` marks speaker changes **inside the `text` string** with `<|speaker:N|>` markers. The label `N` identifies the speaker for the text that follows, up to the next marker. A repeated label means that speaker is speaking again. +The Pro models mark speaker changes **inside the `text` string** with `<|speaker:N|>` markers. The label `N` identifies the speaker for the text that follows, up to the next marker. A repeated label means that speaker is speaking again. - Markers usually have a space on each side (`<|speaker:0|> 你好。 <|speaker:1|> ...`). Do not depend on exact spacing. - Any text before the first marker belongs to the first turn. @@ -135,7 +183,7 @@ Read this as speaker 0 saying `你好。`, speaker 1 saying `[高兴]很开心 ### Speaker turns -With `ignore_timestamps=false`, `transcribe-1-pro` also returns the turns as a structured `speaker_turns` array, unless you send `diarize=false`. When you request timestamps, prefer `speaker_turns` over parsing `text`. +With `ignore_timestamps=false`, the Pro models also return the turns as a structured `speaker_turns` array, unless you send `diarize=false`. When you request timestamps, prefer `speaker_turns` over parsing `text`. - `speaker_turns` lists the turns in the order they occur, and is `[]` when no speech was found. Each turn is `{ "speaker": "speaker:N", "text": "...", "start": , "end": }`. - `speaker` is the string `speaker:N`, where `N` matches the `<|speaker:N|>` marker in `text`. Like the markers, labels identify speakers within one response only. @@ -186,14 +234,27 @@ A segment is usually one word; in Chinese and Japanese it is usually one charact ### Language -- `language` is optional. The language is detected automatically whether or not you send a hint, and a hint does not force the transcript into that language. -- Use a lowercase ISO 639-1 code such as `en`, `zh`, or `ja`. Other forms, such as `en-US` or `English`, may be rejected with 400. +`language` is optional. Responses report one language: for recordings that switch languages, `language` and `language_code` do not list every language spoken. + +With `transcribe-1-pro`: + +- The language is detected automatically whether or not you send a hint, and a hint does not force the transcript into that language. +- Use a lowercase ISO 639-1 code such as `en`, `zh`, or `ja`. - 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. + +With `transcribe-2-pro`: + +- The hint is passed to the model and guides the transcription. Send it when you know the language of the recording. Without a hint, the response language is detected from the transcript, and for some languages it can be missing or name a related language, such as Hindi for Marathi. +- The hint can be an ISO 639-1 or ISO 639-3 code, an English language name, or a locale such as `pt-BR`, in any letter case. A hint the model does not recognize, such as `auto`, is ignored: the model transcribes without a hint, the response language is detected as with `transcribe-1-pro`, and no error is returned. +- When the model recognizes the hint, `language` and `language_code` report the hint's language, for example `Portuguese` and `pt` for `pt-BR`, if the transcript agrees with it: no language is detected in the transcript, the language detected is the hint's, or, for a language that detection cannot identify, the transcript is mostly in a script that language is written in. Otherwise they report the detected language: Chinese speech sent with `language=ja` returns `Chinese` and `zh`. +- For `bs`, `hr`, and `sr`, `language` is `Bosnian/Croatian/Serbian` and `language_code` is the code you sent. +- Send the language that is actually spoken. A wrong hint can change the transcript, for example the script it is written in, and a wrong hint in the same script as the speech is not always caught: English speech sent with `language=az` can return `Azerbaijani`. + +{/* TODO(owner, D5): once the guide publishes the list of languages transcribe-2-pro recognizes (Language hints with transcribe-2-pro), link it here. Until then this page names no list. */} ## Limits -- **Audio length:** up to 60 minutes per request. Longer audio returns 400 with code `audio_too_long`. +- **Audio length:** up to 60 minutes per request with either Pro model. 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. - **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. @@ -201,7 +262,7 @@ A segment is usually one word; in Chinese and Japanese it is usually one charact ### Processing time and timeouts -- Processing time grows with the length of the recording. Long `transcribe-1-pro` recordings can take several minutes. +- Processing time grows with the length of the recording. Long recordings can take several minutes on either Pro model. - 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. - 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. @@ -209,7 +270,7 @@ A segment is usually one word; in Chinese and Japanese it is usually one charact ## 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. +- The Pro models accept WAV, MP3, AAC (including M4A/MP4), FLAC, Ogg (Opus or Vorbis), WebM/Matroska, and MOV, including browser recordings. For a video file, they use the first audio track. Send the original file bytes; no conversion is needed. - Not supported: AIFF, CAF, WMA, AMR, AC-3, and raw (headerless) PCM. These return 400. **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. @@ -218,11 +279,11 @@ A segment is usually one word; in Chinese and Japanese it is usually one charact Error responses have one of these shapes: -- **`transcribe-1-pro` errors** are JSON with `status`, `message`, `code`, and `request_id`. Branch on `code`, not on `message`. +- **Pro model errors**, from `transcribe-1-pro` and `transcribe-2-pro`, are JSON with `status`, `message`, `code`, and `request_id`. Branch on `code`, not on `message`. - **Platform errors**, such as authentication, credit, and concurrency errors, are returned before the request reaches a model. They are JSON with exactly `status` and `message`. - **Errors from the network edge** in front of the API, such as some 413 and 5xx responses, may not have a JSON body. Handle them by HTTP status. -This illustrative `transcribe-1-pro` error body shows the shape: +This illustrative Pro model error body shows the shape: ```json { diff --git a/api-reference/errors.mdx b/api-reference/errors.mdx index acc0dfc0..cfa9bd77 100644 --- a/api-reference/errors.mdx +++ b/api-reference/errors.mdx @@ -12,7 +12,7 @@ Fish Audio errors come back as JSON with a `message` and a `status`: (A request whose body can't be parsed returns a plain-text parse error instead.) -Some endpoints add fields. For example, `transcribe-1-pro` speech-to-text errors also include `code` and `request_id`; see [Speech to Text errors](/api-reference/endpoint/openapi-v1/speech-to-text#errors). Errors returned by the network edge in front of the API, such as some `413` or `5xx` responses, may not be JSON. +Some endpoints add fields. For example, `transcribe-1-pro` and `transcribe-2-pro` speech-to-text errors also include `code` and `request_id`; see [Speech to Text errors](/api-reference/endpoint/openapi-v1/speech-to-text#errors). Errors returned by the network edge in front of the API, such as some `413` or `5xx` responses, may not be JSON. ## Status codes diff --git a/api-reference/observability.mdx b/api-reference/observability.mdx index f3208d73..f2d9fd7a 100644 --- a/api-reference/observability.mdx +++ b/api-reference/observability.mdx @@ -438,11 +438,12 @@ x-fish-trace-id: 4bf92f3577b34da6a3ce929d0e0e4736 ## Speech-to-Text Request IDs -`transcribe-1-pro` responses from `POST /v1/asr` include a `request_id` field -in the JSON body, on success and on its own error responses, and the same value -in the `x-request-id` response header. Platform errors, such as authentication, -credit, and concurrency errors, and errors from the network edge do not carry -it. Include it when you contact support about a transcription request. See +`transcribe-1-pro` and `transcribe-2-pro` responses from `POST /v1/asr` include +a `request_id` field in the JSON body, on success and on their own error +responses, and the same value in the `x-request-id` response header. Platform +errors, such as authentication, credit, and concurrency errors, and errors from +the network edge do not carry it. Include it when you contact support about a +transcription request. See [Speech to Text](/api-reference/endpoint/openapi-v1/speech-to-text#read-the-response). ## Enterprise Performance Analysis diff --git a/developer-guide/getting-started/changelog.mdx b/developer-guide/getting-started/changelog.mdx index 84507b94..042c8d84 100644 --- a/developer-guide/getting-started/changelog.mdx +++ b/developer-guide/getting-started/changelog.mdx @@ -4,6 +4,16 @@ description: "Complete release history and version updates for all Fish Audio pr icon: "clock-rotate-left" rss: true --- + + ## Transcribe 2 Pro + + Speech-to-text model for short clips and long recordings up to 60 minutes, including multi-speaker conversations, with the same speaker markers, speaker turns, and emotion and vocal-event cues as `transcribe-1-pro`. New request fields choose written or spoken numbers, dates, and amounts (`text_format`, `written` by default), keep or leave out filler sounds and false starts (`verbatim`), and list up to 128 key terms for the transcript to spell as given (`keyterms`). A `language` hint is passed to the model and guides the transcription. + + Use model ID `transcribe-2-pro` on `POST /v1/asr`. `transcribe-1-pro` remains available. + + [Speech to Text](/features/speech-to-text#transcribe-2-pro-options) | [API reference](/api-reference/endpoint/openapi-v1/speech-to-text) | [Pricing](/developer-guide/models-pricing/pricing-and-rate-limits#automatic-speech-recognition-asr-models) + + ## Voice Agents native iOS and Android SDKs diff --git a/developer-guide/models-pricing/deprecations.mdx b/developer-guide/models-pricing/deprecations.mdx index 9f88520c..2b05f5e1 100644 --- a/developer-guide/models-pricing/deprecations.mdx +++ b/developer-guide/models-pricing/deprecations.mdx @@ -19,6 +19,7 @@ import { AudioTranscript } from '/snippets/audio-transcript.jsx'; Currently available models: - **Fish Audio S2** (Recommended: `s2.1-pro`) - Latest generation with best performance - **Transcribe 1 Pro** (`transcribe-1-pro`) - Speech to text +- **Transcribe 2 Pro** (`transcribe-2-pro`) - Speech to text ## Deprecated Models - **s1** - S1 is deprecated and will be retired on December 31, 2026. After that date, requests that specify `s1` are served by `s2.1-pro`. See [Migrate from S1](/developer-guide/models-pricing/migrate-from-s1). diff --git a/developer-guide/models-pricing/models-overview.mdx b/developer-guide/models-pricing/models-overview.mdx index 1ece8294..14d10487 100644 --- a/developer-guide/models-pricing/models-overview.mdx +++ b/developer-guide/models-pricing/models-overview.mdx @@ -71,20 +71,21 @@ S1 is deprecated and will be retired on December 31, 2026. After that date, requ ## Speech-to-Text Models -We recommend `transcribe-1-pro` for transcribing recordings. Both file models use `POST /v1/asr`, and you select one with the `model` HTTP header, written exactly as shown. Send `model: transcribe-1-pro` with every request: if the header is missing or its value is not an exact match, the request is served and billed as `transcribe-1`, and no error is returned. To transcribe live audio, use `transcribe-stream-1` on the realtime WebSocket, `wss://api.fish.audio/v1/asr/realtime`, where it is the default model. +We recommend `transcribe-1-pro` for transcribing recordings. `transcribe-2-pro` handles the same recordings and adds text format, verbatim, and key term options. All three file models use `POST /v1/asr`, and you select one with the `model` HTTP header, written exactly as shown. Send `model: transcribe-1-pro` or `model: transcribe-2-pro` with every request: if the header is missing or its value is not an exact match (for example `transcribe-2`), the request is served and billed as `transcribe-1`, and no error is returned. To transcribe live audio, use `transcribe-stream-1` on the realtime WebSocket, `wss://api.fish.audio/v1/asr/realtime`, where it is the default model. | Model | Capabilities | | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `transcribe-1-pro` (recommended) | Anything from short clips to long recordings (up to 60 minutes), including multi-speaker conversations. Speaker markers in `text`, structured `speaker_turns` with start and end times, speaker-count hints, and inline emotion and vocal-event cues such as `[高兴]` (happy) and `[laughter]` (optional via `tag_audio_events`). Supports optional timestamps. | +| `transcribe-2-pro` | The same recordings, speaker markers, `speaker_turns`, speaker-count hints, and cues as `transcribe-1-pro`. Also takes `text_format` (written or spoken numbers, default written), `verbatim`, and up to 128 `keyterms`, and uses your `language` hint. | | `transcribe-1` | General transcription of short recordings, with optional timestamps. Serves requests whose `model` header is missing or not an exact match. | | `transcribe-stream-1` (Preview) | Live audio streamed over the [realtime WebSocket](/features/speech-to-text/realtime), transcribed turn by turn while people speak. Turn detection for voice agents (eager end of turn, backchannel detection and background awareness), live drafts, conversation context, speaker tags and sound tags. Sessions up to 60 minutes. | -Pro labels speakers with inline `<|speaker:N|>` markers in `text`, alongside emotion cues. A label identifies the same speaker within one response only. When you request timestamps (`ignore_timestamps=false`), Pro also returns `speaker_turns`, a structured list of turns with each turn's speaker, text, and start and end times, unless you send `diarize=false`. Timestamped `segments` are word-level, contain spoken words without these markers, and do not expose per-segment speaker IDs. See the [multi-speaker response example](/features/speech-to-text#multi-speaker-conversations) and [Speaker turns](/features/speech-to-text#speaker-turns). +The Pro models, `transcribe-1-pro` and `transcribe-2-pro`, label speakers with inline `<|speaker:N|>` markers in `text`, alongside emotion cues. A label identifies the same speaker within one response only. When you request timestamps (`ignore_timestamps=false`), they also return `speaker_turns`, a structured list of turns with each turn's speaker, text, and start and end times, unless you send `diarize=false`. Timestamped `segments` are word-level, contain spoken words without these markers, and do not expose per-segment speaker IDs. See the [multi-speaker response example](/features/speech-to-text#multi-speaker-conversations) and [Speaker turns](/features/speech-to-text#speaker-turns). -Pro has its own optional request fields: `tag_audio_events`, `diarize`, and the speaker-count hints `num_speakers`, `min_speakers`, and `max_speakers`. Speaker-count hints are applied on a best-effort basis and may have no effect on short recordings. For supported audio formats, file size, and length, see [Input audio](/features/speech-to-text#input-audio) and [Limits](/features/speech-to-text#limits). For costs, see [ASR pricing](/developer-guide/models-pricing/pricing-and-rate-limits#automatic-speech-recognition-asr-models). +The Pro models have their own optional request fields: `tag_audio_events`, `diarize`, and the speaker-count hints `num_speakers`, `min_speakers`, and `max_speakers`. Speaker-count hints are applied on a best-effort basis and may have no effect on short recordings. `transcribe-2-pro` also takes `text_format`, `verbatim`, and `keyterms`, and passes your `language` hint to the model; see [transcribe-2-pro options](/features/speech-to-text#transcribe-2-pro-options). For supported audio formats, file size, and length, see [Input audio](/features/speech-to-text#input-audio) and [Limits](/features/speech-to-text#limits). For costs, see [ASR pricing](/developer-guide/models-pricing/pricing-and-rate-limits#automatic-speech-recognition-asr-models). -**If you use `transcribe-1`:** it is designed for short recordings; for recordings longer than a few minutes, use `transcribe-1-pro`. Speaker markers, speaker turns, and emotion and vocal-event cues are `transcribe-1-pro` features, so send the Pro request fields above only with `model: transcribe-1-pro`. +**If you use `transcribe-1`:** it is designed for short recordings; for recordings longer than a few minutes, use `transcribe-1-pro`. Speaker markers, speaker turns, and emotion and vocal-event cues are Pro model features, so send the Pro request fields above only with `model: transcribe-1-pro` or `model: transcribe-2-pro`. ## Model Specifications diff --git a/developer-guide/models-pricing/pricing-and-rate-limits.mdx b/developer-guide/models-pricing/pricing-and-rate-limits.mdx index 166fd09f..72e30ce8 100644 --- a/developer-guide/models-pricing/pricing-and-rate-limits.mdx +++ b/developer-guide/models-pricing/pricing-and-rate-limits.mdx @@ -48,14 +48,19 @@ the same price. See [Migrate from S1](/developer-guide/models-pricing/migrate-fr | Model Name | Price (USD) | | --------------------------------------------- | -------------------- | | `transcribe-1-pro` (recommended) | $0.36 / audio hour | +| `transcribe-2-pro` | \$0.06 / audio hour through December 31, 2026, then \$0.16 | | `transcribe-1` | $0.36 / audio hour | | `transcribe-stream-1` (Realtime ASR, Preview) | $0.36 / session hour | -For recordings, we recommend `transcribe-1-pro`, which handles multi-speaker conversations (speaker markers and speaker turns), long recordings, and inline emotion cues. Both file models cost the same and use the [Speech to Text API](/api-reference/endpoint/openapi-v1/speech-to-text). Send the `model: transcribe-1-pro` HTTP header to select Pro; a request whose `model` header is missing or not an exact match is served and billed as `transcribe-1`. See the [model comparison](/features/speech-to-text#choose-an-asr-model). +Through December 31, 2026 (until January 1, 2027, 00:00 PT / 08:00 UTC), +`transcribe-2-pro` is billed at a launch price of \$0.06 / audio hour. From +then on, it is billed at \$0.16 / audio hour. + +For recordings, we recommend `transcribe-1-pro`, which handles multi-speaker conversations (speaker markers and speaker turns), long recordings, and inline emotion cues. `transcribe-2-pro` handles the same recordings and adds text format, verbatim, and key term options. All three file models use the [Speech to Text API](/api-reference/endpoint/openapi-v1/speech-to-text), and `transcribe-1-pro` and `transcribe-1` cost the same. Send the `model: transcribe-1-pro` or `model: transcribe-2-pro` HTTP header to select a Pro model; a request whose `model` header is missing or not an exact match, such as `transcribe-2`, is served and billed as `transcribe-1`. See the [model comparison](/features/speech-to-text#choose-an-asr-model). `transcribe-stream-1` transcribes live audio over the [realtime WebSocket](/features/speech-to-text/realtime) and is billed as its own line item, Realtime ASR, separate from file transcription. -**How ASR billing works for files (`transcribe-1-pro`, `transcribe-1`):** +**How ASR billing works for files (`transcribe-1-pro`, `transcribe-2-pro`, `transcribe-1`):** - Charges are based on the duration of audio processed - Duration is rounded up to the nearest second diff --git a/developer-guide/resources/agent-quickstart.mdx b/developer-guide/resources/agent-quickstart.mdx index ef4bde09..040c374d 100644 --- a/developer-guide/resources/agent-quickstart.mdx +++ b/developer-guide/resources/agent-quickstart.mdx @@ -142,6 +142,7 @@ Not a coding agent installing a skill, but an autonomous agent, RAG pipeline, or - Authentication: `Authorization: Bearer ` - TTS model selection: optional `model` header (`s1` (deprecated), `s2-pro`, `s2.1-pro`, `s2.1-pro-free`). Recommended: `s2.1-pro` for production, `s2.1-pro-free` for the free developer tier. If omitted, the server uses `s2.1-pro`. S1 is deprecated and will be retired on December 31, 2026. After that date, requests that specify `s1` are served by `s2.1-pro` - ASR model selection: `model` header on `POST /v1/asr` (`transcribe-1-pro`, `transcribe-1`). Recommended: `transcribe-1-pro` (speaker turns, long recordings, emotion cues); send it explicitly. If the header is missing or not an exact match, the request is served and billed as `transcribe-1`. The `/v1/asr` entry in `openapi.json` does not yet list the `transcribe-1-pro` fields, `request_id`, `speaker_turns`, or the error `code`; for those, follow the [Speech to Text API reference](https://docs.fish.audio/api-reference/endpoint/openapi-v1/speech-to-text.md) + - `transcribe-2-pro` is selected the same way (`model: transcribe-2-pro`). It returns the same response format as `transcribe-1-pro` and also takes `text_format`, `verbatim`, and `keyterms`, which `openapi.json` does not list either; see the [Speech to Text API reference](https://docs.fish.audio/api-reference/endpoint/openapi-v1/speech-to-text.md) - Main REST endpoints: - `POST /v1/tts` - `POST /v1/asr` diff --git a/features/speech-to-text.mdx b/features/speech-to-text.mdx index 79b91793..816fe015 100644 --- a/features/speech-to-text.mdx +++ b/features/speech-to-text.mdx @@ -1,11 +1,13 @@ --- title: "Speech to Text" sidebarTitle: "Overview" -description: "Transcribe audio with transcribe-1-pro, including word-level timestamps, speaker turns for multi-speaker conversations, long recordings, and emotion cues" +description: "Transcribe audio with transcribe-1-pro or transcribe-2-pro, including word-level timestamps, speaker turns for multi-speaker conversations, long recordings, emotion cues, and key terms" icon: "waveform" --- -Turn spoken audio into text with `transcribe-1-pro`, Fish Audio's recommended automatic speech recognition (ASR) model. Send an audio file to `POST /v1/asr` with the header `model: transcribe-1-pro` to receive a transcript, its duration, and optional word-level timestamps. Pro handles multi-speaker conversations and recordings up to 60 minutes: it marks speakers inline in the transcript, returns a structured list of speaker turns when you request timestamps, and keeps emotion and vocal-event cues. To transcribe live audio as people speak, with turn detection for voice agents, see [Realtime Speech to Text](/features/speech-to-text/realtime). +{/* TODO(owner): decide which model the docs label "recommended". This page still recommends transcribe-1-pro and lists transcribe-2-pro beside it without a label. */} + +Turn spoken audio into text with `transcribe-1-pro`, Fish Audio's recommended automatic speech recognition (ASR) model. Send an audio file to `POST /v1/asr` with the header `model: transcribe-1-pro` to receive a transcript, its duration, and optional word-level timestamps. Pro handles multi-speaker conversations and recordings up to 60 minutes: it marks speakers inline in the transcript, returns a structured list of speaker turns when you request timestamps, and keeps emotion and vocal-event cues. `transcribe-2-pro` returns the same response format and also lets you choose how numbers are written, keep or leave out filler sounds, and list key terms; see [transcribe-2-pro options](#transcribe-2-pro-options). To transcribe live audio as people speak, with turn detection for voice agents, see [Realtime Speech to Text](/features/speech-to-text/realtime). @@ -196,7 +202,7 @@ For captions, group consecutive segments into caption-sized cues instead of writ ## Multi-speaker conversations -`transcribe-1-pro` supports recordings with multiple speakers, such as interviews, meetings, and calls. Send the recording as one audio file. Speaker labels are consistent within one response, not across requests, so do not split a conversation into several requests. +`transcribe-1-pro` and `transcribe-2-pro` support recordings with multiple speakers, such as interviews, meetings, and calls. Send the recording as one audio file. Speaker labels are consistent within one response, not across requests, so do not split a conversation into several requests. ### Speaker markers @@ -249,7 +255,7 @@ When you request timestamps, prefer `speaker_turns` over parsing `text`. ### Speaker turns -With `ignore_timestamps=false`, `transcribe-1-pro` also returns `speaker_turns`, a list of who spoke when. The field is present when `ignore_timestamps=false` and `diarize` is not `false`; otherwise it is absent. Speaker identification is a `transcribe-1-pro` feature. +With `ignore_timestamps=false`, the Pro models also return `speaker_turns`, a list of who spoke when. The field is present when `ignore_timestamps=false` and `diarize` is not `false`; otherwise it is absent. Speaker identification is a Pro model feature. This illustrative response is the same conversation with timestamps requested: @@ -294,7 +300,7 @@ This illustrative response is the same conversation with timestamps requested: ### Speaker options -These `transcribe-1-pro` fields control speaker identification: +These Pro model fields control speaker identification: - `diarize`: `auto` (default) or `true` returns `speaker_turns` when timestamps are requested. `false` omits `speaker_turns` and removes the speaker markers from `text`; the rest of the transcript does not change. Use it when you do not need speaker labels. - `num_speakers`: the expected number of speakers. This is a hint, applied on a best-effort basis; it guides speaker identification on longer recordings and may have no effect on short ones. It cannot be combined with `min_speakers` or `max_speakers`. @@ -351,17 +357,127 @@ Pro can retain cues about how speech sounds alongside the spoken words. These ap These are annotations inferred from the audio, not words you need to add to the request. The API has no separate `emotion` field or fixed emotion enum; preserve the returned text when your application needs these cues. -To get a transcript without cues, send `tag_audio_events=false` (`transcribe-1-pro`). Cues are then removed from `text` and `speaker_turns`; timestamps and billing do not change. +To get a transcript without cues, send `tag_audio_events=false` (Pro models). Cues are then removed from `text` and `speaker_turns`; timestamps and billing do not change. Word timestamps ignore speaker markers and cues. Read `text` for the annotated transcript and `segments` for timed speech; the segment text may therefore differ from the full transcript. +## transcribe-2-pro options + +`transcribe-2-pro` takes three request fields that the other models ignore: `text_format`, `verbatim`, and `keyterms`. They apply to the whole recording, and they do not change the price. + +### Text format + +`text_format` chooses how numbers, dates, times, and amounts are written: + +| Value | Output | Example | +| ------------------- | ----------------------------- | --------------------- | +| `written` (default) | Digits and symbols | `3:30`, `20%` | +| `spoken` | Words, the way they were said | `twenty-five dollars` | + +In Chinese transcripts, `written` numbers are usually Arabic digits rather than Chinese numerals. Send `written` or `spoken`, in any letter case. + +`spoken` is not always followed when you also send [key terms](#key-terms): numbers, dates, and amounts can then come back in digits and symbols, as with `written`. If you need spoken numbers, send the request without `keyterms`. + +{/* TODO(launch): if docs/transcribe-stream-2 merges first, add a sentence here: the realtime model transcribe-stream-2 has a setting of the same name, results.text_format, whose default is "spoken" and whose values are case-sensitive. */} + +### Verbatim + +`verbatim` controls filler words and disfluencies: + +- `true` (default): filler words, stutters, repetitions, and false starts stay in the transcript. +- `false`: the model leaves out filler sounds, stutters, accidental repetitions, and short false starts. + +With `false`, words are only removed, never reworded or replaced. Meaningful words stay, and so does a short reply such as `Mm-hmm`. The model decides what counts as a filler or a false start, so it can occasionally leave one in or remove a short word that was meant. + +### Key terms + +Send `keyterms` to list up to 128 words or short phrases that may be spoken in the recording, such as names, products, and technical terms, so the transcript spells them as you list them. List only terms that are likely to occur: a listed term that is never said can occasionally appear in the transcript. Key terms have been tested on short Chinese, Japanese, and English clips. + +- In multipart forms, repeat the `keyterms` field once per term. In MessagePack, send an array of strings. +- Each term is at most 50 characters and 8 words. It cannot contain an ASCII comma (`,`), any of `\ < > [ ] { }`, or line breaks; full-width punctuation such as `,` and `、` is accepted. +- All the terms together must fit in the model's limit of 1024 tokens. Long Chinese or Japanese terms can reach it before 128 terms; if the list is refused as too long in total, send fewer or shorter terms. +- A term that breaks a rule returns 400 `invalid_parameter`, and the error message names the term's position, such as `keyterms[3]`, counted from 0. See [Key terms](/api-reference/endpoint/openapi-v1/speech-to-text#key-terms) in the API reference for every rule. +- With key terms, `text_format=spoken` is not always followed, and numbers can come back in digits. See [Text format](#text-format). + +{/* TODO(owner): decide whether key terms are labelled Beta. */} + +For example, to transcribe an English earnings call with a language hint and two key terms: + + + +```python Python (httpx) +import os + +import httpx + +with open("earnings-call.mp3", "rb") as f: + resp = httpx.post( + "https://api.fish.audio/v1/asr", + headers={ + "Authorization": f"Bearer {os.environ['FISH_API_KEY']}", + "model": "transcribe-2-pro", + }, + files={"audio": ("earnings-call.mp3", f)}, + data={ + "language": "en", + "keyterms": ["Kubernetes", "Fish Audio"], # one field per term + }, + # Long recordings can take several minutes to process. + timeout=httpx.Timeout(900.0, connect=10.0), + ) +resp.raise_for_status() +print(resp.json()["text"]) +``` + +```bash API (curl) +curl --request POST https://api.fish.audio/v1/asr \ + --header "Authorization: Bearer $FISH_API_KEY" \ + --header "model: transcribe-2-pro" \ + --form audio=@earnings-call.mp3 \ + --form language=en \ + --form-string keyterms=Kubernetes \ + --form-string "keyterms=Fish Audio" +``` + +```javascript JavaScript (Node.js 20+) +import { readFile } from "node:fs/promises"; + +const form = new FormData(); +form.append( + "audio", + new Blob([await readFile("earnings-call.mp3")]), + "earnings-call.mp3" +); +form.append("language", "en"); +for (const term of ["Kubernetes", "Fish Audio"]) { + form.append("keyterms", term); // one field per term +} + +const response = await fetch("https://api.fish.audio/v1/asr", { + method: "POST", + headers: { + Authorization: `Bearer ${process.env.FISH_API_KEY}`, + model: "transcribe-2-pro", + }, + body: form, +}); + +if (!response.ok) throw new Error(await response.text()); +const result = await response.json(); +console.log(result.text); +``` + + + +In curl, `--form-string` sends each term as plain text, even one that starts with `@`, which `--form` would read as a file to upload. + ## Implementation details ### Language -`language` is optional. The language is detected automatically whether or not you send a hint, and a hint does not force the transcript into that language. With `transcribe-1-pro`, the hint does not change the transcript; it matters only when the language cannot be determined, as described below. +`language` is optional. With `transcribe-1-pro`, the language is detected automatically whether or not you send a hint, and a hint does not force the transcript into that language: the hint does not change the transcript; it matters only when the language cannot be determined, as described below. With `transcribe-2-pro`, the hint guides the transcription; see [Language hints with transcribe-2-pro](#language-hints-with-transcribe-2-pro). -Use a lowercase ISO 639-1 code such as `en`, `zh`, or `ja`. Other forms, such as `en-US` or `English`, may be rejected with 400. +With `transcribe-1-pro`, use a lowercase ISO 639-1 code such as `en`, `zh`, or `ja`. The response reports the language in two fields, which are omitted when unknown (never `null`): @@ -370,6 +486,18 @@ The response reports the language in two fields, which are omitted when unknown 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). +#### Language hints with transcribe-2-pro + +`transcribe-2-pro` passes your hint to the model, which uses it to transcribe the recording. Send `language` when you know the language of the recording: without a hint, the response language is detected from the transcript, and for some languages it can be missing or name a related language, such as Hindi for Marathi. + +- The hint can be an ISO 639-1 or ISO 639-3 code, an English language name, or a locale such as `pt-BR`, in any letter case. +- A hint the model does not recognize, such as `auto`, is ignored: the model transcribes without a hint, the response language is detected as with `transcribe-1-pro`, and no error is returned. +- When the model recognizes the hint, `language` and `language_code` report the hint's language, for example `Portuguese` and `pt` for `pt-BR`, if the transcript agrees with it: no language is detected in the transcript, the language detected is the hint's, or, for a language that detection cannot identify, the transcript is mostly in a script that language is written in. Otherwise they report the detected language: Chinese speech sent with `language=ja` returns `Chinese` and `zh`. +- For `bs`, `hr`, and `sr`, `language` is `Bosnian/Croatian/Serbian` and `language_code` is the code you sent. +- Send the language that is actually spoken. A wrong hint can change the transcript, for example the script it is written in, and a wrong hint in the same script as the speech is not always caught: English speech sent with `language=az` can return `Azerbaijani`. + +{/* TODO(owner, D5): add the languages transcribe-2-pro supports here, in the exact wording to publish. Still to decide: the list itself (every language the model recognizes as a hint, or the smaller set marketing names), which languages should always be sent with `language`, which languages to steer to transcribe-1-pro, and what to say about Cantonese and zh-HK, zh-TW, and zh-Hant hints. */} + ```python Python @@ -398,7 +526,7 @@ curl --request POST https://api.fish.audio/v1/asr \ ### 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. +The Pro models accept WAV, MP3, AAC (including M4A/MP4), FLAC, Ogg (Opus or Vorbis), WebM/Matroska, and MOV, including browser recordings, and use the first audio track of a video file. Send the original file bytes; no conversion is needed. Not supported: AIFF, CAF, WMA, AMR, AC-3, and raw (headerless) PCM. These return 400. @@ -408,7 +536,7 @@ If you use `transcribe-1`, send WAV, MP3, AAC (including M4A/MP4), FLAC, or Ogg ### Limits -These limits apply to `transcribe-1-pro`: +These limits apply to `transcribe-1-pro` and `transcribe-2-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. @@ -418,13 +546,13 @@ If you use `transcribe-1`, send up to 50 MiB per request and keep MP3 and Opus f ### Long recordings -With `transcribe-1-pro`, send the whole recording, up to 60 minutes, in one request. Timestamps and speaker labels cover the whole recording. Do not split conversations: speaker labels are consistent only within one response. Long recordings can take several minutes, so raise your [client timeout](#processing-time-and-timeouts) and retry on 5xx errors. You are billed for the full duration of the recording once. +With `transcribe-1-pro` or `transcribe-2-pro`, send the whole recording, up to 60 minutes, in one request. Timestamps and speaker labels cover the whole recording. Do not split conversations: speaker labels are consistent only within one response. Long recordings can take several minutes, so raise your [client timeout](#processing-time-and-timeouts) and retry on 5xx errors. You are billed for the full duration of the recording once. If you use `transcribe-1`, keep each request short. For a long recording, use `transcribe-1-pro`, or split the audio into shorter clips, transcribe each, and offset each clip's `start`/`end` by where it began in the full recording. Check that each response covers the complete clip before combining transcripts. ### Processing time and timeouts -Each request returns only when the whole file has been transcribed. Processing time grows with the length of the recording, and timestamps add to it. Long `transcribe-1-pro` recordings can take several minutes. +Each request returns only when the whole file has been transcribed. Processing time grows with the length of the recording, and timestamps add to it. Long recordings can take several minutes on either Pro model. 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: @@ -466,13 +594,13 @@ These values are examples, not a server guarantee. If a long request fails with ### 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 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). +The Pro models return a unique `request_id` in the response body, both on success and on their 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 The error body depends on where the error comes from: -- `transcribe-1-pro` errors are JSON with `status`, `message`, `code`, and `request_id`. Branch on `code`, not on `message`. +- Pro model errors, from `transcribe-1-pro` and `transcribe-2-pro`, are JSON with `status`, `message`, `code`, and `request_id`. Branch on `code`, not on `message`. - Platform errors, such as a missing or invalid API key (401), insufficient API credit (402), or the concurrency limit (429), are JSON with `status` and `message`. - Errors from the network edge in front of the API, such as some 413 and 5xx responses, may not have a JSON body. @@ -488,7 +616,7 @@ The error body depends on where the error comes from: Retry 429 and 5xx responses with exponential backoff; 429 responses have no `Retry-After` header. Do not retry other 4xx responses; change the request first. New `code` values may be added; handle unknown codes by HTTP status. See the [API reference](/api-reference/endpoint/openapi-v1/speech-to-text#errors) for every status and code. -With the Python SDK, a failed request raises `APIError` (`RateLimitError` for 429, `ServerError` for 5xx). `e.status` is the HTTP status, and `e.body` is the raw response body, where `transcribe-1-pro` errors carry `code` and `request_id`: +With the Python SDK, a failed request raises `APIError` (`RateLimitError` for 429, `ServerError` for 5xx). `e.status` is the HTTP status, and `e.body` is the raw response body, where Pro model errors carry `code` and `request_id`: ```python import json @@ -591,7 +719,7 @@ for turn in result.get("speaker_turns", []): print(turn["speaker"], turn["start"], turn["end"], turn["text"]) ``` -The response is the same as for multipart: `text`, `duration` (seconds), `segments`, and `request_id`, plus `speaker_turns` when timestamps are requested, and `language_code` and `language` when the language is known. Model selection stays in the HTTP header for both formats. MessagePack values are typed: send booleans for `ignore_timestamps` and `tag_audio_events`, integers for speaker counts, and a boolean or `"auto"` for `diarize`. +The response is the same as for multipart: `text`, `duration` (seconds), `segments`, and `request_id`, plus `speaker_turns` when timestamps are requested, and `language_code` and `language` when the language is known. Model selection stays in the HTTP header for both formats. MessagePack values are typed: send booleans for `ignore_timestamps`, `tag_audio_events`, and `verbatim`, integers for speaker counts, a boolean or `"auto"` for `diarize`, the string `"written"` or `"spoken"` for `text_format`, and an array of strings for `keyterms`. ## Going further diff --git a/llms.txt b/llms.txt index 26334d06..107aca05 100644 --- a/llms.txt +++ b/llms.txt @@ -18,7 +18,7 @@ - [API Introduction](https://docs.fish.audio/api-reference/introduction.md): How to use the Fish Audio API. - [Text to Speech Endpoint](https://docs.fish.audio/api-reference/endpoint/openapi-v1/text-to-speech.md): Convert text to speech. -- [Speech to Text Endpoint](https://docs.fish.audio/api-reference/endpoint/openapi-v1/speech-to-text.md): Transcribe audio with transcribe-1-pro (recommended; select it with the model header) or transcribe-1; request fields, timestamps, speaker turns, limits, formats and errors. +- [Speech to Text Endpoint](https://docs.fish.audio/api-reference/endpoint/openapi-v1/speech-to-text.md): Transcribe audio with transcribe-1-pro (recommended; select it with the model header), transcribe-2-pro or transcribe-1; request fields, timestamps, speaker turns, text format, verbatim, key terms, limits, formats and errors. - [Audio Infill Endpoint](https://docs.fish.audio/api-reference/endpoint/openapi-v1/audio-infill.md): Regenerate part of a recording with drama-3 (POST /v1/audio/infill) and get the whole take back; request shapes, positions, length of the new span, response and stream events. - [Voice Design Endpoint](https://docs.fish.audio/api-reference/endpoint/openapi-v1/voice-design.md): Generate candidate voices from a prompt. - [List Models](https://docs.fish.audio/api-reference/endpoint/model/list-models.md): Get a list of all models. diff --git a/overview/capabilities.mdx b/overview/capabilities.mdx index 4c8eed14..f82f78c5 100644 --- a/overview/capabilities.mdx +++ b/overview/capabilities.mdx @@ -15,7 +15,7 @@ Fish Audio is a voice AI platform. Every core feature is available three ways: i - Transcribe audio with `transcribe-1-pro`: multi-speaker conversations, long recordings, emotion cues, and optional timestamps. + Transcribe audio with `transcribe-1-pro` or `transcribe-2-pro`: multi-speaker conversations, long recordings, emotion cues, and optional timestamps. @@ -73,6 +73,7 @@ These text-to-speech models power most capabilities: For speech to text, select the model with the `model` header on `POST /v1/asr`: - **`transcribe-1-pro`**: the recommended model, for everything from short clips to multi-speaker conversations (speaker markers and speaker turns) and long recordings, with inline emotion cues. Send `model: transcribe-1-pro` explicitly. +- **`transcribe-2-pro`**: the same kinds of recordings and the same response format as `transcribe-1-pro`, plus written or spoken numbers, a verbatim option, and key terms. Send `model: transcribe-2-pro` explicitly. - **`transcribe-1`**: general transcription of short recordings. A request whose `model` header is missing or not an exact match is served by this model. To transcribe live audio, `transcribe-stream-1` (Preview) streams transcripts turn by turn over a WebSocket, with turn detection for voice agents. It is available through the API; see [Realtime Speech to Text](/features/speech-to-text/realtime).