@ekworp/opencode-mystatus 0.0.0-stage → 1.2.8
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/LICENSE +21 -0
- package/README.md +240 -2
- package/README.zh-CN.md +239 -0
- package/command/mystatus.md +5 -0
- package/dist/plugin/lib/config.d.ts +6 -0
- package/dist/plugin/lib/config.js +29 -0
- package/dist/plugin/lib/copilot.d.ts +20 -0
- package/dist/plugin/lib/copilot.d.ts.map +1 -0
- package/dist/plugin/lib/copilot.js +346 -0
- package/dist/plugin/lib/deepseek.d.ts +3 -0
- package/dist/plugin/lib/deepseek.js +46 -0
- package/dist/plugin/lib/google.d.ts +14 -0
- package/dist/plugin/lib/google.d.ts.map +1 -0
- package/dist/plugin/lib/google.js +265 -0
- package/dist/plugin/lib/i18n.d.ts +111 -0
- package/dist/plugin/lib/i18n.d.ts.map +1 -0
- package/dist/plugin/lib/i18n.js +176 -0
- package/dist/plugin/lib/openai.d.ts +16 -0
- package/dist/plugin/lib/openai.d.ts.map +1 -0
- package/dist/plugin/lib/openai.js +161 -0
- package/dist/plugin/lib/opencode-auth.d.ts +9 -0
- package/dist/plugin/lib/opencode-auth.js +48 -0
- package/dist/plugin/lib/types.d.ts +97 -0
- package/dist/plugin/lib/types.d.ts.map +1 -0
- package/dist/plugin/lib/types.js +13 -0
- package/dist/plugin/lib/utils.d.ts +43 -0
- package/dist/plugin/lib/utils.d.ts.map +1 -0
- package/dist/plugin/lib/utils.js +115 -0
- package/dist/plugin/lib/zhipu.d.ts +22 -0
- package/dist/plugin/lib/zhipu.d.ts.map +1 -0
- package/dist/plugin/lib/zhipu.js +134 -0
- package/dist/plugin/mystatus.d.ts +11 -0
- package/dist/plugin/mystatus.d.ts.map +1 -0
- package/dist/plugin/mystatus.js +126 -0
- package/package.json +67 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 javazys
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,241 @@
|
|
|
1
|
-
#
|
|
1
|
+
# opencode-mystatus
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@ekworp/opencode-mystatus)
|
|
4
|
+
[](https://www.npmjs.com/package/@ekworp/opencode-mystatus)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
An [OpenCode](https://opencode.ai) plugin to query account quota usage for multiple AI platforms.
|
|
8
|
+
|
|
9
|
+
[中文文档](./README.zh-CN.md)
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
## Supported Platforms
|
|
14
|
+
|
|
15
|
+
| Platform | Account Type | Data Source |
|
|
16
|
+
| ------------ | ----------------- | ---------------------------------------------- |
|
|
17
|
+
| OpenAI | Plus / Team / Pro | `~/.local/share/opencode/opencode.db` |
|
|
18
|
+
| Zhipu AI | Coding Plan | `~/.local/share/opencode/opencode.db` |
|
|
19
|
+
| Z.ai | Coding Plan | `~/.local/share/opencode/opencode.db` |
|
|
20
|
+
| DeepSeek | API balance | `~/.local/share/opencode/opencode.db` |
|
|
21
|
+
| GitHub Copilot | Individual / Business | `~/.local/share/opencode/opencode.db` |
|
|
22
|
+
| Google Cloud | Antigravity | `~/.config/opencode/antigravity-accounts.json` |
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
### Let an LLM do it
|
|
27
|
+
|
|
28
|
+
Paste this into any LLM agent (Claude Code, OpenCode, Cursor, etc.):
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
Install the opencode-mystatus plugin by following: https://raw.githubusercontent.com/vbgate/opencode-mystatus/main/README.md
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
<details>
|
|
35
|
+
<summary><b>Instructions for LLM agents</b></summary>
|
|
36
|
+
|
|
37
|
+
To install this plugin, perform these steps:
|
|
38
|
+
|
|
39
|
+
1. Add `"@ekworp/opencode-mystatus"` to the `plugins` array in `~/.config/opencode/opencode.json`:
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"$schema": "https://opencode.ai/config.json",
|
|
44
|
+
"plugins": ["@ekworp/opencode-mystatus"]
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
2. Optionally copy `command/mystatus.md` to `~/.config/opencode/commands/` to enable `/mystatus`.
|
|
49
|
+
|
|
50
|
+
3. Restart OpenCode.
|
|
51
|
+
|
|
52
|
+
</details>
|
|
53
|
+
|
|
54
|
+
### Manual Installation
|
|
55
|
+
|
|
56
|
+
1. Add the plugin and slash command to your `~/.config/opencode/opencode.json`:
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"$schema": "https://opencode.ai/config.json",
|
|
61
|
+
"plugins": ["@ekworp/opencode-mystatus"]
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
2. Optionally copy `command/mystatus.md` to `~/.config/opencode/commands/` to enable `/mystatus`.
|
|
66
|
+
3. Restart OpenCode
|
|
67
|
+
|
|
68
|
+
### From Local Files
|
|
69
|
+
|
|
70
|
+
Copy the plugin files to your project's OpenCode directory:
|
|
71
|
+
|
|
72
|
+
1. Copy `plugin/mystatus.ts` and `plugin/lib/` to `.opencode/plugins/`
|
|
73
|
+
2. Install the project dependencies with `pnpm install`.
|
|
74
|
+
3. Optionally copy `command/mystatus.md` to `.opencode/commands/` to enable `/mystatus`.
|
|
75
|
+
4. Restart OpenCode
|
|
76
|
+
|
|
77
|
+
### GitHub Release
|
|
78
|
+
|
|
79
|
+
Every `v*` tag publishes a single-file V2 plugin build to GitHub Releases:
|
|
80
|
+
|
|
81
|
+
```text
|
|
82
|
+
https://github.com/ekworp/opencode-mystatus/releases/latest/download/opencode-mystatus.js
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Download the file to `.opencode/plugins/mystatus.js` before starting OpenCode. The
|
|
86
|
+
release file still expects OpenCode V2 to provide `@opencode/plugin`.
|
|
87
|
+
|
|
88
|
+
## Usage
|
|
89
|
+
|
|
90
|
+
### Option 1: Slash Command
|
|
91
|
+
|
|
92
|
+
Use the `/mystatus` command to get complete quota information:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
/mystatus
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Option 2: Natural Language
|
|
99
|
+
|
|
100
|
+
Simply ask in natural language, for example:
|
|
101
|
+
|
|
102
|
+
- "Check my OpenAI quota"
|
|
103
|
+
- "How much Codex quota do I have left?"
|
|
104
|
+
- "Show my AI account status"
|
|
105
|
+
|
|
106
|
+
OpenCode will automatically use the mystatus tool to answer your question.
|
|
107
|
+
|
|
108
|
+
## Output Example
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
## OpenAI Account Quota
|
|
112
|
+
|
|
113
|
+
Account: user@example.com (team)
|
|
114
|
+
|
|
115
|
+
3-hour limit
|
|
116
|
+
██████████████████████████████ 85% remaining
|
|
117
|
+
Resets in: 2h 30m
|
|
118
|
+
|
|
119
|
+
## Zhipu AI Account Quota
|
|
120
|
+
|
|
121
|
+
Account: 9c89****AQVM (Coding Plan)
|
|
122
|
+
|
|
123
|
+
5-hour token limit
|
|
124
|
+
██████████████████████████████ 95% remaining
|
|
125
|
+
Used: 0.5M / 10.0M
|
|
126
|
+
Resets in: 4h
|
|
127
|
+
|
|
128
|
+
## Z.ai Account Quota
|
|
129
|
+
|
|
130
|
+
Account: 9c89****AQVM (Z.ai)
|
|
131
|
+
|
|
132
|
+
5-hour token limit
|
|
133
|
+
██████████████████████████████ 95% remaining
|
|
134
|
+
Used: 0.5M / 10.0M
|
|
135
|
+
Resets in: 4h
|
|
136
|
+
|
|
137
|
+
## GitHub Copilot Account Quota
|
|
138
|
+
|
|
139
|
+
Account: GitHub Copilot (individual)
|
|
140
|
+
|
|
141
|
+
Premium ████░░░░░░░░░░░░░░░░ 24% (229/300)
|
|
142
|
+
|
|
143
|
+
Quota resets: 19d 0h (2026-02-01)
|
|
144
|
+
|
|
145
|
+
## Google Cloud Account Quota
|
|
146
|
+
|
|
147
|
+
### user@gmail.com
|
|
148
|
+
|
|
149
|
+
G3 Pro 4h 59m ████████████████████ 100%
|
|
150
|
+
G3 Image 4h 59m ████████████████████ 100%
|
|
151
|
+
G3 Flash 4h 59m ████████████████████ 100%
|
|
152
|
+
Claude 2d 9h ░░░░░░░░░░░░░░░░░░░░ 0%
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Features
|
|
156
|
+
|
|
157
|
+
- Query quota usage across multiple AI platforms in one command
|
|
158
|
+
- Visual progress bars showing remaining quota
|
|
159
|
+
- Reset time countdown
|
|
160
|
+
- Multi-language support (Chinese / English)
|
|
161
|
+
- Multiple Google Cloud accounts support
|
|
162
|
+
- API key masking for security
|
|
163
|
+
|
|
164
|
+
## Configuration
|
|
165
|
+
|
|
166
|
+
No additional configuration required. The plugin automatically reads credentials from:
|
|
167
|
+
|
|
168
|
+
- **OpenAI, Zhipu AI, Z.ai, DeepSeek & GitHub Copilot**: `~/.local/share/opencode/opencode.db`
|
|
169
|
+
- **Google Cloud**: `~/.config/opencode/antigravity-accounts.json`
|
|
170
|
+
|
|
171
|
+
### Disable providers
|
|
172
|
+
|
|
173
|
+
Create `~/.config/opencode/mystatus.json` to skip selected providers:
|
|
174
|
+
|
|
175
|
+
```json
|
|
176
|
+
{
|
|
177
|
+
"disabledProviders": ["deepseek", "google"]
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Available names: `openai`, `zhipuai-coding-plan`, `zai-coding-plan`, `deepseek`, `google`, `github-copilot`.
|
|
182
|
+
|
|
183
|
+
### Google Cloud Setup
|
|
184
|
+
|
|
185
|
+
To query Google Cloud (Antigravity) account quota, you need to install the [opencode-antigravity-auth](https://github.com/NoeFabris/opencode-antigravity-auth) plugin first to authenticate your Google account.
|
|
186
|
+
|
|
187
|
+
## Security
|
|
188
|
+
|
|
189
|
+
This plugin is safe to use:
|
|
190
|
+
|
|
191
|
+
**Local Files Accessed (read-only):**
|
|
192
|
+
|
|
193
|
+
- `~/.local/share/opencode/opencode.db` - OpenCode V2's official credential storage
|
|
194
|
+
- `~/.config/opencode/antigravity-accounts.json` - Antigravity plugin's account storage
|
|
195
|
+
|
|
196
|
+
**API Endpoints (all official):**
|
|
197
|
+
|
|
198
|
+
- `https://chatgpt.com/backend-api/wham/usage` - OpenAI official quota API
|
|
199
|
+
- `https://bigmodel.cn/api/monitor/usage/quota/limit` - Zhipu AI official quota API
|
|
200
|
+
- `https://api.z.ai/api/monitor/usage/quota/limit` - Z.ai official quota API
|
|
201
|
+
- `https://api.github.com/copilot_internal/user` - GitHub Copilot official API
|
|
202
|
+
- `https://oauth2.googleapis.com/token` - Google official OAuth API
|
|
203
|
+
- `https://cloudcode-pa.googleapis.com/v1internal:fetchAvailableModels` - Google Cloud official API
|
|
204
|
+
|
|
205
|
+
**Privacy:**
|
|
206
|
+
|
|
207
|
+
- No data is stored, uploaded, or cached by this plugin
|
|
208
|
+
- Sensitive information (API keys) is automatically masked in output
|
|
209
|
+
- Source code is fully open for review
|
|
210
|
+
|
|
211
|
+
## Google Cloud Models
|
|
212
|
+
|
|
213
|
+
The plugin displays quota for these models:
|
|
214
|
+
|
|
215
|
+
| Display Name | Model Key |
|
|
216
|
+
| ------------ | ---------------------------------------------- |
|
|
217
|
+
| G3 Pro | `gemini-3-pro-high` / `gemini-3-pro-low` |
|
|
218
|
+
| G3 Image | `gemini-3-pro-image` |
|
|
219
|
+
| G3 Flash | `gemini-3-flash` |
|
|
220
|
+
| Claude | `claude-opus-4-5-thinking` / `claude-opus-4-5` |
|
|
221
|
+
|
|
222
|
+
## Development
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
# Install dependencies
|
|
226
|
+
pnpm install
|
|
227
|
+
|
|
228
|
+
# Check the code
|
|
229
|
+
pnpm run typecheck
|
|
230
|
+
pnpm run lint
|
|
231
|
+
|
|
232
|
+
# Build the TypeScript distribution
|
|
233
|
+
pnpm run build
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Git hooks run the lint and typecheck automatically before commits.
|
|
237
|
+
They are installed by `pnpm install` through Husky.
|
|
238
|
+
|
|
239
|
+
## License
|
|
240
|
+
|
|
241
|
+
MIT
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# opencode-mystatus
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@ekworp/opencode-mystatus)
|
|
4
|
+
[](https://www.npmjs.com/package/@ekworp/opencode-mystatus)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
[OpenCode](https://opencode.ai) 插件,用于查询多个 AI 平台的账号额度使用情况。
|
|
8
|
+
|
|
9
|
+
[English](./README.md)
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
## 支持的平台
|
|
14
|
+
|
|
15
|
+
| 平台 | 账号类型 | 数据来源 |
|
|
16
|
+
| ------------ | ----------------- | ---------------------------------------------- |
|
|
17
|
+
| OpenAI | Plus / Team / Pro | `~/.local/share/opencode/opencode.db` |
|
|
18
|
+
| 智谱 AI | Coding Plan | `~/.local/share/opencode/opencode.db` |
|
|
19
|
+
| Z.ai | Coding Plan | `~/.local/share/opencode/opencode.db` |
|
|
20
|
+
| DeepSeek | API 余额 | `~/.local/share/opencode/opencode.db` |
|
|
21
|
+
| GitHub Copilot | Individual / Business | `~/.local/share/opencode/opencode.db` |
|
|
22
|
+
| Google Cloud | Antigravity | `~/.config/opencode/antigravity-accounts.json` |
|
|
23
|
+
|
|
24
|
+
## 安装
|
|
25
|
+
|
|
26
|
+
### 让 AI 帮你安装
|
|
27
|
+
|
|
28
|
+
将以下内容粘贴到任意 AI 代理(Claude Code、OpenCode、Cursor 等):
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
Install the opencode-mystatus plugin by following: https://raw.githubusercontent.com/vbgate/opencode-mystatus/main/README.md
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
<details>
|
|
35
|
+
<summary><b>AI 代理安装指令</b></summary>
|
|
36
|
+
|
|
37
|
+
安装此插件需要执行以下步骤:
|
|
38
|
+
|
|
39
|
+
1. 在 `~/.config/opencode/opencode.json` 的 `plugins` 数组中添加 `"@ekworp/opencode-mystatus"`:
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"$schema": "https://opencode.ai/config.json",
|
|
44
|
+
"plugins": ["@ekworp/opencode-mystatus"]
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
2. 如需启用 `/mystatus`,将 `command/mystatus.md` 复制到 `~/.config/opencode/commands/`。
|
|
49
|
+
3. 重启 OpenCode。
|
|
50
|
+
|
|
51
|
+
</details>
|
|
52
|
+
|
|
53
|
+
### 手动安装
|
|
54
|
+
|
|
55
|
+
1. 在 `~/.config/opencode/opencode.json` 中添加插件和斜杠命令:
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"$schema": "https://opencode.ai/config.json",
|
|
60
|
+
"plugins": ["@ekworp/opencode-mystatus"]
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
2. 如需启用 `/mystatus`,将 `command/mystatus.md` 复制到 `~/.config/opencode/commands/`。
|
|
65
|
+
3. 重启 OpenCode
|
|
66
|
+
|
|
67
|
+
### 从本地文件安装
|
|
68
|
+
|
|
69
|
+
将插件文件复制到 OpenCode 配置目录:
|
|
70
|
+
|
|
71
|
+
1. 将 `plugin/mystatus.ts` 和 `plugin/lib/` 复制到项目的 `.opencode/plugins/`
|
|
72
|
+
2. 执行 `pnpm install` 安装依赖。
|
|
73
|
+
3. 如需启用 `/mystatus`,将 `command/mystatus.md` 复制到 `.opencode/commands/`。
|
|
74
|
+
4. 重启 OpenCode
|
|
75
|
+
|
|
76
|
+
### GitHub Release
|
|
77
|
+
|
|
78
|
+
每个 `v*` 标签都会在 GitHub Release 中发布单文件 V2 插件:
|
|
79
|
+
|
|
80
|
+
```text
|
|
81
|
+
https://github.com/ekworp/opencode-mystatus/releases/latest/download/opencode-mystatus.js
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
启动 OpenCode 前,将文件下载到项目的 `.opencode/plugins/mystatus.js`。
|
|
85
|
+
该文件依赖 OpenCode V2 提供的 `@opencode/plugin`。
|
|
86
|
+
|
|
87
|
+
## 使用方法
|
|
88
|
+
|
|
89
|
+
### 方式一:斜杠命令
|
|
90
|
+
|
|
91
|
+
使用 `/mystatus` 命令获取完整的额度信息:
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
/mystatus
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 方式二:自然语言
|
|
98
|
+
|
|
99
|
+
直接用自然语言提问,例如:
|
|
100
|
+
|
|
101
|
+
- "帮我查看 Codex 的额度"
|
|
102
|
+
- "我的 OpenAI 还剩多少额度?"
|
|
103
|
+
- "查看 AI 账号状态"
|
|
104
|
+
|
|
105
|
+
OpenCode 会自动调用 mystatus 工具来回答你的问题。
|
|
106
|
+
|
|
107
|
+
## 输出示例
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
## OpenAI 账号额度
|
|
111
|
+
|
|
112
|
+
Account: user@example.com (team)
|
|
113
|
+
|
|
114
|
+
3小时限额
|
|
115
|
+
██████████████████████████████ 剩余 85%
|
|
116
|
+
重置: 2小时30分钟后
|
|
117
|
+
|
|
118
|
+
## 智谱 AI 账号额度
|
|
119
|
+
|
|
120
|
+
Account: 9c89****AQVM (Coding Plan)
|
|
121
|
+
|
|
122
|
+
5 小时 Token 限额
|
|
123
|
+
██████████████████████████████ 剩余 95%
|
|
124
|
+
已用: 0.5M / 10.0M
|
|
125
|
+
重置: 4小时后
|
|
126
|
+
|
|
127
|
+
## Z.ai 账号额度
|
|
128
|
+
|
|
129
|
+
Account: 9c89****AQVM (Z.ai)
|
|
130
|
+
|
|
131
|
+
5 小时 Token 限额
|
|
132
|
+
██████████████████████████████ 剩余 95%
|
|
133
|
+
已用: 0.5M / 10.0M
|
|
134
|
+
重置: 4小时后
|
|
135
|
+
|
|
136
|
+
## GitHub Copilot Account Quota
|
|
137
|
+
|
|
138
|
+
Account: GitHub Copilot (individual)
|
|
139
|
+
|
|
140
|
+
Premium ████░░░░░░░░░░░░░░░░ 24% (229/300)
|
|
141
|
+
|
|
142
|
+
Quota resets: 19d 0h (2026-02-01)
|
|
143
|
+
|
|
144
|
+
## Google Cloud 账号额度
|
|
145
|
+
|
|
146
|
+
### user@gmail.com
|
|
147
|
+
|
|
148
|
+
G3 Pro 4h 59m ████████████████████ 100%
|
|
149
|
+
G3 Image 4h 59m ████████████████████ 100%
|
|
150
|
+
G3 Flash 4h 59m ████████████████████ 100%
|
|
151
|
+
Claude 2d 9h ░░░░░░░░░░░░░░░░░░░░ 0%
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## 功能特性
|
|
155
|
+
|
|
156
|
+
- 一条命令查询多个 AI 平台的额度使用情况
|
|
157
|
+
- 可视化进度条显示剩余额度
|
|
158
|
+
- 重置时间倒计时
|
|
159
|
+
- 多语言支持(中文 / 英文)
|
|
160
|
+
- 支持多个 Google Cloud 账号
|
|
161
|
+
- API Key 脱敏显示,保护安全
|
|
162
|
+
|
|
163
|
+
## 配置
|
|
164
|
+
|
|
165
|
+
插件自动从以下位置读取认证信息:
|
|
166
|
+
|
|
167
|
+
- **OpenAI、智谱 AI、Z.ai、DeepSeek 和 GitHub Copilot**: `~/.local/share/opencode/opencode.db`
|
|
168
|
+
- **Google Cloud**: `~/.config/opencode/antigravity-accounts.json`
|
|
169
|
+
|
|
170
|
+
### 禁用平台
|
|
171
|
+
|
|
172
|
+
可创建 `~/.config/opencode/mystatus.json`,过滤不需要查询的平台:
|
|
173
|
+
|
|
174
|
+
```json
|
|
175
|
+
{
|
|
176
|
+
"disabledProviders": ["deepseek", "google"]
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
可用名称:`openai`、`zhipuai-coding-plan`、`zai-coding-plan`、`deepseek`、`google`、`github-copilot`。
|
|
181
|
+
|
|
182
|
+
### Google Cloud 设置
|
|
183
|
+
|
|
184
|
+
如需查询 Google Cloud (Antigravity) 账号额度,需要先安装 [opencode-antigravity-auth](https://github.com/NoeFabris/opencode-antigravity-auth) 插件来完成 Google 账号认证。
|
|
185
|
+
|
|
186
|
+
## 安全性
|
|
187
|
+
|
|
188
|
+
本插件可以安全放心使用:
|
|
189
|
+
|
|
190
|
+
**读取的本地文件(只读):**
|
|
191
|
+
|
|
192
|
+
- `~/.local/share/opencode/opencode.db` - OpenCode V2 官方认证存储
|
|
193
|
+
- `~/.config/opencode/antigravity-accounts.json` - Antigravity 插件的账号存储
|
|
194
|
+
|
|
195
|
+
**请求的 API 接口(均为官方接口):**
|
|
196
|
+
|
|
197
|
+
- `https://chatgpt.com/backend-api/wham/usage` - OpenAI 官方额度查询接口
|
|
198
|
+
- `https://bigmodel.cn/api/monitor/usage/quota/limit` - 智谱 AI 官方额度查询接口
|
|
199
|
+
- `https://api.z.ai/api/monitor/usage/quota/limit` - Z.ai 官方额度查询接口
|
|
200
|
+
- `https://api.github.com/copilot_internal/user` - GitHub Copilot 官方 API
|
|
201
|
+
- `https://oauth2.googleapis.com/token` - Google 官方 OAuth 接口
|
|
202
|
+
- `https://cloudcode-pa.googleapis.com/v1internal:fetchAvailableModels` - Google Cloud 官方接口
|
|
203
|
+
|
|
204
|
+
**隐私保护:**
|
|
205
|
+
|
|
206
|
+
- 插件不会保存、上传或缓存任何用户数据
|
|
207
|
+
- 敏感信息(API Key)在输出时自动脱敏显示
|
|
208
|
+
- 源代码完全开源,可随时审查
|
|
209
|
+
|
|
210
|
+
## Google Cloud 模型
|
|
211
|
+
|
|
212
|
+
插件显示以下模型的额度:
|
|
213
|
+
|
|
214
|
+
| 显示名称 | 模型 Key |
|
|
215
|
+
| -------- | ---------------------------------------------- |
|
|
216
|
+
| G3 Pro | `gemini-3-pro-high` / `gemini-3-pro-low` |
|
|
217
|
+
| G3 Image | `gemini-3-pro-image` |
|
|
218
|
+
| G3 Flash | `gemini-3-flash` |
|
|
219
|
+
| Claude | `claude-opus-4-5-thinking` / `claude-opus-4-5` |
|
|
220
|
+
|
|
221
|
+
## 开发
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
# 安装依赖
|
|
225
|
+
pnpm install
|
|
226
|
+
|
|
227
|
+
# 检查代码
|
|
228
|
+
pnpm run typecheck
|
|
229
|
+
pnpm run lint
|
|
230
|
+
|
|
231
|
+
# 编译 TypeScript
|
|
232
|
+
pnpm run build
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Git hook 会在提交前自动执行 lint 与类型检查,执行 `pnpm install` 时由 Husky 自动安装。
|
|
236
|
+
|
|
237
|
+
## 许可证
|
|
238
|
+
|
|
239
|
+
MIT
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type ProviderId = "openai" | "zhipuai-coding-plan" | "zai-coding-plan" | "deepseek" | "google" | "github-copilot";
|
|
2
|
+
declare const CONFIG_PATH: string;
|
|
3
|
+
/** Read optional provider filters. Invalid or missing config means enabled all. */
|
|
4
|
+
export declare function readMystatusConfig(): Promise<Set<ProviderId>>;
|
|
5
|
+
export declare function isProviderEnabled(disabledProviders: Set<ProviderId>, provider: ProviderId): boolean;
|
|
6
|
+
export { CONFIG_PATH };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
const CONFIG_PATH = join(homedir(), ".config/opencode/mystatus.json");
|
|
5
|
+
/** Read optional provider filters. Invalid or missing config means enabled all. */
|
|
6
|
+
export async function readMystatusConfig() {
|
|
7
|
+
try {
|
|
8
|
+
const content = await readFile(CONFIG_PATH, "utf8");
|
|
9
|
+
const config = JSON.parse(content);
|
|
10
|
+
if (!Array.isArray(config.disabledProviders))
|
|
11
|
+
return new Set();
|
|
12
|
+
const validProviders = [
|
|
13
|
+
"openai",
|
|
14
|
+
"zhipuai-coding-plan",
|
|
15
|
+
"zai-coding-plan",
|
|
16
|
+
"deepseek",
|
|
17
|
+
"google",
|
|
18
|
+
"github-copilot",
|
|
19
|
+
];
|
|
20
|
+
return new Set(config.disabledProviders.filter((provider) => validProviders.includes(provider)));
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return new Set();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export function isProviderEnabled(disabledProviders, provider) {
|
|
27
|
+
return !disabledProviders.has(provider);
|
|
28
|
+
}
|
|
29
|
+
export { CONFIG_PATH };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub Copilot Premium Requests Quota Module
|
|
3
|
+
*
|
|
4
|
+
* [Input]: GitHub token from ~/.local/share/opencode/auth.json (github-copilot provider)
|
|
5
|
+
* [Output]: Formatted quota usage information with progress bars
|
|
6
|
+
* [Location]: Called by mystatus.ts to handle GitHub Copilot accounts
|
|
7
|
+
* [Sync]: mystatus.ts, types.ts, utils.ts, i18n.ts
|
|
8
|
+
*
|
|
9
|
+
* [Updated]: Jan 2026 - Handle new OpenCode official partnership auth flow
|
|
10
|
+
* The new OAuth tokens (gho_) need to be exchanged for Copilot session tokens
|
|
11
|
+
* before calling the internal quota API.
|
|
12
|
+
*/
|
|
13
|
+
import type { CopilotAuthData, QueryResult } from "./types";
|
|
14
|
+
export type { CopilotAuthData };
|
|
15
|
+
/**
|
|
16
|
+
* Query GitHub Copilot account quota
|
|
17
|
+
* @param authData GitHub Copilot authentication data (optional if using PAT config)
|
|
18
|
+
* @returns Query result, null if no account configured
|
|
19
|
+
*/
|
|
20
|
+
export declare function queryCopilotUsage(authData: CopilotAuthData | undefined): Promise<QueryResult | null>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot.d.ts","sourceRoot":"","sources":["../../../plugin/lib/copilot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,KAAK,EACV,eAAe,EAGf,WAAW,EACZ,MAAM,SAAS,CAAC;AAmcjB,YAAY,EAAE,eAAe,EAAE,CAAC;AAEhC;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,eAAe,GAAG,SAAS,GACpC,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAuC7B"}
|