
Use a patch only when an application already calls OpenAI or ElevenLabs for text to speech. New applications should use the native SDK.
Linux / Mac / Windows
python -m pip install "teenageworks[openai]"Linux / Mac / Windows
python -m pip install "teenageworks[elevenlabs]"Set TEENAGEWORKS_API_KEY for rerouted speech. Keep the original provider key configured for calls that pass through.
Python
from teenageworks import patch_elevenlabs, patch_openai
openai_patch = patch_openai()
elevenlabs_patch = patch_elevenlabs()Apply only the patch or patches used by your application. Importing teenageworks alone changes nothing.
Recognized TTS calls now route through Teen V1. Unknown TTS models and every non-TTS resource continue to the original provider.
| Provider call | Routed to TeenageWorks when |
|---|---|
OpenAI audio.speech.create() | The model is a recognized TTS ID |
| ElevenLabs text-to-speech | The model is teen-v1, starts with eleven_, or uses the provider default |
Python
assert openai_patch.is_active
openai_patch.unpatch()Equivalent patch calls reuse the active handle. Conflicting configuration raises PatchConflictError. Do not unpatch while requests are in flight.
Patching replaces supported Python methods inside the current process. It does not create a proxy, background thread, DNS change, or system-wide network rule.
On this page