Migrate from HeyGen
HeyGen is a strong platform and we respect their team. Because HeyGen's interactive avatars already run over LiveKit — the same transport we use — most of your client-side code carries over, and the migration is mainly about a simpler object model and a shorter session handshake. The HeyGen snippets reflect its streaming.* API and are shown for orientation.
Two things are worth knowing up front:
- One object instead of two. HeyGen binds an
avatar_id(the look) and a separatevoice_id(the sound) per session. Lookalike has avatars and voices too, but you bind them once: an identity points at an avatar and a voice, adds the personality, and you reuse it by itsid. - One call instead of a handshake. HeyGen's streaming path is
streaming.create_token→streaming.new→streaming.start, and you then drive speech with repeatedstreaming.taskcalls. Lookalike is onePOST /v1/sessions, and the agent converses on its own — no per-utterance calls.
How the concepts map
| HeyGen | Lookalike | Notes |
|---|---|---|
Avatar (avatar_id) | avatar (avt_…) | The look; stock avatars are public |
Voice (voice_id) | voice (voc_…) | The sound; stock voices are public |
avatar_id + voice_id per session | one identity (id_…) | Bound once with the personality, then reused |
streaming.create_token + streaming.new + streaming.start | POST /v1/sessions | One call |
streaming.task (repeat / talk) | native conversation | The agent speaks on its own |
streaming.stop | disconnect or POST /v1/sessions/{id}/end | Leave the LiveKit room, or end it explicitly |
X-Api-Key header | Authorization: Bearer or X-API-Key | Keys start with lk_ |
| Usage credits / concurrent sessions | credits | One balance for realtime usage |
Authenticate
HeyGen sends X-Api-Key against https://api.heygen.com. Lookalike sends a bearer token (or X-API-Key) against https://api.lookalike.com, and keys start with lk_. Get one in the console.
HeyGen
curl https://api.heygen.com/v1/streaming/avatar.list -H "X-Api-Key: $HEYGEN_API_KEY"
Lookalike
curl https://api.lookalike.com/v1/identities -H "Authorization: Bearer $LOOKALIKE_API_KEY"
Create the avatar
In HeyGen you reference an avatar_id (a stock interactive avatar, or a Photo/Instant avatar you created) plus a separate voice_id, and wire them together at session time. In Lookalike you bind them once into an identity with its instructions. Pass a stock avatar_id and voice_id (list them with ?public=true on /v1/avatars and /v1/voices), or upload a photo and a voice clip as below. With a photo the identity is creating until its avatar is made; poll GET /v1/identities/{id} until it is active.
Lookalike
- cURL
- Python
- Node.js
curl -sS -X POST https://api.lookalike.com/v1/identities \
-H "Authorization: Bearer $LOOKALIKE_API_KEY" \
-F "name=Ada" \
-F "instructions=You are Ada, a warm and concise product guide." \
-F "image=@ada.jpg;type=image/jpeg" \
-F "audio=@ada.wav;type=audio/wav"
# -> { "id": "id_...", "object": "identity", "status": "creating", "pending": { "avatar_id": "avt_..." }, ... }
import httpx
with open("ada.jpg", "rb") as img, open("ada.wav", "rb") as aud:
resp = httpx.post(
"https://api.lookalike.com/v1/identities",
headers={"Authorization": f"Bearer {API_KEY}"},
data={
"name": "Ada",
"instructions": "You are Ada, a warm and concise product guide.",
},
files=[
("image", ("ada.jpg", img, "image/jpeg")),
("audio", ("ada.wav", aud, "audio/wav")),
],
)
resp.raise_for_status()
identity = resp.json() # { id, status: "creating", ... } — poll GET /v1/identities/{id} until "active"
import { openAsBlob } from 'node:fs';
const form = new FormData();
form.set('name', 'Ada');
form.set('instructions', 'You are Ada, a warm and concise product guide.');
form.set('image', await openAsBlob('ada.jpg', { type: 'image/jpeg' }), 'ada.jpg');
form.set('audio', await openAsBlob('ada.wav', { type: 'audio/wav' }), 'ada.wav');
const resp = await fetch('https://api.lookalike.com/v1/identities', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.LOOKALIKE_API_KEY}` },
body: form,
});
const identity = await resp.json(); // { id, status: "creating", ... } — poll GET /v1/identities/{id} until "active"
See Create an Identity for the full field list.
Start a session
HeyGen mints a short-lived token, opens a session against an avatar_id + voice, then starts it. Lookalike takes just the identity_id and returns the LiveKit room, token, and URL directly.
HeyGen
# 1. mint a short-lived client token
curl -sS -X POST https://api.heygen.com/v1/streaming.create_token \
-H "X-Api-Key: $HEYGEN_API_KEY"
# -> { "data": { "token": "..." } }
# 2. open the streaming session (LiveKit-backed)
curl -sS -X POST https://api.heygen.com/v1/streaming.new \
-H "X-Api-Key: $HEYGEN_API_KEY" -H "Content-Type: application/json" \
-d '{ "version": "v2", "quality": "high",
"avatar_id": "Ada_public",
"voice": { "voice_id": "en-US-...", "rate": 1.0 } }'
# -> { "data": { "session_id": "...", "url": "wss://heygen-xxxx.livekit.cloud",
# "access_token": "..." } }
# 3. start it
curl -sS -X POST https://api.heygen.com/v1/streaming.start \
-H "X-Api-Key: $HEYGEN_API_KEY" -H "Content-Type: application/json" \
-d '{ "session_id": "..." }'
Lookalike
curl -sS -X POST https://api.lookalike.com/v1/sessions \
-H "Authorization: Bearer $LOOKALIKE_API_KEY" -H "Content-Type: application/json" \
-d '{ "identity_id": "id_3f9a2b7c4d1e8a05f6b3" }'
# -> { "id": "sess_...", "transport": { "url": "wss://...", "token": "eyJ...", ... }, ... }
The token is minted server-side and already encodes the room. It is returned only on create. See Realtime API for the full response.
Join the call
Both HeyGen and Lookalike hand you a LiveKit URL and token, so your join code is the same — point your LiveKit client at ours (transport.url + transport.token) instead of HeyGen's url + access_token.
import { Room, RoomEvent, Track } from 'livekit-client';
// livekitUrl and token are transport.url and transport.token from the POST /v1/sessions response
const room = new Room();
room.on(RoomEvent.TrackSubscribed, (track) => {
if (track.kind === Track.Kind.Video) {
document.getElementById('avatar').appendChild(track.attach());
} else if (track.kind === Track.Kind.Audio) {
document.body.appendChild(track.attach());
}
});
await room.connect(livekitUrl, token);
await room.localParticipant.setMicrophoneEnabled(true); // so the avatar can hear you
In a video session the avatar publishes both audio and video. Attach both, but don't also play the agent's raw voice track, or you'll hear it twice.
Drive the conversation
This is the biggest simplification. In HeyGen you push each utterance with streaming.task — repeat to speak your own LLM's output verbatim, or talk to use HeyGen's built-in LLM. In Lookalike the agent already runs the LLM and speech: the user just talks into the mic and the avatar replies, so there are no per-utterance calls.
HeyGen
curl -sS -X POST https://api.heygen.com/v1/streaming.task \
-H "X-Api-Key: $HEYGEN_API_KEY" -H "Content-Type: application/json" \
-d '{ "session_id": "...", "text": "Hello and welcome.", "task_type": "repeat" }'
Lookalike — nothing to send; the enabled microphone drives the conversation, and the agent handles turns and interruptions natively.
End the session
HeyGen ends a session with streaming.stop. On Lookalike you can do either of two things: disconnect from the room, or call the End Session endpoint.
HeyGen
curl -sS -X POST https://api.heygen.com/v1/streaming.stop \
-H "X-Api-Key: $HEYGEN_API_KEY" -H "Content-Type: application/json" \
-d '{ "session_id": "..." }'
Lookalike
Disconnect the client:
await room.disconnect();
Or end it from your backend with the session's sess_ id:
curl -sS -X POST https://api.lookalike.com/v1/sessions/sess_4b9e02f1/end \
-H "Authorization: Bearer $LOOKALIKE_API_KEY"
Billing
Both platforms meter credits. On Lookalike, creating identities, avatars and voices is free and a realtime session is charged per minute while the avatar is streaming. Buy credits and view usage in the Console; full rates are on the Billing & credits page. A request that would spend credits you don't have returns 402.
What's different
- Bind avatar and voice once. The identity holds them with the personality, so a session needs only the identity.
- One call to go live. No
create_token→new→startsequence. - Conversational by default. No
streaming.taskloop — the agent listens and speaks on its own once the mic is on. - Same LiveKit transport. Your existing join and track-handling code carries over.
Next steps
- Core concepts — how identities, avatars, voices and sessions fit together.
- Create an Identity — the full create reference.
- Realtime API — the full session and join reference.
- Billing & credits — rates and how credits are charged.