@cliptude/cli 0.1.5 → 0.1.9

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.
@@ -1,4 +1,4 @@
1
- """Tiny CLI wrapping /api/v1: auth | templates | generate | status | jobs | account | cancel."""
1
+ """Tiny CLI wrapping /api/v1: auth | templates | template-create | template-options | voices | avatars | estimate | generate | editor | agent | render | script | voiceover | continue | status | jobs | account | cancel."""
2
2
 
3
3
  from __future__ import annotations
4
4
 
@@ -35,6 +35,64 @@ def _resolve_template_id(client: CliptudeClient, value: str) -> str:
35
35
  raise CliptudeApiError(f"Template not found: {value}")
36
36
 
37
37
 
38
+ def _add_thumbnail_args(parser: argparse.ArgumentParser, *, scope: str) -> None:
39
+ parser.add_argument(
40
+ "--thumbnail-prompt",
41
+ default="",
42
+ help=f"Thumbnail brief for {scope} (people, style, text). Not with --thumbnail-reference.",
43
+ )
44
+ parser.add_argument(
45
+ "--thumbnail-reference",
46
+ default="",
47
+ help=(
48
+ f"YouTube video link or https image whose thumbnail style {scope} copies. Without a brief or "
49
+ "reference, each video picks a reference for its own title."
50
+ ),
51
+ )
52
+
53
+
54
+ def _thumbnail_from_args(args) -> dict | None:
55
+ thumbnail = {
56
+ key: value.strip()
57
+ for key, value in (
58
+ ("custom_prompt", getattr(args, "thumbnail_prompt", "")),
59
+ ("reference_url", getattr(args, "thumbnail_reference", "")),
60
+ )
61
+ if value and value.strip()
62
+ }
63
+ return thumbnail or None
64
+
65
+
66
+ def _parse_set_args(pairs: list[str]) -> dict:
67
+ out = {}
68
+ for pair in pairs:
69
+ key, sep, raw = pair.partition("=")
70
+ if not sep or not key.strip():
71
+ raise CliptudeApiError(f"--set expects KEY=VALUE, got {pair!r}")
72
+ try:
73
+ value = json.loads(raw)
74
+ except json.JSONDecodeError:
75
+ value = raw
76
+ out[key.strip()] = value
77
+ return out
78
+
79
+
80
+ _DONE_STATUSES = {"completed", "failed", "cancelled", "conflict"}
81
+
82
+
83
+ def _wait(fetch, status_of, *, interval: float = 10.0, timeout: float = 3600.0):
84
+ import time
85
+
86
+ deadline = time.monotonic() + timeout
87
+ while True:
88
+ payload = fetch()
89
+ status = str(status_of(payload) or "").lower()
90
+ if status in _DONE_STATUSES or time.monotonic() > deadline:
91
+ return payload
92
+ print(f"{status or 'pending'}...", file=sys.stderr)
93
+ time.sleep(interval)
94
+
95
+
38
96
  def _run_auth(auth_cmd: str) -> None:
39
97
  from cliptude_mcp.auth_login import AuthLoginError, login
40
98
  from cliptude_mcp.credentials import clear_credentials, stored_access_token
@@ -55,7 +113,7 @@ def _run_auth(auth_cmd: str) -> None:
55
113
  print("Not authenticated. Run: cliptude auth login", file=sys.stderr)
56
114
  raise SystemExit(1)
57
115
  try:
58
- account = CliptudeClient().get_account()
116
+ account = CliptudeClient(client_kind="cli").get_account()
59
117
  except Exception as exc:
60
118
  _die(exc)
61
119
  email = account.get("email") if isinstance(account, dict) else None
@@ -86,6 +144,80 @@ def main(argv: list[str] | None = None) -> None:
86
144
  t.add_argument("--limit", type=int, default=20)
87
145
  t.add_argument("--offset", type=int, default=0)
88
146
 
147
+ tc = sub.add_parser(
148
+ "template-create",
149
+ help="Create a template from settings (no wizard)",
150
+ formatter_class=argparse.RawDescriptionHelpFormatter,
151
+ epilog=(
152
+ "example:\n"
153
+ ' cliptude template-create --name "TSMC doc" --format faceless_documentary '
154
+ "--set voice_id=JBFqnCBsd6RMkjVDRZzb --set voice_name=George --set generation_model=pro "
155
+ "--set faceless_documentary_style=investigative --set faceless_documentary_primary=#E11D48\n"
156
+ ' cliptude template-create --name "TSMC doc" --format faceless_documentary --settings-file settings.json\n'
157
+ "See cliptude template-options --format <format> for every field and its choices."
158
+ ),
159
+ )
160
+ tc.add_argument("--name", required=True)
161
+ tc.add_argument("--format", required=True, help="e.g. faceless_documentary, vector_explainer")
162
+ tc.add_argument("--settings-file", default="", help="JSON object of settings")
163
+ tc.add_argument(
164
+ "--set",
165
+ action="append",
166
+ default=[],
167
+ metavar="KEY=VALUE",
168
+ help="One setting; VALUE is parsed as JSON when possible (true, 0.4, [\"a\"]), else a string. Repeatable.",
169
+ )
170
+ _add_thumbnail_args(tc, scope="every video from this template")
171
+
172
+ to = sub.add_parser("template-options", help="Fields, choices and defaults for template-create")
173
+ to.add_argument("--format", required=True)
174
+
175
+ vc = sub.add_parser("voices", help="List voices for template-create (voice_id)")
176
+ vc.add_argument("--provider", default="elevenlabs", help="elevenlabs, minimax, cartesia, inworld, voicetory")
177
+ vc.add_argument("--language", default="")
178
+
179
+ av = sub.add_parser("avatars", help="List avatars for Avatar Video (id for --avatar / avatar_profile_id)")
180
+ av.add_argument("--section", default="", choices=["", "mine", "builtin", "public", "favorites"])
181
+ av.add_argument("--search", default="", help="Part of the avatar's name")
182
+ av.add_argument("--gender", default="", choices=["", "male", "female"])
183
+ av.add_argument("--limit", type=int, default=50)
184
+
185
+ vcl = sub.add_parser("vector-characters", help="List Vector Explainer characters (built-in and your uploads)")
186
+ vcu = sub.add_parser(
187
+ "vector-character-upload",
188
+ help="Add your own Vector Explainer character from a local image or a public URL; prints its id",
189
+ )
190
+ vcu.add_argument("--name", required=True, help="Short name for the character")
191
+ vcu.add_argument("--file", default="", help="Local PNG, JPG or WEBP")
192
+ vcu.add_argument("--url", default="", help="Public https link to the image")
193
+ vcd = sub.add_parser("vector-character-delete", help="Delete one of your uploaded Vector Explainer characters")
194
+ vcd.add_argument("character_id")
195
+
196
+ est = sub.add_parser(
197
+ "estimate",
198
+ help="Credits a job would need (creates nothing)",
199
+ formatter_class=argparse.RawDescriptionHelpFormatter,
200
+ epilog=(
201
+ "example:\n"
202
+ ' cliptude estimate --template "Finance vector weekly" --script-file script.txt\n'
203
+ ' cliptude estimate --template "Finance vector weekly" --voiceover-seconds 3600'
204
+ ),
205
+ )
206
+ est.add_argument("--template", required=True, help="Template name or UUID")
207
+ est.add_argument("--prompt", default="")
208
+ est.add_argument("--script", default="")
209
+ est.add_argument("--script-file", default="")
210
+ est.add_argument("--duration", default="", help="Duration bucket, e.g. 6-8. Default: template (or from --script)")
211
+ est.add_argument("--voiceover-seconds", type=float, default=None, help="Length of the voiceover you would upload")
212
+ est.add_argument("--talking-head-seconds", type=float, default=None, help="Length of the talking-head video you would upload")
213
+ est.add_argument("--output", default="", choices=["", "video", "plan", "script", "voiceover"])
214
+ est.add_argument("--avatar-intro-only", action=argparse.BooleanOptionalAction, default=None)
215
+ est.add_argument("--avatar-ai-footage", action=argparse.BooleanOptionalAction, default=None)
216
+ est.add_argument("--avatar", type=int, default=None, help="Avatar Video: avatar id from `cliptude avatars`. Default: the template's avatar")
217
+ est.add_argument("--avatar-engine", default="", choices=["", "iii", "iv", "v"], help="Avatar Video: HeyGen engine. Default: the template's")
218
+ est.add_argument("--vector-motion", default="", choices=["", "none", "video"], help="Vector Explainer: price stills (none) or AI clips (video)")
219
+ est.add_argument("--render-only", action="store_true", help="Plan job where you bring the voiceover, pictures, clips and graphics (with --output plan --voiceover-seconds)")
220
+
89
221
  g = sub.add_parser(
90
222
  "generate",
91
223
  help="Start a job",
@@ -98,7 +230,9 @@ def main(argv: list[str] | None = None) -> None:
98
230
  ' cliptude generate --template "Finance vector weekly" --title "Why index funds win" '
99
231
  '--script-file script.txt\n'
100
232
  ' cliptude generate --template "Finance vector weekly" --title "Why index funds win" '
101
- '--voiceover narration.mp3'
233
+ '--voiceover narration.mp3\n'
234
+ ' cliptude generate --template "My talking head" --title "Weekly recap" '
235
+ '--talking-head clip.mp4'
102
236
  ),
103
237
  )
104
238
  g.add_argument("--template", required=True, help="Template name or UUID")
@@ -115,27 +249,219 @@ def main(argv: list[str] | None = None) -> None:
115
249
  default="",
116
250
  help="Path to a narration audio file (MP3, M4A, WAV, …). Transcribed; skips TTS. Do not combine with --prompt or --script.",
117
251
  )
252
+ g.add_argument("--voiceover-url", default="", help="Public https link to the narration audio; Cliptude downloads it.")
118
253
  g.add_argument(
119
- "--faceless-coding",
120
- default="external",
121
- help=(
122
- "Faceless Explainer: default external (this session authors HTML). "
123
- "Pass cliptude to let Cliptude code. Ignored on other formats."
124
- ),
254
+ "--talking-head",
255
+ default="",
256
+ help="Path to a talking-head presenter video (MP4, MOV, WEBM, AVI). Requires a Talking Head template. Transcribed; skips TTS. Do not combine with --prompt, --script, or --voiceover.",
125
257
  )
126
258
  g.add_argument(
127
259
  "--duration",
128
260
  default="",
129
261
  help="Wizard duration bucket, e.g. 3-4 or 6-8. Default: template duration (or estimated from --script)",
130
262
  )
263
+ g.add_argument(
264
+ "--avatar-intro-only",
265
+ action=argparse.BooleanOptionalAction,
266
+ default=None,
267
+ help=(
268
+ "Avatar Video: Avatar Intro Only (HeyGen in a short opening). "
269
+ "Omit to use the template. Only valid for Avatar Video templates."
270
+ ),
271
+ )
272
+ g.add_argument(
273
+ "--avatar-ai-footage",
274
+ action=argparse.BooleanOptionalAction,
275
+ default=None,
276
+ help=(
277
+ "Avatar Video: AI Image + AI Video instead of stock and web footage. "
278
+ "Omit to use the template. Only valid for Avatar Video templates."
279
+ ),
280
+ )
281
+ g.add_argument("--avatar", type=int, default=None, help="Avatar Video: avatar id from `cliptude avatars`. Default: the template's avatar")
282
+ g.add_argument("--avatar-engine", default="", choices=["", "iii", "iv", "v"], help="Avatar Video: HeyGen engine. Default: the template's")
283
+ g.add_argument(
284
+ "--disable-animations",
285
+ action=argparse.BooleanOptionalAction,
286
+ default=None,
287
+ help="No animated text reveals or motion graphics. Omit to use the template.",
288
+ )
289
+ g.add_argument(
290
+ "--disable-overlays",
291
+ action=argparse.BooleanOptionalAction,
292
+ default=None,
293
+ help="No text overlays or graphic elements over footage (captions unaffected). Omit to use the template.",
294
+ )
295
+ g.add_argument(
296
+ "--disable-effects",
297
+ action=argparse.BooleanOptionalAction,
298
+ default=None,
299
+ help="No color grading, film grain, or light leaks. Ken Burns is unaffected. Omit to use the template.",
300
+ )
301
+ g.add_argument(
302
+ "--disable-transitions",
303
+ action=argparse.BooleanOptionalAction,
304
+ default=None,
305
+ help="No scene transitions; hard cuts only. Omit to use the template.",
306
+ )
307
+ g.add_argument(
308
+ "--exclude-animation-type",
309
+ action="append",
310
+ dest="excluded_animation_types",
311
+ default=None,
312
+ metavar="TYPE",
313
+ help="Exclude an animation type from this video. Repeatable. Omit to use the template.",
314
+ )
315
+ g.add_argument(
316
+ "--exclude-transition",
317
+ action="append",
318
+ dest="excluded_transition_kinds",
319
+ default=None,
320
+ metavar="SLUG",
321
+ help="Exclude a transition (e.g. flip-horizontal) from auto-selection. Repeatable. Omit to use the template.",
322
+ )
323
+ _add_thumbnail_args(g, scope="this video")
324
+ g.add_argument("--vector-motion", default="", choices=["", "none", "video"], help='Vector Explainer: "none" = stills with camera moves, "video" = AI clips. Default: the template\'s')
325
+ g.add_argument("--vector-character", default="", help='Vector Explainer: character id from `cliptude vector-characters`, or "none". Default: the template\'s')
131
326
 
132
- k = sub.add_parser("kit", help="Download Faceless coding kit zip")
133
- k.add_argument("job_id")
134
- k.add_argument("--out", default="kit.zip")
327
+ sc = sub.add_parser(
328
+ "script",
329
+ help="Generate a spoken script only (no video)",
330
+ formatter_class=argparse.RawDescriptionHelpFormatter,
331
+ epilog=(
332
+ "example:\n"
333
+ ' cliptude script --template "Finance vector weekly" --title "Why index funds win" '
334
+ '--prompt "why most retail traders underperform the S&P" --duration 3-4'
335
+ ),
336
+ )
337
+ sc.add_argument("--template", required=True, help="Template name or UUID")
338
+ sc.add_argument("--title", required=True)
339
+ sc.add_argument("--prompt", required=True, help="Topic or brief. Cliptude writes the narration.")
340
+ sc.add_argument("--duration", default="", help="Wizard duration bucket, e.g. 3-4 or 6-8")
341
+
342
+ vo = sub.add_parser(
343
+ "voiceover",
344
+ help="Generate TTS audio only (no video)",
345
+ formatter_class=argparse.RawDescriptionHelpFormatter,
346
+ epilog=(
347
+ "example:\n"
348
+ ' cliptude voiceover --template "Finance vector weekly" --title "Why index funds win" '
349
+ '--script-file script.txt'
350
+ ),
351
+ )
352
+ vo.add_argument("--template", required=True, help="Template name or UUID")
353
+ vo.add_argument("--title", required=True)
354
+ vo.add_argument("--prompt", default="", help="Topic or brief. Cliptude writes the narration then voices it.")
355
+ vo.add_argument("--script", default="")
356
+ vo.add_argument("--script-file", default="")
357
+ vo.add_argument("--duration", default="", help="Wizard duration bucket, e.g. 3-4 or 6-8")
135
358
 
136
- sp = sub.add_parser("submit-project", help="Upload Faceless project zip")
137
- sp.add_argument("job_id")
138
- sp.add_argument("zip_path")
359
+ dv = sub.add_parser("download-voiceover", help="Download voiceover MP3 for a completed voiceover job")
360
+ dv.add_argument("job_id")
361
+ dv.add_argument("--out", default="voiceover.mp3")
362
+
363
+ cont = sub.add_parser(
364
+ "continue",
365
+ help="Turn a completed script/voiceover job, or a plan job with a locked plan, into a full video",
366
+ formatter_class=argparse.RawDescriptionHelpFormatter,
367
+ epilog=(
368
+ "example:\n"
369
+ " cliptude continue <job-id>"
370
+ ),
371
+ )
372
+ cont.add_argument("job_id")
373
+
374
+ pj = sub.add_parser(
375
+ "plan-job",
376
+ help="Start an agent-planned job: Cliptude voices the narration and stops at plan_ready",
377
+ formatter_class=argparse.RawDescriptionHelpFormatter,
378
+ epilog=(
379
+ "example:\n"
380
+ ' cliptude plan-job --template "TSMC doc" --title "The island" --script-file script.txt\n'
381
+ " cliptude narration <job-id> > narration.json\n"
382
+ " cliptude catalog --format faceless_documentary --compact\n"
383
+ " cliptude plan-check <job-id> plan.json (repeat until valid)\n"
384
+ " cliptude plan-lock <job-id> plan.json && cliptude continue <job-id>\n"
385
+ " cliptude plan-report <job-id>"
386
+ ),
387
+ )
388
+ pj.add_argument("--template", required=True, help="Template name or UUID (Faceless Documentary, Top 10, Avatar Video)")
389
+ pj.add_argument("--title", required=True)
390
+ pj.add_argument("--prompt", default="", help="Topic or brief. Cliptude writes the narration.")
391
+ pj.add_argument("--script", default="")
392
+ pj.add_argument("--script-file", default="")
393
+ pj.add_argument("--voiceover", default="", help="Local audio to use as the narration (aligned, not re-voiced)")
394
+ pj.add_argument("--voiceover-url", default="", help="Public https link to the narration audio; Cliptude downloads it")
395
+ pj.add_argument("--duration", default="", help="Wizard duration bucket, e.g. 6-8")
396
+ pj.add_argument("--avatar", type=int, default=None, help="Avatar Video: avatar id from `cliptude avatars`. Default: the template's avatar")
397
+ pj.add_argument("--avatar-engine", default="", choices=["", "iii", "iv", "v"], help="Avatar Video: HeyGen engine. Default: the template's")
398
+ pj.add_argument("--render-only", action="store_true", help="You bring everything (needs --voiceover); Cliptude only builds and renders, at the render-only rate")
399
+ _add_thumbnail_args(pj, scope="this video")
400
+ pj.add_argument("--vector-motion", default="", choices=["", "none", "video"], help='Vector Explainer: "none" = stills with camera moves, "video" = AI clips. Default: the template\'s')
401
+ pj.add_argument("--vector-character", default="", help='Vector Explainer: character id from `cliptude vector-characters`, or "none". Default: the template\'s')
402
+
403
+ nr = sub.add_parser("narration", help="Numbered sentences and word timings of a plan_ready job")
404
+ nr.add_argument("job_id")
405
+
406
+ cat = sub.add_parser("catalog", help="Graphics an agent can place (kinds, types, overlay styles)")
407
+ cat.add_argument("--format", default="", help="faceless_documentary, faceless_top_10, avatar_video or vector_explainer")
408
+ cat.add_argument("--theme", default="")
409
+ cat.add_argument("--compact", action="store_true", help="One summary line per graphic")
410
+ cat.add_argument("--types", default="", help="Comma-separated types/styles for full entries")
411
+ cat.add_argument("--premium", action="store_true", help="Only the premium boards")
412
+
413
+ for name, text in (("plan-check", "Validate a plan file (nothing stored)"), ("plan-lock", "Validate and lock a plan file")):
414
+ pc = sub.add_parser(name, help=text)
415
+ pc.add_argument("job_id")
416
+ pc.add_argument("plan_file", help="JSON file with the cliptude.plan/v1 plan")
417
+
418
+ pg = sub.add_parser("plan-get", help="Show the locked plan")
419
+ pg.add_argument("job_id")
420
+ pv = sub.add_parser("plan-review", help="The built design beat by beat and graphic by graphic (review before rendering)")
421
+ pv.add_argument("job_id")
422
+ pr = sub.add_parser("plan-report", help="What sourcing used for each media request of the locked plan")
423
+ pr.add_argument("job_id")
424
+ um = sub.add_parser("upload-media", help="Send a picture or clip you found to a plan job; prints its keep id for media.keep")
425
+ um.add_argument("job_id")
426
+ um.add_argument("path", help="Local JPG/PNG/WEBP/GIF (up to 15 MB) or MP4/MOV/WEBM/M4V (up to 300 MB)")
427
+
428
+ ed = sub.add_parser("editor", help="Open the timeline editor project for a completed job (prints the timeline)")
429
+ ed.add_argument("job_id")
430
+
431
+ ag = sub.add_parser(
432
+ "agent",
433
+ help="Ask Cliptude Agent to edit a project's timeline",
434
+ formatter_class=argparse.RawDescriptionHelpFormatter,
435
+ epilog=(
436
+ "example:\n"
437
+ ' cliptude agent 123 --prompt "Replace this shot with real footage of a TSMC fab" --items clip-1 --wait\n'
438
+ "Item ids come from cliptude editor <job-id> (timeline[].id)."
439
+ ),
440
+ )
441
+ ag.add_argument("project_id")
442
+ ag.add_argument("--prompt", default="", help="Edit request in plain English")
443
+ ag.add_argument("--prompt-file", default="")
444
+ ag.add_argument("--items", default="", help="Comma-separated timeline item ids the request is about")
445
+ ag.add_argument("--tier", default="fast", help="fast or smart (see cliptude agent-tiers)")
446
+ ag.add_argument("--chat", default="", help="Continue an existing agent chat id")
447
+ ag.add_argument("--wait", action="store_true", help="Poll until the run finishes")
448
+
449
+ ags = sub.add_parser("agent-status", help="Get a Cliptude Agent run")
450
+ ags.add_argument("project_id")
451
+ ags.add_argument("run_id")
452
+
453
+ agc = sub.add_parser("agent-cancel", help="Cancel a Cliptude Agent run")
454
+ agc.add_argument("project_id")
455
+ agc.add_argument("run_id")
456
+
457
+ sub.add_parser("agent-tiers", help="List Cliptude Agent tiers")
458
+
459
+ rn = sub.add_parser("render", help="Render an edited project to a new MP4")
460
+ rn.add_argument("project_id")
461
+ rn.add_argument("--wait", action="store_true", help="Poll until the render finishes")
462
+
463
+ rs = sub.add_parser("render-status", help="Get an editor render (output_url when done)")
464
+ rs.add_argument("render_id")
139
465
 
140
466
  s = sub.add_parser("status", help="Get job status")
141
467
  s.add_argument("job_id")
@@ -153,38 +479,212 @@ def main(argv: list[str] | None = None) -> None:
153
479
  if args.cmd == "auth":
154
480
  _run_auth(args.auth_cmd)
155
481
  return
156
- client = CliptudeClient()
482
+ client = CliptudeClient(client_kind="cli")
157
483
  try:
158
484
  if args.cmd == "templates":
159
485
  _print(client.list_templates(limit=args.limit, offset=args.offset))
486
+ elif args.cmd == "template-create":
487
+ settings = {}
488
+ if args.settings_file:
489
+ settings = json.loads(Path(args.settings_file).read_text(encoding="utf-8"))
490
+ if not isinstance(settings, dict):
491
+ raise CliptudeApiError("--settings-file must contain a JSON object.")
492
+ settings.update(_parse_set_args(args.set))
493
+ thumbnail = _thumbnail_from_args(args)
494
+ if thumbnail:
495
+ settings["thumbnail"] = thumbnail
496
+ _print(client.create_template(name=args.name, format=args.format, settings=settings))
497
+ elif args.cmd == "template-options":
498
+ _print(client.template_options(args.format))
499
+ elif args.cmd == "voices":
500
+ _print(client.list_voices(provider=args.provider, language=args.language or None))
501
+ elif args.cmd == "vector-characters":
502
+ _print(client.list_vector_characters())
503
+ elif args.cmd == "vector-character-upload":
504
+ if bool(args.file) == bool(args.url):
505
+ raise CliptudeApiError("Give --file or --url (one of them).")
506
+ _print(client.upload_vector_character(
507
+ image_path=args.file or None, image_url=args.url or None, name=args.name,
508
+ ))
509
+ elif args.cmd == "vector-character-delete":
510
+ _print(client.delete_vector_character(args.character_id))
511
+ elif args.cmd == "avatars":
512
+ _print(client.list_avatars(
513
+ section=args.section or None, search=args.search or None,
514
+ gender=args.gender or None, limit=args.limit,
515
+ ))
516
+ elif args.cmd == "estimate":
517
+ script = args.script
518
+ if args.script_file:
519
+ script = Path(args.script_file).read_text(encoding="utf-8")
520
+ _print(client.estimate_credits(
521
+ template_id=_resolve_template_id(client, args.template),
522
+ prompt=args.prompt or None,
523
+ script=script or None,
524
+ duration=args.duration or None,
525
+ voiceover_seconds=args.voiceover_seconds,
526
+ talking_head_seconds=args.talking_head_seconds,
527
+ output=args.output or None,
528
+ avatar_intro_only=args.avatar_intro_only,
529
+ avatar_ai_footage=args.avatar_ai_footage,
530
+ avatar_profile_id=args.avatar,
531
+ avatar_engine=args.avatar_engine or None,
532
+ render_only=args.render_only or None,
533
+ vector_reveal_mode=args.vector_motion or None,
534
+ ))
160
535
  elif args.cmd == "generate":
161
536
  script = args.script
162
537
  if args.script_file:
163
538
  script = Path(args.script_file).read_text(encoding="utf-8")
164
539
  voiceover = (args.voiceover or "").strip()
540
+ voiceover_url = (args.voiceover_url or "").strip()
541
+ talking_head = (args.talking_head or "").strip()
542
+ if talking_head and (voiceover or voiceover_url):
543
+ raise CliptudeApiError("Use --talking-head or --voiceover, not both.")
544
+ if talking_head and (args.prompt or script):
545
+ raise CliptudeApiError(
546
+ "Use --talking-head or --prompt/--script, not both. "
547
+ "An uploaded talking head is transcribed and used as the narration."
548
+ )
165
549
  if voiceover and (args.prompt or script):
166
550
  raise CliptudeApiError(
167
551
  "Use --voiceover or --prompt/--script, not both. "
168
552
  "An uploaded file is transcribed and used as the narration."
169
553
  )
170
- if not voiceover and not (args.prompt or script):
171
- raise CliptudeApiError("Provide --prompt, --script / --script-file, or --voiceover.")
554
+ if not talking_head and not voiceover and not (args.prompt or script):
555
+ raise CliptudeApiError(
556
+ "Provide --prompt, --script / --script-file, --voiceover, or --talking-head."
557
+ )
172
558
  template_id = _resolve_template_id(client, args.template)
173
559
  _print(client.create_job(
174
560
  template_id=template_id,
175
561
  title=args.title,
176
562
  prompt=args.prompt or None,
177
563
  script=script or None,
178
- faceless_coding=args.faceless_coding,
179
564
  duration=(args.duration or None),
180
565
  voiceover_path=voiceover or None,
566
+ voiceover_url=voiceover_url or None,
567
+ talking_head_path=talking_head or None,
568
+ avatar_intro_only=args.avatar_intro_only,
569
+ avatar_ai_footage=args.avatar_ai_footage,
570
+ avatar_profile_id=args.avatar,
571
+ avatar_engine=args.avatar_engine or None,
572
+ disable_animations=args.disable_animations,
573
+ disable_overlays=args.disable_overlays,
574
+ disable_effects=args.disable_effects,
575
+ disable_transitions=args.disable_transitions,
576
+ excluded_animation_types=args.excluded_animation_types,
577
+ excluded_transition_kinds=args.excluded_transition_kinds,
578
+ thumbnail=_thumbnail_from_args(args),
579
+ vector_character_id=args.vector_character or None,
580
+ vector_reveal_mode=args.vector_motion or None,
581
+ ))
582
+ elif args.cmd == "script":
583
+ if not (args.prompt or "").strip():
584
+ raise CliptudeApiError("Provide --prompt.")
585
+ template_id = _resolve_template_id(client, args.template)
586
+ _print(client.create_job(
587
+ template_id=template_id,
588
+ title=args.title,
589
+ prompt=args.prompt,
590
+ duration=(args.duration or None),
591
+ output="script",
592
+ ))
593
+ elif args.cmd == "voiceover":
594
+ script = args.script
595
+ if args.script_file:
596
+ script = Path(args.script_file).read_text(encoding="utf-8")
597
+ if not (args.prompt or "").strip() and not (script or "").strip():
598
+ raise CliptudeApiError("Provide --prompt or --script / --script-file.")
599
+ template_id = _resolve_template_id(client, args.template)
600
+ _print(client.create_job(
601
+ template_id=template_id,
602
+ title=args.title,
603
+ prompt=args.prompt or None,
604
+ script=script or None,
605
+ duration=(args.duration or None),
606
+ output="voiceover",
607
+ ))
608
+ elif args.cmd == "plan-job":
609
+ script = args.script
610
+ if args.script_file:
611
+ script = Path(args.script_file).read_text(encoding="utf-8")
612
+ voiceover = (args.voiceover or "").strip()
613
+ voiceover_url = (args.voiceover_url or "").strip()
614
+ if not (args.prompt or "").strip() and not (script or "").strip() and not voiceover and not voiceover_url:
615
+ raise CliptudeApiError("Provide --prompt, --script / --script-file, --voiceover or --voiceover-url.")
616
+ template_id = _resolve_template_id(client, args.template)
617
+ _print(client.create_job(
618
+ template_id=template_id,
619
+ title=args.title,
620
+ prompt=args.prompt or None,
621
+ script=script or None,
622
+ voiceover_path=voiceover or None,
623
+ voiceover_url=voiceover_url or None,
624
+ duration=(args.duration or None),
625
+ output="plan",
626
+ avatar_profile_id=args.avatar,
627
+ avatar_engine=args.avatar_engine or None,
628
+ render_only=args.render_only or None,
629
+ thumbnail=_thumbnail_from_args(args),
630
+ vector_character_id=args.vector_character or None,
631
+ vector_reveal_mode=args.vector_motion or None,
632
+ ))
633
+ elif args.cmd == "narration":
634
+ _print(client.get_narration(args.job_id))
635
+ elif args.cmd == "catalog":
636
+ types = [t.strip() for t in (args.types or "").split(",") if t.strip()]
637
+ _print(client.get_kind_catalog(
638
+ format=args.format or None, theme=args.theme or None, compact=args.compact, types=types or None,
639
+ premium=args.premium,
181
640
  ))
182
- elif args.cmd == "kit":
641
+ elif args.cmd in ("plan-check", "plan-lock"):
642
+ plan = json.loads(Path(args.plan_file).read_text(encoding="utf-8"))
643
+ _print(client.put_plan(args.job_id, plan, dry_run=args.cmd == "plan-check"))
644
+ elif args.cmd == "plan-get":
645
+ _print(client.get_plan(args.job_id))
646
+ elif args.cmd == "plan-review":
647
+ _print(client.get_plan_review(args.job_id))
648
+ elif args.cmd == "plan-report":
649
+ _print(client.get_plan_report(args.job_id))
650
+ elif args.cmd == "upload-media":
651
+ _print(client.upload_plan_media(args.job_id, args.path))
652
+ elif args.cmd == "download-voiceover":
183
653
  dest = Path(args.out)
184
- client.download_coding_kit_file(args.job_id, dest)
654
+ client.download_voiceover_file(args.job_id, dest)
185
655
  _print({"ok": True, "path": str(dest.resolve())})
186
- elif args.cmd == "submit-project":
187
- _print(client.submit_faceless_project(args.job_id, args.zip_path))
656
+ elif args.cmd == "continue":
657
+ _print(client.continue_job(args.job_id))
658
+ elif args.cmd == "editor":
659
+ _print(client.open_editor_project(args.job_id))
660
+ elif args.cmd == "agent":
661
+ prompt = args.prompt
662
+ if args.prompt_file:
663
+ prompt = Path(args.prompt_file).read_text(encoding="utf-8")
664
+ if not (prompt or "").strip():
665
+ raise CliptudeApiError("Provide --prompt or --prompt-file.")
666
+ items = [i.strip() for i in (args.items or "").split(",") if i.strip()]
667
+ payload = client.run_agent(
668
+ args.project_id, prompt=prompt, tier=args.tier, referenced_item_ids=items, chat_id=args.chat or None
669
+ )
670
+ if args.wait:
671
+ run_id = (payload.get("run") or {}).get("id")
672
+ payload = _wait(lambda: client.get_agent_run(args.project_id, run_id), lambda p: (p.get("run") or {}).get("status"))
673
+ _print(payload)
674
+ elif args.cmd == "agent-status":
675
+ _print(client.get_agent_run(args.project_id, args.run_id))
676
+ elif args.cmd == "agent-cancel":
677
+ _print(client.cancel_agent_run(args.project_id, args.run_id))
678
+ elif args.cmd == "agent-tiers":
679
+ _print(client.agent_tiers())
680
+ elif args.cmd == "render":
681
+ payload = client.render_project(args.project_id)
682
+ if args.wait:
683
+ render_id = (payload.get("render") or {}).get("id")
684
+ payload = _wait(lambda: client.get_render(render_id), lambda p: (p.get("render") or {}).get("status"))
685
+ _print(payload)
686
+ elif args.cmd == "render-status":
687
+ _print(client.get_render(args.render_id))
188
688
  elif args.cmd == "status":
189
689
  _print(client.get_job(args.job_id))
190
690
  elif args.cmd == "jobs":