Skip to content
/ zizu Public

自足 ZiZu — Open AI capacity-sharing platform

Notifications You must be signed in to change notification settings

HanduoZ/zizu

Repository files navigation

ZiZu 自足 — Open AI Capacity-Sharing Platform

English | 中文


What is ZiZu?

ZiZu is an open-source platform that connects people who need AI assistance with people who can provide it. Users submit tasks through a web interface; the platform routes them to available Providers (自给人) who execute them on their own machines. The platform handles routing, billing, encryption, and privacy — it never touches AI directly.

How It Works

User (browser)          ZiZu Server (cloud)           Provider (their machine)
─────────────          ─────────────────────           ─────────────────────────
Pick a model  ───────►  Route to best Provider ───────►  Execute via CLI (sandboxed)
See streaming  ◄───────  Relay encrypted stream ◄───────  Stream results back
Pay credits    ───────►  Bill + pay Provider
  • Users pick an AI tool, type a prompt, get results
  • Providers run a daemon on their machine that connects via encrypted WebSocket
  • Server handles auth, billing, routing, and queue — never calls AI APIs
  • Privacy: Provider never sees user identity; server never sees prompt content

Supported AI Tools

ZiZu is tool-agnostic. It currently supports any AI accessible via CLI:

Model CLI Tool
Claude Code claude
Codex codex
Gemini gemini

More CLI tools can be integrated as the ecosystem grows.

Architecture

zizu.life (lightweight Node.js server on cloud VM)
  ├── Web UI (single-page app)
  ├── Auth (keypair-based, no email/password)
  ├── Billing (Stripe, credit-based)
  ├── Task Queue & Router
  ├── Provider WebSocket endpoint (/provider)
  │
  ├── Provider A (Claude Code)     ◄── AES-256-GCM encrypted WebSocket
  ├── Provider B (Codex)           ◄── AES-256-GCM encrypted WebSocket
  └── Provider C (Gemini)          ◄── AES-256-GCM encrypted WebSocket

Key design decisions:

  • Keypair identity — no email/password, recovery via passphrase
  • Two-layer privacy — platform layer (billing/routing) is fully separated from execution layer (prompts/responses)
  • AES-256-GCM encryption for task blobs between server and Providers
  • macOS sandbox-exec / Linux firejail isolation for task execution
  • Affinity routing — users build history with Providers for consistent experience

Become a Provider (自给人)

Providers are individuals who connect their AI-capable machines to the ZiZu network. Each provider is responsible for their own setup and compliance with the terms of service of whichever AI tools they use.

Quick start — give this URL to your AI assistant and it will set everything up:

https://zizu.life/api/provider/guide

This is the 自给人介绍页 (Provider Guide) — a machine-readable onboarding guide. Your AI assistant can read it and walk you through registration, configuration, and startup automatically.

Manual Setup

  1. Install AI CLI tools you want to provide (e.g. claude, codex, gemini)

  2. Register via the API or web interface

  3. Configure ~/.zizu/runner.json:

    {
      "serverUrl": "wss://zizu.life/provider",
      "providerKey": "your-key",
      "sharedSecret": "your-shared-secret",
      "models": ["claude-code", "gemini"]
    }
  4. Start the daemon:

    node runner.js

    The daemon connects, authenticates via HMAC challenge-response, enters a 24-hour trial, and begins accepting tasks.

Project Structure

zizu/
├── server.js           # Main server (HTTP + WebSocket)
├── runner.js           # Provider daemon (connects to server via WSS)
├── start.sh            # Server startup script
├── start-runner.sh     # Provider startup script
├── DESIGN.md           # Detailed platform design document
├── public/
│   └── index.html      # Single-page web application
└── lib/
    ├── config.js       # Configuration constants & model registry
    ├── db.js           # SQLite database operations
    ├── auth.js         # Authentication (keypair, sessions)
    ├── billing.js      # Credit billing & Stripe integration
    ├── queue.js        # Task queue management
    ├── provider.js       # Provider management & routing
    ├── trial.js        # Provider trial/qualification system
    ├── executor.js     # Sandboxed CLI task execution
    ├── crypto.js       # AES-256-GCM encryption & HMAC auth
    ├── memory.js       # User memory (client-owned context)
    └── wordlist.js     # Passphrase generation wordlist

Server Setup

Prerequisites

  • Node.js 22+
  • SQLite (via better-sqlite3, compiled during npm install)
git clone https://github.com/HanduoZ/zizu.git
cd zizu
npm install

# Create config directory
mkdir -p ~/.zizu

# Set environment variables (or create ~/.zizu/env)
export PORT=3099
export BASE_URL=https://your-domain.com

# Start
node server.js

The server creates ~/.zizu/zizu.db on first run with all required tables.

Environment Variables

Variable Default Description
PORT 3099 HTTP server port
DB_PATH ~/.zizu/zizu.db SQLite database path
SANDBOX_ROOT ~/.zizu/sandboxes Task sandbox directory
BASE_URL http://localhost:3099 Public URL (for Stripe callbacks)
STRIPE_SECRET_KEY Stripe live/test secret key
STRIPE_WEBHOOK_SECRET Stripe webhook signing secret
DEPLOY_SECRET GitHub webhook deploy secret

User Tiers

Free Mode (排队模式)

  • Queue-based — wait for available Provider
  • Served by trial Providers and qualified Providers who opt in
  • Variable speed depending on capacity

Paid Mode (优先模式)

  • Priority routing — no queue
  • Served by qualified Providers only
  • Affinity routing for consistent experience
  • Credit-based billing (buy via Stripe)

Contributing

Contributions are welcome! Areas where help is needed:

  • Linux support — firejail sandbox testing
  • New AI integrations — additional CLI tools
  • Internationalization — UI translation improvements
  • Documentation — guides, tutorials, videos

Development

# Start in development mode (auto-restart on changes)
npm run dev

# Run tests
node test-queue.mjs
node test-trial.mjs

License

MIT


ZiZu 自足 是什么?

ZiZu 是一个开源的 AI 算力共享平台。它将需要 AI 帮助的用户与能够提供算力的人连接起来。用户通过网页提交任务,平台将任务路由到可用的自给人(Provider),由自给人在自己的机器上执行。平台负责路由、计费、加密和隐私保护——从不直接接触 AI。

运作原理

用户(浏览器)          ZiZu 服务器(云端)              自给人(自己的电脑)
────────────          ──────────────────              ──────────────────
选择模型    ──────────►  路由到最佳自给人  ──────────►  通过 CLI 执行(沙盒隔离)
查看流式输出 ◄──────────  转发加密数据流   ◄──────────  流式返回结果
支付积分    ──────────►  计费 + 结算给自给人
  • 用户:选择 AI 工具,输入提示词,获取结果
  • 自给人:在自己的电脑上运行守护进程,通过加密 WebSocket 连接
  • 服务器:处理认证、计费、路由和队列——从不调用 AI API
  • 隐私保障:自给人看不到用户身份,服务器看不到提示词内容

支持的 AI 工具

ZiZu 与工具无关,目前支持任何通过 CLI 访问的 AI:

模型 CLI 工具
Claude Code claude
Codex codex
Gemini gemini

更多 CLI 工具可随生态发展而集成。

成为自给人

自给人是将自己的 AI 设备接入 ZiZu 网络的个人。每位自给人自行负责自己的配置,并遵守所使用 AI 工具的相关服务条款。

快速开始——将此链接发给你的 AI 助手,它会自动帮你完成所有设置:

https://zizu.life/api/provider/guide

这是自给人介绍页——一份机器可读的入驻指南。你的 AI 助手可以读取并自动引导你完成注册、配置和启动。

手动设置

  1. 安装你想要提供的 AI CLI 工具(如 claudecodexgemini

  2. 通过 API 或网页界面注册

  3. 配置 ~/.zizu/runner.json

    {
      "serverUrl": "wss://zizu.life/provider",
      "providerKey": "your-key",
      "sharedSecret": "your-shared-secret",
      "models": ["claude-code", "gemini"]
    }
  4. 启动守护进程

    node runner.js

    守护进程会连接服务器,通过 HMAC 挑战-响应认证,进入 24 小时试用期,然后开始接受任务。

系统架构

zizu.life(轻量级 Node.js 服务器,运行在云端 VM)
  ├── Web 界面(单页应用)
  ├── 认证系统(密钥对,无需邮箱/密码)
  ├── 计费系统(Stripe,积分制)
  ├── 任务队列 & 路由器
  ├── 自给人 WebSocket 端点(/provider)
  │
  ├── 自给人 A(Claude Code)     ◄── AES-256-GCM 加密 WebSocket
  ├── 自给人 B(Codex)           ◄── AES-256-GCM 加密 WebSocket
  └── 自给人 C(Gemini)          ◄── AES-256-GCM 加密 WebSocket

项目结构

zizu/
├── server.js           # 主服务器(HTTP + WebSocket)
├── runner.js           # 自给人守护进程(通过 WSS 连接服务器)
├── start.sh            # 服务器启动脚本
├── start-runner.sh     # 自给人启动脚本
├── DESIGN.md           # 详细的平台设计文档
├── public/
│   └── index.html      # 单页 Web 应用
└── lib/
    ├── config.js       # 配置常量 & 模型注册表
    ├── db.js           # SQLite 数据库操作
    ├── auth.js         # 认证(密钥对、会话)
    ├── billing.js      # 积分计费 & Stripe 集成
    ├── queue.js        # 任务队列管理
    ├── provider.js       # 自给人管理 & 路由
    ├── trial.js        # 自给人试用/资质系统
    ├── executor.js     # 沙盒化 CLI 任务执行
    ├── crypto.js       # AES-256-GCM 加密 & HMAC 认证
    ├── memory.js       # 用户记忆(客户端拥有的上下文)
    └── wordlist.js     # 助记词生成词表

部署指南

前置要求

  • Node.js 22+
  • SQLite(通过 better-sqlite3npm install 时自动编译)
git clone https://github.com/HanduoZ/zizu.git
cd zizu
npm install

mkdir -p ~/.zizu
export PORT=3099
export BASE_URL=https://your-domain.com

node server.js

服务器首次运行时会自动创建数据库和所有必需的表。

环境变量

变量 默认值 说明
PORT 3099 HTTP 服务端口
DB_PATH ~/.zizu/zizu.db SQLite 数据库路径
SANDBOX_ROOT ~/.zizu/sandboxes 任务沙盒目录
BASE_URL http://localhost:3099 公开 URL(用于 Stripe 回调)
STRIPE_SECRET_KEY Stripe 密钥
STRIPE_WEBHOOK_SECRET Stripe Webhook 签名密钥
DEPLOY_SECRET GitHub Webhook 部署密钥

用户模式

免费模式(排队模式)

  • 基于队列——等待可用自给人
  • 由试用期自给人和选择接受免费任务的合格自给人服务
  • 速度取决于当前算力

付费模式(优先模式)

  • 优先路由——无需排队
  • 仅由合格自给人服务
  • 亲和路由,体验更一致
  • 积分制计费(通过 Stripe 购买)

参与贡献

欢迎贡献!以下是需要帮助的方向:

  • Linux 支持 — firejail 沙盒测试
  • 新 AI 集成 — 更多 CLI 工具支持
  • 国际化 — UI 翻译改进
  • 文档 — 指南、教程、视频

开发

npm run dev    # 开发模式(文件修改自动重启)

node test-queue.mjs   # 运行测试
node test-trial.mjs

许可证

MIT

About

自足 ZiZu — Open AI capacity-sharing platform

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors