OpenAI transcription
Transcribe files through AllModels with the official OpenAI JavaScript or Python SDK.
Set the OpenAI client's base URL to https://api.allmodels.io/oai, then upload audio with audio.transcriptions.create().
Transcribe a file
https://api.allmodels.io/oai/audio/transcriptionsOpenAIimport { createReadStream } from "node:fs";
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.ALLMODELS_API_KEY,
baseURL: "https://api.allmodels.io/oai"
});
const transcript = await client.audio.transcriptions.create({
file: createReadStream("call.wav"),
model: "deepgram/nova-3",
language: "en",
response_format: "json"
});
console.log(transcript.text);Response formats
Use response_format to choose the transcription response.
const transcript = await client.audio.transcriptions.create({
file: createReadStream("meeting.wav"),
model: "openai/whisper-1",
response_format: "verbose_json",
timestamp_granularities: ["word", "segment"]
});For json, read transcript.text. A verbose_json response can also contain words, segments, language, and duration. Text, SRT, and VTT responses are strings, so write or print them directly.
Streaming transcription
Set stream: true to receive transcription events as they are produced. The selected model must support streaming or the API returns unsupported_streaming.
const stream = await client.audio.transcriptions.create({
file: createReadStream("meeting.wav"),
model: "openai/gpt-4o-mini-transcribe",
response_format: "json",
stream: true
});
for await (const event of stream) console.log(event);Check GET /v1/models to confirm that a model supports streaming. For live microphones or calls, use the realtime WebSocket guide.
Provider extensions
Use provider preferences and provider-specific options with the OpenAI SDK:
const transcript = await client.audio.transcriptions.create({
file: createReadStream("call.wav"),
model: "deepgram/nova-3",
response_format: "verbose_json",
provider: { only: ["deepgram"] },
provider_options: { smart_format: true, diarize: true }
});Additional fields include prompt, temperature, chunking_strategy, include, known_speaker_names, and known_speaker_references. Support varies by provider; see the API reference for details.
