API reference
Every public endpoint on https://realtimeavatar.ai/api/v1 — what it takes, what it returns, which scope it needs, and how it fails.
Base URL https://realtimeavatar.ai/api/v1. Every request carries Authorization: Bearer tic_…. A machine-readable spec for the realtime surface lives at /openapi.json.
curl https://realtimeavatar.ai/api/v1/credits/balance \
-H "Authorization: Bearer $REALTIME_AVATAR_API_KEY"import { RealtimeAvatar } from "realtime-avatar";
const rta = new RealtimeAvatar({ apiKey: process.env.REALTIME_AVATAR_API_KEY! });
await rta.creditBalance();import os, httpx
client = httpx.Client(
base_url="https://realtimeavatar.ai/api/v1",
headers={"Authorization": f"Bearer {os.environ['REALTIME_AVATAR_API_KEY']}"})
client.get("/credits/balance").json()Realtime
| Endpoint | Scope | Notes |
|---|---|---|
POST /realtime/livekit/session | realtime:write | Mint a session. Returns a grant, or 429 with the queue contract when capacity is full. See Calls. |
POST /realtime/livekit/session/release | realtime:write | Free the call's slot. Free of charge and idempotent, so calling it twice — or on a call that already ended — is safe. { session_id | queue_ticket_id, reason?, capacity_pool? } — one of the two ids is required. reason is a closed set: page_hide · disconnected · superseded · unmount · manual · idle_timeout. Anything else is a 422, and a rejected release frees nothing — the slot stays held until it expires on its own, so send one of these or omit the field. The SDK sends it for you. |
POST /realtime/livekit/prejoin | realtime:write | Join an end user to a room before the call, so starting it skips the connection. { user, room_name?, participant_identity? } returns a subscribe-only grant (prejoin_id, room_name, livekit_url, participant_token, participant_identity, expires_at). Start the call with prejoin: { id, user } in the session request (video only); if its grant names the same room_name, keep the connection. Free; one per user; deleted after 60 seconds unless a call takes it over. |
GET /realtime/livekit/capacity | realtime:write | Snapshot of one pool — the orchestrator default, named by capacity_pool in the body (primary). Mints fail over across pools and voice calls are not capacity-gated, so this does not predict whether a mint will be granted. Do not gate a call on it: mint, and treat the 429 as the queue. |
Scenes (preview)
Enabled per workspace; other workspaces get 403 scene_sessions_not_enabled. A scene is a clip you supply, prepared once and then played as a call's picture: mint with scene: { video_cache_id } and the avatar keeps her voice and persona. You can read back and mint only scenes your workspace prepared; any other id is 404 scene_not_found. A mint also needs the scene to be ready, otherwise it answers 409 scene_not_ready (retryable while it is still building). Prepared scenes are kept for a limited time: a mint of one that has expired answers 404 scene_not_found, and preparing it again rebuilds it. A workspace holds at most 2 scene calls at once unless support raises it; another answers 429 scene_concurrency_limit_reached, retryable once one ends.
| Endpoint | Scope | Notes |
|---|---|---|
POST /scenes | realtime:write | { source: { url, md5?, bytes? }, continuation?, profile: "scene-v0" }. The id comes from the clip's content, not its URL, so the same bytes always get the same id, and a clip already prepared answers ready at once when you send its md5 and bytes. Answers 202 while building and 200 once ready or failed. A failed state names why in error: source_unreachable (the clip could not be downloaded; retry a few times with backoff), source_unusable (use a different clip), source_mismatch (the bytes differ from your md5 or bytes) or build_failed. Its scene_id is "unresolved" when the download failed and you sent no md5 and bytes. A source the preparer refuses is 422 scene_source_rejected; 503 scene_builder_unavailable means preparation is not offered on this deployment. |
GET /scenes/{sceneId} | realtime:write | The build state of a scene your workspace prepared. ready carries video_cache_id and the frame counts a mint may pass through. |
Voices
Turn text into an audio file in a voice your workspace can use: the shared presets, voices it designed, and voices it added from the public voice library, by the voiceId an avatar carries as defaultVoiceId. It is the same voice and voice model a call speaks with, and each request is a fresh read, so two runs of one sentence can differ slightly in pacing. The voice is never substituted: one that cannot be used is refused rather than replaced. Open to workspaces on a paid plan or that have bought credits; a workspace on the free Sandbox grant alone gets 403 speech_requires_purchase, and buying a credit pack unlocks it.
| Endpoint | Scope | Notes |
|---|---|---|
POST /voices/{voiceId}/speech | speech:write | { text, format?: "mp3" | "wav", speed?, language? }. text is at most 2,000 characters after trimming; speed is 0.5 to 2; language is a tag such as en-AU that shapes how numbers, dates and units are read, not the voice. The response is the audio file (audio/mpeg by default, audio/wav on request), with what it cost in X-RTA-Billed-Credits and X-RTA-Billed-Bytes. The scope is off by default on new keys: tick Generate speech audio when you create one. |
POST /voices/{voiceId}/speech/stream | speech:write | { text, speed?, language?, latency?, chunkLength? }, without format. latency is normal, balanced (default) or low; chunkLength (100 to 300) is the provider's text-chunk size, smaller starting audio sooner. Neither changes the price. SSE JSON events carry type and requestId: started declares pcm_s16le, 24000 Hz mono; audio carries sequence, contiguous sampleOffset and audioBase64; alignment replaces the snapshot for chunkSeq with absolute-second {text,start,end} segments; completed carries totalSamples, billedCredits and billedBytes only after settlement; failed carries the canonical API error envelope. |
Streaming. Audio arrives before the complete synthesis. Append every audio payload, including when an alignment snapshot repeats; replace alignment by chunkSeq. Before admission, refusals are ordinary HTTP JSON errors. After started, a failure is an SSE failed event, even after partial audio; those bytes cannot be retracted. An end without completed is not success. Limits are 180 seconds, 16 KiB PCM per audio event and 256 KiB queued delivery. A stalled reader is disconnected instead of retaining unbounded audio. Disconnect stops delivery, not already admitted synthesis: work drains within the provider timeout and settles or refunds, subject to the runtime's post-disconnect lifetime limit. Do not automatically retry an uncertain result: another request synthesizes and bills again. The file endpoint and its billing headers are unchanged; streaming final billing is in completed, not headers.
Pricing. Billed per byte of text, the unit the voice provider meters: 1 credit per 90 bytes of UTF-8 text, rounded up, with a minimum of 1 credit per request, taken from the workspace balance. 90 bytes is 90 characters of plain English; accented letters and other scripts use 2 to 4 bytes each. A request that fails is not charged: the credits are held while the audio is generated and released if it is not. A key's spend limit applies, so a key with only speech:write and a small spend limit bounds what that key can spend.
Your audio. Nothing is stored on our side: not the text, not the audio. You may store the file and replay it in your own product. We keep a usage record (which voice, how many bytes, the format and the credits) for billing. A saved file keeps working, but generating new audio depends on the voice staying available; a library voice its owner removes can no longer be generated (422 voice_unavailable).
Limits and retries. At most 240 requests a minute per workspace (429 rate_limited), and a per-workspace cap on requests in progress, under a platform-wide cap (429 speech_busy with Retry-After: 2); both are retryable, so honour Retry-After rather than retrying at once. There is no Idempotency-Key replay, because nothing is kept to replay: a retry after a timed-out success is billed again. Text in [square brackets] may be performed as a delivery cue instead of spoken, so leave brackets out of text you want read aloud.
Refusals. 404 voice_not_found for a voice this workspace cannot see; 409 voice_not_ready while it is still being prepared; 422 voice_unavailable for a voice that cannot be used to generate speech, including one that is not a shared preset, not designed by your workspace and not in the public voice library; 422 speech_rejected when the voice provider refuses the request itself (check the text, format, speed and language); 422 speech_too_long when the audio is longer than one response can carry (split the text, or ask for mp3); 402 when the balance or the key's limit does not cover the request (nothing is generated); 502, 503 or 504 when generation fails. None of these is charged, and the 422s will fail the same way if sent again unchanged.
curl -sS -X POST "https://realtimeavatar.ai/api/v1/voices/$VOICE_ID/speech" \
-H "Authorization: Bearer $REALTIME_AVATAR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"Thanks for calling. Your order is ready to collect after 2:30 this afternoon.","format":"mp3"}' \
-D speech-headers.txt -o reminder.mp3
grep -i '^x-rta-billed' speech-headers.txt # X-RTA-Billed-Credits: 1import { writeFile } from "node:fs/promises";
const voiceId = process.env.VOICE_ID!;
const response = await fetch(`https://realtimeavatar.ai/api/v1/voices/${voiceId}/speech`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.REALTIME_AVATAR_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ text: "Thanks for calling. Your order is ready to collect after 2:30 this afternoon.", format: "mp3" }),
});
if (!response.ok) throw new Error((await response.json()).error);
await writeFile("reminder.mp3", Buffer.from(await response.arrayBuffer()));
console.log("billed credits:", response.headers.get("X-RTA-Billed-Credits"));import os, httpx
voice_id = os.environ["VOICE_ID"]
response = httpx.post(
f"https://realtimeavatar.ai/api/v1/voices/{voice_id}/speech",
headers={"Authorization": f"Bearer {os.environ['REALTIME_AVATAR_API_KEY']}"},
json={"text": "Thanks for calling. Your order is ready to collect after 2:30 this afternoon.", "format": "mp3"},
timeout=90)
response.raise_for_status()
with open("reminder.mp3", "wb") as f:
f.write(response.content)
print("billed credits:", response.headers["X-RTA-Billed-Credits"])Connection history
| Endpoint | Scope | Notes |
|---|---|---|
GET /sessions/{sessionId}/connection-history | usage:read | Read received client connection observations for a session in your workspace. Empty data means no observations were received. Enable collection in server session policy; the SDK owns uploads. |
Recordings
| Endpoint | Scope | Notes |
|---|---|---|
GET /recordings | recordings:read | List your workspace's recording metadata. Optional sessionId, limit, and cursor filters. |
GET /recordings/{recordingId} | recordings:read | Get the recording's current status and retention deadline. Media can finish processing after the call ends. |
GET /recordings/{recordingId}/access | recordings:read | Get a private playback URL for a ready recording. The URL supports seeking, lasts at most one hour, and can be renewed within retention. |
Renders
Everything in one shot happens at the same time; shots play one after another. A render is an MP4 (H.264 and AAC, 25 fps) of an avatar performing a list of shots, made offline with no live call: the same face, voice and clips a call would use, and every frame is lip-synced.
{
"avatarId": "ava_0123456789abcdef0123456789abcdef",
"shots": [
{
"clipId": "gesture_send_flower",
"say": "你终于来了。今天……我有话想对你说。"
},
{
"clipId": "idle_touch_collar",
"say": "别笑,我是认真的。",
"pauseAfterMs": 800
},
{
"say": "所以,今晚留下来。"
}
]
}Each shot has three optional fields, and needs at least one of them:
clipId: what she does. A ready clip from the avatar's clip library, or"primary"for the avatar's own video. Omit it to keep the current loop clip; the first shot starts on"primary".say: what she says, 1 to 1,000 characters. Speech starts when the shot starts.pauseAfterMs: how long she stays silent after speaking, 0 to 10,000 ms. Default 0.
A shot lasts as long as its speech plus pauseAfterMs, or as long as a once clip's action if that is longer, rounded up to 200 ms; no shot is shorter than 200 ms, so a shot that only names a loop clip just switches to it. A once clip plays its action exactly once from its first frame and is never cut; if the shot is longer, she continues on the loop clip from before the shot. A loop clip fills the shot, and the same loop clip in consecutive shots continues without restarting. Once or loop: A clip loops if it is "primary" or in the avatar's idle pool (behavior.idle.clips in the avatar's clip list); every other clip plays once. Up to 50 shots; at least one says something; at most 4,000 characters of say in total and 16 different clips besides "primary".
Create it, poll it until ready or failed, then ask for a download URL. Both scopes are off by default on new keys: tick Render videos and Download rendered videos when you create one.
| Endpoint | Scope | Notes |
|---|---|---|
POST /renders | renders:write | { avatarId, voiceId?, voice?, lipGain?, shots }. voiceId is a voice from your workspace's voice library; voice is an inline Fish voice, the same object a live call takes; omit both to use the avatar's own voice (sending both is refused). Only a Fish voice can render: when the avatar's own voice is not a Fish voice and neither was sent, the render is refused with 422 voice_unavailable rather than spoken in another voice, so pass voice or voiceId. lipGain is the mouth-motion amplitude, as on a live call. Answers 202 with the render, status: "queued". Send an Idempotency-Key so a retry returns the same render instead of starting another. 400 render_too_long means the shots would make a video longer than 180 seconds (nothing is charged); 422 render_clip_unavailable names a clip that is not a ready clip of this avatar; 404 voice_not_found a voice this workspace cannot see and 422 voice_unavailable a voice that cannot be used for video, whether inline, named, or the avatar's own (a voice is never replaced); 429 concurrency_limit_reached means this workspace already has 4 renders queued or rendering (retry when one finishes); 503 render_export_unavailable means rendering is not offered on this deployment, and 503 render_start_failed that this render could not be started (it is listed as failed, nothing is charged, and a retry starts a new render). |
GET /renders | renders:read | Your workspace's renders, newest first. Optional limit (1 to 100) and cursor (the previous page's nextCursor). |
GET /renders/{renderId} | renders:read | { id, object: "render", status, avatarId, voiceId, durationMs, width, height, timeline, error, createdAt, completedAt }. status is queued, rendering, ready or failed; voiceId is the library voice it speaks with, the one you sent or the avatar's own (null when it speaks with the inline voice you sent). Once ready, timeline has one entry per shot, in milliseconds of video: { index, startMs, endMs, clipId, playback, speechStartMs, speechEndMs, clipEndMs, afterClipId }, where clipEndMs is when a once clip's action finished and afterClipId the loop clip shown after it. A failed render carries error: { code, message } with code one of asset_unavailable, tts_failed, too_long or render_failed. |
GET /renders/{renderId}/access | renders:read | { id, url, expiresAt }: a private download URL for a ready render. It supports seeking and lasts one hour; ask again for a new one. 409 render_not_ready before the render is ready. |
Pricing. 1 credit per second of rendered video, the same rate as a live call. Creating a render holds an upper-bound estimate from the shots, the render settles to its real length, and a failed render is not charged. A video may be at most 180 seconds: shots estimated longer are refused with 400 render_too_long before anything is held. Rendered videos are kept until you delete your account.
Avatars
| Endpoint | Scope | Notes |
|---|---|---|
GET /avatars | avatars:read | List the workspace's avatars (most recently updated first, capped at 100) as { data: [...] }. |
POST /avatars | avatars:write | { displayName, sourceAssetId?, motionPrompt?, voice?, defaultVoiceId?, llm?, settings?, metadata? } → 201 (preprocessing with a portrait attached; draft without one). Creation is image-only: sourceAssetId names an uploaded portrait and the platform generates the looping idle video plus a multi-clip motion library in the background — poll until status is ready. motionPrompt optionally art-directs the generated loop. Custom video upload is not supported. |
GET /avatars/{id} | avatars:read | Includes status: draft · preprocessing · ready · failed · disabled · deleted and idleVideoStatus: none · queued · generating · ready · failed (the background motion-generation progress). Mint only against ready; on failed, error says why. |
PATCH /avatars/{id} | avatars:write | Partial update; at least one field required. Profile fields allow 160 characters for the name, 4,000 for personality, 8,000 for background, 2,500 for art direction, and 1,000 for reply style. The merged stored profile, including custom metadata and the system template, must fit 16,000 characters of session instructions; exceeding that total returns 422 before the update is saved. Limits use JavaScript string length (UTF-16 code units). portraitUrl is in the schema but is dashboard-only — over this API it is always 400. To change the portrait, register the image with POST /assets or POST /assets/remote and PATCH the returned id as sourceAssetId, which is its own swap lane: it consumes anchorTimeMs as the new source's frame and is exclusive of every other field except sourceReview. sourceReview: { reason } records that a person watched the new loop and accepts it: the automated source checks still run and are audited, but they no longer refuse the swap. |
DELETE /avatars/{id} | avatars:write | Soft delete. |
GET /avatars/{id}/clips | avatars:read | The envelope is { data, avatarId, revision, anchorVersion, anchor, clipLibraryEligible, defaultSourceAssetId, behavior }. Each media/job row in data contains clipId, status, url, source, uploadAssetId, motionPrompt, durationSeconds, anchorVersion, poseCheck, error, createdAt, updatedAt; there is no row-level role, whenHint, or weight. behavior contains optional idle and on rules. The job's status is separate from the serving url, which can remain non-null during a replacement or after its failure. Map uploaded rows back to source: { assetId: uploadAssetId } and generated rows to source: { motionPrompt, durationSeconds } for PUT (omit a null duration); older generated rows with null direction require a new prompt. Behavior moves from the GET envelope to PUT's top level. Sessions always inherit the avatar's serving clips and declared behavior. Session HTTP inputs reject clip_library, clip_behavior, and choreography, including an empty clip library. |
PUT /avatars/{id}/loop | avatars:write | Re-direct the source loop from a new motionPrompt. This is the default resting video without an explicit idle pool; it is not privileged in idle selection. To reference a previous source asset separately, declare the defaultSourceAssetId returned by listClips(avatarId) under a new clip record id using source: { assetId } and reference it in idle. That record keeps the asset it references even after a source-loop update. Answers 202; the render takes minutes, during which she stays ready and keeps serving her previous loop (returned as servingUrl), then the swap publishes at once. Your clip library is untouched. Billed as one generation. Requires a portrait to re-animate — 422 loop_not_generatable (terminal) when she has none: a draft created without sourceAssetId, or a grandfathered avatar built from a supplied video. Do not gate on sourceKind: it reads video for every avatar once her generated loop attaches. 409 loop_pending means one is already in flight. The description is screened like a clip's (422 loop_prompt_rejected). |
POST /avatars/{id}/clips/review | avatars:write | Human quality acceptance for one uploaded clip. Send clipId, uploadAssetId,expectedRevision, expectedAnchorVersion and a reason (5–500 characters). Accepts a pose refusal or pending validation after review; keeps the original machine verdict, records the decision and prepares the serving cache. Returns 204. Changed generations return 409. Other processing failures and invalid media remain refused. Ten seconds is a maximum, not a required duration. Clip Library access is enabled by default for active workspaces and can be disabled by an operator. |
PUT /avatars/{id}/clips | avatars:write | Full replacement: { expectedRevision, clips, idle?, on?, actions? }. Required clips is a record keyed by clip id, each value { source }; source is exactly { assetId } or { motionPrompt, durationSeconds? }. Generated source.durationSeconds is an integer from 4–8 seconds, default 5. Optional idle is { clips, weight? }; on.userSpeechStarted contains { clips }; actions is a record keyed by action id whose values are { description, clips }. Every clips list is a nonempty array of declared clip ids. The same clip can serve several lists. Source changes queue media work; selection and action metadata changes do not re-render unchanged sources. Omitted records are retired and omitted behavior is removed. Required expectedRevision is a nonnegative integer for compare-and-set: stale writes get 409 revision_conflict with the current revision. Answers 202 with the GET envelope plus plan: { kept, queued, retired }. Enabled by default for active workspaces; an operator-disabled workspace receives 403 clip_library_not_enabled. Motion prompts and action descriptions are screened even on metadata-only writes: refusal is 422 clip_declaration_rejected; if the screen cannot run, the write fails closed with retryable 503 clip_screen_unavailable. |
Idle variations, events and actions
The source (primary) and authored idle clips form one weighted idle pool.idle.weights maps member IDs to finite weights from 0–100; each omitted member defaults to 1, zero disables it, and at least one must remain positive. Every member avoids immediately repeating when another is available; a sole available member loops completely. Do not combine this map with legacyidle.weight, which is converted into aggregate member weights. Lists are nonempty and cannot repeat a clip id. Unavailable members are filtered before selection and weights are renormalized. Ten idle variations are valid; there are no role-count or total-clip authoring caps beyond 32 per list. The 64 KB request-byte transport bound and worker admission remain independent constraints, not unlimited GPU capacity. If the source is disabled and every positive member is pending, mint returns retryable clip_library_not_ready.
userSpeechStarted plays one listening reaction, once per event, rather than holding a listening loop — a triggered reaction repeats freely. actions exposes the requestable menu: the language model reads each description to choose an appropriate action, then that action's clips list chooses a take; declaring an action never plays it by itself. The same clip can serve idle, listening and any action. Speaker lip-sync runs on the current playback cursor during full-duplex speech, without restarting the body on a separate talking clip.
Clip and action ids are 1–64 letters, digits, underscores, or hyphens; reserved keys are refused. Action descriptions are trimmed, nonempty, and at most 512 characters. Motion prompts are trimmed, nonempty, and at most 1,200 characters. Asset ids are trimmed, nonempty, and at most 160 characters. Strict objects reject unknown fields. Keep declaration writes server-owned; do not let caller-supplied prose bypass your application's policy or the platform's safety screening.
{
"expectedRevision": 0,
"clips": {
"sway": { "source": { "motionPrompt": "Sways gently, settles back to rest" } },
"nod": { "source": { "motionPrompt": "A gentle nod, then returns to rest", "durationSeconds": 5 } }
},
"idle": { "clips": ["sway", "nod"] },
"on": {
"userSpeechStarted": { "clips": ["nod"] }
},
"actions": {
"agree": { "description": "When agreeing with the user", "clips": ["nod"] }
}
}Replace the sample revision with the latest GET revision. This full replacement retires records not shown here; include all existing records and behavior you intend to keep.
Assets
| Endpoint | Scope | Notes |
|---|---|---|
GET /assets | avatars:read | List uploaded assets. |
POST /assets | avatars:write | Multipart: file, optional kind (image | video | audio) → 201. Video assets are accepted as uploaded motion-clip sources; they do not reopen custom-video Avatar creation. A clip declaration pose-validates video and requires it to fit the 18 MB QC ceiling. |
POST /assets/remote | avatars:write | { kind, remoteUrl, originalFilename?, metadata? } — the platform streams the file into storage. remoteUrl must be https on a public host name: IP addresses, workers.dev and our own hosts are refused with 422, every redirect (up to five) is held to the same rule, and an upstream failure is a plain 502. One of your own asset URLs is copied directly, and only if it belongs to your workspace. Video assets may be referenced by PUT /avatars/{id}/clips; prefer remote registration when the bytes already live in object storage. |
Billing and keys
| Endpoint | Scope | Notes |
|---|---|---|
GET /credits/balance | credits:read | Balance and currently reserved credits, in micros. Live sessions hold a reservation for their duration. |
GET /usage/sessions | usage:read | Per-session billing detail — when each session ran, how long it was billable for, and what it cost. This is what reconciles an invoice, or re-bills your own users; the dashboard aggregate can do neither. The window defaults to the trailing 30 days and is clamped to 90 — a wider range is served narrowed, not refused, so read back the returned from/to. Page with nextCursor. ?endUserId= narrows to one of your users when the call was tagged with client_metadata.user_id. Read status before you sum anything. Only released and failed are settled: released is the normal end of a call and carries the charge, failed is terminal and always billedCreditMicros: 0. The other two are not final — reserved is a slot that was held and never became a call, and started is still in flight. Both report billedCreditMicros: 0 provisionally: a started row settles when the session is released, so the same session read again tomorrow can carry a different number. Reconcile on the settled rows and treat the rest as pending, not as free. Send exactly X-RTA-Speech-Diagnostics: 1 to include optional speechDiagnostics; otherwise the field is omitted without reading summaries. Opt-in pages clamp to 50 rows (ordinary pages allow 200), using the same cursor. Each row explicitly reports available or unavailable evidence. Available evidence is dialogue-only, whole-session latency_ms spreads (count/p50/p90/max), sourceRole: dialogue and coverage first/last log timestamps and line count. It is not sliced by query dates; do not pool percentiles. Missing legs remain unknown, not zero. Only released or failed sessions with non-null endedAt can have evidence. The read budget is 64 KiB per summary, four concurrent reads and five seconds for the D1 page query and all R2 reads together, bounded by request cancellation; the budget is not reset after SQL. Before page rows are known, timeout returns the standard 504 upstream_timeout error (retryable), and cancellation returns 408 request_aborted(not retryable), never an empty page or fabricated row evidence. A pre-aborted read starts no page query. D1 cannot cancel an in-flight read; late results are ignored without starting R2. Once rows are known, R2 timeout/cancellation remains unavailable evidence per row. Ordinary pages keep their existing SQL wait and error behavior. Open, missing, malformed, oversized, unconfigured, timed-out, cancelled or unreadable records are unavailable. Truncated records, unreadable lines, negative counts/latencies, nonpositive leg counts and unordered percentiles are unscorable. Log coverage may extend after release. No warnings, levels, raw logs, messages, refusals, credentials, worker IDs or labels are exposed. Nonfinite JSON nulls and integers beyond JavaScript's safe range are rejected. Older servers may ignore the header. |
POST /api-keys | api_keys:write | { name, scopes?, spendLimitCreditMicros?, expiresAt? }. Only name is required. All new keys use tic_<keyId>_<secret>. The deprecated environment field is accepted but ignored. scopes defaults to realtime:write, credits:read and avatars:read, which starts calls and reads but writes no avatars. The new key may hold only scopes the calling key holds, never api_keys:write or *, so a key created this way cannot create keys. If the calling key has a spend limit or an expiry, the new key must set its own, no higher and no later. Anything wider is 403 insufficient_scope. Spend limits apply per key, not as a shared budget, and revoking the calling key does not revoke the keys it created. The creation response includes the full key. Workspace owners and admins can copy newly created keys again in Settings → API keys while they are active and unexpired; the list stays masked with a Copy action. Legacy keys stored as hashes only cannot be recovered if lost and need a replacement. Revoked or expired keys cannot be copied. |
Errors
Switch on code and HTTP status, not the wording of error. Correlated failures include a server-generated requestId, also in X-Request-ID; include it when contacting support. Session failures retain safe codes such as internal_error (500), capacity_unavailable and session_dispatch_failed (503), upstream_unreachable and invalid_upstream_response (502), upstream_timeout (504), and request_aborted (408). Internal diagnostics require separate operational access. A capacity queue 429 keeps its existing body; its request ID is in the header only.
| Status | Meaning | What to do |
|---|---|---|
| 401 | Missing, malformed, revoked, or expired key | Use a full, active, unexpired key. Owners and admins can copy eligible keys again in workspace Settings. Replace lost legacy keys, revoked keys, or expired keys. See Authentication. |
| 403 | The key lacks the scope for this operation, or its workspace is not active (error reads Tenant is not active) | Read error: mint a key with the scope (do not widen to *), or have the workspace reactivated — there is no self-serve switch for that |
| 402 | insufficient_credits or spend_limit_exceeded | Top up, or raise the per-key spend limit. Surface this as a paywall, not as a connection failure. |
| 409 | A conflict with state that already exists. Three kinds reach this API: no workspace on the account yet; an idempotency conflict (a key still in flight, or reused with a different body); and an avatar state conflict — it is disabled, already has a motion video, has no portrait to animate, or a change is still settling. | Read error — the three kinds want different things. A workspace is a one-time setup in the dashboard; an idempotency conflict wants a fresh Idempotency-Key (never the same one); an in-flight change wants a plain retry once it settles. |
| 404 | No such avatar, voice, or key — for this tenant. The message often reads "does not belong to this tenant", which sounds like a permission problem and is usually a wrong or already-deleted id. | Do not route this to your access-denied branch — 403 is the permission answer. Check the id, and remember a soft-deleted avatar is gone from every read. |
| 413 | The JSON body is over this route's cap | See the cap sizes under Conventions. This is almost always inlined media — send it as an asset and reference the id. |
| 422 | Schema rejection — an unknown, mis-cased, or invalid field | The wire schemas are strict. Check camelCase vs snake_case at the layer you are writing. |
| 429 | Plan concurrency ceiling, capacity full (session mint), or rate limited | A mint has two 429s, and they want opposite reactions. With code: "concurrency_limit_reached" the plan’s concurrent-session limit is reached. Starting and connecting sessions also count, even when no conversation is active. The top-level fields maxConcurrentSessions and liveSessions report the limit and occupied reservations; activeSessions, connectingSessions, and pendingSessions break down the count at refusal time. End a session or wait for pending starts to finish or be released before retrying. Avoid parallel duplicate starts, and release sessions on cancellation or unmount. Upgrade only when more simultaneous sessions are needed. Show the error to the caller and retain requestId for support. This refusal is not a queue position. Without a code, look at the body before deciding. A queue answer carries queue_size and recommended_retry_ms: the SDK returns a queued result (isQueued) with position and retryAfterMs — render the position and retry. Deliberately not auto-retried: a blind retry would burn the backoff to receive the same answer. A body with neither a code nor those fields is the per-key rate limit (see Conventions) — back off, do not treat it as a queue position. Use SDK 0.12.0 or later to preserve concurrency refusals as errors. Older SDKs, including 0.11.1 and 0.11.5, map every 429 to a queued result and can hide the refusal. A null queue position alone does not distinguish a refusal from a real queue. |
| 502 | An upstream generation or render failed | Retry; if it persists it is ours, not yours |
| 503 | A dependency this route needs is unavailable — a generation job that could not be started, a staging pipeline that is down, or (clip_screen_unavailable) the screen that vets clip descriptions. Never your request's fault. | Retry with backoff. Nothing was written, so a retry is safe and needs no Idempotency-Key to be correct — though sending one costs nothing. Two render codes differ: render_export_unavailable means this deployment does not render at all, so do not retry; render_start_failed recorded a failed, uncharged render, and a retry creates a new one. |
Conventions
- All
/api/v1responses areCache-Control: no-store. - JSON request bodies are size-capped per route — 4 KiB on the session release and clip review, 64 KiB on session creation and the clip-library
PUT, 128 KiB on avatar writes (create and update), and 8–32 KiB on other JSON routes. Field limits still apply within each byte budget. Over the body cap is a 413. Send media by URL, not inline. Idempotency-Keyis honoured on the three writes that cost money to repeat —PUT /avatars/{id}/clips,PUT /avatars/{id}/loopandPOST /renders. Replay returns the original response rather than doing the work twice. It matters most on the loop, where a repeated re-direct is a second billed render. A repeated clip declaration without the key has a staleexpectedRevisionafter acceptance and conflicts; re-reading and declaring unchanged sources does not re-render them. Reuse the same key with a different body and you get a 409 — a retry means the same request, so generate a fresh key for a changed one. No other endpoint reads the header.- 120 requests per 60 seconds, per key. The throttle is applied when the key is verified, so it covers every
/api/v1endpoint, and it counts per key rather than per workspace — splitting a workload across keys raises the ceiling. Over it is a 429 whose body carries nocodeand no queue fields, which is how you tell it from the other two. Worth sizing against: the creation flow asks you to pollGET /avatars/{id}untilstatusisready, and a render takes minutes — poll on the order of seconds, not milliseconds. - Ids are prefixed and stable:
ava_avatars,tic_API keys. - The SDK covers the integration path — calls, avatars, assets, usage, credits — with a surface that is deliberately narrower than this wire, though less narrow than it once was. Avatar update and delete are in it (
updateAvatar,deleteAvatar), as aregetAvatar,listAvatars,listClips,setClipLibrary,retimeAnchor,swapSourceanditerateSessions. Prefer it over hand-rolled fetches wherever it reaches. What it leaves out is key minting, the capacity snapshot and the asset listing — those three are a plain authenticated fetch against the endpoints above.
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