@openclaw/anthropic-vertex-provider 2026.6.5 → 2026.6.6-beta.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/dist/index.js +3 -1
- package/dist/provider-catalog.js +57 -3
- package/dist/provider-policy-api.js +1 -1
- package/dist/stream-runtime.js +33 -15
- package/npm-shrinkwrap.json +2 -2
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { hasAnthropicVertexAvailableAuth, resolveAnthropicVertexConfigApiKey } from "./region.js";
|
|
2
|
+
import { normalizeAnthropicVertexResolvedModel } from "./provider-catalog.js";
|
|
2
3
|
import { mergeImplicitAnthropicVertexProvider, resolveImplicitAnthropicVertexProvider } from "./api.js";
|
|
3
4
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
4
5
|
import { readConfiguredProviderCatalogEntries } from "openclaw/plugin-sdk/provider-catalog-shared";
|
|
@@ -34,7 +35,8 @@ var anthropic_vertex_default = definePluginEntry({
|
|
|
34
35
|
},
|
|
35
36
|
resolveConfigApiKey: ({ env }) => resolveAnthropicVertexConfigApiKey(env),
|
|
36
37
|
...NATIVE_ANTHROPIC_REPLAY_HOOKS,
|
|
37
|
-
|
|
38
|
+
normalizeResolvedModel: ({ modelId, model }) => normalizeAnthropicVertexResolvedModel(modelId, model),
|
|
39
|
+
resolveThinkingProfile: ({ modelId, params }) => resolveClaudeThinkingProfile(modelId, params, { includeNativeMax: true }),
|
|
38
40
|
resolveSyntheticAuth: () => {
|
|
39
41
|
if (!hasAnthropicVertexAvailableAuth()) return;
|
|
40
42
|
return {
|
package/dist/provider-catalog.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { resolveAnthropicVertexRegion } from "./region.js";
|
|
2
|
+
import { resolveClaudeFable5ModelIdentity } from "openclaw/plugin-sdk/provider-model-shared";
|
|
2
3
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
4
|
//#region extensions/anthropic-vertex/provider-catalog.ts
|
|
4
5
|
/** Default Anthropic Vertex model used for implicit provider catalogs. */
|
|
5
6
|
const ANTHROPIC_VERTEX_DEFAULT_MODEL_ID = "claude-sonnet-4-6";
|
|
6
7
|
const ANTHROPIC_VERTEX_DEFAULT_CONTEXT_WINDOW = 1e6;
|
|
8
|
+
const ANTHROPIC_VERTEX_FABLE_MAX_TOKENS = 128e3;
|
|
7
9
|
const GCP_VERTEX_CREDENTIALS_MARKER = "gcp-vertex-credentials";
|
|
8
10
|
function buildAnthropicVertexModel(params) {
|
|
9
11
|
return {
|
|
@@ -19,6 +21,25 @@ function buildAnthropicVertexModel(params) {
|
|
|
19
21
|
}
|
|
20
22
|
function buildAnthropicVertexCatalog() {
|
|
21
23
|
return [
|
|
24
|
+
buildAnthropicVertexModel({
|
|
25
|
+
id: "claude-fable-5",
|
|
26
|
+
name: "Claude Fable 5",
|
|
27
|
+
reasoning: true,
|
|
28
|
+
input: ["text", "image"],
|
|
29
|
+
cost: {
|
|
30
|
+
input: 10,
|
|
31
|
+
output: 50,
|
|
32
|
+
cacheRead: 1,
|
|
33
|
+
cacheWrite: 12.5
|
|
34
|
+
},
|
|
35
|
+
maxTokens: ANTHROPIC_VERTEX_FABLE_MAX_TOKENS,
|
|
36
|
+
thinkingLevelMap: {
|
|
37
|
+
off: "low",
|
|
38
|
+
minimal: "low",
|
|
39
|
+
xhigh: "xhigh",
|
|
40
|
+
max: "max"
|
|
41
|
+
}
|
|
42
|
+
}),
|
|
22
43
|
buildAnthropicVertexModel({
|
|
23
44
|
id: "claude-opus-4-8",
|
|
24
45
|
name: "Claude Opus 4.8",
|
|
@@ -47,7 +68,11 @@ function buildAnthropicVertexCatalog() {
|
|
|
47
68
|
cacheRead: .5,
|
|
48
69
|
cacheWrite: 6.25
|
|
49
70
|
},
|
|
50
|
-
maxTokens: 128e3
|
|
71
|
+
maxTokens: 128e3,
|
|
72
|
+
thinkingLevelMap: {
|
|
73
|
+
xhigh: null,
|
|
74
|
+
max: "max"
|
|
75
|
+
}
|
|
51
76
|
}),
|
|
52
77
|
buildAnthropicVertexModel({
|
|
53
78
|
id: ANTHROPIC_VERTEX_DEFAULT_MODEL_ID,
|
|
@@ -60,10 +85,39 @@ function buildAnthropicVertexCatalog() {
|
|
|
60
85
|
cacheRead: .3,
|
|
61
86
|
cacheWrite: 3.75
|
|
62
87
|
},
|
|
63
|
-
maxTokens: 128e3
|
|
88
|
+
maxTokens: 128e3,
|
|
89
|
+
thinkingLevelMap: {
|
|
90
|
+
xhigh: null,
|
|
91
|
+
max: "max"
|
|
92
|
+
}
|
|
64
93
|
})
|
|
65
94
|
];
|
|
66
95
|
}
|
|
96
|
+
/** Restore required Fable metadata after explicit catalog models replace the implicit row. */
|
|
97
|
+
function normalizeAnthropicVertexResolvedModel(modelId, model) {
|
|
98
|
+
if (!resolveClaudeFable5ModelIdentity({
|
|
99
|
+
id: modelId,
|
|
100
|
+
params: model.params
|
|
101
|
+
})) return;
|
|
102
|
+
const input = model.input.includes("image") ? model.input : [...model.input, "image"];
|
|
103
|
+
const thinkingLevelMap = {
|
|
104
|
+
off: "low",
|
|
105
|
+
minimal: "low",
|
|
106
|
+
xhigh: "xhigh",
|
|
107
|
+
max: "max",
|
|
108
|
+
...model.thinkingLevelMap
|
|
109
|
+
};
|
|
110
|
+
if (model.reasoning && input === model.input && model.contextWindow === ANTHROPIC_VERTEX_DEFAULT_CONTEXT_WINDOW && model.contextTokens === ANTHROPIC_VERTEX_DEFAULT_CONTEXT_WINDOW && (model.maxTokens ?? 0) >= ANTHROPIC_VERTEX_FABLE_MAX_TOKENS && model.thinkingLevelMap?.off === "low" && model.thinkingLevelMap.minimal === "low" && model.thinkingLevelMap.xhigh === "xhigh" && model.thinkingLevelMap.max === "max") return;
|
|
111
|
+
return {
|
|
112
|
+
...model,
|
|
113
|
+
reasoning: true,
|
|
114
|
+
input,
|
|
115
|
+
contextWindow: ANTHROPIC_VERTEX_DEFAULT_CONTEXT_WINDOW,
|
|
116
|
+
contextTokens: ANTHROPIC_VERTEX_DEFAULT_CONTEXT_WINDOW,
|
|
117
|
+
maxTokens: Math.max(model.maxTokens ?? 0, ANTHROPIC_VERTEX_FABLE_MAX_TOKENS),
|
|
118
|
+
thinkingLevelMap
|
|
119
|
+
};
|
|
120
|
+
}
|
|
67
121
|
/** Build the implicit Anthropic Vertex provider config for the current env. */
|
|
68
122
|
function buildAnthropicVertexProvider(params) {
|
|
69
123
|
const region = resolveAnthropicVertexRegion(params?.env);
|
|
@@ -75,4 +129,4 @@ function buildAnthropicVertexProvider(params) {
|
|
|
75
129
|
};
|
|
76
130
|
}
|
|
77
131
|
//#endregion
|
|
78
|
-
export { ANTHROPIC_VERTEX_DEFAULT_MODEL_ID, buildAnthropicVertexProvider };
|
|
132
|
+
export { ANTHROPIC_VERTEX_DEFAULT_MODEL_ID, buildAnthropicVertexProvider, normalizeAnthropicVertexResolvedModel };
|
|
@@ -7,7 +7,7 @@ import { resolveClaudeThinkingProfile } from "openclaw/plugin-sdk/provider-model
|
|
|
7
7
|
/** Resolve Anthropic Vertex thinking profile for a provider/model pair. */
|
|
8
8
|
function resolveThinkingProfile(params) {
|
|
9
9
|
if (params.provider.trim().toLowerCase() !== "anthropic-vertex") return null;
|
|
10
|
-
return resolveClaudeThinkingProfile(params.modelId);
|
|
10
|
+
return resolveClaudeThinkingProfile(params.modelId, params.params, { includeNativeMax: true });
|
|
11
11
|
}
|
|
12
12
|
//#endregion
|
|
13
13
|
export { resolveThinkingProfile };
|
package/dist/stream-runtime.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { resolveAnthropicVertexClientRegion, resolveAnthropicVertexProjectId } from "./region.js";
|
|
2
|
+
import { resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, supportsClaudeAdaptiveThinking, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort } from "openclaw/plugin-sdk/provider-model-shared";
|
|
2
3
|
import { AnthropicVertex } from "@anthropic-ai/vertex-sdk";
|
|
3
|
-
import { stream } from "openclaw/plugin-sdk/llm";
|
|
4
|
+
import { clampThinkingLevel, stream } from "openclaw/plugin-sdk/llm";
|
|
4
5
|
import { applyAnthropicPayloadPolicyToParams, resolveAnthropicPayloadPolicy } from "openclaw/plugin-sdk/provider-stream-shared";
|
|
5
6
|
//#region extensions/anthropic-vertex/stream-runtime.ts
|
|
6
7
|
/**
|
|
@@ -12,23 +13,33 @@ const defaultAnthropicVertexStreamDeps = {
|
|
|
12
13
|
streamAnthropic: stream
|
|
13
14
|
};
|
|
14
15
|
function isClaudeOpus47OrNewerModel(modelId) {
|
|
15
|
-
return
|
|
16
|
+
return supportsClaudeNativeXhighEffort({ id: modelId });
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
-
return
|
|
18
|
+
function isClaudeFable5Model(modelId) {
|
|
19
|
+
return resolveClaudeFable5ModelIdentity({ id: modelId }) !== void 0;
|
|
20
|
+
}
|
|
21
|
+
function isClaudeMythos5Model(modelId) {
|
|
22
|
+
return /(?:^|-)claude-mythos-5(?=$|[^a-z0-9])/.test(resolveClaudeModelIdentity({ id: modelId }));
|
|
19
23
|
}
|
|
20
24
|
function supportsAdaptiveThinking(modelId) {
|
|
21
|
-
return
|
|
25
|
+
return supportsClaudeAdaptiveThinking({ id: modelId }) || isClaudeMythos5Model(modelId);
|
|
22
26
|
}
|
|
23
|
-
function mapAnthropicAdaptiveEffort(reasoning, modelId) {
|
|
27
|
+
function mapAnthropicAdaptiveEffort(reasoning, model, modelId) {
|
|
28
|
+
const resolvedReasoning = clampThinkingLevel(typeof model.params?.canonicalModelId === "string" ? {
|
|
29
|
+
...model,
|
|
30
|
+
reasoning: true
|
|
31
|
+
} : model, reasoning);
|
|
32
|
+
const mapped = model.thinkingLevelMap?.[resolvedReasoning];
|
|
33
|
+
if (typeof mapped === "string") return mapped;
|
|
24
34
|
return {
|
|
35
|
+
off: "low",
|
|
25
36
|
minimal: "low",
|
|
26
37
|
low: "low",
|
|
27
38
|
medium: "medium",
|
|
28
39
|
high: "high",
|
|
29
|
-
xhigh:
|
|
30
|
-
max:
|
|
31
|
-
}[
|
|
40
|
+
xhigh: isClaudeFable5Model(modelId) ? "xhigh" : isClaudeOpus47OrNewerModel(modelId) || isClaudeMythos5Model(modelId) ? "xhigh" : "high",
|
|
41
|
+
max: supportsClaudeNativeMaxEffort({ id: modelId }) || isClaudeMythos5Model(modelId) ? "max" : "high"
|
|
42
|
+
}[resolvedReasoning] ?? "high";
|
|
32
43
|
}
|
|
33
44
|
function resolveAnthropicVertexMaxTokens(params) {
|
|
34
45
|
const modelMax = typeof params.modelMaxTokens === "number" && Number.isFinite(params.modelMaxTokens) && params.modelMaxTokens > 0 ? Math.floor(params.modelMaxTokens) : void 0;
|
|
@@ -73,7 +84,11 @@ function createAnthropicVertexStreamFn(projectId, region, baseURL, deps = defaul
|
|
|
73
84
|
modelMaxTokens: transportModel.maxTokens,
|
|
74
85
|
requestedMaxTokens: options?.maxTokens
|
|
75
86
|
});
|
|
76
|
-
const
|
|
87
|
+
const contractModelId = resolveClaudeModelIdentity(model);
|
|
88
|
+
const fable5 = isClaudeFable5Model(contractModelId);
|
|
89
|
+
const mandatoryAdaptiveThinking = fable5 || isClaudeMythos5Model(contractModelId);
|
|
90
|
+
const reasoning = options?.reasoning ?? (mandatoryAdaptiveThinking ? "high" : void 0);
|
|
91
|
+
const temperature = mandatoryAdaptiveThinking || Boolean(reasoning && supportsAdaptiveThinking(contractModelId)) || isClaudeOpus47OrNewerModel(contractModelId) || isClaudeMythos5Model(contractModelId) ? void 0 : options?.temperature;
|
|
77
92
|
const opts = {
|
|
78
93
|
client,
|
|
79
94
|
...temperature !== void 0 ? { temperature } : {},
|
|
@@ -90,15 +105,18 @@ function createAnthropicVertexStreamFn(projectId, region, baseURL, deps = defaul
|
|
|
90
105
|
maxRetryDelayMs: options?.maxRetryDelayMs,
|
|
91
106
|
metadata: options?.metadata
|
|
92
107
|
};
|
|
93
|
-
if (
|
|
108
|
+
if (reasoning) if (supportsAdaptiveThinking(contractModelId)) {
|
|
94
109
|
opts.thinkingEnabled = true;
|
|
95
|
-
opts.effort = mapAnthropicAdaptiveEffort(
|
|
110
|
+
opts.effort = mapAnthropicAdaptiveEffort(reasoning, transportModel, contractModelId);
|
|
96
111
|
} else {
|
|
97
112
|
opts.thinkingEnabled = true;
|
|
98
|
-
const budgets = options
|
|
99
|
-
opts.thinkingBudgetTokens = (budgets &&
|
|
113
|
+
const budgets = options?.thinkingBudgets;
|
|
114
|
+
opts.thinkingBudgetTokens = (budgets && reasoning in budgets ? budgets[reasoning] : void 0) ?? 1e4;
|
|
100
115
|
}
|
|
101
|
-
else
|
|
116
|
+
else if (fable5) {
|
|
117
|
+
opts.thinkingEnabled = true;
|
|
118
|
+
opts.effort = "high";
|
|
119
|
+
} else opts.thinkingEnabled = false;
|
|
102
120
|
return deps.streamAnthropic(transportModel, context, opts);
|
|
103
121
|
};
|
|
104
122
|
}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/anthropic-vertex-provider",
|
|
3
|
-
"version": "2026.6.
|
|
3
|
+
"version": "2026.6.6-beta.2",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@openclaw/anthropic-vertex-provider",
|
|
9
|
-
"version": "2026.6.
|
|
9
|
+
"version": "2026.6.6-beta.2",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/vertex-sdk": "0.16.1"
|
|
12
12
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/anthropic-vertex-provider",
|
|
3
|
-
"version": "2026.6.
|
|
3
|
+
"version": "2026.6.6-beta.2",
|
|
4
4
|
"description": "OpenClaw Anthropic Vertex provider plugin for Claude models on Google Vertex AI.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"minHostVersion": ">=2026.5.12-beta.1"
|
|
21
21
|
},
|
|
22
22
|
"compat": {
|
|
23
|
-
"pluginApi": ">=2026.6.
|
|
23
|
+
"pluginApi": ">=2026.6.6-beta.2"
|
|
24
24
|
},
|
|
25
25
|
"build": {
|
|
26
|
-
"openclawVersion": "2026.6.
|
|
26
|
+
"openclawVersion": "2026.6.6-beta.2",
|
|
27
27
|
"bundledDist": false
|
|
28
28
|
},
|
|
29
29
|
"release": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"README.md"
|
|
42
42
|
],
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"openclaw": ">=2026.6.
|
|
44
|
+
"openclaw": ">=2026.6.6-beta.2"
|
|
45
45
|
},
|
|
46
46
|
"peerDependenciesMeta": {
|
|
47
47
|
"openclaw": {
|