Cloudflare Realtime (SFU, TURN, RealtimeKit, Realtime Agents / voice)
Cloudflare's global WebRTC SFU and TURN service, RealtimeKit SDKs/UI for meetings, and a beta voice-agent stack that runs STT, LLM and TTS on Workers AI from inside Workers/Durable Objects.
Overview
Best for: Edge-native web voice apps already on Workers, and anyone needing cheap global WebRTC transport.
At a glance
Voice agent stack is Beta. SFU/TURN billed per GB ($0.05 after 1 TB/month free), RealtimeKit $0.0005/min per audio participant; agents runtime said free in beta (not re-verified). No PSTN numbers.
WebRTC (Opus) or WebSocket PCM via the WebSocket adapter
Same
Depends on Workers AI or third-party models (Deepgram, ElevenLabs via providers).
Vendor emphasises 330+ city edge network; no verified end-to-end number.
Global anycast edge (330+ cities per Cloudflare).
Not verified for these products in this research.
Features
- global SFU/TURN
- WebSocket adapter for AI audio
- turn detection (Workers AI smart-turn, Flux end-of-speech)
- multi-provider plug-ins via AI Gateway
- recording/export (RealtimeKit)
- conversation persistence in Durable Objects
Pricing
| What | Price | Unit |
|---|---|---|
| SFU and TURN egress | $0.05 | per GB |
| RealtimeKit audio-only participant | $0.0005 | per minute |
| RealtimeKit audio/video participant | $0.002 | per minute |
| RealtimeKit export (audio only) | $0.003 | per minute |
| Workers AI Deepgram Nova-3 streaming STT | $0.0092 | per audio minute |
| Workers AI Deepgram Aura-1 TTS | $0.015 | per 1k characters |
| Workers AI free allowance | 10,000 Neurons | per day |
Workers AI STT ~$0.009/min + TTS ~$0.01-0.03/min (assuming roughly 600-1,000 spoken characters per agent minute) + small LLM token cost + near-zero transport within the free 1 TB. Assumes the Realtime Agents runtime itself stays free/cheap; not a vendor figure. No PSTN included (Cloudflare does not sell phone minutes).
Free tier: 1,000 GB/month SFU+TURN egress; 10,000 Workers AI Neurons/day.
Source: developers.cloudflare.com
Setup
- Start from the cloudflare/agents-starter template and 'npm i @cloudflare/voice'.
- In wrangler config add an 'ai' binding named AI, a Durable Object binding for the agent class with a new_sqlite_classes migration, and the nodejs_compat flag.
- Implement onTurn(transcript, context) returning a text stream; use useVoiceAgent({ agent: 'MyVoiceAgent' }) in React for mic, status and startCall/endCall.
- 'npx wrangler deploy'.
Endpoint
Your Worker URL (WebSocket to the Durable Object agent)
Authentication
Cloudflare account / Workers AI binding; RealtimeKit uses app ID + API token
Quick start javascript
// src/server.ts - shape per Cloudflare "Voice agent" docs (Beta). Check docs for exact STT/TTS wiring.
import { Agent } from "agents";
import { withVoice, WorkersAIFluxSTT, WorkersAITTS } from "@cloudflare/voice";
import { streamText } from "ai";
import { createWorkersAI } from "workers-ai-provider";
const VoiceAgent = withVoice(Agent);
export class MyVoiceAgent extends VoiceAgent {
stt = new WorkersAIFluxSTT(this.env.AI); // end-of-speech aware STT
tts = new WorkersAITTS(this.env.AI); // sentence-by-sentence TTS
async onCallStart(connection) {
await this.speak("Hi, how can I help?");
}
async onTurn(transcript, context) {
const workersai = createWorkersAI({ binding: this.env.AI });
const result = streamText({
model: workersai("@cf/moonshotai/kimi-k2.6"),
system: "You are a voice assistant. Keep answers to one or two sentences.",
messages: [...context.messages, { role: "user", content: transcript }],
abortSignal: context.signal, // aborts on barge-in
});
return result.textStream;
}
}
Written from the current docs. Check the vendor's SDK version before you ship.
Warnings
Voice agent stack is Beta
@cloudflare/voice and the Realtime Agents runtime are Beta; APIs and pricing may change. The docs example has already been revised (different compatibility dates).
RealtimeKit billing status changed
Older docs said RealtimeKit was free during beta; the current pricing page states usage is charged. Check the calculator before assuming free.
No phone numbers
Cloudflare provides WebRTC/WebSocket transport, not PSTN. For phone agents you need Twilio/Telnyx/Plivo or another SIP provider.
Participant type is set by preset
RealtimeKit bills audio/video rate if the preset meeting type is video, even if users only send audio.
Workers AI model menu is narrower
Third-party models via AI Gateway are billed by those providers; only Workers AI models land on the Cloudflare bill.
Plus 12 warnings that apply to all platforms and telephony APIs. See category warnings.
Limits
- No native PSTN numbers; bring a SIP/telephony provider
- Voice agent package is Beta
Models and products
| Name | Status |
|---|---|
| Realtime SFU + TURN | GA |
| RealtimeKit | GA (billing stated on docs) |
| Voice agents (@cloudflare/voice on Agents SDK) | Beta |
| Realtime Agents runtime | Beta |
Docs and sources
Docs
Sources used
- developers.cloudflare.com/realtime/sfu/pricing/
- developers.cloudflare.com/realtime/realtimekit/pricing
- developers.cloudflare.com/agents/examples/voice-agent/
- blog.cloudflare.com/cloudflare-realtime-voice-ai
- developers.cloudflare.com/workers-ai/platform/pricing/
Whether the Realtime Agents runtime is still free; Workers AI per-model prices came from a preview build of the pricing page; Flux STT price on Workers AI not found; exact property names for wiring STT/TTS in the snippet.