transcribe() API that works across speech-to-text providers. The @ai-sdk/assemblyai provider — maintained by Vercel in the vercel/ai repo — plugs AssemblyAI’s speech models into that API, so you can transcribe audio in any TypeScript or JavaScript project without calling the AssemblyAI API directly.
Quickstart
Install the AI SDK core package along with the AssemblyAI provider:- npm
- yarn
- pnpm
- bun
ASSEMBLYAI_API_KEY environment variable:
transcribe():
transcribe is a stable export as of AI SDK v7, which is what npm install ai
installs today. The examples on this page target v7.Configuring the provider
The defaultassemblyai instance reads your key from ASSEMBLYAI_API_KEY. To pass the key explicitly — for example, from a secret manager or in a multi-tenant setup — or to add custom headers or a custom fetch implementation, create your own provider instance with createAssemblyAI:
Choosing a speech model
universal-3-5-pro is the recommended default. universal-2 is also supported. Pass the model ID to assemblyai.transcription():
Using AssemblyAI features
AssemblyAI’s diarization and audio-intelligence features are enabled throughproviderOptions.assemblyai. Option keys are the camelCase equivalents of the API’s snake_case parameters (for example, speaker_labels → speakerLabels, redact_pii → redactPii):
satisfies AssemblyAITranscriptionModelOptions gives you editor autocomplete and type-checking for the full option set, so you don’t have to memorize parameter names or hunt through docs.
The table below reflects
@ai-sdk/assemblyai 3.0.5. For the always-current list —
including any options added in newer releases — see the
@ai-sdk/assemblyai provider reference,
which lives alongside the provider code and is the canonical source.Transcription options
Every option below is optional and passed underproviderOptions.assemblyai. Types and behavior follow the AssemblyAI transcription API.
Getting the full results back
transcribe() returns a provider-agnostic result, but AssemblyAI’s richer output — utterances, entities, sentiment, and more — is preserved, so you don’t lose anything by going through the AI SDK:
- Top-level fields like
result.text,result.segments, andresult.durationInSecondsare normalized across providers. result.providerMetadata.assemblyaiholds AssemblyAI-specific results such asutterances,entities, andsentimentAnalysisResults.result.response.bodyis the complete, raw AssemblyAI transcript object.
Additional resources
- AssemblyAI provider reference on ai-sdk.dev — the canonical, complete list of provider options
vercel/aion GitHub — the AI SDK source and where the provider is maintained- AssemblyAI API reference — the underlying transcription API and every parameter it accepts