跳转到主要内容
Send a POST request to https://api.qhaigc.net/v1/audio/transcriptions to convert an audio file into text. The qhai-asr-lite model is optimized for speed and accuracy across a wide range of languages. If you do not specify a language, the model detects it automatically.

Request

POST https://api.qhaigc.net/v1/audio/transcriptions
The request body must use multipart/form-data encoding.

Parameters

file
file
必填
The audio file to transcribe. Supported formats include mp3, wav, m4a, ogg, flac, and webm.
model
string
必填
The transcription model to use. Set this to "qhai-asr-lite".
language
string
The language of the audio as an ISO-639-1 code (for example, "zh" for Chinese or "en" for English). If omitted, the model detects the language automatically.
response_format
string
The format of the transcription output. Options are "json" (default), "text", "srt", and "vtt".

Response

text
string
The transcribed text content of the audio file.

Example response

{
  "text": "你好,这是启航 AI 的语音识别服务测试。"
}

Code examples

import openai

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

with open("audio.mp3", "rb") as audio_file:
    transcription = client.audio.transcriptions.create(
        model="qhai-asr-lite",
        file=audio_file
    )

print(transcription.text)