One Api Pro is a self-hosted AI API gateway written in Go with a Vue 3 admin console. It is a refactor of One API that keeps the original's features and adds a plan and subscription system, payment integration, a decentralized active-active cluster mode, and a tiered permission model. Upstream providers (OpenAI, Anthropic, Gemini, DeepSeek, Qwen, Wenxin, iFlytek, Zhipu, and others, 30 or more in total) sit behind one OpenAI-compatible interface covering models, chat, completions, embeddings, images, audio, and moderations.
Provider adaptors self-register, so adding a provider is a new package plus one register call with no framework changes. Channels are load-balanced by weighted random distribution with automatic failover, cool-down and disable policies, per-channel concurrency and RPM limits, and low-success-rate auto-disable. Billing is per token or per request with independent prompt, completion, and cached pricing, stacked group discounts, and period usage tracking.
Tokens carry per-model allowlists, subnet IP restrictions, quota caps, and expiry. Plans bill by token or request with hourly, weekly, or monthly rate limits and per-model controls. Every checkout and top-up writes an order row (plan snapshot, amount, channel, status, provider trade number), and WeChat Pay and Alipay are integrated natively, with bank, offline, and free channels reserved for admins. Permissions run Guest, User, Admin, and Root.
In cluster mode each node runs its own MySQL and Redis, and application-layer events keep nodes in sync without a shared database, so a deployment can serve several regions. SQLite is the default store, with MySQL or PostgreSQL as alternatives and Redis as an optional cache. The admin console shows a dashboard of core metrics, usage trends, and per-model distribution, and switches between Chinese and English at runtime.
Features
- OpenAI-compatible gateway: 30 or more providers (OpenAI, Anthropic, Gemini, DeepSeek, Qwen, Wenxin, iFlytek, Zhipu) behind one interface for models, chat, completions, embeddings, images, audio, and moderations
- Self-registering adaptors: a new provider is one package plus one register call, with no framework edits
- Channel routing: weighted random distribution, automatic failover, cool-down and disable policies, per-channel concurrency and RPM limits
- Token controls: per-model allowlists, subnet IP restrictions, quota caps, expiry, and unlimited quotas
- Plans and subscriptions: token- or request-based billing, hourly, weekly, or monthly rate limits, per-model controls, stack or price-difference upgrades
- Orders and payments: an audit row per checkout or top-up, native WeChat Pay and Alipay, admin-side bank, offline, and free channels
- Cost accounting: independent prompt, completion, and cached pricing, stacked group discounts, period usage tracking
- Active-active cluster: each node keeps its own MySQL and Redis, synced through application-layer events with no shared database
- Tiered permissions: Guest, User, Admin, and Root roles with granular admin action controls
- Admin console: Vue 3 and Arco Design dashboard with core metrics, usage trends, per-model distribution, and runtime Chinese and English switching

