Skip to content

语音识别 ASR

POST /api/v1/audio/transcriptions
Authorization: Bearer sk-xxx
Content-Type: multipart/form-data

将音频文件转换为文本。

Request(multipart/form-data)

字段类型必填说明
filefile*音频文件(mp3、mp4、mpeg、mpga、m4a、wav、webm)
modelstring*模型 ID,如 whisper-1
languagestring可选音频语言(ISO-639-1),如 zhen
promptstring可选可选提示词,引导模型生成特定风格
response_formatstring可选返回格式:json(默认)/ text / srt / verbose_json / vtt
temperaturenumber可选采样温度,默认 0

请求示例:

bash
curl https://limapi.com/api/v1/audio/transcriptions \
  -H "Authorization: Bearer sk-xxx" \
  -F file=@audio.mp3 \
  -F model=whisper-1

Response

json
{
  "text": "你好,欢迎使用语音识别服务"
}

Python 示例

python
from openai import OpenAI

client = OpenAI(
    base_url="https://limapi.com/api/v1",
    api_key="sk-xxx",
)

with open("audio.mp3", "rb") as f:
    transcript = client.audio.transcriptions.create(
        model="whisper-1",
        file=f,
    )

print(transcript.text)

LimAPI — 大模型聚合网关