The speech-to-text endpoint transcribes audio into text, with Arabic (including Algerian Darija), French, and English as first-class languages.
OpenDunes takes the audio inline as base64 JSON, not a multipart upload, so call the endpoint directly with net/http.
package main
import (
"bytes"
"encoding/base64"
"encoding/json"
"fmt"
"net/http"
"os"
)
func main() {
raw, _ := os.ReadFile("recording.mp3")
data := base64.StdEncoding.EncodeToString(raw)
body, _ := json.Marshal(map[string]any{
"model": "example-provider/stt-model",
"input_audio": map[string]string{
"data": data,
"format": "mp3",
},
"language": "ar",
})
req, _ := http.NewRequest("POST", "https://opendunes.com/api/v1/audio/transcriptions", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("OPENDUNES_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var result struct {
Text string `json:"text"`
}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result.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 (ar, fr, en) — optional |
temperature | 0–1; lower is more deterministic — optional |
STT is billed per second of audio in DA, rounded up. See the STT API reference.