> This is a page from the ElevenLabs documentation. For a complete page index, fetch https://elevenlabs.io/docs/llms.txt. For the full documentation in a single file, fetch https://elevenlabs.io/docs/llms-full.txt.

# 数字和语言选项

> **Note**
>
> **操作指南** · 假设你已完成 [文本转语音 快速入门](/docs/zh/eleven-api/guides/cookbooks/speech-to-text)。

## 概述

[Scribe v3](/docs/zh/overview/models#scribe-v3) 为批量文本转语音 API 新增了两个可选参数：

* `numbers_format` 设置转录文本中的数字以数字形式（`42`）还是文字形式（`forty-two`）书写。
* `secondary_language_codes` 列出除 `language_code` 外，音频中可能使用的其他语言。这可提升说话人在不同语言间切换时的转录准确性。

这两个参数仅受 `scribe_v3` 支持。将其中任一参数与其他模型一同发送会返回 `invalid_parameters` 错误。

> **Note**
>
> SDK 尚未提供这些参数的类型化参数。在 Python 中，请通过 `request_options` 传递。在 TypeScript 中，请使用 `fetch` 发送请求。

## 格式化数字

将 `numbers_format` 设置为 `digits` 或 `words`。省略此参数时，模型会自行选择格式。

| 值        | 输出示例        |
| -------- | ----------- |
| `digits` | `42`        |
| `words`  | `forty-two` |
| （省略）     | 由模型选择       |

```python maxLines=0 {19-24}
import os
from io import BytesIO

import requests
from dotenv import load_dotenv
from elevenlabs.client import ElevenLabs

load_dotenv()

elevenlabs = ElevenLabs(
    api_key=os.getenv("ELEVENLABS_API_KEY"),
)

audio_url = "https://storage.googleapis.com/eleven-public-cdn/audio/marketing/nicole.mp3"
audio_data = BytesIO(requests.get(audio_url).content)

transcription = elevenlabs.speech_to_text.convert(
    file=audio_data,
    model_id="scribe_v3",
    request_options={
        "additional_body_parameters": {
            "numbers_format": "digits",
        },
    },
)

print(transcription.text)
```

```typescript maxLines=0 {10-11}
import "dotenv/config";

const audio = await fetch(
  "https://storage.googleapis.com/eleven-public-cdn/audio/marketing/nicole.mp3"
);
const audioBlob = new Blob([await audio.arrayBuffer()], { type: "audio/mp3" });

const form = new FormData();
form.append("file", audioBlob, "nicole.mp3");
form.append("model_id", "scribe_v3");
form.append("numbers_format", "digits");

const response = await fetch("https://api.elevenlabs.io/v1/speech-to-text", {
  method: "POST",
  headers: { "xi-api-key": process.env.ELEVENLABS_API_KEY! },
  body: form,
});

const transcription = await response.json();
console.log(transcription.text);
```

`numbers_format` 控制模型如何转录数字。如需更改日期、时间或单位的书写方式，请使用[转录文本编辑](/docs/zh/eleven-api/guides/how-to/speech-to-text/batch/transcript-editing)。

## 声明次要语言

将 `language_code` 设置为音频的主要语言，将 `secondary_language_codes` 设置为预期出现的其他语言。两者均接受 ISO-639-1 或 ISO-639-3 代码。

`secondary_language_codes` 是一个列表。每种语言需重复一次表单字段。不接受以单个字符串形式发送的 JSON 数组。

以下示例转录同时包含西班牙语和法语的英语音频：

```python maxLines=0 {4-9}
transcription = elevenlabs.speech_to_text.convert(
    file=audio_data,
    model_id="scribe_v3",
    language_code="en",
    request_options={
        "additional_body_parameters": {
            "secondary_language_codes": ["es", "fr"],
        },
    },
)
```

```typescript maxLines=0 {4-7}
const form = new FormData();
form.append("file", audioBlob, "recording.mp3");
form.append("model_id", "scribe_v3");
form.append("language_code", "en");
for (const code of ["es", "fr"]) {
  form.append("secondary_language_codes", code);
}

const response = await fetch("https://api.elevenlabs.io/v1/speech-to-text", {
  method: "POST",
  headers: { "xi-api-key": process.env.ELEVENLABS_API_KEY! },
  body: form,
});
```

> **Warning**
>
> `secondary_language_codes` 中无法识别的代码会被跳过且不返回错误。发送请求前，请根据[支持的语言](/docs/zh/overview/capabilities/speech-to-text#supported-languages)检查代码。

Scribe v3 会以语音实际使用的语言进行转录，不会在主要语言和次要语言之间翻译。

## 与其他参数结合使用

两个参数可同时使用，也可与 `keyterms`、`diarize` 和 `no_verbatim` 等其他批处理参数结合使用。请参阅[关键术语提示](/docs/zh/eleven-api/guides/how-to/speech-to-text/batch/keyterm-prompting)，了解如何引导转录优先识别特定术语。

## 后续步骤

#### [模型](/docs/zh/overview/models#scribe-v3)

Scribe v3 功能，以及如何从 Scribe v2 升级。

#### [实时语言选项](/docs/zh/eleven-api/guides/how-to/speech-to-text/realtime/language-options)

使用 Scribe v3 Live 以多种语言转录实时音频。