Stream synthesized speech
inference-tts:createAdd-onInferenceRetriesIdempotency-Key identifies the computationAuthenticationStreams raw little-endian PCM16 mono at 16 kHz as the audio is produced. Use a dedicated Inference key.
A 200 or EOF alone cannot prove completion
Inspect the X-Kejue-Inference-Status trailer — completed, error or cancelled — or read GET /inference/requests/{id} afterwards.
Billing and limits
Text to speech is charged by input length, in characters. The whole input is reserved up front (402 if your balance is short) and charged once audio starts; nothing is charged if no audio is produced, and the audio's length never changes the charge. X-Kejue-Characters carries the characters charged. Output is capped by the model's audio limit and the optional max_audio_seconds, as a safety limit; output_limit means output stopped at that cap, and the input is still charged in full. Audio content is never retained.
Idempotency
The Idempotency-Key identifies one computation. A repeated key returns 409 without rerunning or replaying audio.
See one-shot generation.
inferenceBearerAuthAuthorizationBearer <token>Use an Inference API key. Access and keys.
Idempotency-Key*stringIdentifies one computation. Reuse returns 409 inference_request_exists; results are not replayed. Retries and idempotency.
^[A-Za-z0-9!#$%&'*+.^_`|~-]+$1 <= length <= 255application/json- body
model*string1 <= length <= 80voice*stringuuidinput*stringThe text to speak. Charged by its length in Unicode characters (code points), counted as received, whitespace and punctuation included.
1 <= length <= 8000max_audio_seconds?integerOptional cap on the audio produced, a safety limit for runaway output. It does not change what is charged (the input characters), and output cut by the cap is still charged in full once audio has started.
1 <= value <= 600Stream synthesized speech
response?fileaudio/pcmbinarycurl -X POST 'https://api.kejue.co/v1/inference/audio/speech' \ -H 'Idempotency-Key: string' \ -H 'Content-Type: application/json' \ -d '{ "model": "string", "voice": "30cbffd2-8150-49ae-9350-1bb3c0c35f29", "input": "string"}'"string"