Voice AI SDK
One unified interface for Vapi, Retell, and any voice AI provider. Switch providers without rewriting your application.
Quick Start
Install, pick a provider, and make your first outbound call in under a minute.
Provider Registry
Register multiple providers and switch at runtime with zero application changes.
Paginated Call History
Walk through call history with a consistent cursor-based pagination API.
Custom Provider
Plug in your own voice provider using defineProvider and use it alongside built-ins.
Quick start
One install. Every provider.
Use the same agent and call APIs across Vapi, Retell, or a custom provider. Pair it with Voice API when you want a self-hostable control plane too.
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'Built for provider portability
Stop rewriting for every voice provider. One typed interface, no lock-in.
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.
Stop rewriting for every voice provider.
One install. Every provider. No lock-in. Use the SDK alongside Voice API at voice-ai.dev.