voice-ai-sdk<br>v1.1.0<br>Now with Knowledge Base + Custom Providers<br>Voice AI SDKVoice AI SDK<br>One unified interface for Vapi, Retell, and any voice AI provider. Switch providers without rewriting your application.
npm i @keyman500/voice-ai-sdkView on GitHub<br>TypeScript-first · MIT License · Node.js ≥ 18
Quick Start<br>Install, pick a provider, and make your first outbound call in under a minute.<br>Provider Registry<br>Register multiple providers and switch at runtime with zero application changes.<br>Paginated Call History<br>Walk through call history with a consistent cursor-based pagination API.<br>Custom Provider<br>Plug in your own voice provider using defineProvider and use it alongside built-ins.
pre]:!bg-transparent [&>pre]:p-4 [&_code]:break-all md:max-h-[45vh] overflow-scroll">import { createVapi, createRetell } from '@keyman500/voice-ai-sdk';
// Pick a provider — swap the line below to switch<br>const vapi = createVapi({ apiKey: process.env.VAPI_API_KEY! });<br>const retell = createRetell({ apiKey: process.env.RETELL_API_KEY! });
// Create a voice agent<br>const agent = await vapi.agents.create({<br>name: 'Support Bot',<br>voice: { voiceId: 'jennifer' },<br>model: {<br>provider: 'openai',<br>model: 'gpt-4o',<br>systemPrompt: 'You are a helpful support assistant.',<br>},<br>firstMessage: 'Hello, how can I help you today?',<br>maxDurationSeconds: 300,<br>webhookUrl: 'https://example.com/webhook',<br>});
// Place an outbound call<br>const call = await vapi.calls.create({<br>agentId: agent.id,<br>toNumber: '+14155551234',<br>fromNumber: '+14155559999',<br>});
console.log('Call status:', call.status); // 'queued'
Use Cases
createVapi — Vapi provider
createRetell — Retell provider
provider.calls.create(...)
One-line provider swap<br>Switch between Vapi and Retell without touching your application logic.
[14:23:45] QUEUED<br>Call queued — agentId: agt_8fKx2, to: +14155551234
[14:23:47] RINGING<br>Status → ringing. Connecting via Retell...
[14:23:50] IN-PROGRESS<br>Status → in-progress. Duration: 0s
[14:23:52] WARNING<br>NotFoundError: agent agt_INVALID not found via retell
[14:24:05] ENDED<br>Status → ended. Duration: 75s. Transcript ready.
Typed call lifecycle<br>Every status transition and error is typed and consistent across all providers.
Custom providers, one registry<br>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.
Contribute on GitHub
Stop rewriting for every voice provider.<br>One install. Every provider. No lock-in.<br>npm i @keyman500/voice-ai-sdkRead the docs