Text to Avatar Video
Write a script, choose a Cara-4 avatar and voice, and render a polished talking-avatar video. Powered by the Anam Text to Avatar Video API
What you are seeing
Meet Cara-4, Anam's most expressive and controllable real-time avatar model. It pairs higher-resolution video with Director Notes, broader visual styles, and production-ready performance for more natural face-to-face conversations.
- 1Director NotesDynamic control
- 2Native formats1152×768 · 768×1152
- 3Visual stylesPhoto · 3D · anime
- 4Avatar generation~150 ms average
Generate avatar videos from text with the API
Create an asynchronous render on your server, poll its status, then download the finished MP4.
import { randomUUID } from "node:crypto";
import { writeFile } from "node:fs/promises";
const apiKey = process.env.ANAM_API_KEY;
const avatarId = process.env.ANAM_AVATAR_ID;
const voiceId = process.env.ANAM_VOICE_ID;
const inputText = "Welcome to the product tour.";
if (!apiKey || !avatarId || !voiceId) {
throw new Error("Set ANAM_API_KEY, ANAM_AVATAR_ID, and ANAM_VOICE_ID");
}
const createResponse = await fetch("https://api.anam.ai/v1/avatar-videos", {
method: "POST",
headers: {
Authorization: "Bearer " + apiKey,
"Content-Type": "application/json",
// Reuse this value if you retry the same create request.
"Idempotency-Key": process.env.ANAM_IDEMPOTENCY_KEY ?? randomUUID(),
},
body: JSON.stringify({
script: inputText,
avatarId,
voiceId,
}),
});
if (!createResponse.ok) throw new Error(await createResponse.text());
let video = await createResponse.json();
while (!["completed", "failed", "cancelled"].includes(video.status)) {
await new Promise((resolve) => setTimeout(resolve, 2_000));
const statusResponse = await fetch(
"https://api.anam.ai/v1/avatar-videos/" + video.id,
{ headers: { Authorization: "Bearer " + apiKey } },
);
if (!statusResponse.ok) throw new Error(await statusResponse.text());
video = await statusResponse.json();
}
if (video.status !== "completed" || !video.content?.available) {
throw new Error(video.failure?.message ?? "Avatar video was not completed");
}
const mp4 = await fetch(video.content.url);
if (!mp4.ok) throw new Error("Could not download the completed video");
await writeFile("avatar-video.mp4", Buffer.from(await mp4.arrayBuffer()));
Make every customer interaction feel face-to-face.
Create interactive avatars for your business, product, website, training, support, or sales workflow.
Talk to this avatar