clawmoney 0.15.14 → 0.15.16
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/commands/relay-setup.js +51 -18
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import { execSync } from "node:child_process";
|
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import { join } from "node:path";
|
|
5
|
-
import { intro, outro, multiselect, confirm, spinner, isCancel, cancel, log, } from "@clack/prompts";
|
|
5
|
+
import { intro, outro, multiselect, confirm, select, spinner, isCancel, cancel, log, } from "@clack/prompts";
|
|
6
6
|
import chalk from "chalk";
|
|
7
7
|
import { apiPost } from "../utils/api.js";
|
|
8
8
|
import { requireConfig } from "../utils/config.js";
|
|
@@ -224,26 +224,59 @@ export async function relaySetupCommand() {
|
|
|
224
224
|
cancel("No models selected — nothing to register");
|
|
225
225
|
process.exit(0);
|
|
226
226
|
}
|
|
227
|
-
// ── Step 4:
|
|
227
|
+
// ── Step 4: daily budget (the only product-level decision) ──
|
|
228
228
|
//
|
|
229
|
-
//
|
|
229
|
+
// Concurrency is silent (5, the "single power user" cap — explained
|
|
230
|
+
// in the file header). daily_limit is the one variable that's a
|
|
231
|
+
// product decision, not a technical one: it directly controls how
|
|
232
|
+
// much you can earn (and how much subscription quota the relay
|
|
233
|
+
// burns through per day). We offer three presets calibrated to
|
|
234
|
+
// common provider postures, plus the implicit fall-through of
|
|
235
|
+
// editing config.yaml after start for advanced overrides.
|
|
230
236
|
//
|
|
231
|
-
//
|
|
232
|
-
//
|
|
233
|
-
//
|
|
234
|
-
//
|
|
235
|
-
// real CC traffic. Asking the user creates friction and an option
|
|
236
|
-
// they can't confidently judge.
|
|
237
|
-
//
|
|
238
|
-
// - Daily limit ($15): roughly what a heavy individual user spends
|
|
239
|
-
// on Claude API in a day. Hard cap that protects against runaway
|
|
240
|
-
// buyer abuse hitting the OAuth account's quota.
|
|
241
|
-
//
|
|
242
|
-
// Both can be overridden later via:
|
|
243
|
-
// clawmoney relay register --cli X --model Y --concurrency N --daily-limit M
|
|
244
|
-
// (or just edit ~/.clawmoney/config.yaml after start)
|
|
237
|
+
// Earning math per provider (assuming 100% utilization):
|
|
238
|
+
// max_earn_per_day = daily_limit × RELAY_DISCOUNT × (1 - PLATFORM_FEE)
|
|
239
|
+
// = daily_limit × 0.20 × 0.90 = daily_limit × 0.18
|
|
240
|
+
// max_earn_per_month ≈ max_earn_per_day × 30
|
|
245
241
|
const concurrency = 5;
|
|
246
|
-
const
|
|
242
|
+
const earnPerMonth = (cap) => Math.round(cap * RELAY_DISCOUNT * (1 - PLATFORM_FEE) * 30);
|
|
243
|
+
// Baseline: $60/day API cost ≈ a fully utilized Max-tier subscription's
|
|
244
|
+
// daily quota (Claude Max 20x, ChatGPT Pro, etc.). Percentages are
|
|
245
|
+
// computed off this baseline so users can intuit "I'm sharing X% of
|
|
246
|
+
// a typical subscription's daily capacity". For Pro tier subs the
|
|
247
|
+
// real percentage is higher (because their full quota is smaller),
|
|
248
|
+
// but the USD cap is what actually matters technically.
|
|
249
|
+
const dailyLimitChoice = await select({
|
|
250
|
+
message: "How much of your subscription's spare capacity do you want to share?",
|
|
251
|
+
options: [
|
|
252
|
+
{
|
|
253
|
+
value: 6,
|
|
254
|
+
label: `~10% · $6/day cap → ~$${earnPerMonth(6)}/month earnings`,
|
|
255
|
+
hint: "light sharing — keeps most of your quota for personal use",
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
value: 15,
|
|
259
|
+
label: `~25% · $15/day cap → ~$${earnPerMonth(15)}/month earnings`,
|
|
260
|
+
hint: "recommended — shares a quarter, leaves 75% for you",
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
value: 30,
|
|
264
|
+
label: `~50% · $30/day cap → ~$${earnPerMonth(30)}/month earnings`,
|
|
265
|
+
hint: "heavy sharing — half for you, half for relay",
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
value: 60,
|
|
269
|
+
label: `~100% · $60/day cap → ~$${earnPerMonth(60)}/month earnings`,
|
|
270
|
+
hint: "relay-focused — best for accounts dedicated to providing",
|
|
271
|
+
},
|
|
272
|
+
],
|
|
273
|
+
initialValue: 15,
|
|
274
|
+
});
|
|
275
|
+
if (isCancel(dailyLimitChoice)) {
|
|
276
|
+
cancel("Setup cancelled");
|
|
277
|
+
process.exit(0);
|
|
278
|
+
}
|
|
279
|
+
const dailyLimit = dailyLimitChoice;
|
|
247
280
|
// ── Step 5: confirmation summary ──
|
|
248
281
|
log.step(chalk.bold("Summary"));
|
|
249
282
|
for (const r of registrations) {
|