# Speech to text
URL: https://docs.munito.ai/features/speech-to-text

Munito AI transcribes speech with an audio model, such as [Gemma 4 12B](https://docs.munito.ai/models/google-gemma-4-12b) (`google/gemma-4-12b`).
Use the OpenAI speech to text API for a recording, or put a short clip into a chat request.
The [model list](https://docs.munito.ai/api/listModels) shows the models that your key can use.

## Transcribe a file [#transcribe-a-file]

```bash
curl https://api.munito.ai/inference/v1/audio/transcriptions \
  -H "Authorization: Bearer $MUNITO_API_KEY" \
  -F file=@meeting.mp3 \
  -F model=google/gemma-4-12b \
  -F language=en
```

The answer holds the text and the token usage:

```json
{
  "text": "The invoice is due on 14 November, and the total is 1,250 euros.",
  "usage": {
    "type": "tokens",
    "input_tokens": 412,
    "input_token_details": { "text_tokens": 87, "audio_tokens": 325 },
    "output_tokens": 19,
    "total_tokens": 431
  }
}
```

### Use the OpenAI Python client [#use-the-openai-python-client]

```python
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.munito.ai/inference/v1",
    api_key=os.environ["MUNITO_API_KEY"],
)
with open("meeting.mp3", "rb") as audio:
    transcription = client.audio.transcriptions.create(
        model="google/gemma-4-12b",
        file=audio,
        language="en",
    )
print(transcription.text)
```

### Use the OpenAI JavaScript client [#use-the-openai-javascript-client]

```ts
import fs from "node:fs";
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.munito.ai/inference/v1",
  apiKey: process.env.MUNITO_API_KEY,
});
const transcription = await client.audio.transcriptions.create({
  model: "google/gemma-4-12b",
  file: fs.createReadStream("meeting.mp3"),
  language: "en",
});
console.log(transcription.text);
```

## Fields [#fields]

| Field             | Value                                                                                                    |
| ----------------- | -------------------------------------------------------------------------------------------------------- |
| `file`            | The recording. Required.                                                                                 |
| `model`           | An audio model, such as `google/gemma-4-12b`. Required.                                                  |
| `language`        | The language of the audio as an ISO 639-1 code, such as `de`. Omit it to keep the language of the audio. |
| `prompt`          | Names and terms to spell correctly, at most 2,000 characters.                                            |
| `response_format` | `json` (the default) gives the text and the usage. `text` gives the plain text.                          |
| `temperature`     | From 0 to 1. The default is 0.                                                                           |

Timestamps (`timestamp_granularities[]`), word log probabilities (`include[]`), other response formats, and streaming are not available. A request with one of them gets `400`.

## Formats and limits [#formats-and-limits]

- One file of WAV, MP3, FLAC, OGG, WebM, MP4 or M4A audio.
- At most 25 MB and 60 minutes. A larger file gets `413`, and a longer recording gets `400`.
- Munito AI cuts a recording longer than 30 seconds at its quietest points, transcribes the clips, and joins their text in order. A space joins two clips, except in Japanese and Chinese.

## Languages [#languages]

Gemma 4 12B is tested on English, German, French, Spanish, Italian, Brazilian Portuguese, Russian, Arabic, Japanese and Korean.
The `language` field takes the codes of OpenAI's speech models, such as `nl`, `pl` or `uk`. Accuracy can be lower in a language outside the tested list.

## Usage and price [#usage-and-price]

A transcription bills its input and output tokens at the chat prices of the model.
One second of audio is 25 input tokens, so one minute is 1,500 input tokens.
Munito AI ends each clip with half a second of silence, so the model hears the last word, and the count includes it.
`input_token_details.audio_tokens` counts the audio, and `text_tokens` counts the instructions around each clip.
The model has one input price for text and audio tokens. The console shows the prices of each model.

## Audio in a chat request [#audio-in-a-chat-request]

A chat request can hold up to 4 audio clips of at most 30 seconds each. Send each clip as an `input_audio` part with base64 `data` and its `format`. Put the text before the audio.

```python
import base64

with open("question.wav", "rb") as audio:
    clip = base64.b64encode(audio.read()).decode()
response = client.chat.completions.create(
    model="google/gemma-4-12b",
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "Answer the question in this recording."},
                {"type": "input_audio", "input_audio": {"data": clip, "format": "wav"}},
            ],
        }
    ],
)
print(response.choices[0].message.content)
```

The `format` names the container: `wav`, `mp3`, `flac`, `ogg`, `webm`, `m4a` or `mp4`. A clip longer than 30 seconds gets `400`. Send a longer recording to the transcription endpoint.
See the [transcription reference](https://docs.munito.ai/api/createTranscription) and the [chat reference](https://docs.munito.ai/api/createChatCompletion).
