@yakumoryo/minimax-plan-usage 0.2.3 → 0.2.5
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/commands/usage-query.md
CHANGED
package/package.json
CHANGED
package/query.js
CHANGED
|
@@ -74,7 +74,15 @@ function setup(token) {
|
|
|
74
74
|
function queryUsage() {
|
|
75
75
|
return new Promise((resolve, reject) => {
|
|
76
76
|
const apiUrl = `${API_HOST}/v1/api/openplatform/coding_plan/remains`;
|
|
77
|
-
|
|
77
|
+
let authToken = process.env.ANTHROPIC_AUTH_TOKEN;
|
|
78
|
+
|
|
79
|
+
// Fallback to settings.json if env var not set
|
|
80
|
+
if (!authToken) {
|
|
81
|
+
try {
|
|
82
|
+
const settings = JSON.parse(readFileSync(SETTINGS_PATH, 'utf-8'));
|
|
83
|
+
authToken = settings.env?.ANTHROPIC_AUTH_TOKEN;
|
|
84
|
+
} catch {}
|
|
85
|
+
}
|
|
78
86
|
|
|
79
87
|
if (!authToken) {
|
|
80
88
|
return reject(new Error('ANTHROPIC_AUTH_TOKEN not set. Run: npx @yakumoryo/minimax-plan-usage setup <token>'));
|
|
@@ -69,7 +69,7 @@ const queryUsage = () => {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
const m = json.model_remains[0];
|
|
72
|
-
const remaining = m.
|
|
72
|
+
const remaining = m.current_interval_remaining_count;
|
|
73
73
|
const total = m.current_interval_total_count;
|
|
74
74
|
const used = total - remaining;
|
|
75
75
|
const percentage = Math.round((used / total) * 100);
|
|
@@ -87,7 +87,7 @@ const queryUsage = () => {
|
|
|
87
87
|
minute: '2-digit',
|
|
88
88
|
});
|
|
89
89
|
|
|
90
|
-
const weeklyRemaining = m.
|
|
90
|
+
const weeklyRemaining = m.current_weekly_remaining_count;
|
|
91
91
|
const weeklyTotal = m.current_weekly_total_count;
|
|
92
92
|
const weeklyUsed = weeklyTotal - weeklyRemaining;
|
|
93
93
|
const weeklyPercentage = Math.floor((weeklyUsed / weeklyTotal) * 100);
|