Skip to content

Latest commit

 

History

History
84 lines (59 loc) · 5.44 KB

README.en.md

File metadata and controls

84 lines (59 loc) · 5.44 KB

AITokenPool — Shared AI Token Pool

English | 简体中文

🔗 Live instance: https://aitokenpool.args.fun/

Don't let your token plan go to waste. Subscribed to Claude / ChatGPT / GLM / DeepSeek but can't use it all? Share your idle quota to earn points, then redeem those points for models shared by others — one subscription, the whole model pool.

AITokenPool is an open-source AI token sharing platform / multi-model gateway that pools API quota from multiple model providers behind a single entry point with fair per-point allocation. The enterprise edition (internal key pool + per-employee point quotas) and the public edition (users share idle keys to earn points and spend points on others' models) share the same core platform.

Features

  • Multi-protocol gateway — bidirectional conversion between OpenAI Chat / OpenAI Responses / Anthropic Messages, for both non-streaming and SSE streaming requests; clients only need one OpenAI-compatible endpoint
  • Transparent billing — every call shows an input / cache-hit / output token breakdown; vendor price lists ship with the release, each recorded in its own currency (CNY / USD), with peak-hour pricing and per-request input-length tiered pricing
  • Point system — daily gift, 90/10 sharing split, admin top-up, self-registration with email verification, password reset
  • Enterprise controls — departments, member credits, usage reports, and a dedicated operator view
  • Security — upstream keys encrypted with AES-256-GCM, argon2 password hashing, email verification, admin role isolation
  • Lightweight — a single Rust binary + SQLite + one-command Docker deploy, no external services
  • Bilingual web UI included — full interface (dashboard / marketplace / sharing / wallet / transactions / admin / operator / settings), no separate frontend deployment

Use Cases

Scenario Description
Enterprises / teams Buy multiple model plans centrally into a key pool and allocate points to employees — one entry point for all models, controlled cost
Individual subscribers Share quota you can't use to earn points, then redeem those points for other providers' models — subscriptions no longer go to waste
Developers / tinkerers One OpenAI-compatible API to call every model, with dashboard, reports, and permission system out of the box

Quick Start

Don't want to deploy it yourself? Just open the live instance at https://aitokenpool.args.fun/ and sign up (no installation needed).

Docker (recommended)

# Master key (required): compose refuses to start without it — there is no default.
# ⚠️ Generate it once and keep it: regenerating makes every encrypted upstream key unreadable.
export ATP_MASTER_KEY=$(openssl rand -hex 32)
docker compose up -d --build
# or use a published image (images are released on version tags; latest points to the newest release)
docker pull ghcr.io/argszero/aitokenpool:latest
docker run -p 8080:8080 -v "$PWD/atp-data:/data" \
  -e ATP_MASTER_KEY=$(openssl rand -hex 32) \
  ghcr.io/argszero/aitokenpool:latest

From source

cargo run   # creates ./data/ and config on first start; open http://localhost:8080/

First start

  • A unified data directory is created automatically (<data>/: config.toml + aitokenpool.db + logs/ + archive/) — logs/ holds the logs and archive/ the JSONL archives of the detail tables (details past the retention window exist only there); back up and migrate the whole directory
  • An initial admin admin@aitokenpool.local is created with a random 16-character password printed to the startup log (first run only) — change it right after login
  • Regular users can self-register from the login page (email verification code; unverified emails can't log in)
  • ⚠️ Set the master key ATP_MASTER_KEY (openssl rand -hex 32; keep the value you generate) — it encrypts upstream API keys. Under Docker Compose an unset value makes the command fail outright (no default is provided); running from source or via a bare docker run falls back to a random dev key, and previously listed keys can't be decrypted after a restart

See comments in config/config.example.toml for the full configuration.

Gateway access

OpenAI-compatible endpoints: POST /v1/chat/completions, POST /v1/responses, POST /anthropic/v1/messages, GET /v1/models. The base URL is shown on the settings page and built from [server].public_url (set it to your real domain in production). See docs/architecture.md for an overview; the authoritative list is router() in src/routes/mod.rs.

Documentation

Doc Description
docs/architecture.md Architecture, API reference, database schema
docs/user-stories.md User stories & scenarios
docs/plan-api-matrix.md Plans & API matrix
docs/deployment.md Deployment & upgrade: downtime window, rollout and rollback checklist
CHANGELOG.md Version history
CONTRIBUTING.md Contribution guide

Powered by EMRG

This project is developed by EMRG (Evolutionary Multi-instance Reasoning System) — requirements are filed as rants, and EMRG implements, tests, and submits PRs automatically, with human review before merge.

License

MIT