Transcribe audio to text using OpenDunes speech recognition models.
The speech-to-text endpoint transcribes audio to text, with Arabic (including Algerian Darija), French, and English as first-class languages.
OpenDunes takes the audio inline as base64 JSON, not a multipart file upload, so call the endpoint directly with fetch rather than the OpenAI SDK's audio.transcriptions helper.
import { readFileSync } from "fs";
const data = readFileSync("./recording.mp3").toString("base64");
const res = await fetch("https://opendunes.com/v1/audio/transcriptions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.OPENDUNES_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "example-provider/stt-model",
input_audio: { data, format: "mp3" },
language: "ar", // optional — improves accuracy
}),
});
const { text } = await res.json();
console.log(text);| Field | Description |
|---|---|
model | STT model slug (?modality=transcription). |
input_audio.data | Base64-encoded audio bytes. |
input_audio.format | One of wav, mp3, flac, m4a, ogg, webm, aac. |
language | BCP-47 language hint, e.g. "ar", "fr", "en". Optional. |
temperature | 0–1; lower is more deterministic. Optional. |
Transcription is billed per second of audio in DA, rounded up. See the STT API reference.