Text to Avatar Video

Write a script, choose a Cara-4.1 Express avatar and voice, and render a polished talking-avatar video. Powered by the Anam Text to Avatar Video API

Choose an avatar
109 / 2,000
Director notes

Place your cursor in the script, then click a note to change the emotion from that point.

Format

Generate your own AI Avatar videos

Build avatar video generation into your app with a coding agent, Python or Node.js.

# Build my own AI avatar video generator

Build a web app that turns a written script into a downloadable video of an Anam avatar speaking it. Include text entry, avatar and voice selection, render progress, playback, and MP4 download. Before acting, fetch https://anam.ai/docs/avatar-videos/overview and https://anam.ai/docs/llms.txt and treat the live docs as the source of truth.

The Avatar Videos API is a server-side REST workflow. Do not use the realtime JavaScript or Python SDK session APIs, create a session token, open WebRTC, or record frames yourself for this task.

## Step 1 — choose the workflow

Default to Add to an app to build the video generator described above. Use One-off video only if the user explicitly asks to render a single video:

- One-off video: generate and download one video now.
- Add to an app: implement reusable avatar-video generation in their existing application.

Inspect the repository and follow the matching workflow using its framework and conventions. If there is no app yet, create a minimal web app with a server backend and provide local setup and run commands.

## One-off video

1. Ask for the exact input text the avatar should speak.
2. Ask whether ANAM_API_KEY is already available in the environment. If it is not, tell the user how to add it securely to their shell or a local env file. Never ask them to paste an API key into chat, print it, commit it, or put it in browser code.
3. Ask whether to use a saved persona or a specific avatar and voice. If they have no preference, help them choose resources available to their organization; do not guess IDs.
4. Create the job from the backend with POST https://api.anam.ai/v1/avatar-videos. Send Authorization: Bearer $ANAM_API_KEY, Content-Type: application/json, and a caller-generated Idempotency-Key. Keep that key stable if the same request is retried.
5. The JSON body must contain script, avatarId, voiceId, and avatarModel set to "cara-4.1-express". If starting from a saved persona, resolve its avatar and voice first; use direct configuration to enforce this model.
6. Poll GET https://api.anam.ai/v1/avatar-videos/{id} until completed, failed, or cancelled. Expect pending, running, and finalizing before completion. Honor Retry-After on 429 responses and do not create a second job while polling.
7. On completion, download content.url to an MP4 in the user's requested location and report the path. The signed URL expires after one hour; fetch the resource again to refresh it. If the job fails, report failure.code, failure.message, and whether it is retryable.

## Add to an app

Inspect the existing stack and implement the smallest native integration. Ask for the intended input text or how the app will supply it, and ask the user to configure ANAM_API_KEY in the app's server environment if it is missing. Keep the key server-side.

Implement:

- A server endpoint or server action that validates the script and calls POST /v1/avatar-videos.
- A stable idempotency key per logical render, reused when that same render is retried.
- Use avatarId plus voiceId and set avatarModel to "cara-4.1-express". Support optional directorNotes, languageCode, voiceSpeed, and paired videoWidth/videoHeight only when the product needs them.
- Status polling through the app's server for GET /v1/avatar-videos/{id}; never expose ANAM_API_KEY to the client.
- UI states for pending, running, finalizing, completed, failed, and cancelled, plus 429 Retry-After handling.
- A download action using content.url. Treat it as a one-hour signed URL and refetch the job when a fresh URL is needed.
- Focused tests for request validation, server-only authentication, idempotent retries, terminal states, and failures.

Use the existing framework, conventions, and dependency manager. Do not add the realtime Anam SDK unless the app separately needs interactive avatar conversations.

## API invariants

- script is the exact text spoken; the persona brain, greeting, prompt, and tools do not run.
- A create request returns 202 Accepted with the job resource.
- Every create request requires Idempotency-Key. Reusing a key with a different body returns 409.
- Direct video configuration requires both avatarId and voiceId.
- videoWidth and videoHeight must be supplied together.
- Never expose ANAM_API_KEY in a browser, mobile bundle, logs, commits, or chat.

If a field or behavior is absent from the fetched docs, do not invent it. Check the Avatar Videos API reference linked from the overview.

Meet Cara 4.1 Express

The new standard for real-time AI avatars. More expressive. More controllable. Faster to respond. And ranked #1 in the market.