# 语音转文字（STT）

将音频文件转录为文字。请求使用 `multipart/form-data` 格式，必须包含 `file`（16k/单声道/16bit wav）和 `model`（如 `doubao-asr`）字段。

**音频格式要求**（严格校验）：
- 容器：WAV (RIFF/WAVE)
- 编码：PCM (s16le)
- 采样率：16000 Hz
- 声道：单声道 (mono)
- 位深度：16 bit

不符合上述格式的音频将在上传时被拒绝并返回 400 错误（不会调用上游识别服务，不产生计费）。

**响应格式**：成功时返回 Volcengine 格式的 JSON 响应，包含以下字段：
- `result.text` — 识别后的文字内容
- `audio_info.duration` — 识别的音频时长（**毫秒**），用于结算
- `request_id` — 网关请求 ID（`tr-req-` 前缀）

**计费方式**：按音频时长计费，结算使用 `audio_info.duration`（毫秒）计算实际费用。

## POST /v1/audio/transcriptions

> Speech-to-Text (STT)

Transcribe audio files to text. The request uses `multipart/form-data` format and must include `file` (16k/mono/16bit WAV) and `model` fields.

**Response format**: On success, returns a Volcengine-shaped JSON response with the following fields:
- `result.text` — Recognized text content
- `audio_info.duration` — Recognized audio duration in **milliseconds**, used for settlement
- `request_id` — Gateway request ID (`tr-req-` prefix)

**Billing**: Charged per audio duration. Settlement uses `audio_info.duration` (milliseconds) to calculate the actual cost.

### Authentication

`Authorization: Bearer tr-xxx`

### Request Body

Content-Type: `multipart/form-data`

- **model** `string` **(required)**  
  STT model ID. Filter by `type: stt` via `GET /v1/models`
- **file** `string` **(required)**  
  Audio file. Supported formats: mp3, mp4, mpeg, mpga, m4a, wav, webm
- **language** `string`  
  Optional: Audio language code (BCP-47 format, e.g. `zh-CN`, `en-US`). Specifying this can improve recognition accuracy.
- **prompt** `string`  
  Prompt text to provide context and improve recognition accuracy
- **response_format** ``json` | `text` | `srt` | `verbose_json` | `vtt`` (default: `json`)  
  Response format

### Response

- **result** `object` **(required)**  
  
- **result.text** `string` **(required)**  
  Transcribed text content
- **audio_info** `object` **(required)**  
  
- **audio_info.duration** `integer` **(required)**  
  Recognized audio duration in milliseconds
- **request_id** `string` **(required)**  
  Gateway request ID

### Error Codes

- `400`: 
- `401`: 
- `402`: 
- `429`: 
- `502`:
