vapi-network 0.9.7 → 0.11.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 +16 -5
- package/SKILL.md +157 -0
- package/dist/cli.js +1146 -214
- package/dist/cli.js.map +3 -3
- package/dist/index.js +1161 -218
- package/dist/index.js.map +3 -3
- package/dist/skill.test.d.ts +1 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -11,6 +11,8 @@ signing, sends the payment straight to the service, and writes a local receipt.
|
|
|
11
11
|
Every payment identifies this client as `vapi` through x402 `builder-code`; when
|
|
12
12
|
an API advertises `payment-identifier`, the generated id is kept on that receipt.
|
|
13
13
|
|
|
14
|
+
vAPI Call takes no fee. Providers are paid directly.
|
|
15
|
+
|
|
14
16
|
Call is launching. Router, Stake and Agents are coming soon. Tasks is in preview.
|
|
15
17
|
See [vapinetwork.ai](https://vapinetwork.ai) and the
|
|
16
18
|
[documentation](https://docs.vapinetwork.ai).
|
|
@@ -27,6 +29,11 @@ No install? Prefix any command with `npx vapi-network`, for example
|
|
|
27
29
|
`npx vapi-network init`. (`npx vapi` cannot work: the bare `vapi` name on npm
|
|
28
30
|
belongs to an unrelated package.)
|
|
29
31
|
|
|
32
|
+
An agent can set itself up from the agent skill. Tell it: "Read
|
|
33
|
+
https://vapinetwork.ai/SKILL.md and follow it to set up vAPI." The same file
|
|
34
|
+
ships in this package as [SKILL.md](./packages/vapi-network/SKILL.md), with the
|
|
35
|
+
CLI version it describes in its frontmatter.
|
|
36
|
+
|
|
30
37
|
Interactive CLI runs check for a newer release at most once a day and cache the result in
|
|
31
38
|
`~/.vapi/update-check.json`. JSON, MCP server, CI and non-TTY runs skip the check. Set
|
|
32
39
|
`VAPI_NO_UPDATE_CHECK=1` to disable it.
|
|
@@ -117,6 +124,10 @@ an announced preview-only command.
|
|
|
117
124
|
Solana listings remain searchable. Inspecting or paying one returns
|
|
118
125
|
`unsupported_network` (CLI exit `1`); vault payments on Solana arrive in a later release.
|
|
119
126
|
Inspect shows the registry’s last observed quote; pay fetches a fresh quote before signing.
|
|
127
|
+
Hosted search hides listings in outage unless `--include-outage` is set.
|
|
128
|
+
API hits can include health and cheaper or healthier alternatives; inspect can
|
|
129
|
+
include response schemas and an example request. Search, inspect and pay JSON
|
|
130
|
+
results include zero to four next-action hints.
|
|
120
131
|
|
|
121
132
|
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.
|
|
122
133
|
|
|
@@ -159,9 +170,9 @@ Posting a task moves no money. The create-order contract stores its market amoun
|
|
|
159
170
|
| `vapi docs search "<query>"` | `--json` | Searches the vAPI documentation and prints matching excerpts; no wallet or payment |
|
|
160
171
|
| `vapi docs read <url-or-path>` | `--json` | Reads one vAPI documentation page as Markdown; no wallet or payment |
|
|
161
172
|
| `vapi accounts` | `--enable <arc>`, `--wallet <name>` | One deposit account per configured network, with balances and guidance |
|
|
162
|
-
| `vapi search [query]` | `--kind <kind>` (repeatable), `--network <caip2>`, `--limit <n>`, `--cursor <cursor>`, `--include-unverified`
|
|
163
|
-
| `vapi inspect <id>` | `--endpoint <name>` |
|
|
164
|
-
| `vapi pay <id-or-url>` | `--method`, `--endpoint`, `--body <json>`, `--content-type`, `--network <caip2>`, `--expected-pay-to`, `--max <usd>`, `--timeout <seconds>`, `--
|
|
173
|
+
| `vapi search [query]` | `--kind <kind>` (repeatable), `--network <caip2>`, `--limit <n>`, `--cursor <cursor>`, `--include-unverified`, `--include-outage` | Registry discovery with group, tier, health and alternatives |
|
|
174
|
+
| `vapi inspect <id>` | `--endpoint <name>` | Health, verification, request and response contracts, example request and the registry's last observed quote |
|
|
175
|
+
| `vapi pay <id-or-url>` | `--method`, `--endpoint`, `--body <json>`, `--content-type`, `--network <caip2>`, `--expected-pay-to`, `--max <usd>`, `--timeout <seconds>`, `--account <name>` | Pays locally, includes hints in JSON, and names the limit blocking a payment |
|
|
165
176
|
| `vapi pay --resume <receipt-id>` | - | Checks settlement, shows its payment id, and never pays |
|
|
166
177
|
| `vapi check <url>` | `--method <method>` | Grades its 402, extensions and same-origin discovery. Never pays |
|
|
167
178
|
| `vapi balance` | `--wallet <name>` | The wallet's address and USDC balances |
|
|
@@ -223,12 +234,12 @@ Posting a task moves no money. The create-order contract stores its market amoun
|
|
|
223
234
|
| `vapi auth status` | - | Whether this machine has a key and where it comes from, masked |
|
|
224
235
|
| `vapi auth clear` | - | Takes the stored key back out |
|
|
225
236
|
| `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 |
|
|
226
|
-
| `vapi publish activate <slug>` | - | Takes a listing live once
|
|
237
|
+
| `vapi publish activate <slug>` | - | Takes a listing live once every endpoint pays the signed payout wallet |
|
|
227
238
|
| `vapi publish verify-request <slug>` | - | Asks vAPI to review the listing |
|
|
228
239
|
| `vapi publish list` | - | Every listing this API key owns |
|
|
229
240
|
| `vapi claim <origin>` | `--wallet <name>` | Takes over the listings vAPI indexed from your API, signed by their payee |
|
|
230
241
|
| `vapi mcp` | `--wallet <name>` | Serves the MCP tools over stdio |
|
|
231
|
-
| `vapi mcp install <claude
|
|
242
|
+
| `vapi mcp install <app>` | `claude-code`, `claude-desktop`, `cursor`, `codex`; `--home <dir>`, `--registry <url>`, `--no-link`, `--json` | Registers vAPI through Claude Code's CLI or writes the client's MCP config |
|
|
232
243
|
| `vapi serve` | - | Preview only; exits `2` with a message |
|
|
233
244
|
| `vapi version` | - | The client version, also as `--version` or `-v` |
|
|
234
245
|
| `vapi help` | - | The same help bare `vapi` shows, also as `--help` or `-h` |
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vapi
|
|
3
|
+
version: 0.11.0
|
|
4
|
+
description: >-
|
|
5
|
+
Pay for one API call at a time, in USDC, from the agent's own wallet. Search
|
|
6
|
+
vAPI Call before writing a scraper, before asking the user to sign up for an
|
|
7
|
+
API key, or before saying data is out of reach: weather, prices, onchain
|
|
8
|
+
data, search, enrichment, AI models and more, all paid per request over
|
|
9
|
+
x402. Also use it whenever the user mentions vAPI, x402 or paying an API
|
|
10
|
+
with USDC. Exception: when the user already has a tool, MCP server or key
|
|
11
|
+
for that service, use theirs.
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# vAPI Call
|
|
15
|
+
|
|
16
|
+
vAPI Call is a catalogue of x402 APIs an agent can find, check and pay per request.
|
|
17
|
+
|
|
18
|
+
- **No fee.** vAPI Call takes no fee. Providers are paid directly at their own quoted price.
|
|
19
|
+
- **No signup.** No account and no API key. Search needs nothing; paying needs a funded wallet on this machine.
|
|
20
|
+
- **Your own wallet.** The key is created and kept on this machine. Spend caps are applied before anything is signed.
|
|
21
|
+
- **Onchain proof.** Every paid call settles in USDC on Base or Arc, and the receipt names the transaction.
|
|
22
|
+
|
|
23
|
+
The CLI is `vapi`, from the npm package `vapi-network`. Run `vapi help` for every command and flag; it is the source of truth when this file and the CLI disagree.
|
|
24
|
+
|
|
25
|
+
## Setup
|
|
26
|
+
|
|
27
|
+
Check the installed CLI and the latest release:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
vapi version --json
|
|
31
|
+
npm view vapi-network version
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Install or update when `vapi` is not found, when the two versions differ, or when the CLI version does not match `version` in this file's frontmatter:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm i -g vapi-network@latest
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Then save the latest skill from https://vapinetwork.ai/SKILL.md over this file. Bring both to the latest; never downgrade either one to match the other. Without a global install, prefix every command with `npx -y vapi-network@latest`. The bare `npx vapi` is an unrelated package.
|
|
41
|
+
|
|
42
|
+
Check the wallet:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
vapi balance --json
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
- **No wallet yet** (`No wallet yet. Run vapi init.`). Ask the user to run `vapi setup` in their own terminal. It creates the device vault, shows the recovery phrase to them, and links the wallet to their owner wallet. If the user asks you to create it, `vapi init --json` does so with the phrase hidden; the user then runs `vapi backup` in their terminal before funding it. Never ask for, print or store the phrase.
|
|
49
|
+
- **Balance is zero.** Run `vapi fund`. It opens a page where the user pays by card, sends USDC on Base from a wallet, or bridges from another chain.
|
|
50
|
+
- **Caps.** A new account may spend $0.10 per call and $1.00 per day. `vapi accounts caps <account>` shows the current values.
|
|
51
|
+
|
|
52
|
+
MCP clients get the same tools (`call.search`, `call.inspect`, `call.pay`, `wallet.balance`, `receipts.list`):
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
vapi mcp install claude # Claude Desktop
|
|
56
|
+
vapi mcp install cursor
|
|
57
|
+
vapi mcp install codex
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## When not to use vAPI
|
|
61
|
+
|
|
62
|
+
vAPI fills gaps in the user's stack. Choose in this order:
|
|
63
|
+
|
|
64
|
+
1. **The user's instruction for this task.** If they said how to do it, do it that way.
|
|
65
|
+
2. **The user's own tools.** An MCP server, CLI, API key or workflow they already have for that service. Their key may cost nothing extra; a vAPI call spends their USDC.
|
|
66
|
+
3. **vAPI Call**, for everything the first two do not cover.
|
|
67
|
+
|
|
68
|
+
When both could do the job and the user has not chosen, use their tool and mention the vAPI listing as an option. Never switch silently.
|
|
69
|
+
|
|
70
|
+
## Search, inspect, pay
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
vapi search "weather forecast" --limit 10 --json
|
|
74
|
+
vapi inspect <ref> --json
|
|
75
|
+
vapi pay <ref> --body '{"city":"Lisbon"}' --max 0.02 --json > forecast.json
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
1. **Search** with one short noun phrase and `--limit 10`. Read those 5 to 10 results before searching again or paging with `--cursor`. Each result has a `ref`, a price, a `group` and a `verification` tier. `--include-unverified` adds self-listed APIs that passed vAPI's automated probe but were never reviewed.
|
|
79
|
+
2. **Inspect** the one you picked. It is free and shows the request contract (method, content type, request schema), the last observed quote and payee, and liveness. A listing with several endpoints needs `--endpoint <name>`. Build the request from the schema; never guess a field.
|
|
80
|
+
3. **Pay** with `--max` set to the price you expect, in USD. `--body` takes the request as JSON; for a GET it is sent as query parameters. `vapi pay` fetches a fresh quote, checks it against `--max` and the caps, signs one USDC authorization for exactly that quote, and returns the provider's response with the payment and its proof.
|
|
81
|
+
4. **Split** a task that needs several sources into one search, inspect and pay per source.
|
|
82
|
+
5. **Report** the cost when the user cares about spend. `vapi receipts` lists every paid call with its quote, settlement and latency.
|
|
83
|
+
|
|
84
|
+
Send one item per call and a small limit (5 to 10) when an input takes a list or a result count. Some providers bill per item, and a list of three search terms can return three times the results.
|
|
85
|
+
|
|
86
|
+
## Choosing between listings
|
|
87
|
+
|
|
88
|
+
Prefer, in this order, among listings that fit the task:
|
|
89
|
+
|
|
90
|
+
| Signal | Prefer |
|
|
91
|
+
| -------------- | ------------------------------------------------------------------------------------ |
|
|
92
|
+
| `verification` | `verified`, then `requested`, then `none`. Mirrored external rows are always `none`. |
|
|
93
|
+
| Liveness | Higher 7-day uptime, then lower p95 latency. |
|
|
94
|
+
| Price | The lower quote, when the two are otherwise equal. |
|
|
95
|
+
|
|
96
|
+
`vapi inspect` prints a `Liveness:` line when vAPI has measured the listing: uptime over the last seven days of hourly checks, with p50 and p95 latency. No liveness line means not measured yet. That is common for a low-traffic listing and is no reason to skip it. A listing that fails three checks in a row is suspended and drops out of search, so search does not show listings known to be down.
|
|
97
|
+
|
|
98
|
+
Use these signals to break ties between listings that fit. Fit to the task comes first.
|
|
99
|
+
|
|
100
|
+
## Caps and what a block means
|
|
101
|
+
|
|
102
|
+
The CLI checks every payment against the account's caps before signing. A block is terminal: nothing was signed, nothing was paid, and retrying gives the same answer.
|
|
103
|
+
|
|
104
|
+
| Code | Meaning |
|
|
105
|
+
| ----------------------- | ---------------------------------------------------------------- |
|
|
106
|
+
| `per_call_cap_exceeded` | The fresh quote is above the per-call cap. |
|
|
107
|
+
| `per_day_cap_exceeded` | This payment would take today's spend (UTC) above the daily cap. |
|
|
108
|
+
| `max_price_exceeded` | The fresh quote is above the `--max` you passed. |
|
|
109
|
+
|
|
110
|
+
Current clients return `spend_cap_exceeded` with `cap` set to `per_call`, `per_day` or `max_price` for these blocks; older clients used the codes above. Read `amountUsd`, `limitUsd`, optional `spentUsd`, and `command` for the attempted payment and guidance. MCP marks the result `retryable: false`.
|
|
111
|
+
|
|
112
|
+
Tell the user which cap blocked, the quote, and the command that changes it. The caps are the user's spending limit, so the user decides whether to raise them:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
vapi accounts caps <account> --per-call 0.50 --per-day 5
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Recovery
|
|
119
|
+
|
|
120
|
+
| What happened | Do this |
|
|
121
|
+
| ---------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
122
|
+
| Provider answers 400 or 422, or the result has `expectedRequest` | Input does not match the contract. Run `vapi inspect` again and rebuild the body from its schema before paying again. A null `payment` means nothing was charged. |
|
|
123
|
+
| `max_price_exceeded`: the quote changed since inspect | Run `vapi inspect` for the new quote. Pay again with a new `--max` only if the new price still fits what the user asked for. |
|
|
124
|
+
| `settlement_unknown` | Do not pay again. Run `vapi pay --resume <receipt-id>`. **Settled**: it went through. **Expired**: never used, paying again is safe. **Pending**: wait until the time it prints. |
|
|
125
|
+
| `response_unreadable` after a settled payment | The payment went through; do not pay again. Report the receipt to the user. |
|
|
126
|
+
| `payment_rejected` | The payment was refused and nothing settled. Check `vapi balance`, then try once more or pick another listing. |
|
|
127
|
+
| HTTP 429 or a rate-limit message | Back off. Wait for `Retry-After` when the provider sends it, otherwise 30 seconds, and retry once. Do not loop. |
|
|
128
|
+
| `unsupported_network` | The listing settles on Solana, which the vault does not pay yet. Pick a Base or Arc listing. |
|
|
129
|
+
| Insufficient USDC | Run `vapi fund` and tell the user the address and amount. |
|
|
130
|
+
|
|
131
|
+
Exit codes are `0` for success, `1` for an operational failure and `2` for invalid usage.
|
|
132
|
+
|
|
133
|
+
## Slow providers
|
|
134
|
+
|
|
135
|
+
Read the p95 in `vapi inspect` before paying. The paid request waits for the provider's advertised maximum, clamped to 30 to 120 seconds, or 120 seconds when the provider names none. `--timeout <seconds>` sets it from 1 to 300 seconds; a smaller provider maximum still applies. If the response is lost after the payment was signed, the result is `settlement_unknown`: follow the recovery row above and never pay twice.
|
|
136
|
+
|
|
137
|
+
## Large responses
|
|
138
|
+
|
|
139
|
+
Send `--json` output to a file and read the parts you need:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
vapi pay <ref> --body '{"symbol":"ETH"}' --max 0.01 --json > eth.json
|
|
143
|
+
jq '.body' eth.json
|
|
144
|
+
jq '.payment' eth.json
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
`body` is the provider's response. `payment` holds the network, the amount in USD, the payee, and the settlement proof.
|
|
148
|
+
|
|
149
|
+
## Rules
|
|
150
|
+
|
|
151
|
+
1. **Check the user's stack first.** Their own tools come before vAPI; see "When not to use vAPI".
|
|
152
|
+
2. **Inspect before every first payment** to a listing. The request schema is the contract.
|
|
153
|
+
3. **Always pass `--max`.** Set it to the price you expect, so a changed quote stops before signing.
|
|
154
|
+
4. **Start small.** One query, 5 to 10 results, one item per paid call.
|
|
155
|
+
5. **Never pay twice for one request.** After `settlement_unknown` or a lost response, run `vapi pay --resume <receipt-id>` first.
|
|
156
|
+
6. **Surface cap blocks.** Name the cap and the quote; the user decides whether to raise it.
|
|
157
|
+
7. **Keep secrets out of the conversation.** Never ask for, print or store a recovery phrase, passphrase or private key. `vapi backup` and `vapi export-key` are for the user's own terminal.
|