Anam

Updated

Integrate Anam AI avatars into Conversational AI Engine.

Anam provides AI-powered avatars with real-time video rendering, enabling natural video conversations with your AI agents.

Sample configuration

The following examples show how to configure an Anam avatar when starting a conversational AI agent.

from agora_agent import Agent
from agora_agent.agentkit.vendors import AnamAvatar

# client is your configured Agora client
agent = (
    Agent(client)
    .with_stt(...)  # configure your STT vendor
    .with_llm(...)  # configure your LLM vendor
    .with_tts(...)  # configure your TTS vendor
    .with_avatar(AnamAvatar(
        api_key='your-anam-key',
        avatar_id='<anam_avatar_id>',
    ))
)
import { Agent, AnamAvatar } from 'agora-agents';

// client is your configured Agora client
const agent = new Agent({ client })
  .withStt(/* configure your STT vendor */)
  .withLlm(/* configure your LLM vendor */)
  .withTts(/* configure your TTS vendor */)
  .withAvatar(new AnamAvatar({
    apiKey: 'your-anam-key',
    avatarId: '<anam_avatar_id>',
  }));
import (
    "github.com/AgoraIO/agora-agents-go/v2/agentkit"
    "github.com/AgoraIO/agora-agents-go/v2/agentkit/vendors"
)

// client is your configured Agora client
agent := agentkit.NewAgent(client).WithStt(/* configure your STT vendor */).
  WithLlm(/* configure your LLM vendor */).
  WithTts(/* configure your TTS vendor */).
  WithAvatar(
    vendors.NewAnamAvatar(vendors.AnamAvatarOptions{
        APIKey:   "your-anam-key",
        AvatarID: "<anam_avatar_id>",
    }),
)

Use the following avatar configuration in your request:

"avatar": {
  "vendor": "anam",
  "enable": true,
  "params": {
    "api_key": "<anam_key>",
    "avatar_id": "960f614f-ea88-47c3-9883-f02094f70874",
    "agora_uid": "<avatar_rtc_uid>",
    "agora_token": "<avatar_rtc_token>",
    "sample_rate": 24000,
    "quality": "high",
    "video_encoding": "H264"
  }
}

Key parameters

params required
ParameterDescription
api_keystring
required

The API key used for authentication with Anam's services. Get your API key from the Anam console.

avatar_idstring
required

The unique identifier for the Anam avatar you want to use.

agora_uidstring
required

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

agora_tokenstring
required

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

sample_ratenumber
optional
Default value
24000
Possible values
  • 16000
  • 24000
  • 48000

The audio sample rate in Hz.

qualitystring
optional
Default value
high
Possible values
  • high
  • medium
  • low

The video quality level.

video_encodingstring
optional
Default value
H264
Possible values
  • H264
  • AV1

The video encoding format.

avatar_modelstring
optional

The Anam avatar model. For example, cara-4 for Cara 4. If not set, Anam selects the model based on avatar_id.

video_widthnumber
optional

The output video width in pixels. Set together with video_height. For supported resolutions, see Portrait video.

video_heightnumber
optional

The output video height in pixels. Set together with video_width. For supported resolutions, see Portrait video.

The table extends beyond the current width. Scroll horizontally to view more columns.

Caution

The parameters listed on this page are validated for use with Conversational AI Engine. Required parameters must be provided as documented. Any additional parameters are passed through directly to Anam without validation. For a full list of supported options, refer to the Anam documentation.

Portrait video

For mobile apps, configure portrait video as follows:

  1. Set avatar_model to cara-4.
  2. Set video_width and video_height to a portrait resolution, such as 768 x 1152.

The following resolutions are supported:

Resolution (width x height)OrientationModel
720 x 480LandscapeCara 3
1152 x 768LandscapeCara 4
768 x 1152PortraitCara 4

Set video_width and video_height together, or omit both to use the default resolution of the avatar model.

AnamAvatar(
    api_key='your-anam-key',
    avatar_id='<anam_avatar_id>',
    avatar_model='cara-4',
    video_width=768,
    video_height=1152,
)
new AnamAvatar({
  apiKey: 'your-anam-key',
  avatarId: '<anam_avatar_id>',
  avatarModel: 'cara-4',
  videoWidth: 768,
  videoHeight: 1152,
});
width, height := 768, 1152

vendors.NewAnamAvatar(vendors.AnamAvatarOptions{
    APIKey:      "your-anam-key",
    AvatarID:    "<anam_avatar_id>",
    AvatarModel: "cara-4",
    VideoWidth:  &width,
    VideoHeight: &height,
})
"avatar": {
  "vendor": "anam",
  "enable": true,
  "params": {
    "api_key": "<anam_key>",
    "avatar_id": "<anam_avatar_id>",
    "agora_uid": "<avatar_rtc_uid>",
    "agora_token": "<avatar_rtc_token>",
    "avatar_model": "cara-4",
    "video_width": 768,
    "video_height": 1152
  }
}

This integration is fully supported for use with Conversational AI Engine. 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.