> ## Documentation Index
> Fetch the complete documentation index at: https://docs.jiekou.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Fish Audio Text-to-Speech

<Note>
  For best results, we recommend using [audio cloning](/en/docs/models/reference-fish-audio-voice-cloning) to upload reference audio before using this API. This will improve speech quality and reduce latency.
</Note>

Fish Audio converts text into speech.

Supported audio formats:

* WAV / PCM
  * Sample rates: 8kHz, 16kHz, 24kHz, 32kHz, 44.1kHz
  * Default sample rate: 44.1kHz
  * 16-bit, mono

* MP3
  * Sample rates: 32kHz, 44.1kHz
  * Default sample rate: 44.1kHz
  * Mono
  * Bitrates: 64kbps, 128kbps (default), 192kbps

* Opus
  * Sample rate: 48kHz
  * Default sample rate: 48kHz
  * Mono
  * Bitrates: -1000 (automatic), 24kbps, 32kbps (default), 48kbps, 64kbps

## Request Headers

<ParamField header="Content-Type" type="string" required={true}>
  Enum value: `application/json`
</ParamField>

<ParamField header="Authorization" type="string" required={true}>
  Bearer authentication format: Bearer \{\{API Key}}.
</ParamField>

## Request Body

<ParamField body="text" type="string" required={true}>
  The text to convert to speech.
</ParamField>

<ParamField body="temperature" type="number" default={0.9}>
  Controls the randomness of speech generation. Higher values (for example, 1.0) make the output more random, while lower values (for example, 0.1) make it more deterministic. We recommend using `0.9` for the `s1` model.

  Required range: `0 <= x <= 1`
</ParamField>

<ParamField body="top_p" type="number" default={0.9}>
  Controls diversity through nucleus sampling. Lower values (for example, 0.1) make the output more focused, while higher values (for example, 1.0) allow more diversity. We recommend using `0.9` for the `s1` model.

  Required range: `0 <= x <= 1`
</ParamField>

<ParamField body="references" type="ReferenceAudio · object[] | null">
  Reference audio for the voice. This requires MessagePack serialization and will override reference\_voices and reference\_texts.

  <Expandable title="Properties">
    <ParamField body="audio" type="file" required={true}>
      The reference audio file.
    </ParamField>

    <ParamField body="text" type="string" required={true}>
      The reference text corresponding to the audio.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="reference_id" type="string | null">
  The reference model ID for the voice.
</ParamField>

<ParamField body="prosody" type="ProsodyControl · object">
  Prosody control for the voice.

  <Expandable title="Properties">
    <ParamField body="speed" type="number" default={1}>
      Speech speed control.
    </ParamField>

    <ParamField body="volume" type="number" default={0}>
      Speech volume control.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="chunk_length" type="integer" default={200}>
  The chunk length for the voice.

  Required range: `100 <= x <= 300`
</ParamField>

<ParamField body="normalize" type="boolean" default={true}>
  Whether to normalize the speech. This will reduce latency, but may reduce performance when handling numbers and dates.
</ParamField>

<ParamField body="format" type="enum<string>" default="mp3">
  The format for the speech.

  Optional values: `wav`, `pcm`, `mp3`, `opus`
</ParamField>

<ParamField body="sample_rate" type="integer | null">
  The sample rate for the speech.
</ParamField>

<ParamField body="mp3_bitrate" type="enum<integer>" default={128}>
  The MP3 bitrate for the speech.

  Optional values: `64`, `128`, `192`
</ParamField>

<ParamField body="opus_bitrate" type="enum<integer>" default={32}>
  The Opus bitrate for the speech.

  Optional values: `-1000`, `24`, `32`, `48`, `64`
</ParamField>

<ParamField body="latency" type="enum<string>" default="normal">
  The latency setting for the speech. `balanced` reduces latency but may cause performance degradation.

  Optional values: `normal`, `balanced`
</ParamField>

## Response Information

The API will directly return an audio stream in the format specified by the `format` parameter (default: mp3).
