Generate audio speech from text.This endpoint converts text to speech using the Morpheus Network providers. It automatically manages sessions and routes requests to the appropriate TTS model.Returns binary audio data in the specified format.
Swagger UI may not be able to play the audio directly. To test, click “Download” and play the file in your media player, or use curl to save the audio file.
The endpoint returns binary audio data in the requested format. The content type will match the response_format parameter (e.g., audio/mpeg for mp3, audio/wav for wav).
import openaiclient = openai.OpenAI( api_key="sk-xxxxxx", base_url="https://api.mor.org/api/v1")response = client.audio.speech.create( model="tts-model", input="Hello, this is a test of the text-to-speech system.", voice="af_alloy", response_format="mp3")# Save the audio filewith open("output.mp3", "wb") as f: f.write(response.content)