Documentation Index
Fetch the complete documentation index at: https://docs.prem.io/llms.txt
Use this file to discover all available pages before exploring further.
Basic Audio Translation
Translate audio from any language to English:
import createRvencClient from "@premai/api-sdk";
import fs from "fs";
const client = await createRvencClient({
apiKey: process.env.API_KEY,
clientKEK: process.env.CLIENT_KEK
});
const audioFile = fs.createReadStream("./audio-spanish.mp3");
const translation = await client.audio.translations.create({
file: audioFile,
model: "openai/whisper-large-v3",
});
console.log(translation.text);
Translation with Context Prompt
Provide context to improve translation quality:
const translation = await client.audio.translations.create({
file: audioFile,
model: "openai/whisper-large-v3",
prompt: "This is a business meeting discussing quarterly results and future plans.",
});
console.log(translation.text);
Translation with Detailed Response
Get detailed translation information:
const translation = await client.audio.translations.create({
file: audioFile,
model: "openai/whisper-large-v3",
response_format: "verbose_json",
});
console.log({
text: translation.text,
language: translation.language,
duration: translation.duration,
});