LEAPERone 文档

音频转写 API

POST /v1/audio/transcriptions 参考,涵盖文件上传、文件 URL、语言提示、响应格式和计费规则。

把音频转写为文本。支持直接上传文件或传入 URL。

端点

POST https://api.leaper.one/v1/audio/transcriptions

模型

模型价格说明
rapid0.006 点数/分钟快速转写,支持 file_uri
whisper-10.006 点数/分钟高精度转写,支持 prompt

参数

参数类型必填说明
filefilefile_uri 二选一要转写的音频文件,以 multipart 方式上传
file_uristringfile 二选一要转写的音频文件 URL
modelstring使用的模型:"rapid""whisper-1"。默认:"rapid"
response_formatstring输出格式:"text""json""verbose_json""srt""vtt"。默认:"json"
languagestringISO 639-1 语言代码,例如 "en""zh"。指定后可提升准确度
promptstring用于提升转写质量的提示文本
temperaturenumber0 到 1 之间的采样温度,仅支持 whisper-1

请求

上传文件

curl -X POST https://api.leaper.one/v1/audio/transcriptions \
  -H "Authorization: Bearer sk-your-api-key" \
  -F [email protected] \
  -F model=rapid \
  -F response_format=json

传入 URL(大文件推荐)

curl -X POST https://api.leaper.one/v1/audio/transcriptions \
  -H "Authorization: Bearer sk-your-api-key" \
  -F file_uri=https://example.com/audio.mp3 \
  -F model=rapid \
  -F language=zh \
  -F response_format=verbose_json

使用 file_uri 可以避免通过你的网络上传大文件。服务端会直接拉取音频,rapidwhisper-1 都支持这种方式。

使用带 prompt 的 whisper-1

curl -X POST https://api.leaper.one/v1/audio/transcriptions \
  -H "Authorization: Bearer sk-your-api-key" \
  -F [email protected] \
  -F model=whisper-1 \
  -F response_format=json \
  -F prompt="LEAPERone, GTC, NVIDIA"

请求字幕格式

curl -X POST https://api.leaper.one/v1/audio/transcriptions \
  -H "Authorization: Bearer sk-your-api-key" \
  -F [email protected] \
  -F model=whisper-1 \
  -F response_format=srt

响应

{
  "text": "Hello, this is a sample transcription of the audio file."
}

使用 verbose_json 时,响应会包含时间戳和分段:

{
  "task": "transcribe",
  "language": "en",
  "duration": 42.5,
  "text": "Hello, this is a sample transcription of the audio file.",
  "segments": [
    { "start": 0.0, "end": 2.4, "text": "Hello, this is a sample transcription." }
  ]
}

使用 srt 时,响应是纯文本字幕:

1
00:00:00,000 --> 00:00:02,400
Hello, this is a sample transcription.

使用 vtt 时,响应采用 WebVTT 格式:

WEBVTT

00:00:00.000 --> 00:00:02.400
Hello, this is a sample transcription.

支持的音频格式

mp3mp4mpegmpgam4awavwebmopus

直接上传文件的大小上限为 25 MB。使用 file_uri 时没有大小限制。

注意事项

  • 按音频时长和上表中的模型单价计费。
  • 未指定 model 时,默认使用 rapid
  • 当前不支持流式转写(stream=true)。