apinow-sdk 0.20.0 → 0.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +34 -1
  2. 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apinow-sdk",
3
- "version": "0.20.0",
3
+ "version": "0.20.1",
4
4
  "description": "Pay-per-call API SDK & CLI for APINow.fun — endpoints + workflows, wraps x402 so you don't have to",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",