Prerequisites
- An LMNT account
- An API key
Call the API
- Set your API key
Get your API key from the Playground and set it as an environment variable:
export LMNT_API_KEY=your-api-keyTo persist the key across shell sessions, add the line to your shell profile (such as
~/.zshrcor~/.bashrc). - Write your code
Save this as
quickstart.sh:curl --request POST \ --url https://api.lmnt.com/v1/ai/speech/bytes \ --header "X-API-Key: $LMNT_API_KEY" \ --header 'Content-Type: application/json' \ --data '{ "text": "The lazy yellow dog was caught by the slow red fox as he lay sleeping in the sun.", "voice": "leah" }' \ --output story.mp3 - Run your code
bash quickstart.shExample outputwrote ~32 KB to story.mp3
Next steps
You've made your first API call. Next, learn the Speech API patterns you'll use in every LMNT integration.
Working with the Speech API
Learn how to get word timestamps if you want them, generating conversational speech, and other core patterns.
Once you're comfortable with the basics, explore further: