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

@lobehub/tts

v6.1.0

Published

A high-quality & reliable TTS React Hooks library

Readme

Text-to-speech and speech-to-text for server and browser, with React hooks and audio components.

Documents · Changelog · Report Bug · Request Feature

TOC

✨ Why Lobe TTS?

Lobe TTS (@lobehub/tts) lets you add natural-sounding speech output and voice input to your app, on the server or in the browser, in a few lines of TypeScript. It powers the voice features of 🤯 LobeHub.

  • Speak and listen — turn text into speech and speech into text with one library
  • Pick your voice provider — Microsoft Edge, Microsoft Speech, OpenAI or the browser's built-in speech, behind the same simple API
  • Server or browser — generate audio files in Node.js / Bun, or speak directly in the user's browser
  • React-ready — drop-in hooks and an audio player with progress, pause and download, so you don't build playback yourself
  • Smooth long-form playback — long text starts playing quickly instead of waiting for the whole audio
  • AI-native — skills.md and llms.txt let your coding agent use the real API instead of guessing

🚀 Getting Started

[!IMPORTANT]
This package is ESM only.

$ pnpm i @lobehub/tts

The React entry @lobehub/tts/react also needs the peer dependencies @lobehub/ui@^6, react@^19 and react-dom@^19.

Generate speech on the server

// index.js — run with `bun index.js`
import { EdgeSpeechTTS } from '@lobehub/tts';
import fs from 'node:fs';

const tts = new EdgeSpeechTTS({ locale: 'en-US' });

const response = await tts.create({
  input: 'This is a speech demonstration',
  options: { voice: 'en-US-GuyNeural' },
});

fs.writeFileSync('./speech.mp3', Buffer.from(await response.arrayBuffer()));

[!NOTE]
Edge Speech needs a global WebSocket. It is built into Bun and Node.js 22+; on older Node.js versions, set global.WebSocket from the ws package.

Play speech in React

import { AudioPlayer, useEdgeSpeech } from '@lobehub/tts/react';
import { Button, Flexbox } from '@lobehub/ui';

export default () => {
  const { isGlobalLoading, start, stop, audio } = useEdgeSpeech('Hello from Lobe TTS', {
    options: { voice: 'en-US-GuyNeural' },
  });

  return (
    <Flexbox gap={8}>
      <Button loading={isGlobalLoading} onClick={isGlobalLoading ? stop : start}>
        Speak
      </Button>
      <AudioPlayer audio={audio} isLoading={isGlobalLoading} onLoadingStop={stop} />
    </Flexbox>
  );
};

Using Next.js? Add transpilePackages: ['@lobehub/tts'] to next.config.js. For other providers, speech-to-text and more examples, see the documentation.

🤖 AI-Powered Development

Lobe TTS publishes agent-friendly docs, so your AI assistant can write code against the documented API.

| Resource | What it does | | ---------------- | --------------------------------------------------------------------------------------------------------------- | | Agent Skills | tts.lobehub.com/skills.md — skill entry point with setup, workflow and an index of the docs | | llms.txt | tts.lobehub.com/llms.txt — an llms.txt index of every docs page |

Paste this into Cursor, Claude Code, Codex or any agent that can fetch URLs:

Read https://tts.lobehub.com/skills.md, then use @lobehub/tts to add a "read aloud" button to my React app.

Works with Cursor, Claude Code, Windsurf, GitHub Copilot and other tools that read skills.md or llms.txt.

📦 Packages

| Entry | Use it for | | --------------------- | ------------------------------------------------------------- | | @lobehub/tts | Generate speech or transcribe audio, on the server or browser | | @lobehub/tts/server | Proxy OpenAI speech and transcription from your own API route | | @lobehub/tts/react | React hooks and audio player components |

📖 Documentation

Visit tts.lobehub.com for guides, API reference and live demos. See the Changelog for release notes.

⌨️ Local Development

You can use Github Codespaces for online development:

Or clone it for local development:

$ git clone https://github.com/lobehub/lobe-tts.git
$ cd lobe-tts
$ bun install
$ bun run docs:dev

🤝 Contributing

Contributions of all types are more than welcome, if you are interested in contributing code, feel free to check out our GitHub Issues to get stuck in to show us what you’re made of.

🩷 Sponsor

Every bit counts and your one-time donation sparkles in our galaxy of support! You're a shooting star, making a swift and bright impact on our journey. Thank you for believing in us – your generosity guides us toward our mission, one brilliant flash at a time.

🔗 Links


📝 License

Copyright © 2023 LobeHub. This project is MIT licensed.