# LiveAvatar (/en/ai/platform/models/avatar/heygen)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

> Documentation: Conversational AI.
> Documentation version: Preview.
> This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt).


LiveAvatar by HeyGen provides AI-powered avatars with high-quality video rendering and customizable video quality settings, enabling professional video conversations with your AI agents.

## Sample configuration

The following example shows how to configure LiveAvatar as the agent's avatar when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent).

LiveAvatar supports BYOK only. It isn't available in managed mode. Store your LiveAvatar API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys).

**Python SDK**

```python
from agora_agent import Agent, LiveAvatarAvatar, secret_ref

# client is your configured Agora client
agent = (
    Agent(client=client)
    .with_stt(...)  # configure your ASR vendor
    .with_llm(...)  # configure your LLM vendor
    .with_tts(...)  # configure a TTS vendor with a 24,000 Hz sample rate
    .with_avatar(
        LiveAvatarAvatar(
            api_key=secret_ref("support_prod", "liveavatar"),
            quality="high",
            agora_uid="<avatar_rtc_uid>",
            agora_token="<avatar_rtc_token>",
            avatar_id="65f9e3c9-d48b-4118-b73a-4ae2e3cbb8f0",
        )
    )
)
```

**TypeScript SDK**

```ts
import { Agent, LiveAvatarAvatar, secretRef } from 'agora-agents';

// client is your configured Agora client
const agent = new Agent({ client })
  .withStt(/* configure your ASR vendor */)
  .withLlm(/* configure your LLM vendor */)
  .withTts(/* configure a TTS vendor with a 24,000 Hz sample rate */)
  .withAvatar(
    new LiveAvatarAvatar({
      apiKey: secretRef('support_prod', 'liveavatar'),
      quality: 'high',
      agoraUid: '<avatar_rtc_uid>',
      agoraToken: '<avatar_rtc_token>',
      avatarId: '65f9e3c9-d48b-4118-b73a-4ae2e3cbb8f0',
    }),
  );
```

**Go SDK**

```go
// client is your configured Agora client
agent := agentkit.NewAgent(client).
	WithStt( /* configure your ASR vendor */ ).
	WithLlm( /* configure your LLM vendor */ ).
	WithTts( /* configure a TTS vendor with a 24,000 Hz sample rate */ ).
	WithAvatar(vendors.NewLiveAvatarAvatar(vendors.LiveAvatarAvatarOptions{
		APIKey:     agentkit.SecretRef("support_prod", "liveavatar"),
		Quality:    "high",
		AgoraUID:   "<avatar_rtc_uid>",
		AgoraToken: "<avatar_rtc_token>",
		AvatarID:   "65f9e3c9-d48b-4118-b73a-4ae2e3cbb8f0",
	}))
```

**REST API**

Add an `avatar` block to the `pipeline`. Set `credential.mode` to `byok` and `credential.fields.api_key` to the reference. In the following example, the key is stored as `liveavatar` in the `support_prod` set:

```json
"avatar": {
  "enabled": true,
  "credential": {
    "mode": "byok",
    "fields": {
      "api_key": "$secrets.support_prod.liveavatar"
    }
  },
  "vendor": "liveavatar",
  "params": {
    "agora_token": "<avatar_rtc_token>",
    "agora_uid": "<avatar_rtc_uid>",
    "quality": "high",
    "avatar_id": "65f9e3c9-d48b-4118-b73a-4ae2e3cbb8f0"
  }
}
```

> **Info**
>
> LiveAvatar only supports audio with a sample rate of 24,000 Hz. Using a TTS model configured with a different sample rate results in an error. Make sure that your TTS configuration matches this requirement.

## Key parameters

The `avatar` block takes the following fields. In the SDKs, `LiveAvatarAvatar` sets them from its options, and passes any other parameters from its additional parameters option to `params`.

**avatar required**

**`enabled` (boolean) required**

Set to `true` to show the avatar.

**`vendor` (string) required**

Set to `liveavatar`.

**`credential` (object) required**

Set `mode` to `byok` and `fields.api_key` to a `$secrets.<set>.<key>` reference to your LiveAvatar API key. Get your API key from the LiveAvatar console.

**`params` (object) required**

**`quality` (string) required**

Possible values: `low, medium, high`

The video quality for the avatar rendering.

- `"high"` (720p)
- `"medium"` (480p)
- `"low"` (360p)

Higher quality provides a better visual experience but requires more bandwidth.

**`agora_uid` (string) required**

The unique identifier for the avatar's RTC connection. This must be different from other participants in the channel.

**`agora_token` (string) optional**

The RTC token that authorizes the avatar to join the video channel. Generate this token using your Agora project credentials.

**`avatar_id` (string) optional**

The unique identifier for the avatar you want to use.

**`disable_idle_timeout` (boolean) optional**

Default value: `false`

Whether to disable the idle timeout feature.

**`activity_idle_timeout` (integer) optional**

Default value: `120`

The number of seconds of inactivity before the avatar session times out. Only applies when `disable_idle_timeout` is `false`.

For advanced configuration options, refer to the [LiveAvatar official documentation](https://docs.liveavatar.com/reference/create_session_token_v1_sessions_token_post).

This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads.
