@pollinations/cli 0.1.54 → 0.1.56

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/dist/index.js CHANGED
@@ -14,7 +14,7 @@ var init_package = __esm({
14
14
  "package.json"() {
15
15
  package_default = {
16
16
  name: "@pollinations/cli",
17
- version: "0.1.54",
17
+ version: "0.1.56",
18
18
  description: "The Pollinations CLI \u2014 for humans, AI agents, and everything in between",
19
19
  type: "module",
20
20
  bin: {
@@ -88,7 +88,7 @@ var init_package = __esm({
88
88
  "@types/update-notifier": "^6.0.8",
89
89
  tsup: "^8.4.0",
90
90
  typescript: "^5.7.0",
91
- vitest: "^3.0.0"
91
+ vitest: "^4.1.12"
92
92
  }
93
93
  };
94
94
  }
@@ -959,9 +959,12 @@ async function budgetHint(status4, bodyText) {
959
959
  `Server said: ${bodyText}`
960
960
  ].join("\n");
961
961
  }
962
- const balance = await gen("/account/balance", {
963
- apiKey: requireKey()
964
- }).then((r) => r.balance).catch(() => null);
962
+ const balance = await gen(
963
+ "/account/balance",
964
+ {
965
+ apiKey: requireKey()
966
+ }
967
+ ).then((r) => r.accountBalance?.total).catch(() => null);
965
968
  const lines = [
966
969
  code === "INSUFFICIENT_BALANCE" ? "Insufficient pollen balance." : "Check your pollen balance and API key budget.",
967
970
  "Balance: https://enter.pollinations.ai/pollen",
@@ -2387,49 +2390,6 @@ var fetchHarnessModels = async (selectedModel) => {
2387
2390
  return models2;
2388
2391
  };
2389
2392
 
2390
- // src/harnesses/usage-proof.ts
2391
- init_api();
2392
- init_config();
2393
- var keyUsageCount = async (apiKey) => {
2394
- const result9 = await gen(
2395
- "/account/key/usage?limit=1",
2396
- { apiKey }
2397
- );
2398
- return Number(result9.count ?? result9.usage?.length ?? 0);
2399
- };
2400
- var accountLastRequest = async (apiKey) => {
2401
- const accountKey = resolveApiKey();
2402
- if (!accountKey || accountKey === apiKey) return null;
2403
- try {
2404
- const result9 = await gen("/account/keys", { apiKey: accountKey });
2405
- const row = result9.data?.find(
2406
- (item) => item.enabled !== false && Boolean(item.start) && apiKey.startsWith(item.start)
2407
- );
2408
- return row?.lastRequest ? Date.parse(row.lastRequest) : null;
2409
- } catch {
2410
- return null;
2411
- }
2412
- };
2413
- var waitForKeyUsageIncrease = async (apiKey, before, options = {}) => {
2414
- const attempts = options.attempts ?? 30;
2415
- const delayMs = options.delayMs ?? 1e3;
2416
- const afterMs = options.afterMs ?? Date.now();
2417
- for (let attempt = 0; attempt < attempts; attempt += 1) {
2418
- const count = await keyUsageCount(apiKey);
2419
- if (count > before) return count;
2420
- const lastRequest = await accountLastRequest(apiKey);
2421
- if (lastRequest !== null && Number.isFinite(lastRequest) && lastRequest >= afterMs - 5e3) {
2422
- return before + 1;
2423
- }
2424
- if (attempt + 1 < attempts) {
2425
- await new Promise((resolve4) => setTimeout(resolve4, delayMs));
2426
- }
2427
- }
2428
- throw new Error(
2429
- "The smoke test returned, but no request appeared for the dedicated Pollinations key."
2430
- );
2431
- };
2432
-
2433
2393
  // src/harnesses/claude-code.ts
2434
2394
  var ID2 = "claude-code";
2435
2395
  var LABEL2 = "Claude Code";
@@ -2501,10 +2461,7 @@ var configure = async (ctx, apiKey, model) => {
2501
2461
  writeTextAtomic(path, `${JSON.stringify({ env }, null, 2)}
2502
2462
  `, 384);
2503
2463
  try {
2504
- const before = await keyUsageCount(apiKey);
2505
- const startedAt = Date.now();
2506
2464
  smokeTest(ctx);
2507
- await waitForKeyUsageIncrease(apiKey, before, { afterMs: startedAt });
2508
2465
  } catch (error) {
2509
2466
  if (previous === null) removeIfExists(path);
2510
2467
  else writeTextAtomic(path, previous, 384);
@@ -2785,8 +2742,6 @@ var configureCodex = async (ctx, model, options = {}) => {
2785
2742
  throw failRun(curated, "Codex Router model curation");
2786
2743
  }
2787
2744
  }
2788
- const before = await keyUsageCount(key);
2789
- const startedAt = Date.now();
2790
2745
  const check = smoke(ctx, model);
2791
2746
  if (!check.ok) {
2792
2747
  throw failRun(check, "Codex Router smoke test");
@@ -2799,9 +2754,6 @@ var configureCodex = async (ctx, model, options = {}) => {
2799
2754
  "Codex Router smoke test did not confirm a basic routed response."
2800
2755
  );
2801
2756
  }
2802
- await waitForKeyUsageIncrease(key, before, {
2803
- afterMs: startedAt
2804
- });
2805
2757
  return {
2806
2758
  ...status3(ctx),
2807
2759
  model: `${PROVIDER}/${model}`,