Audio modelsAPI referenceCreate speech

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

API Key: X-API-Key: <API Key> or Authorization: Bearer <API Key>.

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": {}}

Header Parameters

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.

Request Body

application/json
  1. body
emo_alpha?Emo Alpha

Overall strength of the eight-dimensional emotion vector, from 0 to 1. Keep the default of 1 when using emotion reference audio. indextts-2 only.

Range0 <= value <= 1
Default1
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.

model?Model

Model 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.

Default"indextts-2"
Value in"indextts-2""indextts-2.5"
language?Language

Language. 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.

Value in"ZH""EN""JA"
speed?Speed

Speaking-rate multiplier from 0.5 to 2, default 1. Available only with model indextts-2.5.

Range0.5 <= value <= 2
Default1
emo_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*Text

Text 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.

Length1 <= length <= 2048
voice_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?string

Emotion 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.

Formatuuid

Response Body

Request succeeded

application/json
  1. response
estimate_detail*
id*Id
reserved_credits*Reserved Credits
status*JobStatus
Value in"queued""processing""succeeded""failed""cancelled"
type*JobType
Value in"tts""avatar""video""video_analysis""image""voice_design""audio_composition"

On this page