This page was machine-translated. Spotted a mistake?Help improve it.
Skip to content

語音轉錄

使用 AI 驅動的轉錄(faster-whisper)將語音轉換為文字。支援純文字、SRT 與 VTT 輸出格式,並可自動或手動選擇語言。

API Endpoint

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

接受包含一個音訊檔案以及一個 JSON settings 欄位的 multipart form data。

Parameters

ParameterTypeRequiredDefaultDescription
languagestringNo"auto"語言:autoendefreszhjakoidthvi
outputFormatstringNo"txt"輸出格式:txtsrtvtt

Example Request

bash
curl -X POST http://localhost:1349/api/v1/tools/audio/transcribe-audio \
  -H "Authorization: Bearer si_your-api-key" \
  -F "[email protected]" \
  -F 'settings={"language": "en", "outputFormat": "srt"}'

Example Response

這是一個非同步工具。API 會立即回傳 202 Accepted

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

透過 GET /api/v1/jobs/{jobId}/progress 的 SSE 追蹤進度。當工作完成時,SSE 串流會傳遞包含 downloadUrl 的最終結果。

Notes

  • 需要安裝 transcription 功能套件包。若套件包無法使用,會回傳 501 並帶有代碼 FEATURE_NOT_INSTALLED、缺少的 featurefeatureName 以及 estimatedSize
  • 使用 faster-whisper 進行轉錄。語言 auto 會自動偵測所說的語言。
  • srtvtt 格式會為每個片段包含時間戳記,適合作為字幕。
  • txt 格式會回傳不含時間戳記的純文字。
  • 這是一個長時間執行的 AI 工具;處理時間取決於音訊長度與伺服器硬體。