> ## Documentation Index
> Fetch the complete documentation index at: https://anam.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Multilingual Support

> Configure speech recognition for non-English languages to enable global conversations

Anam supports multilingual conversations, allowing your personas to understand and respond to users speaking in their native language. By configuring the transcription language, you ensure accurate speech recognition and better response times for non-English speakers.

## How It Works

When a user speaks to your persona, their speech is transcribed using speech-to-text technology. By default, the system expects English input. For non-English users, you can specify the expected language to significantly improve:

* **Transcription accuracy**: The system correctly interprets words and phrases in the target language
* **Response latency**: Optimized processing for the specified language reduces delays

<Info>The `languageCode` controls what language the system expects to **hear** from users. This is separate from the persona's voice, which determines what language the persona **speaks**.</Info>

### When to Configure Language

For many use cases, the default English setting works well—even when users speak other languages. The LLM can still understand the meaning of what's said and respond appropriately.

Setting a specific `languageCode` becomes important when:

* **You need exact transcription**: In English mode, non-English speech may be translated to English in the transcript rather than preserved in the original language. If your application displays transcripts or the persona needs to see the exact words spoken, set the matching language code.
* **You're building language-focused experiences**: For language learning apps, pronunciation practice, or any use case where the specific words matter as much as their meaning.
* **You want optimized latency**: Configuring the correct language reduces processing time for non-English speech.

## Setting the Language Code

Configure the transcription language when requesting a session token via `POST /v1/auth/session-token`. Add the `languageCode` field to your `personaConfig`:

```javascript theme={"system"}
const response = await fetch("https://api.anam.ai/v1/auth/session-token", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: `Bearer ${process.env.ANAM_API_KEY}`,
  },
  body: JSON.stringify({
    personaConfig: {
      name: "Marie",
      avatarId: "30fa96d0-26c4-4e55-94a0-517025942e18",
      voiceId: "<french-voice-id>",
      llmId: "a7cf662c-2ace-4de1-a21e-ef0fbf144bb7",
      systemPrompt: "Tu es une assistante virtuelle sympathique. Réponds toujours en français.",
      languageCode: "fr",
    },
  }),
});
```

### Configuration Reference

<ParamField body="languageCode" type="string">
  A 2-character [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language code specifying the expected user speech language. Defaults to `en` (English) if not provided.
</ParamField>

## Supported Languages

Anam supports 70+ languages for speech recognition. Common supported languages include:

| Language    | Code |
| ----------- | ---- |
| English     | en   |
| Afrikaans   | af   |
| Arabic      | ar   |
| Armenian    | hy   |
| Azerbaijani | az   |
| Belarusian  | be   |
| Bosnian     | bs   |
| Bulgarian   | bg   |
| Catalan     | ca   |
| Chinese     | zh   |
| Croatian    | hr   |
| Czech       | cs   |
| Danish      | da   |
| Dutch       | nl   |
| Estonian    | et   |
| Finnish     | fi   |
| French      | fr   |
| Galician    | gl   |
| German      | de   |
| Greek       | el   |
| Hebrew      | he   |
| Hindi       | hi   |
| Hungarian   | hu   |
| Icelandic   | is   |
| Indonesian  | id   |
| Italian     | it   |
| Japanese    | ja   |
| Kannada     | kn   |
| Kazakh      | kk   |
| Korean      | ko   |
| Latvian     | lv   |
| Lithuanian  | lt   |
| Macedonian  | mk   |
| Malay       | ms   |
| Maori       | mi   |
| Marathi     | mr   |
| Nepali      | ne   |
| Norwegian   | no   |
| Persian     | fa   |
| Polish      | pl   |
| Portuguese  | pt   |
| Romanian    | ro   |
| Russian     | ru   |
| Serbian     | sr   |
| Slovak      | sk   |
| Slovenian   | sl   |
| Spanish     | es   |
| Swahili     | sw   |
| Swedish     | sv   |
| Tagalog     | tl   |
| Tamil       | ta   |
| Thai        | th   |
| Turkish     | tr   |
| Ukrainian   | uk   |
| Urdu        | ur   |
| Vietnamese  | vi   |
| Welsh       | cy   |

<Tip>**Serving primarily non-English users?** Contact [Anam support](mailto:support@anam.ai) to set a default transcription language for your account. This means you won't need to specify `languageCode` on every session token request—all sessions will automatically use your preferred language unless explicitly overridden.</Tip>

## Understanding Language Configuration

There are two language settings to consider when building multilingual experiences:

### Transcription Language (What Users Speak)

The `languageCode` field tells the speech recognition system what language to expect from users. Set this to match your users' spoken language for accurate transcription.

### Voice Language (What the Persona Speaks)

The `voiceId` determines the voice and language your persona uses when speaking. Select a voice that matches your target language from the [GET /v1/voices](/api-reference/voices/list-voices) endpoint or the [Anam Lab](https://lab.anam.ai).

<Note>For a fully localized experience, configure **both** the `languageCode` (for user speech recognition) and select an appropriate `voiceId` (for persona speech output).</Note>

## Best Practices

<AccordionGroup>
  <Accordion title="Match transcription language to user input">
    Always set `languageCode` to match the language your users will speak. Mismatched settings result in poor transcription accuracy. If your German users speak German, set `languageCode: "de"`.
  </Accordion>

  <Accordion title="One language per session">
    The language code is set per session and cannot be changed mid-conversation. If your application supports multiple languages:

    * Create separate sessions with appropriate language codes for each user
    * Determine the user's preferred language before starting the session
    * Consider using a language selection step in your onboarding flow
  </Accordion>

  <Accordion title="Combine with matching voice and prompt">
    For the best multilingual experience:

    1. Set `languageCode` for accurate speech recognition
    2. Select a `voiceId` in the target language
    3. Write your `systemPrompt` in the target language or instruct the persona to respond in that language
  </Accordion>

  <Accordion title="Account-level defaults for single-language apps">
    If your application primarily serves users of one non-English language, contact [Anam support](mailto:support@anam.ai) to set an account-level default. Benefits include:

    * Simplified integration without passing `languageCode` every time
    * No changes needed to existing integrations
    * Per-session `languageCode` still overrides the default when needed
  </Accordion>
</AccordionGroup>

## SDK Usage

When using the JavaScript SDK with ephemeral personas, the `languageCode` field in your `PersonaConfig` is passed through when creating session tokens:

```typescript theme={"system"}
import { createClient } from "@anam-ai/js-sdk";

// Your server creates the session token with languageCode
const sessionToken = await getSessionTokenFromServer({
  personaConfig: {
    name: "Hans",
    avatarId: "30fa96d0-26c4-4e55-94a0-517025942e18",
    voiceId: "<german-voice-id>",
    llmId: "a7cf662c-2ace-4de1-a21e-ef0fbf144bb7",
    systemPrompt: "Du bist ein hilfreicher Assistent. Antworte immer auf Deutsch.",
    languageCode: "de",
  },
});

// Client uses the token as normal
const anamClient = createClient(sessionToken);
await anamClient.streamToVideoElement("video-id");
```

<Note>The `languageCode` configuration only applies to ephemeral persona flows where you provide the persona configuration at runtime. For stateful personas created in the Anam Lab, contact [Anam support](mailto:support@anam.ai) to configure language settings.</Note>

## Next Steps

<CardGroup cols={3}>
  <Card title="Persona Configuration" icon="user" href="/personas/overview">
    Learn more about configuring personas
  </Card>

  <Card title="Prompting Guide" icon="message" href="/personas/llms/prompting-guide">
    Write effective system prompts for multilingual personas
  </Card>

  <Card title="Authentication" icon="key" href="/javascript-sdk/authentication">
    Understand session token creation
  </Card>
</CardGroup>
