@infernetprotocol/cli 0.1.69 → 0.1.70
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/mcp.js +1 -1
- package/commands/order.js +16 -2
- package/lib/orders-client.js +5 -0
- package/package.json +8 -8
package/commands/mcp.js
CHANGED
|
@@ -96,7 +96,7 @@ export const TOOLS = [
|
|
|
96
96
|
run: (c, a) => c.invoice(a.id)
|
|
97
97
|
},
|
|
98
98
|
// Self-serve orders: anyone can book, no admin token. x402 pays from X402_PRIVATE_KEY.
|
|
99
|
-
{ name: 'order_capacity', description: 'What can be ordered right now: per GPU class the
|
|
99
|
+
{ name: 'order_capacity', description: 'What can be ordered right now: per GPU class the price (our cost plus the house margin), how many online nodes are free and which models they serve.', inputSchema: { type: 'object', properties: {} }, run: (c) => c.orders.capacity() },
|
|
100
100
|
{
|
|
101
101
|
name: 'order_quote',
|
|
102
102
|
description: 'Price an order without paying: matches an online node and returns the quote plus the x402 offer.',
|
package/commands/order.js
CHANGED
|
@@ -8,7 +8,7 @@ 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
|
|
11
|
+
hours you book, and you get an OpenAI-compatible API key. Prepaid at the quoted
|
|
12
12
|
price; non-compliant hours are credited or refunded.
|
|
13
13
|
|
|
14
14
|
Usage:
|
|
@@ -20,6 +20,10 @@ Usage:
|
|
|
20
20
|
[--max-usd ${DEFAULT_MAX_USD}] refuse to sign more than this
|
|
21
21
|
infernet order status <id> --buyer-token ifr_buy_… (or INFERNET_BUYER_TOKEN)
|
|
22
22
|
|
|
23
|
+
Admin (INFERNET_ADMIN_TOKEN or --token):
|
|
24
|
+
infernet order margin [PCT] show / set the minimum profit margin over our
|
|
25
|
+
GPU cost, 1-2000 (default 100 = twice our cost)
|
|
26
|
+
|
|
23
27
|
After booking, manage it with \`infernet reservation\` and the same buyer token:
|
|
24
28
|
INFERNET_BUYER_TOKEN=ifr_buy_… infernet reservation key-issue <reservation id>
|
|
25
29
|
`;
|
|
@@ -38,7 +42,7 @@ export default async function order(args) {
|
|
|
38
42
|
process.stdout.write(HELP);
|
|
39
43
|
return sub || args.has('help') ? 0 : 1;
|
|
40
44
|
}
|
|
41
|
-
const { baseUrl } = await resolveClientOptions({ url: args.get('url') });
|
|
45
|
+
const { baseUrl, adminToken } = await resolveClientOptions({ url: args.get('url'), token: args.get('token') });
|
|
42
46
|
const client = createOrdersClient({ baseUrl });
|
|
43
47
|
const json = args.has('json');
|
|
44
48
|
const body = () => orderBodyFromFlags((k) => args.get(k));
|
|
@@ -91,6 +95,16 @@ export default async function order(args) {
|
|
|
91
95
|
if (o.reservation_id) process.stdout.write(`reservation ${o.reservation_id}: INFERNET_BUYER_TOKEN=… infernet reservation key-issue ${o.reservation_id}\n`);
|
|
92
96
|
return 0;
|
|
93
97
|
}
|
|
98
|
+
case 'margin': {
|
|
99
|
+
if (!adminToken) throw new Error('set INFERNET_ADMIN_TOKEN (or pass --token)');
|
|
100
|
+
const v = await client.margin(adminToken, a1 === undefined ? undefined : Number(a1));
|
|
101
|
+
if (json) return out(v), 0;
|
|
102
|
+
process.stdout.write(`minimum profit margin ${v.min_margin_pct}% over our cost (range ${v.range.min}-${v.range.max}%)\n`);
|
|
103
|
+
for (const c of v.classes) {
|
|
104
|
+
process.stdout.write(`${c.gpu_class.padEnd(7)} ${c.label.padEnd(13)} cost $${c.cost_per_hour.toFixed(2)}/h sells $${c.price_per_hour.toFixed(2)}/h + $${c.setup_fee.toFixed(2)} setup\n`);
|
|
105
|
+
}
|
|
106
|
+
return 0;
|
|
107
|
+
}
|
|
94
108
|
default:
|
|
95
109
|
process.stderr.write(`unknown subcommand: ${sub}\n\n${HELP}`);
|
|
96
110
|
return 1;
|
package/lib/orders-client.js
CHANGED
|
@@ -41,6 +41,11 @@ export function createOrdersClient({ baseUrl, fetchImpl = fetch, x402 = createX4
|
|
|
41
41
|
|
|
42
42
|
return {
|
|
43
43
|
capacity: () => call('GET', '/api/v1/orders/capacity'),
|
|
44
|
+
/** Admin: read (pct undefined) or set the minimum profit margin. */
|
|
45
|
+
margin: (adminToken, pct) => call(pct === undefined ? 'GET' : 'POST', '/api/v1/admin/orders/pricing', {
|
|
46
|
+
body: pct === undefined ? undefined : { min_margin_pct: pct },
|
|
47
|
+
headers: { authorization: `Bearer ${adminToken}` }
|
|
48
|
+
}),
|
|
44
49
|
status: (id, buyerToken) => call('GET', `/api/v1/orders/${encodeURIComponent(id)}`, { headers: { 'x-buyer-token': buyerToken } }),
|
|
45
50
|
/** Quote without paying: the 402 body (offer + quote). */
|
|
46
51
|
async quote(input) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infernetprotocol/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.70",
|
|
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",
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
"ora": "^9.4.1",
|
|
32
32
|
"react": "^17.0.2",
|
|
33
33
|
"react-blessed": "^0.7.2",
|
|
34
|
-
"@infernetprotocol/
|
|
35
|
-
"@infernetprotocol/
|
|
36
|
-
"@infernetprotocol/
|
|
37
|
-
"@infernetprotocol/engine": "0.1.
|
|
38
|
-
"@infernetprotocol/
|
|
39
|
-
"@infernetprotocol/
|
|
40
|
-
"@infernetprotocol/
|
|
34
|
+
"@infernetprotocol/config": "0.1.70",
|
|
35
|
+
"@infernetprotocol/auth": "0.1.70",
|
|
36
|
+
"@infernetprotocol/deploy-providers": "0.1.70",
|
|
37
|
+
"@infernetprotocol/engine": "0.1.70",
|
|
38
|
+
"@infernetprotocol/liquid-agent": "0.1.70",
|
|
39
|
+
"@infernetprotocol/rpc-adapter": "0.1.70",
|
|
40
|
+
"@infernetprotocol/gpu": "0.1.70"
|
|
41
41
|
},
|
|
42
42
|
"repository": {
|
|
43
43
|
"type": "git",
|