Skip to main content

Train a custom avatar from video

Turn footage of a person into an avatar that can hold conversations.

A custom avatar is trained from video of a real person. Once training completes, it behaves exactly like a stock avatar — same conversation flow, same knowledge bank, same API.

Every request needs your API key. Set it once:

export GOLDENENGINE_API_KEY="<YOUR_API_KEY>"

Before you record​

Training quality is set by the footage. Re-recording after a failed run costs far more time than getting the shot right the first time.

Accepted formats: .mp4, .mov, .webm, .mkv, .avi, and .m4v — or any file sent with a video/* content type. Uploads are capped at 2 GB; a larger file is rejected with 413 and the code file_too_large. The API checks nothing else about the footage — there is no resolution check, so problems with it only surface in training.

Training videos can be at most 15 minutes long. The length is checked when training starts, before any GPU time is spent, so an upload that is too long is accepted and the avatar then moves to failed with an error_message such as "Video is 18.2 minutes long; the maximum for training is 15 minutes. Upload a shorter video." A video whose length cannot be read — some browser MediaRecorder WebM files carry no duration — is trained without the check.

1. Upload the video​

cURL
curl -s "https://backend.goldenengine.ai/v1/videos/upload-url" \
-H "X-Api-Key: $GOLDENENGINE_API_KEY" \

Take id from the response and keep it for the next step:

export VIDEO_ID="<id from the response>"

Confirm it landed before continuing:

cURL
curl -s "https://backend.goldenengine.ai/v1/videos/$VIDEO_ID" \
-H "X-Api-Key: $GOLDENENGINE_API_KEY"

The upload call returns as soon as the API has the file, before it has finished moving to storage, so the record usually comes back as pending or uploading. Poll until status is uploaded — GET /v1/videos/{video_id}/progress is the cheap way, and also reports upload_progress_percent:

cURL
curl -s "https://backend.goldenengine.ai/v1/videos/$VIDEO_ID/progress" \
-H "X-Api-Key: $GOLDENENGINE_API_KEY"

Creating the avatar before then fails with 400 and "Video not found in S3. Please upload the video before creating an avatar." — and can leave the video showing failed until the transfer finishes, which is one more reason to wait. GET /v1/videos lists everything you have uploaded.

2. Create the avatar​

Creating an avatar with a video_id starts training automatically — there is no separate "begin training" call.

cURL
curl -s "https://backend.goldenengine.ai/v1/avatars" \
-H "X-Api-Key: $GOLDENENGINE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Dr. Chen",
"bio": "Senior product specialist at Acme, 10 years in medical devices.",
"video_id": "'"$VIDEO_ID"'",
"primary_language": "English (US)",
"llm_model": "gpt-4o",
"tts_provider": "cartesia",
"voice_id": "<VOICE_ID>",
"stt_engine": "deepgram"
}'

Take id from the response — that is your avatar:

export AVATAR_ID="<id from the response>"

name, bio, and video_id are required; everything else falls back to defaults. See Models for engine and voice values; the accepted persona field values are listed on the request body in the API reference.

If the video is missing (404), not fully uploaded (400), or the request references values outside the allowed option lists (422), creation fails before any training is queued. Creating an avatar also writes its system prompt from the persona fields through a model call; if that call fails you get a 502 and no avatar, and can simply retry.

voice_id is stored as sent — the API does not check it against tts_provider, so a mistyped or mismatched voice is not caught at creation. Copy it from GET /v1/models rather than typing it.

3. Monitor training​

cURL
curl -s "https://backend.goldenengine.ai/v1/avatars/$AVATAR_ID/status" \
-H "X-Api-Key: $GOLDENENGINE_API_KEY"

/status returns the avatar's status, a progress_percent for the current training run, and error_message once something has gone wrong. The avatar moves through:

pending → queued → training → ready
│ │ │
└─────────┴─────────┴──→ failed

failed can come from any of those steps, not only from training itself. If the training job cannot be queued right after you create the avatar, it goes straight to failed with "Training could not be queued (job service unavailable). Please retry training." Cancelling a run also lands it in failed, with the message "Training cancelled by user request."

For the history of every run on the avatar, look at the training jobs:

cURL
curl -s "https://backend.goldenengine.ai/v1/avatars/$AVATAR_ID/training-jobs" \
-H "X-Api-Key: $GOLDENENGINE_API_KEY"

Training-job status uses its own vocabulary — pending, running, completed, failed, cancelled. A job reaching completed is what moves the avatar to ready.

Poll on a sensible interval; training takes far longer than a request timeout, so this is a background job in your system, not a blocking wait.

4. Handle failure​

When an avatar ends in failed, read error_message on the avatar or its training job.

Most failures trace back to the source video — the subject leaving frame, inconsistent lighting, multiple people visible, or too little usable footage. Re-read the recording guide before re-shooting, since a second run with the same problems fails the same way.

To retry with the same video — this returns 202 and puts the avatar back in the queue, or 409 if a run is still queued or training:

cURL
curl -s -X POST "https://backend.goldenengine.ai/v1/avatars/$AVATAR_ID/retrain" \
-H "X-Api-Key: $GOLDENENGINE_API_KEY"

To stop a run in progress — this works only while the avatar is queued or training, and returns 409 otherwise:

cURL
curl -s -X POST "https://backend.goldenengine.ai/v1/avatars/$AVATAR_ID/cancel" \
-H "X-Api-Key: $GOLDENENGINE_API_KEY"

Retraining with different footage means uploading a new video and creating a new avatar.

5. Use it​

Once ready, the avatar works everywhere a stock avatar does:

cURL
curl -s "https://backend.goldenengine.ai/v1/conversations" \
-H "X-Api-Key: $GOLDENENGINE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"avatar_id": "'"$AVATAR_ID"'", "title": "First run"}'

A session on an avatar the engine does not have loaded waits several seconds for a cold start. To take that out of the visitor's wait, call POST /v1/avatars/{avatar_id}/preload when a session is likely — when the visitor opens the page, say — and poll GET /v1/avatars/{avatar_id}/preload-status until its status is ready. It is optional: without it the first connection loads the avatar itself.

Attach documents with the knowledge bank, tune the persona with PATCH /v1/avatars/{avatar_id}, and put the avatar in front of visitors with Embed an avatar.