Make your first TTS API request
Create an API key
Create an Inworld account.In Inworld Portal, generate an API key by going to Settings > API Keys. Copy the Base64 credentials.
Set your API key as an environment variable.

Prepare your first request
This is the simplest way to try Inworld TTS and works well for many applications — batch audio generation, pre-rendered content, and anywhere latency isn’t critical. If your application requires real-time, low-latency audio delivery, see the streaming example in the next step.For Python or JavaScript, create a new file called For Python, you may also have to install
inworld_quickstart.py or inworld_quickstart.js. Copy the corresponding code into the file. For a curl request, copy the request.requests if not already installed.Stream your audio output
Now that you’ve made your first TTS API request, you can try streaming responses as well. Assuming you’ve already followed the instructions above to set up your API key:Prepare your streaming request
First, create a new file called
inworld_stream_quickstart.py for Python or inworld_stream_quickstart.js for JavaScript. Next, set your INWORLD_API_KEY as an environment variable. Finally, copy the following code into the file.For this streaming example, we’ll use Linear PCM format (instead of MP3), which we specify in the audio_config. We also include a Connection: keep-alive header to reuse the TCP+TLS connection across requests.The first request to the API may be slower due to the initial TCP and TLS handshake. Subsequent requests on the same connection will be faster. Use
Connection: keep-alive (and a persistent session in Python) to take advantage of connection reuse. See the low-latency examples in our API examples repo for more advanced techniques.