vapi-network 0.3.0 → 0.5.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 +314 -51
- package/dist/cli.js +10537 -3957
- package/dist/cli.js.map +3 -3
- package/dist/client.d.ts +61 -0
- package/dist/client.test.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +11294 -4478
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,6 +5,8 @@ TypeScript toolkit for discovering and paying x402 services from a terminal, an
|
|
|
5
5
|
MCP client, or your own code. Your key is generated on your machine, encrypted
|
|
6
6
|
under your passphrase, and never leaves it. vAPI applies spend policy before
|
|
7
7
|
signing, sends the payment straight to the service, and writes a local receipt.
|
|
8
|
+
Every payment identifies this client as `vapi` through x402 `builder-code`; when
|
|
9
|
+
an API advertises `payment-identifier`, the generated id is kept on that receipt.
|
|
8
10
|
|
|
9
11
|
Call works today. Tasks and Compute are next.
|
|
10
12
|
|
|
@@ -31,6 +33,28 @@ the price. vAPI and added APIs carry a 5% network fee inside the quoted price;
|
|
|
31
33
|
partner and external listings carry none. `vapi inspect` and `--json` return the
|
|
32
34
|
same `group` and `fee` fields.
|
|
33
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
|
+
|
|
34
58
|
No install? Prefix any command with `npx vapi-network`, for example
|
|
35
59
|
`npx vapi-network init`. (`npx vapi` cannot work: the bare `vapi` name on npm
|
|
36
60
|
belongs to an unrelated package.)
|
|
@@ -134,6 +158,11 @@ default on disk. It cannot see a recovery phrase, a private key or a passphrase,
|
|
|
134
158
|
and the MCP server has no tool that creates, removes, renames, backs up or
|
|
135
159
|
exports a wallet.
|
|
136
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
|
+
|
|
137
166
|
`vapi backup` and `vapi export-key` print a secret, so they run only when a
|
|
138
167
|
person is demonstrably there: stdin and stdout are both a real terminal, no
|
|
139
168
|
agent or CI marker is set, and you type the wallet's own name to confirm.
|
|
@@ -193,42 +222,213 @@ Every command accepts `--json`, which writes one JSON value — success or error
|
|
|
193
222
|
to stdout. Exit codes are `0` for success, `1` for an operational failure, and
|
|
194
223
|
`2` for invalid usage or an announced preview-only command.
|
|
195
224
|
|
|
196
|
-
| Command
|
|
197
|
-
|
|
|
198
|
-
| `vapi init`
|
|
199
|
-
| `vapi wallet list`
|
|
200
|
-
| `vapi wallet create <name>`
|
|
201
|
-
| `vapi wallet use <name>`
|
|
202
|
-
| `vapi wallet rename <old> <new>`
|
|
203
|
-
| `vapi wallet remove <name>`
|
|
204
|
-
| `vapi wallet restore <name>`
|
|
205
|
-
| `vapi wallet caps <name>`
|
|
206
|
-
| `vapi fund`
|
|
207
|
-
| `vapi accounts`
|
|
208
|
-
| `vapi search [query]`
|
|
209
|
-
| `vapi inspect <id>`
|
|
210
|
-
| `vapi pay <id-or-url>`
|
|
211
|
-
| `vapi
|
|
212
|
-
| `vapi
|
|
213
|
-
| `vapi
|
|
214
|
-
| `vapi
|
|
215
|
-
| `vapi
|
|
216
|
-
| `vapi
|
|
217
|
-
| `vapi
|
|
218
|
-
| `vapi
|
|
219
|
-
| `vapi
|
|
220
|
-
| `vapi
|
|
221
|
-
| `vapi
|
|
222
|
-
| `vapi
|
|
223
|
-
| `vapi
|
|
224
|
-
| `vapi
|
|
225
|
-
| `vapi
|
|
226
|
-
| `vapi
|
|
227
|
-
| `vapi
|
|
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` |
|
|
228
283
|
|
|
229
284
|
`vapi pay` also accepts `--max-price-usd` as a long-standing alias for `--max`;
|
|
230
|
-
the two cannot be combined.
|
|
231
|
-
|
|
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:
|
|
305
|
+
|
|
306
|
+
```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
|
|
356
|
+
```
|
|
357
|
+
|
|
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
|
+
```
|
|
374
|
+
|
|
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:
|
|
409
|
+
|
|
410
|
+
```bash
|
|
411
|
+
vapi claim https://weather.example --wallet payout # the wallet the listings pay
|
|
412
|
+
```
|
|
413
|
+
|
|
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.
|
|
232
432
|
|
|
233
433
|
## MCP
|
|
234
434
|
|
|
@@ -289,9 +489,15 @@ that way.
|
|
|
289
489
|
|
|
290
490
|
| Tool | Input | Result |
|
|
291
491
|
| ----------------- | --------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
|
|
292
|
-
| `
|
|
293
|
-
| `
|
|
294
|
-
| `
|
|
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 |
|
|
295
501
|
| `wallet.address` | `wallet` | `wallet`, `address` |
|
|
296
502
|
| `wallet.balance` | `wallet` | `wallet`, `address`, `balances[]` per configured network |
|
|
297
503
|
| `wallet.accounts` | `wallet` | `wallet`, `accounts[]` with USDC, gas balance and deposit guidance |
|
|
@@ -305,13 +511,24 @@ that way.
|
|
|
305
511
|
`wallet` is optional on every tool that takes it: without it the session's
|
|
306
512
|
active wallet is used, then `VAPI_WALLET`, then the machine default. Every
|
|
307
513
|
result names the wallet it used. `call.pay` applies that wallet's own spend caps
|
|
308
|
-
before it signs and tags the receipt with its name.
|
|
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
|
|
309
518
|
session onto another wallet **for this process only** — it never rewrites
|
|
310
519
|
`wallets.json`, so your own terminal keeps the default you chose — and appends a
|
|
311
520
|
`wallet.use.session` line to the audit log. Reads need no passphrase at all.
|
|
312
521
|
|
|
313
522
|
Spend caps default to $0.10 per call and $1.00 per day.
|
|
314
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.
|
|
531
|
+
|
|
315
532
|
#### Deprecated tool aliases
|
|
316
533
|
|
|
317
534
|
These four pre-namespace names still work and still behave identically, but each
|
|
@@ -333,6 +550,44 @@ of a person.
|
|
|
333
550
|
|
|
334
551
|
## SDK
|
|
335
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
|
+
|
|
336
591
|
```bash
|
|
337
592
|
npm i @vapi-network/core @vapi-network/sources
|
|
338
593
|
```
|
|
@@ -426,12 +681,14 @@ reports/ what vapi report writes
|
|
|
426
681
|
| `VAPI_WALLET` | The wallet to use when no `--wallet` is given |
|
|
427
682
|
| `VAPI_REGISTRY_URL` | Replace the registry base; the canonical discovery paths derive from it |
|
|
428
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 |
|
|
429
685
|
| `VAPI_NO_SECRETS` | Set to `1` to stop `vapi backup` and `vapi export-key` printing anything |
|
|
430
686
|
|
|
431
|
-
`
|
|
432
|
-
|
|
433
|
-
existing `~/.vapi/agent-cash/`
|
|
434
|
-
|
|
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.
|
|
435
692
|
|
|
436
693
|
## Funding
|
|
437
694
|
|
|
@@ -463,18 +720,19 @@ to its human.
|
|
|
463
720
|
|
|
464
721
|
## Networks and accounts
|
|
465
722
|
|
|
466
|
-
| Network | x402 identifier | USDC | Gas / RPC notes
|
|
467
|
-
| -------------- | ----------------------------------------------------- | ---------------------------------------------- |
|
|
468
|
-
| Base mainnet | `eip155:8453` | `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913` | ETH; defaults to `https://mainnet.base.org`
|
|
469
|
-
| Arc
|
|
470
|
-
|
|
|
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` |
|
|
471
729
|
|
|
472
730
|
The x402 reference packages shorten the Solana CAIP-2 reference to
|
|
473
731
|
`solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp`; vAPI accepts that identifier as an
|
|
474
|
-
alias while persisting the full genesis hash above. Arc mainnet
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
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`.
|
|
478
736
|
|
|
479
737
|
`vapi accounts` lists one deposit account per configured network: its CAIP-2 ID,
|
|
480
738
|
network name, address, atomic and formatted USDC balance, gas-token balance, and
|
|
@@ -489,6 +747,9 @@ to that network's `config.json` entry:
|
|
|
489
747
|
}
|
|
490
748
|
```
|
|
491
749
|
|
|
750
|
+
Arc mainnet uses the default public RPC or `ARC_RPC_URL` and needs no faucet
|
|
751
|
+
configuration.
|
|
752
|
+
|
|
492
753
|
Create both local accounts at initialization with `vapi init --networks
|
|
493
754
|
base,solana`, or add an Ed25519 account to an existing keystore with `vapi
|
|
494
755
|
accounts --enable solana`. Fund the printed Solana address with SPL USDC. Exact
|
|
@@ -551,6 +812,8 @@ vapi stats --range 7d
|
|
|
551
812
|
vapi receipts export --format csv --range 30d
|
|
552
813
|
```
|
|
553
814
|
|
|
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.
|
|
816
|
+
|
|
554
817
|
`vapi report "<what happened>"` writes `$VAPI_HOME/reports/<timestamp>.json` and
|
|
555
818
|
prints that path plus a prefilled GitHub issue URL. Reports contain the message,
|
|
556
819
|
client version, OS and Node information, and only the newest five receipt IDs.
|