glm-quota-line 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/README.en.md +237 -115
- package/README.md +245 -124
- package/data/models.json +10 -0
- package/package.json +2 -1
- package/src/claude/sessionStart.js +0 -5
- package/src/claude/settings.js +42 -0
- package/src/cli/args.js +2 -0
- package/src/cli/commands.js +41 -3
- package/src/cli/configCommand.js +86 -0
- package/src/cli/help.js +263 -0
- package/src/cli/index.js +37 -74
- package/src/cli/modelCommand.js +127 -0
- package/src/cli/registry.js +238 -0
- package/src/core/context/cache.js +102 -0
- package/src/core/context/calculator.js +0 -48
- package/src/core/context/formatter.js +1 -1
- package/src/core/context/index.js +43 -32
- package/src/core/context/models.js +113 -18
- package/src/core/context/parser.js +1 -32
- package/src/core/quota/cache.js +1 -37
- package/src/core/quota/parse.js +3 -2
- package/src/core/quota/service.js +28 -2
- package/src/core/status/format.js +32 -30
- package/src/core/status/viewModel.js +33 -1
- package/src/shared/bar.js +40 -0
- package/src/shared/constants.js +17 -3
- package/src/shared/migration.js +0 -7
- package/src/shared/utils.js +0 -5
- package/src/tui/index.js +9 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.3.1
|
|
4
|
+
|
|
5
|
+
- Fixed "quota unavailable" on api.z.ai / open.bigmodel.cn: the quota endpoint now returns `{"code":200,...}` without a top-level `success` flag, which made every response parse as unavailable (#6)
|
|
6
|
+
- Added support for credit-based Coding Plans: their 5h/weekly windows are reported as `CREDIT_LIMIT` entries (`usage`/`currentValue`/`remaining`) instead of `TOKENS_LIMIT`, which previously produced no quotas (#6)
|
|
7
|
+
|
|
8
|
+
## 1.3.0
|
|
9
|
+
|
|
10
|
+
- Added `commands` subcommand: list every command with a machine-readable schema via `--json` (name / summary / sideEffect / args / examples), for AI agents and scripting
|
|
11
|
+
- Added per-subcommand `--help` (e.g. `model --help`, `config set --help`) — focused help derived from a single command registry
|
|
12
|
+
- **User-customizable model mapping table** — model context window sizes are now managed by the user at runtime. The bundled `data/models.json` is just a frozen base; your local `modelMap` overlays it, so adapting to a new model (e.g. `glm-5.2` with 1M context) needs only `model set <id> <size>` — no package update or upgrade required
|
|
13
|
+
- Added `model` subcommands: `list`, `get`, `set`, `remove` — manage model context window size mappings via CLI
|
|
14
|
+
- Added `modelMap` persistence in tool config — custom model sizes survive across sessions
|
|
15
|
+
- Added `config reset [--models] [--yes]` — restore user config to defaults. `--models` limits the reset to custom model mappings. Preserves install state; prompts unless `--yes` (required in non-interactive sessions)
|
|
16
|
+
- Model ids reported with a bracket suffix (e.g. `glm-5.2[1M]`) are now normalized to the bare id for lookup and display
|
|
17
|
+
- Updated default table: added `glm-5.2` (1M context), removed `glm-5` and `glm-5.1` (no longer in plan)
|
|
18
|
+
- Added `reset-format` config (`time` / `countdown`) — show reset time as countdown duration instead of time point
|
|
19
|
+
- Weekly quota now displays reset time (time point or countdown) alongside the progress bar
|
|
20
|
+
- Context window resolution now relies solely on the local model map: stdin `context_window_size` is ignored, and stdin-provided window percentages are no longer used as a fallback (they are often inaccurate). If the current model id is not in the map, the context segment is simply not shown rather than guessing
|
|
21
|
+
- ctx cache now keyed by session id + model id: token usage can be 0 or missing on individual status-line frames (session start, between requests), which would make the context segment flash. The cache falls back to the last valid value for the same session and model so the display stays stable — a stale value from a different session or model is never shown
|
|
22
|
+
- Refactored command dispatch into `configCommand.js` / `modelCommand.js`, and extracted a shared `bar.js` and a context-scoped `cache.js`. No behavior change
|
|
23
|
+
- Hardcoded `glm-4.7` fallback remains as a defensive guard against `data/models.json` I/O failure
|
|
24
|
+
|
|
3
25
|
## 1.2.0
|
|
4
26
|
|
|
5
27
|
- Added interactive TUI configuration: `glm-quota-line configure` — live preview, per-component toggle and style, global options
|
package/README.en.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<h1 align="center">glm-quota-line</h1>
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
-
A Zhipu GLM Coding Plan quota monitor built for Claude Code
|
|
4
|
+
A Zhipu GLM Coding Plan quota monitor built for Claude Code<br>
|
|
5
|
+
<strong>Focus on coding without switching windows to check your quota</strong>
|
|
5
6
|
</p>
|
|
6
7
|
|
|
7
8
|
<p align="center">
|
|
@@ -15,20 +16,25 @@
|
|
|
15
16
|
<a href="./README.md">简体中文</a>
|
|
16
17
|
</p>
|
|
17
18
|
|
|
18
|
-
##
|
|
19
|
+
## Core Value
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
- **Claude Code status line** — auto-embeds in the status bar after install, shows quota balance, reset time, and context window usage in real time
|
|
22
|
-
- **Bar visualization** — default bar style shows remaining quota at a glance; weekly quota shows theoretical budget shadow
|
|
23
|
-
- **Weekly pacing analysis** — calculates usage speed based on work days, auto-highlights when exceeding theoretical budget
|
|
24
|
-
- **JSON output** — `--json` flag outputs structured data for scripting
|
|
25
|
-
- **Interactive configuration** — `glm-quota-line configure` launches a TUI with live preview and per-component controls
|
|
26
|
-
- **Component-level control** — each display component (plan, 5h, week, reset, context) can be individually toggled and styled
|
|
27
|
-
- **Smart caching** — tiered refresh by session, TTL, and token usage; `SessionStart` hook pre-refreshes so new sessions never show stale data
|
|
28
|
-
- **Domestic + international endpoints** — auto-detects `open.bigmodel.cn` and `api.z.ai`
|
|
29
|
-
- **Zero dependencies** — no runtime deps, single-purpose CLI
|
|
21
|
+
**Accurate data from official site** → **Real-time status bar display** → **Smart pacing alerts**
|
|
30
22
|
|
|
31
|
-
|
|
23
|
+
After installation, the quota appears automatically in the Claude Code status bar:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
GLM Lite █████████░ 91% | W ▒▒▒▒░░░░░ 47% 11:10 | 14:47 | ctx ███░░░ 45% (glm-4.7/200K)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**See at a glance**:
|
|
30
|
+
- Plan remaining quota (91%) with progress bar
|
|
31
|
+
- Weekly quota consumption (47%) + theoretical budget shadow (▒)
|
|
32
|
+
- Time until reset (14:47)
|
|
33
|
+
- Context window usage (45%)
|
|
34
|
+
|
|
35
|
+
Auto-color alerts when pacing exceeds budget, preventing workflow interruption.
|
|
36
|
+
|
|
37
|
+
## 30-Second Quick Start
|
|
32
38
|
|
|
33
39
|
**One-time query (no install needed):**
|
|
34
40
|
|
|
@@ -36,20 +42,14 @@
|
|
|
36
42
|
npx glm-quota-line
|
|
37
43
|
```
|
|
38
44
|
|
|
39
|
-
**Status line integration (
|
|
45
|
+
**Status line integration (recommended):**
|
|
40
46
|
|
|
41
47
|
```bash
|
|
42
48
|
npm install -g glm-quota-line
|
|
43
49
|
glm-quota-line install
|
|
44
50
|
```
|
|
45
51
|
|
|
46
|
-
Done.
|
|
47
|
-
|
|
48
|
-
```
|
|
49
|
-
GLM Lite █████████░ 91% | W ▒▒▒▒░░░░░ 47% | 14:47 | ctx ███░░░ 45% (glm-4.7/200K)
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
You can also run `glm-quota-line` directly in the terminal to check your quota without launching Claude Code.
|
|
52
|
+
Done. You can run `glm-quota-line` anytime in the terminal to check usage without launching Claude Code.
|
|
53
53
|
|
|
54
54
|
Upgrade:
|
|
55
55
|
|
|
@@ -58,73 +58,41 @@ npm install -g glm-quota-line
|
|
|
58
58
|
glm-quota-line check-update
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
##
|
|
62
|
-
|
|
63
|
-
All options are optional. Persist with `glm-quota-line config set`, or override per-invocation with CLI flags.
|
|
61
|
+
## Common Workflows
|
|
64
62
|
|
|
65
|
-
###
|
|
66
|
-
|
|
67
|
-
| Value | Description | Example |
|
|
68
|
-
|---|---|---|
|
|
69
|
-
| `bar` (default) | Progress bar | `GLM Lite █████████░ 91% \| W ▒▒▒▒░░░░░ 47% \| 14:47 \| ctx ███░░░ 45%` |
|
|
70
|
-
| `text` | Full text | `GLM Lite \| 5h 91% \| week 47% \| reset 14:47 \| ctx 45%` |
|
|
71
|
-
| `compact` | Compact mode | `GLM 5h 91% W 47% \| 14:47` |
|
|
63
|
+
### 📊 Quick quota check
|
|
72
64
|
|
|
73
65
|
```bash
|
|
74
|
-
glm-quota-line
|
|
66
|
+
glm-quota-line
|
|
75
67
|
```
|
|
76
68
|
|
|
77
|
-
###
|
|
69
|
+
### 🎨 Customize status bar style
|
|
78
70
|
|
|
79
|
-
|
|
80
|
-
|---|---|
|
|
81
|
-
| `dark` (default) | Dark terminal, light pine-green accents |
|
|
82
|
-
| `light` | White/light terminal, teal-blue accents |
|
|
83
|
-
| `mono` | Grayscale, minimal distraction |
|
|
71
|
+
**Recommended**: Use interactive configuration with live preview
|
|
84
72
|
|
|
85
73
|
```bash
|
|
86
|
-
glm-quota-line
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
Quota percentage colors change automatically based on remaining amount:
|
|
90
|
-
|
|
91
|
-
- Green — remaining >= 60%
|
|
92
|
-
- Yellow — remaining 30%–60%
|
|
93
|
-
- Red — remaining < 30%
|
|
94
|
-
|
|
95
|
-
### display — Quota metric
|
|
96
|
-
|
|
97
|
-
| Value | Description |
|
|
98
|
-
|---|---|
|
|
99
|
-
| `left` (default) | Show remaining quota (bar fills with remaining) |
|
|
100
|
-
| `used` | Show used quota (bar fills with used) |
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
glm-quota-line config set display used
|
|
74
|
+
glm-quota-line configure
|
|
104
75
|
```
|
|
105
76
|
|
|
106
|
-
|
|
77
|
+
For manual configuration, see [Quick Customization](#quick-customization)
|
|
107
78
|
|
|
108
|
-
|
|
79
|
+
### 🤖 Change model or adjust context window
|
|
109
80
|
|
|
110
81
|
```bash
|
|
111
|
-
|
|
82
|
+
# When Zhipu releases a new model, no need to wait for npm updates — write the local overlay immediately:
|
|
83
|
+
glm-quota-line model set glm-5.3 400K
|
|
84
|
+
# View all models and their context window sizes
|
|
85
|
+
glm-quota-line model list
|
|
112
86
|
```
|
|
113
87
|
|
|
114
|
-
|
|
115
|
-
- Green — usage speed ≤ 1.1x theoretical
|
|
116
|
-
- Yellow — usage speed 1.1x–1.3x theoretical
|
|
117
|
-
- Red — usage speed > 1.3x theoretical
|
|
118
|
-
|
|
119
|
-
### --json — JSON output
|
|
120
|
-
|
|
121
|
-
Output structured JSON format (terminal mode only, ignored in status line mode):
|
|
88
|
+
### 🔧 Script integration
|
|
122
89
|
|
|
123
90
|
```bash
|
|
124
91
|
glm-quota-line --json
|
|
125
92
|
```
|
|
126
93
|
|
|
127
|
-
|
|
94
|
+
Outputs structured JSON data:
|
|
95
|
+
|
|
128
96
|
```json
|
|
129
97
|
{
|
|
130
98
|
"level": "Lite",
|
|
@@ -134,12 +102,6 @@ Example output:
|
|
|
134
102
|
"leftPercent": 91,
|
|
135
103
|
"usedPercent": 9,
|
|
136
104
|
"nextResetTime": 1715257200000
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
"label": "week",
|
|
140
|
-
"leftPercent": 47,
|
|
141
|
-
"usedPercent": 53,
|
|
142
|
-
"nextResetTime": 1715744400000
|
|
143
105
|
}
|
|
144
106
|
],
|
|
145
107
|
"mcp": {
|
|
@@ -149,29 +111,83 @@ Example output:
|
|
|
149
111
|
}
|
|
150
112
|
```
|
|
151
113
|
|
|
152
|
-
###
|
|
114
|
+
### ⚠️ Quota exhausted or display issues
|
|
153
115
|
|
|
154
|
-
|
|
116
|
+
See [Troubleshooting](#troubleshooting)
|
|
117
|
+
|
|
118
|
+
## Quick Customization
|
|
119
|
+
|
|
120
|
+
### Recommended: Interactive configuration
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
glm-quota-line configure # Live preview, WYSIWYG
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**Key bindings**:
|
|
127
|
+
- `↑↓` select component, `Enter` to edit, `Tab` to cycle style, `Space` to toggle
|
|
128
|
+
- `g` for global options (theme, display mode, minimalist, raw-values, reset format)
|
|
129
|
+
- `s` to save, `q` to quit
|
|
130
|
+
|
|
131
|
+
### Common config (non-interactive)
|
|
132
|
+
|
|
133
|
+
#### Style & theme
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
glm-quota-line config set style compact # Compact mode
|
|
137
|
+
glm-quota-line config set theme light # Light theme
|
|
138
|
+
glm-quota-line config set theme mono # Grayscale minimal
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**Style comparison**:
|
|
142
|
+
|
|
143
|
+
| Style | Description | Example |
|
|
144
|
+
|---|---|---|
|
|
145
|
+
| `bar` (default) | Progress bar | `GLM Lite █████████░ 91% \| W ▒▒▒▒░░░░░ 47% 11:10 \| 14:47 \| ctx ███░░░ 45%` |
|
|
146
|
+
| `text` | Full text | `GLM Lite \| 5h 91% \| week 47% 11:10 \| reset 14:47 \| ctx 45%` |
|
|
147
|
+
| `compact` | Compact mode | `GLM 5h 91% W 47% 11:10 \| 14:47` |
|
|
148
|
+
|
|
149
|
+
#### Display options
|
|
155
150
|
|
|
156
151
|
```bash
|
|
157
|
-
glm-quota-line config set
|
|
152
|
+
glm-quota-line config set display used # Show used instead of remaining
|
|
153
|
+
glm-quota-line config set reset-format countdown # Countdown mode (e.g., reset 52m)
|
|
154
|
+
glm-quota-line config set minimalist true # Hide label text
|
|
158
155
|
```
|
|
159
156
|
|
|
160
|
-
|
|
161
|
-
- Off: `GLM Lite █████████░ 91% | W ▒▒▒▒░░░░░ 47% | 14:47`
|
|
162
|
-
- On: `█████████░ 91% | ▒▒▒▒░░░░░ 47% | 14:47`
|
|
157
|
+
**Color logic**:
|
|
163
158
|
|
|
164
|
-
|
|
159
|
+
Quota percentage auto-colors based on remaining amount:
|
|
160
|
+
- 🟢 Green — remaining >= 60%
|
|
161
|
+
- 🟡 Yellow — remaining 30%–60%
|
|
162
|
+
- 🔴 Red — remaining < 30%
|
|
165
163
|
|
|
166
|
-
|
|
164
|
+
Pacing analysis auto-colors based on usage speed:
|
|
165
|
+
- 🟢 Green — usage speed ≤ 1.1x theoretical
|
|
166
|
+
- 🟡 Yellow — usage speed 1.1x–1.3x theoretical
|
|
167
|
+
- 🔴 Red — usage speed > 1.3x theoretical
|
|
168
|
+
|
|
169
|
+
<details>
|
|
170
|
+
<summary><b>Advanced configuration options</b> (click to expand)</summary>
|
|
171
|
+
|
|
172
|
+
### Work days setting
|
|
173
|
+
|
|
174
|
+
Set the number of work days per week (1–7) for weekly quota theoretical budget and pacing analysis. Default: 5.
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
glm-quota-line config set work-days 6
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Raw values mode
|
|
181
|
+
|
|
182
|
+
Display raw values directly, without percentages.
|
|
167
183
|
|
|
168
184
|
```bash
|
|
169
185
|
glm-quota-line config set raw-values true
|
|
170
186
|
```
|
|
171
187
|
|
|
172
|
-
###
|
|
188
|
+
### Custom authentication
|
|
173
189
|
|
|
174
|
-
If Claude Code runs behind a gateway or proxy
|
|
190
|
+
If Claude Code runs behind a gateway or proxy, you can override auth credentials:
|
|
175
191
|
|
|
176
192
|
```bash
|
|
177
193
|
glm-quota-line config set auth-token <your-real-token>
|
|
@@ -182,26 +198,91 @@ glm-quota-line config set base-url https://api.z.ai/api/anthropic
|
|
|
182
198
|
|
|
183
199
|
Clear with `glm-quota-line config unset auth-token` / `base-url`.
|
|
184
200
|
|
|
185
|
-
Auth
|
|
186
|
-
|
|
201
|
+
**Auth priority** (highest to lowest):
|
|
187
202
|
1. Values persisted via `config set`
|
|
188
203
|
2. Environment variables `ANTHROPIC_AUTH_TOKEN` / `ANTHROPIC_BASE_URL`
|
|
189
204
|
3. `env` field in `~/.claude/settings.json`
|
|
190
205
|
|
|
191
|
-
###
|
|
206
|
+
### Factory reset
|
|
192
207
|
|
|
193
|
-
|
|
208
|
+
One-shot reset of user config. Install state is preserved (status line/hook not removed).
|
|
194
209
|
|
|
195
210
|
```bash
|
|
196
|
-
glm-quota-line
|
|
211
|
+
glm-quota-line config reset # Reset all user config (interactive confirm)
|
|
212
|
+
glm-quota-line config reset --models # Reset only custom model mappings (modelMap)
|
|
213
|
+
glm-quota-line config reset --yes # Skip confirmation (scripts/CI)
|
|
197
214
|
```
|
|
198
215
|
|
|
199
|
-
|
|
200
|
-
-
|
|
201
|
-
-
|
|
202
|
-
-
|
|
216
|
+
- Default scope: all global config, component layout, custom model mappings
|
|
217
|
+
- `--models` limits reset to modelMap only; other config untouched
|
|
218
|
+
- Non-interactive sessions (no TTY) require `--yes` or error out
|
|
219
|
+
- After reset, status line still works — model mappings fall back to bundled defaults
|
|
220
|
+
|
|
221
|
+
</details>
|
|
222
|
+
|
|
223
|
+
## Advanced Features
|
|
224
|
+
|
|
225
|
+
<details>
|
|
226
|
+
<summary><b>Model mapping management</b> (new model support)</summary>
|
|
227
|
+
|
|
228
|
+
Manage context window size mapping per model. Context window usage percentage is computed from this mapping.
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
glm-quota-line model list # List all models and their context window size
|
|
232
|
+
glm-quota-line model get <model-id> # Show the size of a given model
|
|
233
|
+
glm-quota-line model set <model-id> <size> # Set model size (e.g., 300K or 300000)
|
|
234
|
+
glm-quota-line model remove <model-id> # Remove custom mapping (built-in reverts to default)
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
**Example `list` output**:
|
|
238
|
+
|
|
239
|
+
```
|
|
240
|
+
glm-4.5-air 128K
|
|
241
|
+
glm-4.7 200K
|
|
242
|
+
glm-5-turbo 200K
|
|
243
|
+
glm-5.2 1M *
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
The `*` marker indicates a user-configured mapping.
|
|
247
|
+
|
|
248
|
+
**Two-layer design**:
|
|
249
|
+
- Bundled `data/models.json` as default base
|
|
250
|
+
- `modelMap` in `~/.claude/glm-quota-line.json` as user overlay (merged key-by-key at runtime)
|
|
251
|
+
|
|
252
|
+
**Advantage**: When Zhipu releases a new model, no need to wait for npm package updates — just run `model set <new-model> <size>` to write the local overlay and it takes effect immediately.
|
|
253
|
+
|
|
254
|
+
To clear all custom model mappings and return to bundled defaults: `glm-quota-line config reset --models --yes`.
|
|
255
|
+
|
|
256
|
+
</details>
|
|
257
|
+
|
|
258
|
+
<details>
|
|
259
|
+
<summary><b>Agent / Automation interface</b></summary>
|
|
260
|
+
|
|
261
|
+
If you are an AI agent (Claude Code / Cursor / Codex) or script author, the following interface is guaranteed stable:
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
# Get full machine-readable schema of all commands in one call
|
|
265
|
+
glm-quota-line commands --json
|
|
266
|
+
|
|
267
|
+
# Focused help for a single command or command group
|
|
268
|
+
glm-quota-line model --help
|
|
269
|
+
glm-quota-line config set --help
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
**Conventions**:
|
|
273
|
+
- **Exit codes**: `0` on success, `1` on error
|
|
274
|
+
- **Side-effect tags**: Each command tagged `read` (safe for automation), `write` (persists config/model map), `mutating` (modifies Claude Code integration), or `interactive` (requires TTY)
|
|
275
|
+
- **Non-blocking**: No command blocks waiting for input
|
|
276
|
+
- **Read query**: `glm-quota-line --json` emits structured quota data
|
|
277
|
+
|
|
278
|
+
Typical agent workflow: Run `commands --json` to discover capabilities → invoke command → parse stdout.
|
|
279
|
+
|
|
280
|
+
</details>
|
|
203
281
|
|
|
204
|
-
|
|
282
|
+
<details>
|
|
283
|
+
<summary><b>Component-level control</b></summary>
|
|
284
|
+
|
|
285
|
+
Through component mode in `glm-quota-line configure`, each display component can be individually toggled and styled. See [Quick Customization](#quick-customization) for key bindings; component capabilities:
|
|
205
286
|
|
|
206
287
|
| Component | Description | Styleable | Hideable |
|
|
207
288
|
|---|---|---|---|
|
|
@@ -211,18 +292,55 @@ Components:
|
|
|
211
292
|
| `reset` | Reset time | — | ✓ |
|
|
212
293
|
| `ctx` | Context window usage | ✓ (bar/text) | ✓ |
|
|
213
294
|
|
|
214
|
-
|
|
295
|
+
</details>
|
|
296
|
+
|
|
297
|
+
## Troubleshooting
|
|
298
|
+
|
|
299
|
+
### Quota not displaying
|
|
300
|
+
|
|
301
|
+
**Possible causes**:
|
|
302
|
+
1. Auth info missing or expired
|
|
303
|
+
2. Non-GLM provider (endpoint not `open.bigmodel.cn` or `api.z.ai`)
|
|
304
|
+
3. Network connection issues
|
|
305
|
+
|
|
306
|
+
**Solutions**:
|
|
307
|
+
```bash
|
|
308
|
+
# Check auth status
|
|
309
|
+
glm-quota-line
|
|
310
|
+
|
|
311
|
+
# If shows "auth expired", update auth info
|
|
312
|
+
glm-quota-line config set auth-token <your-token>
|
|
313
|
+
glm-quota-line config set base-url https://open.bigmodel.cn/api/anthropic
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### Shows "quota unavailable"
|
|
317
|
+
|
|
318
|
+
**Possible causes**:
|
|
319
|
+
- Zhipu API interface issues
|
|
320
|
+
- Network connection problems
|
|
321
|
+
|
|
322
|
+
**Solutions**:
|
|
323
|
+
- Retry later (tool auto-retries)
|
|
324
|
+
- Check network connection
|
|
325
|
+
- If persistent, may be Zhipu service issues
|
|
326
|
+
|
|
327
|
+
### Install/uninstall issues
|
|
215
328
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
329
|
+
**Status bar not updating**:
|
|
330
|
+
```bash
|
|
331
|
+
glm-quota-line uninstall
|
|
332
|
+
glm-quota-line install --force
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
`install --force` backs up previous config; `uninstall` restores when possible.
|
|
336
|
+
|
|
337
|
+
### Debug mode
|
|
338
|
+
|
|
339
|
+
Set `GLM_QUOTA_DEBUG=1` to output context window debug info to stderr:
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
GLM_QUOTA_DEBUG=1 glm-quota-line
|
|
343
|
+
```
|
|
226
344
|
|
|
227
345
|
## Command Reference
|
|
228
346
|
|
|
@@ -234,23 +352,27 @@ glm-quota-line version
|
|
|
234
352
|
glm-quota-line check-update
|
|
235
353
|
glm-quota-line configure
|
|
236
354
|
glm-quota-line config show
|
|
237
|
-
glm-quota-line config set <style|display|theme|auth-token|base-url|work-days|minimalist|raw-values> <value>
|
|
355
|
+
glm-quota-line config set <style|display|theme|auth-token|base-url|work-days|minimalist|raw-values|reset-format> <value>
|
|
238
356
|
glm-quota-line config unset <key>
|
|
357
|
+
glm-quota-line config reset [--models] [--yes]
|
|
358
|
+
glm-quota-line model list
|
|
359
|
+
glm-quota-line model get <model-id>
|
|
360
|
+
glm-quota-line model set <model-id> <size>
|
|
361
|
+
glm-quota-line model remove <model-id>
|
|
362
|
+
glm-quota-line commands --json
|
|
239
363
|
```
|
|
240
364
|
|
|
241
365
|
Run `glm-quota-line --help` for full descriptions.
|
|
242
366
|
|
|
243
|
-
## Notes
|
|
367
|
+
## Technical Notes
|
|
244
368
|
|
|
245
369
|
- Shows `TOKENS_LIMIT` and `MCP_LIMIT` / `TIME_LIMIT` quotas
|
|
246
|
-
- Weekly quota progress bar shadow (▒) is
|
|
247
|
-
- Context window usage
|
|
248
|
-
-
|
|
249
|
-
-
|
|
250
|
-
-
|
|
251
|
-
-
|
|
252
|
-
- `install --force` backs up the previous entry; `uninstall` restores it when possible
|
|
253
|
-
- Set `GLM_QUOTA_DEBUG=1` to output context window debug info to stderr
|
|
370
|
+
- Weekly quota progress bar shadow (▒) is the daily pacing baseline: theoretical budget based on elapsed work days
|
|
371
|
+
- Context window usage computed from raw tokens using local model map; falls back to API-provided percentage when mapping unavailable
|
|
372
|
+
- Smart caching: tiered refresh by session, TTL, and token usage; `SessionStart` hook pre-refreshes so new sessions never show stale data
|
|
373
|
+
- Auto-detects domestic (`open.bigmodel.cn`) and international (`api.z.ai`) endpoints
|
|
374
|
+
- Non-GLM providers automatically disable quota queries
|
|
375
|
+
- Zero runtime dependencies
|
|
254
376
|
|
|
255
377
|
## License
|
|
256
378
|
|