---
url: https://limapi.com/docs/guide/asr.md
---
# 语音识别 ASR

```
POST /api/v1/audio/transcriptions
Authorization: Bearer sk-xxx
Content-Type: multipart/form-data
```

将音频文件转换为文本。

## Request（multipart/form-data）

| 字段 | 类型 | 必填 | 说明 |
|------|------|------|------|
| file | file | \* | 音频文件（mp3、mp4、mpeg、mpga、m4a、wav、webm） |
| model | string | \* | 模型 ID，如 `whisper-1` |
| language | string | 可选 | 音频语言（ISO-639-1），如 `zh`、`en` |
| prompt | string | 可选 | 可选提示词，引导模型生成特定风格 |
| response\_format | string | 可选 | 返回格式：`json`（默认）/ `text` / `srt` / `verbose_json` / `vtt` |
| temperature | number | 可选 | 采样温度，默认 0 |

**请求示例：**

```bash
curl https://limapi.com/api/v1/audio/transcriptions \
  -H "Authorization: Bearer sk-xxx" \
  -F file=@audio.mp3 \
  -F model=whisper-1
```

## Response

```json
{
  "text": "你好，欢迎使用语音识别服务"
}
```

## Python 示例

```python
from openai import OpenAI

client = OpenAI(
    base_url="https://limapi.com/api/v1",
    api_key="sk-xxx",
)

with open("audio.mp3", "rb") as f:
    transcript = client.audio.transcriptions.create(
        model="whisper-1",
        file=f,
    )

print(transcript.text)
```
