Files
plan-usage/README.md

111 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# plan-usage
简体中文 | [English](README_en.md)
一个用于 Claude Code 的插件,在状态栏显示 GLM智谱/ZAI和 MiniMax 算力套餐的使用量统计。
![demo](screenshots/demo.png)
## 功能特性
- 📊 **实时使用量追踪**: 同时显示 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