Deprecate brainType in favor of llmId

Important Update: The brainType parameter has been deprecated and replaced with llmId to support custom language models. Your existing brainType values will continue to work as llmId for backwards compatibility.

What This Means For You

If you currently use brainType in your persona configuration, you should update your code to use llmId instead. This change enables support for custom language models while maintaining compatibility with existing brain types. The benefits of this change are:
  • Custom LLM Support: Create and use your own language models with Anam personas
  • Server-Side Processing: Custom LLMs are processed from Anam’s servers for improved latency
  • Secure Credential Storage: API keys for custom LLMs are encrypted at rest
  • Backwards Compatibility: Your existing brain types work as LLM IDs

Migration Steps

Simply replace brainType with llmId in your persona configuration:
const response = await fetch("https://api.anam.ai/v1/auth/session-token", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: `Bearer ${ANAM_API_KEY}`,
  },
  body: JSON.stringify({
    personaConfig: {
      avatarId: "30fa96d0-26c4-4e55-94a0-517025942e18",
      voiceId: "6bfbe25a-979d-40f3-a92b-5394170af54b",
-     brainType: "0934d97d-0c3a-4f33-91b0-5e136a0ef466",
+     llmId: "0934d97d-0c3a-4f33-91b0-5e136a0ef466",
      systemPrompt: "You are a helpful assistant.",
    },
  }),
});

Available LLM IDs

All existing brain types continue to work as LLM IDs:
Previous brainTypeNew llmIdDescription
0934d97d-0c3a-4f33-91b0-5e136a0ef4660934d97d-0c3a-4f33-91b0-5e136a0ef466OpenAI GPT-4 Mini model
ANAM_LLAMA_v3_3_70B_V1ANAM_LLAMA_v3_3_70B_V1Llama 3.3 70B model
CUSTOMER_CLIENT_V1CUSTOMER_CLIENT_V1Client-side LLM processing

Custom LLMs

With this change, you can now create custom LLMs and use them with your personas. Learn more about Custom LLMs.

Deprecate GET /session-token

Important Update: Declaring persona configuration on the client side is deprecated and has been removed in the latest version of the Anam SDK. You should follow the instructions below to migrate to the new POST /session-token endpoint and pass the persona config in the request body.

What This Means For You

If you currently use the GET /session-token endpoint, or use the POST /session-token endpoint with a personaConfig on the client side, you will need to update your code to pass your persona config in the request body. This means you will need to move your persona configuration from your client side to your server side. The benefits of this change are:
  • Allows for persona config to be defined entirely at runtime
  • Increased security, don’t reveal your Anam config such as persona ID or system prompt to the client
  • Improved performance, this is part of a wider initiative to improve connection start times

Implementation Recommendations

  1. Upgrade to the latest version of the Anam SDK.
  2. If you currently make a GET request to /session-token, please update this to a POST and pass the personaConfig in this request. This must still be from you server side config, so you may need to pass details from your client side config to your server if you are creating your system prompt dynamically.
  3. Update your client side to use the session token only createClient(sessionToken). Optionally you can still pass in client options such as disableInputAudio to the client: createClient(sessionToken, { disableInputAudio: true }).
For more information on creating sessions, see here.

Example migration

The old way:
// On the server side
const response = await fetch("https://api.anam.ai/v1/auth/session-token", {
  method: "GET",
  headers: {
    "Content-Type": "application/json",
    Authorization: `Bearer ${ANAM_API_KEY}`,
  },
});
const { sessionToken } = await response.json();
return sessionToken;

// On the client side
const anamClient = createClient(sessionToken, {
  personaId: "<YOUR_PERSONA_ID>",
});
The new way:
// On the server side
const response = await fetch("https://api.anam.ai/v1/auth/session-token", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: `Bearer ${ANAM_API_KEY}`,
  },
  body: JSON.stringify({
    personaConfig: {
      personaId: "<YOUR_PERSONA_ID>",
    },
  }),
});

const { sessionToken } = await response.json();
return sessionToken;

// On the client side
const anamClient = createClient(sessionToken);
For more in depth examples of how to define your persona config at runtime see our full implementation example.