from pathlib import Path
from openai import OpenAI
client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.mixroute.ai/v1")
with client.audio.speech.with_streaming_response.create(
model="gpt-4o-mini-tts",
voice="alloy",
input="Welcome to MixRoute.",
response_format="wav",
) as response:
response.stream_to_file(Path("speech.wav"))