@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
|
@@ -1,71 +1,162 @@
|
|
|
1
1
|
(function () {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
return null;
|
|
2
|
+
const PLATFORM = 'https://platform.deepseek.com/api/v0/';
|
|
3
|
+
const own = (value, key) => Object.prototype.hasOwnProperty.call(value, key);
|
|
4
|
+
const clean = value => typeof value === 'string' && value.trim() ? value.trim().replace(/^Bearer\s+/i, '') : null;
|
|
5
|
+
function amount(value) {
|
|
6
|
+
if (typeof value !== 'number' && typeof value !== 'string' || typeof value === 'string' && !value.trim()) return null;
|
|
7
|
+
const n = Number(value);
|
|
8
|
+
return Number.isFinite(n) && n >= 0 ? n : null;
|
|
11
9
|
}
|
|
12
|
-
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
function fail(code, message) { throw {code, message}; }
|
|
11
|
+
function request(ctx, url, token, timeoutMs) {
|
|
12
|
+
const result = ctx.util.requestJson({method:'GET', url, timeoutMs,
|
|
13
|
+
headers:{Authorization:'Bearer '+token, Accept:'application/json', 'x-client-platform':'web'}});
|
|
14
|
+
const body = result.json;
|
|
15
|
+
if ([401,403].includes(result.resp.status) || [40002,40003].includes(body?.code) || [40002,40003].includes(body?.data?.biz_code))
|
|
16
|
+
fail('credential-rejected', 'DeepSeek credential expired. Sign in again.');
|
|
17
|
+
if (result.resp.status === 429) fail('failed', 'DeepSeek is rate limited.');
|
|
18
|
+
if (result.resp.status < 200 || result.resp.status >= 300 || !body || body.code && body.code !== 0 || body.data?.biz_code && body.data.biz_code !== 0)
|
|
19
|
+
fail('failed', 'DeepSeek request failed (HTTP '+result.resp.status+').');
|
|
20
|
+
return body;
|
|
21
|
+
}
|
|
22
|
+
function choose(values) {
|
|
23
|
+
return values.find(v => v.currency === 'USD' && v.total > 0) || values.find(v => v.total > 0) || values.find(v => v.currency === 'USD') || values[0];
|
|
24
|
+
}
|
|
25
|
+
function balance(ctx, key, token) {
|
|
26
|
+
if (key) {
|
|
27
|
+
const data = request(ctx, 'https://api.deepseek.com/user/balance', key, 15000);
|
|
28
|
+
if (!Array.isArray(data.balance_infos)) fail('failed', 'DeepSeek balance response changed.');
|
|
29
|
+
const values = data.balance_infos.map(value => ({currency:String(value.currency || '').toUpperCase(), total:amount(value.total_balance),
|
|
30
|
+
paid:amount(value.topped_up_balance), granted:amount(value.granted_balance)}));
|
|
31
|
+
if (values.some(v => !v.currency || v.total === null || v.paid === null || v.granted === null)) fail('failed', 'DeepSeek returned an invalid balance.');
|
|
32
|
+
return {value:choose(values), available:data.is_available !== false};
|
|
17
33
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
34
|
+
const data = request(ctx, PLATFORM+'users/get_user_summary', token, 15000).data?.biz_data;
|
|
35
|
+
if (!data || !Array.isArray(data.normal_wallets) || !Array.isArray(data.bonus_wallets)) fail('failed', 'DeepSeek wallet response changed.');
|
|
36
|
+
const values = new Map();
|
|
37
|
+
for (const [field, wallets] of [['paid',data.normal_wallets],['granted',data.bonus_wallets]]) {
|
|
38
|
+
for (const wallet of wallets) {
|
|
39
|
+
const currency = String(wallet.currency || '').toUpperCase(), value = amount(wallet.balance);
|
|
40
|
+
if (!currency || value === null) fail('failed', 'DeepSeek returned an invalid wallet.');
|
|
41
|
+
if (!values.has(currency)) values.set(currency,{currency,total:0,paid:0,granted:0});
|
|
42
|
+
values.get(currency)[field] += value;
|
|
43
|
+
values.get(currency).total += value;
|
|
44
|
+
}
|
|
28
45
|
}
|
|
29
|
-
|
|
30
|
-
|
|
46
|
+
return {value:choose([...values.values()]),available:true};
|
|
47
|
+
}
|
|
48
|
+
function details(ctx, token, lines) {
|
|
49
|
+
const now = new Date(ctx.nowIso), end = Date.parse(ctx.nowIso.slice(0,10)) + 86400000, start = end - 30*86400000;
|
|
50
|
+
const deadline = Date.now() + 5000;
|
|
51
|
+
const fetch = suffix => {
|
|
52
|
+
const left = deadline - Date.now();
|
|
53
|
+
if (left <= 0) fail('failed','DeepSeek detail deadline exceeded.');
|
|
54
|
+
return request(ctx, PLATFORM+'usage/'+suffix, token, Math.min(1500,left)).data?.biz_data;
|
|
55
|
+
};
|
|
56
|
+
let amounts, costs, monthly = false;
|
|
57
|
+
try {
|
|
58
|
+
const query = '?start='+Math.floor(start/1000)+'&end='+Math.floor(end/1000)+'&tz=0';
|
|
59
|
+
amounts = fetch('by_api_key/amount'+query);
|
|
60
|
+
costs = fetch('by_api_key/cost'+query);
|
|
61
|
+
if (!Array.isArray(amounts?.series) || !Array.isArray(costs?.data)) throw new Error('Unrecognized series');
|
|
62
|
+
} catch (error) {
|
|
63
|
+
if (error?.code === 'credential-rejected' || /rate limited/.test(error?.message || '')) throw error;
|
|
64
|
+
monthly = true;
|
|
65
|
+
const query = '?month='+(now.getUTCMonth()+1)+'&year='+now.getUTCFullYear();
|
|
66
|
+
amounts = fetch('amount'+query);
|
|
67
|
+
costs = fetch('cost'+query);
|
|
68
|
+
if (!Array.isArray(amounts?.days) || !Array.isArray(costs)) throw new Error('Unrecognized monthly usage');
|
|
31
69
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
70
|
+
const blocks = monthly ? costs : costs.data;
|
|
71
|
+
const block = blocks.find(b => b.currency === 'USD') || blocks[0];
|
|
72
|
+
if (!block || typeof block.currency !== 'string') throw new Error('Unknown currency');
|
|
73
|
+
const currency = block.currency.toUpperCase(), days = new Map(), models = new Map(), keys = new Set();
|
|
74
|
+
const lower = monthly ? ctx.nowIso.slice(0,7)+'-01' : new Date(start).toISOString().slice(0,10), upper = ctx.nowIso.slice(0,10);
|
|
75
|
+
function day(date) {
|
|
76
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(date) || date < lower || date > upper || new Date(date).toISOString().slice(0,10) !== date) return null;
|
|
77
|
+
if (!days.has(date)) days.set(date,{date,inputTokens:0,outputTokens:0,cacheReadTokens:0,totalTokens:0,costUsd:0,
|
|
78
|
+
requests:0,tokensKnown:false,costKnown:false,amountSeen:false,costSeen:false,badTokens:false,badCost:false});
|
|
79
|
+
return days.get(date);
|
|
38
80
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
81
|
+
function addAmount(date, usage) {
|
|
82
|
+
const row = day(date);
|
|
83
|
+
if (!row || !usage || typeof usage !== 'object') return;
|
|
84
|
+
for (const [type, field] of [['PROMPT_CACHE_MISS_TOKEN','inputTokens'],['PROMPT_CACHE_HIT_TOKEN','cacheReadTokens'],['RESPONSE_TOKEN','outputTokens'],['REQUEST','requests']]) {
|
|
85
|
+
if (!own(usage,type)) continue;
|
|
86
|
+
const value = amount(usage[type]);
|
|
87
|
+
if (value === null || !Number.isSafeInteger(value)) { row.badTokens=true; continue; }
|
|
88
|
+
row[field] += value;
|
|
89
|
+
if (field !== 'requests') { row.totalTokens += value; row.amountSeen=true; }
|
|
90
|
+
}
|
|
45
91
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (!
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
92
|
+
function addCost(date, model, raw) {
|
|
93
|
+
const row = day(date), value = amount(raw);
|
|
94
|
+
if (!row) return;
|
|
95
|
+
if (value === null) { row.badCost=true; if(model) models.set(model,null); return; }
|
|
96
|
+
row.costUsd += value; row.costSeen=true;
|
|
97
|
+
if (model && models.get(model) !== null) models.set(model,(models.get(model)||0)+value);
|
|
98
|
+
}
|
|
99
|
+
const dateFor = time => typeof time === 'number' && time*1000 >= start && time*1000 < end ? new Date(time*1000).toISOString().slice(0,10) : '';
|
|
100
|
+
if (!monthly) {
|
|
101
|
+
if (amounts.series.length > 10000 || !Array.isArray(block.series) || block.series.length > 10000) throw new Error('Too many series');
|
|
102
|
+
for (const series of amounts.series) {
|
|
103
|
+
if (series.api_key) keys.add(JSON.stringify(series.api_key));
|
|
104
|
+
if (!Array.isArray(series.buckets) || series.buckets.length > 32) throw new Error('Invalid buckets');
|
|
105
|
+
for (const bucket of series.buckets) addAmount(dateFor(bucket.time),bucket.usage);
|
|
106
|
+
}
|
|
107
|
+
for (const series of block.series) {
|
|
108
|
+
if (series.api_key) keys.add(JSON.stringify(series.api_key));
|
|
109
|
+
if (!Array.isArray(series.buckets) || series.buckets.length > 32) throw new Error('Invalid buckets');
|
|
110
|
+
for (const bucket of series.buckets) addCost(dateFor(bucket.time),series.model,bucket.cost);
|
|
111
|
+
}
|
|
58
112
|
} else {
|
|
59
|
-
|
|
113
|
+
for (const item of amounts.days.slice(0,32)) for (const model of (item.data || []).slice(0,1000))
|
|
114
|
+
addAmount(item.date, Object.fromEntries((model.usage || []).map(value => [value.type,value.amount])));
|
|
115
|
+
for (const item of (block.days || []).slice(0,32)) for (const model of (item.data || []).slice(0,1000))
|
|
116
|
+
for (const value of model.usage || []) addCost(item.date,model.model,value.amount);
|
|
117
|
+
}
|
|
118
|
+
const daily = [...days.values()].sort((a,b)=>a.date.localeCompare(b.date));
|
|
119
|
+
for (const row of daily) {
|
|
120
|
+
row.tokensKnown = row.amountSeen && !row.badTokens && Number.isSafeInteger(row.totalTokens);
|
|
121
|
+
row.costKnown = row.costSeen && !row.badCost && Number.isFinite(row.costUsd);
|
|
122
|
+
if (!Number.isFinite(row.costUsd)) throw new Error('Cost overflow');
|
|
123
|
+
delete row.amountSeen; delete row.costSeen; delete row.badTokens; delete row.badCost;
|
|
60
124
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
if
|
|
64
|
-
|
|
125
|
+
if (!daily.length) return;
|
|
126
|
+
const total = daily.reduce((sum,row)=>sum+row.costUsd,0), complete = daily.every(row=>row.costKnown);
|
|
127
|
+
if(!Number.isFinite(total)) throw new Error('Cost overflow');
|
|
128
|
+
const usageLines = [
|
|
129
|
+
ctx.line.text({label:monthly?'This month':'Last 30 days',value:currency+' '+total.toFixed(2)+(complete?'':'+'),subtitle:'Platform-account spend across API keys'}),
|
|
130
|
+
ctx.line.text({label:'Tokens',value:String(daily.reduce((sum,row)=>sum+row.totalTokens,0))+(daily.every(row=>row.tokensKnown)?'':'+')}),
|
|
131
|
+
ctx.line.text({label:'Requests',value:String(daily.reduce((sum,row)=>sum+row.requests,0))})
|
|
132
|
+
];
|
|
133
|
+
if(keys.size) usageLines.push(ctx.line.text({label:'API keys',value:String(keys.size)}));
|
|
134
|
+
for(const [model,cost] of [...models].filter(([,v])=>v!==null && Number.isFinite(v)).sort((a,b)=>b[1]-a[1]).slice(0,30))
|
|
135
|
+
usageLines.push(ctx.line.text({label:model,value:currency+' '+cost.toFixed(2)}));
|
|
136
|
+
usageLines.push(ctx.line.barChart({label:'Daily tokens',points:daily.map(row=>({label:row.date,value:row.totalTokens}))}));
|
|
137
|
+
usageLines.push(ctx.line.barChart({label:'Daily spend',points:daily.filter(row=>row.costKnown).map(row=>({label:row.date,value:row.costUsd,valueLabel:currency+' '+row.costUsd.toFixed(2)}))}));
|
|
138
|
+
// The shared ledger is USD-only; never relabel CNY spend as dollars.
|
|
139
|
+
const stored = daily.map(row=>currency==='USD'?row:{...row,costUsd:0,costKnown:false});
|
|
140
|
+
ctx.host.usageDaily.ingest({displayName:'DeepSeek',source:'deepseek_platform',daily:stored});
|
|
141
|
+
lines.push(...usageLines);
|
|
142
|
+
}
|
|
143
|
+
function probe(ctx) {
|
|
144
|
+
const provider = ctx.provider || {}, settings = provider.settings || {}, scoped = provider.instanceId && provider.instanceId !== 'deepseek';
|
|
145
|
+
const env = key => scoped ? null : clean(ctx.host.env.get(key));
|
|
146
|
+
const key = ctx.sourceMode === 'web' ? null : own(provider,'apiKey') ? clean(provider.apiKey) : env('DEEPSEEK_API_KEY') || env('DEEPSEEK_KEY');
|
|
147
|
+
const token = own(settings,'platformToken') ? clean(settings.platformToken) : own(provider,'cookieHeader') ? clean(provider.cookieHeader) : env('DEEPSEEK_PLATFORM_TOKEN') || env('DEEPSEEK_USER_TOKEN');
|
|
148
|
+
if (!key && !token || ctx.sourceMode === 'api' && !key) fail('missing-auth','Set a DeepSeek API key or a Platform token in web mode.');
|
|
149
|
+
const data = balance(ctx,key,token), lines = [], value = data.value;
|
|
150
|
+
if (value) lines.push(ctx.line.text({label:'Balance',value:value.currency+' '+value.total.toFixed(2),
|
|
151
|
+
subtitle:'Paid: '+value.paid.toFixed(2)+' / Granted: '+value.granted.toFixed(2)}));
|
|
152
|
+
else lines.push(ctx.line.badge({label:'Balance',text:'No balance data',color:'#a3a3a3'}));
|
|
153
|
+
if (!data.available) lines.push(ctx.line.badge({label:'Status',text:'Balance unavailable for API calls',color:'#ef4444'}));
|
|
154
|
+
// Pair website totals only with an explicitly bound API key, never ambient account state.
|
|
155
|
+
if (token && (!key || own(settings,'platformToken') && settings.platformApiKeyHash === ctx.host.crypto.sha256(key)) && settings.extraUsage !== false) {
|
|
156
|
+
try { details(ctx,token,lines); }
|
|
157
|
+
catch (_) { lines.push(ctx.line.text({label:'Details',value:'Detailed usage unavailable'})); }
|
|
65
158
|
}
|
|
66
|
-
|
|
67
|
-
return { lines: lines };
|
|
159
|
+
return {source:key?'api':'web',lines};
|
|
68
160
|
}
|
|
69
|
-
|
|
70
|
-
globalThis.__openusage_plugin = { id: "deepseek", probe: probe };
|
|
161
|
+
globalThis.__openusage_plugin = {id:'deepseek',probe};
|
|
71
162
|
})();
|
|
@@ -9,8 +9,10 @@
|
|
|
9
9
|
{ "label": "Platform", "url": "https://platform.deepseek.com/usage" }
|
|
10
10
|
],
|
|
11
11
|
"usageDashboardUrl": "https://platform.deepseek.com/usage",
|
|
12
|
-
"supportedModes": ["api"],
|
|
12
|
+
"supportedModes": ["api", "web"],
|
|
13
13
|
"autoMode": "api",
|
|
14
|
+
"webUrl": "https://platform.deepseek.com",
|
|
15
|
+
"envVars": ["DEEPSEEK_API_KEY", "DEEPSEEK_KEY", "DEEPSEEK_PLATFORM_TOKEN", "DEEPSEEK_USER_TOKEN"],
|
|
14
16
|
"lines": [
|
|
15
17
|
{ "type": "text", "label": "Balance", "scope": "overview" }
|
|
16
18
|
]
|
package/plugins/devin/plugin.js
CHANGED
|
@@ -273,8 +273,11 @@
|
|
|
273
273
|
var hideDailyQuota = planInfo.hideDailyQuota === true
|
|
274
274
|
var dailyRemaining = readFiniteNumber(planStatus.dailyQuotaRemainingPercent)
|
|
275
275
|
var weeklyRemaining = readFiniteNumber(planStatus.weeklyQuotaRemainingPercent)
|
|
276
|
+
if (Object.prototype.hasOwnProperty.call(planStatus, "weeklyQuotaRemainingPercent") && weeklyRemaining === null) throw QUOTA_HINT
|
|
276
277
|
var dailyReset = !hideDailyQuota ? unixSecondsToIso(ctx, planStatus.dailyQuotaResetAtUnix) : null
|
|
277
278
|
var weeklyReset = unixSecondsToIso(ctx, planStatus.weeklyQuotaResetAtUnix)
|
|
279
|
+
// Proto3 omits a zero remaining percentage; a reset identifies the exhausted window.
|
|
280
|
+
if (weeklyRemaining === null && weeklyReset) weeklyRemaining = 0
|
|
278
281
|
var extraUsageBalance = formatDollarsFromMicros(planStatus.overageBalanceMicros)
|
|
279
282
|
|
|
280
283
|
var dailyLine = !hideDailyQuota
|
|
@@ -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,120 @@
|
|
|
1
|
+
// Generated by tools/vendor-codexbar-providers.cjs; see LICENSE.
|
|
2
|
+
globalThis.__usagestat_bundled_options = {"labels":["Plan credits","Premium weekly","Additional"],"defaults":{},"autoMode":"api"};
|
|
3
|
+
(function(defineProvider) {
|
|
4
|
+
// BEGIN UPSTREAM Sources/CodexBarCore/Resources/Plugins/devpass.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: "devpass",
|
|
35
|
+
name: "DevPass",
|
|
36
|
+
endpoints: ["https://api.llmgateway.io"],
|
|
37
|
+
auth: { type: "bearer", secret: "DEVPASS_API_KEY" },
|
|
38
|
+
settings: [{ key: "DEVPASS_API_KEY", title: "DevPass API key", type: "secure" }],
|
|
39
|
+
capabilities: ["http-status"],
|
|
40
|
+
async fetchUsage(ctx) {
|
|
41
|
+
const response = await ctx.http.get("https://api.llmgateway.io/v1/key");
|
|
42
|
+
if (response.status === 401) throw ctx.fail.authenticationExpired("DevPass API key was rejected or is inactive.");
|
|
43
|
+
if (response.status === 403) throw ctx.fail.permissionDenied("DevPass requires a regular gateway API key.");
|
|
44
|
+
if (response.status === 429) {
|
|
45
|
+
const delay = Number(_nullishCoalesce(response.headers["retry-after"], () => 1));
|
|
46
|
+
throw ctx.fail.rateLimited("DevPass usage requests are rate limited.", {
|
|
47
|
+
retryAfterSeconds: Number.isFinite(delay) && delay >= 0 ? Math.min(delay, 10) : 1,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (response.status >= 500) throw ctx.fail.providerUnavailable("DevPass usage is temporarily unavailable.");
|
|
51
|
+
if (response.status !== 200) throw ctx.fail.apiFailure(`DevPass returned HTTP ${response.status}.`);
|
|
52
|
+
function fail() {
|
|
53
|
+
throw ctx.fail.parseFailure("DevPass returned an unrecognized usage response.");
|
|
54
|
+
}
|
|
55
|
+
let body;
|
|
56
|
+
try {
|
|
57
|
+
body = JSON.parse(response.bodyText);
|
|
58
|
+
} catch (error) {
|
|
59
|
+
void error;
|
|
60
|
+
return fail();
|
|
61
|
+
}
|
|
62
|
+
const data = _optionalChain([body, "optionalAccess", (_) => _.data]);
|
|
63
|
+
if (!data || !["none", "lite", "pro", "max"].includes(data.devPlan)) return fail();
|
|
64
|
+
function money(key) {
|
|
65
|
+
const value = data[key];
|
|
66
|
+
if (typeof value !== "string" || !/^\d+(?:\.\d+)?$/.test(value)) return fail();
|
|
67
|
+
const number = Number(value);
|
|
68
|
+
if (!Number.isFinite(number)) return fail();
|
|
69
|
+
return number;
|
|
70
|
+
}
|
|
71
|
+
const keyUsed = money("usage");
|
|
72
|
+
const keyLimit = data.limit === null ? null : money("limit");
|
|
73
|
+
const keyRows = [{ label: "All-time key usage", value: ctx.format.usd(keyUsed) }];
|
|
74
|
+
if (keyLimit !== null) keyRows.push({ label: "Key spending limit", value: ctx.format.usd(keyLimit) });
|
|
75
|
+
if (data.devPlan === "none") {
|
|
76
|
+
return {
|
|
77
|
+
details: [{ title: "API key (all time)", rows: keyRows }],
|
|
78
|
+
identity: { loginMethod: "Pay as you go" },
|
|
79
|
+
dataConfidence: "exact",
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const used = money("devPlanCreditsUsed");
|
|
83
|
+
const limit = money("devPlanCreditsLimit");
|
|
84
|
+
const remaining = money("devPlanCreditsRemaining");
|
|
85
|
+
const weeklyUsed = money("devPlanPremiumCreditsUsed");
|
|
86
|
+
const weeklyLimit = money("devPlanPremiumWeeklyLimit");
|
|
87
|
+
const reset = data.devPlanPremiumWeekResetsAt;
|
|
88
|
+
let resetsAt = null;
|
|
89
|
+
if (reset !== null) {
|
|
90
|
+
if (
|
|
91
|
+
typeof reset !== "string" ||
|
|
92
|
+
!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/.test(reset)
|
|
93
|
+
)
|
|
94
|
+
return fail();
|
|
95
|
+
resetsAt = new Date(reset);
|
|
96
|
+
if (!Number.isFinite(resetsAt.getTime())) return fail();
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
primary: limit > 0 ? { usedPercent: ctx.pct(used, limit) } : null,
|
|
100
|
+
secondary:
|
|
101
|
+
weeklyLimit > 0 ? { usedPercent: ctx.pct(weeklyUsed, weeklyLimit), windowMinutes: 10080, resetsAt } : null,
|
|
102
|
+
details: [
|
|
103
|
+
{
|
|
104
|
+
title: "DevPass credits",
|
|
105
|
+
rows: [
|
|
106
|
+
{ label: "Cycle used", value: `${ctx.format.usd(used)} / ${ctx.format.usd(limit)}` },
|
|
107
|
+
{ label: "Cycle remaining", value: ctx.format.usd(remaining) },
|
|
108
|
+
{ label: "Premium weekly", value: `${ctx.format.usd(weeklyUsed)} / ${ctx.format.usd(weeklyLimit)}` },
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
{ title: "API key (all time)", rows: keyRows },
|
|
112
|
+
],
|
|
113
|
+
identity: { loginMethod: `DevPass ${data.devPlan.charAt(0).toUpperCase()}${data.devPlan.slice(1)}` },
|
|
114
|
+
dataConfidence: "exact",
|
|
115
|
+
};
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
// END UPSTREAM
|
|
120
|
+
})(globalThis.defineProvider);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"id": "devpass",
|
|
4
|
+
"name": "DevPass",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"entry": "plugin.js",
|
|
7
|
+
"enabledByDefault": false,
|
|
8
|
+
"supportedModes": [
|
|
9
|
+
"api"
|
|
10
|
+
],
|
|
11
|
+
"autoMode": "api",
|
|
12
|
+
"usageDashboardUrl": "https://devpass.llmgateway.io/dashboard",
|
|
13
|
+
"envVars": [
|
|
14
|
+
"DEVPASS_API_KEY"
|
|
15
|
+
],
|
|
16
|
+
"setupFields": [],
|
|
17
|
+
"upstream": {
|
|
18
|
+
"repository": "https://github.com/steipete/CodexBar",
|
|
19
|
+
"revision": "1f6da9bec44455288ddee5ef6f3617a803d8eb2a",
|
|
20
|
+
"path": "Sources/CodexBarCore/Resources/Plugins/devpass.js",
|
|
21
|
+
"sha256": "6fdfab17f543fc88f28b90f76fbe6edc6db3f4d3c7fa657a899c573d363a0886",
|
|
22
|
+
"license": "MIT"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -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 height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Exa</title><path clip-rule="evenodd" d="M3 0h19v1.791L13.892 12 22 22.209V24H3V0zm9.62 10.348l6.589-8.557H6.03l6.59 8.557zM5.138 3.935v7.17h5.52l-5.52-7.17zm5.52 8.96h-5.52v7.17l5.52-7.17zM6.03 22.21l6.59-8.557 6.589 8.557H6.03z" fill="#1F40ED" fill-rule="evenodd"></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>Exa</title><path clip-rule="evenodd" d="M3 0h19v1.791L13.892 12 22 22.209V24H3V0zm9.62 10.348l6.589-8.557H6.03l6.59 8.557zM5.138 3.935v7.17h5.52l-5.52-7.17zm5.52 8.96h-5.52v7.17l5.52-7.17zM6.03 22.21l6.59-8.557 6.589 8.557H6.03z"></path></svg>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Generated by tools/vendor-codexbar-providers.cjs; see LICENSE.
|
|
2
|
+
globalThis.__usagestat_bundled_options = {"labels":["Usage","Additional","Additional"],"defaults":{},"autoMode":"api"};
|
|
3
|
+
(function(defineProvider) {
|
|
4
|
+
// BEGIN UPSTREAM Sources/CodexBarCore/Resources/Plugins/exa.js
|
|
5
|
+
defineProvider({
|
|
6
|
+
id: "exa",
|
|
7
|
+
name: "Exa",
|
|
8
|
+
endpoints: ["https://admin-api.exa.ai"],
|
|
9
|
+
auth: { type: "x-api-key", secret: "EXA_SERVICE_KEY" },
|
|
10
|
+
settings: [
|
|
11
|
+
{ key: "EXA_SERVICE_KEY", title: "Exa service key", type: "secure" },
|
|
12
|
+
{ key: "EXA_API_KEY_ID", title: "API key ID", type: "plain" },
|
|
13
|
+
],
|
|
14
|
+
capabilities: ["http-status"],
|
|
15
|
+
async fetchUsage(ctx) {
|
|
16
|
+
const id = ctx.settings.get("EXA_API_KEY_ID");
|
|
17
|
+
if (!id || id === "." || id === "..") {
|
|
18
|
+
throw ctx.fail.missingCredential(
|
|
19
|
+
"Set the Exa API key ID in Scope or EXA_API_KEY_ID; this is not the service key.",
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
const end = new Date(Math.floor(ctx.date.now().getTime() / 1000) * 1000);
|
|
23
|
+
const start = new Date(Date.UTC(end.getUTCFullYear(), end.getUTCMonth(), 1));
|
|
24
|
+
const url =
|
|
25
|
+
`https://admin-api.exa.ai/team-management/api-keys/${encodeURIComponent(id)}/usage` +
|
|
26
|
+
`?start_date=${encodeURIComponent(start.toISOString())}&end_date=${encodeURIComponent(end.toISOString())}`;
|
|
27
|
+
const response = await ctx.http.get(url);
|
|
28
|
+
const message = `Exa returned HTTP ${response.status}.`;
|
|
29
|
+
if (response.status === 401) {
|
|
30
|
+
throw ctx.fail.authenticationExpired("Exa rejected the service key. Ordinary search API keys are not supported.");
|
|
31
|
+
}
|
|
32
|
+
if (response.status === 403) {
|
|
33
|
+
throw ctx.fail.permissionDenied(
|
|
34
|
+
"Exa Team Management must be enabled and both keys must belong to the same team.",
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
if (response.status === 429) throw ctx.fail.rateLimited(message);
|
|
38
|
+
if (response.status >= 500) throw ctx.fail.providerUnavailable(message);
|
|
39
|
+
if (response.status !== 200) throw ctx.fail.apiFailure(message);
|
|
40
|
+
const fail = () => {
|
|
41
|
+
throw ctx.fail.parseFailure("Exa returned an unrecognized API key usage response.");
|
|
42
|
+
};
|
|
43
|
+
let data;
|
|
44
|
+
try {
|
|
45
|
+
data = JSON.parse(response.bodyText);
|
|
46
|
+
} catch {
|
|
47
|
+
return fail();
|
|
48
|
+
}
|
|
49
|
+
if (
|
|
50
|
+
!data ||
|
|
51
|
+
typeof data.total_cost_usd !== "number" ||
|
|
52
|
+
!Number.isFinite(data.total_cost_usd) ||
|
|
53
|
+
data.total_cost_usd < 0 ||
|
|
54
|
+
!data.period ||
|
|
55
|
+
typeof data.period.start !== "string" ||
|
|
56
|
+
typeof data.period.end !== "string" ||
|
|
57
|
+
Date.parse(data.period.start) !== start.getTime() ||
|
|
58
|
+
Date.parse(data.period.end) !== end.getTime()
|
|
59
|
+
)
|
|
60
|
+
return fail();
|
|
61
|
+
return {
|
|
62
|
+
details: [
|
|
63
|
+
{
|
|
64
|
+
title: "API key this month (UTC)",
|
|
65
|
+
rows: [{ label: "Spend", value: ctx.format.currency(data.total_cost_usd, "USD") }],
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
identity: { loginMethod: "Service key" },
|
|
69
|
+
dataConfidence: "exact",
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// END UPSTREAM
|
|
75
|
+
})(globalThis.defineProvider);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"id": "exa",
|
|
4
|
+
"name": "Exa",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"entry": "plugin.js",
|
|
7
|
+
"enabledByDefault": false,
|
|
8
|
+
"supportedModes": [
|
|
9
|
+
"api"
|
|
10
|
+
],
|
|
11
|
+
"autoMode": "api",
|
|
12
|
+
"usageDashboardUrl": "https://dashboard.exa.ai",
|
|
13
|
+
"envVars": [
|
|
14
|
+
"EXA_SERVICE_KEY",
|
|
15
|
+
"EXA_API_KEY_ID"
|
|
16
|
+
],
|
|
17
|
+
"setupFields": [
|
|
18
|
+
{
|
|
19
|
+
"key": "EXA_API_KEY_ID",
|
|
20
|
+
"title": "API key ID",
|
|
21
|
+
"type": "string",
|
|
22
|
+
"description": "Provider-specific account or source selection."
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"upstream": {
|
|
26
|
+
"repository": "https://github.com/steipete/CodexBar",
|
|
27
|
+
"revision": "1f6da9bec44455288ddee5ef6f3617a803d8eb2a",
|
|
28
|
+
"path": "Sources/CodexBarCore/Resources/Plugins/exa.js",
|
|
29
|
+
"sha256": "36d2cbf9973e160f2e0d2548ff1f9bbf254f94c9a09710004c0718749e5cdfbd",
|
|
30
|
+
"license": "MIT"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 67 65" id="mobile-nav-logo" class="h-auto w-10 md:hidden"><path fill="currentColor" d="M47.75 11.15a.867.867 0 0 1-.671-.806.84.84 0 0 1 .067-.362c1.688-4.007 2.433-7.213 1.23-8.555-3.183-3.56-15.952 3.52-20.024 5.919a.9.9 0 0 1-1.273-.41c-1.711-3.998-3.51-6.78-5.334-6.9-4.833-.323-8.73 13.49-9.87 17.992a.85.85 0 0 1-.459.563.9.9 0 0 1-.737.027c-4.109-1.647-7.398-2.373-8.773-1.2-3.651 3.104 3.609 15.557 6.068 19.528a.85.85 0 0 1-.11 1.031.9.9 0 0 1-.31.21C3.455 39.856.604 41.61.478 43.389c-.329 4.713 13.834 8.513 18.452 9.625q.186.046.337.163a.87.87 0 0 1 .332.642.84.84 0 0 1-.067.362c-1.688 4.007-2.433 7.214-1.23 8.555 3.183 3.561 15.954-3.519 20.025-5.917a.9.9 0 0 1 1.058.107.9.9 0 0 1 .215.302c1.711 3.997 3.509 6.779 5.334 6.9 4.833.322 8.73-13.49 9.868-17.993a.85.85 0 0 1 .168-.33.88.88 0 0 1 .659-.324.9.9 0 0 1 .371.066c4.109 1.647 7.397 2.372 8.773 1.2 3.651-3.105-3.61-15.559-6.07-19.53a.85.85 0 0 1 .111-1.03.9.9 0 0 1 .31-.21c4.1-1.67 6.952-3.424 7.075-5.203.331-4.713-13.833-8.513-18.45-9.623m-5.546-4.518c.93 1.624-3.858 12.446-7.42 20.015a.7.7 0 0 1-.28.303.71.71 0 0 1-.796-.059.7.7 0 0 1-.23-.341c-1.439-4.921-3.082-10.704-4.841-15.612a.84.84 0 0 1 .01-.594.87.87 0 0 1 .401-.446c4.392-2.34 11.908-5.446 13.156-3.266m-21.048 1.34c1.833.507 6.294 11.46 9.264 19.268a.67.67 0 0 1-.2.754.71.71 0 0 1-.794.08c-4.589-2.485-9.94-5.444-14.743-7.702a.87.87 0 0 1-.422-.427.84.84 0 0 1-.04-.591c1.414-4.679 4.471-12.063 6.935-11.383M7.243 23.433c1.664-.906 12.762 3.763 20.522 7.235.13.058.239.154.311.274a.67.67 0 0 1-.06.776.7.7 0 0 1-.35.225c-5.045 1.403-10.976 3.006-16.01 4.721a.9.9 0 0 1-.607-.01.88.88 0 0 1-.456-.391c-2.395-4.284-5.586-11.613-3.35-12.83M8.617 43.96c.519-1.788 11.752-6.14 19.758-9.035a.72.72 0 0 1 .773.195.67.67 0 0 1 .081.774c-2.548 4.475-5.582 9.694-7.898 14.377a.87.87 0 0 1-.437.413.9.9 0 0 1-.607.039c-4.797-1.37-12.37-4.36-11.67-6.763m15.855 13.568c-.93-1.623 3.859-12.446 7.42-20.014a.7.7 0 0 1 .28-.303.715.715 0 0 1 .796.059.7.7 0 0 1 .23.34c1.439 4.92 3.083 10.705 4.841 15.613a.84.84 0 0 1-.01.593.87.87 0 0 1-.402.445c-4.391 2.335-11.908 5.447-13.15 3.267zm21.049-1.34c-1.836-.506-6.297-11.461-9.266-19.269a.67.67 0 0 1 .2-.755.71.71 0 0 1 .795-.078c4.587 2.484 9.94 5.445 14.742 7.703.189.088.339.24.423.426a.84.84 0 0 1 .039.592c-1.413 4.686-4.47 12.063-6.933 11.381m13.912-15.462c-1.665.907-12.762-3.763-20.523-7.236a.7.7 0 0 1-.311-.273.67.67 0 0 1 .06-.777.7.7 0 0 1 .35-.225c5.046-1.402 10.975-3.005 16.009-4.72a.9.9 0 0 1 .609.01.88.88 0 0 1 .457.392c2.393 4.282 5.584 11.613 3.349 12.829M58.06 20.2c-.521 1.79-11.753 6.14-19.759 9.036a.72.72 0 0 1-.774-.195.67.67 0 0 1-.08-.776c2.547-4.474 5.581-9.694 7.897-14.377a.87.87 0 0 1 .437-.412.9.9 0 0 1 .607-.038c4.797 1.377 12.37 4.359 11.672 6.762"></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 height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Fal</title><path clip-rule="evenodd" d="M15.477 0c.415 0 .749.338.788.752a7.775 7.775 0 006.985 6.984c.413.04.752.373.752.788v6.952c0 .415-.338.748-.752.788a7.775 7.775 0 00-6.985 6.984c-.04.414-.373.752-.788.752H8.525c-.416 0-.749-.338-.789-.752a7.775 7.775 0 00-6.984-6.984c-.414-.04-.752-.373-.752-.788V8.524c0-.415.338-.748.752-.788A7.775 7.775 0 007.736.752C7.776.338 8.11 0 8.526 0h6.95zM4.819 11.98a7.226 7.226 0 007.223 7.23 7.226 7.226 0 007.223-7.23c0-3.994-3.234-7.23-7.223-7.23a7.227 7.227 0 00-7.223 7.23z" fill="#EC0648" fill-rule="evenodd"></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>Fal</title><path clip-rule="evenodd" d="M15.477 0c.415 0 .749.338.788.752a7.775 7.775 0 006.985 6.984c.413.04.752.373.752.788v6.952c0 .415-.338.748-.752.788a7.775 7.775 0 00-6.985 6.984c-.04.414-.373.752-.788.752H8.525c-.416 0-.749-.338-.789-.752a7.775 7.775 0 00-6.984-6.984c-.414-.04-.752-.373-.752-.788V8.524c0-.415.338-.748.752-.788A7.775 7.775 0 007.736.752C7.776.338 8.11 0 8.526 0h6.95zM4.819 11.98a7.226 7.226 0 007.223 7.23 7.226 7.226 0 007.223-7.23c0-3.994-3.234-7.23-7.223-7.23a7.227 7.227 0 00-7.223 7.23z"></path></svg>
|