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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@motemen/ai-streamer

v0.0.2

Published

ai-streamer は、OpenAI と VOICEVOX を活用し、静止画ベースの VTuber 実況配信を自動化するシステムです。OBS の Browser Source として追加することで、AI による発話・字幕・表情制御をオールインワンで実現します。

Readme

ai-streamer 概要

ai-streamer は、OpenAI と VOICEVOX を活用し、静止画ベースの VTuber 実況配信を自動化するシステムです。OBS の Browser Source として追加することで、AI による発話・字幕・表情制御をオールインワンで実現します。

使い方

事前準備

VOICEVOX サーバを起動します。デフォルトでは 50021 ポートを使用します。

docker run -d -p 50021:50021 voicevox/voicevox_engine:latest

npx経由で起動(推奨)

最も簡単な方法は、npxを使用して直接起動することです:

npx @motemen/ai-streamer

設定ファイルを指定する場合:

npx @motemen/ai-streamer --config config.example.toml

開発環境での起動

  1. リポジトリをクローンし、依存パッケージをインストール
  2. pnpm dev でサーバ・フロントエンドを起動
  3. OBS の Browser Source に http://localhost:5173 を追加
  4. 必要に応じて API(/api/chat など)を直接叩いて制御も可能

技術スタック

  • OpenAI(台詞生成、Streaming 対応)
  • VOICEVOX(音声合成、ずんだもんボイス等)
  • Hono(API サーバ)
  • Vite + React(フロントエンド)

サーバ・フロントエンド間のシーケンス図

sequenceDiagram
  actor User as ユーザ
  participant Director as ディレクターコンソール (/director)
  participant ExternalDirector as 外部プログラム
  participant Server as サーバ (/api/*)
  participant Frontend as フロントエンド
  actor OBS as OBS Browser Source

  User->>Director: プロンプト入力
  Director->>Server: POST /api/chat

  activate Server
  Server->>Server: 台詞生成・音声合成
  Server->>Frontend: SSE /api/stream
  deactivate Server
  Frontend->>Frontend: キュー・再生
  Frontend-->>OBS: 取り込み

  opt キューが空のとき
    Frontend->>Server: POST /api/idle
    activate Server
    Server->>Server: 台詞生成・音声合成
    Server->>Frontend: SSE /api/stream
    deactivate Server
  end

  opt 外部プログラム利用
    ExternalDirector->>Server: POST /api/chat
  end

設定

設定ファイルをJSで書けば、AI Streamerの動作をカスタマイズできます。

ツール機能

発話生成時にAIが外部ツール(Tool Calling)を使用できるようになりました。これにより、AIが時刻を確認したり、アバターを変更したり、計算したりといった操作を自律的に行えます。

デフォルトで以下のツールが利用可能です:

  • setAvatar: アバターを変更

設定ファイル内でツールを直接定義できます:

import { z } from "zod";

export default {
  tools: {
    // 現在時刻を取得
    getTime: {
      description: "現在の時刻を取得する",
      inputSchema: z.object({}),
      execute: async () => {
        const now = new Date();
        return now.toLocaleString("ja-JP", { timeZone: "Asia/Tokyo" });
      },
    },

    // サイコロを振る
    rollDice: {
      description: "指定された面数のサイコロを振る",
      inputSchema: z.object({
        sides: z.number().default(6).describe("サイコロの面数"),
      }),
      execute: async ({ sides }) => {
        const result = Math.floor(Math.random() * sides) + 1;
        return { result }; // オブジェクトを返す例
      },
    },
  },
};
  • ツールのexecute関数のシグネチャは (params, context) => Promise<any> です。
    • params: inputSchemaで定義された入力オブジェクトです。
    • context: { aiStreamer, ... } のように、aiStreamerインスタンスを含むコンテキストオブジェクトです。
  • 戻り値は、AIに渡されるJSONシリアライズ可能な任意のオブジェクトです。
  • inputSchemaにはZodスキーマを使用します。

詳細はconfigs/config.example-tools.jsを参照してください。

Development

open -a OBS --args --remote-debugging-port=9222 --remote-allow-origins=http://localhost:9222