Translations

Create translation

Some speech-capable models can translate spoken audio into English. Replace YOUR_SPEECH_MODEL_ID with a model ID that the current catalog marks as supporting audio translation:

python
from openai import OpenAI client = OpenAI(    base_url="https://api.livrouter.com/v1") with open("audio.mp3", "rb") as audio_file:    transcription = client.audio.translations.create(        model="YOUR_SPEECH_MODEL_ID",        file=audio_file    ) print(transcription.text)