Create an audio composition
Create an audio composition job: each speech line is generated once, sound effects are trimmed to their ranges and music is looped along the timeline, then everything is mixed into one WAV. An Idempotency-Key is required, and an explicit prompt_document is recommended. Credits are reserved once for the whole composition, not again per segment.
Authentication
Credentials in the examples are placeholders. Replace them and run the examples on your server.
Code examples
curl -X POST 'https://shixux.com/api/v1/audio/compositions' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: your-unique-business-action-id' \ -d '{"text":"[00:00] 欢迎回来。","prompt_document":{"version":1,"parts":[{"type":"text","text":"[00:00] 欢迎回来。"}]},"voice_preset_id":"vp_000000000000000000000001"}'{ "id": "job_xxx", "type": "tts", "status": "queued", "reserved_credits": 1, "estimate_detail": {}}Idempotency-Key*stringIdempotency key of up to 128 characters. Reuse the same value when retrying the same request; using it for a different request returns 409.
1 <= length <= 128application/json- body
model?stringModel ID. For image and video models, use the corresponding settings endpoint for current availability, resolutions and rates. Speech synthesis and audio composition accept indextts-2 (default) or indextts-2.5.
"indextts-2""indextts-2""indextts-2.5"speed?numberSpeaking-rate multiplier from 0.5 to 2, default 1. Available only with model indextts-2.5.
0.5 <= value <= 21prompt_document?Structured script document (version 1) made of text and reference parts, describing the timeline, voices, sound effects and music. Recommended for audio composition; when omitted, text is parsed as a simple timeline.
text*stringText to synthesize. It must not be all whitespace. In speech synthesis, indextts-2 accepts up to 2048 characters, and indextts-2.5 accepts up to 2000 characters that include a letter or digit. Audio composition scripts are limited to 5000 characters in total.
voice_preset_id?stringPreset voice ID from the preset voice catalog. Mutually exclusive with voice_asset_id and voice_ref_key.
voice_asset_id?stringVoice asset ID of your account, such as a saved designed voice or a voice reference uploaded and confirmed with purpose voice_reference. It must not be expired.
emo_asset_id?stringEmotion reference asset ID: a WAV uploaded and confirmed with purpose emotion_reference, owned by your account and unexpired. Mutually exclusive with emo_ref_key. indextts-2 only.
voice_ref_key?|Voice reference value, mutually exclusive with voice_preset_id and voice_asset_id. For voice references registered through the upload endpoints, use voice_asset_id.
emo_ref_key?|Emotion reference WAV value, up to 20 MiB. indextts-2 only. For emotion references registered through the upload endpoints, use emo_asset_id.
emo_alpha?Emo AlphaOverall strength of the eight-dimensional emotion vector, from 0 to 1. Keep the default of 1 when using emotion reference audio. indextts-2 only.
0 <= value <= 11emo_vector?array<>|Eight-dimensional emotion vector in the fixed order happy, angry, sad, afraid, disgusted, melancholic, surprised, calm. Exactly eight values, each from 0 to 1.4. Mutually exclusive with emotion reference audio. indextts-2 only.
Request succeeded
application/json- response
estimate_detail*id*Idreserved_credits*Reserved Creditsstatus*JobStatus"queued""processing""succeeded""failed""cancelled"type*JobType"tts""avatar""video""video_analysis""image""voice_design""audio_composition"