Initial commit: plan-usage - GLM & MiniMax statusline for Claude Code
This commit is contained in:
110
README.md
Normal file
110
README.md
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
# plan-usage
|
||||||
|
|
||||||
|
简体中文 | [English](README_en.md)
|
||||||
|
|
||||||
|
一个用于 Claude Code 的插件,在状态栏显示 GLM(智谱/ZAI)和 MiniMax 算力套餐的使用量统计。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## 功能特性
|
||||||
|
|
||||||
|
- 📊 **实时使用量追踪**: 同时显示 GLM 和 MiniMax 使用百分比
|
||||||
|
- 🎨 **颜色警告提示**: 绿色 (0-70%)、黄色 (70-90%)、红色 (90-100%)
|
||||||
|
- ⚡ **快速查询**: 异步并行获取两个 API
|
||||||
|
- 🔧 **灵活配置**: 支持单独查看 GLM 或 MiniMax
|
||||||
|
|
||||||
|
## 安装
|
||||||
|
|
||||||
|
### 方法 1: npm 安装(推荐)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install -g @renato97/plan-usage
|
||||||
|
```
|
||||||
|
|
||||||
|
### 方法 2: 手动安装
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir -p ~/.claude/plan-usage
|
||||||
|
cp -r dist/index.js ~/.claude/plan-usage/
|
||||||
|
chmod +x ~/.claude/plan-usage/index.js
|
||||||
|
```
|
||||||
|
|
||||||
|
## 配置 Claude Code
|
||||||
|
|
||||||
|
编辑 `~/.claude/settings.json`:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"statusLine": {
|
||||||
|
"type": "command",
|
||||||
|
"command": "plan-usage"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
或者使用完整路径:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"statusLine": {
|
||||||
|
"type": "command",
|
||||||
|
"command": "node ~/.claude/plan-usage/index.js"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 环境变量
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# GLM API Key (也会使用 ANTHROPIC_AUTH_TOKEN)
|
||||||
|
export GLM_API_KEY="your-glm-api-key"
|
||||||
|
|
||||||
|
# MiniMax API Key (可选)
|
||||||
|
export MINIMAX_API_KEY="your-minimax-api-key"
|
||||||
|
```
|
||||||
|
|
||||||
|
## 使用方法
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 显示状态栏 (默认)
|
||||||
|
plan-usage
|
||||||
|
|
||||||
|
# 只显示 GLM
|
||||||
|
plan-usage --glm
|
||||||
|
|
||||||
|
# 只显示 MiniMax
|
||||||
|
plan-usage --minimax
|
||||||
|
|
||||||
|
# JSON 格式输出
|
||||||
|
plan-usage --json
|
||||||
|
```
|
||||||
|
|
||||||
|
## 输出示例
|
||||||
|
|
||||||
|
```
|
||||||
|
GLM 6% | MiniMax 93% 1.6h
|
||||||
|
```
|
||||||
|
|
||||||
|
颜色说明:
|
||||||
|
- 🟢 绿色: 0-70%
|
||||||
|
- 🟡 黄色: 70-90%
|
||||||
|
- 🔴 红色: 90-100%
|
||||||
|
|
||||||
|
## API 端点
|
||||||
|
|
||||||
|
- **GLM**: `https://api.z.ai/api/monitor/usage/quota/limit`
|
||||||
|
- **MiniMax**: `https://api.minimax.io/v1/api/openplatform/coding_plan/remains`
|
||||||
|
|
||||||
|
## 构建
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 本地运行
|
||||||
|
node dist/index.js
|
||||||
|
|
||||||
|
# 测试
|
||||||
|
node dist/index.js --json
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT
|
||||||
11
package.json
Normal file
11
package.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "@renato97/plan-usage",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "GLM and MiniMax Coding Plan usage statusline for Claude Code",
|
||||||
|
"bin": {
|
||||||
|
"plan-usage": "./dist/index.js"
|
||||||
|
},
|
||||||
|
"keywords": ["claude-code", "statusline", "glm", "minimax", "coding-plan"],
|
||||||
|
"author": "renato97",
|
||||||
|
"license": "MIT"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user