Skip to main content

Text-to-Speech

const audioBuffer = await theo.tts({
  text: "Welcome to Theo. How can I help you today?",
  voice: "theo-voice-warm", // Optional — see table below
  speed: 1.0,               // Optional speed multiplier
});

// audioBuffer is an ArrayBuffer — write to file or stream to client
import { writeFileSync } from "fs";
writeFileSync("output.mp3", Buffer.from(audioBuffer));

Voices

VoiceCharacter
theo-voice-classicNeutral, versatile — default
theo-voice-brightBright, clear, upbeat
theo-voice-storytellerNarrative, expressive
theo-voice-deepDeep, authoritative
theo-voice-warmWarm, professional
theo-voice-softSoft, thoughtful
Omitting voice or passing an unknown value falls back to theo-voice-classic.

Speech-to-Text

const file = new Blob([audioBytes], { type: "audio/mp3" });
const result = await theo.stt(file, "en");

console.log(result.text);              // Transcribed text
console.log(result.language);          // Detected language
console.log(result.duration_seconds);  // Audio duration
console.log(result.usage.cost_cents);  // Cost