Speech to text
Speech-capable models can transcribe audio to text. Replace YOUR_SPEECH_MODEL_ID with a model ID that the current catalog marks as supporting audio transcription:
from openai import OpenAI client = OpenAI( base_url="https://api.livrouter.com/v1") with open("audio.mp3", "rb") as audio_file: transcription = client.audio.transcriptions.create( model="YOUR_SPEECH_MODEL_ID", file=audio_file ) print(transcription.text)