First steps

Get started with LMNT

Make your first API call to LMNT and build a simple storyteller.

Prerequisites

Call the API

  1. Set your API key

    Get your API key from the Playground and set it as an environment variable:

    export LMNT_API_KEY=your-api-key

    To persist the key across shell sessions, add the line to your shell profile (such as ~/.zshrc or ~/.bashrc).

  2. Install the SDK
    pip install lmnt
  3. Write your code

    Save this as quickstart.py:

    from lmnt import Lmnt
     
    client = Lmnt()
     
    text = (
      'The lazy yellow dog was caught by the slow red fox '
      'as he lay sleeping in the sun.'
    )
     
    with client.speech.with_streaming_response.generate(
      text=text,
      voice='leah',
    ) as response:
      response.stream_to_file('story.mp3')
  4. Run your code
    python quickstart.py
    Example output
    wrote ~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: