quickmagic-cli 1.4.0 → 1.5.0
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 +47 -7
- package/package.json +6 -3
- package/skills/README.md +6 -5
- package/skills/quickmagic-account/SKILL.md +5 -0
- package/skills/quickmagic-generate/SKILL.md +5 -1
- package/skills/quickmagic-music/SKILL.md +118 -0
- package/src/commands/jobs.js +44 -0
- package/src/commands/models.js +8 -1
- package/src/commands/music.js +109 -0
- package/src/index.js +38 -2
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
images/videos, product photoshoots, virtual try-on, hook ad videos, auto-subtitles/dubbing
|
|
9
9
|
and more, through the Quick Magic REST API. Sign-in is browser-based **OAuth PKCE** — no API
|
|
10
10
|
keys to copy around. Requires Node.js **≥ 18** (uses built-in `fetch`/`crypto`/`http`, no
|
|
11
|
-
`axios`). Also ships with
|
|
11
|
+
`axios`). Also ships with 10 Claude **Agent Skills** and an **MCP server** integration for
|
|
12
12
|
coding agents. Everything below this line is in Vietnamese (tiếng Việt) — quickstart only:
|
|
13
13
|
|
|
14
14
|
```bash
|
|
@@ -151,6 +151,10 @@ Ghi chú chung trước khi xem bảng:
|
|
|
151
151
|
| `qm voices list --model <m>` | Liệt kê giọng theo model + giá (`pricing`) | — |
|
|
152
152
|
| `qm voices clone --audio <file\|url> --name <n>` | Nhân bản giọng riêng (dùng cho qimi_5/5.5) | Có |
|
|
153
153
|
| `qm voices delete <id>` | Xoá giọng đã clone | — |
|
|
154
|
+
| `qm music models` | Bảng model nhạc + giá + ETA + hàng chờ | — |
|
|
155
|
+
| `qm music lyrics --desc <d>` | AI viết lời bài hát | Không (0đ) |
|
|
156
|
+
| `qm music create (--desc <d>\|--lyrics <l>)` | Tạo bài hát AI (mode simple/custom, 2 model melo-3/melo-2) | Có (thường miễn phí giai đoạn ra mắt) |
|
|
157
|
+
| `qm music get <id>` | Xem chi tiết job nhạc | — |
|
|
154
158
|
|
|
155
159
|
### Nhập liệu (miễn phí)
|
|
156
160
|
|
|
@@ -182,8 +186,39 @@ qm generate video --prompt "..." --model grok-imagine --wait --out ./out
|
|
|
182
186
|
|
|
183
187
|
- `--image` cũng nhận URL hoặc file local (như `--ref`).
|
|
184
188
|
- `--mode reference|frames` — `reference` (nhiều ảnh tham chiếu) hoặc `frames` (khung
|
|
185
|
-
đầu/cuối, tối đa 2).
|
|
186
|
-
|
|
189
|
+
đầu/cuối, tối đa 2). Model họ Seedance 2.x (`seedance-2-0`, `-fast`, `-mini`) giờ **tự động
|
|
190
|
+
chấp nhận ảnh người thật** ở mọi `--mode` — xem mục "Ảnh người thật" ngay dưới.
|
|
191
|
+
|
|
192
|
+
### Ảnh người thật (Seedance 2.x)
|
|
193
|
+
|
|
194
|
+
Model họ Seedance 2.x không còn chặn cứng ảnh có người thật: hệ thống tự chuẩn bị (đăng ký)
|
|
195
|
+
ảnh trước khi render, **có thể mất thêm ~1–3 phút** ở lần đầu dùng 1 ảnh cụ thể. Trong lúc đó
|
|
196
|
+
`qm jobs wait`/`--wait` in dòng `đang chuẩn bị ảnh có người thật (tối đa ~10 phút) — đừng tạo
|
|
197
|
+
job mới…` — **đừng bấm Ctrl+C rồi chạy lại lệnh**, cứ để CLI tự chờ tiếp (script/agent gọi
|
|
198
|
+
`jobs get`/`wait_for_job` cũng áp dụng y hệt — xem `docs/mcp-integration-guide.md` phía repo
|
|
199
|
+
backend). Ảnh bị bộ lọc nội dung của model từ chối (bản quyền/chính sách; khi bật kiểm tra sớm:
|
|
200
|
+
người nổi tiếng/nhân vật công chúng, trẻ em, nội dung nhạy cảm) → job `failed` kèm message rõ lý do
|
|
201
|
+
+ 1 `error_code` trong bảng dưới (credit hoàn), CLI tự in gợi ý xử lý:
|
|
202
|
+
|
|
203
|
+
| `error_code` | Ý nghĩa | Gợi ý |
|
|
204
|
+
|---|---|---|
|
|
205
|
+
| `PORTRAIT_PUBLIC_FIGURE` | Ảnh có người nổi tiếng/nhân vật công chúng | Dùng ảnh người thường |
|
|
206
|
+
| `PORTRAIT_MINOR` | Ảnh có trẻ em | Dùng ảnh người lớn |
|
|
207
|
+
| `PORTRAIT_NSFW` | Ảnh vi phạm nội dung nhạy cảm | Dùng ảnh khác |
|
|
208
|
+
| `PORTRAIT_GEMINI_UNAVAILABLE` | Chưa kiểm được ảnh (hệ thống bận) | Thử lại sau vài phút |
|
|
209
|
+
| `PORTRAIT_ASSET_FAILED` | Ảnh không được chấp nhận (mờ/nhiều người/định dạng lạ) | Thử ảnh khác |
|
|
210
|
+
| `PORTRAIT_ASSET_REJECTED` | Ảnh vẫn bị bộ lọc nội dung từ chối sau khi xử lý (người nổi tiếng/trẻ em/nhạy cảm/bản quyền) | Dùng ảnh khác |
|
|
211
|
+
| `PORTRAIT_TIMEOUT` | Chuẩn bị ảnh quá lâu (>10 phút) | Thử lại |
|
|
212
|
+
| `PORTRAIT_QUOTA_FULL` | Hệ thống đang bận (đầy quota tạm) | Thử lại sau vài phút |
|
|
213
|
+
| `PORTRAIT_IMAGE_HOST` | Ảnh không thuộc host Quick Magic | Dùng `--image <file local>` (CLI tự upload) thay URL ngoài |
|
|
214
|
+
| `PORTRAIT_IMAGE_FETCH_FAILED` | Không tải được ảnh | Thử lại |
|
|
215
|
+
| `PORTRAIT_PROVIDER_ERROR` | Hệ thống đang bận (lỗi tạm thời) | Thử lại sau ít phút |
|
|
216
|
+
| `PORTRAIT_PROVIDER_FAILED` | Ảnh bị từ chối theo chính sách nội dung (người nổi tiếng/trẻ em/nhạy cảm/bản quyền) | Dùng ảnh khác |
|
|
217
|
+
| `PORTRAIT_COPYRIGHT` | Ảnh bị từ chối vì bản quyền/quyền hình ảnh (người nổi tiếng, nhân vật/tác phẩm/thương hiệu được bảo hộ) | Dùng ảnh khác |
|
|
218
|
+
| `PORTRAIT_DISABLED` | Tính năng ảnh người thật đang tắt | Đổi `--model gemini-omni` |
|
|
219
|
+
| `PORTRAIT_TOO_MANY_IMAGES` | Vượt số ảnh người thật cho phép của model | Bớt `--image` |
|
|
220
|
+
| `PORTRAIT_VIDEO_REF_UNSUPPORTED` | Video tham chiếu có người thật chưa hỗ trợ | Dùng `--image` thay `--video-ref`, hoặc đổi model |
|
|
221
|
+
| `REAL_PERSON_BLOCKED` | (mã cũ) Model không nhận ảnh người thật | Đổi `--model gemini-omni` |
|
|
187
222
|
|
|
188
223
|
## Job
|
|
189
224
|
|
|
@@ -232,6 +267,11 @@ qm voices list --model qimi_1.5 --language "Tiếng Việt"
|
|
|
232
267
|
qm tts --text "Xin chào Quick Magic" --voice <voice_id> --model qimi_3 --wait --out ./out
|
|
233
268
|
qm voices clone --audio ./sample.wav --name "Giọng của tôi" --wait
|
|
234
269
|
|
|
270
|
+
# Tạo nhạc AI — xem giá trước khi chạy (thường miễn phí giai đoạn ra mắt)
|
|
271
|
+
qm music models
|
|
272
|
+
qm music lyrics --desc "bài hát vui về buổi sáng cà phê Sài Gòn"
|
|
273
|
+
qm music create --mode simple --desc "lofi chill guitar, rainy night" --instrumental --model melo-2 --wait --out ./out
|
|
274
|
+
|
|
235
275
|
# Video marketing theo mode + phân tích video đối thủ → kịch bản
|
|
236
276
|
qm marketing modes
|
|
237
277
|
qm marketing video --mode 3 --product-id 42 --duration 10
|
|
@@ -267,7 +307,7 @@ qm credits # chạy không cần browser
|
|
|
267
307
|
|
|
268
308
|
## Agent Skills
|
|
269
309
|
|
|
270
|
-
CLI này đi kèm
|
|
310
|
+
CLI này đi kèm 10 **Agent Skills** (`skills/quickmagic-*/SKILL.md`) để coding agent
|
|
271
311
|
(Claude Code...) dùng CLI trực tiếp — báo giá + xin xác nhận trước khi tốn credit,
|
|
272
312
|
tự `jobs wait` thay vì poll tay, chủ động báo Qimi free-window. Danh sách đầy đủ và quy ước
|
|
273
313
|
chung: xem `skills/README.md`.
|
|
@@ -278,7 +318,7 @@ Cách 1 — `npx skills` (nếu dùng công cụ [`skills`](https://www.npmjs.co
|
|
|
278
318
|
quản lý Agent Skills từ GitHub):
|
|
279
319
|
|
|
280
320
|
```bash
|
|
281
|
-
npx skills add Tungbillee/cli-quickmagic --skills quickmagic-account,quickmagic-generate,quickmagic-product-photoshoot,quickmagic-fashion,quickmagic-cutout,quickmagic-hook-video,quickmagic-edit-image,quickmagic-subtitle-split,quickmagic-tts
|
|
321
|
+
npx skills add Tungbillee/cli-quickmagic --skills quickmagic-account,quickmagic-generate,quickmagic-product-photoshoot,quickmagic-fashion,quickmagic-cutout,quickmagic-hook-video,quickmagic-edit-image,quickmagic-subtitle-split,quickmagic-tts,quickmagic-music
|
|
282
322
|
```
|
|
283
323
|
|
|
284
324
|
Cách 2 — copy thủ công vào thư mục skills của Claude Code:
|
|
@@ -293,8 +333,8 @@ cp -r skills/quickmagic-* ~/.claude/skills/ # user (mọi project trên má
|
|
|
293
333
|
Quick Magic cũng có MCP server dùng **chung tài khoản/ví credit** — cho phép Claude Code
|
|
294
334
|
(và các MCP client khác) gọi thẳng `generate_image`, `generate_video`, `get_job`,
|
|
295
335
|
`wait_for_job`, `list_models`, `get_credit_balance`, `list_voices`, `text_to_speech`,
|
|
296
|
-
`create_voice_clone`, `delete_voice_clone`... mà không cần
|
|
297
|
-
trình duyệt, không cần API key.
|
|
336
|
+
`create_voice_clone`, `delete_voice_clone`, `generate_music`, `write_lyrics`... mà không cần
|
|
337
|
+
qua CLI. Xác thực OAuth 2.1 qua trình duyệt, không cần API key.
|
|
298
338
|
|
|
299
339
|
- MCP endpoint: `https://api.quickmagic.vn/mcp`
|
|
300
340
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quickmagic-cli",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Quick Magic CLI — generate AI images/videos, product photoshoots, virtual try-on, hook ad videos, subtitles, text-to-speech/voice cloning and more via the Quick Magic REST API, with browser-based OAuth PKCE login (no API keys to manage). Ships with
|
|
3
|
+
"version": "1.5.0",
|
|
4
|
+
"description": "Quick Magic CLI — generate AI images/videos, product photoshoots, virtual try-on, hook ad videos, subtitles, text-to-speech/voice cloning, AI song generation and more via the Quick Magic REST API, with browser-based OAuth PKCE login (no API keys to manage). Ships with 10 Claude Agent Skills and an MCP server integration.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"quickmagic": "src/index.js",
|
|
7
7
|
"qm": "src/index.js"
|
|
@@ -32,7 +32,10 @@
|
|
|
32
32
|
"claude-code",
|
|
33
33
|
"agent-skills",
|
|
34
34
|
"product-photography",
|
|
35
|
-
"virtual-try-on"
|
|
35
|
+
"virtual-try-on",
|
|
36
|
+
"text-to-speech",
|
|
37
|
+
"voice-cloning",
|
|
38
|
+
"music-generation"
|
|
36
39
|
],
|
|
37
40
|
"homepage": "https://github.com/Tungbillee/cli-quickmagic#readme",
|
|
38
41
|
"repository": {
|
package/skills/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Quick Magic CLI — Agent Skills
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
10 Agent Skills that wrap the `quickmagic` / `qm` CLI so a coding agent (Claude
|
|
4
4
|
Code and compatible tools) can drive Quick Magic directly from the terminal —
|
|
5
5
|
mirroring the `npx skills add higgsfield-ai/skills` pattern (`/higgsfield:generate`
|
|
6
6
|
etc.), tailored to Quick Magic's own REST API and CLI.
|
|
@@ -18,7 +18,7 @@ when to load the skill).
|
|
|
18
18
|
Option 1 — `npx skills` (if this repo is published as a skills package):
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
|
-
npx skills add Tungbillee/cli-quickmagic --skills quickmagic-account,quickmagic-generate,quickmagic-product-photoshoot,quickmagic-fashion,quickmagic-cutout,quickmagic-hook-video,quickmagic-edit-image,quickmagic-subtitle-split,quickmagic-tts
|
|
21
|
+
npx skills add Tungbillee/cli-quickmagic --skills quickmagic-account,quickmagic-generate,quickmagic-product-photoshoot,quickmagic-fashion,quickmagic-cutout,quickmagic-hook-video,quickmagic-edit-image,quickmagic-subtitle-split,quickmagic-tts,quickmagic-music
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
Option 2 — copy directly into a project's or your user's Claude skills folder:
|
|
@@ -35,7 +35,7 @@ mkdir -p ~/.claude/skills && cp -r cli-quickmagic/skills/quickmagic-* ~/.claude/
|
|
|
35
35
|
|
|
36
36
|
| Skill | Wraps | Use for |
|
|
37
37
|
|---|---|---|
|
|
38
|
-
| `quickmagic-account` | `auth`, `credits`, `models list`, `jobs get/wait` | login/status, credit balance + Qimi free-window benefit, model catalog, job polling — **foundation** the other
|
|
38
|
+
| `quickmagic-account` | `auth`, `credits`, `models list`, `jobs get/wait` | login/status, credit balance + Qimi free-window benefit, model catalog, job polling — **foundation** the other 9 skills reference |
|
|
39
39
|
| `quickmagic-generate` | `generate image`, `generate video` | text/reference-to-image or -video |
|
|
40
40
|
| `quickmagic-product-photoshoot` | `product` | studio/marketing photos of a product (packshot/poster/infographic/composite) |
|
|
41
41
|
| `quickmagic-fashion` | `fashion`, `tryon` | outfit lookbook shoots vs. virtual try-on on a specific person photo |
|
|
@@ -44,8 +44,9 @@ mkdir -p ~/.claude/skills && cp -r cli-quickmagic/skills/quickmagic-* ~/.claude/
|
|
|
44
44
|
| `quickmagic-edit-image` | `edit` | restore / upscale (2k/4k) / beauty / muscle / color_boost on an existing image |
|
|
45
45
|
| `quickmagic-subtitle-split` | `subtitle`, `split` | auto subtitles/dubbing, long-video → short clips |
|
|
46
46
|
| `quickmagic-tts` | `tts`, `voices list/clone/delete` | text-to-speech (5 models) + custom voice cloning |
|
|
47
|
+
| `quickmagic-music` | `music create/lyrics/models/get` | AI song generation (vocals or instrumental) from a description or your own lyrics |
|
|
47
48
|
|
|
48
|
-
## Shared conventions (all
|
|
49
|
+
## Shared conventions (all 10 skills)
|
|
49
50
|
|
|
50
51
|
- Check `qm auth status` first; if not logged in, tell the user to run
|
|
51
52
|
`qm auth login`.
|
|
@@ -60,7 +61,7 @@ mkdir -p ~/.claude/skills && cp -r cli-quickmagic/skills/quickmagic-* ~/.claude/
|
|
|
60
61
|
shortfall and a link to top up (https://quickmagic.vn/pricing).
|
|
61
62
|
- Never poll `jobs get` manually — use `qm jobs wait <id> [--out dir]`. Note that
|
|
62
63
|
`--out` only auto-downloads for job types with a single `result_url`
|
|
63
|
-
(image/video/tryon/edit/hook/subtitle/tts); product/fashion/cutout/split
|
|
64
|
+
(image/video/tryon/edit/hook/subtitle/tts/music); product/fashion/cutout/split
|
|
64
65
|
return arrays and must be read back with `qm jobs get <id>` after
|
|
65
66
|
completion, and voice-clone jobs (`voc_`) have no `result_url` at all (read
|
|
66
67
|
`voice`/`sample_url`/`status` instead). See `quickmagic-account` for the
|
|
@@ -66,6 +66,11 @@ qm models list --type video # columns: KEY | LABEL | CREDIT | IMAGES
|
|
|
66
66
|
`ref 9 · frames 2`. A trailing `*` means that mode **rejects photos containing
|
|
67
67
|
real people** for that model — switch models (e.g. `gemini-omni`, a `seedance
|
|
68
68
|
1.x` key, `wan-2-7`) if the user's reference photos have people in them.
|
|
69
|
+
No `*` = people photos are fine. Seedance 2.x currently accepts real-people
|
|
70
|
+
photos (the server prints an ℹ note under the table): the first use of a given
|
|
71
|
+
photo may add ~1–3 min of preparation — `qm jobs wait` handles it, do NOT
|
|
72
|
+
resubmit. If the model's content filter rejects a photo (copyright/policy), the
|
|
73
|
+
job fails with an explicit reason and the credit is refunded — use another photo.
|
|
69
74
|
- The table does not print quality tiers or max-ref-image counts for image
|
|
70
75
|
models — image quality levels are commonly `1K`/`2K`/`4K`, priced per level; if
|
|
71
76
|
the exact enum for a model is unknown, omit `--quality` and let the server
|
|
@@ -36,7 +36,11 @@ studio photos see `quickmagic-product-photoshoot`.
|
|
|
36
36
|
`KEY | LABEL | CREDIT` (+ `IMAGES` column for video, showing max reference images
|
|
37
37
|
per mode, e.g. `ref 9 · frames 2`; a `*` after a number means that mode **rejects
|
|
38
38
|
real photos of real people** — pick a different model if the user's refs contain
|
|
39
|
-
people, e.g. `gemini-omni` / a `seedance 1.x` key / `wan-2-7`).
|
|
39
|
+
people, e.g. `gemini-omni` / a `seedance 1.x` key / `wan-2-7`). No `*` = people
|
|
40
|
+
photos are accepted; Seedance 2.x currently accepts them (first use of a photo may
|
|
41
|
+
add ~1–3 min of server-side preparation — keep waiting with `qm jobs wait`, do not
|
|
42
|
+
resubmit; a content-filter rejection — copyright/policy — fails the job with an
|
|
43
|
+
explicit reason and refunds the credit → try another photo).
|
|
40
44
|
|
|
41
45
|
- This table doesn't print quality tiers — image quality levels are commonly
|
|
42
46
|
`1K`/`2K`/`4K`, priced differently per level. If `--quality` matters, mention the
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: quickmagic-music
|
|
3
|
+
description: >-
|
|
4
|
+
Generate an AI song (with vocals or instrumental) from a text description
|
|
5
|
+
or your own lyrics, via the Quick Magic CLI (`qm music create/lyrics/models/get`).
|
|
6
|
+
2 models (melo-3 default, melo-2), simple mode (AI writes lyrics) or custom
|
|
7
|
+
mode (your own lyrics), fair 1-song-per-account queue. Triggers:
|
|
8
|
+
"tạo nhạc AI", "sáng tác nhạc", "viết bài hát", "viết lời bài hát",
|
|
9
|
+
"làm nhạc nền", "generate a song", "AI music", "write song lyrics",
|
|
10
|
+
"compose a song", "make music", "text to music".
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# quickmagic-music — AI Song Generation (Xưởng Nhạc "Melo")
|
|
14
|
+
|
|
15
|
+
Wraps `qm music create/lyrics/models/get`. Use whenever the user wants an AI-
|
|
16
|
+
generated song (vocals or instrumental) or just wants lyrics written for them.
|
|
17
|
+
|
|
18
|
+
## Commands
|
|
19
|
+
|
|
20
|
+
| Command | Required flags | Key optional flags |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
| `qm music models` | — | prints KEY/LABEL/GIÁ/ETA/HÀNG CHỜ table |
|
|
23
|
+
| `qm music lyrics` | `--desc <d>` | `--title <t>`, `--language <l>`, `--instrumental` |
|
|
24
|
+
| `qm music create` | `--desc <d>` (mode simple/instrumental) or `--lyrics <l>`/`--lyrics-file <path>` (mode custom) | `--mode <m>` (default `simple`), `--model <m>` (default `melo-3`), `--styles <s>`, `--title <t>`, `--instrumental`, `--gender <g>`, `--crid <id>`, `--wait`, `--out <dir>` |
|
|
25
|
+
| `qm music get <id>` | `<id>` (`mus_12` or bare `12`) | — |
|
|
26
|
+
|
|
27
|
+
## Two modes
|
|
28
|
+
|
|
29
|
+
- **`--mode simple`** (default): pass `--desc` describing the vibe/topic —
|
|
30
|
+
the server's internal AI songwriter writes the lyrics automatically. Good
|
|
31
|
+
default when the user just describes what they want.
|
|
32
|
+
- **`--mode custom`**: pass `--lyrics` (inline) or `--lyrics-file <path>`
|
|
33
|
+
(local UTF-8 text file, ≤3500 chars) with lyrics the user already has or
|
|
34
|
+
that you drafted with `qm music lyrics` first.
|
|
35
|
+
- **`--instrumental`**: no vocals at all — only `--styles`/`--desc` matter,
|
|
36
|
+
`--lyrics`/`--gender` are ignored.
|
|
37
|
+
|
|
38
|
+
## Pricing — always read at runtime, never hardcode
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
qm music models
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Prices are **runtime-only** — currently **free during the launch phase**
|
|
45
|
+
(check the `GIÁ` column / `free_launch` in the raw JSON), but this can change
|
|
46
|
+
at any time. `qm music create` already re-reads this internally right before
|
|
47
|
+
submitting and passes it as a price guard — if the price changed between your
|
|
48
|
+
quote and the actual submit, the command fails with `price_changed` instead
|
|
49
|
+
of silently charging a different amount. If that happens, just re-run
|
|
50
|
+
`qm music models`, tell the user the new price, and get confirmation again
|
|
51
|
+
before retrying `qm music create`.
|
|
52
|
+
|
|
53
|
+
## Queue — fair, 1 song running per account
|
|
54
|
+
|
|
55
|
+
Each account runs **1 song at a time**; extra requests queue fairly (FIFO
|
|
56
|
+
across users, not first-come-first-served within a single user hogging
|
|
57
|
+
slots). `qm music create` prints `queue_position`/`eta_seconds` right after
|
|
58
|
+
submitting. **Don't poll manually** — always use `--wait` (or
|
|
59
|
+
`qm jobs wait mus_<n> --out <dir>` afterwards), which polls automatically and
|
|
60
|
+
auto-downloads the mp3 once done (single `result_url`, like `tts`/`generate
|
|
61
|
+
image`). A song typically finishes in under 2 minutes once it starts running,
|
|
62
|
+
longer if queued behind other users' jobs. A long `queued` job is **not**
|
|
63
|
+
necessarily an error — check `queue_position`/`eta_seconds` in `qm music get`;
|
|
64
|
+
`status` only flips to `stalled` once the job stops making queue progress at
|
|
65
|
+
all (well past the ETA), not just because it has been waiting a while.
|
|
66
|
+
|
|
67
|
+
## Workflow
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
qm music models # 1. check current price + ETA
|
|
71
|
+
qm music lyrics --desc "lofi chill về mùa thu Hà Nội" # 2. optional — preview/edit lyrics first
|
|
72
|
+
# ... quote the price, get explicit user confirmation ...
|
|
73
|
+
qm music create --mode simple --desc "lofi chill về mùa thu Hà Nội" \
|
|
74
|
+
--model melo-3 --wait --out ./out # 3. submit + wait + auto-download mp3
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Custom lyrics example:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
qm music create --mode custom --lyrics-file ./loi-bai-hat.txt \
|
|
81
|
+
--styles "V-pop, Ballad, Piano" --title "Chiều Thu" --gender female --wait --out ./out
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Instrumental example:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
qm music create --mode simple --desc "epic cinematic trailer music, orchestral, rising tension" \
|
|
88
|
+
--instrumental --model melo-2 --wait --out ./out
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Errors
|
|
92
|
+
|
|
93
|
+
CLI prints `Lỗi [code]: message`. Common codes:
|
|
94
|
+
|
|
95
|
+
| Code | Meaning | What to do |
|
|
96
|
+
|---|---|---|
|
|
97
|
+
| `rate_limited` | more than 3 song submits/minute for this account | wait, then retry |
|
|
98
|
+
| `feature_disabled` | Xưởng Nhạc temporarily off | tell the user, don't retry |
|
|
99
|
+
| `price_changed` | price shifted between quote and submit | re-run `qm music models`, re-quote, re-confirm |
|
|
100
|
+
| `invalid_input` | missing/invalid `--desc`/`--lyrics`/`--model`/`--mode` for the chosen mode | check the mode's required field (see "Two modes" above) |
|
|
101
|
+
| `insufficient_credit` / `negative_balance` | not enough balance (only matters once pricing is no longer free) | state the exact shortfall and https://quickmagic.vn/pricing |
|
|
102
|
+
| `busy` | `qm music lyrics` internal writer overloaded | wait a bit, then retry `qm music lyrics`, or just supply lyrics yourself |
|
|
103
|
+
| `lyrics_failed` | AI songwriter couldn't produce valid lyrics after retry | try a clearer/different `--desc`, or write lyrics yourself with `--lyrics` |
|
|
104
|
+
| `feature_unavailable` | account temporarily blocked from this feature | tell the user, don't retry |
|
|
105
|
+
| `concurrent_limit` | too many jobs already running at once for the account's plan | wait for one of the running jobs to finish, then retry |
|
|
106
|
+
| `INVALID_PROMPT` | (uppercase, REST-only) `--lyrics` over 3500 chars or `--desc` over 500 chars | shorten the text and resubmit |
|
|
107
|
+
|
|
108
|
+
Full auth/job/error-code reference: `quickmagic-account` skill.
|
|
109
|
+
|
|
110
|
+
## Examples
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
qm auth status
|
|
114
|
+
qm music models
|
|
115
|
+
qm music lyrics --desc "bài hát vui về buổi sáng cà phê Sài Gòn" --title "Sài Gòn Sáng Cà Phê"
|
|
116
|
+
qm music create --mode simple --desc "bài hát vui về buổi sáng cà phê Sài Gòn" --wait --out ./out
|
|
117
|
+
qm music get mus_12
|
|
118
|
+
```
|
package/src/commands/jobs.js
CHANGED
|
@@ -8,6 +8,38 @@ const POLL_INTERVAL_MS = 2500;
|
|
|
8
8
|
const TERMINAL_STATUSES = new Set(['completed', 'error', 'failed', 'success', 'stalled', 'timeout']);
|
|
9
9
|
const SUCCESS_STATUSES = new Set(['completed', 'success']);
|
|
10
10
|
|
|
11
|
+
// [P3 portrait, plans/260818-1521 bước 9] Ảnh người thật Seedance 2.x đi qua kho ảo pass-through —
|
|
12
|
+
// job có thể đứng "đang xử lý" tới ~10' ở lần đầu dùng 1 ảnh. R12: jobs-view có thể còn đánh dấu
|
|
13
|
+
// job xếp hàng >15' là 'stalled' (fix ở BE phase sau) → agent/script CHẠY --wait tuyệt đối KHÔNG
|
|
14
|
+
// được suy ra "job kẹt, tạo job mới thử lại" (tạo job đôi, trừ tiền 2 lần). portrait_state đọc trực
|
|
15
|
+
// tiếp từ response — override cách hiểu bất kể server còn gắn status gì.
|
|
16
|
+
const PORTRAIT_PREPARING_STATES = new Set(['awaiting_asset', 'asset_ready']);
|
|
17
|
+
|
|
18
|
+
// Gợi ý theo error_code B′ (đối chiếu backend-quick-magic/services/portrait/portrait-errors.js — 17 mã).
|
|
19
|
+
const PORTRAIT_HINTS = {
|
|
20
|
+
PORTRAIT_PUBLIC_FIGURE: 'dùng ảnh người thường, không phải người nổi tiếng',
|
|
21
|
+
PORTRAIT_MINOR: 'dùng ảnh người lớn, không phải trẻ em',
|
|
22
|
+
PORTRAIT_NSFW: 'dùng ảnh khác, tránh nội dung nhạy cảm',
|
|
23
|
+
PORTRAIT_GEMINI_UNAVAILABLE: 'thử lại sau vài phút',
|
|
24
|
+
PORTRAIT_ASSET_FAILED: 'thử ảnh khác, rõ mặt, chỉ 1 người',
|
|
25
|
+
PORTRAIT_ASSET_REJECTED: 'ảnh bị bộ lọc nội dung từ chối (người nổi tiếng/trẻ em/nhạy cảm/bản quyền) — dùng ảnh khác',
|
|
26
|
+
PORTRAIT_TIMEOUT: 'thử lại sau vài phút',
|
|
27
|
+
PORTRAIT_QUOTA_FULL: 'thử lại sau vài phút',
|
|
28
|
+
PORTRAIT_IMAGE_HOST: 'tải ảnh lên QM trước (dùng --image <file>)',
|
|
29
|
+
PORTRAIT_IMAGE_FETCH_FAILED: 'thử lại sau vài phút',
|
|
30
|
+
PORTRAIT_PROVIDER_ERROR: 'thử lại sau vài phút',
|
|
31
|
+
PORTRAIT_PROVIDER_FAILED: 'ảnh bị từ chối theo chính sách nội dung (người nổi tiếng/trẻ em/nhạy cảm/bản quyền) — dùng ảnh khác',
|
|
32
|
+
PORTRAIT_COPYRIGHT: 'ảnh bị từ chối vì bản quyền/quyền hình ảnh (người nổi tiếng, nhân vật/tác phẩm được bảo hộ) — dùng ảnh khác',
|
|
33
|
+
PORTRAIT_DISABLED: 'đổi --model gemini-omni (nhận ảnh người thật)',
|
|
34
|
+
PORTRAIT_TOO_MANY_IMAGES: 'bớt số ảnh có người thật trong yêu cầu',
|
|
35
|
+
PORTRAIT_VIDEO_REF_UNSUPPORTED: 'dùng --image thay --video-ref, hoặc đổi model',
|
|
36
|
+
REAL_PERSON_BLOCKED: 'đổi --model gemini-omni (nhận ảnh người thật)',
|
|
37
|
+
};
|
|
38
|
+
function hintFor(code) {
|
|
39
|
+
const h = PORTRAIT_HINTS[code];
|
|
40
|
+
return h ? ` — gợi ý: ${h}` : '';
|
|
41
|
+
}
|
|
42
|
+
|
|
11
43
|
function sleep(ms) {
|
|
12
44
|
return new Promise((r) => setTimeout(r, ms));
|
|
13
45
|
}
|
|
@@ -36,11 +68,23 @@ async function waitOne(id, out_dir) {
|
|
|
36
68
|
for (;;) {
|
|
37
69
|
const data = await api.call('GET', `/jobs/${id}`);
|
|
38
70
|
const status = data.status;
|
|
71
|
+
|
|
72
|
+
// [P3 portrait, R12] job đang chuẩn bị ảnh có người thật — KHÔNG coi là stalled/lỗi, KHÔNG gợi ý
|
|
73
|
+
// chạy lại lệnh dù đợi lâu. In thẳng rồi tiếp tục poll, bỏ qua nhánh TERMINAL_STATUSES lượt này
|
|
74
|
+
// (server có deadline riêng ~10' sẽ tự chuyển job sang failed thật nếu quá hạn — vòng lặp không treo mãi).
|
|
75
|
+
if (PORTRAIT_PREPARING_STATES.has(data.portrait_state)) {
|
|
76
|
+
console.log(`[${id}] đang chuẩn bị ảnh có người thật (tối đa ~10 phút) — đừng tạo job mới…`);
|
|
77
|
+
await sleep(POLL_INTERVAL_MS);
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
|
|
39
81
|
const progress = data.progress != null ? ` (${data.progress}%)` : '';
|
|
40
82
|
console.log(`[${id}] ${status}${progress}`);
|
|
41
83
|
if (TERMINAL_STATUSES.has(status)) {
|
|
42
84
|
if (SUCCESS_STATUSES.has(status)) {
|
|
43
85
|
if (data.result_url && out_dir) await download(data.result_url, out_dir);
|
|
86
|
+
} else if (data.error_code) {
|
|
87
|
+
console.error(`[${id}] Lỗi [${data.error_code}]: ${data.error || status}${hintFor(data.error_code)}`);
|
|
44
88
|
} else {
|
|
45
89
|
console.error(`[${id}] job lỗi: ${data.error || status}`);
|
|
46
90
|
}
|
package/src/commands/models.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
// commands/models.js — liệt kê model ảnh/video dạng bảng key | label | credit (+IMAGES cho
|
|
1
|
+
// commands/models.js — liệt kê model ảnh/video/nhạc dạng bảng key | label | credit (+IMAGES cho
|
|
2
|
+
// video). `qm models list --type music` dùng chung hàm này; bảng ĐẦY ĐỦ hơn (giá/ETA/hàng chờ) nằm
|
|
3
|
+
// ở `qm music models` (commands/music.js) — dành cho ai đã quen `qm models list` chung 1 lệnh.
|
|
2
4
|
const api = require('../api');
|
|
3
5
|
|
|
4
6
|
// Cột IMAGES (video): "ref 9* · frames 2" — theo image_max_by_mode; * = mode cấm ảnh người thật.
|
|
@@ -44,6 +46,11 @@ async function list(options) {
|
|
|
44
46
|
console.log(' rồi dùng ảnh đó (provider chấp nhận ảnh thuần Seedream 5.0 Pro — đã probe thật 260808).');
|
|
45
47
|
console.log(' Hoặc dùng model không dấu *: gemini-omni / wan-3-0 / wan-2-7 / seedance 1.x nhận ảnh người trực tiếp.');
|
|
46
48
|
}
|
|
49
|
+
// [Portrait 260819] server bật pass-through → model từng cấm người thật giờ trả real_person_note (không còn dấu *)
|
|
50
|
+
if (is_video && models.some((m) => m.real_person_note)) {
|
|
51
|
+
console.log('\nℹ Ảnh người thật: Seedance 2.x nhận bình thường — hệ thống chuẩn bị ảnh thêm ~1-3 phút ở lần đầu dùng 1 ảnh');
|
|
52
|
+
console.log(' (qm jobs wait tự chờ). Nếu bộ lọc nội dung của model từ chối (bản quyền/chính sách), job failed kèm lý do rõ, credit hoàn.');
|
|
53
|
+
}
|
|
47
54
|
}
|
|
48
55
|
|
|
49
56
|
module.exports = { list };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// commands/music.js — qm music create/lyrics/models/get (Xưởng Nhạc Melo: REST /music, /music/lyrics,
|
|
2
|
+
// /models?type=music, /jobs/mus_<n>). Tách khỏi tools.js vì cần đọc file lời + gộp --wait + in bảng.
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const { call } = require('../api');
|
|
6
|
+
const jobs = require('./jobs');
|
|
7
|
+
|
|
8
|
+
const out = (data) => console.log(JSON.stringify(data, null, 2));
|
|
9
|
+
// [mirror voice.js] api.js đã gắn err.code từ REST {code,message} → in kèm code để rẽ nhánh (retryable
|
|
10
|
+
// 5xx/429 vs không 4xx).
|
|
11
|
+
const run = (fn) => (...a) => fn(...a).catch((e) => {
|
|
12
|
+
console.error(e.code ? `Lỗi [${e.code}]: ${e.message}` : `Lỗi: ${e.message}`);
|
|
13
|
+
process.exit(1);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
// Bảng text căn cột đơn giản — repo không có thư viện bảng, KHÔNG thêm dependency mới (mirror voice.js).
|
|
17
|
+
function printTable(headers, rows) {
|
|
18
|
+
const widths = headers.map((h, i) => Math.max(h.length, ...rows.map((r) => String(r[i] == null ? '' : r[i]).length)));
|
|
19
|
+
const line = (cells) => cells.map((c, i) => String(c == null ? '' : c).padEnd(widths[i])).join(' ');
|
|
20
|
+
console.log(line(headers));
|
|
21
|
+
console.log(widths.map((w) => '-'.repeat(w)).join(' '));
|
|
22
|
+
for (const r of rows) console.log(line(r));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function priceLabel(m) {
|
|
26
|
+
return m.free_launch ? 'Miễn phí (giai đoạn ra mắt)' : `${m.credit} credit/bài`;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// ── music models ──
|
|
30
|
+
const models = run(async () => {
|
|
31
|
+
const data = await call('GET', '/models?type=music');
|
|
32
|
+
const rows = data.models || [];
|
|
33
|
+
if (!rows.length) {
|
|
34
|
+
console.log('Không có model nào.');
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
printTable(
|
|
38
|
+
['KEY', 'LABEL', 'GIÁ', 'ETA (s)', 'HÀNG CHỜ'],
|
|
39
|
+
rows.map((m) => [m.key, m.label, priceLabel(m), m.eta_seconds, m.queue_capacity]),
|
|
40
|
+
);
|
|
41
|
+
if (rows.some((m) => m.free_launch)) {
|
|
42
|
+
console.log('\nGiá đang MIỄN PHÍ giai đoạn ra mắt — có thể đổi bất kỳ lúc nào, luôn kiểm tra lại trước khi tạo bài.');
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// ── music lyrics — AI viết lời (0đ) ──
|
|
47
|
+
const lyrics = run(async (o) => {
|
|
48
|
+
if (!o.desc) throw new Error('Cần --desc');
|
|
49
|
+
const data = await call('POST', '/music/lyrics', {
|
|
50
|
+
body: { description: o.desc, title: o.title, language: o.language, instrumental: !!o.instrumental },
|
|
51
|
+
});
|
|
52
|
+
console.log(`Tiêu đề: ${data.title}`);
|
|
53
|
+
console.log(`Phong cách: ${data.style_tags}`);
|
|
54
|
+
console.log('');
|
|
55
|
+
console.log(data.lyrics || '(bản không lời — chỉ có tiêu đề + phong cách)');
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// ── music create ──
|
|
59
|
+
const create = run(async (o) => {
|
|
60
|
+
// [P06b-L5 fix 260818] Server (validateMinimal, music-submit-service.js) CHẤP instrumental chỉ cần
|
|
61
|
+
// styles HOẶC description, không cần cả 2 — guard cục bộ cũ hẹp hơn hợp đồng, chặn oan
|
|
62
|
+
// `--instrumental --styles "lofi"` không --desc. Nới điều kiện cho khớp.
|
|
63
|
+
if (!o.desc && !o.lyrics && !o.lyricsFile && !(o.instrumental && o.styles)) {
|
|
64
|
+
throw new Error('Cần --desc (mode simple/instrumental) hoặc --lyrics/--lyrics-file (mode custom) hoặc --instrumental kèm --styles');
|
|
65
|
+
}
|
|
66
|
+
// [P06b-L5 fix 260818] --out mà thiếu --wait trước đây bị LỜ ÂM THẦM (waitAll chỉ chạy khi o.wait) —
|
|
67
|
+
// tự bật --wait để --out thực sự có tác dụng, kèm cảnh báo cho user biết.
|
|
68
|
+
if (o.out && !o.wait) {
|
|
69
|
+
console.log('Lưu ý: có --out nhưng thiếu --wait — tự động bật --wait để tải file khi bài xong.');
|
|
70
|
+
o.wait = true;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// [KI #11] Đọc giá + free_launch NGAY TRƯỚC submit — gửi kèm expected_free chống lệch giá giữa lúc
|
|
74
|
+
// quote và lúc submit thật (server fail-closed trả price_changed nếu lệch, KHÔNG âm thầm thu tiền).
|
|
75
|
+
const catalog = await call('GET', '/models?type=music');
|
|
76
|
+
const model_key = o.model || 'melo-3';
|
|
77
|
+
const m = (catalog.models || []).find((x) => x.key === model_key);
|
|
78
|
+
if (!m) {
|
|
79
|
+
console.log(`Cảnh báo: không tìm thấy model "${model_key}" trong catalog hiện tại — vẫn thử gửi, server sẽ báo lỗi nếu sai.`);
|
|
80
|
+
} else {
|
|
81
|
+
console.log(priceLabel(m));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const lyrics_text = o.lyricsFile ? fs.readFileSync(path.resolve(o.lyricsFile), 'utf8') : o.lyrics;
|
|
85
|
+
const data = await call('POST', '/music', {
|
|
86
|
+
body: {
|
|
87
|
+
mode: o.mode || 'simple', description: o.desc, lyrics: lyrics_text, title: o.title, model: model_key,
|
|
88
|
+
styles: o.styles ? o.styles.split(',').map((s) => s.trim()).filter(Boolean) : undefined,
|
|
89
|
+
instrumental: !!o.instrumental, vocal_gender: o.gender,
|
|
90
|
+
expected_free: m ? m.free_launch : undefined, client_request_id: o.crid,
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
out(data);
|
|
94
|
+
console.log(`\n→ Theo dõi: qm music get ${data.job_id}`);
|
|
95
|
+
if (o.wait) {
|
|
96
|
+
// [KI #16] --out là THƯ MỤC (jobs.waitAll → fs.mkdirSync(out_dir) rồi ghi basename từ URL) —
|
|
97
|
+
// truyền --out song.mp3 sẽ tạo THƯ MỤC tên song.mp3, không phải file. Dùng --out ./out.
|
|
98
|
+
await jobs.waitAll([data.job_id], o.out);
|
|
99
|
+
out(await call('GET', `/jobs/${data.job_id}`));
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// ── music get — chấp cả mus_<n> lẫn số trần ──
|
|
104
|
+
const get = run(async (id) => {
|
|
105
|
+
const job_id = String(id).startsWith('mus_') ? id : `mus_${id}`;
|
|
106
|
+
out(await call('GET', `/jobs/${job_id}`));
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
module.exports = { create, lyrics, models, get };
|
package/src/index.js
CHANGED
|
@@ -10,6 +10,7 @@ const models = require('./commands/models');
|
|
|
10
10
|
const credits = require('./commands/credits');
|
|
11
11
|
const tools = require('./commands/tools');
|
|
12
12
|
const voice = require('./commands/voice');
|
|
13
|
+
const music = require('./commands/music');
|
|
13
14
|
|
|
14
15
|
const collect = (v, acc) => { acc.push(v); return acc; };
|
|
15
16
|
|
|
@@ -51,7 +52,7 @@ gen_cmd
|
|
|
51
52
|
.option('--resolution <r>', 'Độ phân giải (vd 720p, 1080p)')
|
|
52
53
|
.option('--aspect-ratio <r>', 'Tỉ lệ khung')
|
|
53
54
|
.option('--image <i...>', 'Ảnh đầu vào (URL hoặc file local, lặp nhiều lần — max theo model+mode, xem qm models)')
|
|
54
|
-
.option('--mode <m>', 'Chế độ ảnh: reference (nhiều ảnh tham chiếu) | frames (khung đầu/cuối, max 2). Seedance 2.x
|
|
55
|
+
.option('--mode <m>', 'Chế độ ảnh: reference (nhiều ảnh tham chiếu) | frames (khung đầu/cuối, max 2). Seedance 2.x nhận ảnh người thật ở mọi chế độ (hệ thống chuẩn bị ảnh thêm ~1-3 phút lần đầu; nếu bộ lọc nội dung của model từ chối — bản quyền/chính sách — CLI in rõ lý do, credit hoàn; xem README mục "Ảnh người thật")')
|
|
55
56
|
.option('--video-ref <v>', 'Video tham chiếu (URL hoặc file local, max 15s/100MB) — CHỈ model supports_video_ref (seedance-2-0/-fast). Giá = rate with-video × (giây output + giây video); không dùng chung với --image')
|
|
56
57
|
.option('--seed <n>', 'Seed cố định — cùng seed + cùng prompt cho kết quả LẶP LẠI được (giữ nhất quán khi render nhiều cảnh)', parseInt)
|
|
57
58
|
.option('--negative <p>', 'Mô tả thứ KHÔNG muốn xuất hiện (watermark, chữ, tay thừa…) — model nào không hỗ trợ thì bỏ qua')
|
|
@@ -93,7 +94,7 @@ const models_cmd = program.command('models').description('Model AI');
|
|
|
93
94
|
models_cmd
|
|
94
95
|
.command('list')
|
|
95
96
|
.description('Liệt kê model')
|
|
96
|
-
.option('--type <t>', 'Loại: image | video', 'image')
|
|
97
|
+
.option('--type <t>', 'Loại: image | video | music', 'image')
|
|
97
98
|
.action(models.list);
|
|
98
99
|
|
|
99
100
|
// ── credits ──────────────────────────────────────────────────────────────────
|
|
@@ -188,6 +189,41 @@ voices_cmd
|
|
|
188
189
|
.description('Xoá giọng đã clone')
|
|
189
190
|
.action(voice.voicesDelete);
|
|
190
191
|
|
|
192
|
+
// ── Xưởng Nhạc Melo ──────────────────────────────────────────────────────────
|
|
193
|
+
const music_cmd = program.command('music').description('Xưởng Nhạc Melo — tạo nhạc AI (mô tả/lời → mp3)');
|
|
194
|
+
music_cmd
|
|
195
|
+
.command('create')
|
|
196
|
+
.description('Tạo bài hát AI (mode simple: AI viết lời từ mô tả; mode custom: tự nhập lời)')
|
|
197
|
+
.option('--mode <m>', 'simple (mặc định, AI viết lời) | custom (tự nhập lời)', 'simple')
|
|
198
|
+
.option('--desc <d>', 'Mô tả bài hát — bắt buộc mode simple, hoặc bản không lời')
|
|
199
|
+
.option('--lyrics <l>', 'Lời bài hát (mode custom)')
|
|
200
|
+
.option('--lyrics-file <path>', 'Đọc lời từ file local UTF-8 (thay --lyrics)')
|
|
201
|
+
.option('--styles <s>', 'Phong cách nhạc, phân cách dấu phẩy (vd "V-pop, Ballad")')
|
|
202
|
+
.option('--title <t>', 'Tiêu đề bài hát')
|
|
203
|
+
.option('--model <m>', 'melo-3 (mặc định, mới nhất) | melo-2 (thế hệ trước)', 'melo-3')
|
|
204
|
+
.option('--instrumental', 'Bản không lời')
|
|
205
|
+
.option('--gender <g>', 'auto (mặc định) | male | female — chỉ áp dụng khi có lời')
|
|
206
|
+
.option('--crid <id>', 'client_request_id')
|
|
207
|
+
.option('--wait', 'Chờ tới khi job hoàn tất')
|
|
208
|
+
.option('--out <dir>', 'Thư mục lưu file mp3 (tự bật --wait nếu chưa có)')
|
|
209
|
+
.action(music.create);
|
|
210
|
+
music_cmd
|
|
211
|
+
.command('lyrics')
|
|
212
|
+
.description('AI viết lời bài hát (0đ) — xem trước/chỉnh trước khi dùng mode custom')
|
|
213
|
+
.requiredOption('--desc <d>', 'Mô tả bài hát')
|
|
214
|
+
.option('--title <t>', 'Tiêu đề gợi ý')
|
|
215
|
+
.option('--language <l>', 'Ngôn ngữ (mặc định auto)')
|
|
216
|
+
.option('--instrumental', 'Chỉ cần tiêu đề + phong cách, không cần lời')
|
|
217
|
+
.action(music.lyrics);
|
|
218
|
+
music_cmd
|
|
219
|
+
.command('models')
|
|
220
|
+
.description('Liệt kê model nhạc + giá + ETA + hàng chờ')
|
|
221
|
+
.action(music.models);
|
|
222
|
+
music_cmd
|
|
223
|
+
.command('get <id>')
|
|
224
|
+
.description('Xem chi tiết job nhạc (mus_<n> hoặc số trần)')
|
|
225
|
+
.action(music.get);
|
|
226
|
+
|
|
191
227
|
// ── Cutout Studio ────────────────────────────────────────────────────────────
|
|
192
228
|
program.command('cutout').description('Tách nền / tạo ảnh cutout trong suốt (PNG)')
|
|
193
229
|
.option('--operation <o>', 'generate|from_ref|remix_describe', 'from_ref')
|