How to transcribe audio with an API
Turn recordings into text with a speech-to-text model.
Upload the audio
Send the audio file to the transcriptions endpoint and read the text from the response.
Example
from openai import OpenAI
client = OpenAI(api_key="YOUR_TOKENREX_KEY", base_url="https://tokenrex.ai/api/public")
with open("meeting.mp3", "rb") as f:
t = client.audio.transcriptions.create(model="gpt-transcribe", file=f)
print(t.text)Questions
- Do I need a separate key for each provider?
- No. One TokenRex API key works for every enabled model; change only the model ID.
Related
- How to use the OpenAI SDK with a custom base URL
- How to call Claude with the OpenAI SDK
- How to call Gemini with the OpenAI SDK
- How to use the Anthropic Messages API on TokenRex
- How to stream LLM responses
- How to use function calling (tools) with an LLM API
- How to send images to a vision model
- How to generate images with an API