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.
| Option | Type | Description |
|---|---|---|
audioEndAt | number | End time of the audio, in milliseconds. |
audioStartFrom | number | Start time of the audio, in milliseconds. |
autoChapters | boolean | Automatically generate chapters for the transcript. |
autoHighlights | boolean | Automatically generate highlights for the transcript. |
boostParam | enum | Boost level for wordBoost. Allowed values: low, default, high. Deprecated — applies only to the deprecated wordBoost; use keytermsPrompt instead. |
contentSafety | boolean | Enable content safety filtering. |
contentSafetyConfidence | number | Confidence threshold for content safety filtering (25-100). |
customSpelling | array of objects | Custom spelling rules. Each object has from (array of strings) and to (string). |
disfluencies | boolean | Include disfluencies (um, uh, etc.) in the transcript. |
domain | string | Enable a domain-specific model for specialized terminology. Currently supports medical-v1 (Medical Mode). |
entityDetection | boolean | Detect entities in the transcript. |
filterProfanity | boolean | Filter profanity in the transcript. |
formatText | boolean | Apply text formatting to the transcript. |
iabCategories | boolean | Include IAB categories in the transcript. |
keytermsPrompt | array of strings | Domain-specific keyterms to boost recognition for (max 6 words per phrase). Replaces wordBoost for newer models — supported by universal-3-pro, universal-3-5-pro, and slam-1 (and universal-2 when enabled). |
languageCode | string | Language code for the audio. Supports numerous ISO-639-1 and ISO-639-3 codes. |
languageConfidenceThreshold | number | Confidence threshold for language detection. |
languageDetection | boolean | Enable automatic language detection. |
languageDetectionOptions | object | Options for language detection: expectedLanguages (array of strings), fallbackLanguage (string), codeSwitching (boolean), codeSwitchingConfidenceThreshold (number, 0-1). |
multichannel | boolean | Process multiple audio channels separately. |
prompt | string | Natural-language context (up to 1,500 words) to steer the model. Only supported by universal-3-pro, universal-3-5-pro, and slam-1. |
punctuate | boolean | Add punctuation to the transcript. |
redactPii | boolean | Redact personally identifiable information (PII). |
redactPiiAudio | boolean | Redact PII in the audio file. |
redactPiiAudioOptions | object | Options for PII-redacted audio: returnRedactedNoSpeechAudio (boolean), overrideAudioRedactionMethod (silence). Requires redactPiiAudio. |
redactPiiAudioQuality | enum | Quality of the redacted audio file. Allowed values: mp3, wav. |
redactPiiPolicies | array of enums | Which types of information to redact (e.g. person_name, phone_number). |
redactPiiReturnUnredacted | boolean | Return the original unredacted transcript alongside the redacted one. Requires redactPii. |
redactPiiSub | enum | Substitution method for redacted PII. Allowed values: entity_name, hash. |
redactStaticEntities | object | Map of user-defined labels to exact terms to redact, e.g. { INTERNAL_TOOL: ['Bearclaw'] }. Applied on top of standard PII redaction. Requires redactPii. |
removeAudioTags | enum | Remove inline annotations from rich transcripts. Allowed values: all, speaker. Universal-3 Pro models. |
sentimentAnalysis | boolean | Perform sentiment analysis on the transcript. |
speakerLabels | boolean | Label different speakers in the transcript (diarization). |
speakerOptions | object | Diarization options: minSpeakersExpected (number), maxSpeakersExpected (number). |
speakersExpected | number | Expected number of speakers in the audio. |
speechThreshold | number | Threshold for speech detection (0-1). |
summarization | boolean | Generate a summary of the transcript. |
summaryModel | enum | Summarization model. Allowed values: informative, conversational, catchy. |
summaryType | enum | Type of summary. Allowed values: bullets, bullets_verbose, gist, headline, paragraph. |
temperature | number | Sampling temperature (0-1) controlling randomness. Universal-3 Pro models. |
webhookAuthHeaderName | string | Name of the authentication header for webhook requests. |
webhookAuthHeaderValue | string | Value of the authentication header for webhook requests. |
webhookUrl | string | URL to send webhook notifications to. |
wordBoost | array of strings | Words to boost in the transcript. Deprecated — rejected by universal-3-pro, universal-3-5-pro, and slam-1 (works only on universal-2/best); use keytermsPrompt instead. |
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