Skip to main content
POST
/
v1
/
audio
/
transcriptions
音频转文本
curl --request POST \
  --url https://api.qhaigc.net/v1/audio/transcriptions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form 'model=<string>' \
  --form file='@example-file' \
  --form 'response_format=<string>'
{
  "text": "<string>"
}

功能说明

使用启航 AI 的语音识别(ASR)模型,快速准确地将音频文件转换为文本。

请求参数

名称类型必选说明
modelstring模型名称,默认为 qhai-asr-lite
filefile待识别的音频文件(支持 mp3, wav, m4a 等格式)
response_formatstring响应格式,默认为 json

调用示例

import openai

client = openai.OpenAI(
    api_key="sk-your-api-key-here",
    base_url="https://api.qhaigc.net/v1"
)

audio_file = open("path/to/file.mp3", "rb")
transcription = client.audio.transcriptions.create(
    model="qhai-asr-lite",
    file=audio_file
)

print(transcription.text)

返回结果

成功返回识别后的文本。
{
  "text": "你好,这是启航 AI 的语音识别服务测试。"
}

相关内容

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

multipart/form-data
model
string
file
file
response_format
string

Response

200 - application/json

成功响应

text
string