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

# OpenAI compatibility

> Use A5S Async v1 with OpenAI SDKs and other tools that speak OpenAI's transcription API.

Model: [A5S Async v1](https://aircaps.ai/models/a5s-async)

`POST /v1/audio/transcriptions` accepts the same request as OpenAI's transcription endpoint and answers in the same shape. Point an OpenAI SDK, or any tool built for that API, at `https://api.aircaps.com/v1` with your [AirCaps API key](https://aircaps.ai/docs/authentication.md).

It runs the same model as [batch transcription](https://aircaps.ai/docs/guides/async-transcription.md) and returns the same transcript. The request is answered when the transcript is finished.

## Make a request

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

client = OpenAI(api_key="YOUR_AIRCAPS_API_KEY", base_url="https://api.aircaps.com/v1")

with open("meeting.mp3", "rb") as f:
    transcript = client.audio.transcriptions.create(model="a5s-async-v1", file=f)

print(transcript.text)
```

```bash curl theme={null}
curl https://api.aircaps.com/v1/audio/transcriptions \
  -H "Authorization: Bearer $AIRCAPS_API_KEY" \
  -F file=@meeting.mp3 \
  -F model=a5s-async-v1
```

```json theme={null}
{
  "text": "Hey, good afternoon, everybody. ...",
  "usage": {"type": "duration", "seconds": 312.4}
}
```

## Request fields

Send a multipart form.

| Field | Required | |
| - | - | - |
| `file` | One of `file` or `url` | The audio. Any audio or video format works. |
| `url` | One of `file` or `url` | A public or presigned http(s) address of the audio, instead of `file`. |
| `model` | Yes | `a5s-async-v1` |
| `language` | No | The language of the audio: `en` (the default), `es`, `fr`, `de`, `pt`, `hi`, `ja`, `ko` or `zh`, with or without a region (`en-GB`, `pt-BR`). There is no automatic language detection. |
| `response_format` | No | `json` (the default), `verbose_json` or `text`. |
| `timestamp_granularities[]` | No | `word`, `segment` or both, with `verbose_json`. Segments are always included; `word` adds `words`. |
| `diarize` | No | `true` adds the speaker to every segment and word, with `verbose_json`. |
| `keyterms` | No | [Key terms](https://aircaps.ai/docs/guides/async-transcription.md#key-terms): repeat the field once per term. English only. |
| `smart_format` | No | `true` turns on [smart formatting](https://aircaps.ai/docs/guides/async-transcription.md#smart-formatting). |
| `large_meeting` | No | `true` for recordings with [many active speakers](https://aircaps.ai/docs/guides/async-transcription.md#large-meetings). |

Other OpenAI fields, such as `prompt` and `temperature`, are accepted and ignored.

## Timestamps and speakers

Ask for `verbose_json` to get segments, word timestamps and speakers:

```python Python theme={null}
with open("meeting.mp3", "rb") as f:
    transcript = client.audio.transcriptions.create(
        model="a5s-async-v1",
        file=f,
        response_format="verbose_json",
        timestamp_granularities=["word", "segment"],
        extra_body={"diarize": True},
    )

for segment in transcript.segments:
    print(segment.speaker_label, segment.start, segment.text)
```

```bash curl theme={null}
curl https://api.aircaps.com/v1/audio/transcriptions \
  -H "Authorization: Bearer $AIRCAPS_API_KEY" \
  -F file=@meeting.mp3 \
  -F model=a5s-async-v1 \
  -F response_format=verbose_json \
  -F "timestamp_granularities[]=word" \
  -F diarize=true
```

```json theme={null}
{
  "task": "transcribe",
  "language": "en",
  "duration": 312.4,
  "text": "Hey, good afternoon, everybody. ...",
  "segments": [
    {"id": 0, "start": 0.48, "end": 6.12, "text": "Hey, good afternoon, everybody. ...",
     "speaker": 0, "speaker_label": "speaker_0"}
  ],
  "words": [
    {"word": "Hey,", "start": 0.48, "end": 0.71, "speaker": 0, "speaker_label": "speaker_0"}
  ],
  "usage": {"type": "duration", "seconds": 312.4}
}
```

* Times are seconds from the start of the audio.
* A segment is one speaker's turn. Overlapping speech produces overlapping segments.
* `speaker` is a number and `speaker_label` its name (`speaker_0`, `speaker_1`, …), in order of first speech. They are consistent within one transcript only.
* `usage.seconds` is the audio's duration, which is what you are billed for, at the A5S Async v1 price.

## Limits and errors

* The request waits up to 120 seconds for the transcript. If it is not finished by then, the response is `504` with the code `timeout`; the transcript is canceled and you are not billed. For long recordings, use [batch transcription](https://aircaps.ai/docs/guides/async-transcription.md), which has webhooks and polling.
* Errors use the same JSON as the rest of the API: see [Errors](https://aircaps.ai/docs/errors.md). Audio that can't be read returns `400 invalid_audio`.
* `Idempotency-Key`, webhooks and `metadata` are not available on this endpoint. Speaker names, subtitles and transcript ids are part of [batch transcription](https://aircaps.ai/docs/guides/async-transcription.md).
* Your account's [data controls](https://aircaps.ai/docs/data-privacy.md) apply as they do to batch transcription.


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