> ## 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 transcription languages and understand how language selection interacts with speech-to-text providers and organization defaults.

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. If you do not set a language, the persona inherits your organization's default transcription language. Organizations without a configured default use English. For non-English users, specifying the expected language can 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

For a saved persona, open its **Advanced** settings in the Anam Lab and use **Transcription Language**. For an ephemeral persona, add `languageCode` to `personaConfig` when requesting a session token via `POST /v1/auth/session-token`:

```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",
      avatarModel: "cara-4",
      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) code (or the literal `inherit` sentinel) specifying the expected user speech language. Omit it, use `inherit`, an empty string, or `null` to use the organization default. If the organization has no configured default, Anam uses `en` (English).
</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 your organization default. Personas using `inherit` pick up that language when their next session starts, while an explicit persona or session `languageCode` takes precedence.</Tip>

<Warning>
  Changing the organization default can make an inherited language incompatible with a persona's saved STT provider. Anam does not block the organization-wide change. For affected sessions, it ignores the saved provider selection and uses the platform default provider so the session can still start. Set an explicit `languageCode` at the persona level if the provider must remain fixed.
</Warning>

## Understanding Language Configuration

There are three 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](/docs/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>

### Speech-to-Text Provider

The optional `voiceDetectionOptions.sttProvider` determines which provider transcribes user speech. Provider language support differs: `anam` supports every language listed above, while `deepgram` supports `en`, `es`, `fr`, `de`, `hi`, `ru`, `pt`, `ja`, `it`, and `nl`.

The Lab prevents new explicit provider-language mismatches. The API also rejects an explicit unsupported pair. Inherited languages behave differently because the organization default can change after a persona is saved: an unsupported inherited pair falls back to the platform default provider at session start.

See [Voice Detection](/docs/personas/session/voice-detection#choose-a-speech-to-text-provider) for provider configuration and restrictions.

## 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="Choose the initial language before starting">
    Choose the expected language before the session starts. 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 organization 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",
    avatarModel: "cara-4",
    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>For a saved persona, set **Transcription Language** in its **Advanced** settings in the Anam Lab. Select **Inherit from org default** to resolve the language from the organization setting when each session starts.</Note>

## Next Steps

<CardGroup cols={3}>
  <Card title="Persona Configuration" icon="user" href="https://anam.ai/docs/personas/overview">
    Learn more about configuring personas
  </Card>

  <Card title="Prompting Guide" icon="message" href="https://anam.ai/docs/personas/llms/prompting-guide">
    Write effective system prompts for multilingual personas
  </Card>

  <Card title="Authentication" icon="key" href="https://anam.ai/docs/javascript-sdk/authentication">
    Understand session token creation
  </Card>
</CardGroup>
