Skip to navigation

Generate speech

View as Markdown

Converts complete text to WAV or raw PCM audio. Set stream: true for progressive delivery.

The JSON body must fit within 64 KiB. Unknown fields, explicit null values, and incorrect field types return 400. Omit optional fields to use their defaults.

Authentication

AuthorizationBearer
A Nari API key created in the Dashboard.

Request

This endpoint expects an object.
modelenumRequired
Select Standard or Fast.
Allowed values:
inputstringRequired>=1 character

Complete text. Surrounding whitespace is removed before validation, synthesis and usage measurement. The trimmed text must contain 1–2,048 Unicode code points; otherwise the request returns 400 INVALID_SPEECH_REQUEST. Split longer text at sentence boundaries.

Use normal capitalization and punctuation; all-lowercase or unpunctuated text can severely degrade speech quality.

voicestringRequired

Case-sensitive voice ID from List voices for the same model. The selected voice determines the language.

languagestringOptional>=1 characterDefaults to auto

Use auto or omit to use the voice’s language. An explicit code, such as en or es, must match the selected voice’s language. This does not translate the input.

seedintegerOptional0-4294967295Defaults to 0

Send a different seed to request another variation. The seed used is returned in x-nari-seed.

streambooleanOptionalDefaults to false

false returns audio after generation finishes; true sends audio as it is generated. Send the complete text in one request in either mode.

response_formatenumOptionalDefaults to wav

wav includes a WAV header; pcm returns raw audio samples. Both formats support streaming.

Allowed values:

Response headers

x-nari-seedinteger
Seed used for synthesis.
x-request-idstringOptional
Always returned. Request identifier for logs and support.

Response

Binary audio containing 24 kHz, signed 16-bit little-endian, mono samples. The content type is audio/wav for WAV or audio/pcm for raw PCM.

See Streaming audio for playback and interrupted-stream handling.

Errors

400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
404
Not Found Error
413
Content Too Large Error
429
Too Many Requests Error
500
Internal Server Error
503
Service Unavailable Error