Create speech
Submit text and a voice to generate speech asynchronously. Select indextts-2 (default) or indextts-2.5 with model; voice_preset_id, voice_asset_id and voice_ref_key are mutually exclusive. indextts-2 supports emotion reference audio or an eight-dimensional emotion vector, with up to 2048 characters of text. indextts-2.5 requires language, supports speed and emo_text, and accepts up to 2000 characters.
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/tts' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: your-unique-business-action-id' \ -d '{"text":"Hello from Shixu.","voice_preset_id":"vp_000000000000000000000001","emo_vector":[0,0,0,0,0,0,0,1]}'{ "id": "job_xxx", "type": "tts", "status": "queued", "reserved_credits": 1, "estimate_detail": {}}Idempotency-Key?|Idempotency key of up to 128 characters. Reuse the same value when retrying the same request; using it for a different request returns 409.
application/json- body
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_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.
model?ModelModel 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"language?LanguageLanguage. Speech synthesis and audio composition use it only with model indextts-2.5, where it is required and must be ZH, EN or JA. Voice design uses the language codes its configuration allows.
"ZH""EN""JA"speed?SpeedSpeaking-rate multiplier from 0.5 to 2, default 1. Available only with model indextts-2.5.
0.5 <= value <= 21emo_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.
text*TextText 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.
1 <= length <= 2048voice_asset_id?|Voice 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.
voice_preset_id?|Preset voice ID from the preset voice catalog. Mutually exclusive with voice_asset_id and voice_ref_key.
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.
webhook_endpoint_id?|ID of the webhook endpoint notified when the job ends. It must belong to your account and be enabled.
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.
uuidRequest 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"