compshare-cli 0.4.4__py3-none-any.whl → 0.5.0__py3-none-any.whl
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.
- compshare_cli/__init__.py +1 -1
- compshare_cli/commands/minimax.py +730 -25
- compshare_cli/i18n.py +146 -14
- compshare_cli/mcp_server.py +26 -0
- {compshare_cli-0.4.4.dist-info → compshare_cli-0.5.0.dist-info}/METADATA +20 -8
- {compshare_cli-0.4.4.dist-info → compshare_cli-0.5.0.dist-info}/RECORD +10 -10
- {compshare_cli-0.4.4.dist-info → compshare_cli-0.5.0.dist-info}/WHEEL +0 -0
- {compshare_cli-0.4.4.dist-info → compshare_cli-0.5.0.dist-info}/entry_points.txt +0 -0
- {compshare_cli-0.4.4.dist-info → compshare_cli-0.5.0.dist-info}/licenses/LICENSE +0 -0
- {compshare_cli-0.4.4.dist-info → compshare_cli-0.5.0.dist-info}/top_level.txt +0 -0
compshare_cli/__init__.py
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import json
|
|
4
|
+
import math
|
|
4
5
|
import os
|
|
5
6
|
import uuid
|
|
7
|
+
from pathlib import Path
|
|
6
8
|
from typing import Any, Dict, List, Optional, Sequence
|
|
7
9
|
from urllib import error as urlerror
|
|
8
10
|
from urllib import parse, request
|
|
@@ -16,13 +18,14 @@ from compshare_cli.i18n import tr
|
|
|
16
18
|
from compshare_cli.output import Renderer
|
|
17
19
|
from compshare_cli.runtime import Runtime
|
|
18
20
|
|
|
19
|
-
app = typer.Typer(help="Manage MiniMax H3 video tasks.", no_args_is_help=True)
|
|
21
|
+
app = typer.Typer(help="Manage MiniMax H3 video, image, and audio tasks.", no_args_is_help=True)
|
|
20
22
|
|
|
21
23
|
API_BASE_URL = "https://cp.compshare.cn"
|
|
22
24
|
API_KEY_ENV = "COMPSHARE_MINIMAX_API_KEY"
|
|
23
25
|
CALLBACK_TOKEN_ENV = "COMPSHARE_MINIMAX_CALLBACK_TOKEN"
|
|
24
26
|
|
|
25
|
-
_RESOLUTIONS = {"768P", "1080P", "2K"}
|
|
27
|
+
_RESOLUTIONS = {"480P", "768P", "1080P", "2K", "4K"}
|
|
28
|
+
_MODELS = {"MiniMax-H3", "minimax-h3-lite"}
|
|
26
29
|
_RATIOS = {"adaptive", "21:9", "16:9", "4:3", "1:1", "3:4", "9:16"}
|
|
27
30
|
_STATUSES = {"queued", "running", "succeeded", "failed", "cancelled"}
|
|
28
31
|
_TASK_COLUMNS = (
|
|
@@ -107,7 +110,7 @@ def _request(
|
|
|
107
110
|
) -> Dict[str, Any]:
|
|
108
111
|
url = f"{API_BASE_URL}{path}"
|
|
109
112
|
if query:
|
|
110
|
-
url = f"{url}?{parse.urlencode(query)}"
|
|
113
|
+
url = f"{url}?{parse.urlencode(query, doseq=True)}"
|
|
111
114
|
headers = {
|
|
112
115
|
"Accept": "application/json",
|
|
113
116
|
"User-Agent": f"compshare-cli/{__version__}",
|
|
@@ -177,14 +180,18 @@ def _content(
|
|
|
177
180
|
reference_audio: Sequence[str],
|
|
178
181
|
) -> List[Dict[str, Any]]:
|
|
179
182
|
text = prompt.strip()
|
|
180
|
-
if not text:
|
|
181
|
-
raise UsageError(tr("Prompt cannot be empty."))
|
|
182
183
|
if len(text) > 7000:
|
|
183
184
|
raise UsageError(tr("Prompt cannot exceed 7000 characters."))
|
|
184
|
-
if last_frame and not first_frame:
|
|
185
|
-
raise UsageError(tr("--last-frame requires --first-frame."))
|
|
186
185
|
if (first_frame or last_frame) and (reference_images or reference_videos or reference_audio):
|
|
187
186
|
raise UsageError(tr("Frame inputs cannot be combined with reference inputs."))
|
|
187
|
+
if not text and not (
|
|
188
|
+
first_frame or last_frame or reference_images or reference_videos or reference_audio
|
|
189
|
+
):
|
|
190
|
+
raise UsageError(tr("Prompt cannot be empty."))
|
|
191
|
+
if sum(map(len, (reference_images, reference_videos, reference_audio))) > 12:
|
|
192
|
+
raise UsageError(tr("At most 12 reference inputs are allowed."))
|
|
193
|
+
if reference_audio and not (reference_images or reference_videos):
|
|
194
|
+
raise UsageError(tr("Reference audio requires a reference image or video."))
|
|
188
195
|
limits = (
|
|
189
196
|
(reference_images, 9, "--reference-image"),
|
|
190
197
|
(reference_videos, 3, "--reference-video"),
|
|
@@ -200,7 +207,9 @@ def _content(
|
|
|
200
207
|
)
|
|
201
208
|
)
|
|
202
209
|
|
|
203
|
-
items: List[Dict[str, Any]] = [
|
|
210
|
+
items: List[Dict[str, Any]] = []
|
|
211
|
+
if text:
|
|
212
|
+
items.append({"type": "text", "text": text})
|
|
204
213
|
if first_frame:
|
|
205
214
|
items.append(
|
|
206
215
|
{
|
|
@@ -234,26 +243,30 @@ def _task_path(task_id: str, *, query: bool) -> str:
|
|
|
234
243
|
@app.command("create", help="Create a MiniMax H3 video task.")
|
|
235
244
|
def create(
|
|
236
245
|
ctx: typer.Context,
|
|
237
|
-
prompt: str = typer.Argument(
|
|
238
|
-
|
|
239
|
-
|
|
246
|
+
prompt: str = typer.Argument("", help="Video prompt; at most 7000 characters."),
|
|
247
|
+
model: str = typer.Option("MiniMax-H3", help="Model: MiniMax-H3 or minimax-h3-lite."),
|
|
248
|
+
resolution: str = typer.Option("768P", help="Output resolution: 480P, 768P, 1080P, 2K, or 4K."),
|
|
249
|
+
duration: int = typer.Option(5, min=4, max=30, help="Video duration in seconds (4-30)."),
|
|
240
250
|
ratio: str = typer.Option("16:9", help="Output ratio or adaptive for media input."),
|
|
241
|
-
first_frame: Optional[str] = typer.Option(None, help="
|
|
242
|
-
last_frame: Optional[str] = typer.Option(None, help="
|
|
251
|
+
first_frame: Optional[str] = typer.Option(None, help="First-frame image URL or Data URL."),
|
|
252
|
+
last_frame: Optional[str] = typer.Option(None, help="Last-frame image URL or Data URL."),
|
|
243
253
|
reference_images: Optional[List[str]] = typer.Option(
|
|
244
|
-
None, "--reference-image", help="
|
|
254
|
+
None, "--reference-image", help="Reference image URL or Data URL; repeatable."
|
|
245
255
|
),
|
|
246
256
|
reference_videos: Optional[List[str]] = typer.Option(
|
|
247
|
-
None, "--reference-video", help="
|
|
257
|
+
None, "--reference-video", help="Reference video URL or Data URL; repeatable."
|
|
248
258
|
),
|
|
249
259
|
reference_audio: Optional[List[str]] = typer.Option(
|
|
250
|
-
None, "--reference-audio", help="
|
|
260
|
+
None, "--reference-audio", help="Reference audio URL or Data URL; repeatable."
|
|
251
261
|
),
|
|
252
262
|
context_ir: bool = typer.Option(
|
|
253
263
|
False,
|
|
254
264
|
"--context-ir/--no-context-ir",
|
|
255
265
|
help="Enable Context-IR prompt optimization.",
|
|
256
266
|
),
|
|
267
|
+
skill_id: Optional[str] = typer.Option(None, help="Skill ID; requires --context-ir."),
|
|
268
|
+
mute_audio: bool = typer.Option(False, "--mute-audio", help="Remove the video audio track."),
|
|
269
|
+
watermark: bool = typer.Option(False, "--watermark", help="Add an AIGC watermark."),
|
|
257
270
|
callback_url: Optional[str] = typer.Option(None, help="Public task callback URL."),
|
|
258
271
|
idempotency_key: Optional[str] = typer.Option(
|
|
259
272
|
None,
|
|
@@ -267,31 +280,35 @@ def create(
|
|
|
267
280
|
yes: bool = typer.Option(False, "--yes", "-y", help="Skip confirmation."),
|
|
268
281
|
) -> None:
|
|
269
282
|
state = runtime(ctx)
|
|
283
|
+
if model not in _MODELS:
|
|
284
|
+
raise UsageError(tr("Unsupported video model: {model}.", model=model))
|
|
270
285
|
if resolution not in _RESOLUTIONS:
|
|
271
|
-
raise UsageError(tr("--resolution must be 768P, 1080P, or
|
|
286
|
+
raise UsageError(tr("--resolution must be 480P, 768P, 1080P, 2K, or 4K."))
|
|
272
287
|
if ratio not in _RATIOS:
|
|
273
288
|
raise UsageError(tr("Unsupported video ratio: {ratio}.", ratio=ratio))
|
|
289
|
+
if skill_id and not context_ir:
|
|
290
|
+
raise UsageError(tr("--skill-id requires --context-ir."))
|
|
274
291
|
references = (
|
|
275
292
|
reference_images or [],
|
|
276
293
|
reference_videos or [],
|
|
277
294
|
reference_audio or [],
|
|
278
295
|
)
|
|
279
296
|
content = _content(prompt, first_frame, last_frame, *references)
|
|
280
|
-
|
|
281
|
-
raise UsageError(tr("Pure text video generation requires a non-adaptive ratio."))
|
|
282
|
-
key = (idempotency_key or str(uuid.uuid4())).strip()
|
|
283
|
-
if not key:
|
|
284
|
-
raise UsageError(tr("Idempotency key cannot be empty."))
|
|
297
|
+
key = _new_key(idempotency_key)
|
|
285
298
|
payload: Dict[str, Any] = {
|
|
286
|
-
"model":
|
|
299
|
+
"model": model,
|
|
287
300
|
"content": content,
|
|
288
301
|
"resolution": resolution,
|
|
289
302
|
"duration": duration,
|
|
290
303
|
"ratio": ratio,
|
|
291
|
-
"aigc_watermark":
|
|
304
|
+
"aigc_watermark": watermark,
|
|
292
305
|
}
|
|
293
306
|
if context_ir:
|
|
294
307
|
payload["use_context_ir"] = True
|
|
308
|
+
if skill_id:
|
|
309
|
+
payload["skill_id"] = skill_id
|
|
310
|
+
if mute_audio:
|
|
311
|
+
payload["mute_audio"] = True
|
|
295
312
|
if callback_url:
|
|
296
313
|
payload["callback_url"] = callback_url
|
|
297
314
|
callback_token = os.environ.get(CALLBACK_TOKEN_ENV, "").strip()
|
|
@@ -300,7 +317,7 @@ def create(
|
|
|
300
317
|
|
|
301
318
|
plan = {"dry_run": dry_run, "idempotency_key": key, "request": payload}
|
|
302
319
|
fields = [
|
|
303
|
-
("MODEL",
|
|
320
|
+
("MODEL", model),
|
|
304
321
|
("RESOLUTION", resolution),
|
|
305
322
|
("DURATION", f"{duration}s"),
|
|
306
323
|
("RATIO", ratio),
|
|
@@ -355,14 +372,19 @@ def list_tasks(
|
|
|
355
372
|
page: int = typer.Option(1, "--page", min=1, help="Page number starting at 1."),
|
|
356
373
|
page_size: int = typer.Option(20, min=1, max=100, help="Results per page (1-100)."),
|
|
357
374
|
status: Optional[str] = typer.Option(None, help="Filter by task status."),
|
|
375
|
+
model: Optional[str] = typer.Option(None, help="Filter by model."),
|
|
358
376
|
) -> None:
|
|
359
377
|
state = runtime(ctx)
|
|
360
378
|
normalized_status = status.casefold() if status else None
|
|
361
379
|
if normalized_status and normalized_status not in _STATUSES:
|
|
362
380
|
raise UsageError(tr("Unsupported task status: {status}.", status=status))
|
|
381
|
+
if model and model not in _MODELS:
|
|
382
|
+
raise UsageError(tr("Unsupported video model: {model}.", model=model))
|
|
363
383
|
query: Dict[str, Any] = {"page_num": page, "page_size": page_size}
|
|
364
384
|
if normalized_status:
|
|
365
385
|
query["filter.status"] = normalized_status
|
|
386
|
+
if model:
|
|
387
|
+
query["filter.model"] = model
|
|
366
388
|
response = _request(
|
|
367
389
|
state,
|
|
368
390
|
"GET",
|
|
@@ -426,3 +448,686 @@ def cancel(
|
|
|
426
448
|
[("TASK ID", response.get("task_id", task_id)), ("STATUS", response.get("status"))],
|
|
427
449
|
response=response,
|
|
428
450
|
)
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
def _new_key(value: Optional[str]) -> str:
|
|
454
|
+
key = (value or str(uuid.uuid4())).strip()
|
|
455
|
+
if not 1 <= len(key) <= 128:
|
|
456
|
+
raise UsageError(tr("Idempotency key must contain 1-128 characters."))
|
|
457
|
+
return key
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
def _submit_task(
|
|
461
|
+
state: Runtime,
|
|
462
|
+
path: str,
|
|
463
|
+
payload: Dict[str, Any],
|
|
464
|
+
key: str,
|
|
465
|
+
dry_run: bool,
|
|
466
|
+
yes: bool,
|
|
467
|
+
fields: List[tuple[str, Any]],
|
|
468
|
+
) -> None:
|
|
469
|
+
renderer = Renderer(state.json_output, state.show_sensitive)
|
|
470
|
+
if dry_run:
|
|
471
|
+
renderer.details(
|
|
472
|
+
"Create plan",
|
|
473
|
+
fields,
|
|
474
|
+
response={"dry_run": True, "idempotency_key": key, "request": payload},
|
|
475
|
+
)
|
|
476
|
+
return
|
|
477
|
+
confirm_details(state, "Create plan", fields, "Confirm this operation?", yes)
|
|
478
|
+
response = _request(state, "POST", path, body=payload, idempotency_key=key)
|
|
479
|
+
renderer.details(
|
|
480
|
+
"Operation submitted",
|
|
481
|
+
[("TASK ID", response.get("task_id")), ("IDEMPOTENCY KEY", key)],
|
|
482
|
+
response={**response, "idempotency_key": key},
|
|
483
|
+
)
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
def _media_task_path(prefix: str, task_id: str) -> str:
|
|
487
|
+
return f"{prefix}/{parse.quote(task_id, safe='')}"
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
def _media_action(state: Runtime, prefix: str, task_id: str, action: str, yes: bool) -> None:
|
|
491
|
+
path = _media_task_path(prefix, task_id)
|
|
492
|
+
current = _request(state, "GET", path)
|
|
493
|
+
task = current.get("task") if isinstance(current.get("task"), dict) else {}
|
|
494
|
+
confirm_details(
|
|
495
|
+
state,
|
|
496
|
+
"Operation plan",
|
|
497
|
+
[("TASK ID", task_id), ("STATUS", task.get("status")), ("ACTION", action)],
|
|
498
|
+
"Confirm this operation?",
|
|
499
|
+
yes,
|
|
500
|
+
)
|
|
501
|
+
method, target = ("POST", f"{path}/cancel") if action == "cancel" else ("DELETE", path)
|
|
502
|
+
response = _request(state, method, target)
|
|
503
|
+
Renderer(state.json_output, state.show_sensitive).details(
|
|
504
|
+
"Operation submitted",
|
|
505
|
+
[("TASK ID", response.get("task_id", task_id)), ("ACTION", action)],
|
|
506
|
+
response=response,
|
|
507
|
+
)
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
def _upload_asset(
|
|
511
|
+
state: Runtime,
|
|
512
|
+
kind: str,
|
|
513
|
+
file: Path,
|
|
514
|
+
content_type: str,
|
|
515
|
+
limit: int,
|
|
516
|
+
extra: Dict[str, int],
|
|
517
|
+
yes: bool,
|
|
518
|
+
) -> None:
|
|
519
|
+
try:
|
|
520
|
+
size = file.stat().st_size
|
|
521
|
+
except OSError as error:
|
|
522
|
+
raise UsageError(str(error)) from error
|
|
523
|
+
if not 0 < size <= limit:
|
|
524
|
+
raise UsageError(tr("File size must be between 1 and {maximum} bytes.", maximum=limit))
|
|
525
|
+
confirm_details(
|
|
526
|
+
state,
|
|
527
|
+
"Upload plan",
|
|
528
|
+
[("FILE", str(file)), ("SIZE", size), ("CONTENT TYPE", content_type)],
|
|
529
|
+
"Confirm this operation?",
|
|
530
|
+
yes,
|
|
531
|
+
)
|
|
532
|
+
details: Dict[str, Any] = {
|
|
533
|
+
"file_name": file.name,
|
|
534
|
+
"content_type": content_type,
|
|
535
|
+
"file_size": size,
|
|
536
|
+
}
|
|
537
|
+
response = _request(state, "POST", f"/{kind}/v1/upload_urls", body=details)
|
|
538
|
+
upload_url = response.get("upload_url")
|
|
539
|
+
object_key = response.get("object_key")
|
|
540
|
+
if not isinstance(upload_url, str) or parse.urlsplit(upload_url).scheme != "https":
|
|
541
|
+
_fail(state, "invalid_response", tr("API returned an invalid upload URL."))
|
|
542
|
+
if not isinstance(object_key, str) or not object_key:
|
|
543
|
+
_fail(state, "invalid_response", tr("API returned no upload object key."))
|
|
544
|
+
headers = {"Content-Type": content_type}
|
|
545
|
+
if kind == "image":
|
|
546
|
+
for field, header in (
|
|
547
|
+
("authorization", "Authorization"),
|
|
548
|
+
("bucket", "bucket"),
|
|
549
|
+
("region", "ufile_indicated_region"),
|
|
550
|
+
):
|
|
551
|
+
value = response.get(field)
|
|
552
|
+
if not isinstance(value, str) or not value:
|
|
553
|
+
_fail(state, "invalid_response", tr("API returned incomplete upload credentials."))
|
|
554
|
+
headers[header] = value
|
|
555
|
+
try:
|
|
556
|
+
data = file.read_bytes()
|
|
557
|
+
if len(data) != size:
|
|
558
|
+
raise UsageError(tr("File changed while preparing the upload."))
|
|
559
|
+
req = request.Request(upload_url, data=data, headers=headers, method="PUT")
|
|
560
|
+
with request.urlopen(req, timeout=120.0) as uploaded:
|
|
561
|
+
uploaded.read()
|
|
562
|
+
except urlerror.HTTPError as error:
|
|
563
|
+
_fail(
|
|
564
|
+
state,
|
|
565
|
+
"upload_error",
|
|
566
|
+
tr("Reference upload failed with HTTP {status}.", status=error.code),
|
|
567
|
+
{"http_status": error.code},
|
|
568
|
+
)
|
|
569
|
+
except (urlerror.URLError, TimeoutError, OSError) as error:
|
|
570
|
+
_fail(
|
|
571
|
+
state,
|
|
572
|
+
"upload_error",
|
|
573
|
+
tr("Unable to upload the reference file."),
|
|
574
|
+
{"reason": str(error)},
|
|
575
|
+
)
|
|
576
|
+
registered = _request(
|
|
577
|
+
state,
|
|
578
|
+
"POST",
|
|
579
|
+
f"/{kind}/v1/assets",
|
|
580
|
+
body={**details, "object_key": object_key, **extra},
|
|
581
|
+
)
|
|
582
|
+
Renderer(state.json_output, state.show_sensitive).data(registered)
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
image_app = typer.Typer(help="Generate images and manage image tasks.", no_args_is_help=True)
|
|
586
|
+
app.add_typer(image_app, name="image")
|
|
587
|
+
|
|
588
|
+
_IMAGE_PATH = "/image/v1/tasks"
|
|
589
|
+
_IMAGE_RATIOS = {"1:1", "4:3", "3:4", "3:2", "2:3", "16:9", "9:16"}
|
|
590
|
+
_IMAGE_MIME = {
|
|
591
|
+
".jpg": "image/jpeg",
|
|
592
|
+
".jpeg": "image/jpeg",
|
|
593
|
+
".png": "image/png",
|
|
594
|
+
".webp": "image/webp",
|
|
595
|
+
}
|
|
596
|
+
_IMAGE_COLUMNS = (
|
|
597
|
+
("task_id", "TASK ID"),
|
|
598
|
+
("status", "STATUS"),
|
|
599
|
+
("point_cost", "POINTS"),
|
|
600
|
+
("created_at", "CREATED"),
|
|
601
|
+
)
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
@image_app.command("config", help="Show image generation availability and prices.")
|
|
605
|
+
def image_config(ctx: typer.Context) -> None:
|
|
606
|
+
state = runtime(ctx)
|
|
607
|
+
Renderer(state.json_output, state.show_sensitive).data(
|
|
608
|
+
_request(state, "GET", "/image/v1/config")
|
|
609
|
+
)
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
@image_app.command("create", help="Create a Qwen-Image task.")
|
|
613
|
+
def image_create(
|
|
614
|
+
ctx: typer.Context,
|
|
615
|
+
prompt: str = typer.Argument(..., help="Image prompt; at most 7000 characters."),
|
|
616
|
+
resolution: str = typer.Option("2K", help="Image resolution: 1K or 2K."),
|
|
617
|
+
ratio: str = typer.Option("1:1", help="Image aspect ratio."),
|
|
618
|
+
reference_assets: Optional[List[str]] = typer.Option(
|
|
619
|
+
None, "--reference-asset", help="Registered reference image asset ID; repeatable."
|
|
620
|
+
),
|
|
621
|
+
optimize_prompt: bool = typer.Option(False, "--optimize-prompt", help="Optimize the prompt."),
|
|
622
|
+
idempotency_key: Optional[str] = typer.Option(None, help="Idempotency key."),
|
|
623
|
+
dry_run: bool = typer.Option(False, "--dry-run", help="Show the request only."),
|
|
624
|
+
yes: bool = typer.Option(False, "--yes", "-y", help="Skip confirmation."),
|
|
625
|
+
) -> None:
|
|
626
|
+
text = prompt.strip()
|
|
627
|
+
if not text or len(prompt) > 7000:
|
|
628
|
+
raise UsageError(tr("Image prompt must contain 1-7000 characters."))
|
|
629
|
+
if resolution not in {"1K", "2K"}:
|
|
630
|
+
raise UsageError(tr("Image resolution must be 1K or 2K."))
|
|
631
|
+
if ratio not in _IMAGE_RATIOS:
|
|
632
|
+
raise UsageError(tr("Unsupported image ratio: {ratio}.", ratio=ratio))
|
|
633
|
+
if len(reference_assets or []) > 10:
|
|
634
|
+
raise UsageError(tr("At most 10 reference images are allowed."))
|
|
635
|
+
payload: Dict[str, Any] = {
|
|
636
|
+
"prompt": prompt,
|
|
637
|
+
"resolution": resolution,
|
|
638
|
+
"aspect_ratio": ratio,
|
|
639
|
+
"optimize_prompt": optimize_prompt,
|
|
640
|
+
}
|
|
641
|
+
if reference_assets:
|
|
642
|
+
payload["reference_images"] = [{"asset_id": value} for value in reference_assets]
|
|
643
|
+
state = runtime(ctx)
|
|
644
|
+
_submit_task(
|
|
645
|
+
state,
|
|
646
|
+
_IMAGE_PATH,
|
|
647
|
+
payload,
|
|
648
|
+
_new_key(idempotency_key),
|
|
649
|
+
dry_run,
|
|
650
|
+
yes,
|
|
651
|
+
[("RESOLUTION", resolution), ("RATIO", ratio), ("REFERENCES", len(reference_assets or []))],
|
|
652
|
+
)
|
|
653
|
+
|
|
654
|
+
|
|
655
|
+
@image_app.command("show", help="Show an image task.")
|
|
656
|
+
def image_show(ctx: typer.Context, task_id: str = typer.Argument(...)) -> None:
|
|
657
|
+
state = runtime(ctx)
|
|
658
|
+
response = _request(state, "GET", _media_task_path(_IMAGE_PATH, task_id))
|
|
659
|
+
task = response.get("task") if isinstance(response.get("task"), dict) else {}
|
|
660
|
+
Renderer(state.json_output, state.show_sensitive).details(
|
|
661
|
+
"Image task",
|
|
662
|
+
[
|
|
663
|
+
("TASK ID", task.get("task_id", task_id)),
|
|
664
|
+
("STATUS", task.get("status")),
|
|
665
|
+
("POINTS", task.get("point_cost")),
|
|
666
|
+
("OUTPUT URL", task.get("output_url")),
|
|
667
|
+
("ERROR", task.get("error_message")),
|
|
668
|
+
],
|
|
669
|
+
response=response,
|
|
670
|
+
)
|
|
671
|
+
|
|
672
|
+
|
|
673
|
+
@image_app.command("list", help="List image tasks.")
|
|
674
|
+
def image_list(
|
|
675
|
+
ctx: typer.Context,
|
|
676
|
+
offset: int = typer.Option(0, min=0),
|
|
677
|
+
limit: int = typer.Option(20, min=1, max=100),
|
|
678
|
+
statuses: Optional[List[str]] = typer.Option(None, "--status", help="Task status; repeatable."),
|
|
679
|
+
sort: str = typer.Option("latest", help="latest or oldest."),
|
|
680
|
+
) -> None:
|
|
681
|
+
if sort not in {"latest", "oldest"}:
|
|
682
|
+
raise UsageError(tr("Sort must be latest or oldest."))
|
|
683
|
+
state = runtime(ctx)
|
|
684
|
+
query: Dict[str, Any] = {"offset": offset, "limit": limit, "sort": sort}
|
|
685
|
+
if statuses:
|
|
686
|
+
query["statuses"] = statuses
|
|
687
|
+
response = _request(state, "GET", _IMAGE_PATH, query=query)
|
|
688
|
+
rows = response.get("items") if isinstance(response.get("items"), list) else []
|
|
689
|
+
Renderer(state.json_output, state.show_sensitive).data(
|
|
690
|
+
response, rows=rows, columns=_IMAGE_COLUMNS
|
|
691
|
+
)
|
|
692
|
+
|
|
693
|
+
|
|
694
|
+
@image_app.command("cancel", help="Cancel a queued image task.")
|
|
695
|
+
def image_cancel(
|
|
696
|
+
ctx: typer.Context,
|
|
697
|
+
task_id: str = typer.Argument(...),
|
|
698
|
+
yes: bool = typer.Option(False, "--yes", "-y"),
|
|
699
|
+
) -> None:
|
|
700
|
+
_media_action(runtime(ctx), _IMAGE_PATH, task_id, "cancel", yes)
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
@image_app.command("delete", help="Delete a finished image task and its output.")
|
|
704
|
+
def image_delete(
|
|
705
|
+
ctx: typer.Context,
|
|
706
|
+
task_id: str = typer.Argument(...),
|
|
707
|
+
yes: bool = typer.Option(False, "--yes", "-y"),
|
|
708
|
+
) -> None:
|
|
709
|
+
_media_action(runtime(ctx), _IMAGE_PATH, task_id, "delete", yes)
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
@image_app.command("upload", help="Upload and register a reference image.")
|
|
713
|
+
def image_upload(
|
|
714
|
+
ctx: typer.Context,
|
|
715
|
+
file: Path = typer.Argument(..., exists=True, dir_okay=False, readable=True),
|
|
716
|
+
width: int = typer.Option(..., min=1, help="Actual image width in pixels."),
|
|
717
|
+
height: int = typer.Option(..., min=1, help="Actual image height in pixels."),
|
|
718
|
+
yes: bool = typer.Option(False, "--yes", "-y"),
|
|
719
|
+
) -> None:
|
|
720
|
+
content_type = _IMAGE_MIME.get(file.suffix.lower())
|
|
721
|
+
if not content_type:
|
|
722
|
+
raise UsageError(tr("Image file must be JPG, PNG, or WebP."))
|
|
723
|
+
_upload_asset(
|
|
724
|
+
runtime(ctx),
|
|
725
|
+
"image",
|
|
726
|
+
file,
|
|
727
|
+
content_type,
|
|
728
|
+
30 * 1024 * 1024,
|
|
729
|
+
{"width": width, "height": height},
|
|
730
|
+
yes,
|
|
731
|
+
)
|
|
732
|
+
|
|
733
|
+
|
|
734
|
+
audio_app = typer.Typer(help="Generate speech and manage audio tasks.", no_args_is_help=True)
|
|
735
|
+
app.add_typer(audio_app, name="audio")
|
|
736
|
+
|
|
737
|
+
_AUDIO_PATH = "/audio/v1/speech/jobs"
|
|
738
|
+
_AUDIO_LANGUAGES = {"ZH", "EN", "JA", "ES", "AR"}
|
|
739
|
+
_AUDIO_MIME = {
|
|
740
|
+
".wav": "audio/wav",
|
|
741
|
+
".mp3": "audio/mpeg",
|
|
742
|
+
".flac": "audio/flac",
|
|
743
|
+
".ogg": "audio/ogg",
|
|
744
|
+
".m4a": "audio/mp4",
|
|
745
|
+
}
|
|
746
|
+
_AUDIO_COLUMNS = (
|
|
747
|
+
("task_id", "TASK ID"),
|
|
748
|
+
("status", "STATUS"),
|
|
749
|
+
("point_cost", "POINTS"),
|
|
750
|
+
("created_at", "CREATED"),
|
|
751
|
+
)
|
|
752
|
+
_VOICE_COLUMNS = (
|
|
753
|
+
("voice_id", "VOICE ID"),
|
|
754
|
+
("kind", "KIND"),
|
|
755
|
+
("name", "NAME"),
|
|
756
|
+
("language", "LANGUAGE"),
|
|
757
|
+
)
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
@audio_app.command("pricing", help="Show speech pricing and point balance.")
|
|
761
|
+
def audio_pricing(ctx: typer.Context) -> None:
|
|
762
|
+
state = runtime(ctx)
|
|
763
|
+
Renderer(state.json_output, state.show_sensitive).data(
|
|
764
|
+
_request(state, "GET", "/audio/v1/pricing")
|
|
765
|
+
)
|
|
766
|
+
|
|
767
|
+
|
|
768
|
+
@audio_app.command("voices", help="List preset or custom voices.")
|
|
769
|
+
def audio_voices(
|
|
770
|
+
ctx: typer.Context,
|
|
771
|
+
kind: str = typer.Option("preset", help="preset or custom."),
|
|
772
|
+
) -> None:
|
|
773
|
+
if kind not in {"preset", "custom"}:
|
|
774
|
+
raise UsageError(tr("Voice kind must be preset or custom."))
|
|
775
|
+
state = runtime(ctx)
|
|
776
|
+
response = _request(state, "GET", "/audio/v1/voices", query={"kind": kind})
|
|
777
|
+
rows = response.get("items") if isinstance(response.get("items"), list) else []
|
|
778
|
+
Renderer(state.json_output, state.show_sensitive).data(
|
|
779
|
+
response, rows=rows, columns=_VOICE_COLUMNS
|
|
780
|
+
)
|
|
781
|
+
|
|
782
|
+
|
|
783
|
+
def _emotion_values(raw: str, mode: Optional[str]) -> List[float]:
|
|
784
|
+
try:
|
|
785
|
+
values = [float(part.strip()) for part in raw.split(",")]
|
|
786
|
+
except ValueError as error:
|
|
787
|
+
raise UsageError(tr("Emotion vector must contain eight numbers.")) from error
|
|
788
|
+
if len(values) != 8 or any(not 0 <= value <= 0.8 for value in values):
|
|
789
|
+
raise UsageError(tr("Emotion vector must contain eight values between 0 and 0.8."))
|
|
790
|
+
if not 0 < sum(values) <= 0.8:
|
|
791
|
+
raise UsageError(tr("Emotion vector sum must be greater than 0 and at most 0.8."))
|
|
792
|
+
if mode == "single" and sum(value > 0 for value in values) != 1:
|
|
793
|
+
raise UsageError(tr("Single emotion mode requires exactly one nonzero value."))
|
|
794
|
+
return values
|
|
795
|
+
|
|
796
|
+
|
|
797
|
+
def _pronunciation_rules(raw: Sequence[str]) -> List[Dict[str, str]]:
|
|
798
|
+
if len(raw) > 100:
|
|
799
|
+
raise UsageError(tr("At most 100 pronunciation rules are allowed."))
|
|
800
|
+
rules: List[Dict[str, str]] = []
|
|
801
|
+
seen = set()
|
|
802
|
+
for item in raw:
|
|
803
|
+
parts = item.split(":", 2)
|
|
804
|
+
if len(parts) != 3:
|
|
805
|
+
raise UsageError(tr("Pronunciation must be WORD:KIND:VALUE."))
|
|
806
|
+
word, kind, value = (part.strip() for part in parts)
|
|
807
|
+
if not 1 <= len(word) <= 64 or kind not in {"pinyin", "alias", "cmu", "kana"}:
|
|
808
|
+
raise UsageError(tr("Invalid pronunciation word or kind."))
|
|
809
|
+
if not 1 <= len(value) <= 512 or word in seen:
|
|
810
|
+
raise UsageError(tr("Invalid or duplicate pronunciation rule."))
|
|
811
|
+
seen.add(word)
|
|
812
|
+
rules.append({"word": word, "kind": kind, "value": value})
|
|
813
|
+
return rules
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
@audio_app.command("create", help="Create an IndexTTS 2.5 speech task.")
|
|
817
|
+
def audio_create(
|
|
818
|
+
ctx: typer.Context,
|
|
819
|
+
text: str = typer.Argument(..., help="Speech text; at most 2000 characters."),
|
|
820
|
+
voice_source: str = typer.Option("preset", help="preset, custom, or asset."),
|
|
821
|
+
voice_id: Optional[str] = typer.Option(None, help="Preset or custom voice ID."),
|
|
822
|
+
asset_id: Optional[str] = typer.Option(None, help="Registered reference audio asset ID."),
|
|
823
|
+
language: str = typer.Option("ZH", help="ZH, EN, JA, ES, or AR."),
|
|
824
|
+
speed: float = typer.Option(1.0, min=0, max=2.0, help="Speech speed (0 or 0.5-2.0)."),
|
|
825
|
+
auto_emotion: bool = typer.Option(True, "--auto-emotion/--no-auto-emotion"),
|
|
826
|
+
emotion_description: Optional[str] = typer.Option(None, help="Emotion description."),
|
|
827
|
+
emotion_strength: float = typer.Option(0.8, min=0, max=1, help="Emotion strength (0-1)."),
|
|
828
|
+
emotion_vector: Optional[str] = typer.Option(
|
|
829
|
+
None, help="Eight comma-separated emotion values."
|
|
830
|
+
),
|
|
831
|
+
emotion_vector_mode: Optional[str] = typer.Option(None, help="single or mixed."),
|
|
832
|
+
pronunciations: Optional[List[str]] = typer.Option(
|
|
833
|
+
None, "--pronunciation", help="WORD:KIND:VALUE; repeatable."
|
|
834
|
+
),
|
|
835
|
+
save_voice: bool = typer.Option(False, "--save-voice", help="Save asset as a custom voice."),
|
|
836
|
+
voice_name: Optional[str] = typer.Option(None, help="Name for a saved custom voice."),
|
|
837
|
+
idempotency_key: Optional[str] = typer.Option(None, help="Idempotency key."),
|
|
838
|
+
dry_run: bool = typer.Option(False, "--dry-run", help="Show the request only."),
|
|
839
|
+
yes: bool = typer.Option(False, "--yes", "-y", help="Skip confirmation."),
|
|
840
|
+
) -> None:
|
|
841
|
+
if len(text) > 2000 or not any(char.isalpha() or char.isdecimal() for char in text):
|
|
842
|
+
raise UsageError(tr("Speech text must contain 1-2000 characters of letters or digits."))
|
|
843
|
+
if language not in _AUDIO_LANGUAGES:
|
|
844
|
+
raise UsageError(tr("Unsupported speech language: {language}.", language=language))
|
|
845
|
+
if not math.isfinite(speed) or (speed != 0 and not 0.5 <= speed <= 2.0):
|
|
846
|
+
raise UsageError(tr("Speech speed must be 0 or between 0.5 and 2.0."))
|
|
847
|
+
if not math.isfinite(emotion_strength) or not 0 <= emotion_strength <= 1:
|
|
848
|
+
raise UsageError(tr("Emotion strength must be between 0 and 1."))
|
|
849
|
+
if voice_source not in {"preset", "custom", "asset"}:
|
|
850
|
+
raise UsageError(tr("Voice source must be preset, custom, or asset."))
|
|
851
|
+
if voice_source == "asset":
|
|
852
|
+
if not asset_id or voice_id:
|
|
853
|
+
raise UsageError(tr("Asset voice requires --asset-id and no --voice-id."))
|
|
854
|
+
voice = {"source": "asset", "asset_id": asset_id}
|
|
855
|
+
else:
|
|
856
|
+
if not voice_id or asset_id:
|
|
857
|
+
raise UsageError(tr("Preset or custom voice requires --voice-id and no --asset-id."))
|
|
858
|
+
voice = {"source": voice_source, "voice_id": voice_id}
|
|
859
|
+
if save_voice and (
|
|
860
|
+
voice_source != "asset" or not voice_name or not 1 <= len(voice_name.strip()) <= 64
|
|
861
|
+
):
|
|
862
|
+
raise UsageError(tr("--save-voice requires an asset voice and a name of 1-64 characters."))
|
|
863
|
+
if voice_name and not save_voice:
|
|
864
|
+
raise UsageError(tr("--voice-name requires --save-voice."))
|
|
865
|
+
if emotion_description and len(emotion_description) > 200:
|
|
866
|
+
raise UsageError(tr("Emotion description cannot exceed 200 characters."))
|
|
867
|
+
if emotion_vector_mode and emotion_vector_mode not in {"single", "mixed"}:
|
|
868
|
+
raise UsageError(tr("Emotion vector mode must be single or mixed."))
|
|
869
|
+
if emotion_vector_mode and not emotion_vector:
|
|
870
|
+
raise UsageError(tr("Emotion vector mode requires --emotion-vector."))
|
|
871
|
+
if emotion_vector and (auto_emotion or emotion_description):
|
|
872
|
+
raise UsageError(tr("Emotion vector requires --no-auto-emotion and no description."))
|
|
873
|
+
payload: Dict[str, Any] = {
|
|
874
|
+
"text": text,
|
|
875
|
+
"language": language,
|
|
876
|
+
"voice": voice,
|
|
877
|
+
"speed": speed,
|
|
878
|
+
"auto_emotion": auto_emotion,
|
|
879
|
+
"emotion_strength": emotion_strength,
|
|
880
|
+
}
|
|
881
|
+
if emotion_description:
|
|
882
|
+
payload["emotion_description"] = emotion_description
|
|
883
|
+
if emotion_vector:
|
|
884
|
+
payload["emotion_vector"] = _emotion_values(emotion_vector, emotion_vector_mode)
|
|
885
|
+
if emotion_vector_mode:
|
|
886
|
+
payload["emotion_vector_mode"] = emotion_vector_mode
|
|
887
|
+
if pronunciations:
|
|
888
|
+
payload["pronunciations"] = _pronunciation_rules(pronunciations)
|
|
889
|
+
if save_voice:
|
|
890
|
+
payload["save_voice"] = True
|
|
891
|
+
payload["voice_name"] = voice_name.strip() if voice_name else ""
|
|
892
|
+
state = runtime(ctx)
|
|
893
|
+
_submit_task(
|
|
894
|
+
state,
|
|
895
|
+
_AUDIO_PATH,
|
|
896
|
+
payload,
|
|
897
|
+
_new_key(idempotency_key),
|
|
898
|
+
dry_run,
|
|
899
|
+
yes,
|
|
900
|
+
[("LANGUAGE", language), ("VOICE SOURCE", voice_source), ("TEXT LENGTH", len(text))],
|
|
901
|
+
)
|
|
902
|
+
|
|
903
|
+
|
|
904
|
+
@audio_app.command("show", help="Show a speech task.")
|
|
905
|
+
def audio_show(ctx: typer.Context, task_id: str = typer.Argument(...)) -> None:
|
|
906
|
+
state = runtime(ctx)
|
|
907
|
+
response = _request(state, "GET", _media_task_path(_AUDIO_PATH, task_id))
|
|
908
|
+
task = response.get("task") if isinstance(response.get("task"), dict) else {}
|
|
909
|
+
Renderer(state.json_output, state.show_sensitive).details(
|
|
910
|
+
"Speech task",
|
|
911
|
+
[
|
|
912
|
+
("TASK ID", task.get("task_id", task_id)),
|
|
913
|
+
("STATUS", task.get("status")),
|
|
914
|
+
("POINTS", task.get("point_cost")),
|
|
915
|
+
("OUTPUT URL", task.get("output_url")),
|
|
916
|
+
("ERROR", task.get("error_message")),
|
|
917
|
+
],
|
|
918
|
+
response=response,
|
|
919
|
+
)
|
|
920
|
+
|
|
921
|
+
|
|
922
|
+
@audio_app.command("list", help="List speech tasks.")
|
|
923
|
+
def audio_list(
|
|
924
|
+
ctx: typer.Context,
|
|
925
|
+
offset: int = typer.Option(0, min=0),
|
|
926
|
+
limit: int = typer.Option(20, min=1, max=100),
|
|
927
|
+
statuses: Optional[List[str]] = typer.Option(None, "--status", help="Task status; repeatable."),
|
|
928
|
+
) -> None:
|
|
929
|
+
state = runtime(ctx)
|
|
930
|
+
query: Dict[str, Any] = {"offset": offset, "limit": limit}
|
|
931
|
+
if statuses:
|
|
932
|
+
query["statuses"] = statuses
|
|
933
|
+
response = _request(state, "GET", _AUDIO_PATH, query=query)
|
|
934
|
+
rows = response.get("items") if isinstance(response.get("items"), list) else []
|
|
935
|
+
Renderer(state.json_output, state.show_sensitive).data(
|
|
936
|
+
response, rows=rows, columns=_AUDIO_COLUMNS
|
|
937
|
+
)
|
|
938
|
+
|
|
939
|
+
|
|
940
|
+
@audio_app.command("cancel", help="Cancel a queued speech task.")
|
|
941
|
+
def audio_cancel(
|
|
942
|
+
ctx: typer.Context,
|
|
943
|
+
task_id: str = typer.Argument(...),
|
|
944
|
+
yes: bool = typer.Option(False, "--yes", "-y"),
|
|
945
|
+
) -> None:
|
|
946
|
+
_media_action(runtime(ctx), _AUDIO_PATH, task_id, "cancel", yes)
|
|
947
|
+
|
|
948
|
+
|
|
949
|
+
@audio_app.command("delete", help="Delete a finished speech task and its output.")
|
|
950
|
+
def audio_delete(
|
|
951
|
+
ctx: typer.Context,
|
|
952
|
+
task_id: str = typer.Argument(...),
|
|
953
|
+
yes: bool = typer.Option(False, "--yes", "-y"),
|
|
954
|
+
) -> None:
|
|
955
|
+
_media_action(runtime(ctx), _AUDIO_PATH, task_id, "delete", yes)
|
|
956
|
+
|
|
957
|
+
|
|
958
|
+
@audio_app.command("upload", help="Upload and register reference audio.")
|
|
959
|
+
def audio_upload(
|
|
960
|
+
ctx: typer.Context,
|
|
961
|
+
file: Path = typer.Argument(..., exists=True, dir_okay=False, readable=True),
|
|
962
|
+
duration_ms: int = typer.Option(
|
|
963
|
+
..., min=500, max=15000, help="Actual duration in milliseconds."
|
|
964
|
+
),
|
|
965
|
+
yes: bool = typer.Option(False, "--yes", "-y"),
|
|
966
|
+
) -> None:
|
|
967
|
+
if len(file.name) > 255:
|
|
968
|
+
raise UsageError(tr("Audio file name cannot exceed 255 characters."))
|
|
969
|
+
content_type = _AUDIO_MIME.get(file.suffix.lower())
|
|
970
|
+
if not content_type:
|
|
971
|
+
raise UsageError(tr("Audio file must be WAV, MP3, FLAC, OGG, or M4A."))
|
|
972
|
+
_upload_asset(
|
|
973
|
+
runtime(ctx),
|
|
974
|
+
"audio",
|
|
975
|
+
file,
|
|
976
|
+
content_type,
|
|
977
|
+
15 * 1024 * 1024,
|
|
978
|
+
{"duration_ms": duration_ms},
|
|
979
|
+
yes,
|
|
980
|
+
)
|
|
981
|
+
|
|
982
|
+
|
|
983
|
+
@audio_app.command("voice-create", help="Save a reference asset as a custom voice.")
|
|
984
|
+
def audio_voice_create(
|
|
985
|
+
ctx: typer.Context,
|
|
986
|
+
asset_id: str = typer.Argument(..., help="Registered reference audio asset ID."),
|
|
987
|
+
name: str = typer.Argument(..., help="Custom voice name."),
|
|
988
|
+
idempotency_key: Optional[str] = typer.Option(None, help="Idempotency key."),
|
|
989
|
+
dry_run: bool = typer.Option(False, "--dry-run", help="Show the request only."),
|
|
990
|
+
yes: bool = typer.Option(False, "--yes", "-y", help="Skip confirmation."),
|
|
991
|
+
) -> None:
|
|
992
|
+
if not 1 <= len(name.strip()) <= 64:
|
|
993
|
+
raise UsageError(tr("Voice name must contain 1-64 characters."))
|
|
994
|
+
state = runtime(ctx)
|
|
995
|
+
key = _new_key(idempotency_key)
|
|
996
|
+
payload = {"asset_id": asset_id, "name": name.strip()}
|
|
997
|
+
fields = [("ASSET ID", asset_id), ("VOICE NAME", name), ("IDEMPOTENCY KEY", key)]
|
|
998
|
+
renderer = Renderer(state.json_output, state.show_sensitive)
|
|
999
|
+
if dry_run:
|
|
1000
|
+
renderer.details(
|
|
1001
|
+
"Create plan",
|
|
1002
|
+
fields,
|
|
1003
|
+
response={"dry_run": True, "idempotency_key": key, "request": payload},
|
|
1004
|
+
)
|
|
1005
|
+
return
|
|
1006
|
+
confirm_details(state, "Create plan", fields, "Confirm this operation?", yes)
|
|
1007
|
+
response = _request(state, "POST", "/audio/v1/voices", body=payload, idempotency_key=key)
|
|
1008
|
+
renderer.data({**response, "idempotency_key": key})
|
|
1009
|
+
|
|
1010
|
+
|
|
1011
|
+
@audio_app.command("voice-delete", help="Delete a custom voice.")
|
|
1012
|
+
def audio_voice_delete(
|
|
1013
|
+
ctx: typer.Context,
|
|
1014
|
+
voice_id: str = typer.Argument(...),
|
|
1015
|
+
yes: bool = typer.Option(False, "--yes", "-y"),
|
|
1016
|
+
) -> None:
|
|
1017
|
+
state = runtime(ctx)
|
|
1018
|
+
confirm_details(
|
|
1019
|
+
state,
|
|
1020
|
+
"Operation plan",
|
|
1021
|
+
[("VOICE ID", voice_id), ("ACTION", "delete")],
|
|
1022
|
+
"Confirm this operation?",
|
|
1023
|
+
yes,
|
|
1024
|
+
)
|
|
1025
|
+
response = _request(state, "DELETE", _media_task_path("/audio/v1/voices", voice_id))
|
|
1026
|
+
Renderer(state.json_output, state.show_sensitive).data(response)
|
|
1027
|
+
|
|
1028
|
+
|
|
1029
|
+
skill_app = typer.Typer(help="Manage MiniMax H3 video Skills.", no_args_is_help=True)
|
|
1030
|
+
app.add_typer(skill_app, name="skill")
|
|
1031
|
+
_SKILL_PATH = "/minimax/v2/skills"
|
|
1032
|
+
_SKILL_COLUMNS = (
|
|
1033
|
+
("id", "SKILL ID"),
|
|
1034
|
+
("name", "NAME"),
|
|
1035
|
+
("official", "OFFICIAL"),
|
|
1036
|
+
("description", "DESCRIPTION"),
|
|
1037
|
+
)
|
|
1038
|
+
|
|
1039
|
+
|
|
1040
|
+
@skill_app.command("list", help="List official and custom video Skills.")
|
|
1041
|
+
def skill_list(
|
|
1042
|
+
ctx: typer.Context,
|
|
1043
|
+
page: int = typer.Option(1, min=1),
|
|
1044
|
+
page_size: int = typer.Option(20, min=1, max=100),
|
|
1045
|
+
keyword: Optional[str] = typer.Option(None),
|
|
1046
|
+
) -> None:
|
|
1047
|
+
state = runtime(ctx)
|
|
1048
|
+
query: Dict[str, Any] = {"page_num": page, "page_size": page_size}
|
|
1049
|
+
if keyword:
|
|
1050
|
+
query["keyword"] = keyword
|
|
1051
|
+
response = _request(state, "GET", _SKILL_PATH, query=query)
|
|
1052
|
+
rows = response.get("items") if isinstance(response.get("items"), list) else []
|
|
1053
|
+
Renderer(state.json_output, state.show_sensitive).data(
|
|
1054
|
+
response, rows=rows, columns=_SKILL_COLUMNS
|
|
1055
|
+
)
|
|
1056
|
+
|
|
1057
|
+
|
|
1058
|
+
def _skill_payload(name: str, content: str, description: str) -> Dict[str, str]:
|
|
1059
|
+
payload = {"name": name.strip(), "content": content, "description": description.strip()}
|
|
1060
|
+
if not payload["name"] or not content.strip():
|
|
1061
|
+
raise UsageError(tr("Skill name and content cannot be empty."))
|
|
1062
|
+
if len(json.dumps(payload, ensure_ascii=False).encode("utf-8")) > 64 * 1024:
|
|
1063
|
+
raise UsageError(tr("Skill request cannot exceed 64 KiB."))
|
|
1064
|
+
return payload
|
|
1065
|
+
|
|
1066
|
+
|
|
1067
|
+
def _save_skill(
|
|
1068
|
+
state: Runtime,
|
|
1069
|
+
method: str,
|
|
1070
|
+
path: str,
|
|
1071
|
+
payload: Dict[str, str],
|
|
1072
|
+
dry_run: bool,
|
|
1073
|
+
yes: bool,
|
|
1074
|
+
) -> None:
|
|
1075
|
+
fields = [("NAME", payload["name"]), ("DESCRIPTION", payload["description"])]
|
|
1076
|
+
renderer = Renderer(state.json_output, state.show_sensitive)
|
|
1077
|
+
if dry_run:
|
|
1078
|
+
renderer.details("Operation plan", fields, response={"dry_run": True, "request": payload})
|
|
1079
|
+
return
|
|
1080
|
+
confirm_details(state, "Operation plan", fields, "Confirm this operation?", yes)
|
|
1081
|
+
renderer.data(_request(state, method, path, body=payload))
|
|
1082
|
+
|
|
1083
|
+
|
|
1084
|
+
@skill_app.command("create", help="Create a custom video Skill.")
|
|
1085
|
+
def skill_create(
|
|
1086
|
+
ctx: typer.Context,
|
|
1087
|
+
name: str = typer.Argument(...),
|
|
1088
|
+
content: str = typer.Argument(...),
|
|
1089
|
+
description: str = typer.Option(""),
|
|
1090
|
+
dry_run: bool = typer.Option(False, "--dry-run"),
|
|
1091
|
+
yes: bool = typer.Option(False, "--yes", "-y"),
|
|
1092
|
+
) -> None:
|
|
1093
|
+
_save_skill(
|
|
1094
|
+
runtime(ctx), "POST", _SKILL_PATH, _skill_payload(name, content, description), dry_run, yes
|
|
1095
|
+
)
|
|
1096
|
+
|
|
1097
|
+
|
|
1098
|
+
@skill_app.command("update", help="Replace a custom video Skill.")
|
|
1099
|
+
def skill_update(
|
|
1100
|
+
ctx: typer.Context,
|
|
1101
|
+
skill_id: str = typer.Argument(...),
|
|
1102
|
+
name: str = typer.Argument(...),
|
|
1103
|
+
content: str = typer.Argument(...),
|
|
1104
|
+
description: str = typer.Option(""),
|
|
1105
|
+
dry_run: bool = typer.Option(False, "--dry-run"),
|
|
1106
|
+
yes: bool = typer.Option(False, "--yes", "-y"),
|
|
1107
|
+
) -> None:
|
|
1108
|
+
_save_skill(
|
|
1109
|
+
runtime(ctx),
|
|
1110
|
+
"PUT",
|
|
1111
|
+
_media_task_path(_SKILL_PATH, skill_id),
|
|
1112
|
+
_skill_payload(name, content, description),
|
|
1113
|
+
dry_run,
|
|
1114
|
+
yes,
|
|
1115
|
+
)
|
|
1116
|
+
|
|
1117
|
+
|
|
1118
|
+
@skill_app.command("delete", help="Delete a custom video Skill.")
|
|
1119
|
+
def skill_delete(
|
|
1120
|
+
ctx: typer.Context,
|
|
1121
|
+
skill_id: str = typer.Argument(...),
|
|
1122
|
+
yes: bool = typer.Option(False, "--yes", "-y"),
|
|
1123
|
+
) -> None:
|
|
1124
|
+
state = runtime(ctx)
|
|
1125
|
+
confirm_details(
|
|
1126
|
+
state,
|
|
1127
|
+
"Operation plan",
|
|
1128
|
+
[("SKILL ID", skill_id), ("ACTION", "delete")],
|
|
1129
|
+
"Confirm this operation?",
|
|
1130
|
+
yes,
|
|
1131
|
+
)
|
|
1132
|
+
response = _request(state, "DELETE", _media_task_path(_SKILL_PATH, skill_id))
|
|
1133
|
+
Renderer(state.json_output, state.show_sensitive).data(response)
|
compshare_cli/i18n.py
CHANGED
|
@@ -70,7 +70,7 @@ ZH_TRANSLATIONS: Dict[str, str] = {
|
|
|
70
70
|
"dedicated": "独享带宽",
|
|
71
71
|
"shared": "共享带宽",
|
|
72
72
|
"blocked": "已拦截",
|
|
73
|
-
"Manage MiniMax H3 video tasks.": "管理 MiniMax H3
|
|
73
|
+
"Manage MiniMax H3 video, image, and audio tasks.": "管理 MiniMax H3 视频、图片和音频任务。",
|
|
74
74
|
"Create a MiniMax H3 video task.": "创建 MiniMax H3 视频任务。",
|
|
75
75
|
"Show a MiniMax H3 video task.": "查看 MiniMax H3 视频任务。",
|
|
76
76
|
"List MiniMax H3 video tasks.": "列出 MiniMax H3 视频任务。",
|
|
@@ -78,15 +78,21 @@ ZH_TRANSLATIONS: Dict[str, str] = {
|
|
|
78
78
|
"Show the MiniMax H3 point balance.": "查看 MiniMax H3 积分余额。",
|
|
79
79
|
"Cancel an unfinished MiniMax H3 video task.": "取消尚未结束的 MiniMax H3 视频任务。",
|
|
80
80
|
"Video prompt; at most 7000 characters.": "视频提示词,最多 7000 个字符。",
|
|
81
|
-
"
|
|
82
|
-
"
|
|
81
|
+
"Model: MiniMax-H3 or minimax-h3-lite.": "模型:MiniMax-H3 或 minimax-h3-lite。",
|
|
82
|
+
"Output resolution: 480P, 768P, 1080P, 2K, or 4K.": (
|
|
83
|
+
"输出分辨率:480P、768P、1080P、2K 或 4K。"
|
|
84
|
+
),
|
|
85
|
+
"Video duration in seconds (4-30).": "视频时长秒数(4–30)。",
|
|
83
86
|
"Output ratio or adaptive for media input.": "输出宽高比;素材输入可使用 adaptive。",
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
87
|
+
"First-frame image URL or Data URL.": "首帧图片 URL 或 Data URL。",
|
|
88
|
+
"Last-frame image URL or Data URL.": "尾帧图片 URL 或 Data URL。",
|
|
89
|
+
"Reference image URL or Data URL; repeatable.": "参考图片 URL 或 Data URL,可重复指定。",
|
|
90
|
+
"Reference video URL or Data URL; repeatable.": "参考视频 URL 或 Data URL,可重复指定。",
|
|
91
|
+
"Reference audio URL or Data URL; repeatable.": "参考音频 URL 或 Data URL,可重复指定。",
|
|
89
92
|
"Enable Context-IR prompt optimization.": "启用 Context-IR 提示词优化。",
|
|
93
|
+
"Skill ID; requires --context-ir.": "Skill ID;需要同时指定 --context-ir。",
|
|
94
|
+
"Remove the video audio track.": "移除视频音轨。",
|
|
95
|
+
"Add an AIGC watermark.": "添加 AIGC 水印。",
|
|
90
96
|
"Public task callback URL.": "可公开访问的任务回调 URL。",
|
|
91
97
|
"Idempotency key; generated automatically when omitted.": "幂等键;省略时自动生成。",
|
|
92
98
|
"Show the request without creating a video task.": "仅显示请求,不创建视频任务。",
|
|
@@ -94,6 +100,7 @@ ZH_TRANSLATIONS: Dict[str, str] = {
|
|
|
94
100
|
"Page number starting at 1.": "页码,从 1 开始。",
|
|
95
101
|
"Results per page (1-100).": "每页结果数(1–100)。",
|
|
96
102
|
"Filter by task status.": "按任务状态筛选。",
|
|
103
|
+
"Filter by model.": "按模型筛选。",
|
|
97
104
|
"Set {environment} to a MiniMax H3 API key.": (
|
|
98
105
|
"请将 {environment} 设置为 MiniMax H3 API Key。"
|
|
99
106
|
),
|
|
@@ -108,20 +115,145 @@ ZH_TRANSLATIONS: Dict[str, str] = {
|
|
|
108
115
|
"MiniMax H3 API rejected the request.": "MiniMax H3 API 拒绝了请求。",
|
|
109
116
|
"Prompt cannot be empty.": "提示词不能为空。",
|
|
110
117
|
"Prompt cannot exceed 7000 characters.": "提示词不能超过 7000 个字符。",
|
|
111
|
-
"--last-frame requires --first-frame.": "--last-frame 需要同时指定 --first-frame。",
|
|
112
118
|
"Frame inputs cannot be combined with reference inputs.": (
|
|
113
119
|
"首尾帧素材不能与参考图片、视频或音频混用。"
|
|
114
120
|
),
|
|
115
121
|
"{option} may be specified at most {maximum} times.": ("{option} 最多可指定 {maximum} 次。"),
|
|
116
|
-
"
|
|
117
|
-
"
|
|
118
|
-
|
|
119
|
-
"纯文生视频必须指定非 adaptive 的宽高比。"
|
|
122
|
+
"At most 12 reference inputs are allowed.": "参考素材合计最多 12 个。",
|
|
123
|
+
"Reference audio requires a reference image or video.": (
|
|
124
|
+
"参考音频需要同时指定参考图片或视频。"
|
|
120
125
|
),
|
|
121
|
-
"
|
|
126
|
+
"Unsupported video model: {model}.": "不支持的视频模型:{model}。",
|
|
127
|
+
"--resolution must be 480P, 768P, 1080P, 2K, or 4K.": (
|
|
128
|
+
"--resolution 必须是 480P、768P、1080P、2K 或 4K。"
|
|
129
|
+
),
|
|
130
|
+
"--skill-id requires --context-ir.": "--skill-id 需要同时指定 --context-ir。",
|
|
131
|
+
"Unsupported video ratio: {ratio}.": "不支持的视频宽高比:{ratio}。",
|
|
122
132
|
"Unsupported task status: {status}.": "不支持的任务状态:{status}。",
|
|
123
133
|
"Video task": "视频任务",
|
|
134
|
+
"Image task": "图片任务",
|
|
135
|
+
"Speech task": "语音任务",
|
|
124
136
|
"Point balance": "积分余额",
|
|
137
|
+
"REFERENCES": "参考素材数",
|
|
138
|
+
"VOICE SOURCE": "音色来源",
|
|
139
|
+
"TEXT LENGTH": "正文长度",
|
|
140
|
+
"CONTENT TYPE": "内容类型",
|
|
141
|
+
"OUTPUT URL": "成品 URL",
|
|
142
|
+
"SKILL ID": "Skill ID",
|
|
143
|
+
"OFFICIAL": "官方",
|
|
144
|
+
"FILE": "文件",
|
|
145
|
+
"Generate images and manage image tasks.": "生成图片并管理图片任务。",
|
|
146
|
+
"Show image generation availability and prices.": "查看图片生成服务状态和价格。",
|
|
147
|
+
"Create a Qwen-Image task.": "创建 Qwen-Image 任务。",
|
|
148
|
+
"Show an image task.": "查看图片任务。",
|
|
149
|
+
"List image tasks.": "列出图片任务。",
|
|
150
|
+
"Cancel a queued image task.": "取消排队中的图片任务。",
|
|
151
|
+
"Delete a finished image task and its output.": "删除已完成的图片任务及成品。",
|
|
152
|
+
"Upload and register a reference image.": "上传并登记参考图片。",
|
|
153
|
+
"Image prompt; at most 7000 characters.": "图片提示词,最多 7000 个字符。",
|
|
154
|
+
"Image resolution: 1K or 2K.": "图片分辨率:1K 或 2K。",
|
|
155
|
+
"Image aspect ratio.": "图片宽高比。",
|
|
156
|
+
"Registered reference image asset ID; repeatable.": "已登记的参考图片素材 ID,可重复指定。",
|
|
157
|
+
"Optimize the prompt.": "优化提示词。",
|
|
158
|
+
"Idempotency key.": "幂等键。",
|
|
159
|
+
"Show the request only.": "仅显示请求。",
|
|
160
|
+
"Task status; repeatable.": "任务状态,可重复指定。",
|
|
161
|
+
"latest or oldest.": "latest 或 oldest。",
|
|
162
|
+
"Actual image width in pixels.": "图片实际宽度,单位像素。",
|
|
163
|
+
"Actual image height in pixels.": "图片实际高度,单位像素。",
|
|
164
|
+
"Generate speech and manage audio tasks.": "生成语音并管理音频任务。",
|
|
165
|
+
"Show speech pricing and point balance.": "查看语音价格和积分余额。",
|
|
166
|
+
"List preset or custom voices.": "列出预设或自定义音色。",
|
|
167
|
+
"Create an IndexTTS 2.5 speech task.": "创建 IndexTTS 2.5 语音任务。",
|
|
168
|
+
"Show a speech task.": "查看语音任务。",
|
|
169
|
+
"List speech tasks.": "列出语音任务。",
|
|
170
|
+
"Cancel a queued speech task.": "取消排队中的语音任务。",
|
|
171
|
+
"Delete a finished speech task and its output.": "删除已完成的语音任务及成品。",
|
|
172
|
+
"Upload and register reference audio.": "上传并登记参考音频。",
|
|
173
|
+
"Save a reference asset as a custom voice.": "将参考音频素材保存为自定义音色。",
|
|
174
|
+
"Delete a custom voice.": "删除自定义音色。",
|
|
175
|
+
"preset or custom.": "preset 或 custom。",
|
|
176
|
+
"Speech text; at most 2000 characters.": "语音正文,最多 2000 个字符。",
|
|
177
|
+
"preset, custom, or asset.": "preset、custom 或 asset。",
|
|
178
|
+
"Preset or custom voice ID.": "预设或自定义音色 ID。",
|
|
179
|
+
"Registered reference audio asset ID.": "已登记的参考音频素材 ID。",
|
|
180
|
+
"ZH, EN, JA, ES, or AR.": "ZH、EN、JA、ES 或 AR。",
|
|
181
|
+
"Speech speed (0 or 0.5-2.0).": "语速(0 或 0.5–2.0)。",
|
|
182
|
+
"Emotion description.": "情绪描述。",
|
|
183
|
+
"Emotion strength (0-1).": "情绪强度(0–1)。",
|
|
184
|
+
"Eight comma-separated emotion values.": "以逗号分隔的八个情绪数值。",
|
|
185
|
+
"single or mixed.": "single 或 mixed。",
|
|
186
|
+
"WORD:KIND:VALUE; repeatable.": "WORD:KIND:VALUE,可重复指定。",
|
|
187
|
+
"Save asset as a custom voice.": "将素材保存为自定义音色。",
|
|
188
|
+
"Name for a saved custom voice.": "保存的自定义音色名称。",
|
|
189
|
+
"Actual duration in milliseconds.": "实际时长,单位毫秒。",
|
|
190
|
+
"Custom voice name.": "自定义音色名称。",
|
|
191
|
+
"Manage MiniMax H3 video Skills.": "管理 MiniMax H3 视频 Skill。",
|
|
192
|
+
"List official and custom video Skills.": "列出官方和自定义视频 Skill。",
|
|
193
|
+
"Create a custom video Skill.": "创建自定义视频 Skill。",
|
|
194
|
+
"Replace a custom video Skill.": "替换自定义视频 Skill。",
|
|
195
|
+
"Delete a custom video Skill.": "删除自定义视频 Skill。",
|
|
196
|
+
"Idempotency key must contain 1-128 characters.": "幂等键长度须为 1–128 个字符。",
|
|
197
|
+
"File size must be between 1 and {maximum} bytes.": "文件大小须在 1 到 {maximum} 字节之间。",
|
|
198
|
+
"API returned an invalid upload URL.": "API 返回的上传 URL 无效。",
|
|
199
|
+
"API returned no upload object key.": "API 未返回上传对象标识。",
|
|
200
|
+
"API returned incomplete upload credentials.": "API 返回的上传凭证不完整。",
|
|
201
|
+
"File changed while preparing the upload.": "准备上传时文件发生变化。",
|
|
202
|
+
"Reference upload failed with HTTP {status}.": "参考素材上传失败,HTTP 状态码为 {status}。",
|
|
203
|
+
"Unable to upload the reference file.": "无法上传参考素材文件。",
|
|
204
|
+
"Image prompt must contain 1-7000 characters.": "图片提示词须包含 1–7000 个字符。",
|
|
205
|
+
"Image resolution must be 1K or 2K.": "图片分辨率须为 1K 或 2K。",
|
|
206
|
+
"Unsupported image ratio: {ratio}.": "不支持的图片宽高比:{ratio}。",
|
|
207
|
+
"At most 10 reference images are allowed.": "参考图片最多 10 张。",
|
|
208
|
+
"Sort must be latest or oldest.": "排序方式须为 latest 或 oldest。",
|
|
209
|
+
"Image file must be JPG, PNG, or WebP.": "图片文件须为 JPG、PNG 或 WebP。",
|
|
210
|
+
"Voice kind must be preset or custom.": "音色类型须为 preset 或 custom。",
|
|
211
|
+
"Emotion vector must contain eight numbers.": "情绪向量须包含八个数字。",
|
|
212
|
+
"Emotion vector must contain eight values between 0 and 0.8.": (
|
|
213
|
+
"情绪向量须包含八个介于 0 和 0.8 之间的值。"
|
|
214
|
+
),
|
|
215
|
+
"Emotion vector sum must be greater than 0 and at most 0.8.": (
|
|
216
|
+
"情绪向量总和须大于 0 且不超过 0.8。"
|
|
217
|
+
),
|
|
218
|
+
"Single emotion mode requires exactly one nonzero value.": (
|
|
219
|
+
"single 情绪模式须恰有一个非零值。"
|
|
220
|
+
),
|
|
221
|
+
"At most 100 pronunciation rules are allowed.": "读音规则最多 100 条。",
|
|
222
|
+
"Pronunciation must be WORD:KIND:VALUE.": "读音规则格式须为 WORD:KIND:VALUE。",
|
|
223
|
+
"Invalid pronunciation word or kind.": "读音规则的词语或类型无效。",
|
|
224
|
+
"Invalid or duplicate pronunciation rule.": "读音规则无效或重复。",
|
|
225
|
+
"Speech text must contain 1-2000 characters of letters or digits.": (
|
|
226
|
+
"语音正文须包含字母或数字,且不超过 2000 个字符。"
|
|
227
|
+
),
|
|
228
|
+
"Unsupported speech language: {language}.": "不支持的语音语言:{language}。",
|
|
229
|
+
"Speech speed must be 0 or between 0.5 and 2.0.": "语速须为 0 或介于 0.5 和 2.0 之间。",
|
|
230
|
+
"Emotion strength must be between 0 and 1.": "情绪强度须介于 0 和 1 之间。",
|
|
231
|
+
"Voice source must be preset, custom, or asset.": "音色来源须为 preset、custom 或 asset。",
|
|
232
|
+
"Asset voice requires --asset-id and no --voice-id.": (
|
|
233
|
+
"素材音色须指定 --asset-id,且不能指定 --voice-id。"
|
|
234
|
+
),
|
|
235
|
+
"Preset or custom voice requires --voice-id and no --asset-id.": (
|
|
236
|
+
"预设或自定义音色须指定 --voice-id,且不能指定 --asset-id。"
|
|
237
|
+
),
|
|
238
|
+
"--save-voice requires an asset voice and a name of 1-64 characters.": (
|
|
239
|
+
"--save-voice 须使用素材音色,并指定 1–64 个字符的名称。"
|
|
240
|
+
),
|
|
241
|
+
"--voice-name requires --save-voice.": "--voice-name 需要同时指定 --save-voice。",
|
|
242
|
+
"Emotion description cannot exceed 200 characters.": "情绪描述不能超过 200 个字符。",
|
|
243
|
+
"Emotion vector mode must be single or mixed.": "情绪向量模式须为 single 或 mixed。",
|
|
244
|
+
"Emotion vector mode requires --emotion-vector.": (
|
|
245
|
+
"情绪向量模式需要同时指定 --emotion-vector。"
|
|
246
|
+
),
|
|
247
|
+
"Emotion vector requires --no-auto-emotion and no description.": (
|
|
248
|
+
"情绪向量需要指定 --no-auto-emotion,且不能指定情绪描述。"
|
|
249
|
+
),
|
|
250
|
+
"Audio file name cannot exceed 255 characters.": "音频文件名不能超过 255 个字符。",
|
|
251
|
+
"Audio file must be WAV, MP3, FLAC, OGG, or M4A.": (
|
|
252
|
+
"音频文件须为 WAV、MP3、FLAC、OGG 或 M4A。"
|
|
253
|
+
),
|
|
254
|
+
"Voice name must contain 1-64 characters.": "音色名称长度须为 1–64 个字符。",
|
|
255
|
+
"Skill name and content cannot be empty.": "Skill 名称和内容不能为空。",
|
|
256
|
+
"Skill request cannot exceed 64 KiB.": "Skill 请求体不能超过 64 KiB。",
|
|
125
257
|
"Manage durable remote instance jobs.": "管理可断线恢复的实例远程任务。",
|
|
126
258
|
"Submit a durable remote job and return immediately.": "提交持久化远程任务并立即返回。",
|
|
127
259
|
"List durable remote jobs on an instance.": "列出实例上的持久化远程任务。",
|
compshare_cli/mcp_server.py
CHANGED
|
@@ -53,6 +53,14 @@ _READ_COMMANDS = {
|
|
|
53
53
|
("minimax", "list"),
|
|
54
54
|
("minimax", "packages"),
|
|
55
55
|
("minimax", "points"),
|
|
56
|
+
("minimax", "image", "config"),
|
|
57
|
+
("minimax", "image", "show"),
|
|
58
|
+
("minimax", "image", "list"),
|
|
59
|
+
("minimax", "audio", "pricing"),
|
|
60
|
+
("minimax", "audio", "voices"),
|
|
61
|
+
("minimax", "audio", "show"),
|
|
62
|
+
("minimax", "audio", "list"),
|
|
63
|
+
("minimax", "skill", "list"),
|
|
56
64
|
("team", "list"),
|
|
57
65
|
("team", "joined"),
|
|
58
66
|
("team", "show"),
|
|
@@ -108,6 +116,19 @@ _WRITE_COMMANDS = {
|
|
|
108
116
|
("bandwidth", "switch"),
|
|
109
117
|
("minimax", "create"),
|
|
110
118
|
("minimax", "cancel"),
|
|
119
|
+
("minimax", "image", "create"),
|
|
120
|
+
("minimax", "image", "cancel"),
|
|
121
|
+
("minimax", "image", "delete"),
|
|
122
|
+
("minimax", "image", "upload"),
|
|
123
|
+
("minimax", "audio", "create"),
|
|
124
|
+
("minimax", "audio", "cancel"),
|
|
125
|
+
("minimax", "audio", "delete"),
|
|
126
|
+
("minimax", "audio", "upload"),
|
|
127
|
+
("minimax", "audio", "voice-create"),
|
|
128
|
+
("minimax", "audio", "voice-delete"),
|
|
129
|
+
("minimax", "skill", "create"),
|
|
130
|
+
("minimax", "skill", "update"),
|
|
131
|
+
("minimax", "skill", "delete"),
|
|
111
132
|
("team", "create"),
|
|
112
133
|
("team", "update"),
|
|
113
134
|
("team", "delete"),
|
|
@@ -136,6 +157,11 @@ _DRY_RUN_COMMANDS = {
|
|
|
136
157
|
("bandwidth", "resize"),
|
|
137
158
|
("bandwidth", "delete"),
|
|
138
159
|
("minimax", "create"),
|
|
160
|
+
("minimax", "image", "create"),
|
|
161
|
+
("minimax", "audio", "create"),
|
|
162
|
+
("minimax", "audio", "voice-create"),
|
|
163
|
+
("minimax", "skill", "create"),
|
|
164
|
+
("minimax", "skill", "update"),
|
|
139
165
|
}
|
|
140
166
|
_PRINT_ONLY_COMMANDS = {("instance", "ssh"), ("instance", "cp")}
|
|
141
167
|
_FORBIDDEN_FLAGS = {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: compshare-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: Command-line client for CompShare GPU compute and MiniMax H3
|
|
5
5
|
Author: CompShare
|
|
6
6
|
License-Expression: Apache-2.0
|
|
7
|
-
Project-URL: Homepage, https://github.com/
|
|
8
|
-
Project-URL: Repository, https://github.com/
|
|
9
|
-
Project-URL: Changelog, https://github.com/
|
|
10
|
-
Project-URL: Issues, https://github.com/
|
|
7
|
+
Project-URL: Homepage, https://github.com/compshare-cn/compshare-cli
|
|
8
|
+
Project-URL: Repository, https://github.com/compshare-cn/compshare-cli
|
|
9
|
+
Project-URL: Changelog, https://github.com/compshare-cn/compshare-cli/blob/master/CHANGELOG.md
|
|
10
|
+
Project-URL: Issues, https://github.com/compshare-cn/compshare-cli/issues
|
|
11
11
|
Requires-Python: >=3.9
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
@@ -27,14 +27,14 @@ Dynamic: license-file
|
|
|
27
27
|
|
|
28
28
|
# CompShare CLI
|
|
29
29
|
|
|
30
|
-
在终端管理优云智算 GPU 实例、镜像、云盘、US3 挂载、独享带宽、团队资源和 MiniMax H3
|
|
30
|
+
在终端管理优云智算 GPU 实例、镜像、云盘、US3 挂载、独享带宽、团队资源和 MiniMax H3 视频、图片、语音任务。
|
|
31
31
|
|
|
32
32
|
- 交互式创建实例,实时查询规格、库存和价格
|
|
33
33
|
- 支持批量生命周期操作、等待状态和跨地域查询
|
|
34
34
|
- 支持可断线恢复的远程任务、状态查询和增量日志读取
|
|
35
35
|
- 支持社区/自定义镜像、云盘、团队额度与账单
|
|
36
36
|
- 支持独享带宽询价、购买、改配、退款预估及实例 EIP 切换
|
|
37
|
-
-
|
|
37
|
+
- 支持 MiniMax H3 视频、Qwen-Image 图片和 IndexTTS 2.5 语音任务,以及素材上传、视频 Skill 和积分查询
|
|
38
38
|
- 默认中文帮助,可切换英文;所有命令支持 JSON 输出
|
|
39
39
|
- 可通过 `compshare feedback` 反馈 CLI 问题和建议
|
|
40
40
|
|
|
@@ -88,6 +88,18 @@ compshare --json minimax create '一只猫在海边奔跑' --dry-run
|
|
|
88
88
|
compshare --json minimax create '一只猫在海边奔跑' --yes
|
|
89
89
|
compshare --json minimax points
|
|
90
90
|
|
|
91
|
+
# 图片:查看价格、创建任务、查询结果
|
|
92
|
+
compshare --json minimax image config
|
|
93
|
+
compshare --json minimax image create '一只戴着宇航头盔的猫' --resolution 1K --dry-run
|
|
94
|
+
compshare --json minimax image create '一只戴着宇航头盔的猫' --resolution 1K --yes
|
|
95
|
+
compshare --json minimax image show TASK_ID
|
|
96
|
+
|
|
97
|
+
# 语音:先查询可用音色,再创建任务
|
|
98
|
+
compshare --json minimax audio pricing
|
|
99
|
+
compshare --json minimax audio voices
|
|
100
|
+
compshare --json minimax audio create '你好,欢迎使用优云智算。' --voice-id VOICE_ID --dry-run
|
|
101
|
+
compshare --json minimax audio create '你好,欢迎使用优云智算。' --voice-id VOICE_ID --yes
|
|
102
|
+
|
|
91
103
|
# 查看帮助
|
|
92
104
|
compshare -h
|
|
93
105
|
compshare instance -h
|
|
@@ -103,7 +115,7 @@ compshare instance GPU 实例、规格、库存、价格和生命周期
|
|
|
103
115
|
compshare image 平台、自定义、社区及共享镜像
|
|
104
116
|
compshare storage 云盘和 US3 挂载
|
|
105
117
|
compshare bandwidth 独享带宽和实例 EIP 带宽归属
|
|
106
|
-
compshare minimax MiniMax H3
|
|
118
|
+
compshare minimax MiniMax H3 视频、图片、语音、Skill 和积分
|
|
107
119
|
compshare team 团队、邀请、成员额度、账单和审计
|
|
108
120
|
```
|
|
109
121
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
compshare_cli/__init__.py,sha256=
|
|
1
|
+
compshare_cli/__init__.py,sha256=A-QnV_7ORmVzK8nUJXTiOaViFHp4hWBa-dsz56Y74n8,60
|
|
2
2
|
compshare_cli/__main__.py,sha256=ftkB0R9jLZejzr717131qktgfFhTe12noFeGqQsVZMc,74
|
|
3
3
|
compshare_cli/actions.py,sha256=DWIXXrUHru_mT6DNnrV5VhkfRhgyBGsu73uQk-7o8Mc,3633
|
|
4
4
|
compshare_cli/api.py,sha256=S4hUvkbG0l7qUqQaAf7trX29GteF1yVnOGgjcJj99jc,9286
|
|
5
5
|
compshare_cli/cli.py,sha256=esimt5yCxnAb0KIFaxvj4iwEPPv1S7wJzwDhFlMS2-0,19664
|
|
6
6
|
compshare_cli/config.py,sha256=xzcP4dvZEclEAaQHsB0ybF7jnxKC9cY_EbWQl0w7TO4,7529
|
|
7
7
|
compshare_cli/errors.py,sha256=ZVVxqJnmaBFfV4k-Q7wuLvxA83iQhmFZ_Bx5w6o9EN4,262
|
|
8
|
-
compshare_cli/i18n.py,sha256=
|
|
8
|
+
compshare_cli/i18n.py,sha256=mpDzOSCqwFvmYFPQLWx7ih9vg9KtV4GjZpIp5crTT94,66672
|
|
9
9
|
compshare_cli/insights.py,sha256=0ouShkU_8_XusQG8JttfZBW-cG6GD9YBpB_AbPS5tnU,4819
|
|
10
10
|
compshare_cli/instance_templates.py,sha256=UGDxQ5IChId4hTTDByKEVk594qswMj1r6LIuU9Qty7A,7894
|
|
11
11
|
compshare_cli/location.py,sha256=17hE_AGU3yKYEA5v-5W6HEU61l4K1JZDdgCpbGIM2KE,4324
|
|
12
|
-
compshare_cli/mcp_server.py,sha256=
|
|
12
|
+
compshare_cli/mcp_server.py,sha256=9c9ALWetTur0SQJSZ76usuW7ilpir7C4bPcKFQyGGZo,20205
|
|
13
13
|
compshare_cli/output.py,sha256=uvmmN3yT6jHkfMEo_GmzQTX8qMF2HHgcJ4aEKZcBBps,12525
|
|
14
14
|
compshare_cli/parsing.py,sha256=pn4W_lZY2FBhdUjHUDFAHvA_kgcc1ch6D-7uOfJZ68E,4578
|
|
15
15
|
compshare_cli/remote_jobs.py,sha256=soAPdpJLCG5Hus-ciqQ0f0vYm-4hgl_thz62RWR1wSA,18808
|
|
@@ -24,12 +24,12 @@ compshare_cli/commands/doctor.py,sha256=JgX9Lg-wvIAql8KkyKKMh51BUyNxqK5ZGlgmBONj
|
|
|
24
24
|
compshare_cli/commands/feedback.py,sha256=wSoIq-1z_mkRr7w4h_jfWQf492aEyZCUvZcJs2lvNJM,575
|
|
25
25
|
compshare_cli/commands/image.py,sha256=e-3_9FVPOxAyRK-ZLW7L4FSWFUyiM7KyZyPAdABY4ik,22735
|
|
26
26
|
compshare_cli/commands/instance.py,sha256=ELAfNGpijeQmDozpYZgU-ZLMqnAtS01pjG-l5uklZZA,109625
|
|
27
|
-
compshare_cli/commands/minimax.py,sha256=
|
|
27
|
+
compshare_cli/commands/minimax.py,sha256=ng0X09NcDTidYtA14O9nnJu5wEamvx-HkTmV4ifxeD8,43034
|
|
28
28
|
compshare_cli/commands/storage.py,sha256=eUmX2KWx-aYr3ea6GVHVjffq0-58cjsEzINxLOrspyI,8975
|
|
29
29
|
compshare_cli/commands/team.py,sha256=weVCgFPOoDDl03LWmVGhXNR0BPkUvyOUwUHlxUOWyKY,23651
|
|
30
|
-
compshare_cli-0.
|
|
31
|
-
compshare_cli-0.
|
|
32
|
-
compshare_cli-0.
|
|
33
|
-
compshare_cli-0.
|
|
34
|
-
compshare_cli-0.
|
|
35
|
-
compshare_cli-0.
|
|
30
|
+
compshare_cli-0.5.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
31
|
+
compshare_cli-0.5.0.dist-info/METADATA,sha256=Prd9nwv7KW7OtORddhQy0Obx8BQNwJZNzk5v4D0RU1M,5556
|
|
32
|
+
compshare_cli-0.5.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
33
|
+
compshare_cli-0.5.0.dist-info/entry_points.txt,sha256=GGv28Bsp3CfBKbcoG6nr2ceqPWYR_XIk0HxxN02olsU,149
|
|
34
|
+
compshare_cli-0.5.0.dist-info/top_level.txt,sha256=ROBw509DOLNt7Z-xwrArjK066G7s4IH0jTcGiaKyMNw,14
|
|
35
|
+
compshare_cli-0.5.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|