x402-proxy 0.9.3 → 0.9.4
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/CHANGELOG.md +7 -1
- package/README.md +5 -5
- package/dist/bin/cli.js +12 -12
- package/dist/openclaw/plugin.js +1 -1
- package/dist/setup-B6xRV8Ue.js +3 -0
- package/dist/{setup-QtTFsCFs.js → setup-Dp5fS7ob.js} +1 -1
- package/package.json +1 -1
- package/skills/SKILL.md +9 -7
- package/skills/references/openclaw-plugin.md +135 -0
- package/dist/setup-lCsiivm2.js +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.9.4] - 2026-03-27
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- All example URLs migrated from legacy individual service subdomains (`twitter.surf.cascade.fyi`, `web.surf.cascade.fyi`, `inference.surf.cascade.fyi`) to unified `surf.cascade.fyi/api/v1/` endpoints across CLI help text, README, SKILL.md, and OpenClaw plugin docs
|
|
14
|
+
|
|
10
15
|
## [0.9.3] - 2026-03-26
|
|
11
16
|
|
|
12
17
|
### Fixed
|
|
@@ -295,7 +300,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
295
300
|
- `appendHistory` / `readHistory` / `calcSpend` - JSONL transaction history
|
|
296
301
|
- Re-exports from `@x402/fetch`, `@x402/svm`, `@x402/evm`
|
|
297
302
|
|
|
298
|
-
[Unreleased]: https://github.com/cascade-protocol/x402-proxy/compare/v0.9.
|
|
303
|
+
[Unreleased]: https://github.com/cascade-protocol/x402-proxy/compare/v0.9.4...HEAD
|
|
304
|
+
[0.9.4]: https://github.com/cascade-protocol/x402-proxy/compare/v0.9.3...v0.9.4
|
|
299
305
|
[0.9.3]: https://github.com/cascade-protocol/x402-proxy/compare/v0.9.2...v0.9.3
|
|
300
306
|
[0.9.2]: https://github.com/cascade-protocol/x402-proxy/compare/v0.9.1...v0.9.2
|
|
301
307
|
[0.9.1]: https://github.com/cascade-protocol/x402-proxy/compare/v0.9.0...v0.9.1
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
## Quick Start
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npx x402-proxy https://
|
|
8
|
+
npx x402-proxy -X POST -d '{"ref":"CoinbaseDev"}' https://surf.cascade.fyi/api/v1/twitter/user
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
That's it. The endpoint returns 402, x402-proxy pays and streams the response.
|
|
@@ -52,14 +52,14 @@ openclaw mcp set surf '{"command":"npx","args":["-y","x402-proxy","mcp","https:/
|
|
|
52
52
|
Works like curl. Response body streams to stdout, payment info goes to stderr.
|
|
53
53
|
|
|
54
54
|
```bash
|
|
55
|
-
#
|
|
56
|
-
$ npx x402-proxy https://
|
|
55
|
+
# POST request
|
|
56
|
+
$ npx x402-proxy -X POST -d '{"ref":"CoinbaseDev"}' https://surf.cascade.fyi/api/v1/twitter/user
|
|
57
57
|
|
|
58
58
|
# POST with body and headers (curl-style short flags: -X, -H, -d)
|
|
59
59
|
$ npx x402-proxy -X POST \
|
|
60
60
|
-H "Content-Type: application/json" \
|
|
61
61
|
-d '{"url":"https://x402.org"}' \
|
|
62
|
-
https://
|
|
62
|
+
https://surf.cascade.fyi/api/v1/web/crawl
|
|
63
63
|
|
|
64
64
|
# Force a specific network
|
|
65
65
|
$ npx x402-proxy --network base https://api.example.com/data
|
|
@@ -71,7 +71,7 @@ $ npx x402-proxy --verbose https://api.example.com/data
|
|
|
71
71
|
$ npx x402-proxy --protocol mpp \
|
|
72
72
|
-X POST -H "Content-Type: application/json" \
|
|
73
73
|
-d '{"model":"minimax/minimax-m2.5","stream":true,"messages":[{"role":"user","content":"Hello"}]}' \
|
|
74
|
-
https://
|
|
74
|
+
https://surf.cascade.fyi/api/v1/inference/completions
|
|
75
75
|
|
|
76
76
|
# Pipe-safe
|
|
77
77
|
$ npx x402-proxy https://api.example.com/data | jq '.results'
|
package/dist/bin/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { a as getHistoryPath, c as loadConfig, i as getConfigDirShort, l as loadWalletFile, s as isConfigured, u as saveConfig } from "../derive-EDXzwKW2.js";
|
|
3
3
|
import { _ as error, b as warn, c as resolveWallet, d as displayNetwork, f as formatAmount, g as dim, h as readHistory, l as appendHistory, m as formatUsdcValue, n as fetchAllBalances, o as walletInfoCommand, p as formatTxLine, s as buildX402Client, u as calcSpend, v as info, y as isTTY } from "../wallet-CqUc-ZFn.js";
|
|
4
|
-
import { n as setupCommand, t as runSetup } from "../setup-
|
|
4
|
+
import { n as setupCommand, t as runSetup } from "../setup-Dp5fS7ob.js";
|
|
5
5
|
import { n as statusCommand } from "../status-BZTToWE_.js";
|
|
6
6
|
import { dirname, join, normalize, resolve } from "node:path";
|
|
7
7
|
import { buildApplication, buildCommand, buildRouteMap, run } from "@stricli/core";
|
|
@@ -310,8 +310,8 @@ const fetchCommand = buildCommand({
|
|
|
310
310
|
fullDescription: `Make a paid HTTP request. Payment is automatic when the server returns 402.
|
|
311
311
|
|
|
312
312
|
Examples:
|
|
313
|
-
$ x402-proxy https://
|
|
314
|
-
$ x402-proxy -X POST -d '{"url":"https://x402.org"}' https://
|
|
313
|
+
$ x402-proxy -X POST -d '{"ref":"CoinbaseDev"}' https://surf.cascade.fyi/api/v1/twitter/user
|
|
314
|
+
$ x402-proxy -X POST -d '{"url":"https://x402.org"}' https://surf.cascade.fyi/api/v1/web/crawl
|
|
315
315
|
$ x402-proxy https://api.example.com/data | jq '.results'`
|
|
316
316
|
},
|
|
317
317
|
parameters: {
|
|
@@ -408,7 +408,7 @@ Examples:
|
|
|
408
408
|
console.log(` ${pc.cyan("$ npx x402-proxy wallet")} Addresses and balances`);
|
|
409
409
|
console.log(` ${pc.cyan("$ npx x402-proxy wallet history")} Full payment history`);
|
|
410
410
|
console.log();
|
|
411
|
-
console.log(pc.dim(" try: ") + pc.cyan(
|
|
411
|
+
console.log(pc.dim(" try: ") + pc.cyan(`$ npx x402-proxy -X POST -d '{"ref":"CoinbaseDev"}' https://surf.cascade.fyi/api/v1/twitter/user`));
|
|
412
412
|
console.log();
|
|
413
413
|
console.log(pc.dim(" https://github.com/cascade-protocol/x402-proxy"));
|
|
414
414
|
console.log();
|
|
@@ -450,7 +450,7 @@ Examples:
|
|
|
450
450
|
process.exit(1);
|
|
451
451
|
}
|
|
452
452
|
dim(" No wallet found. Let's set one up first.\n");
|
|
453
|
-
const { runSetup } = await import("../setup-
|
|
453
|
+
const { runSetup } = await import("../setup-B6xRV8Ue.js");
|
|
454
454
|
await runSetup();
|
|
455
455
|
console.log();
|
|
456
456
|
wallet = resolveWallet();
|
|
@@ -806,7 +806,7 @@ Wallet is auto-generated on first run. No env vars needed.`
|
|
|
806
806
|
});
|
|
807
807
|
if (wallet.source === "none") {
|
|
808
808
|
dim("No wallet found. Auto-generating...");
|
|
809
|
-
const { runSetup } = await import("../setup-
|
|
809
|
+
const { runSetup } = await import("../setup-B6xRV8Ue.js");
|
|
810
810
|
await runSetup({ nonInteractive: true });
|
|
811
811
|
const fresh = resolveWallet({
|
|
812
812
|
evmKey: flags.evmKey,
|
|
@@ -870,7 +870,7 @@ Wallet is auto-generated on first run. No env vars needed.`
|
|
|
870
870
|
}
|
|
871
871
|
const remoteClient = new Client({
|
|
872
872
|
name: "x402-proxy",
|
|
873
|
-
version: "0.9.
|
|
873
|
+
version: "0.9.4"
|
|
874
874
|
});
|
|
875
875
|
const x402Mcp = new x402MCPClient(remoteClient, x402PaymentClient, {
|
|
876
876
|
autoPayment: true,
|
|
@@ -908,7 +908,7 @@ Wallet is auto-generated on first run. No env vars needed.`
|
|
|
908
908
|
}
|
|
909
909
|
const localServer = new Server({
|
|
910
910
|
name: "x402-proxy",
|
|
911
|
-
version: "0.9.
|
|
911
|
+
version: "0.9.4"
|
|
912
912
|
}, { capabilities: {
|
|
913
913
|
tools: tools.length > 0 ? {} : void 0,
|
|
914
914
|
resources: remoteResources.length > 0 ? {} : void 0
|
|
@@ -1003,7 +1003,7 @@ Wallet is auto-generated on first run. No env vars needed.`
|
|
|
1003
1003
|
}));
|
|
1004
1004
|
const remoteClient = new Client({
|
|
1005
1005
|
name: "x402-proxy",
|
|
1006
|
-
version: "0.9.
|
|
1006
|
+
version: "0.9.4"
|
|
1007
1007
|
});
|
|
1008
1008
|
await connectTransport(remoteClient);
|
|
1009
1009
|
const mppClient = McpClient.wrap(remoteClient, { methods: wrappedMethods });
|
|
@@ -1018,7 +1018,7 @@ Wallet is auto-generated on first run. No env vars needed.`
|
|
|
1018
1018
|
}
|
|
1019
1019
|
const localServer = new Server({
|
|
1020
1020
|
name: "x402-proxy",
|
|
1021
|
-
version: "0.9.
|
|
1021
|
+
version: "0.9.4"
|
|
1022
1022
|
}, { capabilities: {
|
|
1023
1023
|
tools: tools.length > 0 ? {} : void 0,
|
|
1024
1024
|
resources: remoteResources.length > 0 ? {} : void 0
|
|
@@ -1272,7 +1272,7 @@ const mcpAddCommand = buildCommand({
|
|
|
1272
1272
|
}
|
|
1273
1273
|
}
|
|
1274
1274
|
prompts.log.step("Try your first request:");
|
|
1275
|
-
prompts.log.message(` ${pc.cyan(
|
|
1275
|
+
prompts.log.message(` ${pc.cyan(`$ npx x402-proxy -X POST -d '{"ref":"CoinbaseDev"}' https://surf.cascade.fyi/api/v1/twitter/user`)}`);
|
|
1276
1276
|
prompts.log.message(` ${pc.dim("Run")} ${pc.cyan("npx x402-proxy")} ${pc.dim("to see your wallet and balance")}`);
|
|
1277
1277
|
prompts.outro(pc.green(`MCP server ${pc.bold(serverName)} is ready to use!`));
|
|
1278
1278
|
}
|
|
@@ -1415,7 +1415,7 @@ const app = buildApplication(buildRouteMap({
|
|
|
1415
1415
|
docs: { brief: "curl for x402 paid APIs" }
|
|
1416
1416
|
}), {
|
|
1417
1417
|
name: "x402-proxy",
|
|
1418
|
-
versionInfo: { currentVersion: "0.9.
|
|
1418
|
+
versionInfo: { currentVersion: "0.9.4" },
|
|
1419
1419
|
scanner: { caseStyle: "allow-kebab-for-camel" }
|
|
1420
1420
|
});
|
|
1421
1421
|
//#endregion
|
package/dist/openclaw/plugin.js
CHANGED
|
@@ -809,7 +809,7 @@ function createWalletCommand(ctx) {
|
|
|
809
809
|
try {
|
|
810
810
|
const snap = await getWalletSnapshot(ctx.rpcUrl, walletAddress, ctx.historyPath);
|
|
811
811
|
const solscanUrl = `https://solscan.io/account/${walletAddress}`;
|
|
812
|
-
const lines = [`x402-proxy v0.9.
|
|
812
|
+
const lines = [`x402-proxy v0.9.4`];
|
|
813
813
|
const defaultModel = ctx.allModels[0];
|
|
814
814
|
if (defaultModel) lines.push("", `**Model** - ${defaultModel.name} (${defaultModel.provider})`);
|
|
815
815
|
lines.push("", `**[Wallet](${solscanUrl})**`, `\`${walletAddress}\``);
|
|
@@ -143,7 +143,7 @@ async function runSetup(opts) {
|
|
|
143
143
|
prompts.log.message(` Solana (USDC): Send USDC to ${pc.cyan(sol.address)}`);
|
|
144
144
|
prompts.log.message(` Base (USDC): Send USDC to ${pc.cyan(evm.address)}`);
|
|
145
145
|
prompts.log.step("Try your first request:");
|
|
146
|
-
prompts.log.message(` ${pc.cyan(
|
|
146
|
+
prompts.log.message(` ${pc.cyan(`$ npx x402-proxy -X POST -d '{"ref":"CoinbaseDev"}' https://surf.cascade.fyi/api/v1/twitter/user`)}`);
|
|
147
147
|
prompts.outro(pc.green("Setup complete!"));
|
|
148
148
|
}
|
|
149
149
|
const setupCommand = buildCommand({
|
package/package.json
CHANGED
package/skills/SKILL.md
CHANGED
|
@@ -10,7 +10,7 @@ description: Use x402-proxy CLI for consuming and debugging x402 and MPP paid AP
|
|
|
10
10
|
## Quick start
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
|
-
npx x402-proxy https://
|
|
13
|
+
npx x402-proxy -X POST -d '{"ref":"CoinbaseDev"}' https://surf.cascade.fyi/api/v1/twitter/user
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
First run auto-creates a wallet. No setup needed.
|
|
@@ -165,14 +165,16 @@ stdout = response body, stderr = payment info. Pipes, redirects, and `jq` all wo
|
|
|
165
165
|
|
|
166
166
|
## OpenClaw Plugin
|
|
167
167
|
|
|
168
|
-
x402-proxy ships as an [OpenClaw](https://openclaw.dev) plugin
|
|
168
|
+
x402-proxy ships as an [OpenClaw](https://openclaw.dev) plugin for automatic x402 payments, wallet management, and pay-per-use inference proxying. For full installation, provider/model configuration, and troubleshooting, read `references/openclaw-plugin.md`.
|
|
169
169
|
|
|
170
|
-
|
|
171
|
-
- `x_payment` tool - call any x402-enabled endpoint with automatic payment
|
|
172
|
-
- `/x_wallet` command - wallet status, send USDC, transaction history
|
|
173
|
-
- HTTP route proxy (`/x402/*`) - proxies requests to upstream x402 endpoints with payment
|
|
170
|
+
Quick install:
|
|
174
171
|
|
|
175
|
-
|
|
172
|
+
```bash
|
|
173
|
+
openclaw plugins install x402-proxy
|
|
174
|
+
npx x402-proxy setup # creates wallet if needed
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Registers: `x_balance` tool, `x_payment` tool, `/x_wallet` command, `/x402/*` HTTP route for inference proxying.
|
|
176
178
|
|
|
177
179
|
## Library API
|
|
178
180
|
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# OpenClaw Plugin Setup
|
|
2
|
+
|
|
3
|
+
x402-proxy ships as an [OpenClaw](https://openclaw.dev) plugin. Gives your gateway automatic x402 payment, wallet management, and pay-per-use inference proxying via Solana USDC.
|
|
4
|
+
|
|
5
|
+
## What it registers
|
|
6
|
+
|
|
7
|
+
- **`x_balance` tool** - check wallet SOL/USDC balances, daily spend, available funds
|
|
8
|
+
- **`x_payment` tool** - call any x402-enabled endpoint with automatic payment (params: `url`, `method`, `params`, `headers`)
|
|
9
|
+
- **`/x_wallet` command** - wallet status dashboard, `send <amount|all> <address>`, `history [page]`
|
|
10
|
+
- **HTTP route `/x402/*`** - proxies requests to upstream inference endpoints with payment, tracks token usage and cost
|
|
11
|
+
|
|
12
|
+
## Step 1: Install the plugin
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
openclaw plugins install x402-proxy
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
This downloads from npm, validates `openclaw.plugin.json`, and installs to `~/.openclaw/extensions/x402-proxy/`.
|
|
19
|
+
|
|
20
|
+
## Step 2: Configure wallet
|
|
21
|
+
|
|
22
|
+
The plugin resolves a Solana wallet using the same cascade as the CLI:
|
|
23
|
+
|
|
24
|
+
1. `keypairPath` in plugin config (solana-keygen JSON file)
|
|
25
|
+
2. `X402_PROXY_WALLET_SOLANA_KEY` env var (base58 or JSON array)
|
|
26
|
+
3. `X402_PROXY_WALLET_MNEMONIC` env var (BIP-39, derives both Solana and EVM)
|
|
27
|
+
4. `~/.config/x402-proxy/wallet.json` (auto-created by `npx x402-proxy setup`)
|
|
28
|
+
|
|
29
|
+
Easiest path - run setup first, then the plugin picks up the wallet automatically:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx x402-proxy setup
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Or set an explicit keypair in plugin config (step 3).
|
|
36
|
+
|
|
37
|
+
## Step 3: Configure providers and models
|
|
38
|
+
|
|
39
|
+
Add the plugin config to your `openclaw.json` (or via `openclaw config edit`):
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"plugins": {
|
|
44
|
+
"entries": {
|
|
45
|
+
"x402-proxy": {
|
|
46
|
+
"config": {
|
|
47
|
+
"providers": {
|
|
48
|
+
"surf-inference": {
|
|
49
|
+
"baseUrl": "/x402/v1",
|
|
50
|
+
"upstreamUrl": "https://surf.cascade.fyi/api/v1/inference",
|
|
51
|
+
"models": [
|
|
52
|
+
{ "id": "anthropic/claude-opus-4.6", "name": "Claude Opus 4.6", "maxTokens": 200000, "reasoning": true, "input": ["text", "image"], "cost": { "input": 0.015, "output": 0.075, "cacheRead": 0.0015, "cacheWrite": 0.01875 }, "contextWindow": 200000 },
|
|
53
|
+
{ "id": "anthropic/claude-sonnet-4.6", "name": "Claude Sonnet 4.6", "maxTokens": 200000, "reasoning": true, "input": ["text", "image"], "cost": { "input": 0.003, "output": 0.015, "cacheRead": 0.0003, "cacheWrite": 0.00375 }, "contextWindow": 200000 },
|
|
54
|
+
{ "id": "anthropic/claude-opus-4.5", "name": "Claude Opus 4.5", "maxTokens": 200000, "reasoning": true, "input": ["text", "image"], "cost": { "input": 0.015, "output": 0.075, "cacheRead": 0.0015, "cacheWrite": 0.01875 }, "contextWindow": 200000 },
|
|
55
|
+
{ "id": "anthropic/claude-sonnet-4.5", "name": "Claude Sonnet 4.5", "maxTokens": 200000, "reasoning": true, "input": ["text", "image"], "cost": { "input": 0.003, "output": 0.015, "cacheRead": 0.0003, "cacheWrite": 0.00375 }, "contextWindow": 200000 },
|
|
56
|
+
{ "id": "x-ai/grok-4.20-beta", "name": "Grok 4.20 Beta", "maxTokens": 131072, "reasoning": true, "input": ["text"], "cost": { "input": 0.003, "output": 0.015, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 131072 },
|
|
57
|
+
{ "id": "x-ai/grok-4.20-multi-agent-beta", "name": "Grok 4.20 Multi-Agent", "maxTokens": 131072, "reasoning": true, "input": ["text"], "cost": { "input": 0.003, "output": 0.015, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 131072 },
|
|
58
|
+
{ "id": "x-ai/grok-4.1-fast", "name": "Grok 4.1 Fast", "maxTokens": 131072, "reasoning": false, "input": ["text"], "cost": { "input": 0.001, "output": 0.005, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 131072 },
|
|
59
|
+
{ "id": "x-ai/grok-4.20-beta:online", "name": "Grok 4.20 Beta (Online)", "maxTokens": 131072, "reasoning": true, "input": ["text"], "cost": { "input": 0.005, "output": 0.025, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 131072 },
|
|
60
|
+
{ "id": "x-ai/grok-4.20-multi-agent-beta:online", "name": "Grok 4.20 Multi-Agent (Online)", "maxTokens": 131072, "reasoning": true, "input": ["text"], "cost": { "input": 0.005, "output": 0.025, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 131072 },
|
|
61
|
+
{ "id": "x-ai/grok-4.1-fast:online", "name": "Grok 4.1 Fast (Online)", "maxTokens": 131072, "reasoning": false, "input": ["text"], "cost": { "input": 0.003, "output": 0.015, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 131072 },
|
|
62
|
+
{ "id": "minimax/minimax-m2.7", "name": "MiniMax M2.7", "maxTokens": 1000000, "reasoning": false, "input": ["text"], "cost": { "input": 0.001, "output": 0.005, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 1000000 },
|
|
63
|
+
{ "id": "minimax/minimax-m2.5", "name": "MiniMax M2.5", "maxTokens": 1000000, "reasoning": false, "input": ["text"], "cost": { "input": 0.001, "output": 0.005, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 1000000 },
|
|
64
|
+
{ "id": "moonshotai/kimi-k2.5", "name": "Kimi K2.5", "maxTokens": 131072, "reasoning": true, "input": ["text"], "cost": { "input": 0.002, "output": 0.008, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 131072 },
|
|
65
|
+
{ "id": "z-ai/glm-5", "name": "GLM-5", "maxTokens": 128000, "reasoning": false, "input": ["text"], "cost": { "input": 0.001, "output": 0.005, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 128000 },
|
|
66
|
+
{ "id": "qwen/qwen-2.5-7b-instruct", "name": "Qwen 2.5 7B Instruct", "maxTokens": 32768, "reasoning": false, "input": ["text"], "cost": { "input": 0.0003, "output": 0.001, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 32768 }
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Config fields
|
|
78
|
+
|
|
79
|
+
| Field | Description |
|
|
80
|
+
|-------|-------------|
|
|
81
|
+
| `providers.<name>.baseUrl` | Route path registered in OpenClaw (e.g., `/x402/v1`) |
|
|
82
|
+
| `providers.<name>.upstreamUrl` | Actual upstream endpoint (e.g., `https://surf.cascade.fyi/api/v1/inference`) |
|
|
83
|
+
| `providers.<name>.models[]` | Model catalog array |
|
|
84
|
+
| `keypairPath` | Optional path to solana-keygen JSON file (overrides wallet resolution) |
|
|
85
|
+
| `rpcUrl` | Solana RPC URL (defaults to mainnet public endpoints with failover) |
|
|
86
|
+
| `dashboardUrl` | URL linked from `/x_wallet` dashboard |
|
|
87
|
+
|
|
88
|
+
### Model entry fields
|
|
89
|
+
|
|
90
|
+
| Field | Type | Description |
|
|
91
|
+
|-------|------|-------------|
|
|
92
|
+
| `id` | string | Model identifier (e.g., `anthropic/claude-opus-4.6`) |
|
|
93
|
+
| `name` | string | Display name |
|
|
94
|
+
| `maxTokens` | number | Max context length |
|
|
95
|
+
| `reasoning` | boolean | Supports extended thinking |
|
|
96
|
+
| `input` | string[] | Input modalities: `["text"]` or `["text", "image"]` |
|
|
97
|
+
| `cost.input` | number | USDC per 1K input tokens |
|
|
98
|
+
| `cost.output` | number | USDC per 1K output tokens |
|
|
99
|
+
| `cost.cacheRead` | number | USDC per 1K cached read tokens |
|
|
100
|
+
| `cost.cacheWrite` | number | USDC per 1K cache write tokens |
|
|
101
|
+
| `contextWindow` | number | Full context window size |
|
|
102
|
+
|
|
103
|
+
## Step 4: Restart gateway and verify
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
openclaw gateway restart
|
|
107
|
+
openclaw models # verify models appear
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## How it works
|
|
111
|
+
|
|
112
|
+
1. Plugin boots, loads wallet via the resolution cascade
|
|
113
|
+
2. Registers each provider from config into OpenClaw's model catalog (API type: `openai-completions`, no auth required)
|
|
114
|
+
3. HTTP route `/x402/*` intercepts inference requests, strips prefix, proxies to `upstreamUrl`
|
|
115
|
+
4. On 402 response, auto-signs a Solana USDC payment and retries
|
|
116
|
+
5. SSE streaming responses are parsed for token usage and logged to `~/.config/x402-proxy/history.jsonl`
|
|
117
|
+
6. Tools and command are available to all agents on the gateway
|
|
118
|
+
|
|
119
|
+
## Fetching latest models
|
|
120
|
+
|
|
121
|
+
The model list on `surf.cascade.fyi` changes over time. Fetch the current catalog:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
npx x402-proxy --protocol mpp --network solana \
|
|
125
|
+
https://surf.cascade.fyi/api/v1/inference/models
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Then update the `models` array in your plugin config accordingly.
|
|
129
|
+
|
|
130
|
+
## Troubleshooting
|
|
131
|
+
|
|
132
|
+
- **Models don't appear in `openclaw models`** - the plugin uses a `catalog` hook (not `models` field). Make sure you're on x402-proxy >= 0.8.5.
|
|
133
|
+
- **"no wallet found" in logs** - run `npx x402-proxy setup` or set `X402_PROXY_WALLET_MNEMONIC` env var before starting the gateway.
|
|
134
|
+
- **402 errors on inference** - check wallet has USDC balance: use `x_balance` tool or `npx x402-proxy wallet`.
|
|
135
|
+
- **Gateway cold start slow** - normal on small VMs (~72s). The `x402-wallet` service eagerly loads the wallet during boot.
|
package/dist/setup-lCsiivm2.js
DELETED