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

# 语音转文本

> 使用与 OpenAI 兼容的 /audio/transcriptions 端点，通过 Venice 的语音转文本模型转录音频文件。

语音转文本可将口语音频转录为文字。向 `/audio/transcriptions` 发送一个音频文件，选择转录模型，并指定所需的响应格式。

## 基本用法

<CodeGroup>
  ```python Python theme={"system"}
  import os

  import requests

  with open("meeting.mp3", "rb") as audio:
      response = requests.post(
          "https://api.venice.ai/api/v1/audio/transcriptions",
          headers={"Authorization": f"Bearer {os.environ['VENICE_API_KEY']}"},
          files={"file": audio},
          data={
              "model": "nvidia/parakeet-tdt-0.6b-v3",
              "response_format": "json",
          },
      )

  response.raise_for_status()
  print(response.json()["text"])
  ```

  ```javascript Node.js theme={"system"}
  import { createReadStream } from "node:fs";
  import FormData from "form-data";

  const form = new FormData();
  form.append("file", createReadStream("meeting.mp3"));
  form.append("model", "nvidia/parakeet-tdt-0.6b-v3");
  form.append("response_format", "json");

  const response = await fetch("https://api.venice.ai/api/v1/audio/transcriptions", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.VENICE_API_KEY}`,
      ...form.getHeaders(),
    },
    body: form,
  });

  if (!response.ok) {
    throw new Error(await response.text());
  }

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

  ```bash cURL theme={"system"}
  curl https://api.venice.ai/api/v1/audio/transcriptions \
    -H "Authorization: Bearer $VENICE_API_KEY" \
    --form file=@meeting.mp3 \
    --form model=nvidia/parakeet-tdt-0.6b-v3 \
    --form response_format=json
  ```
</CodeGroup>

## 支持的输入

常见音频格式包括 `mp3`、`mp4`、`mpeg`、`mpga`、`m4a`、`wav`、`webm`、`flac` 和 `ogg`。请查阅 [语音转文本模型](/models/speech-to-text) 页面了解当前模型支持情况和价格。

## 响应格式

| 格式             | 适用场景                           |
| -------------- | ------------------------------ |
| `json`         | 需要简单的 `{ "text": "..." }` 响应时。 |
| `text`         | 需要纯文本、无需解析 JSON 时。             |
| `srt`          | 需要 SubRip 字幕时。                 |
| `vtt`          | 需要 WebVTT 字幕时。                 |
| `verbose_json` | 需要更丰富的时间戳和分段元数据时。              |

<Tip>
  当转录内容将与媒体播放配合使用时，请选择字幕格式。当转录用于摘要生成、搜索或下游聊天提示时，请使用 `json` 或 `text`。
</Tip>

## 生产环境建议

* 尽量保证音频清晰，避免多人同时说话。
* 如果工作流需要更低延迟或更方便重试，可将过长的录音切分为较小的片段。
* 为每份转录保存原始音频路径、模型 ID 和响应格式，便于审计。

## 相关资源

* [Audio Transcriptions API](/api-reference/endpoint/audio/transcriptions)
* [语音转文本模型](/models/speech-to-text)
* [文本转语音指南](/guides/media/text-to-speech)
