Overview
TeenageWorks SDK
Quickstart
Configuration

Quickstart

Complete these steps in order.

1. Install the SDK

Install the teenageworks package from PyPI.

Linux / Mac / Windows

python -m pip install teenageworks

2. Set your API key

Use the project key from TeenageWorks. Choose your operating system.

export TEENAGEWORKS_API_KEY="tw_live_..."

TW_API_KEY is a shorter alias for the same setting.

3. Initialize the SDK

Python

from teenageworks import TeenageWorks

client = TeenageWorks()

4. Generate speech

Python

speech = client.audio.speech.create(
    model="teen-v1",
    voice="default",
    input="Welcome to Teen V1.",
    response_format="mp3",
)
speech.write_to_file("welcome.mp3")

The new welcome.mp3 file contains the generated audio.

Note

The SDK manages the request language internally. Multilingual input is still supported.

Configure the client