@5y/cli 0.1.4 → 0.1.5
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/README.md +7 -4
- package/lib/commands.mjs +7 -2
- package/lib/config.mjs +3 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -53,7 +53,13 @@ npm i -g @5y/cli # 或者直接 npx @5y/cli ...
|
|
|
53
53
|
5y upload ./frame.png
|
|
54
54
|
5y video --prompt "画面缓慢推进,光影流动" --asset image=<asset_id> --param mode=i2v_first --out ./out
|
|
55
55
|
|
|
56
|
-
# ⑤
|
|
56
|
+
# ⑤ 多素材参考生成视频(多张参考图 + 参考视频)
|
|
57
|
+
5y upload ./charA.png && 5y upload ./charB.png && 5y upload ./motion.mp4
|
|
58
|
+
5y video --prompt "以参考图 1、图 2 的角色形象,按参考视频的运镜生成一段追逐戏" \
|
|
59
|
+
--asset image=<A id> --asset image=<B id> --asset video=<motion id> \
|
|
60
|
+
--param mode=i2v_reference --out ./out
|
|
61
|
+
|
|
62
|
+
# ⑥ 视频编辑(换脸 / 替换):输入 4–30 秒,比例必须 adaptive、时长必须 -1
|
|
57
63
|
5y upload ./clip.mp4 && 5y upload ./face.png
|
|
58
64
|
5y video --prompt "把视频里的脸换成参考图的脸" \
|
|
59
65
|
--asset source_video=<clip id> --asset image=<face id> \
|
|
@@ -83,8 +89,5 @@ CI / 环境变量覆盖用 **`FIVEY_API_KEY`**、**`FIVEY_BASE_URL`**:
|
|
|
83
89
|
```bash
|
|
84
90
|
FIVEY_API_KEY=5y_xxx FIVEY_BASE_URL=https://5y.com.cn/api 5y models
|
|
85
91
|
```
|
|
86
|
-
|
|
87
|
-
> ⚠️ 旧写法 `5Y_API_KEY` 以数字开头,**POSIX shell 无法 `export`**;它只适用于
|
|
88
|
-
> `env 5Y_API_KEY=... 5y ...` 这种注入方式。
|
|
89
92
|
> ⚠️ 本机 `config.toml` 里的 `base_url` 会**覆盖**默认生产地址;若出现 401,
|
|
90
93
|
> 报错里会带上实际使用的 `base_url`,先看它是不是指向了本地/测试环境。
|
package/lib/commands.mjs
CHANGED
|
@@ -56,6 +56,10 @@ QUICK START (in order):
|
|
|
56
56
|
5y upload ./clip.mp4 && 5y upload ./face.png
|
|
57
57
|
5y video --prompt "把视频里的脸换成参考图的脸" --asset source_video=<clip id> --asset image=<face id> --param mode=video_edit --param ratio=adaptive --param duration=-1 --out ./out
|
|
58
58
|
|
|
59
|
+
# ⑥ 多素材参考生成视频(多张参考图 + 参考视频一起喂,适合角色/分镜一致性)
|
|
60
|
+
5y upload ./charA.png && 5y upload ./charB.png && 5y upload ./motion.mp4
|
|
61
|
+
5y video --prompt "以参考图 1、图 2 的角色形象,按参考视频的运镜生成一段追逐戏" --asset image=<A id> --asset image=<B id> --asset video=<motion id> --param mode=i2v_reference --out ./out
|
|
62
|
+
|
|
59
63
|
# 其他常用
|
|
60
64
|
5y image --prompt "..." --no-wait # 立即返回 job_id,之后 5y job get <job_id>
|
|
61
65
|
5y image --prompt "..." --callback http://127.0.0.1:8787/hook # 完成后由本机 CLI 通知
|
|
@@ -533,8 +537,6 @@ Save an API key locally (~/.config/5y/config.toml, mode 600).
|
|
|
533
537
|
--base-url override API base (default https://5y.com.cn/api; useful for self-hosted/dev)
|
|
534
538
|
|
|
535
539
|
Env override: FIVEY_API_KEY / FIVEY_BASE_URL (shell-friendly; CI only).
|
|
536
|
-
NOTE: 5Y_API_KEY starts with a digit and CANNOT be exported by POSIX shells.
|
|
537
|
-
Use FIVEY_* in shell/CI, or: env 5Y_API_KEY=... 5y ...
|
|
538
540
|
Verify with: 5y whoami`,
|
|
539
541
|
|
|
540
542
|
whoami: `5y whoami
|
|
@@ -624,6 +626,9 @@ and a 4-30s source_video.
|
|
|
624
626
|
# 图生视频:用一张首帧图动起来(先 5y upload ./frame.png)
|
|
625
627
|
5y video --prompt "画面缓慢推进,光影流动" --asset image=<asset_id> --param mode=i2v_first --out ./out
|
|
626
628
|
|
|
629
|
+
# 多素材参考:多张参考图 + 参考视频(--asset 可重复)
|
|
630
|
+
5y video --prompt "按参考图的角色形象、参考视频的运镜生成追逐戏" --asset image=<A> --asset image=<B> --asset video=<clip> --param mode=i2v_reference
|
|
631
|
+
|
|
627
632
|
# 视频编辑 / 换脸(输入 4-30 秒;比例 adaptive、时长 -1 是硬约束)
|
|
628
633
|
5y upload ./clip.mp4 && 5y upload ./face.png
|
|
629
634
|
5y video --prompt "把视频里的脸换成参考图的脸" --asset source_video=<clip id> --asset image=<face id> --param mode=video_edit --param ratio=adaptive --param duration=-1 --out ./out`,
|
package/lib/config.mjs
CHANGED
|
@@ -120,14 +120,12 @@ export function loadRuntimeConfig(flags = {}) {
|
|
|
120
120
|
const file = configFilePath();
|
|
121
121
|
const stored = readConfigFile(file);
|
|
122
122
|
|
|
123
|
-
//
|
|
124
|
-
// 所以正式名用 `FIVEY_API_KEY`;`5Y_API_KEY` 仍保留给 `env 5Y_API_KEY=... cmd` 这类注入。
|
|
123
|
+
// 环境变量名用 FIVEY_*(5Y_ 前缀以数字开头,POSIX shell 无法 export)。
|
|
125
124
|
const apiKey = String(
|
|
126
|
-
process.env['FIVEY_API_KEY'] ||
|
|
125
|
+
process.env['FIVEY_API_KEY'] || stored.api_key || ''
|
|
127
126
|
).trim();
|
|
128
127
|
const baseUrl = normalizeBaseUrl(
|
|
129
|
-
flags['base-url'] || process.env['FIVEY_BASE_URL'] ||
|
|
130
|
-
|| stored.base_url || DEFAULT_BASE_URL,
|
|
128
|
+
flags['base-url'] || process.env['FIVEY_BASE_URL'] || stored.base_url || DEFAULT_BASE_URL,
|
|
131
129
|
);
|
|
132
130
|
|
|
133
131
|
return {
|