Audio dùng cùng khóa API và model ID từ GET /v1/models.
Điểm cần nhớ
- Speech tính theo ký tự Unicode.
- Transcription và translation nhận multipart/form-data.
- Thời lượng được làm tròn lên giây và tối thiểu một giây.
- Request lỗi không bị tính phí.
Tạo giọng nói hoặc chép lời âm thanh#
Dùng các route audio tương thích OpenAI với khóa API. Speech trả về file âm thanh; transcription và translation nhận multipart audio rồi trả JSON văn bản.
curl https://api.xpncore.com/v1/audio/speech \
-H "Authorization: Bearer $XPNCORE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"AUDIO_MODEL_ID","input":"Hello from XPNCORE","voice":"alloy","response_format":"wav"}' \
-o speech.wavGET /v1/models liệt kê model audio cùng audio.speech, audio.transcriptions hoặc audio.translations.
Tham số audio#
Speech nhận JSON gồm model, input và voice. Các route upload dùng multipart/form-data với model và file; language và prompt là tùy chọn.
curl https://api.xpncore.com/v1/audio/transcriptions \
-H "Authorization: Bearer $XPNCORE_API_KEY" \
-F [email protected] \
-F model=AUDIO_MODEL_ID \
-F language=enGiá audio#
Speech tính theo số ký tự Unicode, dùng giá mỗi triệu ký tự của model. Transcription và translation tính theo thời lượng audio đo được, làm tròn lên giây và tối thiểu một giây. Request lỗi không bị tính phí.
Lỗi audio#
Hãy dùng model khai báo capability audio tương ứng. Multipart sai, định dạng audio không hỗ trợ, không đủ tiền hoặc upstream lỗi sẽ trả error chuẩn; upstream lỗi sẽ hoàn tiền giữ.