@openclaw/pixverse-provider 2026.9.5 → 2026.9.7
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/assets/icon.png +0 -0
- package/dist/constants.js +14 -1
- package/dist/onboard.js +10 -44
- package/dist/video-generation-provider.js +12 -31
- package/package.json +4 -4
package/assets/icon.png
CHANGED
|
Binary file
|
package/dist/constants.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
1
2
|
//#region extensions/pixverse/constants.ts
|
|
2
3
|
const PIXVERSE_PROVIDER_ID = "pixverse";
|
|
3
4
|
const PIXVERSE_BASE_URL_BY_REGION = {
|
|
@@ -7,5 +8,17 @@ const PIXVERSE_BASE_URL_BY_REGION = {
|
|
|
7
8
|
const DEFAULT_PIXVERSE_REGION = "international";
|
|
8
9
|
const DEFAULT_PIXVERSE_MODEL_ID = "v6";
|
|
9
10
|
const PIXVERSE_DEFAULT_VIDEO_MODEL_REF = `${PIXVERSE_PROVIDER_ID}/v6`;
|
|
11
|
+
function normalizePixVerseRegion(value) {
|
|
12
|
+
switch (normalizeOptionalLowercaseString(value)) {
|
|
13
|
+
case "cn":
|
|
14
|
+
case "china":
|
|
15
|
+
case "mainland":
|
|
16
|
+
case "pai": return "cn";
|
|
17
|
+
case "global":
|
|
18
|
+
case "intl":
|
|
19
|
+
case "international": return "international";
|
|
20
|
+
default: return;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
10
23
|
//#endregion
|
|
11
|
-
export { DEFAULT_PIXVERSE_MODEL_ID, DEFAULT_PIXVERSE_REGION, PIXVERSE_BASE_URL_BY_REGION, PIXVERSE_DEFAULT_VIDEO_MODEL_REF, PIXVERSE_PROVIDER_ID };
|
|
24
|
+
export { DEFAULT_PIXVERSE_MODEL_ID, DEFAULT_PIXVERSE_REGION, PIXVERSE_BASE_URL_BY_REGION, PIXVERSE_DEFAULT_VIDEO_MODEL_REF, PIXVERSE_PROVIDER_ID, normalizePixVerseRegion };
|
package/dist/onboard.js
CHANGED
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
import { DEFAULT_PIXVERSE_REGION, PIXVERSE_BASE_URL_BY_REGION, PIXVERSE_DEFAULT_VIDEO_MODEL_REF, PIXVERSE_PROVIDER_ID } from "./constants.js";
|
|
2
|
-
import { applyAuthProfileConfig, buildApiKeyCredential, ensureApiKeyFromOptionEnvOrPrompt, normalizeApiKeyInput, normalizeOptionalSecretInput, upsertAuthProfileWithLockOrThrow, validateApiKeyInput } from "openclaw/plugin-sdk/provider-auth-api-key";
|
|
1
|
+
import { DEFAULT_PIXVERSE_REGION, PIXVERSE_BASE_URL_BY_REGION, PIXVERSE_DEFAULT_VIDEO_MODEL_REF, PIXVERSE_PROVIDER_ID, normalizePixVerseRegion } from "./constants.js";
|
|
3
2
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
|
+
import { applyAuthProfileConfig, buildApiKeyCredential, captureProviderApiKey, normalizeOptionalSecretInput, persistProviderApiKey } from "openclaw/plugin-sdk/provider-auth-api-key";
|
|
4
4
|
//#region extensions/pixverse/onboard.ts
|
|
5
5
|
const PROFILE_ID = `${PIXVERSE_PROVIDER_ID}:default`;
|
|
6
|
-
function normalizePixVerseRegion(value) {
|
|
7
|
-
switch (normalizeOptionalString(value)?.toLowerCase()) {
|
|
8
|
-
case "cn":
|
|
9
|
-
case "china":
|
|
10
|
-
case "mainland":
|
|
11
|
-
case "pai": return "cn";
|
|
12
|
-
case "global":
|
|
13
|
-
case "intl":
|
|
14
|
-
case "international": return "international";
|
|
15
|
-
default: return;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
6
|
function pixVerseRegionNote(region) {
|
|
19
7
|
return `PixVerse endpoint: ${region === "cn" ? "CN" : "International"} (${PIXVERSE_BASE_URL_BY_REGION[region]})`;
|
|
20
8
|
}
|
|
@@ -71,36 +59,22 @@ async function promptForPixVerseRegion(ctx) {
|
|
|
71
59
|
});
|
|
72
60
|
}
|
|
73
61
|
async function runPixVerseApiKeyAuth(ctx) {
|
|
74
|
-
|
|
75
|
-
let capturedCredential = false;
|
|
76
|
-
let capturedMode;
|
|
77
|
-
await ensureApiKeyFromOptionEnvOrPrompt({
|
|
62
|
+
const { input, mode } = await captureProviderApiKey(ctx, {
|
|
78
63
|
token: normalizeOptionalSecretInput(ctx.opts?.pixverseApiKey) ?? normalizeOptionalSecretInput(ctx.opts?.token),
|
|
79
64
|
tokenProvider: normalizeOptionalSecretInput(ctx.opts?.pixverseApiKey) ? PIXVERSE_PROVIDER_ID : normalizeOptionalSecretInput(ctx.opts?.tokenProvider),
|
|
80
|
-
secretInputMode: ctx.allowSecretRefPrompt === false ? ctx.secretInputMode ?? "plaintext" : ctx.secretInputMode,
|
|
81
|
-
config: ctx.config,
|
|
82
65
|
env: ctx.env,
|
|
83
|
-
workspaceDir: ctx.workspaceDir,
|
|
84
66
|
expectedProviders: [PIXVERSE_PROVIDER_ID],
|
|
85
67
|
provider: PIXVERSE_PROVIDER_ID,
|
|
86
68
|
envLabel: "PIXVERSE_API_KEY",
|
|
87
69
|
promptMessage: "Enter PixVerse API key",
|
|
88
|
-
|
|
89
|
-
validate: validateApiKeyInput,
|
|
90
|
-
prompter: ctx.prompter,
|
|
91
|
-
setCredential: async (apiKey, mode) => {
|
|
92
|
-
capturedSecretInput = apiKey;
|
|
93
|
-
capturedCredential = true;
|
|
94
|
-
capturedMode = mode;
|
|
95
|
-
}
|
|
70
|
+
missingInputMessage: "Missing PixVerse API key."
|
|
96
71
|
});
|
|
97
|
-
if (!capturedCredential) throw new Error("Missing PixVerse API key.");
|
|
98
72
|
const region = await promptForPixVerseRegion(ctx);
|
|
99
73
|
return {
|
|
100
74
|
profiles: [{
|
|
101
75
|
profileId: PROFILE_ID,
|
|
102
|
-
credential: buildApiKeyCredential(PIXVERSE_PROVIDER_ID,
|
|
103
|
-
secretInputMode:
|
|
76
|
+
credential: buildApiKeyCredential(PIXVERSE_PROVIDER_ID, input, void 0, mode ? {
|
|
77
|
+
secretInputMode: mode,
|
|
104
78
|
config: ctx.config
|
|
105
79
|
} : void 0)
|
|
106
80
|
}],
|
|
@@ -116,18 +90,10 @@ async function runPixVerseApiKeyAuthNonInteractive(ctx) {
|
|
|
116
90
|
envVar: "PIXVERSE_API_KEY"
|
|
117
91
|
});
|
|
118
92
|
if (!resolved) return null;
|
|
119
|
-
if (
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
});
|
|
124
|
-
if (!credential) return null;
|
|
125
|
-
await upsertAuthProfileWithLockOrThrow({
|
|
126
|
-
profileId: PROFILE_ID,
|
|
127
|
-
credential,
|
|
128
|
-
agentDir: ctx.agentDir
|
|
129
|
-
});
|
|
130
|
-
}
|
|
93
|
+
if (!await persistProviderApiKey(ctx, PROFILE_ID, {
|
|
94
|
+
provider: "pixverse",
|
|
95
|
+
resolved
|
|
96
|
+
})) return null;
|
|
131
97
|
const next = applyAuthProfileConfig(ctx.config, {
|
|
132
98
|
profileId: PROFILE_ID,
|
|
133
99
|
provider: PIXVERSE_PROVIDER_ID,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_PIXVERSE_REGION, PIXVERSE_BASE_URL_BY_REGION, PIXVERSE_PROVIDER_ID } from "./constants.js";
|
|
1
|
+
import { DEFAULT_PIXVERSE_REGION, PIXVERSE_BASE_URL_BY_REGION, PIXVERSE_PROVIDER_ID, normalizePixVerseRegion } from "./constants.js";
|
|
2
2
|
import { asFiniteNumber, asSafeIntegerInRange, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { bufferToBlobPart } from "openclaw/plugin-sdk/blob-runtime";
|
|
@@ -40,17 +40,9 @@ function resolvePixVerseBaseUrl(req) {
|
|
|
40
40
|
}
|
|
41
41
|
function resolvePixVerseApiRegion(value) {
|
|
42
42
|
const region = normalizeOptionalString(value)?.toLowerCase();
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
case "mainland":
|
|
47
|
-
case "pai": return "cn";
|
|
48
|
-
case "global":
|
|
49
|
-
case "intl":
|
|
50
|
-
case "international":
|
|
51
|
-
case void 0: return DEFAULT_PIXVERSE_REGION;
|
|
52
|
-
default: throw new Error(`Unsupported PixVerse API region "${region}". Use "international" or "cn".`);
|
|
53
|
-
}
|
|
43
|
+
const normalized = normalizePixVerseRegion(region);
|
|
44
|
+
if (normalized || region === void 0) return normalized ?? "international";
|
|
45
|
+
throw new Error(`Unsupported PixVerse API region "${region}". Use "international" or "cn".`);
|
|
54
46
|
}
|
|
55
47
|
function normalizePixVerseModel(model) {
|
|
56
48
|
return (normalizeOptionalString(model)?.replace(/^pixverse\//iu, ""))?.toLowerCase() || "v6";
|
|
@@ -65,27 +57,12 @@ function resolvePixVerseDurationSeconds(value) {
|
|
|
65
57
|
if (typeof value !== "number" || !Number.isFinite(value)) return 5;
|
|
66
58
|
return Math.max(1, Math.min(MAX_DURATION_SECONDS, Math.round(value)));
|
|
67
59
|
}
|
|
68
|
-
function appendOptionalNumber(body, key, value) {
|
|
69
|
-
const numberValue = asFiniteNumber(value);
|
|
70
|
-
if (numberValue != null) body[key] = numberValue;
|
|
71
|
-
}
|
|
72
|
-
function appendOptionalInt32Seed(body, value) {
|
|
73
|
-
const seed = asSafeIntegerInRange(value, {
|
|
74
|
-
min: 0,
|
|
75
|
-
max: PIXVERSE_SEED_MAX
|
|
76
|
-
});
|
|
77
|
-
if (seed !== void 0) body.seed = seed;
|
|
78
|
-
}
|
|
79
60
|
function readPixVerseSeed(value) {
|
|
80
61
|
return asSafeIntegerInRange(value, {
|
|
81
62
|
min: 0,
|
|
82
63
|
max: PIXVERSE_SEED_MAX
|
|
83
64
|
});
|
|
84
65
|
}
|
|
85
|
-
function appendOptionalString(body, key, value) {
|
|
86
|
-
const stringValue = normalizeOptionalString(value);
|
|
87
|
-
if (stringValue) body[key] = stringValue;
|
|
88
|
-
}
|
|
89
66
|
function buildPixVerseHeaders(headers, contentType) {
|
|
90
67
|
const next = new Headers(headers);
|
|
91
68
|
next.set("Ai-trace-id", randomUUID());
|
|
@@ -147,10 +124,14 @@ function buildVideoBody(req, model, imageId) {
|
|
|
147
124
|
body.img_id = imageId;
|
|
148
125
|
body.motion_mode = normalizeOptionalString(options.motion_mode) ?? normalizeOptionalString(options.motionMode) ?? "normal";
|
|
149
126
|
} else body.aspect_ratio = normalizeOptionalString(req.aspectRatio) ?? "16:9";
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
127
|
+
const negativePrompt = normalizeOptionalString(options.negative_prompt) ?? normalizeOptionalString(options.negativePrompt);
|
|
128
|
+
if (negativePrompt) body.negative_prompt = negativePrompt;
|
|
129
|
+
const cameraMovement = normalizeOptionalString(options.camera_movement) ?? normalizeOptionalString(options.cameraMovement);
|
|
130
|
+
if (cameraMovement) body.camera_movement = cameraMovement;
|
|
131
|
+
const templateId = asFiniteNumber(options.template_id) ?? asFiniteNumber(options.templateId);
|
|
132
|
+
if (templateId != null) body.template_id = templateId;
|
|
133
|
+
const seed = readPixVerseSeed(options.seed);
|
|
134
|
+
if (seed !== void 0) body.seed = seed;
|
|
154
135
|
if (req.audio !== void 0) body.generate_audio_switch = req.audio;
|
|
155
136
|
return body;
|
|
156
137
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/pixverse-provider",
|
|
3
|
-
"version": "2026.9.
|
|
3
|
+
"version": "2026.9.7",
|
|
4
4
|
"description": "OpenClaw PixVerse video generation provider plugin.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"peerDependencies": {
|
|
11
|
-
"openclaw": ">=2026.9.
|
|
11
|
+
"openclaw": ">=2026.9.7"
|
|
12
12
|
},
|
|
13
13
|
"peerDependenciesMeta": {
|
|
14
14
|
"openclaw": {
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"minHostVersion": ">=2026.5.26"
|
|
27
27
|
},
|
|
28
28
|
"compat": {
|
|
29
|
-
"pluginApi": ">=2026.9.
|
|
29
|
+
"pluginApi": ">=2026.9.7"
|
|
30
30
|
},
|
|
31
31
|
"build": {
|
|
32
|
-
"openclawVersion": "2026.9.
|
|
32
|
+
"openclawVersion": "2026.9.7",
|
|
33
33
|
"bundledDist": false
|
|
34
34
|
},
|
|
35
35
|
"release": {
|