@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.
Files changed (284) hide show
  1. package/native-manifest.json +1532 -134
  2. package/package.json +235 -2
  3. package/plugins/UPSTREAM-LICENSES.md +6 -2
  4. package/plugins/_provider-icons/LICENSE +21 -0
  5. package/plugins/_provider-icons/NOTICE +12 -0
  6. package/plugins/_provider-icons/licenses/CodexBar-MIT.txt +21 -0
  7. package/plugins/_provider-icons/licenses/LobeHub-MIT.txt +21 -0
  8. package/plugins/_provider-icons/licenses/UsageStat-Bar-MIT.txt +21 -0
  9. package/plugins/_provider-icons/manifest.json +1219 -0
  10. package/plugins/_provider-icons/provenance.json +269 -0
  11. package/plugins/_provider-icons/source.json +4 -0
  12. package/plugins/abacus-ai/icon-color.svg +18 -0
  13. package/plugins/abliteration/LICENSE +21 -0
  14. package/plugins/abliteration/icon.svg +5 -0
  15. package/plugins/abliteration/plugin.js +89 -0
  16. package/plugins/abliteration/plugin.json +24 -0
  17. package/plugins/aerostack/LICENSE +21 -0
  18. package/plugins/aerostack/icon.svg +1 -0
  19. package/plugins/aerostack/plugin.js +94 -0
  20. package/plugins/aerostack/plugin.json +24 -0
  21. package/plugins/aixy/LICENSE +21 -0
  22. package/plugins/aixy/icon.svg +1 -0
  23. package/plugins/aixy/plugin.js +266 -0
  24. package/plugins/aixy/plugin.json +32 -0
  25. package/plugins/antigravity/plugin.js +189 -65
  26. package/plugins/antigravity-cli/icon-color.svg +1 -0
  27. package/plugins/antigravity-cli/icon.svg +1 -3
  28. package/plugins/antigravity-cli/plugin.js +32 -20
  29. package/plugins/antigravity-ide/icon-color.svg +1 -0
  30. package/plugins/antigravity-ide/icon.svg +1 -3
  31. package/plugins/antigravity-ide/plugin.js +19 -7
  32. package/plugins/atlascloud/LICENSE +21 -0
  33. package/plugins/atlascloud/icon-color.svg +1 -0
  34. package/plugins/atlascloud/icon.svg +1 -0
  35. package/plugins/atlascloud/plugin.js +54 -0
  36. package/plugins/atlascloud/plugin.json +24 -0
  37. package/plugins/augment/icon-color.svg +14 -0
  38. package/plugins/bifrost/LICENSE +21 -0
  39. package/plugins/bifrost/icon.svg +3 -0
  40. package/plugins/bifrost/plugin.js +366 -0
  41. package/plugins/bifrost/plugin.json +31 -0
  42. package/plugins/chatbox/LICENSE +21 -0
  43. package/plugins/chatbox/icon.svg +4 -0
  44. package/plugins/chatbox/plugin.js +208 -0
  45. package/plugins/chatbox/plugin.json +24 -0
  46. package/plugins/claude/plugin.js +340 -153
  47. package/plugins/claude/plugin.json +1 -1
  48. package/plugins/claudeplatform/LICENSE +21 -0
  49. package/plugins/claudeplatform/icon.svg +3 -0
  50. package/plugins/claudeplatform/plugin.js +244 -0
  51. package/plugins/claudeplatform/plugin.json +25 -0
  52. package/plugins/clinepass/plugin.js +19 -3
  53. package/plugins/codebuff/icon-color.svg +92 -0
  54. package/plugins/coderabbit/plugin.js +25 -0
  55. package/plugins/coderabbit/plugin.json +12 -0
  56. package/plugins/codex/plugin.js +15 -8
  57. package/plugins/codex/plugin.json +11 -2
  58. package/plugins/command-code/icon-color.svg +3 -0
  59. package/plugins/command-code/plugin.js +7 -3
  60. package/plugins/copilot/icon.svg +1 -1
  61. package/plugins/copilot/plugin.json +1 -0
  62. package/plugins/cosmic/LICENSE +21 -0
  63. package/plugins/cosmic/icon.svg +1 -0
  64. package/plugins/cosmic/plugin.js +134 -0
  65. package/plugins/cosmic/plugin.json +32 -0
  66. package/plugins/crof/icon-color.svg +3 -0
  67. package/plugins/crofai/icon-color.svg +3 -0
  68. package/plugins/crofai/icon.svg +2 -15
  69. package/plugins/cursor/icon-color.svg +1 -0
  70. package/plugins/cursor/plugin.js +51 -14
  71. package/plugins/cursor-nightly/plugin.json +1 -1
  72. package/plugins/deepinfra/icon-color.svg +1 -0
  73. package/plugins/deepinfra/icon.svg +1 -4
  74. package/plugins/deepseek/plugin.js +150 -59
  75. package/plugins/deepseek/plugin.json +3 -1
  76. package/plugins/devin/plugin.js +3 -0
  77. package/plugins/devpass/LICENSE +21 -0
  78. package/plugins/devpass/icon.svg +3 -0
  79. package/plugins/devpass/plugin.js +120 -0
  80. package/plugins/devpass/plugin.json +24 -0
  81. package/plugins/elevenlabs/icon-color.svg +4 -0
  82. package/plugins/exa/LICENSE +21 -0
  83. package/plugins/exa/icon-color.svg +1 -0
  84. package/plugins/exa/icon.svg +1 -0
  85. package/plugins/exa/plugin.js +75 -0
  86. package/plugins/exa/plugin.json +32 -0
  87. package/plugins/factory/icon-color.svg +1 -0
  88. package/plugins/fal/LICENSE +21 -0
  89. package/plugins/fal/icon-color.svg +1 -0
  90. package/plugins/fal/icon.svg +1 -0
  91. package/plugins/fal/plugin.js +74 -0
  92. package/plugins/fal/plugin.json +24 -0
  93. package/plugins/fireworks-ai/icon-color.svg +1 -0
  94. package/plugins/fireworks-ai/icon.svg +1 -6
  95. package/plugins/flora/LICENSE +21 -0
  96. package/plugins/flora/icon.svg +4 -0
  97. package/plugins/flora/plugin.js +93 -0
  98. package/plugins/flora/plugin.json +32 -0
  99. package/plugins/futureagi/LICENSE +21 -0
  100. package/plugins/futureagi/icon.svg +24 -0
  101. package/plugins/futureagi/plugin.js +139 -0
  102. package/plugins/futureagi/plugin.json +32 -0
  103. package/plugins/gemini-apps/LICENSE +21 -0
  104. package/plugins/gemini-apps/icon-color.svg +1 -0
  105. package/plugins/gemini-apps/icon.svg +1 -0
  106. package/plugins/gemini-apps/plugin.js +141 -0
  107. package/plugins/gemini-apps/plugin.json +25 -0
  108. package/plugins/gitkraken/LICENSE +21 -0
  109. package/plugins/gitkraken/icon.svg +2 -0
  110. package/plugins/gitkraken/plugin.js +158 -0
  111. package/plugins/gitkraken/plugin.json +32 -0
  112. package/plugins/googledeveloper/LICENSE +21 -0
  113. package/plugins/googledeveloper/icon.svg +3 -0
  114. package/plugins/googledeveloper/plugin.js +204 -0
  115. package/plugins/googledeveloper/plugin.json +25 -0
  116. package/plugins/grok/icon-color.svg +1 -0
  117. package/plugins/groqcloud/icon-color.svg +1 -0
  118. package/plugins/helmcode/LICENSE +21 -0
  119. package/plugins/helmcode/icon.svg +5 -0
  120. package/plugins/helmcode/plugin.js +253 -0
  121. package/plugins/helmcode/plugin.json +32 -0
  122. package/plugins/huggingface/LICENSE +21 -0
  123. package/plugins/huggingface/icon-color.svg +1 -0
  124. package/plugins/huggingface/icon.svg +1 -0
  125. package/plugins/huggingface/plugin.js +298 -0
  126. package/plugins/huggingface/plugin.json +26 -0
  127. package/plugins/hyper/LICENSE +21 -0
  128. package/plugins/hyper/plugin.js +137 -0
  129. package/plugins/hyper/plugin.json +27 -0
  130. package/plugins/jetbrains-ai-assistant/LICENSE +22 -0
  131. package/plugins/jetbrains-ai-assistant/plugin.js +502 -16
  132. package/plugins/jetbrains-ai-assistant/plugin.json +27 -4
  133. package/plugins/kilo/icon-color.svg +1 -0
  134. package/plugins/kimi/plugin.js +54 -14
  135. package/plugins/kimi/plugin.json +46 -6
  136. package/plugins/langdock/LICENSE +21 -0
  137. package/plugins/langdock/icon.svg +4 -0
  138. package/plugins/langdock/plugin.js +106 -0
  139. package/plugins/langdock/plugin.json +25 -0
  140. package/plugins/linkup/LICENSE +21 -0
  141. package/plugins/linkup/icon.svg +10 -0
  142. package/plugins/linkup/plugin.js +46 -0
  143. package/plugins/linkup/plugin.json +24 -0
  144. package/plugins/litellm/plugin.js +54 -3
  145. package/plugins/lithosai/LICENSE +21 -0
  146. package/plugins/lithosai/icon.svg +1 -0
  147. package/plugins/lithosai/plugin.js +130 -0
  148. package/plugins/lithosai/plugin.json +26 -0
  149. package/plugins/llmman/LICENSE +21 -0
  150. package/plugins/llmman/icon.svg +4 -0
  151. package/plugins/llmman/plugin.js +138 -0
  152. package/plugins/llmman/plugin.json +31 -0
  153. package/plugins/longcat/icon-color.svg +1 -0
  154. package/plugins/longcat/icon.svg +1 -4
  155. package/plugins/manus/icon-color.svg +6 -0
  156. package/plugins/mimo/icon-color.svg +4 -0
  157. package/plugins/mimo/icon.svg +4 -1
  158. package/plugins/mistral/plugin.js +164 -27
  159. package/plugins/moonshot/icon-color.svg +1 -0
  160. package/plugins/munito/LICENSE +21 -0
  161. package/plugins/munito/icon.svg +7 -0
  162. package/plugins/munito/plugin.js +171 -0
  163. package/plugins/munito/plugin.json +24 -0
  164. package/plugins/muse/LICENSE +21 -0
  165. package/plugins/muse/icon.svg +3 -0
  166. package/plugins/muse/plugin.js +288 -0
  167. package/plugins/muse/plugin.json +34 -0
  168. package/plugins/museai/LICENSE +21 -0
  169. package/plugins/museai/icon.svg +3 -0
  170. package/plugins/museai/plugin.js +161 -0
  171. package/plugins/museai/plugin.json +26 -0
  172. package/plugins/nous/LICENSE +21 -0
  173. package/plugins/nous/icon-color.svg +1 -0
  174. package/plugins/nous/icon.svg +1 -0
  175. package/plugins/nous/plugin.js +129 -0
  176. package/plugins/nous/plugin.json +32 -0
  177. package/plugins/ollama/icon-color.svg +1 -0
  178. package/plugins/ollama/plugin.js +58 -0
  179. package/plugins/openai-api/icon-color.svg +1 -0
  180. package/plugins/opencode/icon-color.svg +1 -0
  181. package/plugins/opencode-go/icon-color.svg +1 -0
  182. package/plugins/opencode-go/plugin.js +104 -37
  183. package/plugins/opendesign/LICENSE +21 -0
  184. package/plugins/opendesign/icon.svg +4 -0
  185. package/plugins/opendesign/plugin.js +108 -0
  186. package/plugins/opendesign/plugin.json +25 -0
  187. package/plugins/openrouter/icon-color.svg +1 -0
  188. package/plugins/parallel/LICENSE +21 -0
  189. package/plugins/parallel/icon.svg +11 -0
  190. package/plugins/parallel/plugin.js +97 -0
  191. package/plugins/parallel/plugin.json +25 -0
  192. package/plugins/perplexity/LICENSE +22 -0
  193. package/plugins/perplexity/plugin.js +122 -0
  194. package/plugins/perplexity/plugin.json +36 -7
  195. package/plugins/pi/plugin.js +113 -0
  196. package/plugins/pi/plugin.json +11 -0
  197. package/plugins/qwencloud/LICENSE +21 -0
  198. package/plugins/qwencloud/icon-color.svg +1 -0
  199. package/plugins/qwencloud/icon.svg +1 -4
  200. package/plugins/qwencloud/plugin.js +197 -0
  201. package/plugins/qwencloud/plugin.json +17 -0
  202. package/plugins/raycast/LICENSE +21 -0
  203. package/plugins/raycast/icon.svg +4 -0
  204. package/plugins/raycast/plugin.js +179 -0
  205. package/plugins/raycast/plugin.json +32 -0
  206. package/plugins/replicate/LICENSE +21 -0
  207. package/plugins/replicate/icon-color.svg +1 -0
  208. package/plugins/replicate/icon.svg +1 -0
  209. package/plugins/replicate/plugin.js +170 -0
  210. package/plugins/replicate/plugin.json +25 -0
  211. package/plugins/sailresearch/LICENSE +21 -0
  212. package/plugins/sailresearch/icon.svg +4 -0
  213. package/plugins/sailresearch/plugin.js +104 -0
  214. package/plugins/sailresearch/plugin.json +24 -0
  215. package/plugins/siliconflow/LICENSE +21 -0
  216. package/plugins/siliconflow/icon.svg +3 -0
  217. package/plugins/siliconflow/plugin.js +87 -0
  218. package/plugins/siliconflow/plugin.json +32 -0
  219. package/plugins/sofya/LICENSE +21 -0
  220. package/plugins/sofya/icon.svg +3 -0
  221. package/plugins/sofya/plugin.js +86 -0
  222. package/plugins/sofya/plugin.json +24 -0
  223. package/plugins/soniox/LICENSE +21 -0
  224. package/plugins/soniox/icon.svg +3 -0
  225. package/plugins/soniox/plugin.js +103 -0
  226. package/plugins/soniox/plugin.json +24 -0
  227. package/plugins/synthetic/icon-color.svg +14 -0
  228. package/plugins/synthetic/plugin.js +12 -0
  229. package/plugins/synthetic/plugin.json +51 -9
  230. package/plugins/tavily/LICENSE +21 -0
  231. package/plugins/tavily/icon.svg +3 -0
  232. package/plugins/tavily/plugin.js +61 -0
  233. package/plugins/tavily/plugin.json +24 -0
  234. package/plugins/tinyapi/LICENSE +21 -0
  235. package/plugins/tinyapi/icon.svg +4 -0
  236. package/plugins/tinyapi/plugin.js +73 -0
  237. package/plugins/tinyapi/plugin.json +25 -0
  238. package/plugins/traecn/LICENSE +21 -0
  239. package/plugins/traecn/icon.svg +3 -0
  240. package/plugins/traecn/plugin.js +103 -0
  241. package/plugins/traecn/plugin.json +25 -0
  242. package/plugins/tripo/LICENSE +21 -0
  243. package/plugins/tripo/icon.svg +4 -0
  244. package/plugins/tripo/plugin.js +60 -0
  245. package/plugins/tripo/plugin.json +24 -0
  246. package/plugins/typesafe/LICENSE +21 -0
  247. package/plugins/typesafe/icon.svg +4 -0
  248. package/plugins/typesafe/plugin.js +181 -0
  249. package/plugins/typesafe/plugin.json +25 -0
  250. package/plugins/v0/LICENSE +21 -0
  251. package/plugins/v0/icon-color.svg +1 -0
  252. package/plugins/v0/icon.svg +1 -0
  253. package/plugins/v0/plugin.js +219 -0
  254. package/plugins/v0/plugin.json +32 -0
  255. package/plugins/venice/plugin.js +50 -1
  256. package/plugins/venice/plugin.json +2 -1
  257. package/plugins/vercel/LICENSE +21 -0
  258. package/plugins/vercel/icon-color.svg +1 -0
  259. package/plugins/vercel/icon.svg +1 -0
  260. package/plugins/vercel/plugin.js +202 -0
  261. package/plugins/vercel/plugin.json +54 -0
  262. package/plugins/windsurf/icon-color.svg +1 -0
  263. package/plugins/workbuddy/LICENSE +21 -0
  264. package/plugins/workbuddy/icon.svg +1 -0
  265. package/plugins/workbuddy/plugin.js +318 -0
  266. package/plugins/workbuddy/plugin.json +63 -0
  267. package/plugins/xai/icon-color.svg +1 -0
  268. package/plugins/xai/icon.svg +1 -7
  269. package/plugins/xai/plugin.js +9 -0
  270. package/plugins/xapi/LICENSE +21 -0
  271. package/plugins/xapi/icon.svg +1 -0
  272. package/plugins/xapi/plugin.js +90 -0
  273. package/plugins/xapi/plugin.json +25 -0
  274. package/plugins/xkiro/LICENSE +21 -0
  275. package/plugins/xkiro/icon.svg +1 -0
  276. package/plugins/xkiro/plugin.js +104 -0
  277. package/plugins/xkiro/plugin.json +24 -0
  278. package/plugins/zai/icon-color.svg +1 -0
  279. package/plugins/zai/plugin.js +5 -1
  280. package/plugins/zenmux/icon-color.svg +1 -0
  281. package/plugins/zenmux/icon.svg +1 -3
  282. package/usagestat +0 -0
  283. package/usagestatd +0 -0
  284. package/plugins/cursor-nightly/plugin.js +0 -1416
@@ -0,0 +1,266 @@
1
+ // Generated by tools/vendor-codexbar-providers.cjs; see LICENSE.
2
+ globalThis.__usagestat_bundled_options = {"labels":["Budget","Secondary budget","Additional"],"defaults":{"AIXY_BASE_URL":"https://api.aixy-gateway.com"},"autoMode":"api"};
3
+ (function(defineProvider) {
4
+ // BEGIN UPSTREAM Sources/CodexBarCore/Resources/Plugins/aixy.js
5
+ function _optionalChain(ops) {
6
+ let lastAccessLHS = undefined;
7
+ let value = ops[0];
8
+ let i = 1;
9
+ while (i < ops.length) {
10
+ const op = ops[i];
11
+ const fn = ops[i + 1];
12
+ i += 2;
13
+ if ((op === "optionalAccess" || op === "optionalCall") && value == null) {
14
+ return undefined;
15
+ }
16
+ if (op === "access" || op === "optionalAccess") {
17
+ lastAccessLHS = value;
18
+ value = fn(value);
19
+ } else if (op === "call" || op === "optionalCall") {
20
+ value = fn((...args) => value.call(lastAccessLHS, ...args));
21
+ lastAccessLHS = undefined;
22
+ }
23
+ }
24
+ return value;
25
+ }
26
+ defineProvider({
27
+ id: "aixy",
28
+ name: "Aixy",
29
+ endpoints: [{ setting: "AIXY_BASE_URL", policy: "https-or-private-network-http" }],
30
+ auth: { type: "bearer", secret: "AIXY_API_KEY" },
31
+ settings: [
32
+ { key: "AIXY_API_KEY", title: "API key", type: "secure" },
33
+ { key: "AIXY_BASE_URL", title: "Base URL", type: "plain" },
34
+ ],
35
+ capabilities: ["http-status"],
36
+ async fetchUsage(ctx) {
37
+ const fail = (message) => {
38
+ throw ctx.fail.parseFailure(`Aixy: ${message}`);
39
+ };
40
+ const object = (value) => {
41
+ if (!value || typeof value !== "object" || Array.isArray(value)) return fail("expected an object");
42
+ return value;
43
+ };
44
+ const text = (value) => {
45
+ if (typeof value !== "string" || !value.trim()) return fail("invalid text");
46
+ return value.trim();
47
+ };
48
+ const bounded = (value) => Array.from(value).slice(0, 120).join("");
49
+ const number = (value) => {
50
+ if (value == null) return undefined;
51
+ if (typeof value === "string" && /^\d+(?:\.\d+)?$/u.test(value)) value = Number(value);
52
+ if (typeof value !== "number" || !Number.isFinite(value) || value < 0) return fail("invalid amount");
53
+ return value;
54
+ };
55
+ const count = (value) => {
56
+ const parsed = number(value);
57
+ if (parsed === undefined || !Number.isSafeInteger(parsed)) return fail("invalid count");
58
+ return parsed;
59
+ };
60
+ const date = (value) => {
61
+ if (value == null) return undefined;
62
+ let parsed;
63
+ try {
64
+ parsed = ctx.date.iso(text(value));
65
+ } catch (error) {
66
+ void error;
67
+ return fail("invalid date");
68
+ }
69
+ if (!Number.isFinite(parsed.getTime())) return fail("invalid date");
70
+ return parsed;
71
+ };
72
+ const base = (ctx.settings.get("AIXY_BASE_URL") || "https://api.aixy-gateway.com").replace(/\/+$/u, "");
73
+ if (/[?#]/u.test(base)) throw ctx.fail.apiFailure("Aixy Base URL must not contain a query or fragment.");
74
+ const endpoint = `${base.replace(/\/v1$/u, "")}/v1/usage`;
75
+ const response = await ctx.http.get(endpoint);
76
+ const message = `Aixy usage request failed (HTTP ${response.status}).`;
77
+ if (response.status === 401)
78
+ throw ctx.fail.authenticationExpired("Aixy rejected the API key. Check its expiry or revocation.");
79
+ if (response.status === 403) throw ctx.fail.permissionDenied("Aixy denied access to this key's usage.");
80
+ if (response.status === 404)
81
+ throw ctx.fail.apiFailure(
82
+ "This Aixy installation does not provide the usage endpoint. Update the gateway or check its Base URL.",
83
+ );
84
+ if (response.status === 429) throw ctx.fail.rateLimited(message);
85
+ if (response.status >= 500) throw ctx.fail.providerUnavailable(message);
86
+ if (response.status < 200 || response.status >= 300) throw ctx.fail.apiFailure(message);
87
+ let decoded;
88
+ try {
89
+ decoded = JSON.parse(response.bodyText);
90
+ } catch (error) {
91
+ void error;
92
+ return fail("invalid usage JSON");
93
+ }
94
+ const root = object(decoded);
95
+ if (root.object !== "key.usage" || root.currency !== "USD") return fail("unsupported usage contract");
96
+ const asOf = date(root.as_of);
97
+ if (!asOf) return fail("missing observation time");
98
+ const key = object(root.key);
99
+ const keyID = text(key.id);
100
+ if (!Array.isArray(root.budgets)) return fail("invalid budgets");
101
+ const labels = {
102
+ organization: "Organization",
103
+ project: "Project",
104
+ team: "Team",
105
+ user: "User",
106
+ api_key: "Key",
107
+ daily: "Daily",
108
+ weekly: "Weekly",
109
+ monthly: "Monthly",
110
+ lifetime: "Lifetime",
111
+ };
112
+ if (root.budgets.length > 64) return fail("too many budgets");
113
+ const ids = new Set();
114
+ const budgets = root.budgets
115
+ .map((raw) => {
116
+ const budget = object(raw),
117
+ id = text(budget.id);
118
+ if (ids.has(id)) return fail("duplicate budget");
119
+ ids.add(id);
120
+ const scope = text(budget.scope),
121
+ interval = text(budget.interval);
122
+ if (
123
+ !["organization", "project", "team", "user", "api_key"].includes(scope) ||
124
+ !["daily", "weekly", "monthly", "lifetime"].includes(interval)
125
+ )
126
+ return fail("invalid budget scope or interval");
127
+ if (budget.enforcement !== "hard" && budget.enforcement !== "monitor") return fail("invalid enforcement");
128
+ if (typeof budget.shared !== "boolean") return fail("invalid shared scope");
129
+ const limit = number(budget.limit_usd);
130
+ if (limit === undefined || limit <= 0) return fail("invalid budget limit");
131
+ if (
132
+ !Array.isArray(budget.applies_to) ||
133
+ !budget.applies_to.length ||
134
+ budget.applies_to.some(
135
+ (item) => object(item).api_key_id !== keyID || object(item).project_id !== key.project_id,
136
+ )
137
+ )
138
+ return fail("budget belongs to another key");
139
+ const availability = object(budget.availability);
140
+ const hard = budget.enforcement === "hard";
141
+ if (!["available", "unavailable", "not_enforced"].includes(text(availability.status)))
142
+ return fail("invalid availability");
143
+ if (!["available", "unavailable"].includes(text(budget.spend_status))) return fail("invalid spend status");
144
+ const known = hard ? availability.status === "available" : budget.spend_status === "available";
145
+ const spent = number(hard ? availability.spent_usd : budget.spend_usd);
146
+ const reserved = hard ? number(availability.reserved_usd) : 0;
147
+ const remaining = number(hard ? availability.remaining_usd : budget.remaining_usd);
148
+ if (known && (spent === undefined || reserved === undefined || remaining === undefined))
149
+ return fail("incomplete budget balance");
150
+ const used = known ? spent + reserved : undefined;
151
+ if (used !== undefined && !Number.isFinite(used)) return fail("budget amount overflow");
152
+ const startsAt = date(budget.starts_at),
153
+ resetsAt = date(budget.resets_at);
154
+ if (startsAt && resetsAt && resetsAt <= startsAt) return fail("invalid budget period");
155
+ const minutes = startsAt && resetsAt ? (resetsAt.getTime() - startsAt.getTime()) / 60000 : undefined;
156
+ const title = bounded(
157
+ `${labels[scope]} · ${labels[interval]} · ${budget.shared ? "Shared" : "Personal"} · ${hard ? "Hard" : "Monitor"}`,
158
+ );
159
+ return {
160
+ id: `aixy-${id}`,
161
+ title,
162
+ known,
163
+ hard,
164
+ spent,
165
+ reserved,
166
+ remaining,
167
+ limit,
168
+ used,
169
+ window: {
170
+ usedPercent: known ? ctx.pct(used, limit) : 0,
171
+ windowMinutes: minutes !== undefined && Number.isSafeInteger(minutes) && minutes > 0 ? minutes : undefined,
172
+ resetsAt,
173
+ resetDescription: `${title} · ${known ? `${ctx.format.usd(remaining)} remaining` : "Unavailable"}`,
174
+ },
175
+ };
176
+ })
177
+ .sort(
178
+ (a, b) =>
179
+ Number(b.hard) - Number(a.hard) ||
180
+ Number(b.known) - Number(a.known) ||
181
+ b.window.usedPercent - a.window.usedPercent ||
182
+ (a.id < b.id ? -1 : a.id > b.id ? 1 : 0),
183
+ );
184
+ const known = budgets.filter((budget) => budget.known);
185
+ const selected = known.slice(0, 2);
186
+ const details = [
187
+ {
188
+ title: "Aixy key",
189
+ rows: [
190
+ { label: "Key", value: bounded(key.name == null ? keyID : text(key.name)) },
191
+ {
192
+ label: "Project",
193
+ value: bounded(key.project_name == null ? text(key.project_id) : text(key.project_name)),
194
+ },
195
+ { label: "Observed", value: asOf.toISOString() },
196
+ ],
197
+ },
198
+ ];
199
+ for (let offset = 0; offset < budgets.length; offset += 24)
200
+ details.push({
201
+ title: "Applicable budgets",
202
+ rows: budgets.slice(offset, offset + 24).map((budget) => ({
203
+ label: budget.title,
204
+ value: budget.known
205
+ ? `${ctx.format.usd(budget.remaining)} / ${ctx.format.usd(budget.limit)} remaining`
206
+ : "Unavailable",
207
+ secondaryValue: budget.known
208
+ ? `${ctx.format.usd(budget.spent)} spent${budget.hard ? ` · ${ctx.format.usd(budget.reserved)} reserved` : ""}`
209
+ : undefined,
210
+ progress: budget.known ? budget.window.usedPercent / 100 : undefined,
211
+ usageValue: budget.used,
212
+ })),
213
+ });
214
+ let cost;
215
+ let confidence = "unknown";
216
+ if (root.usage != null) {
217
+ const usage = object(root.usage);
218
+ if (usage.window !== "7d") return fail("unsupported reporting period");
219
+ const requests = count(usage.requests),
220
+ tokens = count(usage.total_tokens);
221
+ const attributed = count(usage.attributed_requests),
222
+ partial = count(usage.partial_requests);
223
+ const spend = number(usage.spend_usd);
224
+ if (attributed > requests || partial > attributed || (spend !== undefined && spend > 0 && attributed === 0))
225
+ return fail("invalid attribution coverage");
226
+ if (spend !== undefined) {
227
+ cost = { used: spend, currency: "USD", period: "Last 7 days · attributed" };
228
+ confidence = "estimated";
229
+ }
230
+ details.push({
231
+ title: "Last 7 days · this key",
232
+ rows: [
233
+ { label: "Requests", value: ctx.format.number(requests) },
234
+ { label: "Tokens", value: ctx.format.number(tokens) },
235
+ { label: "Attributed spend", value: spend === undefined ? "Unavailable" : ctx.format.usd(spend) },
236
+ {
237
+ label: "Cost coverage",
238
+ value: `${attributed} / ${requests} requests`,
239
+ secondaryValue: `${partial} partial`,
240
+ },
241
+ ],
242
+ });
243
+ } else {
244
+ details.push({ title: "Last 7 days · this key", rows: [{ label: "Usage", value: "Unavailable" }] });
245
+ }
246
+ return {
247
+ primary: _optionalChain([selected, "access", (_) => _[0], "optionalAccess", (_2) => _2.window]),
248
+ secondary: _optionalChain([selected, "access", (_3) => _3[1], "optionalAccess", (_4) => _4.window]),
249
+ extraWindows: budgets
250
+ .filter((budget) => !selected.includes(budget))
251
+ .map((budget) => ({
252
+ id: budget.id,
253
+ title: budget.title,
254
+ usageKnown: budget.known,
255
+ window: budget.window,
256
+ })),
257
+ cost,
258
+ details,
259
+ dataConfidence: confidence,
260
+ identity: { accountID: keyID, loginMethod: "API key" },
261
+ };
262
+ },
263
+ });
264
+
265
+ // END UPSTREAM
266
+ })(globalThis.defineProvider);
@@ -0,0 +1,32 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "id": "aixy",
4
+ "name": "Aixy",
5
+ "version": "0.1.0",
6
+ "entry": "plugin.js",
7
+ "enabledByDefault": false,
8
+ "supportedModes": [
9
+ "api"
10
+ ],
11
+ "autoMode": "api",
12
+ "usageDashboardUrl": "https://dash.aixy-gateway.com",
13
+ "envVars": [
14
+ "AIXY_API_KEY",
15
+ "AIXY_BASE_URL"
16
+ ],
17
+ "setupFields": [
18
+ {
19
+ "key": "AIXY_BASE_URL",
20
+ "title": "Base URL",
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/aixy.js",
29
+ "sha256": "975d98525503e286f9425c2a1d64fe00da8e2fdc0b00890e15c2cbcb9a37c125",
30
+ "license": "MIT"
31
+ }
32
+ }