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

# Language selection

> Steer Dictation transcription toward one or more languages with the language_codes field.

Pass `language_codes` in the `config` part to steer transcription toward a
specific language. The field always takes a list, so use a single-element list
such as `["es"]` for monolingual audio, and several codes for multilingual or
code-switching audio.

* Accepts ISO language codes in a list: `["es"]`, or `["en", "es"]`
* When omitted, no language steering is applied
* Applies to the transcript only. The rewrite in `llm_response` follows the
  language of the transcript unless your
  [`llm_instruction`](https://assemblyai.com/docs/dictation/transcript-rewriting) says otherwise.

> [tab] Python SDK
>
> ```python theme={null}
> import assemblyai as aai
>
> aai.settings.api_key = "<YOUR_API_KEY>"
>
> config = aai.DictationConfig(language_codes=["es"])
>
> result = aai.DictationTranscriber().transcribe_live("clip.wav", config)
> print(result.text)
> ```

> [tab] JavaScript SDK
>
> ```javascript theme={null}
> import { AssemblyAI } from "assemblyai";
>
> const client = new AssemblyAI({ apiKey: "<YOUR_API_KEY>" });
>
> const config = {
>   language_codes: ["es"],
> };
>
> const result = await client.dictation.transcribeLive("clip.wav", config);
> console.log(result.text);
> ```

> [tab] Python
>
> ```python theme={null}
> import json
> import requests
>
> config = {"language_codes": ["es"]}
>
> with open("clip.wav", "rb") as f:
>     audio = f.read()
>
> response = requests.post(
>     "https://dictation.assemblyai.com/v1/transcribe/live",
>     headers={"Authorization": "<YOUR_API_KEY>"},
>     files={
>         "config": (None, json.dumps(config), "application/json"),
>         "audio": ("clip.wav", audio, "audio/wav"),
>     },
>     timeout=90,
> )
> response.raise_for_status()
> print(response.json()["text"])
> ```

> [tab] JavaScript
>
> ```javascript theme={null}
> import { readFileSync } from "fs";
>
> const config = { language_codes: ["es"] };
>
> const audio = readFileSync("clip.wav");
> const form = new FormData();
> form.append(
>   "config",
>   new Blob([JSON.stringify(config)], { type: "application/json" })
> );
> form.append("audio", new Blob([audio], { type: "audio/wav" }), "clip.wav");
>
> const response = await fetch(
>   "https://dictation.assemblyai.com/v1/transcribe/live",
>   { method: "POST", headers: { Authorization: "<YOUR_API_KEY>" }, body: form }
> );
> console.log((await response.json()).text);
> ```

> [tab] cURL
>
> ```bash theme={null}
> curl -X POST https://dictation.assemblyai.com/v1/transcribe/live \
>   -H 'Authorization: <YOUR_API_KEY>' \
>   -F 'config={"language_codes": ["es"]};type=application/json' \
>   -F 'audio=@clip.wav;type=audio/wav'
> ```

## Multilingual audio

Pass several codes when a single clip moves between languages, which is common
in dictation from bilingual speakers:

```json theme={null}
{ "language_codes": ["en", "es"] }
```

List only the languages you actually expect. Extra codes give the model more
ways to be wrong on ambiguous audio.

## Supported languages

The endpoint accepts 32 codes. Anything outside this set is rejected with a
`400` that lists the full set in its `detail`.

| Code | Language | Code | Language |
| - | - | - | - |
| `en` | English | `ko` | Korean |
| `es` | Spanish | `ca` | Catalan |
| `de` | German | `gl` | Galician |
| `fr` | French | `ru` | Russian |
| `it` | Italian | `ro` | Romanian |
| `pt` | Portuguese | `et` | Estonian |
| `tr` | Turkish | `fa` | Persian |
| `nl` | Dutch | `yue` | Cantonese |
| `sv` | Swedish | `af` | Afrikaans |
| `no` | Norwegian | `mr` | Marathi |
| `da` | Danish | `zu` | Zulu |
| `fi` | Finnish | `xh` | Xhosa |
| `hi` | Hindi | `nn` | Norwegian Nynorsk |
| `vi` | Vietnamese | `ar` | Arabic |
| `he` | Hebrew | `ja` | Japanese |
| `ur` | Urdu | `zh` | Mandarin |

## Related features

* [Prompting and keyterms](https://assemblyai.com/docs/dictation/prompting-and-keyterms.md) steers the
  transcript within the chosen language.
* [Transcript rewriting](https://assemblyai.com/docs/dictation/transcript-rewriting.md) reshapes the
  transcript after it is written.
