Create AI-powered voice calls with natural language processing and voice synthesis.
Category | Features |
---|---|
Voice Calls | • Outbound calls • SMS messaging • Real-time call monitoring • Call status tracking • Concurrent call handling |
AI Integration | • Natural voice synthesis • Multi-voice support • Emotion detection • Conversation management • Context awareness |
Analytics | • Call metrics tracking • Cost monitoring • Success rate analysis • Duration tracking • Sentiment analysis |
Developer Tools | • WebSocket monitoring • Caching system • Rate limiting • Health checks • Detailed logging |
npm install @atrix.dev/ai-voice-sdk
import { AIVoiceCaller } from '@atrix.dev/ai-voice-sdk';
// Initialize the SDK
const voiceCaller = new AIVoiceCaller({
apiKey: 'your_api_key',
twilioAccountSid: 'your_twilio_sid',
twilioAuthToken: 'your_twilio_token',
twilioPhoneNumber: 'your_twilio_number',
elevenLabsApiKey: 'your_elevenlabs_key',
elevenLabsVoiceId: 'your_voice_id'
});
// Make a call
const result = await voiceCaller.makeCall({
to: '+1234567890',
message: 'Hello from AI Voice!'
});
// Send an SMS
const sms = await voiceCaller.sendSMS(
'+1234567890',
'Hello from AI Voice!'
);
Option | Type | Required | Default | Description |
---|---|---|---|---|
apiKey | string | ✓ | - | Your Atrix API key |
twilioAccountSid | string | ✓ | - | Twilio Account SID |
twilioAuthToken | string | ✓ | - | Twilio Auth Token |
twilioPhoneNumber | string | ✓ | - | Your Twilio phone number |
elevenLabsApiKey | string | ✓ | - | ElevenLabs API key |
elevenLabsVoiceId | string | ✓ | - | ElevenLabs voice ID |
baseUrl | string | - | https://api.atrix.dev | API base URL |
logLevel | string | - | 'info' | Logging level (debug/info/warn/error) |
maxConcurrentCalls | number | - | 5 | Maximum concurrent calls |
cacheTTL | number | - | 300000 | Cache TTL in milliseconds |
cacheMaxSize | number | - | 1000 | Maximum cache entries |
retryAttempts | number | - | 3 | Number of retry attempts |
timeout | number | - | 30000 | Request timeout in milliseconds |
// Make a voice call
const call = await voiceCaller.makeCall({
to: '+1234567890',
message: 'Hello!',
voiceSettings: {
stability: 0.7,
similarityBoost: 0.5,
style: 0.5,
useSpeakerBoost: true
}
});
// End a call
await voiceCaller.endCall('call_id');
// Get call history
const history = await voiceCaller.getCallHistory(10);
// Get call metrics
const metrics = await voiceCaller.getCallMetrics('call_id');
// Send SMS
const sms = await voiceCaller.sendSMS(
'+1234567890',
'Hello from AI Voice!'
);
// Listen for call status updates
voiceCaller.onCallStatus((status) => {
console.log('Call status:', status);
});
// Listen for errors
voiceCaller.onError((error) => {
console.error('Error:', error);
});
// Get aggregate metrics
const metrics = await voiceCaller.getMetrics();
// Get conversation transcript
const transcript = await voiceCaller.getConversationTranscript('call_id', {
format: 'json',
includeTiming: true,
speakerLabels: true
});
Error Code | Description | Common Causes |
---|---|---|
INVALID_CONFIG | Configuration error | Missing required fields, invalid format |
TWILIO_ERROR | Twilio API error | Invalid credentials, rate limits |
ELEVENLABS_ERROR | ElevenLabs API error | Invalid API key, voice ID |
NETWORK_ERROR | Network request failed | Timeout, connection issues |
CALL_FAILED | Call operation failed | Invalid phone number, service unavailable |
SMS_FAILED | SMS operation failed | Invalid phone number, service unavailable |
VALIDATION_ERROR | Input validation failed | Invalid phone format, missing data |
-
Rate Limiting
- Monitor your API usage
- Implement proper error handling
- Use the built-in rate limiter
-
Resource Management
- Clean up resources with
disconnect()
- Monitor memory usage with metrics
- Use caching for frequent requests
- Clean up resources with
-
Error Handling
- Always implement error handlers
- Use try-catch blocks
- Monitor error rates
-
Performance
- Enable caching for repeated calls
- Use concurrent call limits
- Monitor call metrics
const call = await voiceCaller.makeCall({
to: '+1234567890',
message: 'Hello!',
voiceSettings: {
stability: 0.7,
similarityBoost: 0.5,
style: 0.5,
useSpeakerBoost: true
},
webhookEvents: ['initiated', 'ringing', 'answered', 'completed'],
callbackUrl: 'https://your-webhook.com/callback'
});
// Check service health
const isHealthy = await voiceCaller.checkHealth();
// Clear cache if needed
await voiceCaller.clearCache();
// Disconnect services
voiceCaller.disconnect();
- Documentation: https://docs.atrix.dev/developers/ai-voice-sdk
- Issues: GitHub Issues
- Email: support@atrix.dev
MIT