音频接口
使用 OpenAI Compatible 的 Audio 接口完成语音转文字和文字转语音。
两个接口:
POST /v1/audio/transcriptions— 语音转文字POST /v1/audio/speech— 文字转语音
语音转文字
curl --request POST \
--url https://ergouzi.life/v1/audio/transcriptions \
--header "Authorization: Bearer $DOGZEE_API_KEY" \
--header "Content-Type: multipart/form-data" \
--form file=@/path/to/audio.mp3 \
--form model=whisper-1
这是文件上传请求,不是纯 JSON。
文字转语音
curl --request POST \
--url https://ergouzi.life/v1/audio/speech \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $DOGZEE_API_KEY" \
--data '{
"model": "tts-1",
"voice": "alloy",
"input": "欢迎使用 Dogzee API 文档站。"
}' \
--output speech.mp3
排错
- transcription 失败 → 确认用的是 multipart 文件上传,不是 JSON
- 请求失败 → 检查分组是否支持音频模型