---
title: Languages
description: LMNT's speech models fluently speak 31 languages with native code-switching.
---

## How native language prompting works

By default, the model looks at your text and guesses the native language for your generated speech.
But you can explicitly prompt the model for more control.

This shapes the accent and how the model handles foreign words.

<CodeGroup>
```python Python
import asyncio

from lmnt import AsyncLmnt

async def main():
  client = AsyncLmnt()
  text = 'Hello, and uh, welcome to the show.'

  for language in ['en', 'fr', 'de']:
    async with client.speech.with_streaming_response.generate(
      text=text,
      voice='leah',
      language=language,
    ) as response:
      await response.stream_to_file(f'{language}.mp3')

asyncio.run(main())
```

```typescript TypeScript
import { createWriteStream } from 'fs';
import { pipeline } from 'stream/promises';

import Lmnt from 'lmnt-node';

const client = new Lmnt();
const text = 'Hello, and uh, welcome to the show.';

for (const language of ['en', 'fr', 'de'] as const) {
  const response = await client.speech.generate({
    text,
    voice: 'leah',
    language,
  }).asResponse();
  await pipeline(response.body, createWriteStream(`${language}.mp3`));
}
```

```go Go
package main

import (
	"context"
	"io"
	"log"
	"os"

	"github.com/lmnt-com/lmnt-go/v2"
)

func main() {
	client := lmnt.NewClient()
	text := "Hello, and uh, welcome to the show."

	for _, language := range []string{"en", "fr", "de"} {
		audio, err := client.Speech.Generate(context.TODO(), lmnt.SpeechGenerateParams{
			Text:     text,
			Voice:    "leah",
			Language: lmnt.LanguageCode(language),
		})
		if err != nil {
			log.Fatal(err)
		}

		out, err := os.Create(language + ".mp3")
		if err != nil {
			log.Fatal(err)
		}
		io.Copy(out, audio.Body)
		audio.Body.Close()
		out.Close()
	}
}
```

```sh cURL
TEXT="Hello, and uh, welcome to the show."

for LANG in en fr de; do
  curl --request POST \
    --url https://api.lmnt.com/v1/ai/speech/bytes \
    --header "X-API-Key: $LMNT_API_KEY" \
    --header 'lmnt-version: 1.2' \
    --header 'Content-Type: application/json' \
    --data "{\"text\": \"$TEXT\", \"voice\": \"leah\", \"language\": \"$LANG\"}" \
    --output "$LANG.mp3"
done
```
</CodeGroup>

<ResponseAudioGroup items={[
  { label: 'en.mp3', uuid: '5375076e-9a61-46b0-aefd-f4d245eb1614' },
  { label: 'fr.mp3', uuid: '3fb91526-1277-44aa-af04-ee2cfc3f5ec4' },
  { label: 'de.mp3', uuid: '14a66d61-44f5-436f-8ac8-fbef45cf31a7' },
]} />
The output:

- `en.mp3` → spoken by a native English speaker.
- `fr.mp3` → spoken in English with a French accent.
- `de.mp3` → spoken in English with a German accent.

## Code switching

Code switching is mixing text from two or more of the model's supported languages into the same text prompt, and is fully supported.

<CodeGroup>
```python Python
import asyncio

from lmnt import AsyncLmnt

async def main():
  client = AsyncLmnt()
  text = 'Bonjour! Did you know that mariposa means butterfly in Spanish?'

  for language in ['en', 'fr', 'es']:
    async with client.speech.with_streaming_response.generate(
      text=text,
      voice='leah',
      language=language,
    ) as response:
      await response.stream_to_file(f'{language}.mp3')

asyncio.run(main())
```

```typescript TypeScript
import { createWriteStream } from 'fs';
import { pipeline } from 'stream/promises';

import Lmnt from 'lmnt-node';

const client = new Lmnt();
const text = 'Bonjour! Did you know that mariposa means butterfly in Spanish?';

for (const language of ['en', 'fr', 'es'] as const) {
  const response = await client.speech.generate({
    text,
    voice: 'leah',
    language,
  }).asResponse();
  await pipeline(response.body, createWriteStream(`${language}.mp3`));
}
```

```go Go
package main

import (
	"context"
	"io"
	"log"
	"os"

	"github.com/lmnt-com/lmnt-go/v2"
)

func main() {
	client := lmnt.NewClient()
	text := "Bonjour! Did you know that mariposa means butterfly in Spanish?"

	for _, language := range []string{"en", "fr", "es"} {
		audio, err := client.Speech.Generate(context.TODO(), lmnt.SpeechGenerateParams{
			Text:     text,
			Voice:    "leah",
			Language: lmnt.LanguageCode(language),
		})
		if err != nil {
			log.Fatal(err)
		}

		out, err := os.Create(language + ".mp3")
		if err != nil {
			log.Fatal(err)
		}
		io.Copy(out, audio.Body)
		audio.Body.Close()
		out.Close()
	}
}
```

```sh cURL
TEXT="Bonjour! Did you know that mariposa means butterfly in Spanish?"

for LANG in en fr es; do
  curl --request POST \
    --url https://api.lmnt.com/v1/ai/speech/bytes \
    --header "X-API-Key: $LMNT_API_KEY" \
    --header 'lmnt-version: 1.2' \
    --header 'Content-Type: application/json' \
    --data "{\"text\": \"$TEXT\", \"voice\": \"leah\", \"language\": \"$LANG\"}" \
    --output "$LANG.mp3"
done
```
</CodeGroup>

<ResponseAudioGroup items={[
  { label: 'en.mp3', uuid: '6028cd88-d4d5-4956-9f5f-17f71854841a' },
  { label: 'fr.mp3', uuid: '02c2e37e-3796-41a3-99fa-f79358716836' },
  { label: 'es.mp3', uuid: '5cbab281-1b5c-4eff-b6ce-325996500003' },
]} />
The output:

- `en.mp3` → English speaker — `Bonjour` and `mariposa` sound foreign.
- `fr.mp3` → French speaker — `butterfly` and `mariposa` sound foreign.
- `es.mp3` → Spanish speaker — `Bonjour` and `butterfly` sound foreign.


## Use native scripts

Our models have been trained on native scripts for all supported languages.

For languages with non-Latin scripts, write your text in the language's native
script. Romanized or transliterated text may not always be pronounced as you'd
expect.

## Supported languages

| Language   | Code |
|------------|------|
| Arabic     | `ar` |
| Assamese   | `as` |
| Bengali    | `bn` |
| Chinese    | `zh` |
| Czech      | `cs` |
| Danish     | `da` |
| Dutch      | `nl` |
| English    | `en` |
| Finnish    | `fi` |
| French     | `fr` |
| German     | `de` |
| Hindi      | `hi` |
| Indonesian | `id` |
| Italian    | `it` |
| Japanese   | `ja` |
| Korean     | `ko` |
| Malayalam  | `ml` |
| Marathi    | `mr` |
| Polish     | `pl` |
| Portuguese | `pt` |
| Russian    | `ru` |
| Slovak     | `sk` |
| Spanish    | `es` |
| Swedish    | `sv` |
| Tamil      | `ta` |
| Telugu     | `te` |
| Thai       | `th` |
| Turkish    | `tr` |
| Ukrainian  | `uk` |
| Urdu       | `ur` |
| Vietnamese | `vi` |

## Next steps

<CardGroup cols={2}>
  <Card title="Accents" icon="globe" href="/build-with-lmnt/accents" variant="outline">
    Pair a language with the right accent for a natural sound
  </Card>
  <Card title="Voice cloning" icon="mic" href="/build-with-lmnt/voice-cloning" variant="outline">
    Turn your voice prompt into a saved voice, ready for low latency generation at scale
  </Card>
</CardGroup>
