创建语音转文本请求
Creates an audio transcription.
The audio file object (not file name) to transcribe. File upload specifications are limited to:duration not exceeding 1 hour, and file size not exceeding 50MB.
binary"/path/to/file/audio.mp3"Corresponding Model Name. To better enhance service quality, we will make periodic changes to the models provided by this service, including but not limited to model on/offlining and adjustments to model service capabilities. We will notify you of such changes through appropriate means such as announcements or message pushes where feasible.
"FunAudioLLM/SenseVoiceSmall" | "TeleAI/TeleSpeechASR""FunAudioLLM/SenseVoiceSmall"Response Body
The response from the model. The response header contains the x-siliconcloud-trace-id field, which serves as a unique identifier for tracing requests, facilitating log queries and issue troubleshooting.
TypeScript Definitions
Use the response body type in TypeScript.
The transcribed text.
curl --request POST \
--url https://api.siliconflow.cn/v1/audio/transcriptions \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-F "file=@path/to/your/audio.mp3" \
-F "model=FunAudioLLM/SenseVoiceSmall"
import requests
url = "https://api.siliconflow.cn/v1/audio/transcriptions"
file_path = "path/to/your/audio.mp3"
headers = {
"Authorization": "Bearer <YOUR_API_KEY>"
}
with open(file_path, "rb") as audio_file:
files = {
"file": ("audio.mp3", audio_file), # 根据文件类型调整 MIME 类型
"model": (None, "FunAudioLLM/SenseVoiceSmall")
}
response = requests.post(url, headers=headers, files=files)
fetch('https://api.siliconflow.cn/v1/audio/transcriptions', {
method: 'POST',
headers: {
'Authorization': 'Bearer <YOUR_API_KEY>'
},
body: JSON.stringify({
model: 'FunAudioLLM/SenseVoiceSmall',
file: 'path/to/your/audio.mp3'
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
{
"text": "string"
}{
"code": 20012,
"message": "string",
"data": "string"
}"Invalid token""Forbidden""404 page not found"{
"message": "Request was rejected due to rate limiting. If you want more, please contact contact@siliconflow.cn. Details:TPM limit reached.",
"data": "string"
}{
"code": 50505,
"message": "Model service overloaded. Please try again later.",
"data": "string"
}"string"