@blockrun/clawrouter 0.11.4 → 0.11.5

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/README.md CHANGED
@@ -37,6 +37,7 @@ One wallet, 41+ models, zero API keys.
37
37
  | ----------------------------------------- | ------------------------------- |
38
38
  | [Quick Start](#-quick-start) | Install in 2 minutes |
39
39
  | [Routing Profiles](#-routing-profiles) | eco / auto / premium / free |
40
+ | [Image Generation](#-image-generation) | /imagegen with 5 models |
40
41
  | [How It Works](#-how-it-works) | 15-dimension local routing |
41
42
  | [Models & Pricing](#-models--pricing) | 41+ models, full price list |
42
43
  | [Screenshots](#-screenshots) | See it in action |
@@ -78,6 +79,28 @@ Choose your routing strategy with `/model <profile>`:
78
79
 
79
80
  ---
80
81
 
82
+ ## 🎨 Image Generation
83
+
84
+ Generate images directly from chat with `/imagegen`:
85
+
86
+ ```
87
+ /imagegen a dog dancing on the beach
88
+ /imagegen --model dall-e-3 a futuristic city at sunset
89
+ /imagegen --model banana-pro --size 2048x2048 mountain landscape
90
+ ```
91
+
92
+ | Model | Provider | Price | Max Size |
93
+ | ------------- | ---------------------- | ----------- | --------- |
94
+ | `nano-banana` | Google Gemini Flash | $0.05/image | 1024x1024 |
95
+ | `banana-pro` | Google Gemini Pro | $0.10/image | 4096x4096 |
96
+ | `dall-e-3` | OpenAI DALL-E 3 | $0.04/image | 1792x1024 |
97
+ | `gpt-image` | OpenAI GPT Image 1 | $0.02/image | 1536x1024 |
98
+ | `flux` | Black Forest Flux 1.1 | $0.04/image | 1024x1024 |
99
+
100
+ Default model: `nano-banana`. Images are returned as hosted URLs for compatibility with Telegram, Discord, and other clients.
101
+
102
+ ---
103
+
81
104
  ## ⚡ How It Works
82
105
 
83
106
  **100% local routing. <1ms latency. Zero external API calls.**
package/dist/cli.js CHANGED
@@ -6293,6 +6293,45 @@ async function resolveOrGenerateWalletKey() {
6293
6293
  return { key, address, source: "generated" };
6294
6294
  }
6295
6295
 
6296
+ // src/report.ts
6297
+ async function generateReport(period, json = false) {
6298
+ const days = period === "daily" ? 1 : period === "weekly" ? 7 : 30;
6299
+ const stats = await getStats(days);
6300
+ if (json) {
6301
+ return JSON.stringify(stats, null, 2);
6302
+ }
6303
+ return formatMarkdownReport(period, days, stats);
6304
+ }
6305
+ function formatMarkdownReport(period, days, stats) {
6306
+ const lines = [];
6307
+ lines.push(`# ClawRouter ${capitalize(period)} Report`);
6308
+ lines.push(`**Period:** Last ${days} day${days > 1 ? "s" : ""}`);
6309
+ lines.push(`**Generated:** ${(/* @__PURE__ */ new Date()).toISOString()}`);
6310
+ lines.push("");
6311
+ lines.push("## \u{1F4CA} Usage Summary");
6312
+ lines.push("");
6313
+ lines.push(`| Metric | Value |`);
6314
+ lines.push(`|--------|-------|`);
6315
+ lines.push(`| Total Requests | ${stats.totalRequests} |`);
6316
+ lines.push(`| Total Cost | $${stats.totalCost.toFixed(4)} |`);
6317
+ lines.push(`| Baseline Cost | $${stats.totalBaselineCost.toFixed(4)} |`);
6318
+ lines.push(`| **Savings** | **$${stats.totalSavings.toFixed(4)}** |`);
6319
+ lines.push(`| Savings % | ${stats.savingsPercentage.toFixed(1)}% |`);
6320
+ lines.push(`| Avg Latency | ${stats.avgLatencyMs.toFixed(0)}ms |`);
6321
+ lines.push("");
6322
+ lines.push("## \u{1F916} Model Distribution");
6323
+ lines.push("");
6324
+ const sortedModels = Object.entries(stats.byModel).sort((a, b) => b[1].count - a[1].count).slice(0, 10);
6325
+ for (const [model, data] of sortedModels) {
6326
+ lines.push(`- ${model}: ${data.count} reqs, $${data.cost.toFixed(4)}`);
6327
+ }
6328
+ lines.push("");
6329
+ return lines.join("\n");
6330
+ }
6331
+ function capitalize(str) {
6332
+ return str.charAt(0).toUpperCase() + str.slice(1);
6333
+ }
6334
+
6296
6335
  // src/doctor.ts
6297
6336
  import { platform, arch, freemem, totalmem } from "os";
6298
6337
  function formatBytes(bytes) {
@@ -6629,6 +6668,7 @@ Usage:
6629
6668
  clawrouter [options]
6630
6669
  clawrouter doctor [opus] [question]
6631
6670
  clawrouter partners [test]
6671
+ clawrouter report [daily|weekly|monthly] [--json]
6632
6672
 
6633
6673
  Options:
6634
6674
  --version, -v Show version number
@@ -6671,6 +6711,9 @@ function parseArgs(args) {
6671
6711
  doctor: false,
6672
6712
  partners: false,
6673
6713
  partnersTest: false,
6714
+ report: false,
6715
+ reportPeriod: "daily",
6716
+ reportJson: false,
6674
6717
  port: void 0
6675
6718
  };
6676
6719
  for (let i = 0; i < args.length; i++) {
@@ -6687,6 +6730,20 @@ function parseArgs(args) {
6687
6730
  result.partnersTest = true;
6688
6731
  i++;
6689
6732
  }
6733
+ } else if (arg === "report") {
6734
+ result.report = true;
6735
+ const next = args[i + 1];
6736
+ if (next && ["daily", "weekly", "monthly"].includes(next)) {
6737
+ result.reportPeriod = next;
6738
+ i++;
6739
+ if (args[i + 1] === "--json") {
6740
+ result.reportJson = true;
6741
+ i++;
6742
+ }
6743
+ } else if (next === "--json") {
6744
+ result.reportJson = true;
6745
+ i++;
6746
+ }
6690
6747
  } else if (arg === "--port" && args[i + 1]) {
6691
6748
  result.port = parseInt(args[i + 1], 10);
6692
6749
  i++;
@@ -6757,6 +6814,11 @@ ClawRouter Partner APIs (v${VERSION})
6757
6814
  }
6758
6815
  process.exit(0);
6759
6816
  }
6817
+ if (args.report) {
6818
+ const report = await generateReport(args.reportPeriod, args.reportJson);
6819
+ console.log(report);
6820
+ process.exit(0);
6821
+ }
6760
6822
  const { key: walletKey, address, source } = await resolveOrGenerateWalletKey();
6761
6823
  if (source === "generated") {
6762
6824
  console.log(`[ClawRouter] Generated new wallet: ${address}`);