Quickstart
Complete these steps in order.
1. Install the SDK
Install the teenageworks package from PyPI.
python -m pip install teenageworks2. 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
from teenageworks import TeenageWorks
client = TeenageWorks()4. Generate speech
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.
