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

# Create Translation

> Translate audio into English text

```
POST /v1/audio/translations
```

Translates audio into English text. This endpoint takes audio in any supported language and outputs the transcription in English.

## Request Body

This endpoint accepts `multipart/form-data`.

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

<ParamField body="model" type="string" required>
  The model to use for translation (e.g., `whisper-1`).
</ParamField>

<ParamField body="prompt" type="string">
  Optional text to guide the model's style. Should be in English.
</ParamField>

<ParamField body="response_format" type="string" default="json">
  The output format. Options: `json`, `text`, `srt`, `verbose_json`, `vtt`.
</ParamField>

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

## Response

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

## Examples

### Basic Translation

<CodeGroup>
  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="sk-voidai-your_key_here",
      base_url="https://api.voidai.app/v1"
  )

  # Translate French audio to English
  with open("french_audio.mp3", "rb") as audio_file:
      translation = client.audio.translations.create(
          model="whisper-1",
          file=audio_file
      )

  print(translation.text)
  ```

  ```typescript TypeScript theme={null}
  import OpenAI from 'openai';
  import fs from 'fs';

  const client = new OpenAI({
    apiKey: 'sk-voidai-your_key_here',
    baseURL: 'https://api.voidai.app/v1'
  });

  // Translate French audio to English
  const translation = await client.audio.translations.create({
    model: 'whisper-1',
    file: fs.createReadStream('french_audio.mp3')
  });

  console.log(translation.text);
  ```

  ```bash cURL theme={null}
  curl https://api.voidai.app/v1/audio/translations \
    -H "Authorization: Bearer sk-voidai-your_key_here" \
    -F file="@french_audio.mp3" \
    -F model="whisper-1"
  ```
</CodeGroup>

### With Prompt Guidance

<CodeGroup>
  ```python Python theme={null}
  with open("japanese_meeting.mp3", "rb") as audio_file:
      translation = client.audio.translations.create(
          model="whisper-1",
          file=audio_file,
          prompt="This is a business meeting discussion about quarterly sales."
      )
  ```

  ```bash cURL theme={null}
  curl https://api.voidai.app/v1/audio/translations \
    -H "Authorization: Bearer sk-voidai-your_key_here" \
    -F file="@japanese_meeting.mp3" \
    -F model="whisper-1" \
    -F prompt="This is a business meeting discussion about quarterly sales."
  ```
</CodeGroup>

### SRT Subtitles in English

<CodeGroup>
  ```python Python theme={null}
  with open("german_video.mp3", "rb") as audio_file:
      translation = client.audio.translations.create(
          model="whisper-1",
          file=audio_file,
          response_format="srt"
      )

  # Save English subtitles
  with open("english_subtitles.srt", "w") as f:
      f.write(translation)
  ```

  ```bash cURL theme={null}
  curl https://api.voidai.app/v1/audio/translations \
    -H "Authorization: Bearer sk-voidai-your_key_here" \
    -F file="@german_video.mp3" \
    -F model="whisper-1" \
    -F response_format="srt" \
    -o english_subtitles.srt
  ```
</CodeGroup>

## Response Example

```json theme={null}
{
  "text": "Hello, welcome to our presentation. Today we will discuss the new features of our product."
}
```

## Supported Languages

The translation endpoint accepts audio in any of the following languages and translates to English:

| Language   | Code | Language   | Code |
| ---------- | ---- | ---------- | ---- |
| Afrikaans  | af   | Korean     | ko   |
| Arabic     | ar   | Latvian    | lv   |
| Chinese    | zh   | Lithuanian | lt   |
| Czech      | cs   | Malay      | ms   |
| Danish     | da   | Norwegian  | no   |
| Dutch      | nl   | Polish     | pl   |
| Finnish    | fi   | Portuguese | pt   |
| French     | fr   | Romanian   | ro   |
| German     | de   | Russian    | ru   |
| Greek      | el   | Spanish    | es   |
| Hebrew     | he   | Swedish    | sv   |
| Hindi      | hi   | Thai       | th   |
| Hungarian  | hu   | Turkish    | tr   |
| Indonesian | id   | Ukrainian  | uk   |
| Italian    | it   | Vietnamese | vi   |
| Japanese   | ja   |            |      |

<Info>
  Unlike transcription, translation always outputs English text regardless of the input language.
</Info>
