Node.js SDK
Text to Speech
Generate complete audio buffers with client.tts.create()
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Generate complete audio buffers with client.tts.create()
client.tts.create(request)import UpliftAI from '@upliftai/sdk-js';
import { writeFileSync } from 'fs';
const client = new UpliftAI({
apiKey: 'your-api-key',
});
const { audio, metadata } = await client.tts.create({
text: 'السلام علیکم، یہ ایک ٹیسٹ ہے',
voiceId: 'v_meklc281',
outputFormat: 'MP3_22050_128',
});
writeFileSync('output.mp3', audio);
console.log('Metadata:', metadata);
console.log(`Audio size: ${audio.length} bytes`);
| Parameter | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Text to synthesize (Urdu, English, or mixed) |
voiceId | string | Yes | Voice profile ID (e.g. v_meklc281) |
outputFormat | string | No | Audio format — defaults to WAV_22050_32 |
phraseReplacementConfigId | string | No | ID from phrase replacements |
| Field | Type | Description |
|---|---|---|
audio | Buffer | Complete audio data |
metadata.requestId | string | Request ID for debugging |
metadata.contentType | string | MIME type of the audio |
metadata.sampleRate | number | Audio sample rate |
