9. Audio#
9.1 Speech synthesis (TTS)#
POST /v1/audio/speech — text to speech; returns an audio byte stream (e.g. audio/mpeg) that can be written directly to a file.
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | TTS model name |
input | string | Yes | Text to synthesize |
voice | string | No | Voice |
cURL
curl http://183.240.79.21:52099/v1/audio/speech \
-H "Authorization: Bearer sk-你的YiTuoToken-Key" \
-H "Content-Type: application/json" \
-d '{
"model": "tts-1",
"input": "你好,欢迎使用 YiTuoToken",
"voice": "alloy"
}' \
--output speech.mp3
9.2 Speech recognition (STT)#
POST /v1/audio/transcriptions — speech to text (Whisper). The audio file is uploaded with multipart/form-data.
| Field | Required | Description |
|---|---|---|
file | Yes | Audio file |
model | Yes | Recognition model name |
language | No | Language code, e.g. zh |
prompt | No | Prompt |
response_format | No | Response format |
temperature | No | Sampling temperature |
cURL
curl http://183.240.79.21:52099/v1/audio/transcriptions \
-H "Authorization: Bearer sk-你的YiTuoToken-Key" \
-F file=@./audio.mp3 \
-F model="whisper-1" \
-F language="zh"