@miloya/oc-minimax-status 0.3.0 → 0.4.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 +7 -9
  2. package/index.js +15 -18
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -45,15 +45,14 @@ npm install -g @miloya/oc-minimax-status
45
45
 
46
46
  ```json
47
47
  {
48
- "token": "your-api-token",
49
- "groupId": "your-group-id"
48
+ "token": "your-api-token"
50
49
  }
51
50
  ```
52
51
 
53
- ### 如何获取 token 和 groupId
52
+ ### 如何获取 token
54
53
 
55
54
  1. 登录 [https://platform.minimaxi.com/user-center/payment/coding-plan](https://platform.minimaxi.com/user-center/payment/coding-plan)
56
- 2. 获取 API Key 和 Group ID
55
+ 2. 获取 API Key
57
56
 
58
57
  ## 使用方法
59
58
 
@@ -78,7 +77,7 @@ minimax 状态
78
77
  ```
79
78
  minimax_status
80
79
  minimax_auth action=get
81
- minimax_auth action=set token=xxx groupId=xxx
80
+ minimax_auth action=set token=xxx
82
81
  ```
83
82
 
84
83
  ## 输出示例
@@ -109,13 +108,12 @@ MiniMax Coding Plan 用量状态
109
108
  1. 如果已安装 Claude Code 版 minimax-status,配置文件已自动共享,无需重复配置
110
109
  2. 或手动创建 ~/.minimax-config.json:
111
110
  {
112
- "token": "your-api-token",
113
- "groupId": "your-group-id"
111
+ "token": "your-api-token"
114
112
  }
115
113
 
116
- 获取 token 和 groupId:
114
+ 获取 token:
117
115
  1. 登录 https://platform.minimaxi.com/user-center/payment/coding-plan
118
- 2. 获取 API Key 和 Group ID
116
+ 2. 获取 API Key
119
117
  ```
120
118
 
121
119
  ## 相关项目
package/index.js CHANGED
@@ -28,15 +28,14 @@ function getCredentials() {
28
28
  }
29
29
 
30
30
  function saveCredentials(token, groupId) {
31
- const config = { token, groupId };
31
+ const config = { token };
32
32
  fs.writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2));
33
33
  }
34
34
 
35
- async function fetchUsageStatus(token, groupId) {
35
+ async function fetchUsageStatus(token) {
36
36
  const response = await axios.get(
37
37
  "https://www.minimaxi.com/v1/api/openplatform/coding_plan/remains",
38
38
  {
39
- params: { GroupId: groupId },
40
39
  headers: {
41
40
  Authorization: `Bearer ${token}`,
42
41
  Accept: "application/json",
@@ -142,29 +141,28 @@ export const MiniMaxStatusPlugin = async (ctx) => {
142
141
  try {
143
142
  const credentials = getCredentials();
144
143
 
145
- if (!credentials?.token || !credentials?.groupId) {
144
+ if (!credentials?.token) {
146
145
  return `请先配置认证信息!
147
146
 
148
147
  配置方式:
149
148
  1. 如果已安装 Claude Code 版 minimax-status,配置文件已自动共享,无需重复配置
150
149
  2. 或手动创建 ~/.minimax-config.json:
151
150
  {
152
- "token": "your-api-token",
153
- "groupId": "your-group-id"
151
+ "token": "your-api-token"
154
152
  }
155
153
 
156
- 获取 token 和 groupId:
154
+ 获取 token:
157
155
  1. 登录 https://platform.minimaxi.com/user-center/payment/coding-plan
158
- 2. 获取 API Key 和 Group ID`;
156
+ 2. 获取 API Key`;
159
157
  }
160
158
 
161
- const apiData = await fetchUsageStatus(credentials.token, credentials.groupId);
159
+ const apiData = await fetchUsageStatus(credentials.token);
162
160
  const usageData = parseUsageData(apiData);
163
161
 
164
162
  return formatOutput(usageData);
165
163
  } catch (error) {
166
164
  if (error.response?.status === 401) {
167
- return "认证失败,请检查 token 和 groupId 是否正确";
165
+ return "认证失败,请检查 token 是否正确";
168
166
  }
169
167
  if (error.code === "ECONNABORTED") {
170
168
  return "请求超时,请检查网络连接";
@@ -184,19 +182,18 @@ export const MiniMaxStatusPlugin = async (ctx) => {
184
182
  async execute(args, context) {
185
183
  if (args.action === "get") {
186
184
  const creds = getCredentials();
187
- if (!creds || !creds.token || !creds.groupId) {
188
- return "未配置认证信息。请使用 action=set 设置 token 和 groupId";
185
+ if (!creds || !creds.token) {
186
+ return "未配置认证信息。请使用 action=set 设置 token";
189
187
  }
190
188
  return `当前认证信息:
191
- - Token: ${creds.token ? "****" + creds.token.slice(-4) : "未设置"}
192
- - GroupID: ${creds.groupId || "未设置"}`;
189
+ - Token: ${creds.token ? "****" + creds.token.slice(-4) : "未设置"}`;
193
190
  }
194
-
191
+
195
192
  if (args.action === "set") {
196
- if (!args.token || !args.groupId) {
197
- return "设置认证需要提供 token 和 groupId 两个参数";
193
+ if (!args.token) {
194
+ return "设置认证需要提供 token 参数";
198
195
  }
199
- saveCredentials(args.token, args.groupId);
196
+ saveCredentials(args.token, args.groupId || null);
200
197
  return "认证信息已保存到 ~/.minimax-config.json";
201
198
  }
202
199
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miloya/oc-minimax-status",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "MiniMax Coding Plan 用量查询插件 for OpenCode - 一键安装自动配置",
5
5
  "main": "index.js",
6
6
  "type": "module",