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

# Speech to Text

> Transcribe audio files to text using Whisper and other transcription models.

## Endpoint

```http theme={null}
POST https://api.samuraiapi.in/v1/audio/transcriptions
```

## Parameters

| Parameter         | Type   | Required | Description                                   |
| ----------------- | ------ | -------- | --------------------------------------------- |
| `file`            | file   | ✅        | Audio file (mp3, mp4, wav, m4a, webm, ogg)    |
| `model`           | string | ✅        | `whisper-1`                                   |
| `language`        | string | —        | ISO-639-1 language code (e.g. `"en"`, `"ja"`) |
| `prompt`          | string | —        | Context hint to improve accuracy              |
| `response_format` | string | —        | `json` (default), `text`, `srt`, `vtt`        |
| `temperature`     | number | —        | Sampling temperature 0–1                      |

## Code Examples

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

  client = OpenAI(
      api_key="sk-samurai-YOUR_KEY",
      base_url="https://api.samuraiapi.in/v1"
  )

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

  print(transcript)
  ```

  ```javascript Node.js theme={null}
  import fs from 'fs';

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

  console.log(transcript);
  ```

  ```bash cURL theme={null}
  curl https://api.samuraiapi.in/v1/audio/transcriptions \
    -H "Authorization: Bearer sk-samurai-YOUR_KEY" \
    -F model="whisper-1" \
    -F file="@audio.mp3" \
    -F language="en"
  ```
</CodeGroup>

## Subtitle Generation (SRT)

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

with open("subtitles.srt", "w") as f:
    f.write(srt)
```

## Supported Languages

Whisper supports 99 languages including English, Spanish, French, German, Japanese, Chinese, Arabic, Hindi, Portuguese, and more.

## Pricing

`whisper-1`: \*\*$0.003/minute** (Samurai AI 50% discount from $0.006)
