SDK
Text to speech
Provider patches
OpenAI patch
ElevenLabs patch
Patch parameters
Migration and troubleshooting

OpenAI patch

1. Install and configure

Install the openai extra, then set both TEENAGEWORKS_API_KEY and OPENAI_API_KEY. The OpenAI key remains necessary for calls that are not rerouted.

Linux / Mac / Windows

python -m pip install "teenageworks[openai]"

2. Patch before creating the client

Python

from teenageworks import patch_openai

patch_openai()

3. Keep the existing OpenAI call

Python

from openai import OpenAI

client = OpenAI()
speech = client.audio.speech.create(
    model="gpt-4o-mini-tts",
    voice="alloy",
    input="This speech call is routed to Teen V1.",
    response_format="mp3",
)

Use a TeenageWorks voice ID directly, or pass reference_audio and reference_audio_format to clone a voice. For a clone, the provider voice ID is ignored. OpenAI instructions is not applied and emits a warning if supplied.

Routed model IDs

  • teen-v1
  • tts-1
  • tts-1-hd
  • gpt-4o-mini-tts
  • gpt-4o-mini-tts-2025-12-15

Unknown speech models pass through to OpenAI. Non-speech resources are never rerouted.

The patch covers tested synchronous and asynchronous clients, module-level speech access, raw responses, and streaming-response wrappers.

Review translated parameters