@openclaw/cloudflare-ai-gateway-provider 2026.9.8 → 2026.10.1-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 +19 -23
- package/dist/models.js +0 -3
- package/dist/onboard.js +8 -30
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -7,27 +7,26 @@ import { applyAuthProfileConfig, buildApiKeyCredential, ensureAuthProfileStore,
|
|
|
7
7
|
import { captureProviderApiKey, persistProviderApiKey } from "openclaw/plugin-sdk/provider-auth-api-key";
|
|
8
8
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
9
|
//#region extensions/cloudflare-ai-gateway/index.ts
|
|
10
|
-
/**
|
|
11
|
-
* Bundled provider plugin entry for Cloudflare AI Gateway setup, catalog
|
|
12
|
-
* discovery, failover classification, and stream wrapping.
|
|
13
|
-
*/
|
|
14
10
|
const PROVIDER_ID = "cloudflare-ai-gateway";
|
|
15
11
|
const PROVIDER_ENV_VAR = "CLOUDFLARE_AI_GATEWAY_API_KEY";
|
|
16
12
|
const PROFILE_ID = "cloudflare-ai-gateway:default";
|
|
17
|
-
function readRequiredTextInput(value) {
|
|
18
|
-
return normalizeOptionalString(value) ?? "";
|
|
19
|
-
}
|
|
20
13
|
async function resolveCloudflareGatewayMetadataInteractive(ctx) {
|
|
21
14
|
let accountId = normalizeOptionalString(ctx.accountId) ?? "";
|
|
22
15
|
let gatewayId = normalizeOptionalString(ctx.gatewayId) ?? "";
|
|
23
|
-
if (!accountId)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
16
|
+
if (!accountId) {
|
|
17
|
+
const value = await ctx.prompter.text({
|
|
18
|
+
message: "Enter Cloudflare Account ID",
|
|
19
|
+
validate: (val) => normalizeOptionalString(val) ? void 0 : "Account ID is required"
|
|
20
|
+
});
|
|
21
|
+
accountId = normalizeOptionalString(value) ?? "";
|
|
22
|
+
}
|
|
23
|
+
if (!gatewayId) {
|
|
24
|
+
const value = await ctx.prompter.text({
|
|
25
|
+
message: "Enter Cloudflare AI Gateway ID",
|
|
26
|
+
validate: (val) => normalizeOptionalString(val) ? void 0 : "Gateway ID is required"
|
|
27
|
+
});
|
|
28
|
+
gatewayId = normalizeOptionalString(value) ?? "";
|
|
29
|
+
}
|
|
31
30
|
return {
|
|
32
31
|
accountId,
|
|
33
32
|
gatewayId
|
|
@@ -74,20 +73,17 @@ var cloudflare_ai_gateway_default = definePluginEntry({
|
|
|
74
73
|
return {
|
|
75
74
|
profiles: [{
|
|
76
75
|
profileId: PROFILE_ID,
|
|
77
|
-
credential: buildApiKeyCredential(PROVIDER_ID, input, {
|
|
78
|
-
accountId: metadata.accountId,
|
|
79
|
-
gatewayId: metadata.gatewayId
|
|
80
|
-
}, mode ? { secretInputMode: mode } : void 0)
|
|
76
|
+
credential: buildApiKeyCredential(PROVIDER_ID, input, metadata, mode ? { secretInputMode: mode } : void 0)
|
|
81
77
|
}],
|
|
82
78
|
configPatch: applyCloudflareAiGatewayProviderConnectionConfig(ctx.config, metadata),
|
|
83
79
|
defaultModel: CLOUDFLARE_AI_GATEWAY_DEFAULT_MODEL_REF
|
|
84
80
|
};
|
|
85
81
|
},
|
|
86
82
|
runNonInteractive: async (ctx) => {
|
|
87
|
-
const
|
|
88
|
-
const storedMetadata =
|
|
89
|
-
accountId: normalizeOptionalString(
|
|
90
|
-
gatewayId: normalizeOptionalString(
|
|
83
|
+
const credential = ensureAuthProfileStore(ctx.agentDir, { allowKeychainPrompt: false }).profiles[PROFILE_ID];
|
|
84
|
+
const storedMetadata = credential?.type === "api_key" ? {
|
|
85
|
+
accountId: normalizeOptionalString(credential.metadata?.accountId),
|
|
86
|
+
gatewayId: normalizeOptionalString(credential.metadata?.gatewayId)
|
|
91
87
|
} : {};
|
|
92
88
|
const accountId = normalizeOptionalSecretInput(ctx.opts.cloudflareAiGatewayAccountId) ?? storedMetadata.accountId;
|
|
93
89
|
const gatewayId = normalizeOptionalSecretInput(ctx.opts.cloudflareAiGatewayGatewayId) ?? storedMetadata.gatewayId;
|
package/dist/models.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
//#region extensions/cloudflare-ai-gateway/models.ts
|
|
2
|
-
/** Provider id used in model refs and auth profiles. */
|
|
3
2
|
const CLOUDFLARE_AI_GATEWAY_PROVIDER_ID = "cloudflare-ai-gateway";
|
|
4
|
-
/** Default Cloudflare AI Gateway model id exposed by the bundled provider. */
|
|
5
3
|
const CLOUDFLARE_AI_GATEWAY_DEFAULT_MODEL_ID = "claude-sonnet-4-6";
|
|
6
|
-
/** Fully-qualified default model ref used by onboarding. */
|
|
7
4
|
const CLOUDFLARE_AI_GATEWAY_DEFAULT_MODEL_REF = `${CLOUDFLARE_AI_GATEWAY_PROVIDER_ID}/${CLOUDFLARE_AI_GATEWAY_DEFAULT_MODEL_ID}`;
|
|
8
5
|
const CLOUDFLARE_AI_GATEWAY_DEFAULT_CONTEXT_WINDOW = 2e5;
|
|
9
6
|
const CLOUDFLARE_AI_GATEWAY_DEFAULT_MAX_TOKENS = 64e3;
|
package/dist/onboard.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { CLOUDFLARE_AI_GATEWAY_DEFAULT_MODEL_REF, buildCloudflareAiGatewayModelDefinition, resolveCloudflareAiGatewayBaseUrl } from "./models.js";
|
|
2
|
-
import { applyAgentDefaultModelPrimary, applyProviderConfigWithDefaultModel, applyProviderConnectionConfig } from "openclaw/plugin-sdk/provider-onboard";
|
|
2
|
+
import { applyAgentDefaultModelPrimary, applyProviderConfigWithDefaultModel, applyProviderConnectionConfig, createAliasOnlyPresetAppliers } from "openclaw/plugin-sdk/provider-onboard";
|
|
3
3
|
//#region extensions/cloudflare-ai-gateway/onboard.ts
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Builds the minimal config patch for provider setup and default model aliasing.
|
|
10
|
-
*/
|
|
4
|
+
const { applyProviderConfig: applyCloudflareAiGatewayAlias } = createAliasOnlyPresetAppliers({
|
|
5
|
+
modelRef: CLOUDFLARE_AI_GATEWAY_DEFAULT_MODEL_REF,
|
|
6
|
+
alias: "Cloudflare AI Gateway"
|
|
7
|
+
});
|
|
11
8
|
function buildCloudflareAiGatewayConfigPatch(params) {
|
|
12
9
|
return {
|
|
13
10
|
models: { providers: { "cloudflare-ai-gateway": {
|
|
@@ -18,41 +15,22 @@ function buildCloudflareAiGatewayConfigPatch(params) {
|
|
|
18
15
|
agents: { defaults: { models: { [CLOUDFLARE_AI_GATEWAY_DEFAULT_MODEL_REF]: { alias: "Cloudflare AI Gateway" } } } }
|
|
19
16
|
};
|
|
20
17
|
}
|
|
21
|
-
/**
|
|
22
|
-
* Applies provider model config while preserving existing agent model aliases.
|
|
23
|
-
*/
|
|
24
18
|
function applyCloudflareAiGatewayProviderConfig(cfg, params) {
|
|
25
|
-
const
|
|
26
|
-
models[CLOUDFLARE_AI_GATEWAY_DEFAULT_MODEL_REF] = {
|
|
27
|
-
...models[CLOUDFLARE_AI_GATEWAY_DEFAULT_MODEL_REF],
|
|
28
|
-
alias: models[CLOUDFLARE_AI_GATEWAY_DEFAULT_MODEL_REF]?.alias ?? "Cloudflare AI Gateway"
|
|
29
|
-
};
|
|
19
|
+
const withAlias = applyCloudflareAiGatewayAlias(cfg);
|
|
30
20
|
const existingProvider = cfg.models?.providers?.["cloudflare-ai-gateway"];
|
|
31
21
|
const baseUrl = params?.accountId && params?.gatewayId ? resolveCloudflareAiGatewayBaseUrl({
|
|
32
22
|
accountId: params.accountId,
|
|
33
23
|
gatewayId: params.gatewayId
|
|
34
24
|
}) : typeof existingProvider?.baseUrl === "string" ? existingProvider.baseUrl : void 0;
|
|
35
|
-
if (!baseUrl) return
|
|
36
|
-
...cfg,
|
|
37
|
-
agents: {
|
|
38
|
-
...cfg.agents,
|
|
39
|
-
defaults: {
|
|
40
|
-
...cfg.agents?.defaults,
|
|
41
|
-
models
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
};
|
|
25
|
+
if (!baseUrl) return withAlias;
|
|
45
26
|
return applyProviderConfigWithDefaultModel(cfg, {
|
|
46
|
-
agentModels: models,
|
|
27
|
+
agentModels: withAlias.agents?.defaults?.models ?? {},
|
|
47
28
|
providerId: "cloudflare-ai-gateway",
|
|
48
29
|
api: "anthropic-messages",
|
|
49
30
|
baseUrl,
|
|
50
31
|
defaultModel: buildCloudflareAiGatewayModelDefinition()
|
|
51
32
|
});
|
|
52
33
|
}
|
|
53
|
-
/**
|
|
54
|
-
* Applies Cloudflare AI Gateway config and makes its default model primary.
|
|
55
|
-
*/
|
|
56
34
|
function applyCloudflareAiGatewayConfig(cfg, params) {
|
|
57
35
|
return applyAgentDefaultModelPrimary(applyCloudflareAiGatewayProviderConfig(cfg, params), CLOUDFLARE_AI_GATEWAY_DEFAULT_MODEL_REF);
|
|
58
36
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/cloudflare-ai-gateway-provider",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.10.1-beta.2",
|
|
4
4
|
"description": "OpenClaw Cloudflare AI Gateway provider plugin.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"minHostVersion": ">=2026.6.8"
|
|
19
19
|
},
|
|
20
20
|
"compat": {
|
|
21
|
-
"pluginApi": ">=2026.
|
|
21
|
+
"pluginApi": ">=2026.10.1-beta.2"
|
|
22
22
|
},
|
|
23
23
|
"build": {
|
|
24
|
-
"openclawVersion": "2026.
|
|
24
|
+
"openclawVersion": "2026.10.1-beta.2",
|
|
25
25
|
"bundledDist": false
|
|
26
26
|
},
|
|
27
27
|
"release": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"assets/activity.svg"
|
|
41
41
|
],
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"openclaw": ">=2026.
|
|
43
|
+
"openclaw": ">=2026.10.1-beta.2"
|
|
44
44
|
},
|
|
45
45
|
"peerDependenciesMeta": {
|
|
46
46
|
"openclaw": {
|