> ## 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 Transcription

> Transcribe audio into text

```
POST /v1/audio/transcriptions
```

Transcribes audio into text in the language of the audio.

## Request Body

This endpoint accepts `multipart/form-data`.

<ParamField body="file" type="file" required>
  The audio file to transcribe. 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 transcription (e.g., `whisper-1`).
</ParamField>

<ParamField body="language" type="string">
  The language of the audio in ISO-639-1 format (e.g., `en`, `es`, `fr`). Providing the language improves accuracy.
</ParamField>

<ParamField body="prompt" type="string">
  Optional text to guide the model's style or continue a previous transcript. Should match the audio language.
</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. Higher values make output more random.
</ParamField>

## Response

Varies based on `response_format`:

### JSON Response (default)

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

### Verbose JSON Response

<ResponseField name="task" type="string">
  The task performed (`transcribe`).
</ResponseField>

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

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

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

<ResponseField name="segments" type="array">
  Array of transcript segments with timestamps.
</ResponseField>

## Examples

### Basic Transcription

<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"
  )

  with open("audio.mp3", "rb") as audio_file:
      transcript = client.audio.transcriptions.create(
          model="whisper-1",
          file=audio_file
      )

  print(transcript.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'
  });

  const transcript = await client.audio.transcriptions.create({
    model: 'whisper-1',
    file: fs.createReadStream('audio.mp3')
  });

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

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

### With Language Hint

<CodeGroup>
  ```python Python theme={null}
  with open("spanish_audio.mp3", "rb") as audio_file:
      transcript = client.audio.transcriptions.create(
          model="whisper-1",
          file=audio_file,
          language="es"
      )
  ```

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

### SRT Subtitles

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

  # Save as subtitle file
  with open("subtitles.srt", "w") as f:
      f.write(transcript)
  ```

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

### Verbose JSON with Timestamps

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

  print(f"Language: {transcript.language}")
  print(f"Duration: {transcript.duration}s")
  for segment in transcript.segments:
      print(f"[{segment['start']:.2f}s - {segment['end']:.2f}s] {segment['text']}")
  ```
</CodeGroup>

## Response Examples

### JSON Response

```json theme={null}
{
  "text": "Hello, this is a test transcription of an audio file."
}
```

### Verbose JSON Response

```json theme={null}
{
  "task": "transcribe",
  "language": "english",
  "duration": 5.42,
  "text": "Hello, this is a test transcription of an audio file.",
  "segments": [
    {
      "id": 0,
      "start": 0.0,
      "end": 2.5,
      "text": "Hello, this is a test",
      "tokens": [50364, 2425, 11, 341, 307, 257, 1500],
      "temperature": 0.0,
      "avg_logprob": -0.25,
      "compression_ratio": 1.2,
      "no_speech_prob": 0.01
    },
    {
      "id": 1,
      "start": 2.5,
      "end": 5.42,
      "text": " transcription of an audio file.",
      "tokens": [50489, 1112, 11, 295, 364, 6279, 2058],
      "temperature": 0.0,
      "avg_logprob": -0.22,
      "compression_ratio": 1.1,
      "no_speech_prob": 0.02
    }
  ]
}
```

### SRT Response

```srt theme={null}
1
00:00:00,000 --> 00:00:02,500
Hello, this is a test

2
00:00:02,500 --> 00:00:05,420
transcription of an audio file.
```

## Tips

<AccordionGroup>
  <Accordion title="Specify the language">
    Providing the `language` parameter improves accuracy, especially for non-English audio or audio with accents.
  </Accordion>

  <Accordion title="Use prompts for context">
    The `prompt` parameter can help with proper nouns, technical terms, or specific formatting expectations.
  </Accordion>

  <Accordion title="Choose the right format">
    Use `srt` or `vtt` for subtitles, `verbose_json` when you need timestamps, or plain `text` for simple transcripts.
  </Accordion>
</AccordionGroup>
