Audio API
Text-to-speech (TTS) and voice list queries
The Audio API provides text-to-speech (TTS) and voice listing capabilities.
Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /v1/audio/voice/{model} | List voices for a TTS model |
| POST | /v1/audio/speech | Text-to-speech (TTS) |
Recommended call order: First call the voice list endpoint to get data[].code, then pass it as the voice field in the TTS request.
GET /v1/audio/voice/{model}
List available voices for a TTS model.
Auth: Bearer Token
Path parameter: model — TTS model name, e.g. tts-1, cosyvoice-v3-flash
Request: No request body
Request example (curl)
curl https://www.guid.ai/v1/audio/voice/cosyvoice-v3-flash \
-H "Authorization: Bearer sk-xxx"
Response body
HTTP 200
{
"success": true,
"object": "list",
"data": [
{
"name": "龙小淳",
"code": "longxiaochun"
},
{
"name": "Cherry",
"code": "Cherry"
}
]
}
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean | Whether the call succeeded |
object | string | Always list |
data | array | Voice list |
data[].name | string | Voice display name |
data[].code | string | Voice code; pass as voice in TTS requests |
When no voices are available:
{
"success": true,
"object": "list",
"data": []
}
Failure response
HTTP 400
{
"success": false,
"message": "model is required"
}
| Field | Type | Description |
|---|---|---|
success | boolean | Always false |
message | string | Failure reason |
Notes:
- Channel voices:
nameequalscode; comes from channel configuration - Platform voice library:
nameis the display name;codeisvoice_key. If the model supports private user voices, they are included as well
POST /v1/audio/speech
Text-to-speech (TTS).
Auth: Bearer Token
Content-Type: application/json
Request body
{
"model": "tts-1",
"input": "Hello, welcome to Guid AI text-to-speech service.",
"voice": "alloy",
"response_format": "mp3",
"speed": 1.0
}
Request fields
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | TTS model, e.g. tts-1, cosyvoice-v3-flash |
input | string | Yes | Text to synthesize |
voice | string | Yes | Voice code (see voice list above) |
response_format | string | No | Output format: mp3 (default), opus, aac, flac, wav, pcm |
speed | number | No | Speech rate, 0.25–4.0; default 1.0 |
CosyVoice model example:
{
"model": "cosyvoice-v3-flash",
"input": "你好,欢迎使用语音合成服务。",
"voice": "longxiaochun",
"response_format": "mp3",
"speed": 1.0
}
Request example (curl)
curl https://www.guid.ai/v1/audio/speech \
-H "Authorization: Bearer sk-xxx" \
-H "Content-Type: application/json" \
-d '{
"model": "tts-1",
"input": "Hello, welcome to Guid AI text-to-speech service.",
"voice": "alloy",
"response_format": "mp3",
"speed": 1.0
}' \
-o speech.mp3
CosyVoice model:
curl https://www.guid.ai/v1/audio/speech \
-H "Authorization: Bearer sk-xxx" \
-H "Content-Type: application/json" \
-d '{
"model": "cosyvoice-v3-flash",
"input": "你好,欢迎使用语音合成服务。",
"voice": "longxiaochun",
"response_format": "mp3",
"speed": 1.0
}' \
-o speech.mp3
Response body
HTTP 200
- Content-Type:
audio/mpeg(mp3) or the MIME type for the chosen format - Body: Audio binary stream (not JSON)
Example response headers:
HTTP/1.1 200 OK
Content-Type: audio/mpeg
Content-Length: 45632
Response notes
| Item | Description |
|---|---|
| HTTP status | 200 |
| Content-Type | Determined by response_format; see table below |
| Body | Audio binary stream, not JSON |
response_format and Content-Type mapping
response_format | Content-Type |
|---|---|
mp3 (default) | audio/mpeg |
opus | audio/opus |
aac | audio/aac |
flac | audio/flac |
wav | audio/wav |
pcm | audio/pcm |
Failure response
HTTP 400. Format: Standard errors.
{
"error": {
"message": "voice is required",
"type": "invalid_request_error",
"code": "invalid_request"
}
}

