# 语音识别

> Transcriptions / Translations：上传音频或传公网地址，转成文字。
> 分组：模型接入
> 更新时间：2026-10-12
> 原文：https://www.chenra.com/docs/model-stt

## 语音识别（Transcriptions）

把音频转成文字。两种传法：

- multipart/form-data：model + file（音频文件）——与官方 SDK 一致；

- application/json：model + input（公网音频地址）。

支持的音频格式：mp3 / wav / m4a / aac / ogg / flac / pcm，单文件不超过 25MB。
上传的文件**不落盘**，就地转成 data URI 交给上游。

## 语音翻译（Translations）

端点 /audio/translations 与识别入参完全一致；上游多数并不区分二者，
**是否翻译成英文由上游与模型决定**，需要强制翻译时请选支持翻译的模型。

## 语音识别

`POST /audio/transcriptions`

multipart 上传文件（model + file），或用 JSON 传公网地址（model + input）。

### 请求参数

| 参数 | 类型 | 必填 | 说明 | 默认值 |
| --- | --- | --- | --- | --- |
| model | string | 是 | 语音识别模型标识 |  |
| file | file | 否 | 音频文件（multipart）；与 input 二选一 |  |
| input | string | 否 | 公网音频地址（JSON）；与 file 二选一 |  |

### 请求示例

```bash
curl https://api.chenra.com/api/relay/v1/audio/transcriptions \
  -H "Authorization: Bearer sk-你的密钥" \
  -F "model=glm-asr" \
  -F "file=@./sample.mp3"
```

### 响应示例

```json
{
  "text": "今天的会议改到下午三点。",
  "model": "glm-asr"
}
```

### 错误码

| 错误码 | 说明 |
| --- | --- |
| 400 | 缺少 file / input，或音频格式不支持 / 超过 25MB |
| 404 | 模型不存在或未启用 |
