@luel/speech
v0.1.2
Published
Official TypeScript SDK for the Luel Speech API.
Readme
@luel/speech
Official TypeScript SDK for the Luel Speech API. ESM, Node 20+, server-side
(https://api.luel.ai). Mint a key with the Synthesize speech scope.
npm install @luel/speechimport { writeFile } from 'node:fs/promises'
import { Luel } from '@luel/speech'
const luel = new Luel({ apiKey: process.env.LUEL_API_KEY! })
const audio = await luel.speech.convert({
voice: 'bo-female',
text: 'བཀྲ་ཤིས་བདེ་ལེགས།',
})
await writeFile('speech.mp3', audio)bo-female is Dolma (Ü-Tsang Tibetan). Eight identities are live — Tenzin,
Pema, Jigme, Cleopatra, Mana, Salma, and Anir included. Audio is MP3
(mp3_44100_128). Pass outputFormat: 'pcm_48000' for the native
Tibetan/Dzongkha stream (pcm_24000 for Darija and Masri). voices() returns
live voices — see Voices.
const voices = await luel.speech.voices()
const stream = await luel.speech.stream({
voice: 'bo-female',
text: 'བཀྲ་ཤིས་བདེ་ལེགས།',
})
await writeFile('speech.mp3', Buffer.from(await stream.arrayBuffer()))Failures throw SpeechError with status and code. A missing key is 401
(unauthorized). While synthesis is off, convert/stream are 503
(speech_synthesis_disabled). A 402 is an empty balance or a key cap. A 429
includes retryAfterSeconds.
