TokenPanel is an open-source, self-hosted platform for tracking AI usage, managing users and accounts, enforcing budgets and rolling limits, and exposing a governed OpenAI- and Anthropic-compatible API.
Connect providers, issue API keys, set model prices and budgets, enforce limits, and see cost and usage from one dashboard — whether for internal teams, clients, or product metering.
No enterprise feature wall. No paid source tier for core features. TokenPanel is licensed under AGPLv3 so the platform stays open when modified and offered as a hosted service.
- Platform and infra teams centralizing AI provider access
- Product teams metering AI usage for customers
- Agencies allocating AI budget per client
- Teams that need per-user or per-account AI budgets and limits
Most LLM gateways focus on routing requests across providers. TokenPanel adds who can use what, at what cost, and under which limits.
Use it when you need:
- Accounts, prepaid balances, subscriptions, and API keys
- OpenAI-compatible and Anthropic-compatible APIs for your apps and users
- Model aliases with provider fallback chains
- Per-model pricing and upstream cost tracking
- Token, request, and spend limits over custom windows like 1h, 5h, weekly, or 30d
- Usage analytics by account, model, cost, and spend
- A self-hosted dashboard your team can actually run day to day
If LiteLLM is the provider gateway, TokenPanel is the open-source access, billing, and dashboard layer on top.
Install TokenPanel on a Linux server:
curl -fsSL https://raw.githubusercontent.com/tokenpanel/tokenpanel/main/manager/install.sh | sudo bashPrefer local development? Jump to Local Development.
Accounts and access
- Create accounts with balances, status, metadata, and external IDs
- Issue API keys with one-time secret display
- Restrict keys to specific model aliases
- Suspend or close accounts without rotating provider credentials
AI gateway
- OpenAI-compatible
/v1/modelsand/v1/chat/completions - Anthropic-compatible
/v1/messages - Streaming and non-streaming responses
- API-key auth, brute-force throttling, and per-key last-used tracking
Provider and model control
- Connect OpenAI-compatible and Anthropic-compatible providers
- Store provider secrets encrypted at rest
- Discover upstream models from providers
- Import model metadata and costs from models.dev
- Publish your own model aliases instead of exposing upstream names
- Configure ordered fallback chains across providers and upstream models
Budgets and limits
- Store money as integer units, never floats
- Track upstream cost separately from charged price
- Debit account balances after successful usage
- Record append-only usage and balance ledgers
- Enforce rolling token, request, and spend limits
- Define plan defaults and per-account overrides
Dashboard
- Overview of accounts, models, providers, plans, and balances
- Account drawer with balance history, subscriptions, usage, and keys
- Plan editor with included credit, included tokens, and custom limits
- Analytics for requests, tokens, cost, and spend
- Admin playground for testing one or more models before rollout
- Multi-organization console with invites and per-organization roles
Operations
- One-line Linux installer
- Docker-based production deployment
- MongoDB replica set for transactional billing and migrations
- Pre/post migration flow with destructive-operation safety checks
- Backups, restore, update, rollback, diagnostics, and optional Caddy HTTPS
Production install on a Linux server:
curl -fsSL https://raw.githubusercontent.com/tokenpanel/tokenpanel/main/manager/install.sh | sudo bashThe installer:
- Installs Docker if missing
- Clones the stable
mainbranch to/opt/tokenpanel - Stores config in
/etc/tokenpanel - Stores MongoDB data, backups, and certificates in
/var/tokenpanel/shared - Starts an interactive setup wizard for domain, HTTPS, MongoDB, and admin settings
- Keeps prompts interactive even when launched as
curl | sudo bash
After install:
tokenpanel status
tokenpanel backup
tokenpanel update
tokenpanel logs -fTokenPanel uses one operator-edited config file:
/etc/tokenpanel/tokenpanel.ymlExample:
domain: panel.example.com
adminEmail: admin@example.com
timezone: UTC
proxy:
mode: caddy
trustProxy: true
trustCloudflare: false
database:
user: tokenpanel
password: change-me
name: tokenpanel
api:
jwtSecret: change-me-to-a-long-random-secretAfter editing it, apply the change:
tokenpanel config render
tokenpanel restartDuring updates, tokenpanel update re-renders configuration automatically.
Generated deployment files live in:
/etc/tokenpanel/generated/Do not edit generated files. Edit tokenpanel.yml instead.
Create a customer and API key in the dashboard, then point OpenAI-compatible clients at your TokenPanel domain:
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "tp_live_your_customer_key",
baseURL: "https://your-tokenpanel-domain.com/v1",
});
const response = await client.chat.completions.create({
model: "default-chat",
messages: [{ role: "user", content: "Write a short welcome email." }],
});
console.log(response.choices[0]?.message.content);Anthropic-compatible clients can call the same customer key through Authorization: Bearer:
curl https://your-tokenpanel-domain.com/v1/messages \
-H "Authorization: Bearer tp_live_your_customer_key" \
-H "Content-Type: application/json" \
-d '{
"model": "default-chat",
"max_tokens": 256,
"messages": [{"role": "user", "content": "Explain token resale in one paragraph."}]
}'TokenPanel uses Bun workspaces and Docker Compose.
bun install
cp -f .env.example .env
bun run docker:startLocal URLs:
- Admin:
http://localhost:5173 - API:
http://localhost:3000 - Health:
http://localhost:3000/health
Useful commands:
bun run test
bun run typecheck
bun run lint
bun run buildTokenPanel has two API surfaces:
- Admin API under
/admin/*for users managing organizations, providers, models, customers, plans, API keys, invites, analytics, and playground requests - Public API under
/v1/*for customer API keys calling OpenAI-compatible and Anthropic-compatible endpoints
Core data lives in MongoDB with Effect Schema TypeScript schemas. Billing settlement uses MongoDB transactions so usage records, customer balance debits, balance ledger entries, and rate-limit counters commit together.
TokenPanel is built as an open-source alternative to closed feature tiers around AI gateway operations. The goal is simple: if the feature exists, self-hosted users should have it.
You can self-host it, inspect it, modify it, and run it for your customers. If you modify TokenPanel and offer it as a hosted network service, AGPLv3 requires you to make the corresponding source code available to users of that service.
TokenPanel is under active development. Review release notes and back up production data before upgrades. APIs, configuration, and deployment behavior may change before the first stable release.
Security reports should follow SECURITY.md. Contributions are welcome through CONTRIBUTING.md.
TokenPanel is licensed under the GNU Affero General Public License v3.0 only (AGPL-3.0-only). See LICENSE.
This is not legal advice. If you plan to redistribute TokenPanel or offer a modified hosted service, review the license with counsel.
