← All posts
How-ToNovember 6, 2026 · 11 min

How to build voice AI agent development with Vapi and ElevenLabs

You can build voice-based AI agents by combining Vapi's orchestration layer with ElevenLabs' natural-sounding text-to-speech voices, then connecting speech recognition (via Twilio, Google Cloud Speech-to-Text, or OpenAI Whisper) to route inbound calls or outbound campaigns. Vapi handles the agent logic, call state, and NLP routing; ElevenLabs generates realistic voice output with latency under 500ms; Twilio or Google Cloud manages the telephony or transcription layer. Start by defining your agent's system prompt in Vapi, wire in your speech-to-text provider, select an ElevenLabs voice, and connect your backend API endpoints so the agent can fetch customer data, check inventory, or trigger workflows. The entire voice AI agent development pipeline runs without custom speech processing code - Vapi abstracts the complexity of turn-taking, interruption handling, and context memory.

What you need

Voice AI agent development requires a speech-to-text layer, a language model, text-to-speech voices, telephony infrastructure, and orchestration glue. Here's the stack:

ToolPlan/PriceRole
VapiFrom $0.10/minVoice agent orchestration, call handling, real-time transcription routing
OpenAIGPT-4 from $0.03/1K input tokensLLM backbone for agent reasoning and response generation
ElevenLabsFrom $0.30/1K charactersNatural text-to-speech voices for agent replies
TwilioFrom $0.0075/min inboundPSTN telephony, call routing, SIP integration
Google Cloud Speech-to-TextFrom $0.024/15 sec audioSpeech recognition alternative to Vapi's built-in transcription
Amazon PollyFrom $0.02/1K charactersAlternative TTS with lower latency for regional deployments
n8nSelf-hosted free or Cloud from $10/moWorkflow automation to chain agent responses to CRM, ticketing, or logging

Pick Vapi if you want voice agent development handled end-to-end with minimal plumbing. Pair it with OpenAI for reasoning and ElevenLabs for voice quality. Use Twilio when you need direct PSTN control or existing phone infrastructure. Google Cloud and Amazon Polly are cost-effective for high-volume TTS or speech-to-text if you're already in their ecosystems. n8n bridges the agent to your backend systems - CRM updates, ticket creation, escalation logic.

How it works

  1. Caller initiates contact. A customer calls a Twilio phone number or initiates a web chat. Twilio receives the inbound call and immediately routes it to a webhook endpoint you control, passing caller ID, timestamp, and any IVR input.
  1. Speech-to-text conversion. The audio stream is sent to a speech recognition service - either OpenAI's Whisper API, Google Cloud Speech-to-Text, or a real-time provider like Deepgram. This transcribes the caller's intent into text with ~95% accuracy in most environments.
  1. NLP and intent routing. The transcribed text enters your voice AI agent development logic via Vapi or a custom n8n workflow. NLP models (often built into Vapi or called via OpenAI's GPT-4) classify the caller's intent - refund request, account lookup, appointment booking - and route to the appropriate handler or knowledge base.
  1. Agent response generation. The AI generates a contextual reply, pulling data from your CRM, knowledge base, or backend APIs as needed. Vapi orchestrates this step, managing conversation state and deciding whether to escalate, answer, or collect more information.
  1. Text-to-speech synthesis. The agent's response is converted to natural speech using ElevenLabs (for high-quality, customizable voices) or Amazon Polly (for cost-effective, low-latency synthesis). The audio is streamed back to the caller in real time.
  1. Logging and handoff. Call metadata, transcript, and outcome are logged to your database. If human escalation is needed, Vapi transfers the call back to Twilio and routes it to an available agent with full context.

How to build it

  1. Set up Twilio for inbound call handling. Create a Twilio phone number and configure its voice webhook to point to your orchestration layer (n8n, Make, or a custom endpoint). When a call arrives, Twilio will POST call metadata (caller ID, duration, call SID) to your webhook. Store the call SID - you'll need it to transfer or record the interaction. In Twilio Console, set Voice URL to https://your-domain.com/webhook/twilio-voice and Method to POST.
  1. Choose your speech-to-text engine. Twilio's native speech recognition is basic; for production voice AI agent development, use OpenAI's Whisper API (via the Vapi integration) or Google Cloud Speech-to-Text. If you use Vapi, it handles Whisper internally. If building standalone, send audio streams from Twilio to Google Cloud Speech-to-Text using the streaming API - configure a service account JSON key in your orchestration layer and set the language code to en-US.
  1. Configure Vapi as your voice agent orchestrator. Vapi sits between your telephony (Twilio) and your LLM, managing conversation flow, hold times, and escalation. Sign up at https://vapi.ai, create an assistant, and set the model to OpenAI GPT-4 (or GPT-3.5-turbo for cost reduction). In Vapi's dashboard, link your Twilio phone number under "Phone Numbers" and paste your Twilio Account SID and Auth Token. Vapi will auto-answer and route inbound calls through your configured system prompt.
  1. Write and deploy your system prompt. This is the voice of your agent. Use a structured format that tells the LLM its role, constraints, and escalation rules. See the example prompt below. Store it as a JSON config in your n8n workflow or Vapi assistant settings. The prompt should include: role definition (e.g., "You are a customer support agent"), context (business name, hours, policies), and fallback behavior ("If the customer asks about refunds, collect their order ID and transfer to a human").
  1. Set up text-to-speech with ElevenLabs or Amazon Polly. Vapi integrates ElevenLabs by default; if you need lower latency or cost savings, use Amazon Polly (from $0.000004 per character). In Vapi's assistant settings, select ElevenLabs and choose a voice (e.g., "Bella" for warm customer service). If using Polly standalone, configure it in your n8n workflow: create an AWS Lambda function that accepts text, calls Polly's SynthesizeSpeech API with Engine: neural and OutputFormat: mp3, and returns a signed S3 URL. Vapi will stream the audio directly to the caller.
  1. Build the n8n orchestration workflow. Create a workflow that receives the Twilio webhook, logs the call to your CRM, triggers Vapi's API to start the conversation, and listens for completion webhooks. Use the HTTP Request node to call Vapi's /call endpoint with your assistant ID and the caller's phone number. The example workflow JSON below shows the structure.
  1. Handle NLP intent routing. Before or after Vapi processes the call, use OpenAI's function calling or a lightweight NLP classifier (e.g., Google Cloud NLP) to detect intent (billing, technical support, sales). In your system prompt, instruct the agent to state the caller's intent early: "What can I help you with today?" Then route to the appropriate escalation queue or knowledge base. Store intents in your CRM for analytics.
  1. Set up escalation and recording. Configure Vapi to detect when a caller requests a human or when the agent confidence drops below a threshold. Use Twilio's <Dial> verb to transfer to a live agent queue. Enable call recording via Twilio's record=true parameter and store MP3s in an S3 bucket for compliance. Log the transfer reason and agent performance metrics to your database.
  1. Test end-to-end with a test call. Call your Twilio number from a mobile phone. Verify: (1) Twilio receives the inbound call, (2) Vapi's system prompt is active (agent greets you), (3) speech recognition captures your responses, (4) the agent responds with synthesized audio, (5) escalation works if you ask for a human. Monitor logs in Vapi's dashboard and Twilio's console for latency and error rates.

Example Vapi system prompt (JSON):

json
{
 "systemPrompt": "You are a customer support agent for Acme Corp. Your job is to help customers with billing, technical issues, and sales inquiries. You are friendly, concise, and professional. If a customer asks about a refund, collect their order ID and email, then say 'I'm transferring you to our billing team.' If you don't know the answer, say 'Let me check with my supervisor' and transfer the call. Never make up information. Keep responses under 30 seconds.",
 "model": "gpt-4",
 "temperature": 0.7,
 "maxTokens": 150,
 "voiceProvider": "elevenlabs",
 "voiceId": "bella",
 "language": "en-US"
}

Example n8n workflow excerpt (HTTP trigger + Vapi call):

```json { "nodes": [ { "name": "Twilio Webhook", "type": "n8n-nodes-base.webhook", "typeVersion": 1, "position": [250, 300], "webhookId": "twilio-inbound", "httpMethod": "POST" }, { "name": "Call Vapi API", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4, "position": [500, 300], "parameters": { "url": "https://api.vapi.ai/call", "method": "POST", "headers": { "Authorization": "Bearer YOUR_VAPI_API_KEY", "Content-Type": "application/json" }, "body": { "

What it costs to run

Component100 calls/mo1,000 calls/mo10,000 calls/mo
Vapi (orchestration)$10-20$50-100$300-500
ElevenLabs (TTS)$5-10$30-50$200-400
OpenAI (LLM reasoning)$2-5$15-30$100-200
Twilio (inbound/outbound)$5-15$30-80$200-600
Google Cloud Speech-to-Text$3-8$15-40$100-300
Total (mid-range)$25-58$140-300$900-2,000

Assumptions: 5-minute average call duration; Vapi pay-per-minute pricing from $0.05-0.10/min; ElevenLabs at ~$0.03/1K characters; OpenAI GPT-4 at ~$0.03 input/$0.06 output per 1K tokens; Twilio at $0.0085/min inbound, $0.013/min outbound; Google Cloud Speech-to-Text at $0.024/15-second interval. Actual costs vary by region, model selection, and concurrency. Check current pricing on each vendor's dashboard - these are estimates only.

Where this breaks

Speech recognition misses domain jargon. The voice AI agent understands "I want to book a call" but fails on "I need a discovery sprint for our Shopify Plus migration." OpenAI's Whisper and Google Cloud Speech-to-Text train on general English; they stumble on industry terms, product names, and acronyms specific to your vertical. Fix: fine-tune your speech-to-text model on recorded customer calls from your domain, or use Vapi's custom vocabulary settings to weight technical terms higher during transcription. Deepgram offers custom acoustic models; Twilio's speech recognition lets you pass a hints array of expected phrases.

Latency kills the conversation feel. The caller hears 2-3 seconds of silence while the voice AI agent processes their question through OpenAI's API, fetches data from your backend, and generates a response via ElevenLabs text-to-speech. Real conversations have sub-500ms response times; anything longer feels broken. Fix: cache common questions and answers locally, use streaming responses from OpenAI instead of waiting for full completion, and choose ElevenLabs' lower-latency voice models (not the highest-quality ones) for real-time calls. Pre-generate TTS audio for predictable responses during off-peak hours.

Caller interrupts mid-response and the agent freezes. The voice AI agent is still playing a 10-second answer when the caller says "wait, I meant something else." Most orchestration layers (including basic Vapi setups) don't handle barge-in gracefully - they either ignore the interruption or restart the entire flow. Fix: enable barge-in detection in Vapi's call configuration, and structure your prompts to keep individual agent responses under 3 seconds so interruptions feel natural. Use Amazon Polly's SSML tags to mark pauseable sections.

Handoff to human fails silently. The voice AI agent decides the caller needs a human (refund request, angry tone detected), but the queue system, CRM sync, or Twilio bridge to your contact center doesn't trigger. The caller hears "connecting you now" and then dead air or a dial tone. Fix: test the full handoff chain end-to-end with Twilio's call recording and logs; use n8n or Make to monitor the handoff webhook and log failures to a Slack channel; implement a fallback callback option if the live agent queue is full.

How do I choose between Vapi, Twilio, and a custom voice AI agent development stack?

Vapi handles orchestration - it connects speech-to-text, LLM reasoning, and text-to-speech in a single managed service starting from $0.05/min, and is fastest for customer service automation. Twilio is a telephony foundation; you still build the voice AI agent logic yourself, which takes weeks. Use Vapi if you need a working voice agent in days; use Twilio if you need deep carrier integration or SMS fallback alongside voice.

What speech-to-text engine should I pair with my voice AI agent?

Google Cloud Speech-to-Text and OpenAI's Whisper both handle accents and background noise well; Whisper is open-source and runs locally (lower latency), while Google Cloud charges per 15-second increment and integrates natively with Google Cloud AI services. Most voice AI agent development teams start with Whisper for cost and control, then switch to Google Cloud if accuracy on domain-specific terms (medical, legal jargon) becomes critical.

Can I use Amazon Polly voices in a Vapi voice AI agent?

Vapi supports ElevenLabs voices natively and has integrations for other TTS providers, but Amazon Polly requires custom configuration - check the Vapi API reference for current TTS connector options. If Polly voices are mandatory for your brand, build the voice AI agent development layer with Twilio or a custom stack using the AWS SDK instead.

How much does NLP preprocessing add to voice AI agent development costs and latency?

NLP (entity extraction, intent classification) adds 50-200ms per turn; most modern voice AI agent development skips it because large language models like OpenAI's GPT-4 handle intent and entities in-context. Only add explicit NLP if your agent must classify intent before hitting the LLM (e.g., routing calls to different departments), which saves ~$0.001-0.005 per call but adds complexity.

For a deeper technical reference, see n8n's documentation.

Get the full toolkit

Grab the free guide with the node-by-node build for all 10 automations.

By subscribing, you agree to receive this guide plus occasional AI Automation Blueprint educational and product emails. Unsubscribe anytime. Privacy policy.