← Back to Skills Marketplace
103
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install bailian-usage-proxy
Description
阿里百炼大模型平台的多人共享账号用量统计代理服务。用于解决公司共用阿里百炼账号时无法区分个人用量的问题。当用户需要:1) 部署阿里百炼用量统计代理,2) 统计多人Token用量和调用次数,3) 管理大模型API调用配额时激活此技能。
README (SKILL.md)
阿里百炼用量统计代理
为阿里百炼(阿里云大模型服务平台)提供多人共享账号场景下的精细化用量统计方案。
核心能力
- API代理转发:兼容 OpenAI 格式,透明转发到阿里百炼
- 用量实时统计:按用户、模型、时间维度记录 Token 消耗
- 配额管理:支持日限额、限流控制
- 管理后台:用量查询、报表导出
使用场景
- 公司统一申请阿里百炼账号,需要统计每个员工的用量
- 需要按项目/部门分摊大模型调用成本
- 需要限制单个用户的日调用配额
快速部署
1. 环境准备
# 克隆或复制本项目
cd bailian-proxy
# 安装依赖
pip install -r requirements.txt
# 配置环境变量
cp .env.example .env
# 编辑 .env 填入阿里百炼主账号 Key 和数据库配置
2. 数据库初始化
python scripts/init_db.py
3. 启动服务
# 开发模式
python -m app.main
# 生产模式(Docker)
docker-compose up -d
4. 创建用户
python scripts/create_user.py --name "张三" --department "算法部" --daily-limit 1000000
客户端使用
同事只需修改两处配置:
# 原配置
base_url = "https://dashscope.aliyuncs.com/compatible-mode/v1"
api_key = "sk-xxx" # 阿里百炼的key
# 新配置
base_url = "http://your-proxy-server:8080/v1"
api_key = "internal-key-xxx" # 代理系统分配的key
查看用量
命令行
# 今日用量
python scripts/usage_report.py --today
# 指定用户
python scripts/usage_report.py --user-key xxx --start 2026-03-01 --end 2026-03-08
# 导出CSV
python scripts/usage_report.py --export usage.csv
管理后台
访问 http://proxy-server:8081 查看:
- 实时用量仪表盘
- 用户用量排行
- 模型调用分布
- 历史趋势图表
技术架构
API 文档
数据库结构
Usage Guidance
Before installing, consider the following: (1) The code expects a Bailian/Alibaba master API key (BAILIAN_API_KEY or similar) and database credentials even though the registry metadata doesn't list required env vars — supply these carefully and only to an isolated instance. (2) Change SECRET_KEY from the default and secure the DB and log directories; logs and the start scripts can print or store API keys. (3) The start scripts may create a default admin user and print its API key — rotate/delete that key or set your own admin key after install. (4) There are inconsistent env var names in provided docker-compose assets (BAILIAN_MASTER_KEY vs BAILIAN_API_KEY); confirm which you use to avoid accidental disclosure. (5) Run the service in a network-isolated environment (or behind a firewall) and review the code yourself or with a trusted engineer before handing production credentials to it. If you need higher assurance, ask the author for provenance (source repo/homepage) or run it in a sandboxed environment first.
Capability Assessment
Purpose & Capability
The name/description (a proxy that forwards OpenAI-format requests to the Bailian/Alibaba large-model endpoint and tracks per-user token usage) matches the included code (proxy, DB, admin UI, scripts). However the registry metadata says 'required env vars: none' while the code expects secrets like BAILIAN_API_KEY, DATABASE_URL, SECRET_KEY, etc. This mismatch is unexpected and worth flagging.
Instruction Scope
SKILL.md and start scripts instruct the agent/administrator to place a master Bailian API key in .env and run startup scripts. The runtime instructions remain within the proxy's purpose (init DB, start service, create users, generate usage reports). But startup scripts create a default admin user (and print its API key to stdout) and write data/log files under ./data and ./logs — these behaviors can expose credentials if not handled carefully.
Install Mechanism
No remote binary downloads or obscure installers are used — installation is standard Python package installation (pip) and optional Docker compose. This is a lower-risk install mechanism. There are no download-from-arbitrary-URL steps in the files provided.
Credentials
The skill actually requires sensitive environment variables (BAILIAN_API_KEY or BAILIAN_MASTER_KEY in assets, DATABASE_URL, SECRET_KEY, optional REDIS_URL) even though the registry lists none. The presence of a default weak SECRET_KEY ('change-me-in-production') and scripts that will create and print an admin API key increase exposure risk. Also there is an inconsistency in env var names across assets (assets/docker-compose.yml references BAILIAN_MASTER_KEY while docker-compose.yml and config.py use BAILIAN_API_KEY), which could cause secrets to be misconfigured or accidentally leaked.
Persistence & Privilege
The skill is not set to always:true and does not attempt to modify other skills. It does persist data (SQLite/MySQL files, logs) and may auto-create an admin user when started. Those are normal for a service, but creating and printing an admin API key by default is a privilege that requires operational caution.
How to Use
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install bailian-usage-proxy - After installation, invoke the skill by name or use
/bailian-usage-proxy - Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
- Initial release of bailian-usage-proxy.
- Provides a proxy service for precise usage tracking when sharing an Alibaba Bailian (DashScope) account among multiple users.
- Tracks token usage and call counts per user, model, and time period.
- Supports daily quota management and rate limiting for individual users.
- Includes a management dashboard for usage queries and report export.
- Compatible with OpenAI-style API, requiring minimal client changes.
Metadata
Frequently Asked Questions
What is Bailian Usage Proxy?
阿里百炼大模型平台的多人共享账号用量统计代理服务。用于解决公司共用阿里百炼账号时无法区分个人用量的问题。当用户需要:1) 部署阿里百炼用量统计代理,2) 统计多人Token用量和调用次数,3) 管理大模型API调用配额时激活此技能。 It is an AI Agent Skill for Claude Code / OpenClaw, with 103 downloads so far.
How do I install Bailian Usage Proxy?
Run "/install bailian-usage-proxy" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Bailian Usage Proxy free?
Yes, Bailian Usage Proxy is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does Bailian Usage Proxy support?
Bailian Usage Proxy is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Bailian Usage Proxy?
It is built and maintained by bjmfjoy (@bjmfjoy); the current version is v1.0.0.
More Skills