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

@zhin.js/plugin-voice

v0.0.2

Published

Voice input/output plugin for Zhin.js — STT via Whisper + TTS via edge-tts

Readme

@zhin.js/plugin-voice

Zhin.js 语音输入/输出插件,提供语音识别(STT)和语音合成(TTS)功能。

功能特性

  • STT(Speech-to-Text) — 通过 Whisper 模型将语音消息转写为文字
    • 支持 Ollama 和 OpenAI API 两种 Provider
  • TTS(Text-to-Speech) — 通过 edge-tts 将文字转换为语音消息
    • 支持自定义语音、语速、音调
  • AI 工具集成 — 自动注册为 AI 可调用的 Tool

安装

pnpm add @zhin.js/plugin-voice

前置依赖

STT(语音识别)

  • Ollama 并安装 Whisper 模型:ollama pull whisper
  • 或使用 OpenAI API(需要 API Key)

TTS(语音合成)

配置

zhin.config.yml 中配置:

plugins:
  - voice                       # 或带配置的写法

voice:
  stt:
    enabled: true
    provider: ollama            # ollama | openai
    model: whisper              # Whisper 模型名称
    host: http://localhost:11434  # Ollama API 地址
    # apiKey: sk-xxx            # OpenAI 模式需要
  tts:
    enabled: true
    voice: zh-CN-XiaoxiaoNeural  # edge-tts 语音
    rate: '+0%'                   # 语速调整
    pitch: '+0Hz'                 # 音调调整
    edgeTtsCommand: edge-tts      # edge-tts CLI 路径

AI 工具

插件会自动注册以下 AI 工具:

text_to_speech

将文本转换为语音。

| 参数 | 类型 | 必填 | 说明 | |------|------|------|------| | text | string | 是 | 要转换的文本 | | voice | string | 否 | 语音类型(覆盖默认配置) |

speech_to_text

将语音转换为文本。

| 参数 | 类型 | 必填 | 说明 | |------|------|------|------| | audio_url | string | 是 | 音频文件 URL |

可用语音列表

edge-tts 支持多种语音,常用的中文语音包括:

| 语音 ID | 说明 | |---------|------| | zh-CN-XiaoxiaoNeural | 晓晓(女声,默认) | | zh-CN-YunxiNeural | 云希(男声) | | zh-CN-YunjianNeural | 云健(男声) | | zh-CN-XiaoyiNeural | 晓伊(女声) |

查看全部语音:edge-tts --list-voices

使用示例

import { usePlugin, ZhinTool } from 'zhin.js'

const { addTool } = usePlugin()

// 插件已自动注册 TTS/STT 工具
// AI 可以通过 "帮我朗读这段文字" 等自然语言触发 TTS
// AI 可以通过接收语音消息触发 STT

许可证

MIT License