Generate speech
POST https://api.narilabs.com/v1/audio/speech converts complete text into speech. Set stream: true for progressive audio delivery, or omit it to receive the complete response.
Prepare your text
Use normal capitalization and punctuation. All-lowercase text or text without punctuation can severely degrade speech quality.
Capitalize sentence starts and proper nouns, and include commas and sentence-ending punctuation where appropriate. The server does not automatically restore capitalization or missing punctuation. This is a speech-quality guideline, not an additional input validation requirement.
Make a request
With your API key in NARI_API_KEY, run:
The API reference defines field types, validation, and all error responses.
Read the response
A successful request returns HTTP 200 with binary audio, rather than JSON or an audio URL. The example saves it to speech.wav, ready to open in an audio player.
Both formats contain 24 kHz, signed PCM16 little-endian, mono audio. WAV includes a container header; PCM requires you to configure the playback format. Streaming audio covers playback and progressive delivery.
Errors detected before response headers are sent return a non-2xx status with a JSON body. Check the status before treating the body as audio; Errors and troubleshooting explains error codes and how to inspect them with cURL.
Input limits
Whitespace-only text is rejected. Body size is checked before trimming. Text validation failures return 400; oversized bodies return 413. Split longer text into separate requests at sentence boundaries.
Usage and access
Both Free and Partner models measure TTS usage by input characters. x-usage-input-characters reports the count for this request; Usage and billing defines how characters are counted. The daily Free allowance is separate from this measurement.
Successful Partner requests debit credits. Failed and cancelled requests do not debit credits. Partner models require early access and available credits. Usage and billing explains pricing and credit handling.
Rate limits
Free speech endpoints have endpoint-specific concurrent session and daily request limits. Free tier and rate limits lists the current limits, response headers, and retry behavior for each 429 error.