You’ve built a brilliant voice agent with Vapi. The prompt is polished, response times are human-like, and the AI handles edge cases like a pro. Your client wants it embedded on their website. You drop in the Vapi Web SDK snippet, replace YOUR_PUBLIC_API_KEY, and push it live. The widget works perfectly.
Then you open Chrome DevTools, glance at the Network tab, and your stomach drops. There’s your public API key – sitting in plain sight, readable by anyone who visits the page! Could someone copy that key and rack up thousands of dollars in calls from a rogue domain? How do I bill this client for their usage without also paying for everyone else’s? And when I onboard my next client, how do I keep their data and costs completely separate?
This is the API key security and multi‑tenancy gap that hits every voice AI agency. Vapi gives you the keys (literally) to build an agent, but securing those keys for client delivery, and tracking costs per client, requires architecture that Vapi doesn’t spell out in the QuickStart guide. In this post, I’ll walk you through that architecture: from key types and origin restrictions to per‑organization billing and the proxy pattern that locks everything down.
By the end, you’ll have a production‑ready model for delivering Vapi voice agents to multiple clients securely, with accurate per‑client cost tracking – and I’ll show you how Five automates the whole thing.
Vapi provides two types of API keys, and understanding the difference is the foundation of a secure multi‑tenant setup:
The naive approach, i.e. using a single public key for all clients, is the security equivalent of leaving your front door unlocked. Yes, the public key is limited, but without additional restrictions, anyone who grabs it from your client’s website can spin up calls from any domain, exhausting your account balance. Worse, because all usage flows through one key, you have no way to know which client generated which costs.
The solution: per‑client public keys, scoped to specific domains, associated with unique organizations.
Vapi’s Organization (Org) model is the foundation for multi‑tenancy. Each organization is a separate workspace with its own assistants, phone numbers, knowledge bases, and — critically — its own API keys and usage logs.
For an agency, the pattern is:
When you move to production, you generate a unique public API key inside the client’s Org. That key is then embedded in their widget. The result: Client A’s calls are completely isolated from Client B’s. Client A’s key has no access to Client B’s assistants, call logs, or billing data.
This is the “container” model that agencies ask about constantly. It takes a few steps to implement manually, but it’s straightforward once you understand Vapi’s hierarchy:
Master Account
└─ Org: Your Agency (private key only)
└─ Org: Client A
│ └─ Public Key: "pk_client_a_..."
│ └─ Assistant: "Receptionist - Client A"
│ └─ Phone Number: +1 (555) 100-1001
└─ Org: Client B
└─ Public Key: "pk_client_b_..."
└─ Assistant: "Booking Bot - Client B"
└─ Phone Number: +1 (555) 200-2002
A per‑client public key is a huge step forward, but without origin restrictions it’s still vulnerable. Someone could copy Client A’s public key and embed it on their own site, using your client’s account to handle calls for free.
Vapi lets you bind a public API key to a list of Allowed Origins. These are the domains (and ports) from which the key can be used. If a call‑creation request arrives from a domain not on the list, Vapi rejects it.
To set this up when generating a public key:
https://www.client-a-website.com, https://app.client-a-website.com.Now, even if the key is leaked, it’s useless on any other domain. This is the standard technique recommended by Vapi and by experienced agency developers exploring “customer‑specific public API keys that can be tied to allowed origins.”
For developers who need to test on localhost, you can temporarily add http://localhost:3000 to the allowed origins during development and remove it for production.
The security piece solved, the next question is always billing: “How do I calculate the charge for that specific API key?”
The answer lies in the Organization ID (OrgID) associated with each key. Vapi tracks usage per Organization, and you can pull that data through the dashboard or the API to build per‑client invoices.
Using Vapi’s Analytics API, you can fetch call logs filtered by OrgID. A call to the reporting endpoint returns data that includes:
If you’re using the Vapi dashboard, navigate to the client’s Org, go to Analytics, and you’ll see a cost breakdown for that Org alone.
You’re not just passing through Vapi’s cost — you’re running a business. You’ll add your markup to the underlying costs. The real‑world all‑in cost for a Vapi call lands between $0.23 and $0.33 per minute when you sum orchestration, Deepgram/Whisper transcription, OpenAI/Anthropic LLM, ElevenLabs/Play/TTS, and Twilio/Vonage telephony.
A common agency pricing model:
With per‑Org usage data, you can run the numbers at the end of each billing cycle and generate a Stripe invoice. No more manual spreadsheet detective work.
Doing this manually across 10+ clients is soul‑crushing. Every month you’re logging into Vapi, switching Orgs, exporting CSVs, calculating totals, and manually creating Stripe invoices. It’s the kind of repetitive work that prevents agencies from scaling.
The long‑term solution is a system that pulls per‑Org analytics automatically, applies your pricing model, and generates invoices in Stripe. That’s exactly what the Five white‑label Vapi portal does.
For agencies with the highest security requirements, there’s one more pattern worth knowing: proxy all client calls through your own server.
Instead of embedding a Vapi public key in the widget at all, you:
The result: the end‑user’s browser never sees a Vapi API key. It’s the most secure approach, and it also opens the door to additional value — like logging, custom analytics, and per‑call business logic — before the call even starts.
The tradeoff is latency and complexity. You’re introducing a hop between the user and Vapi’s infrastructure. For most agencies, properly restricted per‑Org public keys with allowed origins provide sufficient security without the overhead.
You’ve seen the architecture. You know the patterns. Now let’s get you running with it — without the months of build time. Check out our white-label Vapi portal to secure your Vapi agents properly.
Stop guarding API keys and start scaling your voice AI business.