@otonix/cli 1.2.0 → 1.3.0

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.
Files changed (3) hide show
  1. package/README.md +122 -17
  2. package/dist/cli.js +196 -1
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Command-line tool for the [Otonix](https://otonix.tech) sovereign compute platform.
4
4
 
5
- Initialize, register, and manage autonomous AI agents from your terminal.
5
+ Initialize, register, and manage autonomous AI agents from your terminal. Includes built-in access to the Bankr LLM Gateway for multi-model AI inference.
6
6
 
7
7
  ## Install
8
8
 
@@ -64,13 +64,69 @@ otonix log "Trade executed BTC/USDC" --category trading
64
64
  | `otonix sandboxes` | List VPS sandboxes |
65
65
  | `otonix domains` | List registered domains |
66
66
 
67
+ ### Credits
68
+
69
+ | Command | Description |
70
+ |---------|-------------|
71
+ | `otonix credits [agentId]` | Show agent credit balance |
72
+ | `otonix credits:transfer` | Transfer credits between agents |
73
+ | `otonix credits:history [agentId]` | Show credit transaction history |
74
+
75
+ ### Templates
76
+
77
+ | Command | Description |
78
+ |---------|-------------|
79
+ | `otonix templates` | List all available agent templates |
80
+ | `otonix templates:info <slug>` | Show template details by slug |
81
+ | `otonix templates:deploy` | Deploy an agent from a template |
82
+
67
83
  ### Platform
68
84
 
69
85
  | Command | Description |
70
86
  |---------|-------------|
71
87
  | `otonix engine` | Show autonomic engine status |
88
+ | `otonix marketplace` | List marketplace services |
72
89
  | `otonix x402` | Show x402 payment configuration |
73
90
 
91
+ ### LLM Gateway (Bankr)
92
+
93
+ Access multi-model AI inference directly from your terminal. Supports Claude, GPT, Gemini, Kimi, Qwen, and more via the [Bankr LLM Gateway](https://bankr.bot/llm).
94
+
95
+ | Command | Description |
96
+ |---------|-------------|
97
+ | `otonix llm:init <key>` | Configure Bankr LLM Gateway API key |
98
+ | `otonix llm:models` | List available AI models |
99
+ | `otonix llm:chat <prompt>` | Send a chat completion request |
100
+ | `otonix llm:usage` | Show LLM usage summary |
101
+ | `otonix llm:health` | Check gateway health status |
102
+
103
+ #### LLM Setup
104
+
105
+ Get your Bankr API key from [bankr.bot/api](https://bankr.bot/api) (make sure LLM Gateway access is enabled):
106
+
107
+ ```bash
108
+ otonix llm:init bk_YOUR_API_KEY
109
+ ```
110
+
111
+ #### LLM Examples
112
+
113
+ ```bash
114
+ # List available models
115
+ otonix llm:models
116
+
117
+ # Chat with default model (claude-haiku-4.5)
118
+ otonix llm:chat "What is sovereign compute?"
119
+
120
+ # Chat with a specific model
121
+ otonix llm:chat "Analyze BTC price action" --model gpt-5-mini
122
+
123
+ # Check usage (last 7 days)
124
+ otonix llm:usage --days 7
125
+
126
+ # Check gateway health
127
+ otonix llm:health
128
+ ```
129
+
74
130
  ## Command Options
75
131
 
76
132
  ### `otonix register`
@@ -107,6 +163,52 @@ otonix actions --limit 50
107
163
  |--------|---------|-------------|
108
164
  | `--limit` | `20` | Number of actions to show |
109
165
 
166
+ ### `otonix credits:transfer`
167
+
168
+ ```bash
169
+ otonix credits:transfer --from <agentId> --to <agentId> --amount 10 --desc "Payment"
170
+ ```
171
+
172
+ | Option | Default | Description |
173
+ |--------|---------|-------------|
174
+ | `--from` | (interactive) | Source agent ID |
175
+ | `--to` | (interactive) | Destination agent ID |
176
+ | `--amount` | (interactive) | Amount in USDC |
177
+ | `--desc` | — | Transfer description |
178
+
179
+ ### `otonix templates:deploy`
180
+
181
+ ```bash
182
+ otonix templates:deploy --template trading-bot --name my-trader --vps 10.0.1.1 --wallet 0x...
183
+ ```
184
+
185
+ | Option | Default | Description |
186
+ |--------|---------|-------------|
187
+ | `--template` | (interactive) | Template slug |
188
+ | `--name` | (interactive) | Agent name |
189
+ | `--vps` | — | VPS IP address |
190
+ | `--wallet` | — | Wallet address |
191
+
192
+ ### `otonix llm:chat`
193
+
194
+ ```bash
195
+ otonix llm:chat "Your prompt here" --model claude-haiku-4.5
196
+ ```
197
+
198
+ | Option | Default | Description |
199
+ |--------|---------|-------------|
200
+ | `--model` | `claude-haiku-4.5` | AI model to use |
201
+
202
+ ### `otonix llm:usage`
203
+
204
+ ```bash
205
+ otonix llm:usage --days 7
206
+ ```
207
+
208
+ | Option | Default | Description |
209
+ |--------|---------|-------------|
210
+ | `--days` | `30` | Number of days to show |
211
+
110
212
  ## Configuration
111
213
 
112
214
  Config is stored at `~/.otonix/config.json` with file permissions `600`.
@@ -116,7 +218,8 @@ Config is stored at `~/.otonix/config.json` with file permissions `600`.
116
218
  "apiKey": "otonix_xxxx",
117
219
  "endpoint": "https://app.otonix.tech",
118
220
  "agentId": "uuid-xxxx",
119
- "agentName": "my-agent"
221
+ "agentName": "my-agent",
222
+ "bankrApiKey": "bk_xxxx"
120
223
  }
121
224
  ```
122
225
 
@@ -141,24 +244,26 @@ $ otonix register --name sentinel-01
141
244
  Tier: active
142
245
  Interval: 60s
143
246
 
247
+ $ otonix llm:init bk_4GYZ...WXFKD
248
+ Bankr LLM Gateway key saved.
249
+ Gateway: https://llm.bankr.bot
250
+ Key: bk_4GY...XFKD
251
+
252
+ $ otonix llm:chat "What infrastructure should I monitor?"
253
+ Model: claude-haiku-4.5
254
+ Prompt: What infrastructure should I monitor?
255
+
256
+ Thinking...
257
+
258
+ Focus on CPU usage, memory consumption, disk I/O, network latency,
259
+ and service uptime. Set up alerts for anomalies in each metric.
260
+
261
+ Tokens: 24 in / 87 out
262
+ Model: claude-haiku-4.5
263
+
144
264
  $ otonix heartbeat
145
265
  Heartbeat sent — sentinel-01 [active] tier:active credits:$50.00
146
266
 
147
- $ otonix log "Deployed monitoring stack" --category infra
148
- Logged: [infra] Deployed monitoring stack (completed)
149
-
150
- $ otonix status
151
- Agent Status:
152
- ID: e2998be4-b77c-495e-a535-a6e4ca9dc768
153
- Name: sentinel-01
154
- Status: active
155
- Tier: full
156
- Credits: $50.00
157
- Model: claude-opus-4-6
158
- VPS IP: 10.0.1.1
159
- Heartbeat: 12s ago
160
- Actions: 3
161
-
162
267
  $ otonix engine
163
268
  Autonomic Engine Status:
164
269
  Running: yes
package/dist/cli.js CHANGED
@@ -28,7 +28,7 @@ var import_sdk = require("@otonix/sdk");
28
28
  var fs = __toESM(require("fs"));
29
29
  var path = __toESM(require("path"));
30
30
  var readline = __toESM(require("readline"));
31
- var VERSION = "1.2.0";
31
+ var VERSION = "1.3.0";
32
32
  var CONFIG_DIR = path.join(process.env.HOME || "~", ".otonix");
33
33
  var CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
34
34
  function loadConfig() {
@@ -106,6 +106,12 @@ var HELP = `
106
106
  domains List registered domains
107
107
  sandboxes List VPS sandboxes
108
108
  engine Show autonomic engine status
109
+ credits <agentId> Show agent credit balance
110
+ credits:transfer Transfer credits between agents
111
+ credits:history <id> Show credit transaction history
112
+ templates List available agent templates
113
+ templates:info <s> Show template details by slug
114
+ templates:deploy Deploy an agent from a template
109
115
  marketplace List marketplace services
110
116
  x402 Show x402 payment config
111
117
  llm:init <key> Configure Bankr LLM Gateway API key
@@ -471,6 +477,177 @@ async function cmdMarketplace() {
471
477
  Use 'curl https://app.otonix.tech/api/marketplace/services/<id>' for details.
472
478
  `);
473
479
  }
480
+ async function cmdCredits(agentId) {
481
+ const client = getClient();
482
+ const config = loadConfig();
483
+ const id = agentId || config.agentId;
484
+ if (!id) {
485
+ console.error(" Usage: otonix credits <agentId> (or register an agent first)");
486
+ process.exit(1);
487
+ }
488
+ const balance = await client.getCreditBalance(id);
489
+ console.log(`
490
+ Agent Credit Balance:`);
491
+ console.log(` Agent: ${balance.name}`);
492
+ console.log(` Credits: $${balance.credits.toFixed(2)}`);
493
+ console.log(` Tier: ${balance.survivalTier}
494
+ `);
495
+ }
496
+ async function cmdCreditsTransfer(args) {
497
+ const client = getClient();
498
+ let fromId = "";
499
+ let toId = "";
500
+ let amount = 0;
501
+ let desc = "";
502
+ for (let i = 0; i < args.length; i++) {
503
+ if (args[i] === "--from" && args[i + 1]) fromId = args[++i];
504
+ else if (args[i] === "--to" && args[i + 1]) toId = args[++i];
505
+ else if (args[i] === "--amount" && args[i + 1]) amount = parseFloat(args[++i]);
506
+ else if (args[i] === "--desc" && args[i + 1]) desc = args[++i];
507
+ }
508
+ if (!fromId) fromId = await prompt(" From Agent ID: ");
509
+ if (!toId) toId = await prompt(" To Agent ID: ");
510
+ if (!amount) {
511
+ const amtStr = await prompt(" Amount (USDC): ");
512
+ amount = parseFloat(amtStr);
513
+ }
514
+ if (!fromId || !toId || !amount || amount <= 0) {
515
+ console.error(" Error: --from, --to, and --amount (> 0) are required.");
516
+ process.exit(1);
517
+ }
518
+ try {
519
+ const result = await client.transferCredits({
520
+ fromAgentId: fromId,
521
+ toAgentId: toId,
522
+ amount,
523
+ description: desc || void 0
524
+ });
525
+ if (result.success) {
526
+ console.log(`
527
+ Transfer Successful:`);
528
+ console.log(` Amount: $${result.transferred.toFixed(2)} USDC`);
529
+ console.log(` From: ${result.from}`);
530
+ console.log(` To: ${result.to}
531
+ `);
532
+ } else {
533
+ console.error(" Transfer failed.");
534
+ }
535
+ } catch (err) {
536
+ console.error(` Error: ${err.message}`);
537
+ process.exit(1);
538
+ }
539
+ }
540
+ async function cmdCreditsHistory(agentId) {
541
+ const client = getClient();
542
+ const config = loadConfig();
543
+ const id = agentId || config.agentId;
544
+ if (!id) {
545
+ console.error(" Usage: otonix credits:history <agentId>");
546
+ process.exit(1);
547
+ }
548
+ const history = await client.getCreditHistory(id);
549
+ if (!history.length) {
550
+ console.log("\n No credit transactions found.\n");
551
+ return;
552
+ }
553
+ console.log(`
554
+ Credit History (${history.length} transactions):
555
+ `);
556
+ printTable(
557
+ history.map((tx) => ({
558
+ Type: tx.type,
559
+ Amount: `${tx.type === "credit" ? "+" : "-"}$${Math.abs(tx.amount).toFixed(2)}`,
560
+ Description: (tx.description || "\u2014").slice(0, 50),
561
+ Status: tx.status,
562
+ Date: new Date(tx.createdAt).toLocaleDateString()
563
+ }))
564
+ );
565
+ console.log();
566
+ }
567
+ async function cmdTemplates() {
568
+ const client = getClient();
569
+ const templates = await client.listTemplates();
570
+ if (!templates.length) {
571
+ console.log("\n No templates available.\n");
572
+ return;
573
+ }
574
+ console.log(`
575
+ Agent Templates (${templates.length}):
576
+ `);
577
+ printTable(
578
+ templates.map((t) => ({
579
+ Slug: t.slug,
580
+ Name: t.name,
581
+ Category: t.category,
582
+ Model: t.model,
583
+ Cost: `$${t.estimatedCost.toFixed(2)}/day`,
584
+ Features: t.features?.length || 0
585
+ }))
586
+ );
587
+ console.log();
588
+ }
589
+ async function cmdTemplatesInfo(slug) {
590
+ if (!slug) {
591
+ console.error(" Usage: otonix templates:info <slug>");
592
+ process.exit(1);
593
+ }
594
+ const client = getClient();
595
+ const template = await client.getTemplate(slug);
596
+ console.log(`
597
+ Template: ${template.name}`);
598
+ console.log(` Slug: ${template.slug}`);
599
+ console.log(` Category: ${template.category}`);
600
+ console.log(` Model: ${template.model}`);
601
+ console.log(` Est. Cost: $${template.estimatedCost.toFixed(2)}/day`);
602
+ console.log(` Description: ${template.description}`);
603
+ if (template.features?.length) {
604
+ console.log(` Features:`);
605
+ template.features.forEach((f) => console.log(` - ${f}`));
606
+ }
607
+ console.log();
608
+ }
609
+ async function cmdTemplatesDeploy(args) {
610
+ const client = getClient();
611
+ let slug = "";
612
+ let name = "";
613
+ let vpsIp = "";
614
+ let wallet = "";
615
+ for (let i = 0; i < args.length; i++) {
616
+ if (args[i] === "--template" && args[i + 1]) slug = args[++i];
617
+ else if (args[i] === "--name" && args[i + 1]) name = args[++i];
618
+ else if (args[i] === "--vps" && args[i + 1]) vpsIp = args[++i];
619
+ else if (args[i] === "--wallet" && args[i + 1]) wallet = args[++i];
620
+ }
621
+ if (!slug) slug = await prompt(" Template slug (e.g. trading-bot): ");
622
+ if (!name) name = await prompt(" Agent name: ");
623
+ if (!slug || !name) {
624
+ console.error(" Error: --template and --name are required.");
625
+ process.exit(1);
626
+ }
627
+ try {
628
+ const result = await client.deployTemplate({
629
+ templateSlug: slug,
630
+ name,
631
+ vpsIp: vpsIp || void 0,
632
+ walletAddress: wallet || void 0
633
+ });
634
+ if (result.success) {
635
+ console.log(`
636
+ Agent Deployed:`);
637
+ console.log(` ID: ${result.agent.id}`);
638
+ console.log(` Name: ${result.agent.name}`);
639
+ console.log(` Template: ${result.template.name} (${result.template.category})`);
640
+ console.log(` Model: ${result.agent.model}`);
641
+ console.log(` Tier: ${result.agent.survivalTier}
642
+ `);
643
+ } else {
644
+ console.error(" Deploy failed.");
645
+ }
646
+ } catch (err) {
647
+ console.error(` Error: ${err.message}`);
648
+ process.exit(1);
649
+ }
650
+ }
474
651
  async function cmdX402() {
475
652
  const client = getClient();
476
653
  const config = await client.getX402Config();
@@ -660,6 +837,24 @@ async function main() {
660
837
  case "engine":
661
838
  await cmdEngine();
662
839
  break;
840
+ case "credits":
841
+ await cmdCredits(rest[0]);
842
+ break;
843
+ case "credits:transfer":
844
+ await cmdCreditsTransfer(rest);
845
+ break;
846
+ case "credits:history":
847
+ await cmdCreditsHistory(rest[0]);
848
+ break;
849
+ case "templates":
850
+ await cmdTemplates();
851
+ break;
852
+ case "templates:info":
853
+ await cmdTemplatesInfo(rest[0]);
854
+ break;
855
+ case "templates:deploy":
856
+ await cmdTemplatesDeploy(rest);
857
+ break;
663
858
  case "marketplace":
664
859
  await cmdMarketplace();
665
860
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@otonix/cli",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "CLI tool for the Otonix sovereign compute platform — initialize agents, generate API keys, register, monitor status, and manage infrastructure from the terminal.",
5
5
  "main": "dist/cli.js",
6
6
  "bin": {
@@ -38,7 +38,7 @@
38
38
  "node": ">=18"
39
39
  },
40
40
  "dependencies": {
41
- "@otonix/sdk": "^1.2.0"
41
+ "@otonix/sdk": "^1.3.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "tsup": "^8.0.0",