API Key

Create an API Key before getting started.

API keys authorize your applications to make API calls on behalf of your account.

Keep that tab open so you can copy/paste it into your code in a minute.

Project Setup

Setup a directory for our quickstart project.

If you have experience using python virtual environments we recommend using one, otherwise you can ignore those steps.

  • Create a directory for your project called mythicinfinity-quickstart
  • (optional) Setup a virtual environment using virtualenv venv
  • (optional) Activate your virtual environment ./venv/bin/activate

Install

Install our python client using pip:

pip install mythicinfinity

Generate Speech

Create main.py

Create a file called main.py with the following content:

  from mythicinfinity import MythicInfinityClient

def main():
    # Instantiate the client with your api key
    client = MythicInfinityClient(api_key="YOUR_API_KEY")
    
    # Call the TTS API. By default, stream is False.
    audio_bytes = client.tts.generate(text="Hello world.")
    
    with open('my_audio.wav', 'wb') as f:
        f.write(audio_bytes)

if __name__ == "__main__":
    main()
  
  • Make sure you replace YOUR_API_KEY with the API key we created earlier.
Run main.py

Now run the python code using python main.py.

You will have a file named my_audio.wav

Going further

For further examples and details, see our python client documentation.