Skip to main content
Audio transcription turns speech (audio files) into text. The gateway supports two ways to call it:
ApproachUse forBase path
Unified API (OpenAI-compatible)OpenAI, Azure OpenAI, Groqhttps://{controlPlaneUrl}/api/llm
Provider proxy (native SDK)Deepgram, Cartesia, ElevenLabshttps://{controlPlaneUrl}/stt/{providerAccountName}
Before you start: Replace {controlPlaneUrl} with your gateway URL and your-tfy-api-key with your TrueFoundry API key. For the provider proxy, replace {providerAccountName} with the display name of your provider account on TrueFoundry.
Model names: For audio (STT/TTS), the model ID in code must match the display name of the model on your TrueFoundry provider account.
Which SDK to use: For OpenAI, Azure OpenAI, and Groq, use the OpenAI SDK (same API). For Deepgram, Cartesia, and ElevenLabs, use each provider’s native SDK with the gateway URL above.

Code snippets

from openai import OpenAI

BASE_URL = "https://{controlPlaneUrl}/api/llm"
API_KEY = "your-tfy-api-key"

client = OpenAI(
    api_key=API_KEY,
    base_url=BASE_URL,
)

with open("/path/to/audio.mp3", "rb") as audio_file:
    response = client.audio.transcriptions.create(
        model="openai-main/whisper-1",  # truefoundry model name
        file=audio_file,
    )

print(response)

Response

The shape of the response depends on the provider. Use print(response) to inspect it, or refer to each provider’s SDK docs for the exact structure.