November 21, 2026 · 10 min · api · engineering
.mdIdle avatar calls and runaway bills: hard stop, timeout, mid-call
Which avatar APIs end idle calls: Tavus, Anam, Simli and HeyGen LiveAvatar rules as of Nov 2026, plus code for a hard stop, idle timer and server release.
Tavus, Anam and HeyGen LiveAvatar bill an open session by time, not talk time (each says so in its docs), so a call nobody ends keeps costing money. What ends an idle call differs by vendor, as of November 2026: Anam ends a session after 60 seconds of user silence by default; HeyGen LiveAvatar closes a session when no interaction is detected within a window it does not state, and ends sessions when credits run out unless overage is on; Simli's session token takes maxIdleTime (default 300) and maxSessionLength (default 3600); Tavus ends a call 300 seconds after creation if nobody joins and, by default, as soon as the last participant leaves, with max_call_duration as the cap. Every call therefore needs three guardrails: a hard stop, an idle rule and a release from your server. On Realtime Avatar, your server sets maxSeconds per call, up to 1,800 seconds, enforced on the platform side even if the client stops reporting; an enforced idle timer disconnects abandoned calls; and rta.endCall releases a call from your backend.
Below: each vendor's documented rules, five guardrails with code, and the worst-case cost of a forgotten tab. Vendor facts come from their own pages, read 16 November 2026 and linked at the end.
Idle and timeout behavior by vendor, as of November 2026
Three events should end a call: nobody joins, the user leaves, or the user stays connected and says nothing. The last, a tab left open on a desk, is the expensive one, because a leave timeout never fires.
- Tavus ends empty calls through participant timeouts: participant_absent_timeout ends the call if nobody joins after it is created (default 300 seconds), and participant_left_timeout is the wait after the last participant leaves (default 0). max_call_duration sets the longest call in seconds, capped at your plan's maximum.
- Tavus caveat: the same page's example sets participant_absent_timeout to 120 and says a participant who is present but inactive is ended after 120 seconds, while its parameter table defines that field as a no-join timeout. Test it before relying on it for a silent user who stays connected.
- Tavus billing: its pricing FAQ says a conversation is billed once its creation request is sent, whether or not a participant joins (it auto-closes after 5 minutes if nobody is present), with a 30-second minimum and rounding to the nearest 6 seconds. Its CVI FAQ adds that billing follows active session runtime, so calls left open or idle without adjusted timeouts can keep accruing.
- Anam ends a silent call by itself: its termination reasons page lists user_inactivity_timeout after the persona's silenceBeforeSessionEndSeconds window (60 seconds by default, with a spoken warning first when the window is at least 10 seconds; 0 disables it), and a platform-wide maximum of two hours per session. Its billing page says duration is recorded in seconds and that silence, a muted microphone or an idle avatar does not pause an active session.
- Simli puts the limits on the session token: the Compose Session Token request takes maxIdleTime (default 300) and maxSessionLength (default 3600); the page states no unit.
- HeyGen LiveAvatar closes idle sessions: its Keep Session Alive reference says a session is closed if the user does not join or no interaction is detected within a set time (not stated), and keep-alive refreshes that timer. Its credits FAQ charges per minute of session time (2 credits in FULL mode, 1 in LITE); without overage, sessions end automatically when credits run out, and with overage they do not.
- Realtime Avatar: maxSeconds (max_session_seconds on the wire) is a hard stop of up to 1,800 seconds, enforced on the platform side. The idle timer is enforced: when it fires, the client disconnects and capacity is freed. onQuiet warns first, the SDK releases the call on tab close, and rta.endCall ends it from your server. Metered by the second.
The rules do not replace each other. Match each leak to the guardrail that stops it:
- A user who talks for an hour: only a hard stop per call ends it (maxSeconds on Realtime Avatar, max_call_duration on Tavus, maxSessionLength on Simli).
- A tab left open on a desk: an idle rule ends it, and the hard stop catches it if the idle rule cannot run.
- A user who already left: a release from your server, or the browser's release on tab close.
- A call that starts before anyone wants one: render the call only after a click, and on Tavus create the conversation on the click.
- A key that leaks or a test loop that runs away: a spend limit on that key.
Guardrail 1: a hard stop on every call, set by your server
On Realtime Avatar the hard stop is a field in the session policy your server returns when a call is minted: maxSeconds in the SDK, max_session_seconds over raw HTTP. The Calls docs call it a hard stop, up to 1800, enforced on the platform side so it holds even if your client stops reporting, and tell you to compute it from the balance you just admitted. Whatever the browser sent for a policy field is discarded, so a modified client cannot raise its own limit.
So a per-user limit is a server decision: work out how many seconds this user may still spend, refuse the call if that is too little, and send the smaller of that number and 1,800. In a Next.js route:
// app/api/realtime-avatar/[...path]/route.ts
import { createRealtimeAvatarRoute } from "realtime-avatar/nextjs";
import { currentUser, secondsLeftToday } from "@/lib/billing"; // your own code
const HARD_STOP_CEILING = 1800; // the platform maximum for one call
const SHORTEST_CALL = 60; // your floor: below it, offer a top-up instead of a call
export const { GET, POST } = createRealtimeAvatarRoute({
apiKey: process.env.REALTIME_AVATAR_API_KEY!,
authorize: async ({ request }) => {
if (!(await currentUser(request))) return new Response("Sign in", { status: 401 });
},
// Runs on every connect. Whatever the browser sent for these fields is discarded.
session: async ({ request }) => {
const user = await currentUser(request);
if (!user) return new Response("Sign in", { status: 401 });
const allowance = await secondsLeftToday(user.id); // e.g. 600 on a free tier, 1800 on paid
if (allowance < SHORTEST_CALL) return new Response("Out of call time today", { status: 402 });
return {
instructions: "You are the onboarding guide for the Acme dashboard. Keep answers short.",
maxSeconds: Math.min(HARD_STOP_CEILING, Math.floor(allowance)), // whole seconds; hard stop, enforced on the platform side
metadata: { userId: user.id },
};
},
});
Other backends send max_session_seconds in POST /realtime/livekit/session. For allowances across calls, reconcile with the per-session usage records (start time, billable seconds, cost).
Worked example: the worst case for one abandoned call
Realtime Avatar meters by the second, and Starter's 7,200 credits equal 120 realtime minutes, so one credit is one second on air. The hard stop sets the most one abandoned call can spend if nothing ends it sooner. At the overage rates on the pricing page, as of November 2026:
- maxSeconds 1,800 (the ceiling): up to 1,800 credits, a quarter of Starter's 7,200 a month. Past the included minutes that is $2.85 at Starter's $0.095 a minute, $2.55 at Developer's $0.085 or $2.40 at Studio's $0.08.
- maxSeconds 600 (a support widget that never needs more than 10 minutes): up to 600 credits, or $0.95, $0.85 and $0.80 at the same three rates.
- 100 calls a month abandoned at the 1,800-second ceiling: 3,000 minutes, the entire monthly allowance of the $119 Studio plan.
The same arithmetic works for any vendor: cap, times per-minute rate, times abandoned calls.
Guardrail 2: an idle rule that actually ends the call
The Calls docs are blunt about why: an abandoned tab holding a live character is the most expensive thing that can happen in the product, and it would be on your bill. The idle timer is real and enforced. When it fires, the client disconnects, capacity is freed, and onEnded reports idle.
onQuiet fires when the user goes quiet, with secondsLeft, so you can ask Still there? before the call ends. When the user is silent on purpose, reading a long answer or working an exercise, call.keepAlive() says the user is still here and postpones the idle disconnect.
Note the split: the idle end is a client disconnect, while maxSeconds is enforced on the platform side. If the browser stops running your page, the hard stop still caps the call, which is why you want both.
Guardrail 3: end with a goodbye instead of a cut
A call that stops mid-sentence feels broken. When time is nearly up, onEnding hands you secondsLeft and a call handle; call.sayAndEnd(text) speaks your line exactly as written, never rewritten by the model, never interrupted, and then closes the call. Pass balanceMs and onLowBalance fires while there is still time to offer a top-up.
onEnded always carries one of seven reasons, and they deserve different screens:
- session_cap: the call reached its cap. Offer to continue in a new call.
- idle: nobody was talking. A one-tap Talk again button is enough.
- out_of_credits: the balance ran out. Show the top-up, not a retry.
- user_ended and agent_ended: a normal finish. Show next steps or ask for feedback.
- disconnected and failed: a network or service problem. Offer a retry.
Code: one AvatarCall with every client-side guardrail
The Ending well pattern from the Calls docs, wrapped so no call starts until the user presses Start:
"use client";
import { useState } from "react";
import { AvatarCall, createProxyClient } from "realtime-avatar/react";
import { EndScreen, openTopUp, showToast } from "@/components/call-ui"; // your own UI
const client = createProxyClient({ proxyUrl: "/api/realtime-avatar" });
export function GuardedCall({ avatarId, balanceMs }: { avatarId: string; balanceMs: number }) {
const [started, setStarted] = useState(false);
const [lastEnd, setLastEnd] = useState<string | null>(null); // the onEnded reason
// Nothing connects until the user presses Start.
if (!started) {
return (
<>
{lastEnd ? <EndScreen reason={lastEnd} /> : null}
<button onClick={() => setStarted(true)}>Start call</button>
</>
);
}
return (
<AvatarCall
client={client}
avatarId={avatarId}
balanceMs={balanceMs}
onEnding={({ secondsLeft, call }) => {
if (secondsLeft > 15) return; // wait for the last window
call.sayAndEnd("We're at time for today. Thanks for calling, and pick this up again whenever you like.");
}}
onQuiet={({ secondsLeft }) => showToast(`Still there? This call ends in ${secondsLeft}s.`)}
onLowBalance={({ secondsLeft }) => openTopUp(secondsLeft)}
onEnded={({ reason }) => {
setLastEnd(reason); // session_cap, idle, out_of_credits... each gets its own screen
setStarted(false);
}}
>
{(call) => <button onClick={call.end}>End call</button>}
</AvatarCall>
);
}
Guardrail 4: release the call from your server and on tab close
When your backend learns a call is over before the browser does (a webhook, an admin action, a superseded reconnect), call rta.endCall(sessionId, { reason }). It frees the slot immediately, best-effort and idempotent: true when acknowledged, false otherwise, never a throw, so calling it twice is safe. Over raw HTTP it is POST /realtime/livekit/session/release with the realtime:write scope.
// lib/end-call.ts (server only)
import { RealtimeAvatar } from "realtime-avatar";
import { liveCalls } from "@/lib/live-calls"; // your store: your user id -> Realtime Avatar session id, saved when the call was minted
const rta = new RealtimeAvatar({ apiKey: process.env.REALTIME_AVATAR_API_KEY! });
// Call this from the webhook or admin action that tells you the user is gone:
// a signed-out device, a cancelled plan, a closed support ticket.
export async function endUsersCall(userId: string): Promise<void> {
const sessionId = await liveCalls.get(userId);
if (!sessionId) return;
const released = await rta.endCall(sessionId, { reason: "manual" }); // true when acknowledged, never throws
if (!released) console.warn("release not acknowledged; the hard stop still applies", sessionId);
await liveCalls.delete(userId);
}
Keep the Realtime Avatar session id next to your own call id, as the Calls docs advise, so the handler can find it; when your server mints the call itself with rta.startCall, the result carries it as sessionId. In the browser, call.end() does the same job, and the SDK sends a release on tab close through releaseLiveKitSessionBeacon(), which survives the page going away where a normal fetch would not. The idle end is a client disconnect, so it needs the page: if the tab is gone and the beacon is lost, the hard stop still caps the call, because it is enforced on the platform side. If your proxy route runs on serverless functions, read the session ownership note in the Next.js guide before you rely on browser releases.
Guardrail 5: spend limits per key, and no call before a click
Realtime Avatar API keys are private keys with configurable permissions and spend limits. Give each deployment its own key (a public demo's backend, a test harness, production) and a low limit on the ones you trust least; see the Authentication docs.
And never start a call on page load: render the call component only after the user presses Start, as the code above does. With per-conversation billing this matters more. On Tavus a conversation is billed once its creation request is sent, with a 30-second minimum, whether or not anyone joins, so create it on the click.
Where another vendor fits better
- Calls over 30 minutes: Realtime Avatar caps any single call at 1,800 seconds. Tavus lists a 60-minute maximum conversation on its Growth and Business plans, and Anam's platform-wide maximum is two hours per session. On Realtime Avatar, continue in a new call.
- An idle window you set as a number: Tavus's timeouts and Simli's maxIdleTime are set per session, and Anam's silenceBeforeSessionEndSeconds per persona. Realtime Avatar's session policy has no idle field; the timer is enforced for you, with onQuiet to warn and keepAlive to postpone.
- Free testing: Tavus's test_mode tests conversation creation without cost. Realtime Avatar's free Sandbox gives 480 credits once per account, no card: 8 realtime minutes, or a first avatar plus 2 minutes of calls.
Questions developers ask about idle avatar calls
Why was I billed for more Tavus minutes than expected when calls sat idle?
Tavus bills active session runtime, not speaking time, and a conversation is billed once its creation request is sent, even if nobody joins, with a 30-second minimum. A user who stays connected and silent never triggers participant_left_timeout. Set max_call_duration and both timeouts on every conversation, and end silent calls with your own inactivity rule.
Anam keeps billing while the avatar is idle or the mic is muted. How do I stop paying?
Silence, a muted microphone or an idle avatar does not pause an active Anam session. By default a persona ends it after 60 seconds of user silence (silenceBeforeSessionEndSeconds), so check that nobody set it to 0, close sessions in your code when the user is done, and keep a total cap.
How do I stop a session running up my bill when a user leaves the tab open and walks away?
Stack two limits: an idle rule that ends the call when nobody talks (enforced on Realtime Avatar, with onQuiet warning first) and a hard stop for when the idle rule cannot run. With maxSeconds at 600, one forgotten tab costs at most 600 credits, or $0.95 at Starter's overage rate and $0.85 at Developer's.
How do I set a hard time limit per user so one person can't talk for an hour?
Compute it on your server from that user's remaining allowance and send it as maxSeconds, up to 1,800 seconds per call. The platform enforces it even if the client stops reporting, and the browser cannot override it.
If a user closes the browser mid-call, does the avatar session keep billing?
On Realtime Avatar the SDK sends a release beacon on tab close; if it is lost, the server-enforced hard stop still caps the call. On Tavus, participant_left_timeout defaults to 0, so the call ends when the last participant leaves. Anam ends a Turnkey session when the page closes (reason USER_LEFT), and its LiveKit integration ends a session 10 seconds after the room empties, by default.
My backend knows the user left. How do I end the session server side?
Call rta.endCall(sessionId, { reason }) from the handler that learns the user is gone. It frees the slot immediately, is safe to call twice and returns false instead of throwing. Anam documents the same move for its sessions: a call to its stop-session endpoint, POST /v1/sessions/:id/stop, force-terminates the session.
How do I end an avatar call with a goodbye instead of cutting it off mid-sentence?
In onEnding, which fires near the end with secondsLeft and a call handle, pass your closing line to call.sayAndEnd. It is spoken exactly as written, never interrupted, and the call closes after it.
My avatar call starts on page load and burns credits before anyone clicks
Render the call component only after the user presses Start, never on page load, and make Start the only way back in after a call ends. On Tavus, also create the conversation on the click, because creation alone is billed.
LiveAvatar ends sessions when credits run out. How do others warn the user and say goodbye?
On Realtime Avatar, pass balanceMs and onLowBalance fires while there is time to open a top-up; onEnding with sayAndEnd speaks a closing line you wrote; and the out_of_credits end reason tells your app to show a top-up screen, not a generic error.
Como limitar o tempo de cada chamada com avatar de IA para não estourar meus créditos?
No Realtime Avatar, o seu servidor define maxSeconds em cada chamada, até 1.800 segundos (30 minutos), calculado a partir do saldo que resta ao usuário. A plataforma aplica esse limite mesmo que o navegador pare de responder. Use onEnding com call.sayAndEnd para uma despedida antes do fim e onLowBalance para oferecer uma recarga a tempo.
- Max avatar call length by plan: what the hard stop does, end well
- Per-second avatar billing by vendor: 40-second calls and no-shows
- Concurrent avatar calls and 429 errors: plan limits, queue, retry
- Calls docs: hard stop, idle timer, ending well and server release
- React and React Native: building UI from call state
- Next.js guide: the proxy route and session ownership on serverless
- Authentication: API keys and spend limits
- Realtime Avatar pricing and the all-in cost table
- Tavus pricing per minute, explained
- Realtime Avatar vs Tavus
- Realtime Avatar vs Anam
- Realtime Avatar vs HeyGen LiveAvatar
- Realtime Avatar vs Simli
- Avatar call cost calculator
- Tavus: Call Duration and Timeout (read 16 November 2026)
- Tavus pricing and billing FAQ (read 16 November 2026)
- Tavus CVI FAQ: billing for idle conversations (read 16 November 2026)
- Anam: billing, usage and limits (read 16 November 2026)
- Anam: session termination reasons (read 16 November 2026)
- Simli: Compose Session Token (read 16 November 2026)
- HeyGen LiveAvatar: Keep Session Alive (read 16 November 2026)
- HeyGen LiveAvatar: credits and subscriptions (read 16 November 2026)
Compare and cost guides
- Realtime Avatar pricing
- Avatar API cost calculator
- Realtime Avatar vs Tavus, HeyGen LiveAvatar, Anam and Simli
- Realtime AI avatar APIs compared
- Realtime avatar API pricing, worked out
- HeyGen and LiveAvatar API pricing explained
- Choosing a HeyGen alternative for realtime avatars
- Tavus pricing per minute
- A Tavus alternative for live AI characters
- Meta Muse Realtime Avatar vs Realtime Avatar
- A realtime AI avatar in React Native or Expo
- Live avatars in 2026: a field guide to the research