Skip to content

Text to speech and voice samples ​

Vox 1 creates one MP3 from text for narration, announcements and everyday reading. The default synchronous API returns MP3 bytes directly; asynchronous tasks remain available. Both support voice selection, speaking speed, pitch, volume, emotion and enhancement.

Model and pricing ​

RouteOutputDefault-group priceText limit per task
vox-1One MP3USD 0.01369863, approximately CNY 0.10 per successful generation5000 weighted character units

Han characters in U+4E00–U+9FFF count as two units; all other Unicode code points count as one, including punctuation and spaces. This permits up to 2500 Han characters or 5000 English characters. Text is never truncated or automatically split into separately billed tasks. Send plain text; inline emotion markup is not interpreted.

The CNY estimate uses an exchange rate of 7.3. Account group multipliers and display currency may differ; consult your actual bill. Creation reserves one generation fee. Success settles it and failure refunds it. Text length within the limit and sound parameters do not multiply the charge. Status queries and repeated downloads do not create new generation charges.

Listen and choose a voice ​

Open Synthesize speech, filter by language, search voices and play fixed samples. Selecting a voice updates the code example and the playground request.

Fixed sample playback is free and requires no API key. Synthesizing your own text requires a customer key and normal billing. Some voices have no fixed sample.

Applications may read the voice catalog. It lists public id, supported models, name, language, description and preview_url, which is null when no sample is available. Voice IDs are scoped to their listed models. Each model defines its own controls and limits.

POST /v1/audio/speech waits for completion and returns Content-Type: audio/mpeg with MP3 bytes, rather than a queued task.

bash
curl https://openai.2yanx.dpdns.org/v1/audio/speech \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"vox-1","input":"Hello, welcome to our speech service.","voice":"vx_dbd27c4a9332","speed":1,"response_format":"mp3","metadata":{"pitch":0,"volume":0,"emotion":"neutral","enhance":true}}' \
  -o speech.mp3

Put speed at the top level and other controls in metadata. Vox 1 supports MP3 only, with no stream:true, SSE or progressive playback. Both execution modes have the same price and text limit.

Generation may continue after a timeout or disconnect. Do not assume no generation or charge occurred, and do not automatically resubmit. The synchronous route provides no customer task ID to poll. Use asynchronous tasks when you need persistent records or recovery after disconnect. Check HTTP status and JSON errors before saving audio; 422 indicates validation failure, although New API may show only a generic message.

Asynchronous: create, poll and download ​

POST /tts/v1/tasks returns an id and status immediately. Create a speech task accepts the same canonical fields as synchronous speech:

json
{"model":"vox-1","input":"Hello, welcome to our speech service.","voice":"vx_dbd27c4a9332","speed":1,"response_format":"mp3","metadata":{"pitch":0,"volume":0,"emotion":"neutral","enhance":true}}

Legacy text / parameters / output requests remain supported. Do not mix the two request formats:

bash
curl https://openai.2yanx.dpdns.org/tts/v1/tasks \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"vox-1","text":"Hello, welcome to our speech service.","voice":"vx_dbd27c4a9332","parameters":{"speed":1,"pitch":0,"volume":0,"emotion":"neutral","enhance":true},"output":{"format":"mp3"}}'

Save the returned id and poll every 3–5 seconds. Creation acknowledges acceptance; the terminal states are succeeded and failed. After a client disconnect, query the existing task before submitting again.

bash
curl https://openai.2yanx.dpdns.org/tts/v1/tasks/TASK_ID \
  -H "Authorization: Bearer YOUR_API_KEY"
curl https://openai.2yanx.dpdns.org/v1/tasks/TASK_ID/artifacts \
  -H "Authorization: Bearer YOUR_API_KEY"
curl https://openai.2yanx.dpdns.org/v1/tasks/TASK_ID/artifacts/audio/content \
  -H "Authorization: Bearer YOUR_API_KEY" -o speech.mp3

Download after success using the task owner's customer key. The audio artifact key is audio. Downloads support HEAD and byte ranges. Access parameters in share URLs act as credentials.

Sound controls ​

ParameterRange / defaultMeaning
speed0.5–2 / 1Speaking speed multiplier
pitchInteger -12–12 / 0Pitch control
volumeInteger 0–10 / 0Zero retains baseline volume; higher values increase it. Zero is not mute.
emotionEmpty string by defaultApplies to the full text: happy, sad, angry, fearful, disgusted, surprised, neutral
enhanceBoolean / trueSpeech enhancement switch

For canonical requests, put speed at the top level and other controls in metadata. Legacy asynchronous requests use parameters. Use JSON numbers and booleans. Perceived emotion varies with the voice and text, so compare short samples first. Only MP3 is supported. Unsupported formats, out-of-range controls and invalid voices produce an error. The synchronous relay may ignore unregistered top-level fields; follow this contract. The playground validates requests before sending.

Correct the input before creating a replacement for a failed task. For a temporary service error, retry later after checking any existing task's terminal state.