@infernetprotocol/cli 0.1.87 → 0.1.89

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/commands/batch.js CHANGED
@@ -37,6 +37,8 @@ Usage:
37
37
  infernet billing topup <usd> CoinPay checkout URL (any coin or PayPal)
38
38
  infernet billing topup-status <id> credited once CoinPay confirms payment
39
39
  infernet billing funding earned,prepaid,wallet set your default funding order
40
+ infernet billing spend-earnings [usd|all] move node earnings into the balance,
41
+ so they pay for chat and the API too
40
42
 
41
43
  Earned = your confirmed node earnings (c0mpute and Infernet nodes are one
42
44
  balance), spendable on compute with no fee; whatever you do not spend stays
@@ -166,6 +168,14 @@ export async function billing(args) {
166
168
  out(args, t, `top-up ${t.id}: ${t.status} $${t.amount_usd}${t.credited ? ' (credited now)' : ''}`);
167
169
  return 0;
168
170
  }
171
+ case 'spend-earnings':
172
+ case 'fund-from-earnings': {
173
+ const r = await c.fundFromEarnings(a1 ?? 'all');
174
+ out(args, r, `moved $${r.moved_usd} of node earnings into the compute balance\n`
175
+ + `spendable now: $${r.balance.total_spendable_usd}\n`
176
+ + 'it pays for inference from here on, and can no longer be withdrawn');
177
+ return 0;
178
+ }
169
179
  case 'funding': {
170
180
  if (!a1) throw new Error('usage: infernet billing funding earned,prepaid,wallet');
171
181
  const r = await c.setFunding(String(a1).split(',').map((s) => s.trim()).filter(Boolean));
package/commands/mcp.js CHANGED
@@ -21,7 +21,7 @@ const PROTOCOL_VERSION = '2025-06-18';
21
21
 
22
22
  const id = { type: 'string', description: 'reservation id (uuid)' };
23
23
  const ORDER_PROPS = {
24
- gpu_class: { type: 'string', description: 'l40s, a100, h100, h100x2, or a consumer card on demand (rtx5090, rtx4090, ... one model per order); see order_capacity' },
24
+ gpu_class: { type: 'string', description: 'a network class (l40s, a100, h100, h100x2), or a rented GPU on demand, one model per order: SaladCloud consumer cards (rtx5090, rtx4090, ...), vast-* on Vast.ai, thunder-* on Thunder Compute; see order_capacity' },
25
25
  models: { type: 'array', items: { type: 'string' }, description: 'exact model ids, from order_capacity' },
26
26
  hours: { type: 'integer', minimum: 1, maximum: 168 },
27
27
  start_at: { type: 'string', description: 'whole UTC hour, ISO; default the next hour' },
package/commands/order.js CHANGED
@@ -8,12 +8,14 @@ import { createOrdersClient, orderBodyFromFlags, x402KeyFrom, DEFAULT_MAX_USD }
8
8
  const HELP = `infernet order — order a dedicated model endpoint by the hour
9
9
 
10
10
  We pin the models on one online node with the GPU class you pick, for the
11
- hours you book, and you get an OpenAI-compatible API key. Prepaid at the quoted
12
- price; non-compliant hours are credited or refunded.
11
+ hours you book, and you get an OpenAI-compatible API key. Rented classes
12
+ (rtx* on SaladCloud, vast-*, thunder-*) need no online node: we rent the GPU
13
+ for your window and run the model on it. Prepaid at the quoted price;
14
+ non-compliant hours are credited or refunded.
13
15
 
14
16
  Usage:
15
17
  infernet order capacity what is on sale now: classes, prices, free nodes, models
16
- infernet order quote --gpu l40s|rtx4090 --models m1[,m2] [--hours 1] [--start 2026-10-28T15:00:00Z]
18
+ infernet order quote --gpu l40s|rtx4090|vast-h100|thunder-a100 --models m1[,m2] [--hours 1] [--start 2026-10-28T15:00:00Z]
17
19
  infernet order create --gpu l40s --models m1[,m2] [--hours 1] [--start ISO] [--email you@x]
18
20
  --checkout pay at CoinPay (any coin or PayPal): prints the checkout URL
19
21
  --x402 pay now in USDC from X402_PRIVATE_KEY (or --key-file F)
@@ -0,0 +1,160 @@
1
+ /**
2
+ * `infernet price` — what your node charges for the models it serves.
3
+ *
4
+ * A model nobody has priced is charged the network's default, so adding a
5
+ * model is never an accidental giveaway. You can override that for your own
6
+ * node, inside the band the network allows.
7
+ *
8
+ * infernet price list [--node <pubkey>]
9
+ * infernet price set <model> --out <usd> [--in <usd>] [--node <pubkey>]
10
+ * infernet price unset <model> [--node <pubkey>]
11
+ *
12
+ * Prices are USD per 1M tokens. --out is the one that matters: output tokens
13
+ * dominate what a chat costs. --in defaults to a quarter of --out, which is
14
+ * roughly the house ratio.
15
+ */
16
+
17
+ import { loadConfig } from '../lib/config.js';
18
+
19
+ const DEFAULT_URL = 'https://infernetprotocol.com';
20
+
21
+ const HELP = `infernet price — what your node charges per model
22
+
23
+ Usage:
24
+ infernet price list Every model your node serves, and its price
25
+ infernet price set <model> --out <usd> Set your price (USD per 1M output tokens)
26
+ [--in <usd>] Input price (default: a quarter of --out)
27
+ infernet price unset <model> Fall back to the network's price
28
+ infernet price --help
29
+
30
+ Options:
31
+ --node <pubkey> Which of your nodes (default: this machine's identity)
32
+ --url <url> Control plane (default: $INFERNET_URL or infernetprotocol.com)
33
+ --json Raw JSON
34
+
35
+ A model nobody has priced is charged the network default, so a new model is
36
+ never served for free. Your own price wins over the network's, as long as it
37
+ sits inside the allowed band — "infernet price list" shows the band.
38
+ `;
39
+
40
+ function fmt(n) {
41
+ const v = Number(n) || 0;
42
+ return v >= 0.01 ? `$${v.toFixed(3).replace(/0+$/, '').replace(/\.$/, '')}` : `$${v.toFixed(6).replace(/0+$/, '')}`;
43
+ }
44
+
45
+ async function resolve(args) {
46
+ const config = await loadConfig().catch(() => null);
47
+ const token = args.get('token') || config?.auth?.bearerToken || null;
48
+ if (!token) throw new Error('not signed in: run `infernet login` first');
49
+
50
+ // This machine's node pubkey, the same one `infernet pubkey` links.
51
+ const pubkey = args.get('node') || config?.node?.publicKey || null;
52
+ if (!pubkey) {
53
+ throw new Error('no node identity on this machine: pass --node <pubkey> (see `infernet pubkey`)');
54
+ }
55
+ const baseUrl = String(args.get('url') || process.env.INFERNET_URL || config?.controlPlane?.url || DEFAULT_URL)
56
+ .replace(/\/+$/, '');
57
+ return { baseUrl, token, pubkey };
58
+ }
59
+
60
+ async function call(method, { baseUrl, token, pubkey }, { path = '', body } = {}) {
61
+ const headers = { accept: 'application/json', authorization: `Bearer ${token}` };
62
+ if (body !== undefined) headers['content-type'] = 'application/json';
63
+ const res = await fetch(`${baseUrl}/api/v1/user/nodes/${encodeURIComponent(pubkey)}/prices${path}`, {
64
+ method,
65
+ headers,
66
+ ...(body !== undefined ? { body: JSON.stringify(body) } : {})
67
+ });
68
+ const text = await res.text();
69
+ let json = null;
70
+ try { json = text ? JSON.parse(text) : {}; } catch { json = null; }
71
+
72
+ // An nginx or Next error page, or a control plane mid-deploy. Never print
73
+ // a page of HTML into someone's terminal: say what happened instead.
74
+ if (json === null) {
75
+ if (res.status === 404) {
76
+ throw new Error('this control plane does not support per-node pricing yet (needs a newer infernetprotocol.com)');
77
+ }
78
+ throw new Error(`the control plane returned HTTP ${res.status} (not JSON); try again shortly`);
79
+ }
80
+
81
+ if (!res.ok) {
82
+ const bounds = json?.bounds ? ` (allowed ${fmt(json.bounds.min)}-${fmt(json.bounds.max)} per 1M)` : '';
83
+ throw new Error(`${json?.error ?? `HTTP ${res.status}`}${bounds}`);
84
+ }
85
+ return json;
86
+ }
87
+
88
+ export default async function price(args) {
89
+ const [sub, a1] = args.positional;
90
+ if (args.has('help') || sub === 'help') {
91
+ process.stdout.write(HELP);
92
+ return 0;
93
+ }
94
+
95
+ const ctx = await resolve(args);
96
+
97
+ switch (sub ?? 'list') {
98
+ case 'list': {
99
+ const out = await call('GET', ctx);
100
+ if (args.has('json')) {
101
+ process.stdout.write(`${JSON.stringify(out, null, 2)}\n`);
102
+ return 0;
103
+ }
104
+ const band = out.operator_pricing_enabled
105
+ ? `your price must be ${fmt(out.bounds.min_per_m_usd)}-${fmt(out.bounds.max_per_m_usd)} per 1M tokens`
106
+ : 'operator pricing is switched off on this network';
107
+ process.stdout.write(`node ${ctx.pubkey.slice(0, 12)}… (${band})\n`);
108
+ process.stdout.write(`network default: in ${fmt(out.default_model_price.input_per_m_usd)} / out ${fmt(out.default_model_price.output_per_m_usd)} per 1M\n\n`);
109
+ if (out.models.length === 0) {
110
+ process.stdout.write('this node serves no models yet\n');
111
+ return 0;
112
+ }
113
+ for (const m of out.models) {
114
+ const mark = m.source === 'operator' ? 'yours ' : m.source === 'house' ? 'network' : 'default';
115
+ const warn = m.clamped ? ' (clamped into the allowed band)' : '';
116
+ process.stdout.write(
117
+ ` ${m.model}\n in ${fmt(m.input_per_m_usd)} / out ${fmt(m.output_per_m_usd)} per 1M [${mark}]${warn}\n`
118
+ );
119
+ }
120
+ process.stdout.write('\nset yours: infernet price set <model> --out <usd>\n');
121
+ return 0;
122
+ }
123
+
124
+ case 'set': {
125
+ if (!a1) throw new Error('usage: infernet price set <model> --out <usd> [--in <usd>]');
126
+ const out = Number(args.get('out'));
127
+ if (!Number.isFinite(out) || out < 0) throw new Error('--out <usd> is required: your price per 1M output tokens');
128
+ // Output tokens dominate the bill, so --in follows --out unless
129
+ // asked for: a quarter is roughly the house ratio.
130
+ const inPrice = args.get('in') === undefined ? Math.round((out / 4) * 1e6) / 1e6 : Number(args.get('in'));
131
+ if (!Number.isFinite(inPrice) || inPrice < 0) throw new Error('--in must be a non-negative number of USD per 1M tokens');
132
+
133
+ const r = await call('PUT', ctx, {
134
+ body: { model: a1, input_per_m_usd: inPrice, output_per_m_usd: out }
135
+ });
136
+ if (args.has('json')) {
137
+ process.stdout.write(`${JSON.stringify(r, null, 2)}\n`);
138
+ return 0;
139
+ }
140
+ process.stdout.write(`${r.model}: in ${fmt(r.input_per_m_usd)} / out ${fmt(r.output_per_m_usd)} per 1M tokens\n`);
141
+ process.stdout.write('this node now charges your price for that model\n');
142
+ return 0;
143
+ }
144
+
145
+ case 'unset': {
146
+ if (!a1) throw new Error('usage: infernet price unset <model>');
147
+ const r = await call('DELETE', ctx, { path: `?model=${encodeURIComponent(a1)}` });
148
+ if (args.has('json')) {
149
+ process.stdout.write(`${JSON.stringify(r, null, 2)}\n`);
150
+ return 0;
151
+ }
152
+ process.stdout.write(`${r.model}: back to the network's price\n`);
153
+ return 0;
154
+ }
155
+
156
+ default:
157
+ process.stderr.write(`unknown subcommand: ${sub}\n\n${HELP}`);
158
+ return 1;
159
+ }
160
+ }
package/commands/start.js CHANGED
@@ -227,6 +227,10 @@ async function runDaemon(args, ctx) {
227
227
  const heartbeatMs = Number.parseInt(args.get('heartbeat-interval') ?? '', 10) || DEFAULT_HEARTBEAT_MS;
228
228
  const pollMs = Number.parseInt(args.get('poll-interval') ?? '', 10) || DEFAULT_POLL_MS;
229
229
  const once = args.has('once');
230
+ // Chat jobs run at once. Ollama on one GPU serves a single request at a
231
+ // time unless OLLAMA_NUM_PARALLEL is raised, so extra jobs only queue
232
+ // inside it; raise this together with that.
233
+ const maxConcurrentJobs = Number.parseInt(process.env.INFERNET_MAX_CONCURRENT_JOBS ?? '', 10) || 1;
230
234
 
231
235
  const p2pDisabled = args.has('no-p2p');
232
236
  const noAdvertise = args.has('no-advertise') || node.address === null;
@@ -618,6 +622,12 @@ async function runDaemon(args, ctx) {
618
622
  return;
619
623
  }
620
624
  if (stats.draining) return;
625
+ // Polls fire every pollMs whether or not the last batch finished, so
626
+ // without a cap a node ran one job per tick at once. The extras sat
627
+ // in Ollama's queue until fetch gave up ("fetch failed" at ~300 s,
628
+ // cullen3 2026-11-02). Jobs stay assigned here and run when a slot
629
+ // frees up.
630
+ if (stats.activeJobIds.size >= maxConcurrentJobs) return;
621
631
  const polledAt = Date.now();
622
632
  try {
623
633
  const result = await client.pollJobs({ limit: 5 });
@@ -635,6 +645,7 @@ async function runDaemon(args, ctx) {
635
645
  // new ones" (bonita, 0.1.83 -> 0.1.84). They stay assigned
636
646
  // and the restarted daemon picks them up.
637
647
  if (stats.draining) break;
648
+ if (stats.activeJobIds.size >= maxConcurrentJobs) break;
638
649
  await processJob(job);
639
650
  }
640
651
  } catch (err) {
package/index.js CHANGED
@@ -55,6 +55,7 @@ import order from './commands/order.js';
55
55
  import mcp from './commands/mcp.js';
56
56
  import credits, { invites, redeem } from './commands/credits.js';
57
57
  import batch, { billing, keys } from './commands/batch.js';
58
+ import price from './commands/price.js';
58
59
 
59
60
  function parseArgs(argv) {
60
61
  const positional = [];
@@ -117,11 +118,12 @@ const COMMANDS = {
117
118
  uninstall: remove,
118
119
  start, status, stop, restart, stats, logs,
119
120
  payout, payments, gpu, firewall, chat, setup, model, train, publish, inference, rpc, uncensored, reservation, reservations: reservation, order, orders: order, mcp, credits, invites, redeem, batch, batches: batch, billing, keys, tui, doctor, service, pubkey, debug, deploy, console: consoleCmd, help,
121
+ price, prices: price,
120
122
  'house-models': houseModels, house: houseModels
121
123
  };
122
124
 
123
125
  // Commands that can run without a loaded config.
124
- const NO_CONFIG = new Set(['init', 'login', 'help', 'stats', 'logs', 'stop', 'restart', 'gpu', 'firewall', 'chat', 'setup', 'model', 'train', 'publish', 'inference', 'rpc', 'uncensored', 'reservation', 'reservations', 'order', 'orders', 'mcp', 'credits', 'invites', 'redeem', 'batch', 'batches', 'billing', 'keys', 'tui', 'doctor', 'service', 'pubkey', 'debug', 'deploy', 'console', 'upgrade', 'update', 'remove', 'uninstall', 'house-models', 'house']);
126
+ const NO_CONFIG = new Set(['init', 'login', 'help', 'stats', 'logs', 'stop', 'restart', 'gpu', 'firewall', 'chat', 'setup', 'model', 'train', 'publish', 'inference', 'rpc', 'uncensored', 'reservation', 'reservations', 'order', 'orders', 'mcp', 'credits', 'invites', 'redeem', 'batch', 'batches', 'billing', 'keys', 'tui', 'doctor', 'service', 'pubkey', 'debug', 'deploy', 'console', 'upgrade', 'update', 'remove', 'uninstall', 'house-models', 'house', 'price', 'prices']);
125
127
  // Commands that need a config but not a control-plane client (none today
126
128
  // — kept as a future escape hatch).
127
129
  const NO_CLIENT = new Set();
@@ -76,6 +76,9 @@ export function createBatchClient({ baseUrl, apiKey, userToken, fetchImpl = fetc
76
76
  topup: (amountUsd) => call('POST', '/api/v1/billing/topup', { body: { amount_usd: amountUsd } }),
77
77
  topupStatus: (id) => call('GET', `/api/v1/billing/topup/${enc(id)}`),
78
78
  setFunding: (order) => call('PUT', '/api/v1/billing/funding', { body: { funding_order: order } }),
79
+ fundFromEarnings: (amountUsd) => call('POST', '/api/v1/billing/fund-from-earnings', {
80
+ body: amountUsd == null || amountUsd === 'all' ? {} : { amount_usd: amountUsd }
81
+ }),
79
82
  createKey: (name) => call('POST', '/api/v1/keys', { body: { name: name ?? null }, signedIn: true }),
80
83
  listKeys: () => call('GET', '/api/v1/keys', { signedIn: true }),
81
84
  revokeKey: (id) => call('DELETE', `/api/v1/keys/${enc(id)}`, { signedIn: true })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infernetprotocol/cli",
3
- "version": "0.1.87",
3
+ "version": "0.1.89",
4
4
  "description": "GPU-node CLI / daemon for the Infernet Protocol — register a GPU server with a Supabase control plane and start earning.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -32,14 +32,14 @@
32
32
  "ora": "^9.4.1",
33
33
  "react": "^17.0.2",
34
34
  "react-blessed": "^0.7.2",
35
- "@infernetprotocol/auth": "0.1.87",
36
- "@infernetprotocol/config": "0.1.87",
37
- "@infernetprotocol/deploy-providers": "0.1.87",
38
- "@infernetprotocol/gpu": "0.1.87",
39
- "@infernetprotocol/engine": "0.1.87",
40
- "@infernetprotocol/liquid-agent": "0.1.87",
41
- "@infernetprotocol/rpc-adapter": "0.1.87",
42
- "@infernetprotocol/training": "0.1.87"
35
+ "@infernetprotocol/auth": "0.1.89",
36
+ "@infernetprotocol/config": "0.1.89",
37
+ "@infernetprotocol/deploy-providers": "0.1.89",
38
+ "@infernetprotocol/engine": "0.1.89",
39
+ "@infernetprotocol/gpu": "0.1.89",
40
+ "@infernetprotocol/liquid-agent": "0.1.89",
41
+ "@infernetprotocol/rpc-adapter": "0.1.89",
42
+ "@infernetprotocol/training": "0.1.89"
43
43
  },
44
44
  "repository": {
45
45
  "type": "git",