← All posts
SDKs & API · · 5 min read

Introducing the LeanVox Node.js SDK: Text-to-Speech for TypeScript Developers

The official LeanVox Node.js/TypeScript SDK is here. Full type safety, zero runtime dependencies, streaming, voice cloning, and multi-speaker dialogue — npm install leanvox.

Two SDKs in one day. The LeanVox Node.js/TypeScript SDK is live.

bash
npm install leanvox
typescript
import { Leanvox } from 'leanvox';

const client = new Leanvox();
const result = await client.generate({ text: 'Hello from Node!' });
console.log(result.audioUrl);

Three lines. Full TypeScript types. Zero runtime dependencies.

#Why a Node.js SDK?

Our Python SDK launched this morning and the response was clear: developers want first-class support in their stack. Node.js and TypeScript power a huge chunk of modern web apps, APIs, and serverless functions. If you're building with Next.js, Express, Fastify, or Deno — this is for you.

#What You Get

Generate speech

typescript
const result = await client.generate({
  text: 'Welcome to the future of voice.',
  model: 'pro',
  voice: 'af_heart',
  speed: 1.1,
});
console.log(result.audioUrl); // CDN URL, ready to use

Stream audio in real-time

typescript
const stream = await client.stream({ text: 'This streams in real-time...' });
for await (const chunk of stream) {
  // Process audio chunks as they arrive
  process.stdout.write(chunk);
}

Multi-speaker dialogue

typescript
const episode = await client.dialogue({
  model: 'pro',
  lines: [
    { text: 'Welcome to the show!', voice: 'podcast_conversational_female' },
    { text: 'Great to be here.', voice: 'podcast_casual_male' },
  ],
  gapMs: 400,
});

Voice cloning

typescript
import { readFileSync } from 'fs';

const voice = await client.voices.clone({
  name: 'My Voice',
  audio: readFileSync('sample.wav'),
});
await client.voices.unlock(voice.voiceId);

const result = await client.generate({
  text: 'This is my cloned voice!',
  voice: voice.voiceId,
});

Voice design from prompt

typescript
const narrator = await client.voices.design({
  name: 'Epic Narrator',
  prompt: 'Deep, warm male voice with gravitas',
});

#Built for TypeScript

This isn't a JavaScript SDK with types bolted on. It's TypeScript-first:

  • Full type inference — every response is typed, IDE autocompletion everywhere
  • ESM + CJS — works in any Node.js project, bundler, or serverless runtime
  • Zero runtime dependencies — uses native fetch (Node 18+)
  • Async/await — no callbacks, no promises chains
  • Streaming via async iteratorsfor await just works
  • Auto-retry — exponential backoff on 5xx, respects rate limits

#Both SDKs, One Package Name

We kept it simple:

LanguageInstallPackage
Pythonpip install leanvoxPyPI
Node.js/TSnpm install leanvoxnpm

Same package name, same API design philosophy, same 3-line quickstart.

#Get Started

bash
npm install leanvox
typescript
import { Leanvox } from 'leanvox';

const client = new Leanvox();
const result = await client.generate({ text: "Let's build something amazing." });
console.log(result.audioUrl);

Three lines. Now go build something that talks.

GitHub · npm · Get your API key

Developer path

Ship your first voice request from code

Use the API docs and SDK examples to generate audio, stream speech, and manage voices with production-ready endpoints.

Related reading