Skip to main content
Requires Node.js 18+. Install from npm.

Installation

npm install @upliftai/sdk-js

Configuration

import UpliftAI from '@upliftai/sdk-js';

const client = new UpliftAI({
  apiKey: 'your-api-key',
});
Or use an environment variable:
export UPLIFTAI_API_KEY=sk_...
const client = new UpliftAI(); // picks up from env

Client Options

OptionTypeDefaultDescription
apiKeystringUPLIFTAI_API_KEY envYour API key
baseUrlstringhttps://api.upliftai.orgAPI base URL
timeoutnumber30000Request timeout (ms)
maxRetriesnumber2Auto-retries on 429/5xx errors

Quick Example

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(`Audio size: ${audio.length} bytes`);

Available Methods

Text to Speech

Generate complete audio buffers

Stream TTS

HTTP streaming for low-latency playback

Async TTS

Background jobs with pre-signed URLs

WebSocket TTS

Real-time multiplexed streaming

Speech to Text

Transcribe audio files

Phrase Replacements

Control pronunciation of specific words

Output Formats

FormatIdentifierUse Case
WAVWAV_22050_32 · WAV_22050_16Highest quality, larger files
MP3MP3_22050_128 · MP3_22050_64 · MP3_22050_32Compressed, good for web
PCMPCM_22050_16Raw audio, WebSocket default
ULAWULAW_8000_8Telephony (Twilio, SIP, PSTN)