Skip to main content
Send a sentence to the REST endpoint and save the spoken audio as a WAV file. The examples use Timbre v3.0 and the voice Shivani, which speaks all ten supported languages.
1

Create an API key

Sign in to the Gnani API dashboard and generate an API key.
2

Set your key

The examples read your key from the GNANI_API_KEY environment variable, so it never appears in your code. Set it in the terminal you will run the examples from:
If you use a .env file, load it with a library such as python-dotenv or dotenv, and keep the file out of version control.
3

Install

cURL is preinstalled on macOS, Linux and Windows 10 or later.
4

Run

Run the Python examples with python quickstart.py and the Node.js example with node quickstart.mjs.
The Python SDK example uses Timbre v2.5 and the voice Nalini, the model the SDK documents. Timbre v2.5 voices work only with "model": "timbre-v2.5".
5

Check the output

A successful request returns 200 with Content-Type: audio/wav, and the audio is saved as speech.wav. Play it: you should hear “नमस्ते, आप कैसे हैं?” (“Hello, how are you?”) in Hindi.

If it didn’t work

Text-to-Speech errors return a JSON body with a message that says what is wrong, instead of audio. If speech.wav will not play, open it in a text editor: an error body saved by cURL looks like JSON. Every error is listed in the Error Reference.

Choose an interface for your app

The quickstart used REST. Answer two questions to see which interface fits your app: REST returns the whole file, Streaming (SSE) starts playback early, and Realtime (WebSocket) has the lowest latency for live conversations.

Next

Available Voices

The voices for Timbre v3.0 and Timbre v2.5.

Audio tags

Add laughter, whispers and pauses with Timbre v3.0.

Streaming

Start playback before the whole sentence is generated.
Last modified on December 2, 2026