Now with Knowledge Base + Custom Providers
Voice AI SDK
One unified interface for Vapi, Retell, and any voice AI provider. Switch providers without rewriting your application.
TypeScript-first · MIT License · Node.js ≥ 18
import { createVapi, createRetell } from '@keyman500/voice-ai-sdk';
// Pick a provider — swap the line below to switch
const vapi = createVapi({ apiKey: process.env.VAPI_API_KEY! });
const retell = createRetell({ apiKey: process.env.RETELL_API_KEY! });
// Create a voice agent
const agent = await vapi.agents.create({
name: 'Support Bot',
voice: { voiceId: 'jennifer' },
model: {
provider: 'openai',
model: 'gpt-4o',
systemPrompt: 'You are a helpful support assistant.',
},
firstMessage: 'Hello, how can I help you today?',
maxDurationSeconds: 300,
webhookUrl: 'https://example.com/webhook',
});
// Place an outbound call
const call = await vapi.calls.create({
agentId: agent.id,
toNumber: '+14155551234',
fromNumber: '+14155559999',
});
console.log('Call status:', call.status); // 'queued'Use Cases
One-line provider swap
Switch between Vapi and Retell without touching your application logic.
[14:23:45] QUEUED
Call queued — agentId: agt_8fKx2, to: +14155551234
[14:23:47] RINGING
Status → ringing. Connecting via Retell...
[14:23:50] IN-PROGRESS
Status → in-progress. Duration: 0s
[14:23:52] WARNING
NotFoundError: agent agt_INVALID not found via retell
[14:24:05] ENDED
Status → ended. Duration: 75s. Transcript ready.
Typed call lifecycle
Every status transition and error is typed and consistent across all providers.
Custom providers, one registry
Register Vapi, Retell, or your own provider and route between them at runtime.
Features
Provider Abstraction
Wrap Vapi and Retell behind a single API. Swap providers with one line of config.
Unified Agent API
Create, list, get, update, and delete voice agents across all providers with identical method signatures.
Outbound Call Management
Trigger outbound calls, track status from queued to ended, and access transcripts and recordings.
TypeScript-First
Full type safety across every provider. Autocomplete for agents, calls, phone numbers, tools, and more.
Structured Error Handling
Typed error hierarchy: ProviderError, NotFoundError, AuthenticationError — catch exactly what you care about.
Custom Providers
Register your own provider with defineProvider and createVoiceRegistry. Switch at runtime.
Community
voice-ai-sdk is open source and MIT licensed. Every PR, issue, and provider integration makes it better for everyone building with voice AI.
Stop rewriting for every voice provider.
One install. Every provider. No lock-in.