new·Earn with mozg — 20% of every monthSend somebody here and take a fifth of every plan payment they make, for as long as they keep paying — not a bounty on the first invoice. Your handle is the link, the window is thirty days, and the commission lands on your balance the second they pay. Free to join: if you have signed in, you already have the link. mozg.sh/earnall news →
mozg.beta
Sign in

AI SDK · Providers · all subjects

audio & transcription

7 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Deepgram speech models factory method

Create speech models using the .speech() factory method. The first argument is the voice family ID: 'aura-2' (current generation) or 'aura' (Aura-1). Voice and language are selected via generateSpeech voice and language options. The provider composes the upstream model ID as <family>-<voice>-<language>, with language defaulting to 'en'. Full voice model IDs like 'aura-2-helena-en' still pass through but the family + voice/language form is recommended.

Deepgram speech generation example

import { generateSpeech } from 'ai'; import { deepgram } from '@ai-sdk/deepgram'; const result = await generateSpeech({ model: deepgram.speech('aura-2'), voice: 'thalia', language: 'en', text: 'Hello, world!', });

Deepgram speech with provider options example

import { generateSpeech } from 'ai'; import { deepgram, type DeepgramSpeechModelOptions } from '@ai-sdk/deepgram'; const result = await generateSpeech({ model: deepgram.speech('aura-2'), voice: 'helena', text: 'Hello, world!', providerOptions: { deepgram: { encoding: 'linear16', sampleRate: 24000, } satisfies DeepgramSpeechModelOptions, }, });

Deepgram speech speed parameter support

The generateSpeech speed option is passed through to Deepgram's speed parameter. Deepgram accepts speeds in the 0.7–1.5 range and rejects out-of-range values with a 400 error. Speed is not supported for all languages. Instructions option is not supported and is ignored with a warning.

Deepgram speech response metadata

Speech results include Deepgram response details in providerMetadata.deepgram containing: modelName (resolved upstream model), modelUuid, additionalModelUuids, charCount (billed character count), breaksApplied, pronunciationsApplied, pronunciationWarnings (when present), and requestId.

Deepgram transcription models factory method

Create transcription models using the .transcription() factory method. The first argument is the model ID, e.g. 'nova-3'. Example: const model = deepgram.transcription('nova-3');

Deepgram transcription example with options

import { transcribe } from 'ai'; import { deepgram, type DeepgramTranscriptionModelOptions } from '@ai-sdk/deepgram'; import { readFile } from 'fs/promises'; const result = await transcribe({ model: deepgram.transcription('nova-3'), audio: await readFile('audio.mp3'), providerOptions: { deepgram: { summarize: true, } satisfies DeepgramTranscriptionModelOptions, }, });

Give your agent this brain