Audio Speech
POST /v1/audio/speech
Convert text to natural-sounding speech in multiple voices and audio formats using OpenAI TTS models.
Request
POST https://api.chuizi.ai/v1/audio/speech
Authentication
Authorization: Bearer ck-your-api-key
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Model name, e.g. openai/tts-1, openai/tts-1-hd |
input | string | Yes | — | Text to convert to speech (max 4096 characters) |
voice | string | Yes | — | Voice preset: alloy, echo, fable, onyx, nova, shimmer |
Request Example
config.json
json
{ "model": "openai/tts-1", "input": "Hello! Welcome to Chuizi.AI, the unified AI gateway.", "voice": "nova", "response_format": "mp3", "speed": 1.0 }
Response
The response is a binary audio stream with the appropriate Content-Type header:
HTTP/1.1 200 OK Content-Type: audio/mpeg Transfer-Encoding: chunked (binary audio data)
The response does not include a JSON body. Save the response body directly as an audio file.
Code Examples
terminal
bash
curl -X POST https://api.chuizi.ai/v1/audio/speech \ -H "Authorization: Bearer ck-your-key" \ -H "Content-Type: application/json" \ -d '{ "model": "openai/tts-1", "input": "Hello! Welcome to chuizi.ai.", "voice": "nova" }' \ --output speech.mp3
Next Steps
- Audio Transcriptions — convert speech back to text
- Pricing — TTS model pricing details
- Error Codes — troubleshoot common API errors