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

# Transcriptions

> Transcribe audio files to text, with optional timestamps, through an OpenAI-compatible route.

A transcription model turns speech into text: voice messages, video soundtracks, recordings. On request, it also returns timestamps per segment or per word.

`POST /api/v1/hub/audio/transcriptions` transcribes one audio file synchronously, with the OpenAI Audio Transcriptions contract. A client built with an OpenAI SDK only needs to change its base URL to `https://fanifyai.com/api/v1/hub`.

## Transcribe a file

```bash cURL theme={null}
curl https://fanifyai.com/api/v1/hub/audio/transcriptions \
  -H "Authorization: Bearer $FANIFY_API_KEY" \
  -H "Idempotency-Key: 0192f3a4-8c1e-7b2a-9f10-2b6d4e0c9a11" \
  -F file=@voice.mp3 \
  -F model=voxtral-mini-transcribe-3-0 \
  -F language=fr \
  -F response_format=json
```

```python Python theme={null}
import os
import uuid
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["FANIFY_API_KEY"],
    base_url="https://fanifyai.com/api/v1/hub",
)

with open("voice.mp3", "rb") as audio:
    transcription = client.audio.transcriptions.create(
        model="voxtral-mini-transcribe-3-0",
        file=audio,
        language="fr",
        response_format="json",
        extra_headers={"Idempotency-Key": str(uuid.uuid4())},
    )
print(transcription.text)
```

```csharp .NET theme={null}
using System.ClientModel;
using OpenAI;
using OpenAI.Audio;

var client = new AudioClient(
    "voxtral-mini-transcribe-3-0",
    new ApiKeyCredential(Environment.GetEnvironmentVariable("FANIFY_API_KEY")!),
    new OpenAIClientOptions { Endpoint = new Uri("https://fanifyai.com/api/v1/hub") });

AudioTranscription transcription = await client.TranscribeAudioAsync("voice.mp3",
    new AudioTranscriptionOptions { Language = "fr", ResponseFormat = AudioTranscriptionFormat.Simple });
Console.WriteLine(transcription.Text);
```

Find transcription models in `GET /api/v1/hub/models`: their `output_modalities` contain `transcription`. Examples: `voxtral-mini-transcribe-3-0`, `voxtral-small-transcribe-3-0`, `qwen3-asr-1.7b`, `whisper-large-v3-turbo`. Call a transcription model through this route only; other routes, including `POST /api/v1/hub/generations`, reject it with `400 invalid_input`, and this route rejects chat, decision, embeddings, and media models the same way.

## Request

Send the audio file itself, as `multipart/form-data` (recommended) or as JSON. The Hub never downloads an audio URL, and it does not accept a `sha256:` reference to an uploaded file.

### `multipart/form-data`

| Part | Required | Content |
| - | - | - |
| `file` | yes, exactly one | The audio file, up to 25 MB |
| `model` | yes | Transcription model `id` from the catalog |
| `language` | no | Language of the audio, ISO-639-1 code (`fr`, `en`…); detected by the model when absent |
| `response_format` | no | `json` (default) or `verbose_json`; `text`, `srt`, and `vtt` are refused |
| `timestamp_granularities[]` | no | `segment` and/or `word`, one part per value; only with `verbose_json` |
| `temperature` | no | Sampling temperature, from 0 to 1 |
| `prompt` | no | Context text; some models ignore it |

`diarize` and `keyterms` are forwarded to models that support them. Unknown parts are ignored. Part names are accepted with or without quotes.

### JSON

```bash theme={null}
curl https://fanifyai.com/api/v1/hub/audio/transcriptions \
  -H "Authorization: Bearer $FANIFY_API_KEY" \
  -H "Idempotency-Key: 0192f3a4-8c1e-7b2a-9f10-2b6d4e0c9a12" \
  -H "Content-Type: application/json" \
  -d @body.json
```

```json body.json theme={null}
{
  "model": "voxtral-mini-transcribe-3-0",
  "input_audio": { "data": "UklGRlYAAABXQVZFZm10IBAAAAAB…", "format": "wav" },
  "language": "fr"
}
```

`input_audio.data` is the file encoded in raw base64, **without** a `data:audio/…;base64,` prefix; decoded, it must not exceed 25 MB. `input_audio.format` gives the audio format. The other fields are the same as in multipart; `timestamp_granularities` is then an array. `input_audio.url` is refused. Prefer multipart: base64 makes the request a third larger.

### Audio formats

Accepted formats: `mp3`, `wav`, `ogg`, `webm`, `m4a`, `mp4`, `flac`, `aac`. The Hub determines the format from `input_audio.format`, otherwise from the file name extension, otherwise from the part's `Content-Type`, otherwise from the file content. When none of these gives a format, the request is refused with `400 unsupported_audio_format`. Supported formats and languages can vary by model.

25 MB is about 36 minutes of voice at 96 kbps. A very long recording can still exceed the model's processing time and fail with `provider_error`: split it into shorter files.

Authentication, the Hub pause, and audio capacity are checked before the file is read: a refused request does not wait for the upload to finish.

## Response

With `response_format: json`:

```json theme={null}
{
  "text": "Salut, tu fais quoi ce soir ?",
  "usage": { "seconds": 3.2, "cost": 0.000187 }
}
```

With `response_format: verbose_json` and `timestamp_granularities[]` set to `segment` and `word`:

```json theme={null}
{
  "text": "Salut, tu fais quoi ce soir ?",
  "language": "fr",
  "duration": 3.2,
  "segments": [
    { "id": 0, "start": 0.0, "end": 3.2, "text": "Salut, tu fais quoi ce soir ?" }
  ],
  "words": [
    { "word": "Salut", "start": 0.0, "end": 0.48 },
    { "word": "tu", "start": 0.62, "end": 0.71 }
  ],
  "usage": { "seconds": 3.2, "cost": 0.000187 }
}
```

The model's response is forwarded as is, with these changes: `usage.cost` is the billed amount in EUR, and provider details are removed. `text`, `segments`, `words`, `language`, and `duration` are never modified. Timestamps are in seconds. `verbose_json`, word timestamps, `diarize`, and `keyterms` depend on the model: a model that does not support them returns `provider_error`.

A `200` response also includes:

```text theme={null}
X-Fanify-Generation-Id: 0192f3a4-8c1e-7b2a-9f10-2b6d4e0c9a11
X-Fanify-Billed-Cost: 0.000187
```

The response body has no `id`: the generation identifier is in `X-Fanify-Generation-Id`. `X-Fanify-Billed-Cost` is the billed amount in EUR, always written with a dot as decimal separator.

Each transcription is recorded as a generation with `is_llm: true`: it appears in `GET /api/v1/hub/generations` (excluded by `media_only=true`) and triggers the `generation.running` and `generation.completed` webhooks, whose `data` contains the response. The audio is never stored: it is deleted as soon as the call ends. The transcribed text is kept for the retention period, to serve replays.

## Idempotency

> [!TIP]
>
> Use one new `Idempotency-Key` per audio file, and keep it when you retry after a network failure. Keys share one space across all Hub routes: a key already used by another request replays that request's result.

* A replay with the same key, the same audio, and the same fields returns the same body and headers, without a new model call or charge. This also holds when you switch between multipart and JSON, and whatever the order of the parts. A failed request replays the same error.
* A replay while the request is still running returns `503 generation_in_progress` with `Retry-After: 5`.
* The same key with another audio file or another field value (for example `language`) returns `422 idempotency_conflict`.
* After the retention period of the stored response (24 hours by default), a replay returns `410 file_expired`.

## Errors

Errors use the OpenAI-compatible envelope:

```json theme={null}
{
  "error": {
    "message": "The request input is invalid.",
    "code": "invalid_input",
    "type": "invalid_request_error"
  }
}
```

`error.metadata.provider_name` is present only on a `provider_error`, when the routed model failed. Errors raised by the Hub itself (validation, credits, rate limit, capacity, pause) have no `metadata`, except the replay of a failed generation, which returns its original envelope with `metadata.provider_name`. An authentication failure returns `401 unauthorized` as Problem Details, before the audio is read.

| HTTP | `code` | Cause |
| - | - | - |
| 400 | `invalid_input` | `Content-Type` neither `multipart/form-data` nor `application/json`; unreadable JSON or multipart body; `model` missing; `file` missing, empty, or sent twice; `response_format` other than `json` or `verbose_json`; `stream` sent; audio URL (`input_audio.url`, `source_url`); `input_audio.data` not raw base64; or the model is not a transcription model |
| 400 | `unsupported_audio_format` | The audio format cannot be determined |
| 402 | `insufficient_credits` | The available balance does not cover the request |
| 404 | `model_not_found` | Unknown or unavailable model |
| 410 | `file_expired` | Replay after the retention period |
| 413 | `payload_too_large` | Audio larger than 25 MB, or request body larger than the route's limit |
| 422 | `idempotency_conflict`, `no_route_available` | Key reused with another audio or other fields; no executable route |
| 429 | `rate_limited`, `capacity_exhausted` | Request rate limit of the key; no capacity available right now, including when the Hub is already receiving too much audio at once (see [Errors](https://docs.fanifyai.com/en/hub/errors.md#capacity_exhausted)). Both include `Retry-After` |
| 503 | `hub_paused`, `generation_in_progress` | The Hub is not accepting new requests; same key still running |
| 503 | `interrupted` | Replay of a transcription interrupted by a Hub restart |
| 500 | `internal_error` | Problem on the FanifyHub side; no internal detail is exposed |
| 4xx / 503 | `provider_error` | The routed model failed (for example an unsupported language or option): its `4xx` status is kept, except `401` and `402` which become `503`; any other failure returns `503` |

Transcriptions have their own request rate limit per key, separate from the other Hub routes. A failed request is never billed. See [Errors](https://docs.fanifyai.com/en/hub/errors.md) for the meaning of each code.

## Pricing

A transcription is billed per second of audio, at the `price_per_audio_second` rate shown for your account in `GET /api/v1/hub/models`. Transcription models have no per-token rate. `usage.seconds` is the audio duration counted by the model. The billed amount is rounded **up** to six decimal places: a call with a non-zero cost is billed at least €0.000001, never €0.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.