Skip to main content
POST

Authorizations

Authorization
string
header
required

Modellix API Key. Format: Bearer <your_api_key>

Body

application/json

Gemini 3.1 Flash TTS request. Always pass voice through speakers (1-2 items), even for single-speaker synthesis. When prompt is set, style and script are combined as "{prompt}: {text}". Byte limits apply to UTF-8 length (multibyte characters count toward the limit).

text
string
required

Script to be spoken. Required. Max 8,000 bytes when used alone; if prompt is set, combined "{prompt}: {text}" must not exceed 8,000 bytes. When prompt is set, put only the spoken script here (do not repeat style instructions such as "Say cheerfully:" in text). May include inline audio tags such as [whispers], [slow], [fast], [laughs], and [short pause] to steer delivery.

Required string length: 1 - 8000
Example:

"Hello, welcome to Modellix!"

speakers
object[]
required

Speaker configuration. Required. Length 1 (single voice) or 2 (dialogue). Voice is always set here; there is no top-level voice field.

Required array length: 1 - 2 elements
prompt
string

Optional director or style instruction (tone, pace, emotion, scene). Max 4,000 bytes. Merged with text as "{prompt}: {text}". Combined prompt + ": " + text must not exceed 8,000 bytes. If you omit prompt, you may embed direction in text using Google's single-field pattern (e.g. "Say cheerfully: ...") or audio tags.

Maximum string length: 4000
Example:

"Friendly and warm tone"

language_code
string

Optional BCP-47 language and accent code. Examples: en-us, en-in, cmn-cn, ja-jp, ko-kr, fr-fr.

Pattern: ^[a-z]{2,3}(-[a-z0-9]+)*$
Example:

"en-us"

Response

Task submitted successfully. Poll GET /api/v1/tasks/{task_id} until the task completes; synthesized audio is returned on the task result.

code
integer
required

Response code, 0 indicates success

Example:

0

message
string
required

Response message

Example:

"success"

data
object
required

Task submission details. Poll GET /api/v1/tasks/{task_id} until status is success; audio appears in result.resources with type audio and format wav.