Files
SnapOtter/apps/docs/zh-CN/tools/audio/transcribe-audio.md
T
SnapOtterandGitHub 4963ab3bbd feat(docs-i18n): translate all documentation into 20 languages
All 181 docs markdown files translated into 20 languages (apps/docs/<locale>/**). Companion to the i18n code PR; admin-merged because the file count exceeds GitHub's per-PR CI trigger limit. Validated by pnpm i18n:check (all surfaces, 0 stale/missing) and a clean all-locale docs build.
2026-07-11 13:52:47 +08:00

2.0 KiB
Raw Blame History

description, i18n_source_hash, i18n_provenance, i18n_output_hash
description i18n_source_hash i18n_provenance i18n_output_hash
使用 AI 驱动的转写将语音转换为文本。 ae98c4c0aed2 human 85e9922f3b8c

Transcribe Audio

使用 AI 驱动的转写(faster-whisper)将语音转换为文本。支持纯文本、SRT 和 VTT 输出格式,并可自动或手动选择语言。

API Endpoint

POST /api/v1/tools/audio/transcribe-audio

接受包含音频文件和 JSON settings 字段的 multipart 表单数据。

Parameters

Parameter Type Required Default Description
language string No "auto" 语言:autoendefreszhjakoidthvi
outputFormat string No "txt" 输出格式:txtsrtvtt

Example Request

curl -X POST http://localhost:1349/api/v1/tools/audio/transcribe-audio \
  -H "Authorization: Bearer si_your-api-key" \
  -F "file=@audio.mp3" \
  -F 'settings={"language": "en", "outputFormat": "srt"}'

Example Response

这是一个异步工具。API 会立即返回 202 Accepted

{
  "jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "async": true
}

通过 GET /api/v1/jobs/{jobId}/progress 处的 SSE 跟踪进度。作业完成后,SSE 流会传递带有 downloadUrl 的最终结果。

Notes

  • 需要安装 transcription 功能包。如果该功能包不可用,会返回 501,其代码为 FEATURE_NOT_INSTALLED,并包含缺失的 featurefeatureNameestimatedSize
  • 使用 faster-whisper 进行转写。语言设为 auto 时会自动检测所说的语言。
  • srtvtt 格式为每个片段包含时间戳,适合用作字幕。
  • txt 格式返回不带时间戳的纯文本。
  • 这是一个长时间运行的 AI 工具,处理时间取决于音频长度和服务器硬件。