apinow-sdk 0.20.0 → 0.20.2
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 +34 -1
- package/dist/cli.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,6 +26,15 @@ const results = await apinow.search('weather forecast', 5);
|
|
|
26
26
|
|
|
27
27
|
// free endpoint info (cost, schema, wallet)
|
|
28
28
|
const info = await apinow.info('gg402', 'horoscope');
|
|
29
|
+
|
|
30
|
+
// call ANY external x402 endpoint — even ones not listed on APINow
|
|
31
|
+
const price = await apinow.discoverPrice('https://stablesocial.dev/api/tiktok/profile');
|
|
32
|
+
console.log(price.totalPrice); // upstream + proxy fee
|
|
33
|
+
|
|
34
|
+
const tiktok = await apinow.callExternal('https://stablesocial.dev/api/tiktok/profile', {
|
|
35
|
+
method: 'POST',
|
|
36
|
+
body: { handle: 'someuser' },
|
|
37
|
+
});
|
|
29
38
|
```
|
|
30
39
|
|
|
31
40
|
### `createClient(config)`
|
|
@@ -39,7 +48,9 @@ Returns:
|
|
|
39
48
|
|
|
40
49
|
| Method | Description |
|
|
41
50
|
|--------|-------------|
|
|
42
|
-
| `call(endpoint, opts?)` | Call any endpoint with automatic x402 payment |
|
|
51
|
+
| `call(endpoint, opts?)` | Call any APINow endpoint with automatic x402 payment |
|
|
52
|
+
| `callExternal(url, opts?)` | Proxy any external x402 endpoint (discovery + payment) |
|
|
53
|
+
| `discoverPrice(url, method?)` | Discover the x402 price of any URL (free) |
|
|
43
54
|
| `search(query, limit?)` | Semantic search across all endpoints |
|
|
44
55
|
| `info(ns, name)` | Get endpoint details (free) |
|
|
45
56
|
| `listWorkflows(opts?)` | List workflows (free) |
|
|
@@ -133,6 +144,28 @@ APINOW_WALLET_PKEY=0x... npx apinow run-workflow 90931d9c8fb94df9 -d '{"query":"
|
|
|
133
144
|
| `-d, --data <json>` | JSON input (default: `{"query":"hello world"}`) |
|
|
134
145
|
| `-k, --key <privateKey>` | Wallet key (or set `APINOW_WALLET_PKEY`) |
|
|
135
146
|
|
|
147
|
+
### `discover` — check the x402 price of any URL (free)
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
npx apinow discover https://stablesocial.dev/api/tiktok/profile
|
|
151
|
+
npx apinow discover https://stablesocial.dev/api/tiktok/posts --method POST
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### `call-external` — call any external x402 endpoint (paid)
|
|
155
|
+
|
|
156
|
+
Proxies through APINow — you pay upstream price + a small proxy fee, and the server wallet pays the upstream service.
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
APINOW_WALLET_PKEY=0x... npx apinow call-external https://stablesocial.dev/api/tiktok/profile -d '{"handle":"someuser"}'
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
| Flag | Description |
|
|
163
|
+
|------|-------------|
|
|
164
|
+
| `-d, --data <json>` | JSON body to send to the target |
|
|
165
|
+
| `-m, --method <method>` | HTTP method (default: POST) |
|
|
166
|
+
| `-H, --header <kv...>` | Extra headers as `key:value` pairs |
|
|
167
|
+
| `-k, --key <privateKey>` | Wallet key (or set `APINOW_WALLET_PKEY`) |
|
|
168
|
+
|
|
136
169
|
## Requirements
|
|
137
170
|
|
|
138
171
|
- Node.js v18+
|
package/dist/cli.js
CHANGED
|
@@ -7,7 +7,7 @@ const program = new Command();
|
|
|
7
7
|
program
|
|
8
8
|
.name('apinow')
|
|
9
9
|
.description('CLI for APINow.fun — search, inspect, and call pay-per-request APIs')
|
|
10
|
-
.version('0.20.
|
|
10
|
+
.version('0.20.2');
|
|
11
11
|
// ─── Helpers ───
|
|
12
12
|
function getPrivateKey(opts) {
|
|
13
13
|
const raw = opts.key || process.env.APINOW_WALLET_PKEY || process.env.PRIVATE_KEY;
|
package/package.json
CHANGED