vapi-network 0.5.0 → 0.8.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.
package/README.md CHANGED
@@ -10,530 +10,83 @@ an API advertises `payment-identifier`, the generated id is kept on that receipt
10
10
 
11
11
  Call works today. Tasks and Compute are next.
12
12
 
13
- ## Quickstart
13
+ ## Install
14
14
 
15
15
  ```bash
16
16
  npm i -g vapi-network
17
- vapi init # creates ~/.vapi, the wallet main, and prints its address
18
- vapi backup # write the 12 words down; vAPI cannot recover them
19
- vapi fund # opens the hosted funding page for your address
20
- vapi search "weather" # every catalogue, merged, with provenance
21
- vapi pay <listing-ref> --max 0.02
22
- vapi receipts # one line per paid call: quote, settlement, latency
23
17
  ```
24
18
 
25
- That is the same order `vapi init` prints as its next steps, and the same order
26
- `vapi` alone lists. Two more are worth knowing early: `vapi inspect <ref>` shows
27
- a listing's request contract and live 402 quote for free, before you pay, and
28
- `vapi balance` shows what the wallet holds.
29
-
30
- `vapi search` tags each listing with its group — `[vapi]`, `[added]`,
31
- `[partner]` or `[external]` — and prints the network fee that is already inside
32
- the price. vAPI and added APIs carry a 5% network fee inside the quoted price;
33
- partner and external listings carry none. `vapi inspect` and `--json` return the
34
- same `group` and `fee` fields.
35
-
36
- Listing on vAPI is permissionless, and verification is a tier on top of it. Each
37
- result also carries `[verified]`, `[requested]` or `[unverified]`, and a
38
- mirrored catalog row carries `[external]` instead. By default `vapi search`
39
- answers with vAPI-verified listings plus the mirrored external catalogs;
40
- `--include-unverified` also returns self-listed APIs that passed vAPI's
41
- automated x402 probe but were never reviewed. `vapi inspect` prints a
42
- `Verification:` line, `vapi pay` says so in one line before the result when the
43
- listing it just paid is not verified, and `--json` carries `verification` on
44
- all three.
45
-
46
- `vapi inspect` also says how a listing has behaved lately, when the registry
47
- has measured it: a `Liveness:` line with its uptime over the last seven days of
48
- hourly re-probes and its p50 and p95 latency, and a `Conformance:` line with the
49
- x402 version its 402 declares, whether it follows that version, where the offer
50
- travels, and any issue codes — the same codes `vapi check` reports. A registry
51
- that has not measured a listing sends neither, and neither line is printed.
52
- `--json` carries them as `liveness` and `conformance`.
53
-
54
- When the registry knows it, `vapi inspect` also prints the listing's ERC-8004
55
- agent identity on Base and its reputation. The client reads these fields from
56
- the registry and does not read the chain.
57
-
58
19
  No install? Prefix any command with `npx vapi-network`, for example
59
20
  `npx vapi-network init`. (`npx vapi` cannot work: the bare `vapi` name on npm
60
21
  belongs to an unrelated package.)
61
22
 
62
- ## Wallets
63
-
64
- One machine can hold several wallets: your own, and a capped one per agent. Each
65
- keystore lives in `$VAPI_HOME/wallets/<name>.json`; `$VAPI_HOME/wallets.json`
66
- records which one is the default, what each may spend, and its label. Names are
67
- 1 to 32 characters of lowercase letters, digits and dashes.
68
-
69
- ```bash
70
- vapi wallet list # address, default marker, caps, unlocked, label
71
- vapi wallet create agent --label "claude code" # a wallet of its own for the agent
72
- vapi wallet caps agent --per-call 0.05 --per-day 1
73
- vapi wallet use agent # make it the default for later commands
74
- vapi pay <listing-ref> --wallet agent --max 0.02
75
- vapi receipts --wallet agent # or --all-wallets for every one
76
- ```
77
-
78
- Every command that touches a wallet takes `--wallet <name>`: `balance`,
79
- `accounts`, `fund`, `pay`, `sweep`, `receipts`, `stats`, `export-key`, `backup`,
80
- `import`, `passphrase`, `unlock`, `lock` and `mcp`. Without it, `VAPI_WALLET`
81
- decides; without that, the default set by `vapi wallet use` does. Each of them
82
- names the wallet it used — `Wallet: main (0x…)` on the first line, or a `wallet`
83
- field in `--json` — so neither you nor an agent can be wrong about which key
84
- just moved.
85
-
86
- Spend caps belong to the wallet, not to the machine, and today's total is
87
- counted per wallet: an agent cannot spend your daily allowance. Removing a
88
- wallet is a move, not a delete — the encrypted keystore goes to
89
- `wallets/.trash/`, where `vapi wallet restore` can bring it back.
90
-
91
- **Coming from 0.2.x?** Nothing to do. The first command you run opens the wallet
92
- store, moves `keystore.json` to `wallets/main.json` with its contents untouched,
93
- turns `config.json`'s spend caps into the caps of `main`, and leaves
94
- `keystore.json` behind as a mode 0600 symlink for one release so existing
95
- scripts keep working. A home with no keystore migrates nothing.
96
-
97
- ## Your wallet is yours
98
-
99
- `vapi init` generates a 12-word BIP-39 recovery phrase on your machine, derives
100
- the Base account (`m/44'/60'/0'/0/0`) and, with `--networks base,solana`, the
101
- Solana account (`m/44'/501'/0'/0'`) from it, and writes the phrase encrypted
102
- under your passphrase to `$VAPI_HOME/wallets/main.json` (mode 0600). The phrase
103
- is shown once, on a terminal, and never in `--json` or piped output.
104
-
105
- Three things vAPI cannot do:
106
-
107
- - **See it.** No key, phrase or passphrase ever leaves the machine.
108
- - **Recover it.** There is no copy anywhere to restore from.
109
- - **Freeze it.** Payments go straight from your wallet to the service.
110
-
111
- ### Back it up
112
-
113
- ```bash
114
- vapi backup # the 12 words, numbered, on a terminal
115
- vapi backup --json # { "wallet": "main", "recoveryPhrase": "..." }
116
- ```
117
-
118
- Write the words on paper and keep them somewhere only you reach. Anyone holding
119
- them can spend the wallet, so never type them into a website or a chat.
120
-
121
- Wallets created before 0.2.5 have no recovery phrase. `vapi backup` says so and
122
- points at `vapi export-key`, which prints the private key itself; back that key
123
- up, or `vapi import --key` it into a new wallet. Restoring a phrase-based wallet
124
- in MetaMask, Rabby, Coinbase Wallet or Phantom gives the same addresses.
125
-
126
- ### Import and move a wallet
127
-
128
- ```bash
129
- vapi import --phrase # type the words at the prompt
130
- vapi import --phrase --networks base,solana # restore both accounts
131
- vapi import --key # a 0x private key instead of words
132
- vapi import --phrase --wallet backup-2026 # into a named wallet of its own
133
- ```
134
-
135
- `vapi import` reads the secret from a prompt, never from the command line where
136
- a shell history would keep it, and asks for a new passphrase. It writes a new
137
- named wallet rather than replacing one: `--wallet <name>` chooses the name, and
138
- `main` is assumed only on a machine with no wallet yet. `--replace` moves the
139
- named wallet to `wallets/.trash/` first, and still refuses a wallet that holds
140
- USDC on Base unless you add `--force`.
141
-
142
- ### Change the passphrase
143
-
144
- ```bash
145
- vapi passphrase # current passphrase, then the new one twice
146
- ```
147
-
148
- The wallet, its addresses and its recovery phrase are unchanged. Any copy of the
149
- old passphrase stored by `vapi unlock` is removed at the same time, so nothing
150
- is left behind that no longer opens the wallet.
151
-
152
- ### Agents and secrets
153
-
154
- An agent can drive vAPI all day without ever seeing a secret. It can search,
155
- inspect, pay from the wallet you gave it, read balances and receipts, and pick a
156
- wallet by name with `wallet.use` — which changes only that session, never your
157
- default on disk. It cannot see a recovery phrase, a private key or a passphrase,
158
- and the MCP server has no tool that creates, removes, renames, backs up or
159
- exports a wallet.
160
-
161
- vAPI agents combine a local profile, a dedicated wallet and vAPI Router into a
162
- small run loop on your machine. By default they use only verified listings, ask
163
- before a call above $0.50 and stop after at most 12 model steps. vAPI does not
164
- host agents; they run wherever you run `vapi agent run`.
165
-
166
- `vapi backup` and `vapi export-key` print a secret, so they run only when a
167
- person is demonstrably there: stdin and stdout are both a real terminal, no
168
- agent or CI marker is set, and you type the wallet's own name to confirm.
169
- Otherwise they print nothing and say:
170
-
171
- ```text
172
- Run this yourself in a terminal; an agent must never see these words.
173
- ```
174
-
175
- The markers vAPI refuses on are `VAPI_NO_SECRETS`, `CLAUDECODE`, `CLAUDE_CODE`,
176
- `CURSOR_AGENT`, `CODEX_SANDBOX`, `OPENAI_CODEX`, `AGENT` and `CI`. Set
177
- `VAPI_NO_SECRETS=1` in a machine's agent configuration to switch secret printing
178
- off outright. `vapi init` and `vapi wallet create` still create the wallet under
179
- those conditions; they simply say `Recovery phrase: run vapi backup yourself in
180
- a terminal to see it.`
181
-
182
- In the SDK the same line is drawn by the module layout: the functions that
183
- return a phrase or a key live in the separate `@vapi-network/core/secrets` entry
184
- point, which the MCP package is forbidden by lint to import.
185
-
186
- ### Where the passphrase lives
187
-
188
- An unlock looks in three places, in this order:
189
-
190
- 1. `VAPI_KEYSTORE_PASSWORD`, kept for CI and for Windows.
191
- 2. The OS secret store: the macOS Keychain, or libsecret on Linux, under the
192
- service `vapi-network` and the wallet's name.
193
- 3. A prompt, when a person is there to answer it.
194
-
195
- ```bash
196
- vapi unlock --wallet agent # store it, once, in your own terminal
197
- vapi wallet list # the UNLOCKED column says which agents can pay
198
- vapi lock --all # take every stored passphrase back out
199
- ```
200
-
201
- `vapi unlock` runs only on a real terminal with no agent marker set, and only
202
- after it has verified that the passphrase really opens that wallet. The
203
- passphrase is handed to the OS binary over its standard input, never as a
204
- command-line argument, so it never appears in `ps`. A run that finds no
205
- passphrase anywhere and has no terminal says so and names both other routes; an
206
- agent is never prompted. Windows has no store yet and keeps
207
- `VAPI_KEYSTORE_PASSWORD`.
208
-
209
- ### The audit log
210
-
211
- Every secret export, every wallet change — create, import, remove, restore,
212
- rename, default, caps, passphrase, unlock, lock — and every MCP session wallet
213
- switch appends one JSON line to `$VAPI_HOME/audit.log` (mode 0600): the time,
214
- the event, the wallet, whether a terminal was attached, and which marker was
215
- set. The line never contains the secret itself, so the log answers "did anything
216
- export my phrase while the agent was running" without you having to trust the
217
- agent's own account of it.
218
-
219
- ## CLI reference
220
-
221
- Every command accepts `--json`, which writes one JSON value — success or error —
222
- to stdout. Exit codes are `0` for success, `1` for an operational failure, and
223
- `2` for invalid usage or an announced preview-only command.
224
-
225
- | Command | Options | What it does |
226
- | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
227
- | `vapi init` | `--networks <base,arc,solana>` | Creates `~/.vapi`, the wallet `main` and the config. Says so if one exists. |
228
- | `vapi wallet list` | — | Name, address, default marker, caps in USD, unlocked, label |
229
- | `vapi wallet create <name>` | `--networks <base,arc,solana>`, `--label <text>` | A new wallet, with its own phrase, caps and passphrase |
230
- | `vapi wallet use <name>` | — | Makes it the default for every later command |
231
- | `vapi wallet rename <old> <new>` | — | Renames the keystore, the registry entry and that wallet's receipts |
232
- | `vapi wallet remove <name>` | `--force` | Moves the keystore to `wallets/.trash/`; asks you to type the name |
233
- | `vapi wallet restore <name>` | — | Brings a removed wallet back, same passphrase |
234
- | `vapi wallet caps <name>` | `--per-call <usd>`, `--per-day <usd>` | Sets that wallet's spend caps, in US dollars |
235
- | `vapi fund` | `--amount <usd>`, `--wallet <name>` | Prints and opens the hosted funding page. Makes no network call. |
236
- | `vapi accounts` | `--enable <solana\|arc>`, `--wallet <name>` | One deposit account per configured network, with balances and guidance |
237
- | `vapi search [query]` | `--kind <kind>` (repeatable), `--network <caip2>`, `--limit <n>`, `--cursor <cursor>`, `--include-unverified` | Merged discovery across every configured source, tagged by group and tier |
238
- | `vapi inspect <id>` | `--endpoint <name>` | Verification, fee, liveness, conformance, identity, contract and live quote, for free |
239
- | `vapi pay <id-or-url>` | `--method`, `--endpoint`, `--body <json>`, `--content-type`, `--network <caip2>`, `--expected-pay-to`, `--max <usd>`, `--wallet <name>` | Calls the API and pays it from the local wallet, naming an unverified tier |
240
- | `vapi pay --resume <receipt-id>` | — | Checks settlement, shows its payment id, and never pays |
241
- | `vapi check <url>` | `--method <method>` | Grades its 402, extensions and same-origin discovery. Never pays |
242
- | `vapi balance` | `--wallet <name>` | The wallet's address and USDC balances |
243
- | `vapi receipts` | `--limit <n>`, `--wallet <name>`, `--all-wallets` | The local append-only call ledger, newest last |
244
- | `vapi receipts export` | `--format <json\|csv>`, `--range <24h\|7d\|30d>`, `--wallet <name>`, `--all-wallets` | Raw receipts for a spreadsheet or dashboard |
245
- | `vapi stats` | `--range <24h\|7d\|30d>`, `--wallet <name>`, `--all-wallets` | Spend, outcomes, latency percentiles and top services |
246
- | `vapi sweep [<address>]` | `--network <caip2>`, `--wallet <name>` | Moves USDC to an address, or to the linked owner when omitted |
247
- | `vapi agent create <name>` | `--model <id>`, `--instructions <file>`, `--call-budget <usd>`, `--max-per-call <usd>`, `--router-budget <usd>`, `--approve-above <usd>`, `--include-unverified`, `--max-steps <n>` | Creates a capped local agent wallet, profile and owner link |
248
- | `vapi agent run <name> "<task>"` | None | Runs the named agent on this machine |
249
- | `vapi agent list` | None | Lists profiles, links and today's Call and Router budgets |
250
- | `vapi agent pause <name>` | None | Stops future runs until the agent is resumed |
251
- | `vapi agent resume <name>` | None | Allows a paused agent to run again |
252
- | `vapi agent revoke <name>` | None | Revokes the link and removes the profile, but keeps its wallet |
253
- | `vapi login` | `--wallet <name>`, `--label <name>`, `--publish`, `--no-browser` | Links the local agent wallet to your vAPI account |
254
- | `vapi logout` | `--wallet <name>` | Removes the selected wallet's agent link and stored credentials |
255
- | `vapi whoami` | `--wallet <name>` | Shows the chosen wallet's owner link and permissions, whether the link is live, and its ERC-8004 agent identity. |
256
- | `vapi router models` | `--wallet <name>` | Lists the vAPI Router model ids |
257
- | `vapi router usage` | `--wallet <name>` | Shows the agent's Compute allowance and Router balance |
258
- | `vapi router chat --model <id> "<prompt>"` | `--system <text>`, `--max-tokens <n>`, `--wallet <name>` | Sends one chat request through vAPI Router |
259
- | `vapi router key` | `--rotate`, `--wallet <name>` | Prints a gated Router key or rotates it without printing it |
260
- | `vapi router buy <1\|5\|20\|50>` | `--wallet <name>`, `--json` | Buys vAPI Router balance with USDC from your wallet |
261
- | `vapi router buy --auto <tier> --below <usd>` | `--wallet <name>`, or use `--auto off` | Sets or clears automatic vAPI Router balance refill |
262
- | `vapi stake status` | `--wallet <name>` | Shows the linked owner's stake and Compute today |
263
- | `vapi stake open` | `--wallet <name>`, `--no-browser` | Prints and optionally opens the staking page |
264
- | `vapi export-key` | `--network <caip2>`, `--wallet <name>` | Prints the private key. Terminal only, never for an agent. |
265
- | `vapi backup` | `--wallet <name>` | Prints the 12 words. Terminal only, never for an agent. |
266
- | `vapi import` | `--phrase` or `--key`, `--wallet <name>`, `--networks <base,arc,solana>`, `--replace`, `--force` | Restores a wallet from a prompt, never from argv |
267
- | `vapi passphrase` | `--wallet <name>` | Re-encrypts the keystore under a new passphrase |
268
- | `vapi unlock` | `--wallet <name>` | Puts that wallet's passphrase in the OS secret store |
269
- | `vapi lock` | `--wallet <name>`, `--all` | Takes a stored passphrase back out |
270
- | `vapi report "<what>"` | `--include-addresses`, `--send` | Writes a privacy-preserving local bug report |
271
- | `vapi auth set-key` | — | Types the registry API key on a prompt into the OS secret store |
272
- | `vapi auth status` | — | Whether this machine has a key and where it comes from, masked |
273
- | `vapi auth clear` | — | Takes the stored key back out |
274
- | `vapi publish <url>` | `--method`, `--mode <origin\|endpoint\|openapi>`, `--name <text>`, `--description <text>`, `--category <ai\|data\|crypto\|compute\|search>`, `--select <names>`, `--wallet <name>`, `--yes`, `--resume` | Probes your API, lists the endpoints you pick, signs the payout wallet |
275
- | `vapi publish activate <slug>` | — | Takes a listing live once its FeeSplitter is deployed |
276
- | `vapi publish verify-request <slug>` | — | Asks vAPI to review the listing |
277
- | `vapi publish list` | — | Every listing this API key owns |
278
- | `vapi claim <origin>` | `--wallet <name>` | Takes over the listings vAPI indexed from your API, signed by their payee |
279
- | `vapi mcp` | `--wallet <name>` | Serves the MCP tools over stdio |
280
- | `vapi serve` | — | Preview only; exits `2` with a message |
281
- | `vapi version` | — | The client version, also as `--version` or `-v` |
282
- | `vapi help` | — | The same help bare `vapi` shows, also as `--help` or `-h` |
283
-
284
- `vapi pay` also accepts `--max-price-usd` as a long-standing alias for `--max`;
285
- the two cannot be combined. When a paid call loses its response, `vapi pay` refuses to guess
286
- and names its receipt: `vapi pay --resume <receipt-id>` asks the token contract
287
- on that receipt's network, with EIP-3009 `authorizationState(authorizer,
288
- nonce)`, whether the signed authorization was used. **Settled** means the
289
- payment went through — do not pay again. **Expired** means it was never used
290
- and the chain is past its `validBefore`, so it never can be — paying again is
291
- safe. **Pending** means it is unused but still valid — wait until the time it
292
- prints. It unlocks no wallet and signs nothing. EVM only for now; a Solana
293
- receipt says so, and a receipt written before 0.4.0 does not record the nonce.
294
- Every payment payload carries the client code `vapi` in the x402 `builder-code`
295
- extension. When the API advertises `payment-identifier`, vAPI generates one id,
296
- sends it with the payment, records it as `paymentId` on the receipt, and shows
297
- it again in `vapi pay --resume`. `mcp --json` is accepted as a no-op, because
298
- the stdio transport is already JSON-RPC.
299
-
300
- ## Check your API
301
-
302
- `vapi check` is a free x402 conformance doctor for the API you are building. It
303
- asks the URL for its price without paying, grades the 402 the way a client reads
304
- it, and looks for the origin's discovery documents:
23
+ ## Quickstart
305
24
 
306
25
  ```bash
307
- vapi check https://weather.example/forecast
308
- vapi check https://weather.example/alerts --method POST --json
309
- ```
310
-
311
- | Rule | Passes when |
312
- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
313
- | `status` | the URL answers HTTP 402 |
314
- | `transport` | the offer is readable: a base64 `PAYMENT-REQUIRED` header, a JSON body, or both; or the 402 carries an MPP (`WWW-Authenticate: Payment`) challenge, which is recognised but not payable with `vapi pay` |
315
- | `version` | it declares `x402Version` 2 (1 is a warning: v2-only clients cannot pay it) |
316
- | `fields` | every field that version requires is present and well-typed |
317
- | `scheme` | at least one accepted option is `exact` |
318
- | `asset` | an exact option pays canonical USDC, with USDC's EIP-712 domain, on Base, Arc mainnet, Arc testnet or Solana |
319
- | `pay_to` | every exact option's `payTo` is a valid, non-zero address for its network |
320
- | `timeout` | `maxTimeoutSeconds` is a whole number between 10 and 3600 |
321
- | `extensions` | the offer advertises Bazaar metadata; every known advertised extension is listed |
322
- | `discovery` | `/.well-known/x402` serves a JSON document (a warning otherwise) |
323
- | `openapi` | a discovered OpenAPI document describes the operation with `x-payment-info` |
324
-
325
- The JSON report's `transport` field is `x402` or `mpp`; x402-only rules are
326
- skipped for an MPP 402.
327
-
328
- The `extensions` rule reports `bazaar`, `builder-code`, `payment-identifier`,
329
- `sign-in-with-x`, `offer-and-receipt` and `auth-hints` in that order. Missing
330
- Bazaar metadata is a `bazaar_metadata_missing` warning because adding it makes
331
- the API discoverable in Coinbase's Bazaar and by Coinbase for Agents. This
332
- local warning does not appear in the registry-shaped `conformance.issues`.
333
-
334
- For OpenAPI, the check tries `openapi.json` beside the checked path and then in
335
- each ancestor directory, nearest first, ending at the origin's `/openapi.json`.
336
- If none has a `paths` object, it reads `/.well-known/api-catalog` and follows up
337
- to 10 RFC 9264 `service-desc` links in order. It only follows same-origin links.
338
-
339
- Offer findings carry stable snake_case codes — `v2_missing_resource`,
340
- `offer_header_only`, `v2_header_malformed`, `scheme_unsupported` and the rest —
341
- the same codes the registry records for a listing and `vapi inspect` prints.
342
- `--json` returns the whole report, including the advertised `extensions` list
343
- and a `conformance` object in the registry's shape. The exit code is `0` when
344
- nothing failed, warnings included, `1` when a rule failed, and `2` for invalid
345
- usage. No wallet is opened, nothing is signed, and no registry is called: the
346
- only requests go to the origin being checked, through the same network guard as
347
- every other request.
348
-
349
- In CI, the repository is also a GitHub Action that runs the published CLI:
350
-
351
- ```yaml
352
- - uses: vAPI-Network/vapi-network@main
353
- with:
354
- url: https://weather.example/forecast
355
- fail-on: warn # or fail, the default
26
+ npm i -g vapi-network
27
+ vapi setup [--no-cloud-backup] # creates or restores the vault, derives main, links it to your owner wallet; safe to rerun
28
+ vapi fund # opens the hosted funding page for your address
29
+ vapi search "weather" # every catalogue, merged, with provenance
30
+ vapi pay <listing-ref> --max 0.02
31
+ vapi receipts # one line per paid call: quote, settlement, latency
356
32
  ```
357
33
 
358
- It prints every rule, annotates failures and warnings, exposes the JSON report
359
- as the `report` output, and fails the step on a failed rule — or on a warning
360
- too, with `fail-on: warn`.
361
-
362
- ## Publish an API
363
-
364
- Listing on vAPI is permissionless. vAPI probes the URL you hand it; if it
365
- answers x402, the listing exists, and you decide when it goes live.
366
-
367
- ```bash
368
- vapi auth set-key # paste the key from the console, once
369
- vapi publish https://weather.example # probe, pick endpoints, sign the payout wallet
370
- vapi publish activate weather-call # once the FeeSplitter is deployed
371
- vapi publish verify-request weather-call # ask for the review that ends the [unverified] tag
372
- vapi publish list
373
- ```
34
+ Back up the recovery phrase only in a terminal; vAPI cannot recover it.
35
+ Turn on encrypted cloud backup with `vapi backup --cloud`; only the owner can approve a restore.
374
36
 
375
- `vapi publish` takes an origin, a single endpoint, or an OpenAPI document, plus
376
- `--mode` when the registry should not have to guess which. It prints every
377
- probe step; on a refusal it prints the code, the reason and the hint, and exits
378
- `2` without signing anything. On a terminal it asks which endpoints to list — a
379
- script names them with `--select forecast,alerts`, or takes all of them with
380
- `--yes`, and then has to supply `--name`, `--description` and `--category`
381
- itself.
382
-
383
- A listing holds at most 20 endpoints, so a larger catalog is published as
384
- several listings of up to 20 — `Weather (1/4)`, `Weather (2/4)` and so on, in
385
- probe order — each with its own signature of the payout line, and every
386
- endpoint gets one result line: `listed` with its slug, `failed` with the
387
- reason, or `pending` when an earlier refusal stopped the run. A batch refused
388
- on its own merits does not stop the next one; a rejected key, a rate limit or
389
- an outage does. Run the same command again with `--resume` and it asks
390
- `vapi publish list` what this key already lists, skips those endpoints, and
391
- lists only the rest.
392
-
393
- Your wallet signs one line, `Confirm this wallet receives vAPI Call payouts`,
394
- so the registry knows where the money goes. It is an EIP-4361 message bound to
395
- the registry's own host and to Base: nothing is paid, nothing is approved, and
396
- no key leaves the machine.
397
-
398
- Payouts arrive through a FeeSplitter you own. Deploying it is a wallet
399
- transaction against the factory, so it stays in the console at
400
- `<registry>/providers`; `vapi publish` prints the address it will have on each
401
- network and the exact next step. An active listing answers
402
- `vapi search --include-unverified`, and `vapi publish verify-request <slug>`
403
- asks for the review that puts it in the default search.
404
-
405
- ### Claim a listing vAPI indexed
406
-
407
- vAPI mirrors public x402 catalogs, so your API may already be listed without
408
- you. If it is, you can own those listings instead of publishing new ones:
37
+ ## What you can do
409
38
 
410
- ```bash
411
- vapi claim https://weather.example --wallet payout # the wallet the listings pay
412
- ```
39
+ | Surface | What it does | Guide |
40
+ | ------- | ------------------------------------------------------------------- | ------------------------------------------------------------ |
41
+ | Call | Discover, check, publish and pay for x402 APIs. | [docs/call.md](./docs/call.md) |
42
+ | Router | Use vAPI Router for model access and balance. | [docs/router.md](./docs/router.md) |
43
+ | Agents | Run capped local agents with dedicated wallets and profiles. | [docs/agents.md](./docs/agents.md) |
44
+ | Swarms | Group capped local agents around a treasury and capital policy. | [docs/swarms.md](./docs/swarms.md) |
45
+ | MCP | Use namespaced payment tools from an MCP client. | [docs/mcp.md](./docs/mcp.md) |
46
+ | SDK | Use Call, vAPI Router and local agents behind one wallet-bound API. | [docs/sdk.md](./docs/sdk.md) |
47
+ | Vault | Manage the owner wallet, device vault, accounts and spend caps. | [docs/wallets.md](./docs/wallets.md) |
48
+ | Backup | Store encrypted vault copies and restore with owner approval. | [docs/backup-and-recovery.md](./docs/backup-and-recovery.md) |
413
49
 
414
- The registry sends an EIP-4361 message bound to its own host and to Base, with
415
- the statement `Claim the vAPI Call listings served from <origin>`. vapi checks
416
- that the message says exactly that for this wallet before it signs anything,
417
- signs it the same way `vapi publish` signs its payout line, and the registry
418
- matches the signer against the listings' `payTo`. Every unowned indexed listing
419
- served from that origin that pays this wallet becomes yours; they stay paid
420
- directly to it with no vAPI fee, `vapi publish list` shows them, and `vapi
421
- publish verify-request <slug>` asks for review. A wallet that is not the payee,
422
- an origin with nothing to claim, and listings that already have an owner each
423
- get their own sentence and exit `1`. Like publishing, claiming needs `vapi auth
424
- set-key` and has no MCP tool.
425
-
426
- The API key is a secret like any other here. `vapi auth set-key` reads it from
427
- a prompt, never from an argument, and keeps it in the same OS secret store as
428
- your passphrase — or in `~/.vapi/config.json` at mode 0600 on a platform that
429
- has none. `VAPI_API_KEY` is the route for CI. No agent can reach it: there is
430
- no publish tool on the MCP server, and the key lives behind its own package
431
- entry point that `packages/mcp` is forbidden to import.
432
-
433
- ## MCP
434
-
435
- Add this to Claude Code, Claude Desktop or Cursor:
436
-
437
- ```json
438
- {
439
- "mcpServers": {
440
- "vapi": {
441
- "command": "npx",
442
- "args": ["-y", "vapi-network", "mcp"]
443
- }
444
- }
445
- }
446
- ```
50
+ Wallets and custody are in [docs/wallets.md](./docs/wallets.md), and account transfers are in [docs/sending.md](./docs/sending.md). Configuration, funding, networks and bug reports are in [docs/configuration.md](./docs/configuration.md).
447
51
 
448
- Then hand the passphrase to your operating system once, in your own terminal:
52
+ The MCP server registers `vapi.status`, `vapi.accounts`, `vapi.siblings`, `accounts.add`, `accounts.caps`, `accounts.send`, `auth.link`, `auth.status`, `router.models`, `router.usage`, `router.chat`, `router.buy`, `call.search`, `call.inspect`, `call.pay`, `call.read`, `swarm.setup`, `swarm.add`, `swarm.leave`, `swarm.fund`, `swarm.rebalance`, `swarm.status`, `swarm.dissolve`, `wallet.address`, `wallet.balance`, `wallet.accounts`, `wallet.list`, `wallet.use`, `wallet.fund`, `receipts.list`, `receipts.stats`, `support.report`, `swarm.run`, `swarm.allocate`, `swarm.delegate`, `swarm.runs`; inputs and results are in [docs/mcp.md](./docs/mcp.md).
449
53
 
450
- ```bash
451
- vapi unlock # the passphrase goes into the macOS Keychain or libsecret
452
- ```
54
+ ### Swarms
453
55
 
454
- The passphrase never leaves the machine and never has to appear in an editor's
455
- configuration file. `vapi lock` takes it back out. On Windows, until there is a
456
- Credential Manager path, keep using
457
- `"env": { "VAPI_KEYSTORE_PASSWORD": "your-passphrase" }` instead.
56
+ Swarms keep a treasury and capped member accounts on this machine. Setup is safe to rerun; the owner approves account links and funds the treasury.
57
+ A deposit arriving at the treasury after dissolve stays on the treasury account, which is kept on this device.
458
58
 
459
- Give an agent its own capped wallet by creating it yourself and pinning the
460
- agent to it:
59
+ - `swarm.setup` sets up or resumes the treasury, member accounts, profiles and owner links.
60
+ - `swarm.add` adds or resumes one member.
61
+ - `swarm.leave` sweeps one member to the treasury and removes it from the swarm.
62
+ - `swarm.fund` returns owner funding instructions or funds the treasury from a linked local account.
63
+ - `swarm.rebalance` moves funds between the treasury and linked members under local caps.
64
+ - `swarm.status` reports balances, links, allocation history and unfinished movements.
65
+ - `swarm.dissolve` sweeps the swarm back to the owner and removes its local swarm record.
66
+ - `swarm.run` runs the lead, which may delegate one level deep using treasury-funded budgets bounded by a per-run draw (default $2.00), or runs every member independently on its own capital.
67
+ - `swarm.run` accepts `detach: true` to start in the background, and `swarm.runs` lists a swarm's runs with status.
68
+ - `swarm.allocate` and `swarm.delegate` are agent-only operations and are refused outside a swarm run; their optional `requestId` input makes retries idempotent.
461
69
 
462
- ```bash
463
- vapi wallet create agent-claude --label "claude code"
464
- vapi wallet caps agent-claude --per-day 5
465
- vapi unlock --wallet agent-claude
466
- ```
70
+ MCP always declines approval prompts during swarm runs.
467
71
 
468
- ```json
469
- {
470
- "mcpServers": {
471
- "vapi": {
472
- "command": "npx",
473
- "args": ["-y", "vapi-network", "mcp", "--wallet", "agent-claude"],
474
- "env": {
475
- "VAPI_WALLET": "agent-claude",
476
- "VAPI_NO_SECRETS": "1"
477
- }
478
- }
479
- }
480
- }
481
- ```
72
+ CLI commands:
482
73
 
483
- The agent pays from `agent-claude` and no more than $5 a day, whatever it asks
484
- for; your own wallet is not reachable from that session, because only
485
- `agent-claude` was unlocked. `vapi wallet list` shows which wallets are unlocked
486
- that way.
487
-
488
- ### Tools
489
-
490
- | Tool | Input | Result |
491
- | ----------------- | --------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
492
- | `auth.link` | `label` | Starts linking this wallet to a person's vAPI account for browser approval with default permissions only; returns the code and URL |
493
- | `auth.status` | `wallet` | Link status, owner, label, permissions, Router-key presence, and any pending browser approval |
494
- | `router.models` | — | Model ids available from vAPI Router |
495
- | `router.usage` | `wallet` | Router usage plus the linked owner's stake and stake-funded Compute |
496
- | `router.chat` | `model`, `messages[]`, `max_tokens`, `wallet` | Completion `content`, resolved `model`, and token `usage`; the Router key stays in the OS secret store and is never returned |
497
- | `router.buy` | `usd` (`1`, `5`, `20`, or `50`), `wallet` | Receipt summary and the new vAPI Router balance; the Router key stays in the OS secret store and is never returned |
498
- | `call.search` | `query`, `kinds[]`, `network`, `limit`, `cursor`, `includeUnverified` | One discovery page: `items` with `group`, `fee` and `verification`, plus `nextCursor`, `unavailableKinds`, `rankingVersion` |
499
- | `call.inspect` | `id`, `endpoint` | A listing's `verification`, `fee`, `liveness`, `conformance`, identity, request contract and live quote |
500
- | `call.pay` | `wallet`, `id` or `url`, `method`, `endpoint`, `body`, `contentType`, `network`, `expectedPayTo`, `maxPriceUsd` | `wallet`, `status`, `body`, `payment`, `verification` for a registry listing, and `expectedRequest` when a 402 named one |
501
- | `wallet.address` | `wallet` | `wallet`, `address` |
502
- | `wallet.balance` | `wallet` | `wallet`, `address`, `balances[]` per configured network |
503
- | `wallet.accounts` | `wallet` | `wallet`, `accounts[]` with USDC, gas balance and deposit guidance |
504
- | `wallet.list` | — | `wallet`, `default`, and every wallet with caps in atomic USDC and dollars, balances, and `balanceError` when an RPC is unreachable |
505
- | `wallet.use` | `name` | `wallet`, `active`, `previous`, `scope: "session"` |
506
- | `wallet.fund` | `wallet`, `amountUsd` | `wallet`, `address`, `network`, `url`, `instructions` |
507
- | `receipts.list` | `wallet`, `allWallets`, `limit` | `wallet`, `receipts[]` |
508
- | `receipts.stats` | `wallet`, `allWallets`, `range` | `wallet`, `range`, `generatedAt`, `totals`, `outcomes`, `latency`, `topServices`, `search` |
509
- | `support.report` | `message`, `includeAddresses`, `send` | `path`, `issueUrl`, the report itself, and `responseCode` when sent |
510
-
511
- `wallet` is optional on every tool that takes it: without it the session's
512
- active wallet is used, then `VAPI_WALLET`, then the machine default. Every
513
- result names the wallet it used. `call.pay` applies that wallet's own spend caps
514
- before it signs and tags the receipt with its name. When a paid call's outcome
515
- is uncertain, `call.pay` fails with `settlement_unknown`, says not to retry
516
- automatically, and names the `vapi pay --resume <receipt-id>` that settles the
517
- question on-chain. `wallet.use` moves the
518
- session onto another wallet **for this process only** — it never rewrites
519
- `wallets.json`, so your own terminal keeps the default you chose — and appends a
520
- `wallet.use.session` line to the audit log. Reads need no passphrase at all.
521
-
522
- Spend caps default to $0.10 per call and $1.00 per day.
523
-
524
- `call.search` returns vAPI-verified listings plus mirrored external catalogs;
525
- `includeUnverified: true` adds unverified self-listed APIs, which passed vAPI's
526
- automated x402 probe but were not reviewed. Every result of `call.search`,
527
- `call.inspect` and `call.pay` carries `verification`, one of `"none"`,
528
- `"requested"` or `"verified"` — a mirrored external row is always `"none"`.
529
- Prefer a verified listing, and read the request contract and the price with
530
- `call.inspect` before paying one that is not.
74
+ - `vapi swarm create <name>` creates or resumes a local swarm and can fund it after linking.
75
+ - `vapi swarm add <name> <role>` adds or resumes one member.
76
+ - `vapi swarm remove <name> <member>` sweeps one member to the treasury and removes it.
77
+ - `vapi swarm fund <name> <usd>` prints owner funding instructions or funds from a local account.
78
+ - `vapi swarm rebalance <name>` moves capital toward the swarm's configured targets.
79
+ - `vapi swarm status <name>` reports balances, links, allocation history and unfinished movements.
80
+ - `vapi swarm dissolve <name>` sweeps the swarm to the owner and removes its swarm record.
81
+ - `vapi swarm run <name> "<task>"` runs the lead or every eligible member with per-run budget and treasury-draw limits.
82
+ - `vapi swarm run <name> "<task>" --detach [--runtime local]` starts the run in the background.
83
+ - `vapi swarm runs <name>` lists background runs and their status.
84
+ - `vapi swarm stop <name> [<runId>|--all] [--confirm-worker-stopped]` stops one or all running local processes for the swarm. The confirmation flag clears one stale start only after you verify its worker is gone.
85
+ - `vapi agent run <name> "<task>" --detach` starts one agent run in the background.
531
86
 
532
87
  #### Deprecated tool aliases
533
88
 
534
- These four pre-namespace names still work and still behave identically, but each
535
- result carries one `DEPRECATED:` line naming its replacement. They will be
536
- removed in a later release.
89
+ These pre-namespace names still work and each result carries a DEPRECATED: line naming its replacement.
537
90
 
538
91
  | Alias | Use instead |
539
92
  | --------- | ---------------- |
@@ -542,283 +95,99 @@ removed in a later release.
542
95
  | `call` | `call.pay` |
543
96
  | `wallet` | `wallet.balance` |
544
97
 
545
- #### What the MCP server cannot do
546
-
547
- Create, rename, remove, restore, back up, import or export a wallet, or return a
548
- recovery phrase, a private key or a passphrase. Those stay in the CLI, in front
549
- of a person.
550
-
551
- ## SDK
552
-
553
- ### `createVapiClient`
554
-
555
- Install the bundled client when you want Call, vAPI Router and local agents
556
- behind one wallet-bound API:
557
-
558
- ```bash
559
- npm i vapi-network
560
- ```
561
-
562
- ```ts
563
- import { createVapiClient } from "vapi-network";
564
-
565
- const vapi = await createVapiClient({ wallet: "researcher" });
566
- const reply = await vapi.router.chat({
567
- model: "openai/gpt-5-mini",
568
- messages: [{ role: "user", content: "Summarise Base DEX activity." }],
569
- });
570
- console.log(reply.content);
571
-
572
- const listings = await vapi.call.search("Base DEX volume");
573
- console.log(listings);
574
- const result = await vapi.call.pay({ id: "base-dex-volume", maxPriceUsd: 0.05 });
575
- console.log(result.body);
576
-
577
- const purchase = await vapi.router.buy(5);
578
- console.log(purchase.balance);
579
- ```
580
-
581
- `await vapi.router.openai()` returns the vAPI Router base URL and key for an
582
- OpenAI-compatible framework. Use this in your own code. Do not pass it into a
583
- model prompt.
584
-
585
- Bought vAPI Router balance never expires and is used after the daily Compute
586
- allowance runs out. Your wallet's client spend caps apply to every purchase,
587
- including automatic refill.
588
-
589
- ### Lower-level packages
590
-
591
- ```bash
592
- npm i @vapi-network/core @vapi-network/sources
593
- ```
594
-
595
- `@vapi-network/core` is the main entry point: the x402 protocol, the wallet
596
- store, spend policy, the network guard, discovery merge and the receipt ledger.
597
- `@vapi-network/core/secrets` is a second, deliberately separate entry point for
598
- the four functions that return a recovery phrase or a private key —
599
- `exportRecoveryPhrase`, `exportKeystoreKeys`, `createKeystoreWithPhrase` and
600
- `decryptPrivateKey`. They are not re-exported from the main index, and the MCP
601
- package is forbidden by lint to import them, so a surface an agent drives cannot
602
- reach a secret by accident.
603
-
604
- Search and pay:
605
-
606
- ```ts
607
- import {
608
- LocalWallet,
609
- SpendPolicy,
610
- WalletStore,
611
- getVapiPaths,
612
- loadConfig,
613
- resolvePassphrase,
614
- spendCapsForWallet,
615
- } from "@vapi-network/core";
616
- import { vapiRegistrySource } from "@vapi-network/sources";
617
-
618
- const paths = getVapiPaths();
619
- const config = await loadConfig(paths.config);
620
- const [listing] = await vapiRegistrySource(config.marketplaceDiscoveryUrl, {
621
- discoveryUrl: config.discoveryUrl,
622
- }).search("weather");
623
-
624
- const store = await WalletStore.open(paths.directory);
625
- const { name } = store.resolve();
626
- const account = await store.unlock(name, (await resolvePassphrase(name)).passphrase);
627
- const wallet = new LocalWallet(
628
- account,
629
- new SpendPolicy(await spendCapsForWallet(store, name), {
630
- ledgerPath: paths.ledger,
631
- wallet: name,
632
- }),
633
- );
634
- ```
635
-
636
- Manage wallets:
637
-
638
- ```ts
639
- import { WalletStore, getVapiPaths, usdToAtomic } from "@vapi-network/core";
640
-
641
- const store = await WalletStore.open(getVapiPaths().directory);
642
- for (const wallet of await store.list()) {
643
- console.log(wallet.name, wallet.address, wallet.isDefault, wallet.spendCaps);
644
- }
645
- await store.setSpendCaps("agent", {
646
- perCallAtomic: String(usdToAtomic(0.05)),
647
- perDayAtomic: String(usdToAtomic(1)),
648
- });
649
- ```
650
-
651
- `WalletStore` is the one entry point for the layout: `open`, `list`, `resolve`,
652
- `create`, `importKey`, `unlock`, `setDefault`, `rename`, `setLabel`,
653
- `setSpendCaps`, `remove`, `restore` and `listTrash`. It never rewrites key
654
- material; it moves, names and caps keystores.
655
-
656
- Two runnable examples live in [`examples/`](./examples):
657
- [`pay-with-sdk.ts`](./examples/pay-with-sdk.ts) (`pnpm example:pay -- weather`)
658
- and [`wallets.ts`](./examples/wallets.ts) (`pnpm example:wallets -- agent-demo`).
659
-
660
- ## Configuration
661
-
662
- Local state lives in `~/.vapi/`:
663
-
664
- ```text
665
- config.json registry URLs, networks and RPC endpoints
666
- wallets.json which wallet is the default, plus per-wallet caps and labels
667
- wallets/
668
- main.json one encrypted keystore per wallet, mode 0600
669
- .trash/ removed wallets, kept encrypted, never deleted for you
670
- keystore.json a 0600 symlink to wallets/main.json, for one release
671
- audit.log one JSON line per secret export or wallet change
672
- receipts.jsonl the append-only call ledger
673
- searches.jsonl one line per discovery query
674
- spend-ledger.json today's total, per wallet
675
- reports/ what vapi report writes
676
- ```
677
-
678
- | Variable | What it does |
679
- | ------------------------ | --------------------------------------------------------------------------- |
680
- | `VAPI_HOME` | Use a different directory instead of `~/.vapi` |
681
- | `VAPI_WALLET` | The wallet to use when no `--wallet` is given |
682
- | `VAPI_REGISTRY_URL` | Replace the registry base; the canonical discovery paths derive from it |
683
- | `VAPI_KEYSTORE_PASSWORD` | The passphrase, for CI and for Windows. Checked before the OS secret store. |
684
- | `VAPI_API_KEY` | The registry key `vapi publish` authenticates with, for CI |
685
- | `VAPI_NO_SECRETS` | Set to `1` to stop `vapi backup` and `vapi export-key` printing anything |
686
-
687
- `ARC_RPC_URL` overrides the Arc mainnet RPC. `ARC_TESTNET_RPC_URL` and
688
- `SOLANA_RPC_URL` point those two networks at an endpoint you trust. On first
689
- use of the default home, the client copies an existing `~/.vapi/agent-cash/`
690
- configuration into `~/.vapi/` when it can do so without overwriting files,
691
- prints a notice, and leaves the old directory alone.
692
-
693
- ## Funding
694
-
695
- ```bash
696
- vapi fund # open the funding page for your address
697
- vapi fund --amount 25 # prefill a US dollar amount
698
- vapi fund --json # { address, network, url }
699
- ```
700
-
701
- `vapi fund` prints `<registry>/fund/<your-address>` and opens it in your default
702
- browser when you are on a terminal. The page offers three routes: a card via
703
- Coinbase (needs a Coinbase account; US guest checkout), a transfer from
704
- MetaMask, Coinbase Wallet or WalletConnect, or a bridge from another chain. It
705
- is public, takes no sign-in, and mints the card session when you click — so the
706
- link keeps working while you log in, and nothing expires in your scrollback.
707
-
708
- The command itself makes **no network call**: it works offline, and it always
709
- also prints
710
-
711
- ```text
712
- Send USDC on Base (eip155:8453) to this address; add a little ETH for gas if you plan to sweep.
713
- ```
714
-
715
- Whichever route you pick, the USDC lands on your local address on Base. **vAPI
716
- never holds your funds**, never proxies the payment, and never sees your card
717
- details or your private key. MCP clients use `wallet.fund`, which returns the
718
- same `{ address, network, url }` plus a line telling the agent to hand the link
719
- to its human.
720
-
721
- ## Networks and accounts
722
-
723
- | Network | x402 identifier | USDC | Gas / RPC notes |
724
- | -------------- | ----------------------------------------------------- | ---------------------------------------------- | -------------------------------------------------------------------- |
725
- | Base mainnet | `eip155:8453` | `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913` | ETH; defaults to `https://mainnet.base.org` |
726
- | Arc mainnet | `eip155:5042` | `0x3600000000000000000000000000000000000000` | USDC is also the gas token; defaults to `https://rpc.mainnet.arc.io` |
727
- | Arc testnet | `eip155:5042002` | `0x3600000000000000000000000000000000000000` | USDC is also the gas token; set `ARC_TESTNET_RPC_URL` |
728
- | Solana mainnet | `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d` | `EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v` | SOL; defaults to `https://api.mainnet-beta.solana.com` |
729
-
730
- The x402 reference packages shorten the Solana CAIP-2 reference to
731
- `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp`; vAPI accepts that identifier as an
732
- alias while persisting the full genesis hash above. Enable Arc mainnet with
733
- `vapi init --networks base,arc` (or the same `--networks` value on `vapi wallet
734
- create` or `vapi import`), `vapi accounts --enable arc`, or `ARC_RPC_URL`. Its
735
- explorer is `https://explorer.arc.io`.
736
-
737
- `vapi accounts` lists one deposit account per configured network: its CAIP-2 ID,
738
- network name, address, atomic and formatted USDC balance, gas-token balance, and
739
- deposit guidance. Account lookup dispatches by CAIP namespace, so the EVM and
740
- Solana adapters stay independent of one another. For Arc testnet, add the faucet
741
- to that network's `config.json` entry:
742
-
743
- ```json
744
- {
745
- "depositUrl": "https://your-arc-faucet.example",
746
- "depositInstructions": "Use the configured Arc testnet faucet, then send USDC to this address."
747
- }
748
- ```
749
-
750
- Arc mainnet uses the default public RPC or `ARC_RPC_URL` and needs no faucet
751
- configuration.
752
-
753
- Create both local accounts at initialization with `vapi init --networks
754
- base,solana`, or add an Ed25519 account to an existing keystore with `vapi
755
- accounts --enable solana`. Fund the printed Solana address with SPL USDC. Exact
756
- x402 payments use the facilitator advertised in the challenge as fee payer, so
757
- they do not consume the local SOL balance; `vapi sweep` is a separate
758
- transaction and does need a little SOL. The default public Solana RPC is
759
- rate-limited and has no availability guarantee; set `SOLANA_RPC_URL` to a
760
- dedicated endpoint for regular use.
761
-
762
- ## Discovery sources
763
-
764
- Discovery is a plugin interface. The client merges listings from several
765
- sources, de-duplicates them by normalized resource URL, and keeps each listing's
766
- provenance:
767
-
768
- - **vAPI Registry**, enabled by the default distribution, using
769
- `https://api.vapinetwork.ai/api/call/discovery` and
770
- `https://api.vapinetwork.ai/api/call/services`. If the primary returns HTTP
771
- 404 or cannot be resolved, the client logs one notice and tries the hosts in
772
- `registryFallbacks` on the same canonical paths. The historical
773
- `/api/marketplace/discovery` and `/api/network/services` paths are deprecated;
774
- a base URL supplied on either is normalized to the canonical pair.
775
- - **Coinbase Bazaar**, the public x402 v2 `/discovery/resources` catalogue
776
- exposed by a facilitator.
777
- - **Local file**, a JSON array of listings for private or development
778
- catalogues.
779
- - **x402scan**, a deliberate stub until x402scan documents a stable public read
780
- API this client can safely target.
781
-
782
- Use `@vapi-network/sources` to compose only the catalogues you trust. Every
783
- outbound request is guarded against local and private destinations before it is
784
- made, and redirects and resolved IP addresses are re-validated as new
785
- destinations.
786
-
787
- ## Sign-in with X
788
-
789
- x402 v2 services can require Sign-In-With-X (SIWX) before returning a price.
790
- When `vapi pay` or `call.pay` receives that challenge, vAPI checks that both the
791
- challenge domain and URI match the final resource origin, signs the canonical
792
- EIP-4361 message locally with EVM `personal_sign`, and retries once with
793
- `SIGN-IN-WITH-X`. The proof is never sent to a redirect or a different host.
794
-
795
- If the retry returns a normal 402 quote, the usual spend-policy and payment flow
796
- continues. If the resource is free after sign-in, the result has
797
- `outcome: "signed_in"` and the local receipt records `amountAtomic: "0"`.
798
-
799
- ## Metrics and bug reports
800
-
801
- vAPI measures call and discovery health locally and uploads nothing. Receipts
802
- can include the listing name and provider host, policy decision, retry count,
803
- client version, outcome, total latency, and discovery, quote, signing, request
804
- and settlement phase timings. Policy declines are recorded with the quoted
805
- amount but without a payer or transaction, so blocked spend stays visible
806
- without creating a payment authorization. Search events record the query,
807
- sources tried, per-source latency and result count, merged result count and
808
- timestamp.
809
-
810
- ```sh
811
- vapi stats --range 7d
812
- vapi receipts export --format csv --range 30d
813
- ```
98
+ ## CLI reference
814
99
 
815
- When the registry reports it, `vapi stats` also shows the network-wide amount routed through vAPI for 24h and 30d in USD plus the 30d transaction count. This covers all vAPI clients, not just this wallet.
100
+ Every command accepts `--json`, which writes one JSON value, success or error,
101
+ to stdout. Exit codes are `0` for success, `1` for an operational failure, and
102
+ `2` for invalid usage or an announced preview-only command.
816
103
 
817
- `vapi report "<what happened>"` writes `$VAPI_HOME/reports/<timestamp>.json` and
818
- prints that path plus a prefilled GitHub issue URL. Reports contain the message,
819
- client version, OS and Node information, and only the newest five receipt IDs.
820
- Wallet and payee addresses are included only with `--include-addresses`; amounts
821
- never are. Nothing is uploaded unless `--send` is explicit.
104
+ Every wallet command takes `--account <name>`, falls back to `VAPI_WALLET`, then the default from `vapi accounts use`; `--wallet <name>` keeps working for one release.
105
+
106
+ | Command | Options | What it does |
107
+ | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
108
+ | `vapi init` | `--networks <base,arc,solana>` | Creates `~/.vapi`, the wallet `main` and the config. Says so if one exists. |
109
+ | `vapi setup` | `--no-cloud-backup`, `--json` | Creates or restores the vault, links the first account, and can offer cloud backup. Safe to rerun. |
110
+ | `vapi accounts` | `--all`, `--json` | Lists local accounts and can add the owner's accounts on other devices as read-only rows |
111
+ | `vapi accounts add <name>` | `--label <text>`, `--no-link`, `--json` | Derives and links a new account |
112
+ | `vapi accounts import <name>` | `--keystore <path>` or `--key-file <path>`, `--label <text>`, `--json` | Imports an account from a private-key prompt or local keystore |
113
+ | `vapi accounts rename <old> <new>` | `--json` | Renames an account and its local records |
114
+ | `vapi accounts use <name>` | `--json` | Sets the default account |
115
+ | `vapi accounts remove <name>` | `--force`, `--json` | Moves an account to `wallets/.trash/` |
116
+ | `vapi accounts restore <name>` | `--json` | Restores an account from `wallets/.trash/` |
117
+ | `vapi accounts caps <name>` | `--per-call <usd>`, `--per-day <usd>`, `--ceiling <usd\|off>`, `--json` | Sets the account's spend caps and automatic Base USDC ceiling |
118
+ | `vapi accounts distribute <amount>` | `--from <account>`, `--to <a,b,c>`, `--network <base\|arc>`, `--json` | Splits USDC across linked local accounts and records resumable legs |
119
+ | `vapi accounts distribute --resume <id>` | `--replace-expired-restored`, `--bind-legacy-addresses`, `--json` | Continues an unfinished distribution; unsafe restored or legacy address replacement requires its terminal-only review flag |
120
+ | `vapi accounts distribute --cancel <id>` | `--replace-expired-restored`, `--json` | Cancels eligible legs without signing; restored legs require terminal-only review and signed legs require proven expiry |
121
+ | `vapi swarm create <name>` | `--agents`/`--roles`, `--fund`/`--from`, `--strategy`/`--targets`, `--caps`/`--treasury-caps`, `--network`, `--model`, `--no-wait`, `--json` | Creates or resumes a treasury, member accounts, profiles and owner links |
122
+ | `vapi swarm add <name> <role>` | `--json` | Adds or resumes one member |
123
+ | `vapi swarm remove <name> <member>` | `--json` | Sweeps a member to the treasury and removes it from the swarm |
124
+ | `vapi swarm fund <name> <usd>` | `--from <account>`, `--json` | Prints owner funding instructions or funds the treasury from a local account |
125
+ | `vapi swarm rebalance <name>` | `--targets <role=usd,...>`, `--json` | Moves funds between the treasury and linked members under local caps |
126
+ | `vapi swarm status <name>` | `--json` | Reports balances, links, allocation history and unfinished movements |
127
+ | `vapi swarm dissolve <name>` | `--json` | Sweeps the swarm back to the owner and removes its local swarm record |
128
+ | `vapi send <amount>` | `--from <account>`, `--to <account\|owner\|0x…>`, `--network <base\|arc>`, `--resume <nonce>`, `--json` | Sends USDC to the owner or another active account; vAPI pays gas |
129
+ | `vapi wallet list` | - | Name, address, default marker, caps in USD, unlocked, label |
130
+ | `vapi wallet create <name>` | `--networks <base,arc,solana>`, `--label <text>` | A new wallet, with its own phrase, caps and passphrase |
131
+ | `vapi wallet use <name>` | - | Makes it the default for every later command |
132
+ | `vapi wallet rename <old> <new>` | - | Renames the keystore, the registry entry and that wallet's receipts |
133
+ | `vapi wallet remove <name>` | `--force` | Moves the keystore to `wallets/.trash/`; asks you to type the name |
134
+ | `vapi wallet restore <name>` | - | Brings a removed wallet back, same passphrase |
135
+ | `vapi wallet caps <name>` | `--per-call <usd>`, `--per-day <usd>` | Sets that wallet's spend caps, in US dollars |
136
+ | `vapi fund` | `--amount <usd>`, `--wallet <name>` | Prints and opens the hosted funding page. Makes no network call. |
137
+ | `vapi accounts` | `--enable <solana\|arc>`, `--wallet <name>` | One deposit account per configured network, with balances and guidance |
138
+ | `vapi search [query]` | `--kind <kind>` (repeatable), `--network <caip2>`, `--limit <n>`, `--cursor <cursor>`, `--include-unverified` | Merged discovery across every configured source, tagged by group and tier |
139
+ | `vapi inspect <id>` | `--endpoint <name>` | Verification, fee, liveness, conformance, identity, contract and live quote, for free |
140
+ | `vapi pay <id-or-url>` | `--method`, `--endpoint`, `--body <json>`, `--content-type`, `--network <caip2>`, `--expected-pay-to`, `--max <usd>`, `--wallet <name>` | Calls the API and pays it from the local wallet, naming an unverified tier |
141
+ | `vapi pay --resume <receipt-id>` | - | Checks settlement, shows its payment id, and never pays |
142
+ | `vapi check <url>` | `--method <method>` | Grades its 402, extensions and same-origin discovery. Never pays |
143
+ | `vapi balance` | `--wallet <name>` | The wallet's address and USDC balances |
144
+ | `vapi receipts` | `--limit <n>`, `--wallet <name>`, `--all-wallets` | The local append-only call ledger, newest last |
145
+ | `vapi receipts export` | `--format <json\|csv>`, `--range <24h\|7d\|30d>`, `--wallet <name>`, `--all-wallets` | Raw receipts for a spreadsheet or dashboard |
146
+ | `vapi stats` | `--range <24h\|7d\|30d>`, `--wallet <name>`, `--all-wallets` | Spend, outcomes, latency percentiles and top services |
147
+ | `vapi sweep [<address>]` | `--network <caip2>`, `--wallet <name>` | Moves USDC to an address, or to the linked owner when omitted; open movement legs block it |
148
+ | `vapi agent create <name>` | `--model <id>`, `--instructions <file>`, `--call-budget <usd>`, `--max-per-call <usd>`, `--router-budget <usd>`, `--approve-above <usd>`, `--include-unverified`, `--max-steps <n>` | Creates a capped local agent wallet, profile and owner link |
149
+ | `vapi agent run <name> "<task>"` | `--budget <usd>` | Runs the named agent on this machine with an optional hard budget across Call and Router top-ups |
150
+ | `vapi agent list` | None | Lists profiles, links and today's Call and Router budgets |
151
+ | `vapi agent pause <name>` | None | Stops future runs until the agent is resumed |
152
+ | `vapi agent resume <name>` | None | Allows a paused agent to run again |
153
+ | `vapi agent revoke <name>` | None | Revokes the link and removes the profile, but keeps its wallet |
154
+ | `vapi login` | `--wallet <name>`, `--label <name>`, `--publish`, `--no-browser` | Links the local agent wallet to your vAPI account |
155
+ | `vapi logout` | `--wallet <name>` | Removes the selected wallet's agent link and stored credentials |
156
+ | `vapi whoami` | `--wallet <name>` | Shows the chosen wallet's owner link and permissions, whether the link is live, and its ERC-8004 agent identity. |
157
+ | `vapi router models` | `--wallet <name>` | Lists the vAPI Router model ids |
158
+ | `vapi router usage` | `--wallet <name>` | Shows the agent's Compute allowance and Router balance |
159
+ | `vapi router chat --model <id> "<prompt>"` | `--system <text>`, `--max-tokens <n>`, `--wallet <name>` | Sends one chat request through vAPI Router |
160
+ | `vapi router key` | `--rotate`, `--wallet <name>` | Prints a gated Router key or rotates it without printing it |
161
+ | `vapi router buy <1\|5\|20\|50>` | `--wallet <name>`, `--json` | Buys vAPI Router balance with USDC from your wallet |
162
+ | `vapi router buy --auto <tier> --below <usd>` | `--wallet <name>`, or use `--auto off` | Sets or clears automatic vAPI Router balance refill |
163
+ | `vapi stake status` | `--wallet <name>` | Shows the linked owner's stake and Compute today |
164
+ | `vapi stake open` | `--wallet <name>`, `--no-browser` | Prints and optionally opens the staking page |
165
+ | `vapi export-key` | `--network <caip2>`, `--wallet <name>` | Prints the private key. Terminal only, never for an agent. |
166
+ | `vapi backup` | `--account <name>`, `--cloud [off]`, `--json` | Prints the 12 words, or turns encrypted cloud backup on or off. |
167
+ | `vapi restore` | `--from-owner [--owner <0x…>]`, `--json` | Rebuilds the vault from a recovery phrase typed at the prompt or piped on stdin, or restores an owner-approved cloud backup. |
168
+ | `vapi import` | `--phrase` or `--key`, `--wallet <name>`, `--networks <base,arc,solana>`, `--replace`, `--force` | Restores a wallet from a prompt, never from argv |
169
+ | `vapi passphrase` | `--wallet <name>` | Re-encrypts the keystore under a new passphrase |
170
+ | `vapi vault protect` | `--json` | Adds a password to the device vault |
171
+ | `vapi vault unprotect` | `--json` | Removes the password from the device vault |
172
+ | `vapi vault lock` | `--json` | Closes the protected vault on this device |
173
+ | `vapi vault unlock` | `--json` | Opens the protected vault for 8 hours, or set `VAPI_VAULT_PASSWORD` |
174
+ | `vapi vault status` | `--json` | Shows whether the device vault is protected and open |
175
+ | `vapi unlock` | `--wallet <name>` | Puts that wallet's passphrase in the OS secret store |
176
+ | `vapi lock` | `--wallet <name>`, `--all` | Takes a stored passphrase back out |
177
+ | `vapi report "<what>"` | `--include-addresses`, `--send` | Writes a privacy-preserving local bug report |
178
+ | `vapi auth set-key` | - | Types the registry API key on a prompt into the OS secret store |
179
+ | `vapi auth status` | - | Whether this machine has a key and where it comes from, masked |
180
+ | `vapi auth clear` | - | Takes the stored key back out |
181
+ | `vapi publish <url>` | `--method`, `--mode <origin\|endpoint\|openapi>`, `--name <text>`, `--description <text>`, `--category <ai\|data\|crypto\|compute\|search>`, `--select <names>`, `--wallet <name>`, `--yes`, `--resume` | Probes your API, lists the endpoints you pick, signs the payout wallet |
182
+ | `vapi publish activate <slug>` | - | Takes a listing live once its FeeSplitter is deployed |
183
+ | `vapi publish verify-request <slug>` | - | Asks vAPI to review the listing |
184
+ | `vapi publish list` | - | Every listing this API key owns |
185
+ | `vapi claim <origin>` | `--wallet <name>` | Takes over the listings vAPI indexed from your API, signed by their payee |
186
+ | `vapi mcp` | `--wallet <name>` | Serves the MCP tools over stdio |
187
+ | `vapi mcp install <claude\|cursor\|codex>` | `--home <dir>`, `--registry <url>` | Writes that app's MCP config and prints the file |
188
+ | `vapi serve` | - | Preview only; exits `2` with a message |
189
+ | `vapi version` | - | The client version, also as `--version` or `-v` |
190
+ | `vapi help` | - | The same help bare `vapi` shows, also as `--help` or `-h` |
822
191
 
823
192
  ## Packages
824
193
 
@@ -833,17 +202,6 @@ never are. Nothing is uploaded unless `--send` is explicit.
833
202
  Every npm tarball is bundled and has zero runtime dependencies. The scoped
834
203
  packages are useful for embedding; most users should start with `vapi-network`.
835
204
 
836
- ## Roadmap
837
-
838
- - A local gateway daemon (`vapi serve`) with per-key budgets
839
- - OpenTelemetry traces and metrics, with exporters enabled only by the user
840
- - `task.*` tools for posting, funding, delivering and reviewing work
841
- - `compute.*` tools for discovering models and paying for inference
842
-
843
- Until the gateway lands, `vapi serve` and the provider-side `vapi publish` exit
844
- with a preview message. Payments stay direct from the local wallet to each
845
- service.
846
-
847
205
  ## Development
848
206
 
849
207
  A pnpm workspace for Node.js 22 and pnpm 10. The gate, in order: