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

# Audio: transcription, translation, and speech synthesis

> Transcribe speech to text, translate audio into English, or synthesize speech from text using the /v1/audio/* endpoints. Works with OpenAI Whisper clients.

Anyone provides three audio endpoints compatible with the OpenAI Audio API. You can transcribe speech to text, translate audio in any language into English, or generate spoken audio from a text string. Anyone routes your requests to the best available audio model automatically.

***

## POST /v1/audio/transcriptions

Convert an audio file to text in its original language. Compatible with OpenAI Whisper.

### Request body

This endpoint uses `multipart/form-data` encoding.

<ParamField body="model" type="string" required>
  The transcription model to use. For example, `whisper-1`. The available values depend on your configured channels.
</ParamField>

<ParamField body="file" type="file" required>
  The audio file to transcribe. Supported formats include `mp3`, `mp4`, `mpeg`, `mpga`, `m4a`, `ogg`, `wav`, and `webm`. Maximum file size is 25 MB.
</ParamField>

<ParamField body="language" type="string">
  The language of the audio, as an ISO-639-1 code (e.g., `en`, `zh`, `fr`). Providing this hint improves accuracy and speed. If omitted, the model detects the language automatically.
</ParamField>

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

<ParamField body="instructions" type="string">
  Optional text to guide the model's transcription style or vocabulary.
</ParamField>

### Response

For `response_format: json`, the response is:

<ResponseField name="text" type="string">
  The transcribed text.
</ResponseField>

For `response_format: verbose_json`, additional fields are returned:

<ResponseField name="task" type="string">
  Always `"transcribe"`.
</ResponseField>

<ResponseField name="language" type="string">
  The detected or provided language.
</ResponseField>

<ResponseField name="duration" type="number">
  Duration of the audio in seconds.
</ResponseField>

<ResponseField name="segments" type="object[]">
  Time-aligned segments of the transcription.

  <Expandable title="segment properties">
    <ResponseField name="id" type="integer">Segment index.</ResponseField>
    <ResponseField name="start" type="number">Start time in seconds.</ResponseField>
    <ResponseField name="end" type="number">End time in seconds.</ResponseField>
    <ResponseField name="text" type="string">Transcribed text for this segment.</ResponseField>
    <ResponseField name="temperature" type="number">Model temperature used for this segment.</ResponseField>
    <ResponseField name="avg_logprob" type="number">Average log probability for this segment.</ResponseField>
    <ResponseField name="compression_ratio" type="number">Compression ratio of the segment text.</ResponseField>
    <ResponseField name="no_speech_prob" type="number">Probability that this segment contains no speech.</ResponseField>
  </Expandable>
</ResponseField>

### Example

```bash curl theme={null}
curl https://api.anyone.ai/v1/audio/transcriptions \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -F model="whisper-1" \
  -F file="@recording.mp3" \
  -F language="en" \
  -F response_format="json"
```

***

## POST /v1/audio/translations

Transcribe and translate an audio file into English, regardless of the source language.

### Request body

This endpoint uses `multipart/form-data` encoding.

<ParamField body="model" type="string" required>
  The model to use for translation. For example, `whisper-1`.
</ParamField>

<ParamField body="file" type="file" required>
  The audio file to translate. Same format restrictions as `/v1/audio/transcriptions`.
</ParamField>

<ParamField body="response_format" type="string">
  Output format: `json`, `text`, `srt`, `verbose_json`, or `vtt`. Defaults to `json`.
</ParamField>

<ParamField body="instructions" type="string">
  Optional text to guide the model's translation style.
</ParamField>

### Response

<ResponseField name="text" type="string">
  The translated text in English.
</ResponseField>

### Example

```bash curl theme={null}
curl https://api.anyone.ai/v1/audio/translations \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -F model="whisper-1" \
  -F file="@french-audio.mp3" \
  -F response_format="json"
```

***

## POST /v1/audio/speech

Generate spoken audio from a text string (text-to-speech).

### Request body

<ParamField body="model" type="string" required>
  The TTS model to use. For example, `tts-1` or `tts-1-hd`. `tts-1-hd` produces higher-quality audio at higher cost.
</ParamField>

<ParamField body="input" type="string" required>
  The text to convert to speech. Maximum length is 4,096 characters.
</ParamField>

<ParamField body="voice" type="string" required>
  The voice to use for synthesis. OpenAI TTS supports `alloy`, `echo`, `fable`, `onyx`, `nova`, and `shimmer`. The available voices depend on your configured provider.
</ParamField>

<ParamField body="response_format" type="string">
  The audio output format. One of `mp3`, `opus`, `aac`, or `flac`. Defaults to `mp3`.
</ParamField>

<ParamField body="speed" type="number">
  The playback speed of the generated audio. A value between `0.25` and `4.0`. Defaults to `1.0`.
</ParamField>

<ParamField body="instructions" type="string">
  Optional text instructions to control speaking style, tone, or pacing.
</ParamField>

### Response

The response body is raw audio binary data in the format specified by `response_format`. Set your HTTP client to save the response directly to a file.

### Example

<CodeGroup>
  ```bash curl theme={null}
  curl https://api.anyone.ai/v1/audio/speech \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "tts-1",
      "input": "Welcome to Anyone, your unified AI gateway.",
      "voice": "nova",
      "response_format": "mp3"
    }' \
    --output speech.mp3
  ```

  ```python python theme={null}
  from openai import OpenAI
  from pathlib import Path

  client = OpenAI(
      api_key="YOUR_TOKEN",
      base_url="https://api.anyone.ai/v1",
  )

  response = client.audio.speech.create(
      model="tts-1",
      voice="nova",
      input="Welcome to Anyone, your unified AI gateway.",
  )

  Path("speech.mp3").write_bytes(response.content)
  ```
</CodeGroup>
