npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

leanvox

v0.5.0

Published

Official Node.js/TypeScript SDK for the Leanvox TTS API

Readme

Leanvox Node.js/TypeScript SDK

Official Node.js/TypeScript SDK for the Leanvox text-to-speech API.

Installation

npm install leanvox

Requires Node.js 18 or later.

Quick Start

import { Leanvox } from "leanvox";

const client = new Leanvox({ apiKey: "lv_live_..." });

const result = await client.generate({
  text: "Hello from Leanvox!",
  model: "standard",
  voice: "af_heart",
});

console.log(result.audioUrl);

// Download and save
await result.save("hello.mp3");

Authentication

API keys are resolved in this order:

  1. Constructor parameter: new Leanvox({ apiKey: "lv_live_..." })
  2. Environment variable: LEANVOX_API_KEY
  3. Config file: ~/.lvox/config.toml
# ~/.lvox/config.toml
api_key = "lv_live_..."

Streaming

Stream audio as it's generated (MP3 only):

import { createWriteStream } from "fs";

const stream = await client.stream({
  text: "Long narration text here...",
  model: "standard",
});

const writer = createWriteStream("output.mp3");
for await (const chunk of stream) {
  writer.write(chunk);
}
writer.end();

Max (Instruction-Based Voice)

const result = await client.generate({
  text: "Welcome to our podcast!",
  model: "max",
  voiceInstructions: "A warm, confident female narrator with a slight British accent",
});
console.log(result.generatedVoiceId); // Reuse for consistent voice

Dialogue

Generate multi-speaker dialogue:

const result = await client.dialogue({
  model: "pro",
  lines: [
    { text: "Welcome to the show!", voice: "narrator_warm_male", language: "en" },
    { text: "Thanks for having me.", voice: "assistant_pro_female", language: "en", exaggeration: 0.6 },
  ],
  gapMs: 500,
});

Async Generation

For long text that takes time to process:

const job = await client.generateAsync({
  text: "Very long text...",
  model: "standard",
  webhookUrl: "https://yourapp.com/webhook",
});

// Poll for completion
const result = await client.getJob(job.id);

Text longer than autoAsyncThreshold (default 5000 chars) is automatically routed to async when calling generate().

Voice Management

// List voices
const voices = await client.voices.list("pro");
console.log(voices.proVoices);

// Curated voices
const curated = await client.voices.listCurated();

// Clone a voice
const voice = await client.voices.clone({
  name: "My Voice",
  audio: fs.readFileSync("reference.wav"),
  description: "My custom voice",
});

// Unlock cloned voice ($3.00)
await client.voices.unlock(voice.voiceId);

// Design a voice ($1.00)
const design = await client.voices.design({
  name: "Deep Narrator",
  prompt: "A deep, warm male voice with a gentle storytelling tone",
});

// Delete a voice
await client.voices.delete(voice.voiceId);

Generation History

const gens = await client.generations.list({ limit: 20, offset: 0 });
const audio = await client.generations.getAudio("generation_id");
await client.generations.delete("generation_id");

Account & Billing

const balance = await client.account.balance();
console.log(`Balance: ${balance.balanceCents} cents`);

const usage = await client.account.usage({ days: 30 });
const checkout = await client.account.buyCredits(2000);

File Processing

Extract text from files (.txt, .epub):

const result = await client.files.extractText(
  fs.readFileSync("book.epub"),
  "book.epub",
);
console.log(result.charCount, result.truncated);

Error Handling

import {
  LeanvoxError,
  InvalidRequestError,
  AuthenticationError,
  InsufficientBalanceError,
  RateLimitError,
  StreamingFormatError,
} from "leanvox";

try {
  const result = await client.generate({ text: "Hello" });
} catch (e) {
  if (e instanceof InsufficientBalanceError) {
    console.log(`Need more credits: balance=${e.balanceCents}`);
  } else if (e instanceof RateLimitError) {
    console.log(`Rate limited, retry after: ${e.retryAfter}`);
  } else if (e instanceof LeanvoxError) {
    console.log(`API error: ${e.code} - ${e.message}`);
  }
}

Configuration

const client = new Leanvox({
  apiKey: "lv_live_...",
  baseUrl: "https://api.leanvox.com", // default
  timeout: 30,                         // seconds, default 30
  maxRetries: 2,                       // default 2 (exponential backoff: 1s, 2s, 4s)
  autoAsyncThreshold: 5000,            // chars, default 5000
});

License

MIT