@hashimkarim/usagestat-linux-x64-gnu 2.0.0-alpha.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/LICENSE +57744 -0
- package/native-manifest.json +1414 -0
- package/package.json +254 -0
- package/plugins/abacus-ai/icon.svg +18 -0
- package/plugins/abacus-ai/plugin.js +121 -0
- package/plugins/abacus-ai/plugin.json +17 -0
- package/plugins/alibaba/icon-color.svg +1 -0
- package/plugins/alibaba/icon.svg +1 -0
- package/plugins/alibaba/plugin.js +322 -0
- package/plugins/alibaba/plugin.json +20 -0
- package/plugins/alibaba-token-plan/icon-color.svg +1 -0
- package/plugins/alibaba-token-plan/icon.svg +1 -0
- package/plugins/alibaba-token-plan/plugin.js +544 -0
- package/plugins/alibaba-token-plan/plugin.json +19 -0
- package/plugins/amp/icon-color.svg +1 -0
- package/plugins/amp/icon-conflict.svg +6 -0
- package/plugins/amp/icon.svg +1 -0
- package/plugins/amp/plugin.js +175 -0
- package/plugins/amp/plugin.json +16 -0
- package/plugins/antigravity/icon-color.svg +1 -0
- package/plugins/antigravity/icon-conflict.svg +3 -0
- package/plugins/antigravity/icon.svg +1 -0
- package/plugins/antigravity/plugin.js +739 -0
- package/plugins/antigravity/plugin.json +31 -0
- package/plugins/antigravity-cli/icon.svg +3 -0
- package/plugins/antigravity-cli/plugin.js +570 -0
- package/plugins/antigravity-cli/plugin.json +16 -0
- package/plugins/antigravity-ide/icon.svg +3 -0
- package/plugins/antigravity-ide/plugin.js +257 -0
- package/plugins/antigravity-ide/plugin.json +29 -0
- package/plugins/augment/icon.svg +14 -0
- package/plugins/augment/plugin.js +59 -0
- package/plugins/augment/plugin.json +18 -0
- package/plugins/aws-bedrock/icon-color.svg +1 -0
- package/plugins/aws-bedrock/icon.svg +1 -0
- package/plugins/aws-bedrock/plugin.js +206 -0
- package/plugins/aws-bedrock/plugin.json +18 -0
- package/plugins/azure-openai/icon-color.svg +1 -0
- package/plugins/azure-openai/icon.svg +1 -0
- package/plugins/azure-openai/plugin.js +145 -0
- package/plugins/azure-openai/plugin.json +17 -0
- package/plugins/chutes/icon.svg +7 -0
- package/plugins/chutes/plugin.js +236 -0
- package/plugins/chutes/plugin.json +19 -0
- package/plugins/claude/icon-color.svg +1 -0
- package/plugins/claude/icon.svg +1 -0
- package/plugins/claude/plugin.js +1723 -0
- package/plugins/claude/plugin.json +30 -0
- package/plugins/codebuff/icon.svg +92 -0
- package/plugins/codebuff/plugin.js +113 -0
- package/plugins/codebuff/plugin.json +17 -0
- package/plugins/codex/icon-color.svg +5 -0
- package/plugins/codex/icon.svg +1 -0
- package/plugins/codex/plugin.js +1009 -0
- package/plugins/codex/plugin.json +82 -0
- package/plugins/command-code/icon.svg +3 -0
- package/plugins/command-code/plugin.js +184 -0
- package/plugins/command-code/plugin.json +20 -0
- package/plugins/copilot/icon-color.svg +1 -0
- package/plugins/copilot/icon.svg +1 -0
- package/plugins/copilot/plugin.js +684 -0
- package/plugins/copilot/plugin.json +21 -0
- package/plugins/crof/icon.svg +3 -0
- package/plugins/crof/plugin.js +53 -0
- package/plugins/crof/plugin.json +17 -0
- package/plugins/crofai/icon.svg +16 -0
- package/plugins/crofai/plugin.js +81 -0
- package/plugins/crofai/plugin.json +18 -0
- package/plugins/cursor/icon-conflict.svg +3 -0
- package/plugins/cursor/icon.svg +1 -0
- package/plugins/cursor/plugin.js +1379 -0
- package/plugins/cursor/plugin.json +23 -0
- package/plugins/cursor-nightly/icon.png +0 -0
- package/plugins/cursor-nightly/plugin.js +1379 -0
- package/plugins/cursor-nightly/plugin.json +23 -0
- package/plugins/deepgram/icon.svg +1 -0
- package/plugins/deepgram/plugin.js +20 -0
- package/plugins/deepgram/plugin.json +17 -0
- package/plugins/deepseek/icon-color.svg +1 -0
- package/plugins/deepseek/icon.svg +1 -0
- package/plugins/deepseek/plugin.js +71 -0
- package/plugins/deepseek/plugin.json +17 -0
- package/plugins/devin/icon.svg +5 -0
- package/plugins/devin/plugin.js +341 -0
- package/plugins/devin/plugin.json +16 -0
- package/plugins/doubao/icon-color.svg +1 -0
- package/plugins/doubao/icon.svg +1 -0
- package/plugins/doubao/plugin.js +92 -0
- package/plugins/doubao/plugin.json +17 -0
- package/plugins/droid/icon.svg +1 -0
- package/plugins/droid/plugin.json +20 -0
- package/plugins/elevenlabs/icon.svg +4 -0
- package/plugins/elevenlabs/plugin.js +48 -0
- package/plugins/elevenlabs/plugin.json +18 -0
- package/plugins/factory/icon-conflict.svg +1 -0
- package/plugins/factory/icon.svg +1 -0
- package/plugins/factory/plugin.js +487 -0
- package/plugins/factory/plugin.json +15 -0
- package/plugins/fireworks-ai/icon.svg +6 -0
- package/plugins/fireworks-ai/plugin.js +370 -0
- package/plugins/fireworks-ai/plugin.json +19 -0
- package/plugins/gemini/icon-color.svg +1 -0
- package/plugins/gemini/icon.svg +1 -0
- package/plugins/gemini/plugin.js +460 -0
- package/plugins/gemini/plugin.json +16 -0
- package/plugins/grok/icon.svg +1 -0
- package/plugins/grok/plugin.js +297 -0
- package/plugins/grok/plugin.json +19 -0
- package/plugins/groqcloud/icon.svg +1 -0
- package/plugins/groqcloud/plugin.js +117 -0
- package/plugins/groqcloud/plugin.json +19 -0
- package/plugins/jetbrains-ai-assistant/icon-color.svg +14 -0
- package/plugins/jetbrains-ai-assistant/icon-conflict.svg +3 -0
- package/plugins/jetbrains-ai-assistant/icon.svg +14 -0
- package/plugins/jetbrains-ai-assistant/plugin.js +313 -0
- package/plugins/jetbrains-ai-assistant/plugin.json +16 -0
- package/plugins/kilo/icon.svg +1 -0
- package/plugins/kilo/plugin.js +111 -0
- package/plugins/kilo/plugin.json +19 -0
- package/plugins/kimi/icon-color.svg +1 -0
- package/plugins/kimi/icon-conflict.svg +3 -0
- package/plugins/kimi/icon.svg +1 -0
- package/plugins/kimi/plugin.js +358 -0
- package/plugins/kimi/plugin.json +15 -0
- package/plugins/kimi-k2/icon-color.svg +1 -0
- package/plugins/kimi-k2/icon.svg +1 -0
- package/plugins/kimi-k2/plugin.js +58 -0
- package/plugins/kimi-k2/plugin.json +18 -0
- package/plugins/kiro/icon-color.svg +5 -0
- package/plugins/kiro/icon-conflict.svg +1 -0
- package/plugins/kiro/icon.svg +4 -0
- package/plugins/kiro/plugin.js +390 -0
- package/plugins/kiro/plugin.json +16 -0
- package/plugins/litellm/icon.svg +16 -0
- package/plugins/litellm/plugin.js +199 -0
- package/plugins/litellm/plugin.json +16 -0
- package/plugins/llm-proxy/icon.svg +1 -0
- package/plugins/llm-proxy/plugin.js +40 -0
- package/plugins/llm-proxy/plugin.json +17 -0
- package/plugins/manus/icon.svg +6 -0
- package/plugins/manus/plugin.js +50 -0
- package/plugins/manus/plugin.json +17 -0
- package/plugins/mimo/icon.svg +1 -0
- package/plugins/mimo/plugin.js +177 -0
- package/plugins/mimo/plugin.json +19 -0
- package/plugins/minimax/icon-color.svg +1 -0
- package/plugins/minimax/icon-conflict.svg +4 -0
- package/plugins/minimax/icon.svg +1 -0
- package/plugins/minimax/plugin.js +453 -0
- package/plugins/minimax/plugin.json +14 -0
- package/plugins/mistral/icon-color.svg +1 -0
- package/plugins/mistral/icon.svg +1 -0
- package/plugins/mistral/plugin.js +152 -0
- package/plugins/mistral/plugin.json +18 -0
- package/plugins/moonshot/icon.svg +1 -0
- package/plugins/moonshot/plugin.js +43 -0
- package/plugins/moonshot/plugin.json +16 -0
- package/plugins/nanogpt/icon-color.svg +17 -0
- package/plugins/nanogpt/icon.svg +10 -0
- package/plugins/nanogpt/plugin.js +80 -0
- package/plugins/nanogpt/plugin.json +17 -0
- package/plugins/neuralwatt/icon.svg +3 -0
- package/plugins/neuralwatt/plugin.js +152 -0
- package/plugins/neuralwatt/plugin.json +17 -0
- package/plugins/ollama/icon.svg +1 -0
- package/plugins/ollama/plugin.js +92 -0
- package/plugins/ollama/plugin.json +20 -0
- package/plugins/openai-api/icon.svg +1 -0
- package/plugins/openai-api/plugin.js +533 -0
- package/plugins/openai-api/plugin.json +26 -0
- package/plugins/opencode/icon.svg +1 -0
- package/plugins/opencode/plugin.js +342 -0
- package/plugins/opencode/plugin.json +19 -0
- package/plugins/opencode-go/icon-conflict.svg +1 -0
- package/plugins/opencode-go/icon.svg +1 -0
- package/plugins/opencode-go/plugin.js +617 -0
- package/plugins/opencode-go/plugin.json +50 -0
- package/plugins/openrouter/icon.svg +1 -0
- package/plugins/openrouter/plugin.js +156 -0
- package/plugins/openrouter/plugin.json +8 -0
- package/plugins/perplexity/icon-color.svg +1 -0
- package/plugins/perplexity/icon-conflict.svg +1 -0
- package/plugins/perplexity/icon.svg +1 -0
- package/plugins/perplexity/plugin.js +425 -0
- package/plugins/perplexity/plugin.json +19 -0
- package/plugins/poe/icon.svg +1 -0
- package/plugins/poe/plugin.js +190 -0
- package/plugins/poe/plugin.json +19 -0
- package/plugins/stepfun/icon-color.svg +1 -0
- package/plugins/stepfun/icon.svg +1 -0
- package/plugins/stepfun/plugin.js +155 -0
- package/plugins/stepfun/plugin.json +18 -0
- package/plugins/synthetic/icon-conflict.svg +12 -0
- package/plugins/synthetic/icon.svg +14 -0
- package/plugins/synthetic/plugin.js +331 -0
- package/plugins/synthetic/plugin.json +23 -0
- package/plugins/t3chat/icon-color.svg +28 -0
- package/plugins/t3chat/icon.svg +4 -0
- package/plugins/t3chat/plugin.js +243 -0
- package/plugins/t3chat/plugin.json +20 -0
- package/plugins/venice/icon-color.svg +1 -0
- package/plugins/venice/icon.svg +1 -0
- package/plugins/venice/plugin.js +69 -0
- package/plugins/venice/plugin.json +16 -0
- package/plugins/vertex-ai/icon-color.svg +1 -0
- package/plugins/vertex-ai/icon.svg +1 -0
- package/plugins/vertex-ai/plugin.js +172 -0
- package/plugins/vertex-ai/plugin.json +18 -0
- package/plugins/warp/icon-color.svg +10 -0
- package/plugins/warp/icon.svg +6 -0
- package/plugins/warp/plugin.js +108 -0
- package/plugins/warp/plugin.json +18 -0
- package/plugins/windsurf/icon-conflict.svg +3 -0
- package/plugins/windsurf/icon.svg +1 -0
- package/plugins/windsurf/plugin.js +208 -0
- package/plugins/windsurf/plugin.json +16 -0
- package/plugins/zai/icon-conflict.svg +5 -0
- package/plugins/zai/icon.svg +1 -0
- package/plugins/zai/plugin.js +188 -0
- package/plugins/zai/plugin.json +16 -0
- package/plugins/zed/icon.svg +4 -0
- package/plugins/zed/plugin.js +270 -0
- package/plugins/zed/plugin.json +19 -0
- package/usagestat +0 -0
- package/usagestatd +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"id": "claude",
|
|
4
|
+
"name": "Claude",
|
|
5
|
+
"version": "0.0.1",
|
|
6
|
+
"entry": "plugin.js",
|
|
7
|
+
"icon": "icon.svg",
|
|
8
|
+
"brandColor": "#DE7356",
|
|
9
|
+
"links": [
|
|
10
|
+
{ "label": "Status", "url": "https://status.anthropic.com/" },
|
|
11
|
+
{ "label": "Console", "url": "https://console.anthropic.com/" }
|
|
12
|
+
],
|
|
13
|
+
"supportedModes": ["oauth", "web", "local", "api"],
|
|
14
|
+
"autoMode": "oauth",
|
|
15
|
+
"webUrl": "https://claude.ai",
|
|
16
|
+
"usageDashboardUrl": "https://claude.ai/settings/usage",
|
|
17
|
+
"lines": [
|
|
18
|
+
{ "type": "progress", "label": "Session", "scope": "overview", "primaryOrder": 1 },
|
|
19
|
+
{ "type": "progress", "label": "Weekly", "scope": "overview", "primaryOrder": 2 },
|
|
20
|
+
{ "type": "progress", "label": "Sonnet", "scope": "detail" },
|
|
21
|
+
{ "type": "progress", "label": "Opus", "scope": "detail" },
|
|
22
|
+
{ "type": "progress", "label": "Routines", "scope": "detail" },
|
|
23
|
+
{ "type": "text", "label": "Extra usage spent", "scope": "overview", "primaryOrder": 3 },
|
|
24
|
+
{ "type": "text", "label": "API Spend", "scope": "overview", "primaryOrder": 4 },
|
|
25
|
+
{ "type": "text", "label": "Today", "scope": "detail" },
|
|
26
|
+
{ "type": "text", "label": "Yesterday", "scope": "detail" },
|
|
27
|
+
{ "type": "text", "label": "Last 30 Days", "scope": "detail" },
|
|
28
|
+
{ "type": "barChart", "label": "Usage Trend", "scope": "detail" }
|
|
29
|
+
]
|
|
30
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0.00 0.00 128.00 128.00">
|
|
4
|
+
<g stroke-width="2.00" fill="none" stroke-linecap="butt">
|
|
5
|
+
<path stroke="currentColor" vector-effect="non-scaling-stroke" d="
|
|
6
|
+
M 27.46 27.54
|
|
7
|
+
C 23.31 31.70 16.50 34.46 10.57 34.99
|
|
8
|
+
Q 10.24 35.02 10.04 35.39
|
|
9
|
+
Q 9.90 35.65 9.90 36.04
|
|
10
|
+
Q 9.90 36.43 10.04 36.69
|
|
11
|
+
Q 10.24 37.06 10.57 37.09
|
|
12
|
+
C 16.50 37.62 23.31 40.38 27.46 44.54
|
|
13
|
+
C 31.62 48.69 34.38 55.50 34.91 61.43
|
|
14
|
+
Q 34.94 61.76 35.31 61.97
|
|
15
|
+
Q 35.57 62.11 35.96 62.11
|
|
16
|
+
Q 36.36 62.11 36.62 61.97
|
|
17
|
+
Q 36.98 61.76 37.02 61.43
|
|
18
|
+
C 37.54 55.50 40.31 48.69 44.46 44.54
|
|
19
|
+
C 48.62 40.38 55.43 37.62 61.36 37.09
|
|
20
|
+
Q 61.69 37.06 61.89 36.69
|
|
21
|
+
Q 62.03 36.43 62.03 36.04
|
|
22
|
+
Q 62.03 35.65 61.89 35.39
|
|
23
|
+
Q 61.69 35.02 61.36 34.99
|
|
24
|
+
C 55.43 34.46 48.62 31.70 44.46 27.54
|
|
25
|
+
C 40.31 23.38 37.54 16.58 37.02 10.65
|
|
26
|
+
Q 36.98 10.32 36.62 10.11
|
|
27
|
+
Q 36.36 9.97 35.96 9.97
|
|
28
|
+
Q 35.57 9.97 35.31 10.11
|
|
29
|
+
Q 34.94 10.32 34.91 10.65
|
|
30
|
+
C 34.38 16.58 31.62 23.38 27.46 27.54"
|
|
31
|
+
/>
|
|
32
|
+
<path stroke="currentColor" vector-effect="non-scaling-stroke" d="
|
|
33
|
+
M 103.9557 64.7548
|
|
34
|
+
A 0.70 0.70 0.0 0 0 103.2569 64.0536
|
|
35
|
+
L 64.7970 63.9864
|
|
36
|
+
A 0.70 0.70 0.0 0 0 64.0958 64.6852
|
|
37
|
+
L 64.0843 75.2652
|
|
38
|
+
A 0.70 0.70 0.0 0 0 64.7831 75.9664
|
|
39
|
+
L 103.2430 76.0336
|
|
40
|
+
A 0.70 0.70 0.0 0 0 103.9442 75.3348
|
|
41
|
+
L 103.9557 64.7548"
|
|
42
|
+
/>
|
|
43
|
+
</g>
|
|
44
|
+
<path fill="currentColor" d="
|
|
45
|
+
M 113.99 0.00
|
|
46
|
+
Q 125.60 2.32 128.00 13.94
|
|
47
|
+
L 128.00 113.98
|
|
48
|
+
Q 125.72 125.58 114.06 128.00
|
|
49
|
+
L 14.00 128.00
|
|
50
|
+
Q 2.44 125.69 0.00 114.05
|
|
51
|
+
L 0.00 14.01
|
|
52
|
+
Q 2.33 2.42 13.95 0.00
|
|
53
|
+
L 113.99 0.00
|
|
54
|
+
Z
|
|
55
|
+
M 27.46 27.54
|
|
56
|
+
C 23.31 31.70 16.50 34.46 10.57 34.99
|
|
57
|
+
Q 10.24 35.02 10.04 35.39
|
|
58
|
+
Q 9.90 35.65 9.90 36.04
|
|
59
|
+
Q 9.90 36.43 10.04 36.69
|
|
60
|
+
Q 10.24 37.06 10.57 37.09
|
|
61
|
+
C 16.50 37.62 23.31 40.38 27.46 44.54
|
|
62
|
+
C 31.62 48.69 34.38 55.50 34.91 61.43
|
|
63
|
+
Q 34.94 61.76 35.31 61.97
|
|
64
|
+
Q 35.57 62.11 35.96 62.11
|
|
65
|
+
Q 36.36 62.11 36.62 61.97
|
|
66
|
+
Q 36.98 61.76 37.02 61.43
|
|
67
|
+
C 37.54 55.50 40.31 48.69 44.46 44.54
|
|
68
|
+
C 48.62 40.38 55.43 37.62 61.36 37.09
|
|
69
|
+
Q 61.69 37.06 61.89 36.69
|
|
70
|
+
Q 62.03 36.43 62.03 36.04
|
|
71
|
+
Q 62.03 35.65 61.89 35.39
|
|
72
|
+
Q 61.69 35.02 61.36 34.99
|
|
73
|
+
C 55.43 34.46 48.62 31.70 44.46 27.54
|
|
74
|
+
C 40.31 23.38 37.54 16.58 37.02 10.65
|
|
75
|
+
Q 36.98 10.32 36.62 10.11
|
|
76
|
+
Q 36.36 9.97 35.96 9.97
|
|
77
|
+
Q 35.57 9.97 35.31 10.11
|
|
78
|
+
Q 34.94 10.32 34.91 10.65
|
|
79
|
+
C 34.38 16.58 31.62 23.38 27.46 27.54
|
|
80
|
+
Z
|
|
81
|
+
M 103.9557 64.7548
|
|
82
|
+
A 0.70 0.70 0.0 0 0 103.2569 64.0536
|
|
83
|
+
L 64.7970 63.9864
|
|
84
|
+
A 0.70 0.70 0.0 0 0 64.0958 64.6852
|
|
85
|
+
L 64.0843 75.2652
|
|
86
|
+
A 0.70 0.70 0.0 0 0 64.7831 75.9664
|
|
87
|
+
L 103.2430 76.0336
|
|
88
|
+
A 0.70 0.70 0.0 0 0 103.9442 75.3348
|
|
89
|
+
L 103.9557 64.7548
|
|
90
|
+
Z"
|
|
91
|
+
/>
|
|
92
|
+
</svg>
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
(function () {
|
|
2
|
+
var API_BASE = "https://www.codebuff.com";
|
|
3
|
+
var CRED_PATHS = [
|
|
4
|
+
"~/.config/manicode/credentials.json",
|
|
5
|
+
];
|
|
6
|
+
|
|
7
|
+
function loadApiKey(ctx) {
|
|
8
|
+
var v = ctx.host.env.get("CODEBUFF_API_KEY");
|
|
9
|
+
if (typeof v === "string" && v.trim()) return v.trim();
|
|
10
|
+
|
|
11
|
+
for (var i = 0; i < CRED_PATHS.length; i++) {
|
|
12
|
+
try {
|
|
13
|
+
if (!ctx.host.fs.exists(CRED_PATHS[i])) continue;
|
|
14
|
+
var json = ctx.util.tryParseJson(ctx.host.fs.readText(CRED_PATHS[i]));
|
|
15
|
+
if (!json) continue;
|
|
16
|
+
var keys = ["apiKey", "api_key", "token", "accessToken", "access_token"];
|
|
17
|
+
for (var j = 0; j < keys.length; j++) {
|
|
18
|
+
var t = json[keys[j]];
|
|
19
|
+
if (typeof t === "string" && t.trim()) return t.trim();
|
|
20
|
+
}
|
|
21
|
+
} catch (e) {
|
|
22
|
+
ctx.host.log.warn("codebuff: failed to read credentials: " + e);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function numberAt(obj, keys) {
|
|
29
|
+
for (var i = 0; i < keys.length; i++) {
|
|
30
|
+
var v = obj && obj[keys[i]];
|
|
31
|
+
if (typeof v === "number") return v;
|
|
32
|
+
if (typeof v === "string") { var n = parseFloat(v); if (!isNaN(n)) return n; }
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function strAt(obj, keys) {
|
|
38
|
+
for (var i = 0; i < keys.length; i++) {
|
|
39
|
+
if (obj && typeof obj[keys[i]] === "string") return obj[keys[i]];
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function probe(ctx) {
|
|
45
|
+
var apiKey = loadApiKey(ctx);
|
|
46
|
+
if (!apiKey) {
|
|
47
|
+
throw "Codebuff API key not found. Set CODEBUFF_API_KEY or sign in with Codebuff/Manicode.";
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
var usageResult = ctx.util.requestJson({
|
|
51
|
+
method: "POST",
|
|
52
|
+
url: API_BASE + "/api/v1/usage",
|
|
53
|
+
headers: {
|
|
54
|
+
Authorization: "Bearer " + apiKey,
|
|
55
|
+
"Content-Type": "application/json",
|
|
56
|
+
Accept: "application/json",
|
|
57
|
+
},
|
|
58
|
+
bodyText: JSON.stringify({ fingerprintId: "usagestat-probe" }),
|
|
59
|
+
timeoutMs: 30000,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
if (ctx.util.isAuthStatus(usageResult.resp.status)) {
|
|
63
|
+
throw "Codebuff API key invalid or expired.";
|
|
64
|
+
}
|
|
65
|
+
if (usageResult.resp.status < 200 || usageResult.resp.status >= 300) {
|
|
66
|
+
throw "Codebuff API error (HTTP " + usageResult.resp.status + ").";
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
var usage = usageResult.json || {};
|
|
70
|
+
var usageData = usage.data || usage;
|
|
71
|
+
|
|
72
|
+
var subResult = ctx.util.requestJson({
|
|
73
|
+
method: "GET",
|
|
74
|
+
url: API_BASE + "/api/user/subscription",
|
|
75
|
+
headers: { Authorization: "Bearer " + apiKey, Accept: "application/json" },
|
|
76
|
+
timeoutMs: 10000,
|
|
77
|
+
});
|
|
78
|
+
var sub = (subResult.json && (subResult.json.data || subResult.json)) || null;
|
|
79
|
+
|
|
80
|
+
var used = numberAt(usageData, ["usage", "used"]) || 0;
|
|
81
|
+
var remaining = numberAt(usageData, ["remainingBalance", "remaining"]);
|
|
82
|
+
var total = numberAt(usageData, ["creditsTotal", "quota", "limit"]);
|
|
83
|
+
if (total === null && remaining !== null) total = used + remaining;
|
|
84
|
+
|
|
85
|
+
var pct = total && total > 0 ? Math.min(100, used / total * 100) : (remaining !== null ? 100 : 0);
|
|
86
|
+
|
|
87
|
+
var lines = [];
|
|
88
|
+
var progressOpts = {
|
|
89
|
+
label: "Credits",
|
|
90
|
+
used: pct,
|
|
91
|
+
limit: 100,
|
|
92
|
+
format: { kind: "percent" },
|
|
93
|
+
};
|
|
94
|
+
var resetAt = strAt(usageData, ["next_quota_reset", "nextQuotaReset"]);
|
|
95
|
+
if (resetAt) { var iso = ctx.util.toIso(resetAt); if (iso) progressOpts.resetsAt = iso; }
|
|
96
|
+
lines.push(ctx.line.progress(progressOpts));
|
|
97
|
+
|
|
98
|
+
var detail = total !== null
|
|
99
|
+
? (used.toFixed(0) + "/" + total.toFixed(0) + " credits")
|
|
100
|
+
: (remaining !== null ? remaining.toFixed(0) + " credits remaining" : null);
|
|
101
|
+
if (detail) lines.push(ctx.line.text({ label: "Usage", value: detail }));
|
|
102
|
+
|
|
103
|
+
var plan = null;
|
|
104
|
+
if (sub) {
|
|
105
|
+
var subObj = sub.subscription || sub;
|
|
106
|
+
plan = strAt(subObj, ["displayName", "display_name", "scheduledTier", "scheduled_tier", "tier"]);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return { plan: plan, lines: lines };
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
globalThis.__openusage_plugin = { id: "codebuff", probe: probe };
|
|
113
|
+
})();
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"id": "codebuff",
|
|
4
|
+
"name": "Codebuff",
|
|
5
|
+
"version": "0.0.1",
|
|
6
|
+
"entry": "plugin.js",
|
|
7
|
+
"brandColor": "#7C3AED",
|
|
8
|
+
"links": [
|
|
9
|
+
{ "label": "Usage", "url": "https://www.codebuff.com/usage" }
|
|
10
|
+
],
|
|
11
|
+
"supportedModes": ["api", "local"],
|
|
12
|
+
"autoMode": "local",
|
|
13
|
+
"lines": [
|
|
14
|
+
{ "type": "progress", "label": "Credits", "scope": "overview", "primaryOrder": 1 },
|
|
15
|
+
{ "type": "text", "label": "Usage", "scope": "detail" }
|
|
16
|
+
]
|
|
17
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<title>Codex</title>
|
|
3
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z" fill="url(#lobe-icons-codex-_R_0_)"></path>
|
|
4
|
+
<defs><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-codex-_R_0_" x1="12" x2="12" y1="0" y2="24"><stop stop-color="#B1A7FF"></stop><stop offset=".5" stop-color="#7A9DFF"></stop><stop offset="1" stop-color="#3941FF"></stop></linearGradient></defs>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Codex</title><path clip-rule="evenodd" d="M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z"></path></svg>
|