Skip to main content
The AI SDK gives you a single, unified 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 install ai @ai-sdk/assemblyai
You’ll need an AssemblyAI account and an API key from your dashboard. The provider reads it from the ASSEMBLYAI_API_KEY environment variable:
export ASSEMBLYAI_API_KEY="<YOUR_API_KEY>"
Then transcribe a local file with transcribe():
import { transcribe } from 'ai';
import { assemblyai } from '@ai-sdk/assemblyai';
import { readFile } from 'node:fs/promises';

const result = await transcribe({
  model: assemblyai.transcription('universal-3-5-pro'),
  audio: await readFile('audio.mp3'),
});

console.log(result.text);
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.
Using AI SDK v6? The examples on this page require v7. AI SDK v6 (and v5) export only experimental_transcribeimport { transcribe } from 'ai' throws on those versions — and the latest provider (@ai-sdk/assemblyai 3.x) is built for v7, so it won’t work against v6. If your project is on v6 (for example, an existing project or a registry policy that hasn’t picked up v7 yet), install the v6-compatible packages and alias the experimental export:
npm install ai@ai-v6 @ai-sdk/assemblyai@ai-v6
import { experimental_transcribe as transcribe } from 'ai';
Everything else on this page — the providerOptions, model IDs, and result shape — is the same.

Configuring the provider

The default assemblyai 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:
import { createAssemblyAI } from '@ai-sdk/assemblyai';

const assemblyai = createAssemblyAI({
  apiKey: process.env.ASSEMBLYAI_API_KEY,
});

const result = await transcribe({
  model: assemblyai.transcription('universal-3-5-pro'),
  audio: await readFile('audio.mp3'),
});

Choosing a speech model

universal-3-5-pro is the recommended default. universal-2 is also supported. Pass the model ID to assemblyai.transcription():
const model = assemblyai.transcription('universal-3-5-pro');
For a breakdown of each model’s accuracy, latency, and language support, see Select the speech model.

Using AssemblyAI features

AssemblyAI’s diarization and audio-intelligence features are enabled through providerOptions.assemblyai. Option keys are the camelCase equivalents of the API’s snake_case parameters (for example, speaker_labelsspeakerLabels, redact_piiredactPii):
import { transcribe } from 'ai';
import {
  assemblyai,
  type AssemblyAITranscriptionModelOptions,
} from '@ai-sdk/assemblyai';
import { readFile } from 'node:fs/promises';

const result = await transcribe({
  model: assemblyai.transcription('universal-3-5-pro'),
  audio: await readFile('meeting.mp3'),
  providerOptions: {
    assemblyai: {
      speakerLabels: true,
      keytermsPrompt: ['AssemblyAI', 'Universal'],
      redactPii: true,
      redactPiiPolicies: ['person_name', 'email_address'],
    } satisfies AssemblyAITranscriptionModelOptions,
  },
});
Annotating the options object with 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 under providerOptions.assemblyai. Types and behavior follow the AssemblyAI transcription API.
OptionTypeDescription
audioEndAtnumberEnd time of the audio, in milliseconds.
audioStartFromnumberStart time of the audio, in milliseconds.
autoChaptersbooleanAutomatically generate chapters for the transcript.
autoHighlightsbooleanAutomatically generate highlights for the transcript.
boostParamenumBoost level for wordBoost. Allowed values: low, default, high. Deprecated — applies only to the deprecated wordBoost; use keytermsPrompt instead.
contentSafetybooleanEnable content safety filtering.
contentSafetyConfidencenumberConfidence threshold for content safety filtering (25-100).
customSpellingarray of objectsCustom spelling rules. Each object has from (array of strings) and to (string).
disfluenciesbooleanInclude disfluencies (um, uh, etc.) in the transcript.
domainstringEnable a domain-specific model for specialized terminology. Currently supports medical-v1 (Medical Mode).
entityDetectionbooleanDetect entities in the transcript.
filterProfanitybooleanFilter profanity in the transcript.
formatTextbooleanApply text formatting to the transcript.
iabCategoriesbooleanInclude IAB categories in the transcript.
keytermsPromptarray of stringsDomain-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).
languageCodestringLanguage code for the audio. Supports numerous ISO-639-1 and ISO-639-3 codes.
languageConfidenceThresholdnumberConfidence threshold for language detection.
languageDetectionbooleanEnable automatic language detection.
languageDetectionOptionsobjectOptions for language detection: expectedLanguages (array of strings), fallbackLanguage (string), codeSwitching (boolean), codeSwitchingConfidenceThreshold (number, 0-1).
multichannelbooleanProcess multiple audio channels separately.
promptstringNatural-language context (up to 1,500 words) to steer the model. Only supported by universal-3-pro, universal-3-5-pro, and slam-1.
punctuatebooleanAdd punctuation to the transcript.
redactPiibooleanRedact personally identifiable information (PII).
redactPiiAudiobooleanRedact PII in the audio file.
redactPiiAudioOptionsobjectOptions for PII-redacted audio: returnRedactedNoSpeechAudio (boolean), overrideAudioRedactionMethod (silence). Requires redactPiiAudio.
redactPiiAudioQualityenumQuality of the redacted audio file. Allowed values: mp3, wav.
redactPiiPoliciesarray of enumsWhich types of information to redact (e.g. person_name, phone_number).
redactPiiReturnUnredactedbooleanReturn the original unredacted transcript alongside the redacted one. Requires redactPii.
redactPiiSubenumSubstitution method for redacted PII. Allowed values: entity_name, hash.
redactStaticEntitiesobjectMap of user-defined labels to exact terms to redact, e.g. { INTERNAL_TOOL: ['Bearclaw'] }. Applied on top of standard PII redaction. Requires redactPii.
removeAudioTagsenumRemove inline annotations from rich transcripts. Allowed values: all, speaker. Universal-3 Pro models.
sentimentAnalysisbooleanPerform sentiment analysis on the transcript.
speakerLabelsbooleanLabel different speakers in the transcript (diarization).
speakerOptionsobjectDiarization options: minSpeakersExpected (number), maxSpeakersExpected (number).
speakersExpectednumberExpected number of speakers in the audio.
speechThresholdnumberThreshold for speech detection (0-1).
summarizationbooleanGenerate a summary of the transcript.
summaryModelenumSummarization model. Allowed values: informative, conversational, catchy.
summaryTypeenumType of summary. Allowed values: bullets, bullets_verbose, gist, headline, paragraph.
temperaturenumberSampling temperature (0-1) controlling randomness. Universal-3 Pro models.
webhookAuthHeaderNamestringName of the authentication header for webhook requests.
webhookAuthHeaderValuestringValue of the authentication header for webhook requests.
webhookUrlstringURL to send webhook notifications to.
wordBoostarray of stringsWords 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, and result.durationInSeconds are normalized across providers.
  • result.providerMetadata.assemblyai holds AssemblyAI-specific results such as utterances, entities, and sentimentAnalysisResults.
  • result.response.body is the complete, raw AssemblyAI transcript object.
const result = await transcribe({
  model: assemblyai.transcription('universal-3-5-pro'),
  audio: await readFile('meeting.mp3'),
  providerOptions: {
    assemblyai: { speakerLabels: true, sentimentAnalysis: true },
  },
});

// Normalized, provider-agnostic fields
console.log(result.text);
console.log(result.segments);

// AssemblyAI-specific results
const { utterances, sentimentAnalysisResults } =
  result.providerMetadata.assemblyai;

// The complete, raw AssemblyAI transcript
const rawTranscript = result.response.body;
Timestamps use different units depending on where you read them. The top-level result.segments are in seconds (the AI SDK’s normalized format), while every timing inside result.providerMetadata.assemblyai and result.response.body is in milliseconds (AssemblyAI’s native format). Convert accordingly when you combine the two.

Additional resources