Skip to main content

Transcription

Transcription is an experimental feature.
The AI SDK provides the transcribe function to transcribe audio using a transcription model.
The audio property can be a Uint8Array, ArrayBuffer, Buffer, string (base64 encoded audio data), or a URL. To access the generated transcript:

Settings

Provider-Specific Settings

Transcription models often have provider or model-specific settings which you can set using the providerOptions parameter.

Download Size Limits

When audio is a URL, the SDK downloads the file with a default 2 GiB size limit. You can customize this using createDownload:
You can also provide a fully custom download function:
If a download exceeds the size limit, a DownloadError is thrown:

Retries

The transcribe function accepts an optional maxRetries parameter that you can use to set the maximum number of retries. It defaults to 2 retries (3 attempts in total). You can set it to 0 to disable retries.

Abort Signals and Timeouts

The transcribe function accepts an optional abortSignal parameter of type AbortSignal that you can use to abort the transcription process or set a timeout.

Custom Headers

The transcribe function accepts an optional headers parameter that you can use to add custom headers to the request.

Response Information

The transcribe function returns comprehensive response information:

Transcription Providers & Models

Several providers offer transcription models: