OpenAI-compatible speech synthesis
Drop-in for OpenAI POST /v1/audio/speech: point an OpenAI SDK at https://api.vieneu.io/api/v1 with your VieNeu key and it works unchanged. Returns the audio bytes directly — mp3 by default, like OpenAI; wav, opus and pcm are also available via response_format. Set stream_format to audio or sse to receive audio as it is generated instead of waiting for the whole file — that requires response_format: pcm or ulaw, the only two encodings whose frames concatenate. Maps input→text, voice→VieNeu voice id (from GET /v1/audio/voices) and model→engine. Billed by the submitted character count (minimum 50, × the AI surcharge only if you opt in with aiRefine: true) and refunded if synthesis fails. Auth via Authorization: Bearer <api key>.
Request body
Example request
{
"model": "tts-1",
"input": "Xin chào, đây là VieNeu.",
"voice": "Ngọc Lan",
"response_format": "mp3",
"sample_rate": 24000,
"speed": 1,
"instructions": "Speak in a calm tone.",
"stream_format": "audio",
"emotion": "natural",
"engine": "v3"
}Response
The audio bytes. Content-Type follows response_format (mp3 by default). With stream_format: "sse" the body is instead a text/event-stream of base64 audio deltas; with "audio" it is the same bytes, chunked. For the headerless pcm and ulaw formats the sample rate is in X-Sample-Rate (pcm defaults to 24 kHz here, not the engine native rate).
Changes
No recorded changes to this endpoint across all 1 revision of this API.