@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
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
return null
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
function callLs(ctx, port, scheme, csrf, method, body) {
|
|
85
|
+
function callLs(ctx, port, scheme, csrf, method, body, timeoutMs) {
|
|
86
86
|
var resp = ctx.host.http.request({
|
|
87
87
|
method: "POST",
|
|
88
88
|
url: scheme + "://127.0.0.1:" + port + "/" + LS_SERVICE + "/" + method,
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"x-codeium-csrf-token": csrf,
|
|
93
93
|
},
|
|
94
94
|
bodyText: JSON.stringify(body || {}),
|
|
95
|
-
timeoutMs: 10000,
|
|
95
|
+
timeoutMs: timeoutMs || 10000,
|
|
96
96
|
dangerouslyIgnoreTls: scheme === "https",
|
|
97
97
|
})
|
|
98
98
|
if (resp.status < 200 || resp.status >= 300) {
|
|
@@ -111,8 +111,10 @@
|
|
|
111
111
|
|
|
112
112
|
function poolLabel(normalizedLabel) {
|
|
113
113
|
var lower = normalizedLabel.toLowerCase()
|
|
114
|
+
if (lower.indexOf('argon') !== -1) return null
|
|
114
115
|
if (lower.indexOf("gemini") !== -1 && lower.indexOf("pro") !== -1) return "Gemini Pro"
|
|
115
116
|
if (lower.indexOf("gemini") !== -1 && lower.indexOf("flash") !== -1) return "Gemini Flash"
|
|
117
|
+
if (lower.indexOf('gemini') !== -1) return null
|
|
116
118
|
// All non-Gemini models (Claude, GPT-OSS, etc.) share a single quota pool
|
|
117
119
|
return "Claude"
|
|
118
120
|
}
|
|
@@ -149,9 +151,11 @@
|
|
|
149
151
|
var label = (typeof c.label === "string") ? c.label.trim() : ""
|
|
150
152
|
if (!label) continue
|
|
151
153
|
var qi = c.quotaInfo
|
|
152
|
-
|
|
154
|
+
if (!qi || !Number.isFinite(qi.remainingFraction)) continue
|
|
155
|
+
var frac = qi.remainingFraction
|
|
153
156
|
var rtime = (qi && qi.resetTime) || undefined
|
|
154
157
|
var pool = poolLabel(normalizeLabel(label))
|
|
158
|
+
if (!pool) continue
|
|
155
159
|
if (!deduped[pool] || frac < deduped[pool].remainingFraction) {
|
|
156
160
|
deduped[pool] = {
|
|
157
161
|
label: pool,
|
|
@@ -198,7 +202,13 @@
|
|
|
198
202
|
locale: "en",
|
|
199
203
|
}
|
|
200
204
|
|
|
201
|
-
|
|
205
|
+
var summaryLines = null
|
|
206
|
+
try {
|
|
207
|
+
summaryLines = ctx.util.groupedQuotaLines(callLs(ctx, found.port, found.scheme, discovery.csrf,
|
|
208
|
+
"RetrieveUserQuotaSummary", { forceRefresh: true }, 2000))
|
|
209
|
+
} catch (_) {}
|
|
210
|
+
|
|
211
|
+
// GetUserStatus also supplies identity when grouped quota is available.
|
|
202
212
|
var data = null
|
|
203
213
|
try {
|
|
204
214
|
data = callLs(ctx, found.port, found.scheme, discovery.csrf, "GetUserStatus", { metadata: metadata })
|
|
@@ -207,7 +217,7 @@
|
|
|
207
217
|
}
|
|
208
218
|
var hasUserStatus = data && data.userStatus
|
|
209
219
|
|
|
210
|
-
if (!hasUserStatus) {
|
|
220
|
+
if (!hasUserStatus && summaryLines === null) {
|
|
211
221
|
ctx.host.log.warn("GetUserStatus failed, trying GetCommandModelConfigs")
|
|
212
222
|
data = callLs(ctx, found.port, found.scheme, discovery.csrf, "GetCommandModelConfigs", { metadata: metadata })
|
|
213
223
|
}
|
|
@@ -218,6 +228,8 @@
|
|
|
218
228
|
configs = (data.userStatus.cascadeModelConfigData || {}).clientModelConfigs || []
|
|
219
229
|
} else if (data && data.clientModelConfigs) {
|
|
220
230
|
configs = data.clientModelConfigs
|
|
231
|
+
} else if (summaryLines !== null) {
|
|
232
|
+
configs = []
|
|
221
233
|
} else {
|
|
222
234
|
throw "Start Antigravity IDE and try again."
|
|
223
235
|
}
|
|
@@ -229,8 +241,8 @@
|
|
|
229
241
|
filtered.push(configs[j])
|
|
230
242
|
}
|
|
231
243
|
|
|
232
|
-
var lines = buildModelLines(ctx, filtered)
|
|
233
|
-
if (lines.length === 0) throw "Start Antigravity IDE and try again."
|
|
244
|
+
var lines = summaryLines !== null ? summaryLines : buildModelLines(ctx, filtered)
|
|
245
|
+
if (lines.length === 0 && summaryLines === null) throw "Start Antigravity IDE and try again."
|
|
234
246
|
|
|
235
247
|
var plan = null
|
|
236
248
|
if (hasUserStatus) {
|
|
@@ -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>Atlas Cloud</title><path d="M20.2,18.01L12,0.47,3.8,18.01l-2.58,5.52c1.62,-1.05,3.39,-1.86,5.26,-2.41,1.76,-0.51,3.61,-0.79,5.52,-0.79,0.98,0,1.95,0.08,2.9,0.22l-1.86,-4.3c-0.53,-0.1,-2.87,-0.1,-4.59,0.3l3.56,-8.28,5.52,12.85c0.01,0,0.02,0.01,0.03,0.01,1.86,0.55,3.62,1.36,5.23,2.4l-2.58,-5.52Z"></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>Atlas Cloud</title><path d="M20.2,18.01L12,0.47,3.8,18.01l-2.58,5.52c1.62,-1.05,3.39,-1.86,5.26,-2.41,1.76,-0.51,3.61,-0.79,5.52,-0.79,0.98,0,1.95,0.08,2.9,0.22l-1.86,-4.3c-0.53,-0.1,-2.87,-0.1,-4.59,0.3l3.56,-8.28,5.52,12.85c0.01,0,0.02,0.01,0.03,0.01,1.86,0.55,3.62,1.36,5.23,2.4l-2.58,-5.52Z"></path></svg>
|
|
@@ -0,0 +1,54 @@
|
|
|
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/atlascloud.js
|
|
5
|
+
defineProvider({
|
|
6
|
+
id: "atlascloud",
|
|
7
|
+
name: "Atlas Cloud",
|
|
8
|
+
endpoints: ["https://api.atlascloud.ai"],
|
|
9
|
+
auth: { type: "bearer", secret: "ATLASCLOUD_API_KEY" },
|
|
10
|
+
settings: [{ key: "ATLASCLOUD_API_KEY", title: "Atlas Cloud API key", type: "secure" }],
|
|
11
|
+
capabilities: ["http-status"],
|
|
12
|
+
async fetchUsage(ctx) {
|
|
13
|
+
const response = await ctx.http.get("https://api.atlascloud.ai/public/v1/balance");
|
|
14
|
+
const message = `Atlas Cloud 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("Atlas Cloud returned an unrecognized USD account balance.");
|
|
27
|
+
}
|
|
28
|
+
let data;
|
|
29
|
+
try {
|
|
30
|
+
data = JSON.parse(response.bodyText);
|
|
31
|
+
} catch {
|
|
32
|
+
return fail();
|
|
33
|
+
}
|
|
34
|
+
const value = data?.available?.value;
|
|
35
|
+
if (
|
|
36
|
+
data?.object !== "balance" ||
|
|
37
|
+
data.scope !== "account" ||
|
|
38
|
+
data.available?.currency !== "usd" ||
|
|
39
|
+
typeof value !== "string" ||
|
|
40
|
+
!/^-?\d+(?:\.\d+)?$/.test(value)
|
|
41
|
+
)
|
|
42
|
+
return fail();
|
|
43
|
+
const balance = Number(value);
|
|
44
|
+
if (!Number.isFinite(balance)) return fail();
|
|
45
|
+
return {
|
|
46
|
+
details: [{ title: "Account balance", rows: [{ label: "Available balance", value: ctx.format.usd(balance) }] }],
|
|
47
|
+
identity: { loginMethod: "API" },
|
|
48
|
+
dataConfidence: "exact",
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// END UPSTREAM
|
|
54
|
+
})(globalThis.defineProvider);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"id": "atlascloud",
|
|
4
|
+
"name": "Atlas Cloud",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"entry": "plugin.js",
|
|
7
|
+
"enabledByDefault": false,
|
|
8
|
+
"supportedModes": [
|
|
9
|
+
"api"
|
|
10
|
+
],
|
|
11
|
+
"autoMode": "api",
|
|
12
|
+
"usageDashboardUrl": "https://www.atlascloud.ai/console",
|
|
13
|
+
"envVars": [
|
|
14
|
+
"ATLASCLOUD_API_KEY"
|
|
15
|
+
],
|
|
16
|
+
"setupFields": [],
|
|
17
|
+
"upstream": {
|
|
18
|
+
"repository": "https://github.com/steipete/CodexBar",
|
|
19
|
+
"revision": "1f6da9bec44455288ddee5ef6f3617a803d8eb2a",
|
|
20
|
+
"path": "Sources/CodexBarCore/Resources/Plugins/atlascloud.js",
|
|
21
|
+
"sha256": "852fb78abaf4fcdbbfbfeac0b60d6b82a9ca9b1d1d2f9014f6e5299b41ac47fa",
|
|
22
|
+
"license": "MIT"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 500">
|
|
2
|
+
<g transform="translate(25 0) scale(8.25)" fill="currentColor" stroke="currentColor">
|
|
3
|
+
<path
|
|
4
|
+
d="M8.64,47.51c-.91,0-1.68-.16-2.3-.47-.62-.31-1.09-.79-1.41-1.41-.32-.63-.48-1.39-.48-2.29v-9.27c0-1.14-.23-1.97-.68-2.49-.46-.52-1.27-.79-2.43-.82-.36,0-.65-.14-.87-.41-.22-.27-.33-.59-.33-.94,0-.38.11-.69.33-.94.22-.25.51-.38.87-.41,1.16-.03,1.97-.3,2.43-.82.46-.52.68-1.34.68-2.45v-9.27c0-1.36.36-2.4,1.08-3.1.72-.71,1.76-1.06,3.12-1.06h11.08c.42,0,.76.12,1.04.37.28.25.42.56.42.94,0,.36-.12.66-.35.92-.23.26-.55.39-.94.39h-10.29c-.58,0-1.03.15-1.33.45-.3.3-.46.76-.46,1.39v9.32c0,.82-.17,1.56-.5,2.22-.33.67-.78,1.19-1.33,1.58-.55.38-1.2.57-1.95.57v-.16c.75,0,1.4.19,1.95.57.55.38,1,.91,1.33,1.58.33.67.5,1.41.5,2.23v9.36c0,.63.15,1.09.46,1.39.3.3.75.45,1.33.45h10.29c.39,0,.7.13.94.39.24.26.35.57.35.92s-.14.66-.42.92c-.28.26-.62.39-1.04.39h-11.08Z" />
|
|
5
|
+
<path
|
|
6
|
+
d="M35.79,47.51c-.42,0-.76-.13-1.04-.39-.28-.26-.42-.57-.42-.92s.12-.66.35-.92c.23-.26.55-.39.94-.39h10.29c.58,0,1.03-.15,1.33-.45.3-.3.46-.76.46-1.39v-9.36c0-.82.17-1.56.5-2.22.33-.67.77-1.19,1.33-1.58.55-.38,1.2-.57,1.95-.57v.16c-.75,0-1.4-.19-1.95-.57-.55-.38-1-.91-1.33-1.58-.33-.67-.5-1.41-.5-2.23v-9.32c0-.63-.15-1.09-.46-1.39-.3-.3-.75-.45-1.33-.45h-10.29c-.39,0-.7-.13-.94-.39-.23-.26-.35-.56-.35-.92,0-.38.14-.69.42-.94.28-.25.62-.37,1.04-.37h11.08c1.36,0,2.39.36,3.11,1.06.72.71,1.08,1.74,1.08,3.1v9.27c0,1.12.23,1.94.68,2.45.46.52,1.27.79,2.43.82.36.03.65.16.87.41.22.25.33.56.33.94,0,.36-.11.67-.33.94-.22.27-.51.41-.87.41-1.16.03-1.97.3-2.43.82-.46.52-.68,1.35-.68,2.49v9.27c0,.9-.16,1.66-.48,2.29-.32.63-.79,1.1-1.41,1.41-.62.31-1.39.47-2.31.47h-11.08Z" />
|
|
7
|
+
<path
|
|
8
|
+
d="M38.64,32.95c2.02,0,3.65-1.61,3.65-3.59s-1.64-3.59-3.65-3.59-3.65,1.61-3.65,3.59,1.64,3.59,3.65,3.59Z" />
|
|
9
|
+
<path
|
|
10
|
+
d="M18.18,32.95c2.02,0,3.65-1.61,3.65-3.59s-1.64-3.59-3.65-3.59-3.65,1.61-3.65,3.59,1.64,3.59,3.65,3.59Z" />
|
|
11
|
+
<path
|
|
12
|
+
d="M26.51.95l-.28,7.34c0,.41-.4.62-1.19.62s-1.18-.21-1.18-.62c-.07-1.83-.13-3.25-.17-4.26-.02-1.03-.05-1.76-.07-2.2-.02-.43-.04-.7-.04-.79v-.14c0-.53.49-.79,1.46-.79s1.46.28,1.46.82ZM32.44.95l-.28,7.34c0,.41-.4.62-1.19.62s-1.19-.21-1.19-.62c-.07-1.83-.13-3.25-.17-4.26-.02-1.03-.05-1.76-.07-2.2-.02-.43-.04-.7-.04-.79v-.14c0-.53.49-.79,1.46-.79s1.46.28,1.46.82Z" />
|
|
13
|
+
</g>
|
|
14
|
+
</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,3 @@
|
|
|
1
|
+
<svg width="88" height="110" viewBox="0 0 88 110" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M65.8047 109.59H0V87.6719H65.8047V109.59ZM87.7393 87.6719H65.8047V65.7539H87.7393V87.6719ZM43.8701 65.7539H21.9355V43.8359H43.8701V65.7539ZM87.7393 43.8359H65.8047V21.918H87.7393V43.8359ZM65.8047 21.918H0V0H65.8047V21.918Z" fill="#33C19E"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
// Generated by tools/vendor-codexbar-providers.cjs; see LICENSE.
|
|
2
|
+
globalThis.__usagestat_bundled_options = {"labels":["Budget","Secondary budget","Additional"],"defaults":{},"autoMode":"api"};
|
|
3
|
+
(function(defineProvider) {
|
|
4
|
+
// BEGIN UPSTREAM Sources/CodexBarCore/Resources/Plugins/bifrost.js
|
|
5
|
+
function _nullishCoalesce(lhs, rhsFn) {
|
|
6
|
+
if (lhs != null) {
|
|
7
|
+
return lhs;
|
|
8
|
+
} else {
|
|
9
|
+
return rhsFn();
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function _optionalChain(ops) {
|
|
13
|
+
let lastAccessLHS = undefined;
|
|
14
|
+
let value = ops[0];
|
|
15
|
+
let i = 1;
|
|
16
|
+
while (i < ops.length) {
|
|
17
|
+
const op = ops[i];
|
|
18
|
+
const fn = ops[i + 1];
|
|
19
|
+
i += 2;
|
|
20
|
+
if ((op === "optionalAccess" || op === "optionalCall") && value == null) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
if (op === "access" || op === "optionalAccess") {
|
|
24
|
+
lastAccessLHS = value;
|
|
25
|
+
value = fn(value);
|
|
26
|
+
} else if (op === "call" || op === "optionalCall") {
|
|
27
|
+
value = fn((...args) => value.call(lastAccessLHS, ...args));
|
|
28
|
+
lastAccessLHS = undefined;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return value;
|
|
32
|
+
}
|
|
33
|
+
defineProvider({
|
|
34
|
+
id: "bifrost",
|
|
35
|
+
name: "Bifrost",
|
|
36
|
+
endpoints: [{ setting: "BIFROST_BASE_URL", policy: "https-or-private-network-http" }],
|
|
37
|
+
auth: { type: "header", header: "x-bf-vk", secret: "BIFROST_API_KEY" },
|
|
38
|
+
settings: [
|
|
39
|
+
{ key: "BIFROST_API_KEY", title: "Virtual key", type: "secure" },
|
|
40
|
+
{ key: "BIFROST_BASE_URL", title: "Base URL", type: "plain" },
|
|
41
|
+
],
|
|
42
|
+
capabilities: ["http-status"],
|
|
43
|
+
async fetchUsage(ctx) {
|
|
44
|
+
const fail = (message) => {
|
|
45
|
+
throw ctx.fail.parseFailure(`Bifrost: ${message}`);
|
|
46
|
+
};
|
|
47
|
+
const object = (value) => {
|
|
48
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return fail("expected an object");
|
|
49
|
+
return value;
|
|
50
|
+
};
|
|
51
|
+
const array = (value) => {
|
|
52
|
+
if (value == null) return [];
|
|
53
|
+
if (!Array.isArray(value)) return fail("expected an array");
|
|
54
|
+
return value.map(object);
|
|
55
|
+
};
|
|
56
|
+
const text = (value) => {
|
|
57
|
+
if (value == null) return undefined;
|
|
58
|
+
if (typeof value !== "string") return fail("invalid string");
|
|
59
|
+
return value.trim() || undefined;
|
|
60
|
+
};
|
|
61
|
+
const number = (value) => {
|
|
62
|
+
if (value == null) return undefined;
|
|
63
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return fail("invalid number");
|
|
64
|
+
return value;
|
|
65
|
+
};
|
|
66
|
+
const compare = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
|
|
67
|
+
const bounded = (value) => Array.from(value).slice(0, 120).join("");
|
|
68
|
+
const labels = {
|
|
69
|
+
"1h": "Hourly",
|
|
70
|
+
"1d": "Daily",
|
|
71
|
+
"1w": "Weekly",
|
|
72
|
+
"1M": "Monthly",
|
|
73
|
+
"1Q": "Quarterly",
|
|
74
|
+
"1Y": "Yearly",
|
|
75
|
+
};
|
|
76
|
+
const units = {
|
|
77
|
+
Y: 31536000,
|
|
78
|
+
Q: 7776000,
|
|
79
|
+
M: 2592000,
|
|
80
|
+
w: 604800,
|
|
81
|
+
d: 86400,
|
|
82
|
+
h: 3600,
|
|
83
|
+
m: 60,
|
|
84
|
+
s: 1,
|
|
85
|
+
ms: 0.001,
|
|
86
|
+
us: 0.000001,
|
|
87
|
+
µs: 0.000001,
|
|
88
|
+
μs: 0.000001,
|
|
89
|
+
ns: 0.000000001,
|
|
90
|
+
};
|
|
91
|
+
const duration = (raw) => {
|
|
92
|
+
if (!raw) return undefined;
|
|
93
|
+
const extended = raw.match(/^(\d+(?:\.\d+)?)([dwMQY])$/u);
|
|
94
|
+
const parts = raw.match(/(?:\d+(?:\.\d*)?|\.\d+)(?:ns|us|µs|μs|ms|s|m|h)/gu);
|
|
95
|
+
let seconds;
|
|
96
|
+
if (extended) seconds = Number(extended[1]) * units[extended[2]];
|
|
97
|
+
else if (parts && parts.join("") === raw) {
|
|
98
|
+
seconds = parts.reduce((sum, part) => {
|
|
99
|
+
const match = part.match(/^([\d.]+)(.+)$/u);
|
|
100
|
+
return sum + Number(match[1]) * units[match[2]];
|
|
101
|
+
}, 0);
|
|
102
|
+
}
|
|
103
|
+
return seconds !== undefined && Number.isFinite(seconds) && seconds > 0 ? seconds : undefined;
|
|
104
|
+
};
|
|
105
|
+
const timing = (reset, lastReset) => {
|
|
106
|
+
const raw = text(reset),
|
|
107
|
+
seconds = duration(raw),
|
|
108
|
+
last = text(lastReset);
|
|
109
|
+
// The quota endpoint omits the owner's calendar-alignment policy. Do not invent calendar resets.
|
|
110
|
+
const fixed = raw !== undefined && !/[dwMQY]$/u.test(raw);
|
|
111
|
+
let resetsAt;
|
|
112
|
+
if (fixed && last && seconds) {
|
|
113
|
+
const start = new Date(last).getTime(),
|
|
114
|
+
period = seconds * 1000;
|
|
115
|
+
const next = new Date(
|
|
116
|
+
start + (Math.max(0, Math.floor((ctx.date.now().getTime() - start) / period)) + 1) * period,
|
|
117
|
+
);
|
|
118
|
+
if (Number.isFinite(next.getTime())) resetsAt = next;
|
|
119
|
+
}
|
|
120
|
+
const minutes = seconds === undefined ? 0 : Math.floor(seconds / 60);
|
|
121
|
+
return {
|
|
122
|
+
seconds,
|
|
123
|
+
resetsAt,
|
|
124
|
+
label: raw && Object.hasOwn(labels, raw) ? labels[raw] : undefined,
|
|
125
|
+
windowMinutes: fixed && Number.isSafeInteger(minutes) && minutes > 0 ? minutes : undefined,
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
const rawBase = ctx.settings.get("BIFROST_BASE_URL") || "";
|
|
129
|
+
const [base, suffix = ""] = rawBase.split(/(?=[?#])/u, 2);
|
|
130
|
+
let response;
|
|
131
|
+
try {
|
|
132
|
+
response = await ctx.http.get(`${base.replace(/\/+$/u, "")}/api/governance/virtual-keys/quota${suffix}`);
|
|
133
|
+
} catch (error) {
|
|
134
|
+
if (error.transportClass === "cancelled") throw error;
|
|
135
|
+
throw ctx.fail.networkFailure("Bifrost quota request could not reach the configured gateway.");
|
|
136
|
+
}
|
|
137
|
+
const message = `Bifrost quota request failed (HTTP ${response.status}).`;
|
|
138
|
+
if (response.status === 401) throw ctx.fail.authenticationExpired("Bifrost rejected the virtual key.");
|
|
139
|
+
if (response.status === 403) throw ctx.fail.permissionDenied("Bifrost denied access to this virtual key's quota.");
|
|
140
|
+
if (response.status === 429) throw ctx.fail.rateLimited(message);
|
|
141
|
+
if (response.status >= 500) throw ctx.fail.providerUnavailable(message);
|
|
142
|
+
if (response.status < 200 || response.status >= 300) throw ctx.fail.apiFailure(message);
|
|
143
|
+
let decoded;
|
|
144
|
+
try {
|
|
145
|
+
decoded = JSON.parse(response.bodyText);
|
|
146
|
+
} catch (error) {
|
|
147
|
+
void error;
|
|
148
|
+
return fail("invalid quota JSON");
|
|
149
|
+
}
|
|
150
|
+
const root = object(decoded);
|
|
151
|
+
if (root.is_active != null && typeof root.is_active !== "boolean") return fail("invalid key activity");
|
|
152
|
+
const scopes = [
|
|
153
|
+
{ id: "", body: root },
|
|
154
|
+
...array(root.provider_configs).map((body, index) => ({
|
|
155
|
+
id: `provider-${index}-`,
|
|
156
|
+
title: `Provider ${text(body.provider) || index + 1}`,
|
|
157
|
+
body,
|
|
158
|
+
})),
|
|
159
|
+
...array(root.model_configs).map((body, index) => ({
|
|
160
|
+
id: `model-${index}-`,
|
|
161
|
+
title: `Model ${[text(body.provider), text(body.model_name) || index + 1].filter(Boolean).join(" · ")}`,
|
|
162
|
+
body,
|
|
163
|
+
})),
|
|
164
|
+
];
|
|
165
|
+
const budgets = scopes
|
|
166
|
+
.flatMap((scope) =>
|
|
167
|
+
array(scope.body.budgets).flatMap((budget) => {
|
|
168
|
+
const id = text(budget.id);
|
|
169
|
+
if (!id) return [];
|
|
170
|
+
const amount = _nullishCoalesce(number(budget.override_amount), () => 0),
|
|
171
|
+
mode = text(budget.override_mode);
|
|
172
|
+
const cycles = _nullishCoalesce(number(budget.override_cycles_remaining), () => 0);
|
|
173
|
+
if (!Number.isInteger(cycles)) return fail("invalid override cycles");
|
|
174
|
+
const active = amount > 0 && (mode === "forever" || (mode === "cycles" && cycles > 0));
|
|
175
|
+
const limit = _nullishCoalesce(number(budget.max_limit), () => 0) + (active ? amount : 0);
|
|
176
|
+
if (!Number.isFinite(limit)) return fail("invalid effective budget");
|
|
177
|
+
return [
|
|
178
|
+
{
|
|
179
|
+
id,
|
|
180
|
+
scope,
|
|
181
|
+
source: text(budget.source_name),
|
|
182
|
+
limit,
|
|
183
|
+
used: _nullishCoalesce(number(budget.current_usage), () => 0),
|
|
184
|
+
timing: timing(budget.reset_duration, budget.last_reset),
|
|
185
|
+
models: array(budget.per_model_usage),
|
|
186
|
+
},
|
|
187
|
+
];
|
|
188
|
+
}),
|
|
189
|
+
)
|
|
190
|
+
.sort(
|
|
191
|
+
(a, b) =>
|
|
192
|
+
_nullishCoalesce(a.timing.seconds, () => Infinity) - _nullishCoalesce(b.timing.seconds, () => Infinity) ||
|
|
193
|
+
compare(a.id, b.id),
|
|
194
|
+
);
|
|
195
|
+
const limits = scopes.flatMap((scope) => {
|
|
196
|
+
const components = array(scope.body.rate_limits);
|
|
197
|
+
// rate_limit is a compatibility merge of these components, not another pool.
|
|
198
|
+
const selected = components.length
|
|
199
|
+
? components
|
|
200
|
+
: scope.body.rate_limit == null
|
|
201
|
+
? []
|
|
202
|
+
: [object(scope.body.rate_limit)];
|
|
203
|
+
return selected.map((limit, index) => ({ scope, limit, index }));
|
|
204
|
+
});
|
|
205
|
+
if (root.is_active === false && !budgets.length && !limits.length) {
|
|
206
|
+
throw ctx.fail.permissionDenied("Bifrost virtual key is inactive and has no budgets or rate limits to display.");
|
|
207
|
+
}
|
|
208
|
+
const allWindows = budgets
|
|
209
|
+
.filter((budget) => budget.limit > 0)
|
|
210
|
+
.map((budget) => ({
|
|
211
|
+
id: `bifrost-${budget.scope.id}budget-${budget.id}`,
|
|
212
|
+
scope: budget.scope,
|
|
213
|
+
title: bounded([budget.scope.title, budget.source || "Budget"].filter(Boolean).join(" · ")),
|
|
214
|
+
window: {
|
|
215
|
+
usedPercent: ctx.pct(budget.used, budget.limit),
|
|
216
|
+
windowMinutes: budget.timing.windowMinutes,
|
|
217
|
+
resetsAt: budget.timing.resetsAt,
|
|
218
|
+
resetDescription: [
|
|
219
|
+
_optionalChain([
|
|
220
|
+
budget,
|
|
221
|
+
"access",
|
|
222
|
+
(_) => _.source,
|
|
223
|
+
"optionalAccess",
|
|
224
|
+
(_2) => _2.slice,
|
|
225
|
+
"call",
|
|
226
|
+
(_3) => _3(0, 24),
|
|
227
|
+
]),
|
|
228
|
+
budget.timing.label,
|
|
229
|
+
`${ctx.format.usd(budget.used)} / ${ctx.format.usd(budget.limit)}`,
|
|
230
|
+
]
|
|
231
|
+
.filter(Boolean)
|
|
232
|
+
.join(" · "),
|
|
233
|
+
},
|
|
234
|
+
}));
|
|
235
|
+
const windows = allWindows.filter((window) => !window.scope.id);
|
|
236
|
+
const extraWindows = [...windows.slice(2), ...allWindows.filter((window) => window.scope.id)].map(
|
|
237
|
+
({ id, title, window }) => ({ id, title, window }),
|
|
238
|
+
);
|
|
239
|
+
limits.forEach(({ scope, limit, index }) => {
|
|
240
|
+
const source = text(limit.source_name);
|
|
241
|
+
for (const [key, title] of [
|
|
242
|
+
["token", "Tokens"],
|
|
243
|
+
["request", "Requests"],
|
|
244
|
+
]) {
|
|
245
|
+
const max = number(limit[`${key}_max_limit`]),
|
|
246
|
+
used = _nullishCoalesce(number(limit[`${key}_current_usage`]), () => 0);
|
|
247
|
+
const reset = text(limit[`${key}_reset_duration`]),
|
|
248
|
+
known = max !== undefined && max > 0;
|
|
249
|
+
// Last-reset timestamps are serialized even for unconfigured dimensions.
|
|
250
|
+
if (!known && !reset) continue;
|
|
251
|
+
const time = timing(reset, limit[`${key}_last_reset`]);
|
|
252
|
+
extraWindows.push({
|
|
253
|
+
id: `bifrost-${scope.id}${key}s-${index}`,
|
|
254
|
+
title: bounded([scope.title, source, title].filter(Boolean).join(" ")),
|
|
255
|
+
usageKnown: known,
|
|
256
|
+
window: {
|
|
257
|
+
usedPercent: known ? ctx.pct(used, max) : 0,
|
|
258
|
+
windowMinutes: time.windowMinutes,
|
|
259
|
+
resetsAt: time.resetsAt,
|
|
260
|
+
resetDescription: time.label,
|
|
261
|
+
},
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
if (root.is_active === false) {
|
|
266
|
+
extraWindows.unshift({ id: "bifrost-key-inactive", title: "Key inactive", usageKnown: false, usedPercent: 0 });
|
|
267
|
+
}
|
|
268
|
+
const first = budgets.find((budget) => !budget.scope.id),
|
|
269
|
+
details = [];
|
|
270
|
+
const modelName = (raw) =>
|
|
271
|
+
raw
|
|
272
|
+
.replace(/^(us-gov|us|eu|apac|global)\./iu, "")
|
|
273
|
+
.replace(
|
|
274
|
+
/^(ai21|amazon|anthropic|cohere|deepseek|luma|meta|mistral|openai|qwen|stability|twelvelabs|writer)\./iu,
|
|
275
|
+
"",
|
|
276
|
+
)
|
|
277
|
+
.replace(/-v\d+:\d+$/u, "")
|
|
278
|
+
.replace(/(?:-|\s)(?:\d{8}|\d{4}-\d{2}-\d{2})$/u, "")
|
|
279
|
+
.replace(/[ \t-]+$/u, "") || raw;
|
|
280
|
+
const tokenCount = (value) => {
|
|
281
|
+
const magnitude = Math.abs(value),
|
|
282
|
+
sign = value < 0 ? "-" : "";
|
|
283
|
+
for (const [threshold, divisor, unit] of [
|
|
284
|
+
[999500000, 1e9, "B"],
|
|
285
|
+
[999500, 1e6, "M"],
|
|
286
|
+
[1000, 1000, "K"],
|
|
287
|
+
]) {
|
|
288
|
+
if (magnitude >= threshold) {
|
|
289
|
+
const scaled = magnitude / divisor;
|
|
290
|
+
return sign + scaled.toFixed(scaled >= 10 ? 0 : 1).replace(/\.0$/u, "") + unit;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
return String(value);
|
|
294
|
+
};
|
|
295
|
+
const models = (_optionalChain([first, "optionalAccess", (_4) => _4.models]) || [])
|
|
296
|
+
.map((model) => {
|
|
297
|
+
const tokens = number(model.total_tokens);
|
|
298
|
+
number(model.total_requests);
|
|
299
|
+
return {
|
|
300
|
+
raw: text(model.model) || "Model",
|
|
301
|
+
provider: text(model.provider),
|
|
302
|
+
cost: number(model.total_cost),
|
|
303
|
+
tokens: tokens !== undefined && Math.abs(tokens) < 9223372036854775808 ? Math.trunc(tokens) : undefined,
|
|
304
|
+
};
|
|
305
|
+
})
|
|
306
|
+
.filter((model) => (model.cost || 0) !== 0 || (model.tokens || 0) !== 0)
|
|
307
|
+
.sort((a, b) => (b.cost || 0) - (a.cost || 0) || (b.tokens || 0) - (a.tokens || 0) || compare(a.raw, b.raw));
|
|
308
|
+
if (models.length) {
|
|
309
|
+
const visible = models.slice(0, 5),
|
|
310
|
+
names = visible.map((model) => modelName(model.raw));
|
|
311
|
+
const mixed = new Set(visible.map((model) => model.provider).filter(Boolean)).size > 1;
|
|
312
|
+
const rows = visible.map((model, index) => ({
|
|
313
|
+
label: bounded(
|
|
314
|
+
[
|
|
315
|
+
mixed ? model.provider : undefined,
|
|
316
|
+
names.indexOf(names[index]) !== names.lastIndexOf(names[index]) ? model.raw : names[index],
|
|
317
|
+
]
|
|
318
|
+
.filter(Boolean)
|
|
319
|
+
.join(" · "),
|
|
320
|
+
),
|
|
321
|
+
value: model.cost === undefined ? "—" : ctx.format.usd(model.cost),
|
|
322
|
+
usageValue: model.cost,
|
|
323
|
+
secondaryValue: model.tokens === undefined ? undefined : `${tokenCount(model.tokens)} tokens`,
|
|
324
|
+
}));
|
|
325
|
+
if (models.length > 5) rows.push({ label: "Other models", value: String(models.length - 5) });
|
|
326
|
+
details.push({ title: "Models", rows });
|
|
327
|
+
}
|
|
328
|
+
if (budgets.length > 1 || budgets.some((budget) => budget.scope.id))
|
|
329
|
+
details.push({
|
|
330
|
+
title: "Budgets",
|
|
331
|
+
rows: budgets.slice(0, 24).map((budget) => ({
|
|
332
|
+
label: bounded([budget.scope.title, budget.source || `Budget ${budget.id}`].filter(Boolean).join(" · ")),
|
|
333
|
+
value:
|
|
334
|
+
budget.limit > 0
|
|
335
|
+
? `${ctx.format.usd(budget.used)} / ${ctx.format.usd(budget.limit)}`
|
|
336
|
+
: ctx.format.usd(budget.used),
|
|
337
|
+
secondaryValue: budget.timing.label,
|
|
338
|
+
usageValue: budget.used,
|
|
339
|
+
progress: budget.limit > 0 ? ctx.pct(budget.used, budget.limit) / 100 : undefined,
|
|
340
|
+
})),
|
|
341
|
+
});
|
|
342
|
+
return {
|
|
343
|
+
primary: _optionalChain([windows, "access", (_5) => _5[0], "optionalAccess", (_6) => _6.window]),
|
|
344
|
+
secondary: _optionalChain([windows, "access", (_7) => _7[1], "optionalAccess", (_8) => _8.window]),
|
|
345
|
+
extraWindows,
|
|
346
|
+
details,
|
|
347
|
+
cost: first
|
|
348
|
+
? {
|
|
349
|
+
used: first.used,
|
|
350
|
+
limit: Math.max(0, first.limit),
|
|
351
|
+
currency: "USD",
|
|
352
|
+
period: first.timing.label || (first.limit > 0 ? "Budget" : "Spend"),
|
|
353
|
+
resetsAt: first.timing.resetsAt,
|
|
354
|
+
}
|
|
355
|
+
: undefined,
|
|
356
|
+
identity: {
|
|
357
|
+
email: text(root.virtual_key_name),
|
|
358
|
+
organization: _optionalChain([first, "optionalAccess", (_9) => _9.source]),
|
|
359
|
+
loginMethod: "api",
|
|
360
|
+
},
|
|
361
|
+
};
|
|
362
|
+
},
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
// END UPSTREAM
|
|
366
|
+
})(globalThis.defineProvider);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"id": "bifrost",
|
|
4
|
+
"name": "Bifrost",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"entry": "plugin.js",
|
|
7
|
+
"enabledByDefault": false,
|
|
8
|
+
"supportedModes": [
|
|
9
|
+
"api"
|
|
10
|
+
],
|
|
11
|
+
"autoMode": "api",
|
|
12
|
+
"envVars": [
|
|
13
|
+
"BIFROST_API_KEY",
|
|
14
|
+
"BIFROST_BASE_URL"
|
|
15
|
+
],
|
|
16
|
+
"setupFields": [
|
|
17
|
+
{
|
|
18
|
+
"key": "BIFROST_BASE_URL",
|
|
19
|
+
"title": "Base URL",
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "Provider-specific account or source selection."
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"upstream": {
|
|
25
|
+
"repository": "https://github.com/steipete/CodexBar",
|
|
26
|
+
"revision": "1f6da9bec44455288ddee5ef6f3617a803d8eb2a",
|
|
27
|
+
"path": "Sources/CodexBarCore/Resources/Plugins/bifrost.js",
|
|
28
|
+
"sha256": "b7576d59ccd077c812118cf09d282042589a80df470c621e414583050f03aa07",
|
|
29
|
+
"license": "MIT"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -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,4 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M17.0674 3.26367L17.0674 2.26367H17.0674V3.26367ZM17.0674 18.0566V19.0566H17.0674L17.0674 18.0566ZM7.66211 18.0566V17.0566C7.42949 17.0566 7.20415 17.1377 7.02487 17.286L7.66211 18.0566ZM4.41895 20.7383H3.41895C3.41895 21.1256 3.64261 21.4781 3.99306 21.6431C4.3435 21.808 4.75768 21.7558 5.05618 21.509L4.41895 20.7383ZM4.41895 17.165H5.41895C5.41895 16.8637 5.28308 16.5785 5.04912 16.3886L4.41895 17.165ZM6.93359 3.26367V2.26367H6.93357L6.93359 3.26367ZM17.0674 3.26367L17.0674 4.26367C18.721 4.26372 20.0615 5.6042 20.0615 7.25781H21.0615H22.0615C22.0615 4.49957 19.8256 2.26375 17.0674 2.26367L17.0674 3.26367ZM21.0615 7.25781H20.0615V14.0625H21.0615H22.0615V7.25781H21.0615ZM21.0615 14.0625H20.0615C20.0615 15.7161 18.721 17.0566 17.0674 17.0566L17.0674 18.0566L17.0674 19.0566C19.8256 19.0566 22.0615 16.8207 22.0615 14.0625H21.0615ZM17.0674 18.0566V17.0566H7.66211V18.0566V19.0566H17.0674V18.0566ZM7.66211 18.0566L7.02487 17.286L3.78171 19.9676L4.41895 20.7383L5.05618 21.509L8.29934 18.8273L7.66211 18.0566ZM4.41895 20.7383H5.41895V17.165H4.41895H3.41895V20.7383H4.41895ZM4.41895 17.165L5.04912 16.3886C4.37038 15.8377 3.93945 15.0007 3.93945 14.0625H2.93945H1.93945C1.93945 15.6296 2.66288 17.0277 3.78877 17.9415L4.41895 17.165ZM2.93945 14.0625H3.93945V7.25781H2.93945H1.93945V14.0625H2.93945ZM2.93945 7.25781H3.93945C3.93945 5.6042 5.27994 4.26372 6.93362 4.26367L6.93359 3.26367L6.93357 2.26367C4.17542 2.26375 1.93945 4.49957 1.93945 7.25781H2.93945ZM6.93359 3.26367V4.26367H17.0674V3.26367V2.26367H6.93359V3.26367Z" fill="#000000"/>
|
|
3
|
+
<path d="M9.13379 9.29883C9.83353 9.29883 10.4014 9.86667 10.4014 10.5664C10.4012 11.266 9.83346 11.833 9.13379 11.833C8.43421 11.8329 7.86731 11.266 7.86719 10.5664C7.86719 9.86673 8.43414 9.29893 9.13379 9.29883ZM14.8662 9.29883C15.566 9.29883 16.1338 9.86667 16.1338 10.5664C16.1337 11.266 15.5659 11.833 14.8662 11.833C14.1666 11.8329 13.5997 11.266 13.5996 10.5664C13.5996 9.86673 14.1666 9.29893 14.8662 9.29883Z" fill="#000000"/>
|
|
4
|
+
</svg>
|