Transcription
Transcribe audio through transcribe with routed STT providers.
Pass speko.transcription(...) to the AI SDK's transcribe.
import { speko } from '@spekoai/ai-sdk-provider';
import { transcribe } from 'ai';
import { readFile } from 'node:fs/promises';
const result = await transcribe({
model: speko.transcription('auto'),
audio: await readFile('call.wav'),
providerOptions: {
speko: {
language: 'es-MX',
keywords: ['Speko', 'Vercel'],
},
},
});
console.log(result.text);keywords are domain terms forwarded to the routed STT provider, which improves recognition of names and product vocabulary.
Which provider answered
providerMetadata.speko reports what the router did:
console.log(result.providerMetadata.speko);
// { provider: 'deepgram', model: 'nova-3', confidence: 0.93, failoverCount: 0, scoresRunId: '...' }failoverCount is the number of upstream providers tried before one succeeded.
Segments and duration
| Input | durationInSeconds | segments |
|---|---|---|
| WAV or raw PCM | reported | one whole-transcript segment |
| Other formats | undefined | empty |
The one-shot transcription endpoint does not report per-word timing yet, so duration is only available when the input length is deterministic.
Pinning a provider
speko.transcription('auto-quality'); // bias toward accuracy
speko.transcription('deepgram'); // pin routing and failover to one providerSee Routing options for every model id and option.