aimldocs
Guides

Speech

Transcribe audio and turn text into speech through the same key and balance, with the OpenAI SDK unchanged.

Two routes serve speech models, in OpenAI's shape, so the OpenAI SDKs' audio calls work once the base URL points at ai.ml.

Transcription

POST /v1/audio/transcriptions takes a multipart upload: the audio file (at most 25 MB) and a speech-to-text model, with language, prompt, temperature and response_format as OpenAI defines them. The answer is the transcript as json (the default), text, srt, verbose_json or vtt.

A JSON answer carries an aiml object beside OpenAI's fields: the request id, the host that served it, and what it cost. Every answer has the x-aiml-request-id and x-aiml-cost-micro headers.

A transcription is billed by the seconds of audio the host counted. When the format you asked for carries no length (text, srt, vtt), the gateway's own count is used: exact for a WAV file, an estimate for compressed audio. Models priced by tokens bill the tokens the host reports.

Speech

POST /v1/audio/speech takes JSON: the model, the input text (at most 4,096 characters), a voice, and optionally response_format (mp3, opus, aac, flac, wav, pcm), speed and instructions. The audio streams back as the host produces it.

Speech is billed by the characters of input. A speech model's input price in the catalog is per character: $15 per million characters is $0.000015 a character.

Which models

The models page lists them: a transcription model takes audio in and gives text out, a speech model the reverse. Only those models are served on these routes, and they are not served as chat models: a chat request naming one is refused with the route to use.

Budgets, rate limits, the request log, usage and data policies apply as they do to chat. The request log shows a transcription's seconds of audio, and a speech request's characters as input.

On this page