Lesson 3 / Unit 1: LiveKit Foundations
Hosting Choices
Compare managed transport with self-hosted media, including provider integrations, data paths, observability and the cost of operating the stack.
The same agent framework can use LiveKit Cloud or a self-hosted server. Endpoint changes are the easy part; Cloud-only integrations and operational ownership need a separate check.
Self-hosting adds responsibility for media connectivity, TURN, Redis, upgrades and incident response.
Hosting Boundaries
The room and agent concepts transfer. Cloud inference and managed plugins may not: the official quickstart describes the changes for self-hosting. Trace those dependencies before deciding that a migration only changes credentials.
Your agent reads three settings (LIVEKIT_URL, LIVEKIT_API_KEY, LIVEKIT_API_SECRET), listed in the startup modes reference, and connects to whatever they point at. Swap the values and the same process registers with a different server.
There is also a middle path. You can run your agent workers on your own machines and connect them to LiveKit Cloud’s media servers, which keeps the SFU managed while your code stays on infrastructure you control.
Deployment Tradeoffs
Each option wins on different axes. None of them is a pricing figure; the arithmetic for your volume is in the self-hosted cost lesson.
| Factor | LiveKit Cloud | Self-hosted |
|---|---|---|
| Time to first call | A project key and you are live. No EC2, no port ranges, no TURN, no Redis | You build and size all of it (unit 2) |
| Global reach | Their edge puts an SFU near your users without you building regions | You build each region yourself |
| Traffic spikes | Managed capacity, subject to project limits | Your capacity problem |
| On-call | Upgrades, monitoring and the pager for the media plane are theirs | Yours |
| Cost at volume | Per-minute pricing: trivial at low volume, compounds hard at scale | Compute, network and operating cost; savings depend on utilisation |
| Data boundary | Audio transits their infrastructure | Audio can stay in your VPC, your region, or your building |
| Control | Managed for you | Port ranges, codec policy, instance placement, kernel tuning |
| Debugging | Their dashboards | The logs of the exact machine that misbehaved |
| Experiments | Every load test and internal tool is metered | Extra traffic can add bandwidth, model and compute charges |
| Built-in agent insights | Available | Not supported with self-hosted media servers |
That last row is easy to miss. LiveKit’s managed agent observability (transcripts, traces and recordings in one timeline) works only when the media servers are LiveKit Cloud, so on a fully self-hosted stack you bring your own telemetry.
Cost Crossover
Two common reasons to evaluate self-hosting are a required data boundary and a favourable full-cost comparison. Neither can be decided from an instance bill alone.
The first line is about the data boundary. Check the requirement against every data path. External STT, LLM, TTS, recordings and telemetry can still leave your infrastructure even when the SFU is self-hosted.
Cost is the second line. Per-minute pricing that barely registers at low volume compounds as volume grows, and at some point the same traffic fits on a handful of instances you run yourself. Where that crossover sits depends on your utilisation and redundancy, which is why lesson 25 builds it from measured numbers.
Start Managed
Either migration needs testing: credentials, provider access, telephony, recordings and observability can differ. Starting managed lets you gather traffic measurements before taking on the media infrastructure.
That asymmetry settles the order. If you start on Cloud and later cross a line, you run the project then, with real traffic numbers to size against. If control over the media infrastructure is not yet useful, that engineering time may be better spent on call quality.
Operational Ownership
If you do cross a line, here is the work, in the order unit 2 covers it:
- Instances, ports and security groups. A public IP, three port groups, and an RTP range sized as a capacity decision. Deploy LiveKit on EC2.
- Redis and more than one node. Multi-node LiveKit with Redis.
- Telephony. The SIP service, its own port range, and carrier NAT. Self-hosted SIP.
- NAT and TURN. One-way audio and TURN setup.
LiveKit’s own self-hosting overview is the reference for each component, and the lessons add what it leaves out: the numbers we measured and the failures we hit.
Next: whichever way you host, the agent is the same code. Run your first voice agent locally.
Common questions
LiveKit Cloud or self-hosted: which should you use?
Cloud is a useful starting point when you want managed transport. Evaluate self-hosting against your data requirements, integration needs and full operating cost, including redundancy and engineering time.
Do I have to rewrite my agent to move from LiveKit Cloud to self-hosted?
Core SDK concepts transfer, but Cloud-specific inference, noise cancellation and observability can require changes. Audit those dependencies before changing endpoints.
We do this work for teams shipping voice agents: Self-Hosted Voice Agent .
Edit this lesson on GitHub ↗Discussion
Questions, corrections and war stories welcome. Sign in with GitHub to comment.