01 — TURN FOR AI AGENTS

TURN Server for AI Agents

Your voice, video and vision agents reach users over WebRTC. When a firewall, an office network or a mobile carrier blocks the direct path, Metered relays the media over UDP and TCP on ports 80 and 443, and TLS on port 443.

Get Started Free

500 MB free every month. No credit card required.

02 — DO YOU NEED TURN?

When does an AI agent need a TURN server?

An AI agent needs a TURN server when its WebRTC media can't travel directly between the user and the agent. That happens when the user sits behind a firewall that blocks UDP, or when the agent runs without a public IP. A TURN relay gives both sides a reachable meeting point on ports 80 and 443.

Which WebRTC AI agent setups need a TURN server
YOUR SETUP TURN SERVER? WHY
The browser talks straight to the OpenAI Realtime API over WebRTC Not needed OpenAI terminates WebRTC on its own publicly reachable servers, and its WebRTC guide doesn't ask you for STUN or TURN.
Gemini Live API Not needed The Live API streams over WebSockets, not WebRTC.
Your own agent server terminates WebRTC (aiortc, Pipecat's SmallWebRTC transport, FastRTC) Yes Users behind firewalls that block UDP can only reach your agent through a relay over TCP on ports 80 and 443 or TLS on port 443.
The agent runs in a container or VPC without a public IP Yes Both ends sit behind NAT. A relay is the address they can both reach.
Amazon Bedrock AgentCore with WebRTC Required AWS requires a TURN relay for media between the client and the agent. TURN for AgentCore WebRTC
An AI avatar or video agent you host yourself Usually Same reasons as a self-hosted voice agent, with more media per session.

03 — ARCHITECTURE

How a TURN relay fits into voice AI infrastructure

A voice agent is a WebRTC peer. The user's browser or app streams microphone audio to the agent, and the agent streams its spoken reply back. When the direct path fails, both sides send that media through a TURN relay instead.

The relay only moves packets. Your speech-to-text, LLM and text-to-speech stay wherever you run them.

  • TURN over TLS on port 443 reaches users on networks that block UDP and non-web ports.
  • Automatic geo-routing connects each client to the nearest relay server.
  • Media passes through the relay still encrypted by WebRTC. Metered holds no keys and never inspects, stores or records it.

VOICE AGENT MEDIA PATH

Voice agent media path through a TURN relay The user's browser or app sends media over UDP, TCP or TLS on port 443 to a Metered TURN relay, which forwards it to the AI agent running speech-to-text, an LLM and text-to-speech. User browser or mobile app UDP · TCP · TLS 443 TURN relay Metered relayed media AI agent STT LLM TTS

The relay forwards media packets. Speech-to-text, the LLM and text-to-speech run wherever you deploy them.

04 — BUILT FOR AGENTS

Built for real-time AI agents

What a WebRTC agent needs from its relay: a way through restrictive networks, servers close to your users, and credentials your code can manage.

Gets through locked-down networks

TURN over TCP on ports 80 and 443 and TLS on port 443 reaches users on office, school and hospital networks that block UDP.

Low-latency relays near your users

Automatic geo-routing sends each session to the nearest of 31+ relay regions, so the relay adds as little distance as possible.

Credentials from a REST API

Create TURN credentials with an optional expiry, then fetch the ready-made ICE server list for any session. Each credential's API key covers that one credential.

Usage per credential

Label credentials and pull daily usage for each one, so you can attribute relay traffic to a customer, an agent or an environment.

Relays in the region you choose

Choose a specific region for data residency compliance.

Media stays private

Media passes through the relay still encrypted by WebRTC. Metered holds no keys and never inspects, stores or records it. Connection metadata, including IP addresses, is kept for 30 days.

05 — USE CASES

Where AI agents use TURN

WebRTC voice agents

Support, scheduling and sales agents that talk to people in a browser or an app. Callers on corporate Wi-Fi or a mobile carrier still connect.

Video agents and real-time AI avatars

Avatars and video agents stream far more data per session than voice, so a relay close to the user matters even more.

Vision agents

Agents that watch a camera feed or a shared screen receive the video over WebRTC, even when the camera sits behind a NAT you don't control.

Agents on Amazon Bedrock AgentCore

AgentCore Runtime requires a TURN relay for WebRTC. See how to connect Metered TURN to an AgentCore agent.

TURN for AgentCore WebRTC

06 — PLANS

Start free. Scale to enterprise.

Prototype your agent on the free trial, then move to the plan, or the contract, that fits your traffic.

STARTUPS AND GROWING TEAMS

Self-serve, live in minutes

  • 500 MB of TURN every month on the free trial. It renews monthly and needs no credit card.
  • Paid plans from $99/month as your agents take on real traffic.
  • Create credentials and fetch ICE servers from the REST API.
  • Docs your coding assistant can read, from our Build with AI page.
  • Email support on every plan, including the free trial; priority support on the Business plan.

07 — RESOURCES

Guides and docs

08 — FAQ

TURN server for AI agents: FAQ

Do AI voice agents need a TURN server?

Usually. A voice agent is a WebRTC peer, so users on networks that block UDP can only reach it through a relay over TCP on ports 80 and 443 or TLS on port 443. An agent that runs in a container or VPC without a public IP needs a relay too, because both ends sit behind NAT.

Do I need a TURN server for the OpenAI Realtime API over WebRTC?

Not for the connection between the browser and OpenAI. OpenAI terminates WebRTC on its own publicly reachable servers, and its WebRTC guide doesn't ask you to configure STUN or TURN. You need TURN when your own server terminates WebRTC, for example an agent that sits between your users and the model.

Does the Gemini Live API use WebRTC?

No. Google's Live API streams over WebSockets, so it doesn't use a TURN server. If you put a WebRTC layer in front of it to reach browsers and mobile apps, that layer needs TURN for users on restrictive networks.

Does a TURN relay add latency to a voice agent?

A relayed call travels through the relay server, so the relay's location matters. Metered connects each client to the nearest of 31+ relay regions, and WebRTC only uses the relay when a direct path fails. Check the path from your own network with the TURN server testing tool.

How do I add a TURN server to FastRTC or Pipecat?

Pass Metered's ICE server list to the framework. FastRTC's Stream takes it as rtc_configuration, and FastRTC's deployment guide notes that cloud hosts such as Hugging Face Spaces need a TURN server. Pipecat takes it as ice_servers on SmallWebRTCConnection, which its SmallWebRTC transport wraps.

Should a voice agent use WebRTC or WebSockets?

Use WebRTC between the user's device and your agent. It runs over UDP with the browser's echo cancellation and jitter buffering built in, and a lost packet doesn't hold up the audio behind it. WebSockets suit server-to-server links, such as your agent streaming to a model API.

Can relay traffic stay in the EU?

Yes. Choose a specific region for data residency compliance. Our DPA lists every sub-processor.

How should I give TURN credentials to agent sessions?

Use expiring credentials rotated on a schedule, for example a 48-hour credential created once a day, and fetch the current one's ICE server list at the start of each session. Its API key only returns that credential's ICE servers, so it's safe in front-end code. Don't create a credential per call: a new one takes up to two minutes to start working, as the rotation guide explains.

Keep your AI agents reachable.

Start with 500 MB of TURN every month, free. Move to a paid plan when your agents go to production.