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

# Audio speech, transcription, and translation

> Synthesize speech from a text string, transcribe uploaded audio files to text, or translate audio into English using TokModel's three audio endpoints.

TokModel provides three audio endpoints: one that synthesizes speech from a text string, one that transcribes an audio file into text, and one that translates an audio file directly into English. The text-to-speech endpoint returns an audio binary, while transcription and translation return text. Select the tab below for the endpoint you need.

<Tabs>
  <Tab title="Text-to-speech">
    ## POST /v1/audio/speech

    Convert a text string into spoken audio. The response is a binary audio file in the format specified by `response_format`. You can stream the audio by reading the response body incrementally.

    ### Request parameters

    <ParamField body="model" type="string" required>
      The text-to-speech model to use. Use the [list models](/api-reference/models) endpoint for available TTS model IDs.
    </ParamField>

    <ParamField body="input" type="string" required>
      The text to synthesize into speech. Maximum length depends on the model.
    </ParamField>

    <ParamField body="voice" type="string" required>
      The voice to use for synthesis. Available voices depend on the model. Common options include `"alloy"`, `"echo"`, `"fable"`, `"onyx"`, `"nova"`, and `"shimmer"`.
    </ParamField>

    <ParamField body="response_format" type="string" default="mp3">
      The audio format for the output. Supported values: `"mp3"`, `"opus"`, `"aac"`, `"flac"`, `"wav"`, and `"pcm"`.
    </ParamField>

    <ParamField body="speed" type="number" default="1.0">
      Playback speed of the generated audio, between `0.25` and `4.0`. Values above `1.0` speed up speech; values below `1.0` slow it down.
    </ParamField>

    ### Example

    The response body is the raw audio binary. Pipe it directly to a file:

    ```bash theme={null}
    curl https://tokmodel.com/v1/audio/speech \
      --request POST \
      --header "Authorization: Bearer YOUR_API_KEY" \
      --header "Content-Type: application/json" \
      --data '{
        "model": "openai/tts-1",
        "input": "Welcome to TokModel, your unified LLM API gateway.",
        "voice": "nova",
        "response_format": "mp3",
        "speed": 1.0
      }' \
      --output speech.mp3
    ```
  </Tab>

  <Tab title="Transcription">
    ## POST /v1/audio/transcriptions

    Transcribe an audio file into text. The audio file is uploaded as a multipart form field. The returned text is in the language spoken in the audio file unless you override it with the `language` parameter.

    ### Request parameters

    <ParamField body="file" type="file" required>
      The audio file to transcribe, uploaded via `multipart/form-data`. Supported formats: `flac`, `mp3`, `mp4`, `mpeg`, `mpga`, `m4a`, `ogg`, `wav`, `webm`.
    </ParamField>

    <ParamField body="model" type="string" required>
      The transcription model to use. Use the [list models](/api-reference/models) endpoint for available options (for example, `openai/whisper-1`).
    </ParamField>

    <ParamField body="language" type="string">
      The language of the audio in ISO-639-1 format (for example, `"en"`, `"fr"`, `"de"`). Providing this improves accuracy and speed.
    </ParamField>

    <ParamField body="response_format" type="string" default="json">
      The format of the transcription output. One of `"json"`, `"text"`, `"srt"`, `"verbose_json"`, or `"vtt"`.
    </ParamField>

    <ParamField body="temperature" type="number" default="0">
      Sampling temperature between `0` and `1`. Lower values produce more accurate, deterministic transcriptions.
    </ParamField>

    ### Example

    ```bash theme={null}
    curl https://tokmodel.com/v1/audio/transcriptions \
      --request POST \
      --header "Authorization: Bearer YOUR_API_KEY" \
      --form "file=@/path/to/recording.mp3" \
      --form "model=openai/whisper-1" \
      --form "language=en" \
      --form "response_format=json"
    ```

    ### Response

    ```json theme={null}
    {
      "text": "The quick brown fox jumps over the lazy dog."
    }
    ```
  </Tab>

  <Tab title="Translation">
    ## POST /v1/audio/translations

    Transcribe an audio file and translate the content into English in a single step. This endpoint always returns English text, regardless of the language spoken in the audio file.

    ### Request parameters

    <ParamField body="file" type="file" required>
      The audio file to translate, uploaded via `multipart/form-data`. Supported formats: `flac`, `mp3`, `mp4`, `mpeg`, `mpga`, `m4a`, `ogg`, `wav`, `webm`.
    </ParamField>

    <ParamField body="model" type="string" required>
      The translation model to use.
    </ParamField>

    <ParamField body="response_format" type="string" default="json">
      The format of the translation output. One of `"json"`, `"text"`, `"srt"`, `"verbose_json"`, or `"vtt"`.
    </ParamField>

    <ParamField body="temperature" type="number" default="0">
      Sampling temperature between `0` and `1`.
    </ParamField>

    ### Example

    ```bash theme={null}
    curl https://tokmodel.com/v1/audio/translations \
      --request POST \
      --header "Authorization: Bearer YOUR_API_KEY" \
      --form "file=@/path/to/french-audio.mp3" \
      --form "model=openai/whisper-1" \
      --form "response_format=json"
    ```

    ### Response

    ```json theme={null}
    {
      "text": "Hello, my name is Marie and I live in Paris."
    }
    ```
  </Tab>
</Tabs>
