x402-proxy-openclaw 0.11.3 → 0.11.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/dist/commands.js +1 -1
- package/dist/defaults.js +138 -14
- package/dist/openclaw/plugin.js +33 -15
- package/dist/openclaw.plugin.json +1 -4
- package/openclaw.plugin.json +1 -4
- package/package.json +1 -1
package/dist/commands.js
CHANGED
|
@@ -169,7 +169,7 @@ function createWalletCommand(ctx) {
|
|
|
169
169
|
if (parts[0]?.toLowerCase() === "send") return { text: "Use `/x_send <amount|all> <address>` for transfers." };
|
|
170
170
|
try {
|
|
171
171
|
const snap = await getWalletSnapshot(ctx.rpcUrl, solanaWallet, evmWallet, ctx.historyPath);
|
|
172
|
-
const lines = [`x402-proxy v0.11.
|
|
172
|
+
const lines = [`x402-proxy v0.11.4`];
|
|
173
173
|
lines.push("", `**Protocol** - ${ctx.getDefaultRequestProtocol()}`);
|
|
174
174
|
lines.push(`MPP session budget: ${ctx.getDefaultMppSessionBudget()} USDC`);
|
|
175
175
|
lines.push(`MPP ready: ${evmWallet ? "yes" : "no"}`);
|
package/dist/defaults.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
const DEFAULT_SURF_PROVIDER_ID = "surf";
|
|
3
3
|
const DEFAULT_SURF_BASE_URL = "/x402-proxy/v1";
|
|
4
4
|
const DEFAULT_SURF_UPSTREAM_URL = "https://surf.cascade.fyi/api/v1/inference";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
/** Known model metadata for cost/capability enrichment. */
|
|
6
|
+
const MODEL_METADATA = {
|
|
7
|
+
"anthropic/claude-opus-4.6": {
|
|
8
8
|
name: "Claude Opus 4.6",
|
|
9
9
|
maxTokens: 2e5,
|
|
10
10
|
reasoning: true,
|
|
@@ -17,8 +17,20 @@ const DEFAULT_SURF_MODELS = [
|
|
|
17
17
|
},
|
|
18
18
|
contextWindow: 2e5
|
|
19
19
|
},
|
|
20
|
-
{
|
|
21
|
-
|
|
20
|
+
"anthropic/claude-opus-4.5": {
|
|
21
|
+
name: "Claude Opus 4.5",
|
|
22
|
+
maxTokens: 2e5,
|
|
23
|
+
reasoning: true,
|
|
24
|
+
input: ["text", "image"],
|
|
25
|
+
cost: {
|
|
26
|
+
input: .015,
|
|
27
|
+
output: .075,
|
|
28
|
+
cacheRead: .0015,
|
|
29
|
+
cacheWrite: .01875
|
|
30
|
+
},
|
|
31
|
+
contextWindow: 2e5
|
|
32
|
+
},
|
|
33
|
+
"anthropic/claude-sonnet-4.6": {
|
|
22
34
|
name: "Claude Sonnet 4.6",
|
|
23
35
|
maxTokens: 2e5,
|
|
24
36
|
reasoning: true,
|
|
@@ -31,8 +43,20 @@ const DEFAULT_SURF_MODELS = [
|
|
|
31
43
|
},
|
|
32
44
|
contextWindow: 2e5
|
|
33
45
|
},
|
|
34
|
-
{
|
|
35
|
-
|
|
46
|
+
"anthropic/claude-sonnet-4.5": {
|
|
47
|
+
name: "Claude Sonnet 4.5",
|
|
48
|
+
maxTokens: 2e5,
|
|
49
|
+
reasoning: true,
|
|
50
|
+
input: ["text", "image"],
|
|
51
|
+
cost: {
|
|
52
|
+
input: .003,
|
|
53
|
+
output: .015,
|
|
54
|
+
cacheRead: 3e-4,
|
|
55
|
+
cacheWrite: .00375
|
|
56
|
+
},
|
|
57
|
+
contextWindow: 2e5
|
|
58
|
+
},
|
|
59
|
+
"x-ai/grok-4.20-beta": {
|
|
36
60
|
name: "Grok 4.20 Beta",
|
|
37
61
|
maxTokens: 131072,
|
|
38
62
|
reasoning: true,
|
|
@@ -45,8 +69,33 @@ const DEFAULT_SURF_MODELS = [
|
|
|
45
69
|
},
|
|
46
70
|
contextWindow: 131072
|
|
47
71
|
},
|
|
48
|
-
{
|
|
49
|
-
|
|
72
|
+
"x-ai/grok-4.1-fast": {
|
|
73
|
+
name: "Grok 4.1 Fast",
|
|
74
|
+
maxTokens: 131072,
|
|
75
|
+
reasoning: false,
|
|
76
|
+
input: ["text"],
|
|
77
|
+
cost: {
|
|
78
|
+
input: .001,
|
|
79
|
+
output: .005,
|
|
80
|
+
cacheRead: 0,
|
|
81
|
+
cacheWrite: 0
|
|
82
|
+
},
|
|
83
|
+
contextWindow: 131072
|
|
84
|
+
},
|
|
85
|
+
"minimax/minimax-m2.7": {
|
|
86
|
+
name: "MiniMax M2.7",
|
|
87
|
+
maxTokens: 1e6,
|
|
88
|
+
reasoning: false,
|
|
89
|
+
input: ["text"],
|
|
90
|
+
cost: {
|
|
91
|
+
input: .001,
|
|
92
|
+
output: .005,
|
|
93
|
+
cacheRead: 0,
|
|
94
|
+
cacheWrite: 0
|
|
95
|
+
},
|
|
96
|
+
contextWindow: 1e6
|
|
97
|
+
},
|
|
98
|
+
"minimax/minimax-m2.5": {
|
|
50
99
|
name: "MiniMax M2.5",
|
|
51
100
|
maxTokens: 1e6,
|
|
52
101
|
reasoning: false,
|
|
@@ -59,8 +108,7 @@ const DEFAULT_SURF_MODELS = [
|
|
|
59
108
|
},
|
|
60
109
|
contextWindow: 1e6
|
|
61
110
|
},
|
|
62
|
-
{
|
|
63
|
-
id: "moonshotai/kimi-k2.5",
|
|
111
|
+
"moonshotai/kimi-k2.5": {
|
|
64
112
|
name: "Kimi K2.5",
|
|
65
113
|
maxTokens: 131072,
|
|
66
114
|
reasoning: true,
|
|
@@ -73,8 +121,7 @@ const DEFAULT_SURF_MODELS = [
|
|
|
73
121
|
},
|
|
74
122
|
contextWindow: 131072
|
|
75
123
|
},
|
|
76
|
-
{
|
|
77
|
-
id: "z-ai/glm-5",
|
|
124
|
+
"z-ai/glm-5": {
|
|
78
125
|
name: "GLM-5",
|
|
79
126
|
maxTokens: 128e3,
|
|
80
127
|
reasoning: false,
|
|
@@ -86,8 +133,85 @@ const DEFAULT_SURF_MODELS = [
|
|
|
86
133
|
cacheWrite: 0
|
|
87
134
|
},
|
|
88
135
|
contextWindow: 128e3
|
|
136
|
+
},
|
|
137
|
+
"z-ai/glm-5-turbo": {
|
|
138
|
+
name: "GLM-5 Turbo",
|
|
139
|
+
maxTokens: 128e3,
|
|
140
|
+
reasoning: false,
|
|
141
|
+
input: ["text"],
|
|
142
|
+
cost: {
|
|
143
|
+
input: .001,
|
|
144
|
+
output: .005,
|
|
145
|
+
cacheRead: 0,
|
|
146
|
+
cacheWrite: 0
|
|
147
|
+
},
|
|
148
|
+
contextWindow: 128e3
|
|
149
|
+
},
|
|
150
|
+
"qwen/qwen-2.5-7b-instruct": {
|
|
151
|
+
name: "Qwen 2.5 7B Instruct",
|
|
152
|
+
maxTokens: 32768,
|
|
153
|
+
reasoning: false,
|
|
154
|
+
input: ["text"],
|
|
155
|
+
cost: {
|
|
156
|
+
input: 5e-4,
|
|
157
|
+
output: .002,
|
|
158
|
+
cacheRead: 0,
|
|
159
|
+
cacheWrite: 0
|
|
160
|
+
},
|
|
161
|
+
contextWindow: 131072
|
|
162
|
+
},
|
|
163
|
+
"stepfun/step-3.5-flash": {
|
|
164
|
+
name: "Step 3.5 Flash",
|
|
165
|
+
maxTokens: 131072,
|
|
166
|
+
reasoning: false,
|
|
167
|
+
input: ["text"],
|
|
168
|
+
cost: {
|
|
169
|
+
input: .001,
|
|
170
|
+
output: .005,
|
|
171
|
+
cacheRead: 0,
|
|
172
|
+
cacheWrite: 0
|
|
173
|
+
},
|
|
174
|
+
contextWindow: 131072
|
|
175
|
+
},
|
|
176
|
+
"xiaomi/mimo-v2-pro": {
|
|
177
|
+
name: "MiMo V2 Pro",
|
|
178
|
+
maxTokens: 131072,
|
|
179
|
+
reasoning: true,
|
|
180
|
+
input: ["text"],
|
|
181
|
+
cost: {
|
|
182
|
+
input: .001,
|
|
183
|
+
output: .005,
|
|
184
|
+
cacheRead: 0,
|
|
185
|
+
cacheWrite: 0
|
|
186
|
+
},
|
|
187
|
+
contextWindow: 131072
|
|
89
188
|
}
|
|
90
|
-
|
|
189
|
+
};
|
|
190
|
+
const DEFAULT_CONTEXT_WINDOW = 131072;
|
|
191
|
+
const ZERO_COST = {
|
|
192
|
+
input: 0,
|
|
193
|
+
output: 0,
|
|
194
|
+
cacheRead: 0,
|
|
195
|
+
cacheWrite: 0
|
|
196
|
+
};
|
|
197
|
+
function modelFromId(id) {
|
|
198
|
+
const known = MODEL_METADATA[id];
|
|
199
|
+
if (known) return {
|
|
200
|
+
id,
|
|
201
|
+
...known
|
|
202
|
+
};
|
|
203
|
+
return {
|
|
204
|
+
id,
|
|
205
|
+
name: (id.split("/").pop() ?? id).replace(/[-_]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase()),
|
|
206
|
+
maxTokens: DEFAULT_CONTEXT_WINDOW,
|
|
207
|
+
reasoning: false,
|
|
208
|
+
input: ["text"],
|
|
209
|
+
cost: ZERO_COST,
|
|
210
|
+
contextWindow: DEFAULT_CONTEXT_WINDOW
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
/** Static fallback models used when upstream fetch fails. */
|
|
214
|
+
const DEFAULT_SURF_MODELS = Object.keys(MODEL_METADATA).map(modelFromId);
|
|
91
215
|
function resolveProviders(config) {
|
|
92
216
|
const defaultProtocol = resolveProtocol(config.protocol);
|
|
93
217
|
const defaultMppSessionBudget = resolveMppSessionBudget(config.mppSessionBudget);
|
package/dist/openclaw/plugin.js
CHANGED
|
@@ -21,17 +21,37 @@ function register(api) {
|
|
|
21
21
|
const dashboardUrl = config.dashboardUrl || "";
|
|
22
22
|
const { providers, models: allModels } = resolveProviders(config);
|
|
23
23
|
const defaultProvider = providers[0];
|
|
24
|
+
function buildSurfAuthResult(gatewayPort) {
|
|
25
|
+
return {
|
|
26
|
+
profiles: [{
|
|
27
|
+
profileId: "surf:default",
|
|
28
|
+
credential: {
|
|
29
|
+
type: "api_key",
|
|
30
|
+
provider: "surf",
|
|
31
|
+
key: "x402-proxy-managed"
|
|
32
|
+
}
|
|
33
|
+
}],
|
|
34
|
+
configPatch: { models: { providers: { surf: {
|
|
35
|
+
baseUrl: `http://localhost:${gatewayPort}${defaultProvider.baseUrl}`,
|
|
36
|
+
api: "openai-completions",
|
|
37
|
+
authHeader: false,
|
|
38
|
+
models: defaultProvider.models
|
|
39
|
+
} } } },
|
|
40
|
+
defaultModel: defaultProvider.models[0]?.id
|
|
41
|
+
};
|
|
42
|
+
}
|
|
24
43
|
const walletAuthMethod = {
|
|
25
44
|
id: "wallet-setup",
|
|
26
45
|
label: "x402-proxy wallet setup",
|
|
27
46
|
hint: "Generate or import a crypto wallet for paid inference",
|
|
28
47
|
kind: "custom",
|
|
29
48
|
run: async (ctx) => {
|
|
49
|
+
const gatewayPort = ctx.config.gateway?.port ?? 18789;
|
|
30
50
|
const existing = resolveWallet();
|
|
31
51
|
if (existing.source !== "none") {
|
|
32
52
|
const addresses = [existing.evmAddress ? `EVM: ${existing.evmAddress}` : null, existing.solanaAddress ? `Solana: ${existing.solanaAddress}` : null].filter(Boolean).join("\n");
|
|
33
53
|
await ctx.prompter.note(`Wallet already configured (source: ${existing.source}).\n\n${addresses}`, "x402-proxy wallet");
|
|
34
|
-
return
|
|
54
|
+
return buildSurfAuthResult(gatewayPort);
|
|
35
55
|
}
|
|
36
56
|
const action = await ctx.prompter.select({
|
|
37
57
|
message: "How would you like to set up your x402-proxy wallet?",
|
|
@@ -67,14 +87,7 @@ function register(api) {
|
|
|
67
87
|
action === "generate" ? "\nRecover your mnemonic later with: npx x402-proxy wallet export-key mnemonic" : ""
|
|
68
88
|
].filter(Boolean).join("\n");
|
|
69
89
|
await ctx.prompter.note(msg, "Wallet created");
|
|
70
|
-
return
|
|
71
|
-
profileId: "surf:x402-proxy",
|
|
72
|
-
credential: {
|
|
73
|
-
type: "api_key",
|
|
74
|
-
provider: "surf",
|
|
75
|
-
key: "x402-proxy-managed"
|
|
76
|
-
}
|
|
77
|
-
}] };
|
|
90
|
+
return buildSurfAuthResult(gatewayPort);
|
|
78
91
|
}
|
|
79
92
|
};
|
|
80
93
|
for (const provider of providers) {
|
|
@@ -86,12 +99,17 @@ function register(api) {
|
|
|
86
99
|
resolveConfigApiKey: () => "x402-proxy-managed",
|
|
87
100
|
catalog: {
|
|
88
101
|
order: "simple",
|
|
89
|
-
run: async () =>
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
102
|
+
run: async (ctx) => {
|
|
103
|
+
const { apiKey } = ctx.resolveProviderApiKey(provider.id);
|
|
104
|
+
if (!apiKey) return null;
|
|
105
|
+
return { provider: {
|
|
106
|
+
baseUrl: provider.baseUrl,
|
|
107
|
+
api: "openai-completions",
|
|
108
|
+
authHeader: false,
|
|
109
|
+
apiKey,
|
|
110
|
+
models: provider.models
|
|
111
|
+
} };
|
|
112
|
+
}
|
|
95
113
|
}
|
|
96
114
|
});
|
|
97
115
|
}
|
|
@@ -5,9 +5,6 @@
|
|
|
5
5
|
"providers": [
|
|
6
6
|
"surf"
|
|
7
7
|
],
|
|
8
|
-
"autoEnableWhenConfiguredProviders": [
|
|
9
|
-
"surf"
|
|
10
|
-
],
|
|
11
8
|
"providerAuthChoices": [
|
|
12
9
|
{
|
|
13
10
|
"provider": "surf",
|
|
@@ -120,5 +117,5 @@
|
|
|
120
117
|
"advanced": true
|
|
121
118
|
}
|
|
122
119
|
},
|
|
123
|
-
"version": "0.11.
|
|
120
|
+
"version": "0.11.4"
|
|
124
121
|
}
|
package/openclaw.plugin.json
CHANGED
|
@@ -5,9 +5,6 @@
|
|
|
5
5
|
"providers": [
|
|
6
6
|
"surf"
|
|
7
7
|
],
|
|
8
|
-
"autoEnableWhenConfiguredProviders": [
|
|
9
|
-
"surf"
|
|
10
|
-
],
|
|
11
8
|
"providerAuthChoices": [
|
|
12
9
|
{
|
|
13
10
|
"provider": "surf",
|
|
@@ -120,5 +117,5 @@
|
|
|
120
117
|
"advanced": true
|
|
121
118
|
}
|
|
122
119
|
},
|
|
123
|
-
"version": "0.11.
|
|
120
|
+
"version": "0.11.4"
|
|
124
121
|
}
|
package/package.json
CHANGED