Getting Started - Uplift AI API Docs
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
| Option | Type | Default | Description |
|---|---|---|---|
apiKey |
string |
UPLIFTAI_API_KEY env |
Your API key |
baseUrl |
string |
https://api.upliftai.org |
API base URL |
timeout |
number |
30000 |
Request timeout (ms) |
maxRetries |
number |
2 |
Auto-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](https://docs.upliftai.org/sdk/nodejs/text-to-speech)
[**Stream TTS**
HTTP streaming for low-latency playback](https://docs.upliftai.org/sdk/nodejs/text-to-speech-stream)
[**Async TTS**
Background jobs with pre-signed URLs](https://docs.upliftai.org/sdk/nodejs/text-to-speech-async)
[**WebSocket TTS**
Real-time multiplexed streaming](https://docs.upliftai.org/sdk/nodejs/websocket-tts)
[**Speech to Text**
Transcribe audio files](https://docs.upliftai.org/sdk/nodejs/speech-to-text)
[**Phrase Replacements**
Control pronunciation of specific words](https://docs.upliftai.org/sdk/nodejs/phrase-replacements)
Output Formats
| Format | Identifier | Use Case |
|---|---|---|
| WAV | WAV_22050_32 · WAV_22050_16 |
Highest quality, larger files |
| MP3 | MP3_22050_128 · MP3_22050_64 · MP3_22050_32 |
Compressed, good for web |
| PCM | PCM_22050_16 |
Raw audio, WebSocket default |
| ULAW | ULAW_8000_8 |
Telephony (Twilio, SIP, PSTN) |