@d3ara1n/pi-provider-zhipu-coding-plan 1.0.0 → 1.1.0

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.
Files changed (3) hide show
  1. package/README.md +50 -0
  2. package/index.ts +1 -0
  3. package/package.json +7 -3
package/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # @d3ara1n/pi-provider-zhipu-coding-plan
2
+
3
+ Zhipu AI Coding Plan provider for [Pi Coding Agent](https://pi.dev) — auto-discovers models and reports usage quota.
4
+
5
+ ## Features
6
+
7
+ - **Dynamic model discovery** — fetches available models from Zhipu's `/models` endpoint at startup
8
+ - **Fallback model list** — ships with known GLM model metadata when API is unreachable
9
+ - **Usage quota reporting** — displays token usage percentage and reset countdown in the status bar
10
+ - **No manual config** — reads API key from `~/.pi/agent/auth.json` (set via `/login`)
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ pi install npm:@d3ara1n/pi-provider-zhipu-coding-plan
16
+ ```
17
+
18
+ Also install the status bar display if you want quota visibility:
19
+
20
+ ```bash
21
+ pi install npm:@d3ara1n/pi-usage-block
22
+ ```
23
+
24
+ ## Setup
25
+
26
+ Use `/login` in Pi and select the **zhipu-coding** provider to store your API key.
27
+
28
+ Or manually add to `~/.pi/agent/auth.json`:
29
+
30
+ ```json
31
+ { "zhipu-coding": { "apiKey": "your-key-here" } }
32
+ ```
33
+
34
+ ## Models
35
+
36
+ Supported models include GLM-4.5 through GLM-5.1 series, with vision variants (suffix `v`). Model metadata (context window, max tokens, compatibility flags) is maintained in `KNOWN_MODELS` and updated alongside dynamic discovery.
37
+
38
+ ## Usage Display
39
+
40
+ When paired with `@d3ara1n/pi-usage-block`, the status bar shows:
41
+
42
+ ```
43
+ Zhipu Coding 🟢53% ↺3h34m
44
+ ```
45
+
46
+ - **53%** — token quota consumed (from the TOKENS_LIMIT API)
47
+ - **3h34m** — time until quota resets
48
+ - 🟢/🟡/🔴 — green/yellow/red based on 70%/90% thresholds
49
+
50
+ Lite plan shows one window (5h). Pro plan may show two (5h + weekly).
package/index.ts CHANGED
@@ -147,6 +147,7 @@ function createUsageProvider(): UsageProvider {
147
147
  id: PROVIDER_ID,
148
148
  name: "Zhipu Coding",
149
149
  icon: "⚡",
150
+ source: "api",
150
151
  async fetchUsage(): Promise<UsageWindow[]> {
151
152
  const apiKey = resolveApiKey();
152
153
  if (!apiKey) return [];
package/package.json CHANGED
@@ -1,8 +1,10 @@
1
1
  {
2
2
  "name": "@d3ara1n/pi-provider-zhipu-coding-plan",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Zhipu AI Coding Plan provider for pi — auto-discovers models, reports usage quota",
5
- "keywords": ["pi-package"],
5
+ "keywords": [
6
+ "pi-package"
7
+ ],
6
8
  "main": "index.ts",
7
9
  "dependencies": {
8
10
  "@d3ara1n/pi-usage-block-core": "^1.0.0"
@@ -11,7 +13,9 @@
11
13
  "@earendil-works/pi-coding-agent": "*"
12
14
  },
13
15
  "pi": {
14
- "extensions": ["./index.ts"]
16
+ "extensions": [
17
+ "./index.ts"
18
+ ]
15
19
  },
16
20
  "license": "MIT",
17
21
  "repository": {