Skip to main content
Transcribe short audio clips (mp3 or wav) via the /v1/audio/transcriptions endpoint.
import openai
import pathlib

client = openai.OpenAI(
    base_url="https://api.llm7.io/v1",
    api_key="none",  # or your token
)


def transcribe(audio_path: str):
    """Return plain-text transcription of a local audio file."""
    with pathlib.Path(audio_path).open("rb") as fp:
        response = client.audio.transcriptions.create(
            model="gpt-4o-mini-audio-preview",
            file=fp,
            language="en",
            response_format="json",
            temperature=0,
        )
    return response


if __name__ == "__main__":
    print(transcribe("1.mp3"))
Expected response structure:
Transcription(text="Transcription here...", logprobs=None)
Supported formats: .mp3 and .wav. Set language (defaults to "en") to improve accuracy for multilingual audio.