@hashimkarim/usagestat-darwin-arm64 2.0.0-alpha.3 → 2.3.2
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/native-manifest.json +1532 -134
- package/package.json +235 -2
- package/plugins/UPSTREAM-LICENSES.md +6 -2
- package/plugins/_provider-icons/LICENSE +21 -0
- package/plugins/_provider-icons/NOTICE +12 -0
- package/plugins/_provider-icons/licenses/CodexBar-MIT.txt +21 -0
- package/plugins/_provider-icons/licenses/LobeHub-MIT.txt +21 -0
- package/plugins/_provider-icons/licenses/UsageStat-Bar-MIT.txt +21 -0
- package/plugins/_provider-icons/manifest.json +1219 -0
- package/plugins/_provider-icons/provenance.json +269 -0
- package/plugins/_provider-icons/source.json +4 -0
- package/plugins/abacus-ai/icon-color.svg +18 -0
- package/plugins/abliteration/LICENSE +21 -0
- package/plugins/abliteration/icon.svg +5 -0
- package/plugins/abliteration/plugin.js +89 -0
- package/plugins/abliteration/plugin.json +24 -0
- package/plugins/aerostack/LICENSE +21 -0
- package/plugins/aerostack/icon.svg +1 -0
- package/plugins/aerostack/plugin.js +94 -0
- package/plugins/aerostack/plugin.json +24 -0
- package/plugins/aixy/LICENSE +21 -0
- package/plugins/aixy/icon.svg +1 -0
- package/plugins/aixy/plugin.js +266 -0
- package/plugins/aixy/plugin.json +32 -0
- package/plugins/antigravity/plugin.js +189 -65
- package/plugins/antigravity-cli/icon-color.svg +1 -0
- package/plugins/antigravity-cli/icon.svg +1 -3
- package/plugins/antigravity-cli/plugin.js +32 -20
- package/plugins/antigravity-ide/icon-color.svg +1 -0
- package/plugins/antigravity-ide/icon.svg +1 -3
- package/plugins/antigravity-ide/plugin.js +19 -7
- package/plugins/atlascloud/LICENSE +21 -0
- package/plugins/atlascloud/icon-color.svg +1 -0
- package/plugins/atlascloud/icon.svg +1 -0
- package/plugins/atlascloud/plugin.js +54 -0
- package/plugins/atlascloud/plugin.json +24 -0
- package/plugins/augment/icon-color.svg +14 -0
- package/plugins/bifrost/LICENSE +21 -0
- package/plugins/bifrost/icon.svg +3 -0
- package/plugins/bifrost/plugin.js +366 -0
- package/plugins/bifrost/plugin.json +31 -0
- package/plugins/chatbox/LICENSE +21 -0
- package/plugins/chatbox/icon.svg +4 -0
- package/plugins/chatbox/plugin.js +208 -0
- package/plugins/chatbox/plugin.json +24 -0
- package/plugins/claude/plugin.js +340 -153
- package/plugins/claude/plugin.json +1 -1
- package/plugins/claudeplatform/LICENSE +21 -0
- package/plugins/claudeplatform/icon.svg +3 -0
- package/plugins/claudeplatform/plugin.js +244 -0
- package/plugins/claudeplatform/plugin.json +25 -0
- package/plugins/clinepass/plugin.js +19 -3
- package/plugins/codebuff/icon-color.svg +92 -0
- package/plugins/coderabbit/plugin.js +25 -0
- package/plugins/coderabbit/plugin.json +12 -0
- package/plugins/codex/plugin.js +15 -8
- package/plugins/codex/plugin.json +11 -2
- package/plugins/command-code/icon-color.svg +3 -0
- package/plugins/command-code/plugin.js +7 -3
- package/plugins/copilot/icon.svg +1 -1
- package/plugins/copilot/plugin.json +1 -0
- package/plugins/cosmic/LICENSE +21 -0
- package/plugins/cosmic/icon.svg +1 -0
- package/plugins/cosmic/plugin.js +134 -0
- package/plugins/cosmic/plugin.json +32 -0
- package/plugins/crof/icon-color.svg +3 -0
- package/plugins/crofai/icon-color.svg +3 -0
- package/plugins/crofai/icon.svg +2 -15
- package/plugins/cursor/icon-color.svg +1 -0
- package/plugins/cursor/plugin.js +51 -14
- package/plugins/cursor-nightly/plugin.json +1 -1
- package/plugins/deepinfra/icon-color.svg +1 -0
- package/plugins/deepinfra/icon.svg +1 -4
- package/plugins/deepseek/plugin.js +150 -59
- package/plugins/deepseek/plugin.json +3 -1
- package/plugins/devin/plugin.js +3 -0
- package/plugins/devpass/LICENSE +21 -0
- package/plugins/devpass/icon.svg +3 -0
- package/plugins/devpass/plugin.js +120 -0
- package/plugins/devpass/plugin.json +24 -0
- package/plugins/elevenlabs/icon-color.svg +4 -0
- package/plugins/exa/LICENSE +21 -0
- package/plugins/exa/icon-color.svg +1 -0
- package/plugins/exa/icon.svg +1 -0
- package/plugins/exa/plugin.js +75 -0
- package/plugins/exa/plugin.json +32 -0
- package/plugins/factory/icon-color.svg +1 -0
- package/plugins/fal/LICENSE +21 -0
- package/plugins/fal/icon-color.svg +1 -0
- package/plugins/fal/icon.svg +1 -0
- package/plugins/fal/plugin.js +74 -0
- package/plugins/fal/plugin.json +24 -0
- package/plugins/fireworks-ai/icon-color.svg +1 -0
- package/plugins/fireworks-ai/icon.svg +1 -6
- package/plugins/flora/LICENSE +21 -0
- package/plugins/flora/icon.svg +4 -0
- package/plugins/flora/plugin.js +93 -0
- package/plugins/flora/plugin.json +32 -0
- package/plugins/futureagi/LICENSE +21 -0
- package/plugins/futureagi/icon.svg +24 -0
- package/plugins/futureagi/plugin.js +139 -0
- package/plugins/futureagi/plugin.json +32 -0
- package/plugins/gemini-apps/LICENSE +21 -0
- package/plugins/gemini-apps/icon-color.svg +1 -0
- package/plugins/gemini-apps/icon.svg +1 -0
- package/plugins/gemini-apps/plugin.js +141 -0
- package/plugins/gemini-apps/plugin.json +25 -0
- package/plugins/gitkraken/LICENSE +21 -0
- package/plugins/gitkraken/icon.svg +2 -0
- package/plugins/gitkraken/plugin.js +158 -0
- package/plugins/gitkraken/plugin.json +32 -0
- package/plugins/googledeveloper/LICENSE +21 -0
- package/plugins/googledeveloper/icon.svg +3 -0
- package/plugins/googledeveloper/plugin.js +204 -0
- package/plugins/googledeveloper/plugin.json +25 -0
- package/plugins/grok/icon-color.svg +1 -0
- package/plugins/groqcloud/icon-color.svg +1 -0
- package/plugins/helmcode/LICENSE +21 -0
- package/plugins/helmcode/icon.svg +5 -0
- package/plugins/helmcode/plugin.js +253 -0
- package/plugins/helmcode/plugin.json +32 -0
- package/plugins/huggingface/LICENSE +21 -0
- package/plugins/huggingface/icon-color.svg +1 -0
- package/plugins/huggingface/icon.svg +1 -0
- package/plugins/huggingface/plugin.js +298 -0
- package/plugins/huggingface/plugin.json +26 -0
- package/plugins/hyper/LICENSE +21 -0
- package/plugins/hyper/plugin.js +137 -0
- package/plugins/hyper/plugin.json +27 -0
- package/plugins/jetbrains-ai-assistant/LICENSE +22 -0
- package/plugins/jetbrains-ai-assistant/plugin.js +502 -16
- package/plugins/jetbrains-ai-assistant/plugin.json +27 -4
- package/plugins/kilo/icon-color.svg +1 -0
- package/plugins/kimi/plugin.js +54 -14
- package/plugins/kimi/plugin.json +46 -6
- package/plugins/langdock/LICENSE +21 -0
- package/plugins/langdock/icon.svg +4 -0
- package/plugins/langdock/plugin.js +106 -0
- package/plugins/langdock/plugin.json +25 -0
- package/plugins/linkup/LICENSE +21 -0
- package/plugins/linkup/icon.svg +10 -0
- package/plugins/linkup/plugin.js +46 -0
- package/plugins/linkup/plugin.json +24 -0
- package/plugins/litellm/plugin.js +54 -3
- package/plugins/lithosai/LICENSE +21 -0
- package/plugins/lithosai/icon.svg +1 -0
- package/plugins/lithosai/plugin.js +130 -0
- package/plugins/lithosai/plugin.json +26 -0
- package/plugins/llmman/LICENSE +21 -0
- package/plugins/llmman/icon.svg +4 -0
- package/plugins/llmman/plugin.js +138 -0
- package/plugins/llmman/plugin.json +31 -0
- package/plugins/longcat/icon-color.svg +1 -0
- package/plugins/longcat/icon.svg +1 -4
- package/plugins/manus/icon-color.svg +6 -0
- package/plugins/mimo/icon-color.svg +4 -0
- package/plugins/mimo/icon.svg +4 -1
- package/plugins/mistral/plugin.js +164 -27
- package/plugins/moonshot/icon-color.svg +1 -0
- package/plugins/munito/LICENSE +21 -0
- package/plugins/munito/icon.svg +7 -0
- package/plugins/munito/plugin.js +171 -0
- package/plugins/munito/plugin.json +24 -0
- package/plugins/muse/LICENSE +21 -0
- package/plugins/muse/icon.svg +3 -0
- package/plugins/muse/plugin.js +288 -0
- package/plugins/muse/plugin.json +34 -0
- package/plugins/museai/LICENSE +21 -0
- package/plugins/museai/icon.svg +3 -0
- package/plugins/museai/plugin.js +161 -0
- package/plugins/museai/plugin.json +26 -0
- package/plugins/nous/LICENSE +21 -0
- package/plugins/nous/icon-color.svg +1 -0
- package/plugins/nous/icon.svg +1 -0
- package/plugins/nous/plugin.js +129 -0
- package/plugins/nous/plugin.json +32 -0
- package/plugins/ollama/icon-color.svg +1 -0
- package/plugins/ollama/plugin.js +58 -0
- package/plugins/openai-api/icon-color.svg +1 -0
- package/plugins/opencode/icon-color.svg +1 -0
- package/plugins/opencode-go/icon-color.svg +1 -0
- package/plugins/opencode-go/plugin.js +104 -37
- package/plugins/opendesign/LICENSE +21 -0
- package/plugins/opendesign/icon.svg +4 -0
- package/plugins/opendesign/plugin.js +108 -0
- package/plugins/opendesign/plugin.json +25 -0
- package/plugins/openrouter/icon-color.svg +1 -0
- package/plugins/parallel/LICENSE +21 -0
- package/plugins/parallel/icon.svg +11 -0
- package/plugins/parallel/plugin.js +97 -0
- package/plugins/parallel/plugin.json +25 -0
- package/plugins/perplexity/LICENSE +22 -0
- package/plugins/perplexity/plugin.js +122 -0
- package/plugins/perplexity/plugin.json +36 -7
- package/plugins/pi/plugin.js +113 -0
- package/plugins/pi/plugin.json +11 -0
- package/plugins/qwencloud/LICENSE +21 -0
- package/plugins/qwencloud/icon-color.svg +1 -0
- package/plugins/qwencloud/icon.svg +1 -4
- package/plugins/qwencloud/plugin.js +197 -0
- package/plugins/qwencloud/plugin.json +17 -0
- package/plugins/raycast/LICENSE +21 -0
- package/plugins/raycast/icon.svg +4 -0
- package/plugins/raycast/plugin.js +179 -0
- package/plugins/raycast/plugin.json +32 -0
- package/plugins/replicate/LICENSE +21 -0
- package/plugins/replicate/icon-color.svg +1 -0
- package/plugins/replicate/icon.svg +1 -0
- package/plugins/replicate/plugin.js +170 -0
- package/plugins/replicate/plugin.json +25 -0
- package/plugins/sailresearch/LICENSE +21 -0
- package/plugins/sailresearch/icon.svg +4 -0
- package/plugins/sailresearch/plugin.js +104 -0
- package/plugins/sailresearch/plugin.json +24 -0
- package/plugins/siliconflow/LICENSE +21 -0
- package/plugins/siliconflow/icon.svg +3 -0
- package/plugins/siliconflow/plugin.js +87 -0
- package/plugins/siliconflow/plugin.json +32 -0
- package/plugins/sofya/LICENSE +21 -0
- package/plugins/sofya/icon.svg +3 -0
- package/plugins/sofya/plugin.js +86 -0
- package/plugins/sofya/plugin.json +24 -0
- package/plugins/soniox/LICENSE +21 -0
- package/plugins/soniox/icon.svg +3 -0
- package/plugins/soniox/plugin.js +103 -0
- package/plugins/soniox/plugin.json +24 -0
- package/plugins/synthetic/icon-color.svg +14 -0
- package/plugins/synthetic/plugin.js +12 -0
- package/plugins/synthetic/plugin.json +51 -9
- package/plugins/tavily/LICENSE +21 -0
- package/plugins/tavily/icon.svg +3 -0
- package/plugins/tavily/plugin.js +61 -0
- package/plugins/tavily/plugin.json +24 -0
- package/plugins/tinyapi/LICENSE +21 -0
- package/plugins/tinyapi/icon.svg +4 -0
- package/plugins/tinyapi/plugin.js +73 -0
- package/plugins/tinyapi/plugin.json +25 -0
- package/plugins/traecn/LICENSE +21 -0
- package/plugins/traecn/icon.svg +3 -0
- package/plugins/traecn/plugin.js +103 -0
- package/plugins/traecn/plugin.json +25 -0
- package/plugins/tripo/LICENSE +21 -0
- package/plugins/tripo/icon.svg +4 -0
- package/plugins/tripo/plugin.js +60 -0
- package/plugins/tripo/plugin.json +24 -0
- package/plugins/typesafe/LICENSE +21 -0
- package/plugins/typesafe/icon.svg +4 -0
- package/plugins/typesafe/plugin.js +181 -0
- package/plugins/typesafe/plugin.json +25 -0
- package/plugins/v0/LICENSE +21 -0
- package/plugins/v0/icon-color.svg +1 -0
- package/plugins/v0/icon.svg +1 -0
- package/plugins/v0/plugin.js +219 -0
- package/plugins/v0/plugin.json +32 -0
- package/plugins/venice/plugin.js +50 -1
- package/plugins/venice/plugin.json +2 -1
- package/plugins/vercel/LICENSE +21 -0
- package/plugins/vercel/icon-color.svg +1 -0
- package/plugins/vercel/icon.svg +1 -0
- package/plugins/vercel/plugin.js +202 -0
- package/plugins/vercel/plugin.json +54 -0
- package/plugins/windsurf/icon-color.svg +1 -0
- package/plugins/workbuddy/LICENSE +21 -0
- package/plugins/workbuddy/icon.svg +1 -0
- package/plugins/workbuddy/plugin.js +318 -0
- package/plugins/workbuddy/plugin.json +63 -0
- package/plugins/xai/icon-color.svg +1 -0
- package/plugins/xai/icon.svg +1 -7
- package/plugins/xai/plugin.js +9 -0
- package/plugins/xapi/LICENSE +21 -0
- package/plugins/xapi/icon.svg +1 -0
- package/plugins/xapi/plugin.js +90 -0
- package/plugins/xapi/plugin.json +25 -0
- package/plugins/xkiro/LICENSE +21 -0
- package/plugins/xkiro/icon.svg +1 -0
- package/plugins/xkiro/plugin.js +104 -0
- package/plugins/xkiro/plugin.json +24 -0
- package/plugins/zai/icon-color.svg +1 -0
- package/plugins/zai/plugin.js +5 -1
- package/plugins/zenmux/icon-color.svg +1 -0
- package/plugins/zenmux/icon.svg +1 -3
- package/usagestat +0 -0
- package/usagestatd +0 -0
- package/plugins/cursor-nightly/plugin.js +0 -1416
package/plugins/venice/plugin.js
CHANGED
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
var API_URL = "https://api.venice.ai/api/v1/billing/balance";
|
|
3
3
|
|
|
4
4
|
function loadApiKey(ctx) {
|
|
5
|
+
if (Object.prototype.hasOwnProperty.call(ctx.provider || {}, 'apiKey')) return ctx.provider.apiKey;
|
|
6
|
+
if (ctx.provider && ctx.provider.instanceId && ctx.provider.instanceId !== 'venice') return null;
|
|
5
7
|
var v = ctx.host.env.get("VENICE_API_KEY");
|
|
6
8
|
if (typeof v === "string" && v.trim()) return v.trim();
|
|
7
9
|
return null;
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
function probe(ctx) {
|
|
13
|
+
if (ctx.sourceMode === 'web') return webUsage(ctx);
|
|
11
14
|
var apiKey = loadApiKey(ctx);
|
|
12
15
|
if (!apiKey) {
|
|
13
16
|
throw "Venice API key not found. Set VENICE_API_KEY.";
|
|
@@ -62,7 +65,53 @@
|
|
|
62
65
|
lines.push(ctx.line.badge({ label: "Balance", text: "No Venice API balance", color: "#a3a3a3" }));
|
|
63
66
|
}
|
|
64
67
|
|
|
65
|
-
return { lines: lines };
|
|
68
|
+
return { source: 'api', lines: lines };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function webUsage(ctx) {
|
|
72
|
+
var provider = ctx.provider || {};
|
|
73
|
+
if (provider.settings && provider.settings.cookies === 'off') throw new Error('Venice web cookies are disabled.');
|
|
74
|
+
var raw = Object.prototype.hasOwnProperty.call(provider, 'cookieHeader') ? provider.cookieHeader :
|
|
75
|
+
provider.instanceId && provider.instanceId !== 'venice' ? '' : ctx.host.env.get('VENICE_COOKIE');
|
|
76
|
+
var cookies = {};
|
|
77
|
+
String(raw || '').replace(/^Cookie:\s*/i, '').split(';').forEach(function(pair) {
|
|
78
|
+
var at = pair.indexOf('='); if (at > 0) cookies[pair.slice(0,at).trim()] = pair.slice(at+1).trim();
|
|
79
|
+
});
|
|
80
|
+
var legacy = '__venice-auth.session-token';
|
|
81
|
+
var token = cookies[legacy];
|
|
82
|
+
var chunks = Object.keys(cookies).filter(function(key){return /^__venice-auth\.session-token\.\d+$/.test(key);});
|
|
83
|
+
if (!token && chunks.length && chunks.every(function(_,i){return cookies[legacy+'.'+i];}))
|
|
84
|
+
token = chunks.map(function(_,i){return cookies[legacy+'.'+i];}).join('');
|
|
85
|
+
var headers = {Accept:'application/json'};
|
|
86
|
+
if (token) headers.Cookie = legacy+'='+token;
|
|
87
|
+
else {
|
|
88
|
+
token = cookies.__session || cookies[Object.keys(cookies).sort().find(function(key){return /^__session_.+/.test(key);})];
|
|
89
|
+
if (!token) throw new Error('Import a fresh Venice session cookie.');
|
|
90
|
+
headers.Authorization = 'Bearer '+token;
|
|
91
|
+
}
|
|
92
|
+
var resp = ctx.host.http.request({method:'GET',url:'https://outerface.venice.ai/api/user/session',headers:headers,timeoutMs:15000});
|
|
93
|
+
if (resp.status === 401 || resp.status === 403) throw new Error('Venice session expired. Reopen venice.ai and import fresh cookies.');
|
|
94
|
+
if (resp.status < 200 || resp.status >= 300) throw new Error('Venice session request failed (HTTP '+resp.status+').');
|
|
95
|
+
var payload = ctx.util.tryParseJson(resp.bodyText);
|
|
96
|
+
var claims = payload && ctx.jwt.decodePayload(payload.token);
|
|
97
|
+
function amount(value) { if (typeof value !== 'number' && typeof value !== 'string' || value === '') return null; var n=Number(value); return Number.isFinite(n)&&n>=0?n:null; }
|
|
98
|
+
var expiry = claims && amount(claims.exp);
|
|
99
|
+
if (!claims || expiry === null || expiry < 1e9 || expiry > 4e9 || expiry*1000 < Date.parse(ctx.nowIso)-60000)
|
|
100
|
+
throw new Error('Venice session expired. Import fresh cookies.');
|
|
101
|
+
if (['anonymous','anon','guest','unauthenticated','logged_out'].includes(String(claims.userType).toLowerCase())) throw new Error('Sign in to Venice.');
|
|
102
|
+
var usage = claims.bundledCreditsUsage || {};
|
|
103
|
+
var used = amount(usage.usedThisCycle), refill = amount(usage.monthlyRefillCredits);
|
|
104
|
+
if (used === null || !(refill > 0)) throw new Error('Venice subscription credits unavailable.');
|
|
105
|
+
var lines = [];
|
|
106
|
+
var available = amount(usage.availableCredits);
|
|
107
|
+
if (available === null) available = amount(claims.bundledCredits);
|
|
108
|
+
[['Subscription credits available',available],['Total credits available',amount(claims.veniceCredits)],['Bank cap',amount(usage.tierCap)]]
|
|
109
|
+
.forEach(function(pair){if(pair[1] !== null) lines.push(ctx.line.text({label:pair[0],value:String(pair[1])}));});
|
|
110
|
+
lines.push(ctx.line.text({label:'Used this cycle',value:String(used),subtitle:'Monthly refill: '+refill}));
|
|
111
|
+
var next = amount(usage.nextRefillAt);
|
|
112
|
+
if (next >= 1e12 && next <= 4e12) lines.push(ctx.line.text({label:'Next refill',value:new Date(next).toISOString()}));
|
|
113
|
+
// A refill is not a spending cap. Banked credits must never appear exhausted.
|
|
114
|
+
return {source:'web',lines:lines};
|
|
66
115
|
}
|
|
67
116
|
|
|
68
117
|
globalThis.__openusage_plugin = { id: "venice", probe: probe };
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"links": [
|
|
9
9
|
{ "label": "API Keys", "url": "https://venice.ai/settings/api" }
|
|
10
10
|
],
|
|
11
|
-
"supportedModes": ["api"],
|
|
11
|
+
"supportedModes": ["api", "web"],
|
|
12
|
+
"webUrl": "https://venice.ai",
|
|
12
13
|
"autoMode": "api",
|
|
13
14
|
"lines": [
|
|
14
15
|
{ "type": "text", "label": "Balance", "scope": "overview" }
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Peter Steinberger
|
|
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.
|
|
@@ -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>Vercel</title><path d="M12 0l12 20.785H0L12 0z"></path></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>Vercel</title><path d="M12 0l12 20.785H0L12 0z"></path></svg>
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
// Generated by tools/vendor-codexbar-providers.cjs; see LICENSE.
|
|
2
|
+
globalThis.__usagestat_bundled_options = {"labels":["Balance","Balance","Additional"],"defaults":{},"autoMode":"api"};
|
|
3
|
+
(function(defineProvider) {
|
|
4
|
+
// BEGIN UPSTREAM Sources/CodexBarCore/Resources/Plugins/vercel.js
|
|
5
|
+
defineProvider({
|
|
6
|
+
id: "vercel",
|
|
7
|
+
name: "Vercel AI Gateway",
|
|
8
|
+
endpoints: ["https://ai-gateway.vercel.sh"],
|
|
9
|
+
auth: { type: "bearer", secret: "AI_GATEWAY_API_KEY" },
|
|
10
|
+
settings: [{ key: "AI_GATEWAY_API_KEY", title: "AI Gateway API key", type: "secure" }],
|
|
11
|
+
capabilities: ["http-status"],
|
|
12
|
+
async fetchUsage(ctx) {
|
|
13
|
+
const response = await ctx.http.get("https://ai-gateway.vercel.sh/v1/credits");
|
|
14
|
+
const message = `Vercel AI Gateway returned HTTP ${response.status}.`;
|
|
15
|
+
if (response.status === 401) throw ctx.fail.authenticationExpired(message);
|
|
16
|
+
if (response.status === 403) throw ctx.fail.permissionDenied(message);
|
|
17
|
+
if (response.status === 429) {
|
|
18
|
+
const delay = Number(response.headers["retry-after"] ?? 1);
|
|
19
|
+
throw ctx.fail.rateLimited(message, {
|
|
20
|
+
retryAfterSeconds: Number.isFinite(delay) && delay >= 0 ? Math.min(delay, 10) : 1,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
if (response.status >= 500) throw ctx.fail.providerUnavailable(message);
|
|
24
|
+
if (response.status !== 200) throw ctx.fail.apiFailure(message);
|
|
25
|
+
function fail() {
|
|
26
|
+
throw ctx.fail.parseFailure("Vercel AI Gateway returned an unrecognized credit balance.");
|
|
27
|
+
}
|
|
28
|
+
let data;
|
|
29
|
+
try {
|
|
30
|
+
data = JSON.parse(response.bodyText);
|
|
31
|
+
} catch {
|
|
32
|
+
return fail();
|
|
33
|
+
}
|
|
34
|
+
function money(value) {
|
|
35
|
+
if (typeof value !== "string" || !/^-?\d+(?:\.\d+)?$/.test(value)) return fail();
|
|
36
|
+
const amount = Number(value);
|
|
37
|
+
if (!Number.isFinite(amount)) return fail();
|
|
38
|
+
return amount;
|
|
39
|
+
}
|
|
40
|
+
const balance = money(data?.balance);
|
|
41
|
+
const spent = money(data?.total_used);
|
|
42
|
+
if (spent < 0) return fail();
|
|
43
|
+
return {
|
|
44
|
+
details: [
|
|
45
|
+
{
|
|
46
|
+
title: "Team credits",
|
|
47
|
+
rows: [
|
|
48
|
+
{ label: "Available balance", value: ctx.format.usd(balance) },
|
|
49
|
+
{ label: "Lifetime spend", value: ctx.format.usd(spent) },
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
identity: { loginMethod: "API" },
|
|
54
|
+
dataConfidence: "exact",
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// END UPSTREAM
|
|
60
|
+
})(globalThis.defineProvider);
|
|
61
|
+
(function() { const credits=globalThis.__usagestat_plugin; let budget;
|
|
62
|
+
(function(defineProvider) {
|
|
63
|
+
// BEGIN UPSTREAM Sources/CodexBarCore/Resources/Plugins/vercel-budget.js
|
|
64
|
+
defineProvider({
|
|
65
|
+
id: "vercel",
|
|
66
|
+
name: "Vercel AI Gateway",
|
|
67
|
+
endpoints: ["https://api.vercel.com"],
|
|
68
|
+
auth: { type: "bearer", secret: "VERCEL_ACCESS_TOKEN" },
|
|
69
|
+
settings: [
|
|
70
|
+
{ key: "VERCEL_ACCESS_TOKEN", title: "Vercel access token", type: "secure" },
|
|
71
|
+
{ key: "VERCEL_TEAM_ID", title: "Team ID", type: "plain" },
|
|
72
|
+
],
|
|
73
|
+
capabilities: ["http-status"],
|
|
74
|
+
async fetchUsage(ctx) {
|
|
75
|
+
const team = ctx.settings.get("VERCEL_TEAM_ID")?.trim();
|
|
76
|
+
if (!team) throw ctx.fail.missingCredential("Set the Vercel Team ID to read your personal budget.");
|
|
77
|
+
if (!/^[A-Za-z0-9_-]{1,128}$/.test(team)) {
|
|
78
|
+
throw ctx.fail.permissionDenied("Invalid Vercel Team ID. Enter the team ID or slug without spaces.");
|
|
79
|
+
}
|
|
80
|
+
function fail() {
|
|
81
|
+
throw ctx.fail.parseFailure("Vercel returned an unrecognized personal budget.");
|
|
82
|
+
}
|
|
83
|
+
async function read(url) {
|
|
84
|
+
const response = await ctx.http.get(url);
|
|
85
|
+
const message = `Vercel API returned HTTP ${response.status}.`;
|
|
86
|
+
if (response.status === 401) throw ctx.fail.authenticationExpired(message);
|
|
87
|
+
if (response.status === 403) throw ctx.fail.permissionDenied(message);
|
|
88
|
+
if (response.status === 429) {
|
|
89
|
+
const delay = Number(response.headers["retry-after"] ?? 1);
|
|
90
|
+
throw ctx.fail.rateLimited(message, {
|
|
91
|
+
retryAfterSeconds: Number.isFinite(delay) && delay >= 0 ? Math.min(delay, 10) : 1,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
if (response.status >= 500) throw ctx.fail.providerUnavailable(message);
|
|
95
|
+
if (response.status !== 200) throw ctx.fail.apiFailure(message);
|
|
96
|
+
try {
|
|
97
|
+
return JSON.parse(response.bodyText);
|
|
98
|
+
} catch {
|
|
99
|
+
return fail();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const user = (await read("https://api.vercel.com/v2/user"))?.user;
|
|
104
|
+
if (typeof user?.id !== "string" || !user.id) return fail();
|
|
105
|
+
|
|
106
|
+
// At most 20 pages; the plugin deadline bounds slower teams.
|
|
107
|
+
const matches = [];
|
|
108
|
+
const cursors = new Set();
|
|
109
|
+
let cursor = null;
|
|
110
|
+
for (let page = 0; ; page += 1) {
|
|
111
|
+
const query =
|
|
112
|
+
`teamId=${encodeURIComponent(team)}&scopeType=user&limit=200` +
|
|
113
|
+
(cursor === null ? "" : `&cursor=${encodeURIComponent(cursor)}`);
|
|
114
|
+
const body = await read(`https://api.vercel.com/ai-gateway/budgets/list?${query}`);
|
|
115
|
+
if (!Array.isArray(body?.budgets)) return fail();
|
|
116
|
+
for (const budget of body.budgets) {
|
|
117
|
+
if (budget?.scopeType !== "user" || ![user.id, `usr_${user.id}`].includes(budget.scopeId)) continue;
|
|
118
|
+
if (typeof budget.active !== "boolean" || typeof budget.archived !== "boolean") return fail();
|
|
119
|
+
if (budget.source !== undefined && budget.source !== "default") return fail();
|
|
120
|
+
if (budget.active && !budget.archived) matches.push(budget);
|
|
121
|
+
}
|
|
122
|
+
const next = body.nextCursor;
|
|
123
|
+
if (next === undefined || next === null) break;
|
|
124
|
+
if (typeof next !== "string" || !next || cursors.has(next) || page >= 19) return fail();
|
|
125
|
+
cursors.add(next);
|
|
126
|
+
cursor = next;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const identity = {
|
|
130
|
+
email: typeof user.email === "string" ? user.email : null,
|
|
131
|
+
organization: team,
|
|
132
|
+
loginMethod: "Access token",
|
|
133
|
+
accountID: user.id,
|
|
134
|
+
};
|
|
135
|
+
const custom = matches.filter((budget) => budget.source !== "default");
|
|
136
|
+
const effective = custom.length > 0 ? custom : matches;
|
|
137
|
+
if (effective.length > 1) return fail();
|
|
138
|
+
const budget = effective[0];
|
|
139
|
+
if (!budget) {
|
|
140
|
+
return {
|
|
141
|
+
details: [{ title: "Personal budget", rows: [{ label: "No personal budget configured", value: "—" }] }],
|
|
142
|
+
identity,
|
|
143
|
+
dataConfidence: "exact",
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
const limit = budget.limitAmount;
|
|
147
|
+
const spent = budget.currentSpend;
|
|
148
|
+
if (typeof limit !== "number" || !Number.isFinite(limit) || limit <= 0) return fail();
|
|
149
|
+
if (typeof spent !== "number" || !Number.isFinite(spent) || spent < 0) return fail();
|
|
150
|
+
|
|
151
|
+
// Documented UTC boundaries: daily midnight, weekly Monday, monthly the 1st; `none` never resets.
|
|
152
|
+
const now = ctx.date.now();
|
|
153
|
+
const year = now.getUTCFullYear();
|
|
154
|
+
const month = now.getUTCMonth();
|
|
155
|
+
const day = now.getUTCDate();
|
|
156
|
+
let start = null;
|
|
157
|
+
let end = null;
|
|
158
|
+
if (budget.refreshPeriod === "daily") {
|
|
159
|
+
start = Date.UTC(year, month, day);
|
|
160
|
+
end = Date.UTC(year, month, day + 1);
|
|
161
|
+
} else if (budget.refreshPeriod === "weekly") {
|
|
162
|
+
start = Date.UTC(year, month, day - ((now.getUTCDay() + 6) % 7));
|
|
163
|
+
end = start + 7 * 24 * 60 * 60 * 1000;
|
|
164
|
+
} else if (budget.refreshPeriod === "monthly") {
|
|
165
|
+
start = Date.UTC(year, month, 1);
|
|
166
|
+
end = Date.UTC(year, month + 1, 1);
|
|
167
|
+
} else if (budget.refreshPeriod !== "none") {
|
|
168
|
+
return fail();
|
|
169
|
+
}
|
|
170
|
+
const spentText = ctx.format.usd(spent);
|
|
171
|
+
const limitText = ctx.format.usd(limit);
|
|
172
|
+
return {
|
|
173
|
+
primary: {
|
|
174
|
+
usedPercent: (spent / limit) * 100,
|
|
175
|
+
windowMinutes: start === null ? null : (end - start) / 60000,
|
|
176
|
+
resetsAt: end === null ? null : new Date(end),
|
|
177
|
+
resetDescription: `${spentText} / ${limitText}`,
|
|
178
|
+
},
|
|
179
|
+
details: [
|
|
180
|
+
{
|
|
181
|
+
title: "Personal budget",
|
|
182
|
+
rows: [
|
|
183
|
+
{ label: "Spend", value: spentText },
|
|
184
|
+
{ label: "Limit", value: limitText },
|
|
185
|
+
{ label: "Remaining", value: ctx.format.usd(Math.max(0, limit - spent)) },
|
|
186
|
+
],
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
identity,
|
|
190
|
+
dataConfidence: "exact",
|
|
191
|
+
};
|
|
192
|
+
},
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
// END UPSTREAM
|
|
196
|
+
})(definition => { budget=globalThis.__usagestat_bundledProvider(definition,{"labels":["Personal budget","Additional","Additional"],"autoMode":"api","genericApiKey":false}); });
|
|
197
|
+
globalThis.__usagestat_plugin = {id:"vercel",probe(ctx) {
|
|
198
|
+
const selected=ctx.provider?.settings?.personalBudget;
|
|
199
|
+
if(selected!==undefined && typeof selected!=='boolean') throw new Error('personalBudget must be a boolean.');
|
|
200
|
+
return (selected===true ? budget : credits).probe(ctx);
|
|
201
|
+
}};
|
|
202
|
+
})();
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"id": "vercel",
|
|
4
|
+
"name": "Vercel AI Gateway",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"entry": "plugin.js",
|
|
7
|
+
"enabledByDefault": false,
|
|
8
|
+
"supportedModes": [
|
|
9
|
+
"api"
|
|
10
|
+
],
|
|
11
|
+
"autoMode": "api",
|
|
12
|
+
"usageDashboardUrl": "https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai-gateway",
|
|
13
|
+
"envVars": [
|
|
14
|
+
"AI_GATEWAY_API_KEY",
|
|
15
|
+
"VERCEL_ACCESS_TOKEN",
|
|
16
|
+
"VERCEL_TEAM_ID"
|
|
17
|
+
],
|
|
18
|
+
"setupFields": [
|
|
19
|
+
{
|
|
20
|
+
"key": "personalBudget",
|
|
21
|
+
"title": "Read personal budget",
|
|
22
|
+
"type": "boolean",
|
|
23
|
+
"description": "Use a Vercel access token and Team ID instead of AI Gateway key credits."
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"key": "VERCEL_ACCESS_TOKEN",
|
|
27
|
+
"title": "Vercel access token",
|
|
28
|
+
"type": "string",
|
|
29
|
+
"description": "Separate account token; the AI Gateway API key is not used for budgets."
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"key": "VERCEL_TEAM_ID",
|
|
33
|
+
"title": "Team ID",
|
|
34
|
+
"type": "string",
|
|
35
|
+
"description": "Team ID or slug whose personal budget belongs to the token user."
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"upstream": {
|
|
39
|
+
"repository": "https://github.com/steipete/CodexBar",
|
|
40
|
+
"revision": "1f6da9bec44455288ddee5ef6f3617a803d8eb2a",
|
|
41
|
+
"path": "Sources/CodexBarCore/Resources/Plugins/vercel.js",
|
|
42
|
+
"sha256": "27b39f42709e93a2cfbf850171f198069553c99967f9b7ba6d16614862cb084a",
|
|
43
|
+
"license": "MIT"
|
|
44
|
+
},
|
|
45
|
+
"upstreamSources": [
|
|
46
|
+
{
|
|
47
|
+
"repository": "https://github.com/steipete/CodexBar",
|
|
48
|
+
"revision": "1f6da9bec44455288ddee5ef6f3617a803d8eb2a",
|
|
49
|
+
"path": "Sources/CodexBarCore/Resources/Plugins/vercel-budget.js",
|
|
50
|
+
"sha256": "a65d3affe808517590edc33e4d15b813ba1fa870b4435ef18cb7c7195ab376ad",
|
|
51
|
+
"license": "MIT"
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}
|
|
@@ -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>Windsurf</title><path clip-rule="evenodd" d="M23.78 5.004h-.228a2.187 2.187 0 00-2.18 2.196v4.912c0 .98-.804 1.775-1.76 1.775a1.818 1.818 0 01-1.472-.773L13.168 5.95a2.197 2.197 0 00-1.81-.95c-1.134 0-2.154.972-2.154 2.173v4.94c0 .98-.797 1.775-1.76 1.775-.57 0-1.136-.289-1.472-.773L.408 5.098C.282 4.918 0 5.007 0 5.228v4.284c0 .216.066.426.188.604l5.475 7.889c.324.466.8.812 1.351.938 1.377.316 2.645-.754 2.645-2.117V11.89c0-.98.787-1.775 1.76-1.775h.002c.586 0 1.135.288 1.472.773l4.972 7.163a2.15 2.15 0 001.81.95c1.158 0 2.151-.973 2.151-2.173v-4.939c0-.98.787-1.775 1.76-1.775h.194c.122 0 .22-.1.22-.222V5.225a.221.221 0 00-.22-.222z"></path></svg>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Peter Steinberger
|
|
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.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" fill-rule="evenodd"><path d="M18.777 1.647c.28-.02.536.114.972.51 1.018.926 2.437 2.828 3.318 4.452l.34.631.482.24.11.06v3.638a5.206 5.206 0 00-5.32-1.23c-.491.166-1.021.471-2.08 1.082l-6.09 3.516c-1.057.61-1.586.916-1.975 1.259a5.208 5.208 0 00-1.493 5.572c.165.49.471 1.02 1.082 2.08l.315.543h-3.26c-.685 0-1.34-.135-1.939-.377-.169-.956-.009-1.789.469-2.335.158-.18.164-.189.13-.493a11.846 11.846 0 01-.057-1.711l.02-.444-.667-1.18C2.1 15.622 1.445 14.078 1.192 12.9c-.133-.647-.125-.934.04-1.146.1-.128.427-.261.822-.334.994-.175 3.162-.017 5.575.41l.25.043.551-.487c.915-.81 1.522-1.264 2.641-1.962 1.167-.73 2.484-1.331 3.967-1.807l.476-.152.261-.688c.937-2.471 1.896-4.293 2.58-4.9.235-.21.25-.22.422-.23z"/><path d="M12.139 18.2a1.203 1.203 0 011.642.44l1.296 2.243a1.204 1.204 0 01-2.083 1.203l-1.296-2.243a1.203 1.203 0 01.44-1.644zM18.629 14.452a1.203 1.203 0 011.642.44l1.295 2.244a1.203 1.203 0 11-2.083 1.203l-1.295-2.243a1.203 1.203 0 01.44-1.644z"/></svg>
|