Text to speech
Some models can convert text to speech. Replace YOUR_TTS_MODEL_ID with a model ID that the current catalog marks as supporting audio generation:
from openai import OpenAIfrom pathlib import Path client = OpenAI( base_url="https://api.livrouter.com/v1") speech_file_path = Path(__file__).parent / "speech.mp3" with client.audio.speech.with_streaming_response.create( model="YOUR_TTS_MODEL_ID", voice="Cherry", input="The quick brown fox jumped over the lazy dog.") as response: response.stream_to_file(speech_file_path)