POST /v1/audio/translations
Translate an audio file into English.
- Method: POST
- Path:
/v1/audio/translations
- Auth: Bearer token in
Authorization
header - Content-Type:
multipart/form-data
Request parameters
model
(string, required): Translation model ID (e.g.,whisper-large-v3
).file
(binary, required): The audio file to translate.prompt
(string, optional): Optional prompt to guide the translation.language
(string, optional): Source language hint (if known).
Example requests
- Python
- Node.js
- cURL
from openai import OpenAI
client = OpenAI(base_url="https://api.naga.ac/v1", api_key="YOUR_API_KEY")
with open("german.mp3", "rb") as f:
translation = client.audio.translations.create(
model="whisper-large-v3",
file=f,
# prompt="Translate clearly with punctuation."
)
print(translation.text)
import OpenAI from "openai";
import fs from "fs";
const client = new OpenAI({ baseURL: "https://api.naga.ac/v1", apiKey: "YOUR_API_KEY" });
const translation = await client.audio.translations.create({
model: "whisper-large-v3",
file: fs.createReadStream("german.mp3"),
// prompt: "Translate clearly with punctuation."
});
console.log(translation.text);
curl https://api.naga.ac/v1/audio/translations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: multipart/form-data" \
-F file="@german.mp3" \
-F model="whisper-large-v3"
Response
Returns a JSON object with the translated text, e.g.:
{ "text": "Hello and welcome to NagaAI!" }