makaron-cli 0.17.3 → 0.17.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "makaron-cli",
3
- "version": "0.17.3",
3
+ "version": "0.17.5",
4
4
  "description": "Give Claude Code a creative agent. Pass complete creative requests and source media to Makaron Chat.",
5
5
  "author": {
6
6
  "name": "Versa AI",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "makaron-cli",
3
- "version": "0.17.3",
3
+ "version": "0.17.5",
4
4
  "description": "Give Codex a creative agent. Pass complete creative requests and source media to Makaron Chat.",
5
5
  "author": {
6
6
  "name": "Versa AI",
package/README.md CHANGED
@@ -107,7 +107,7 @@ npx makaron-cli chat --project auto --image photo.jpg --json -b "make it cinemat
107
107
  npx makaron-cli chat --project auto --image img1.jpg --image img2.jpg --json -b "combine these"
108
108
  ```
109
109
 
110
- `chat` routes image and video models automatically, but you may select the Agent LLM with `--agent-model`. Accepted values are `auto`, the base model IDs (`gpt-6-luna`, `gpt-6.1-sol`, `gpt-6-sol`, `gpt-5.6-terra`, `gpt-5.6-sol`, `gpt-5.6-luna`, `grok-4.6`, `deepseek-v4-pro`, `deepseek-flash`), and the personal-plan routes (`gpt-6-luna-codex-subscription`, `gpt-6.1-sol-codex-subscription`, `gpt-6-sol-codex-subscription`, `gpt-5.6-terra-codex-subscription`, `gpt-5.6-sol-codex-subscription`, `gpt-5.6-luna-codex-subscription`, `grok-4.6-grok-subscription`). `auto` resolves to GPT-6 Luna through the Codex subscription for eligible accounts (including admins) and through Azure API otherwise. Base GPT-5.6, GPT-6 and GPT-6.1 IDs select Azure API and base `grok-4.6` selects OpenRouter API; the suffixed IDs explicitly request the corresponding personal plan where authorized. This flag changes only the reasoning/tool-calling Agent LLM.
110
+ `chat` routes image and video models automatically, but you may select the Agent LLM with `--agent-model`. Accepted values are `auto`, the base model IDs (`gpt-6-luna`, `gpt-6.1-sol`, `gpt-6-sol`, `gpt-5.6-terra`, `gpt-5.6-sol`, `gpt-5.6-luna`, `grok-4.6`, `deepseek-v4-pro`, `deepseek-flash`), and the personal-plan routes (`gpt-6-luna-codex-subscription`, `gpt-6.1-sol-codex-subscription`, `gpt-6-sol-codex-subscription`, `gpt-5.6-terra-codex-subscription`, `gpt-5.6-sol-codex-subscription`, `gpt-5.6-luna-codex-subscription`, `grok-4.6-grok-subscription`). `auto` defaults to DeepSeek Flash with native vision, following the server-configured Agent model. When that default is a GPT model, eligible accounts (including admins) can use the Codex subscription; an explicitly selected model or personal-plan route is preserved. Base GPT-5.6, GPT-6 and GPT-6.1 IDs select Azure API and base `grok-4.6` selects OpenRouter API; the suffixed IDs explicitly request the corresponding personal plan where authorized. This flag changes only the reasoning/tool-calling Agent LLM.
111
111
 
112
112
  ```bash
113
113
  # Explicit lower-cost Agent LLM for a controlled comparison
@@ -382,6 +382,8 @@ npx makaron-cli responses get <runId> --pick output # full output arr
382
382
  npx makaron-cli responses get <runId> --pick status
383
383
  npx makaron-cli responses get <runId> --pick credits_used # net credits this run cost
384
384
  npx makaron-cli responses get <runId> --pick usage # per-tool credit breakdown
385
+ npx makaron-cli responses get <runId> --events --json # timestamped raw tool/event evidence, including active runs
386
+ npx makaron-cli responses get <runId> --events --after 1000 --json # next page after the last returned event sequence
385
387
  ```
386
388
 
387
389
  ## Fallback: Direct tool calls (no project context)
@@ -470,7 +472,9 @@ For project/timeline video editing, use:
470
472
  npx makaron-cli chat --project <id|auto> --video input.mp4 -b "make it funny"
471
473
  ```
472
474
 
473
- Options for `video create`: `--script "..."`, `--script-file <path>`, `--image <url>` (repeatable, up to the selected model limit), `--video <file|url>` and `--audio <file|url>` (repeatable where supported), `--voice <xai-preset-id>` (repeatable, Grok only), `--duration <seconds>`, `--aspect 9:16|16:9|1:1`, `--video-model seedance-fast|seedance-mini|seedance|seedance-2.5|wan-3.0|wan-3.0-prime|kling|grok|google-omni|minimax-h3|minimax-h3-max|fal-h3-max|sync-lipsync-v3`, `--video-resolution auto|480p|720p|768p|1080p|2k|4k`. Default model is FAL H3 Max (`fal-h3-max`) at 768p (480p/1080p optional): native text-to-video or image/video/audio reference-to-video, integer 5-15s, up to 9 images + 3 videos + 3 audios (12 total). SeeDance accepts native text-to-video with no image and integer output duration 4-15s (default 5s); every Seedance image input is submitted through reference-to-video, including one image. `seedance-mini` supports 480p/720p and is best for cheaper drafts/multi-size tests. Wan 3.0 and Wan 3.0 Prime both expose 480p/720p/1080p/2K/4K; 2K/4K automatically use the matching FlashVSR endpoint. MiniMax H3 accepts native text-to-video, 4-15s output, public 768p/2k resolution, and up to 9 image, up to 3 video, and up to 3 audio feature references through Makaron Agent/chat; a single image keeps the `reference_image` role. `sync-lipsync-v3` requires exactly one video plus one MP3/WAV and preserves that replacement audio while aligning the mouth. H3 defaults to 768p; request 2k explicitly for maximum/final quality. Kling supports 5-15s. Grok generation uses `grok-imagine-video-1.5`: text-only generation supports 480p/720p/1080p, while any 1-7 image or preset voice input uses reference-to-video and is capped at 720p. Grok edit/extend uses `grok-imagine-video` internally under the same `grok` selector. Gemini Omni supports 3-10s fast image/video generation and editing with native generated audio; every image-only generation request uses `reference_to_video`, including a single image, with up to 6 images when no video reference is provided.
475
+ Kling 4.0: use `--video-model kling-4` for native text-to-video or image/video feature references, integer 3–30s at 720p (default) or 1080p. Up to 10 images and 5 videos; source videos must each be 3s or longer, total at most 30s, 720–2160px per side, 24–60fps and at most 200MB each. `--video-operation edit` requires exactly one source video and preserves its canvas/audio. Explicit keyframe I2V, extension and replacement-audio controls are not exposed. Retake defaults to `kling-4` at 720p, original audio only, source at least 3s, no final/middle frame control. `kling-4-flash` is unavailable: no verified independent callable API or price; never silently substitute the standard model.
476
+
477
+ Options for `video create`: `--script "..."`, `--script-file <path>`, `--image <url>` (repeatable, up to the selected model limit), `--video <file|url>` and `--audio <file|url>` (repeatable where supported), `--voice <xai-preset-id>` (repeatable, Grok only), `--duration <seconds>`, `--aspect 9:16|16:9|1:1`, `--video-model seedance-fast|seedance-mini|seedance|seedance-2.5|wan-3.0|wan-3.0-prime|kling|kling-4|grok|google-omni|minimax-h3|minimax-h3-max|fal-h3-max|sync-lipsync-v3`, `--video-resolution auto|480p|720p|768p|1080p|2k|4k`. Default model is FAL H3 Max (`fal-h3-max`) at 768p (480p/1080p optional): native text-to-video or image/video/audio reference-to-video, integer 5-15s, up to 9 images + 3 videos + 3 audios (12 total). SeeDance accepts native text-to-video with no image and integer output duration 4-15s (default 5s); every Seedance image input is submitted through reference-to-video, including one image. `seedance-mini` supports 480p/720p and is best for cheaper drafts/multi-size tests. Wan 3.0 and Wan 3.0 Prime both expose 480p/720p/1080p/2K/4K; 2K/4K automatically use the matching FlashVSR endpoint. MiniMax H3 accepts native text-to-video, 4-15s output, public 768p/2k resolution, and up to 9 image, up to 3 video, and up to 3 audio feature references through Makaron Agent/chat; a single image keeps the `reference_image` role. `sync-lipsync-v3` requires exactly one video plus one MP3/WAV and preserves that replacement audio while aligning the mouth. H3 defaults to 768p; request 2k explicitly for maximum/final quality. Kling supports 5-15s. Grok generation uses `grok-imagine-video-1.5`: text-only generation supports 480p/720p/1080p, while any 1-7 image or preset voice input uses reference-to-video and is capped at 720p. Grok edit/extend uses `grok-imagine-video` internally under the same `grok` selector. Gemini Omni supports 3-10s fast image/video generation and editing with native generated audio; every image-only generation request uses `reference_to_video`, including a single image, with up to 6 images when no video reference is provided.
474
478
 
475
479
  fal H3 Turbo: use `--video-model minimax-h3-max` for faster-than-real-time generation. It supports exactly 5/10/15 seconds at 480p/768p and defaults to native 768p, with no image for T2V or exactly one `--image` for I2V. It does not accept reference video/audio or multiple images.
476
480
 
@@ -731,3 +735,5 @@ npx makaron-cli admin fetch-skill https://www.makaron.app/s/4c4cbd57
731
735
  FAL video models: **fal H3 Turbo** uses `minimax-h3-max` for single-start-frame I2V/T2V. **FAL H3 Max** uses the new selector `fal-h3-max`: native T2V or image/video/audio reference-to-video, default 768p, optional 480p/1080p, integer 5–15s; at most 9 images / 3 videos / 3 audios / 12 total. Reference video/audio each 2–15s and each modality totals at most 15s. Source-video modifications use generation with feature references, not typed edit/extend. Reference input tokens are billed in addition to output video; query current pricing.
732
736
 
733
737
  The legacy `openai` image-model parameter now resolves to GPT Image 2.5 Flare.
738
+
739
+ `chat --stream` follows the original durable run when its live connection ends before completion. It does not submit another generation; already printed reply text is not replayed.
package/bin/makaron.mjs CHANGED
@@ -520,12 +520,12 @@ Options:
520
520
  grok-4.6-grok-subscription personal-plan route.
521
521
  --background, -b Submit and print a runId.
522
522
  --json Output structured JSON (includes per-run "usage" credits).
523
- --stream Legacy live SSE stream.
523
+ --stream Live SSE; follows the same run after handoff.
524
524
  --help, -h Show this help.
525
525
 
526
- Agent LLM defaults to auto (GPT-6 Luna through the Codex subscription for
527
- eligible accounts, including admins, or Azure API otherwise). GPT-5.6 and GPT-6
528
- base ids select Azure API; append -codex-subscription to
526
+ Agent LLM defaults to auto, following the server-configured Agent model.
527
+ When that default is a GPT model, eligible accounts can use the Codex plan.
528
+ GPT-5.6 and GPT-6 base ids select Azure API; append -codex-subscription to
529
529
  select the personal plan explicitly. Base grok-4.6 selects OpenRouter API;
530
530
  grok-4.6-grok-subscription selects the personal SuperGrok plan. Image/video
531
531
  model routing stays automatic in chat.
@@ -643,9 +643,15 @@ async function streamAgent(baseUrl, headers, projectId, prompt, opts = {}) {
643
643
  process.on('SIGINT', sigintHandler);
644
644
 
645
645
  const results = { images: [], designs: [], animationTasks: [], musicTasks: [], text: '' };
646
+ let completed = false;
646
647
 
647
648
  while (true) {
648
- const { done, value } = await reader.read();
649
+ let chunk;
650
+ try { chunk = await reader.read(); } catch (error) {
651
+ if (controller.signal.aborted) throw error;
652
+ break; // The durable run can continue after the SSE connection closes.
653
+ }
654
+ const { done, value } = chunk;
649
655
  if (done) break;
650
656
 
651
657
  buffer += decoder.decode(value, { stream: true });
@@ -711,14 +717,15 @@ async function streamAgent(baseUrl, headers, projectId, prompt, opts = {}) {
711
717
  break;
712
718
 
713
719
  case 'done':
720
+ completed = true;
714
721
  break;
715
722
  }
716
723
  }
717
724
  }
718
725
 
719
726
  process.removeListener('SIGINT', sigintHandler);
720
- if (results.text) process.stdout.write('\n');
721
- return { runId, results };
727
+ if (completed && results.text) process.stdout.write('\n');
728
+ return { runId, results, completed };
722
729
  }
723
730
 
724
731
  // ─── Run + Poll (non-blocking) ──────────────────────────────────────────────
@@ -759,7 +766,9 @@ async function pollRun(baseUrl, headers, runId, opts = {}) {
759
766
  if (background) return;
760
767
 
761
768
  let lastSeq = -1;
762
- let printedText = '';
769
+ let printedText = opts.alreadyPrintedText || '';
770
+ let replayPrefix = printedText;
771
+ let replayBuffer = '';
763
772
  const start = Date.now();
764
773
 
765
774
  while (true) {
@@ -790,7 +799,15 @@ async function pollRun(baseUrl, headers, runId, opts = {}) {
790
799
  if (json) continue; // skip printing in json mode
791
800
  switch (ev.type) {
792
801
  case 'content': {
793
- const newText = ev.data?.text || '';
802
+ let newText = ev.data?.text || '';
803
+ if (replayPrefix) {
804
+ replayBuffer += newText;
805
+ if (replayPrefix.startsWith(replayBuffer)) break;
806
+ newText = replayBuffer.startsWith(replayPrefix)
807
+ ? replayBuffer.slice(replayPrefix.length) : replayBuffer;
808
+ replayPrefix = '';
809
+ replayBuffer = '';
810
+ }
794
811
  process.stdout.write(newText);
795
812
  printedText += newText;
796
813
  break;
@@ -876,7 +893,8 @@ async function pollRun(baseUrl, headers, runId, opts = {}) {
876
893
  printRunUsage(data.usage);
877
894
  }
878
895
 
879
- if (data.status === 'failed' || data.status === 'aborted') process.exit(1);
896
+ // Let piped JSON drain before exiting; immediate exit truncates long traces.
897
+ if (data.status === 'failed' || data.status === 'aborted') process.exitCode = 1;
880
898
  return data;
881
899
  }
882
900
  }
@@ -1988,12 +2006,12 @@ Inputs:
1988
2006
 
1989
2007
  Generation options:
1990
2008
  --video-model <id> seedance-fast, seedance-mini, seedance, seedance-2.5,
1991
- wan-3.0, wan-3.0-prime, kling, grok, google-omni,
2009
+ wan-3.0, wan-3.0-prime, kling, kling-4, grok, google-omni,
1992
2010
  minimax-h3, minimax-h3-max, fal-h3-max, or sync-lipsync-v3.
1993
2011
  --duration <seconds> Output duration supported by the selected model.
1994
2012
  --video-resolution <res> auto, 480p, 720p, 768p, 1080p, 2k, or 4k.
1995
2013
  --aspect <ratio> 9:16, 16:9, 1:1, or another supported ratio.
1996
- --video-operation <mode> generate, edit, or extend (Seedance 2.5 / Grok).
2014
+ --video-operation <mode> generate, edit, or extend (Seedance 2.5 / Grok); Kling 4 supports generate/edit.
1997
2015
  --extend-direction <dir> forward or backward.
1998
2016
  --output-format <format> mp4 or mov.
1999
2017
  --generated-audio Ask the provider to generate audio.
@@ -2004,6 +2022,8 @@ Generation options:
2004
2022
  --help, -h Show this help.
2005
2023
 
2006
2024
  Recent model choices:
2025
+ kling-4 Kling 4.0 standard: native text/image/video references, 3–30s, 720p/1080p.
2026
+ Native edit preserves source audio; default for video retake.
2007
2027
  fal-h3-max FAL H3 Max (default, 768p) reference-to-video: images, videos and audio;
2008
2028
  integer 5–15s, 480p/768p/1080p, default 768p. Reference inputs cost extra.
2009
2029
  minimax-h3-max fal H3 Turbo faster-than-real-time T2V or one-start-image I2V;
@@ -2095,7 +2115,7 @@ Commands:
2095
2115
 
2096
2116
  edit [--image <file>] "prompt" Image edit, text-to-image, or transparent PNG
2097
2117
  analyze --video <file|url> Analyze video content
2098
- video script|create|retake|status H3 Max, Wan, Seedance, Grok, lip-sync; interval retake
2118
+ video script|create|retake|status H3 Max, Wan, Seedance, Grok, lip-sync, Kling 4; interval retake
2099
2119
  music create|status Music generation
2100
2120
 
2101
2121
  admin Admin commands (skills, credits, upload, set-admin)
@@ -2167,7 +2187,7 @@ function printHelp(topic, subtopic) {
2167
2187
  } else if (topic === 'chat') {
2168
2188
  printChatHelp();
2169
2189
  } else if (topic === 'responses' || topic === 'run') {
2170
- if (subtopic === 'get') console.log('Usage: makaron responses get <runId> [--wait] [--json] [--pick <field>] [--materialize|--export-compositions] [--publish-exports]');
2190
+ if (subtopic === 'get') console.log('Usage: makaron responses get <runId> [--wait] [--json] [--events] [--after <seq>] [--pick <field>] [--materialize|--export-compositions] [--publish-exports]');
2171
2191
  else if (subtopic === 'watch') console.log('Usage: makaron responses watch <runId> [--jsonl] [--interval <ms>]');
2172
2192
  else if (subtopic === 'list') console.log('Usage: makaron responses list --project <id>');
2173
2193
  else console.log(`Responses commands:
@@ -2248,7 +2268,7 @@ Not sure which built-in skill to use? Start with:
2248
2268
  } else if (topic === 'video') {
2249
2269
  if (subtopic === 'script') console.log('Usage: makaron video script --image <file> [--image <file>] [--lang en|zh] "direction"');
2250
2270
  else if (subtopic === 'create') printVideoCreateHelp();
2251
- else if (subtopic === 'retake') console.log('Usage: makaron video retake --video <url|file> --start <seconds> --end <seconds> --prompt "change" [--model seedance-2.5-eco|seedance-2.5|fal-h3-max] [--project <id>] [--wait] [--json] [--request-id <uuid>] [--audio-mode original|generated]');
2271
+ else if (subtopic === 'retake') console.log('Usage: makaron video retake --video <url|file> --start <seconds> --end <seconds> --prompt "change" [--model seedance-2.5-eco|seedance-2.5|fal-h3-max|kling-4] [--project <id>] [--wait] [--json] [--request-id <uuid>] [--audio-mode original|generated]\nDefault: kling-4 at 720p; source >=3s, original audio only. Select another compatible model explicitly for generated audio.');
2252
2272
  else if (subtopic === 'status') console.log('Usage: makaron video status <taskId> | --snapshot <snapshotId> [--wait]');
2253
2273
  else printVideoHelp();
2254
2274
  } else if (topic === 'music') {
@@ -2675,18 +2695,27 @@ if (!command || command === '--help' || command === '-h' || command === 'help')
2675
2695
 
2676
2696
  if (useStream) {
2677
2697
  // Legacy SSE mode
2678
- const { runId: streamRunId, results } = await streamAgent(baseUrl, headers, projectId, finalPrompt, {
2698
+ const { runId: streamRunId, results, completed } = await streamAgent(baseUrl, headers, projectId, finalPrompt, {
2679
2699
  agentModel,
2680
2700
  uploadedVideoCount: uploadedTurnVideoCount,
2681
2701
  turnMediaCount: uploadedTurnMediaCount,
2682
2702
  });
2683
- process.stderr.write('\n━━━ Results ━━━\n');
2684
- for (const img of results.images) process.stderr.write(`🖼️ Image: ${img.imageUrl}\n`);
2685
- for (const d of results.designs) process.stderr.write(`🎨 ${d.desc}\n`);
2686
- process.stderr.write(`🔗 ${APP_URL}/projects/${projectId}\n`);
2687
- printRunUsage(await fetchRunUsage(baseUrl, headers, streamRunId));
2688
- for (const task of results.animationTasks) await pollVideo(baseUrl, headers, task.taskId, task.snapshotId);
2689
- for (const task of results.musicTasks) await pollMusic(baseUrl, headers, task.taskId);
2703
+ if (!completed) {
2704
+ if (!streamRunId) {
2705
+ console.error('Stream ended without completion or a run ID; unable to follow the original run.');
2706
+ process.exit(1);
2707
+ }
2708
+ process.stderr.write(`\n↪ Following the same run after stream handoff: ${streamRunId}\n`);
2709
+ await pollRun(baseUrl, headers, streamRunId, { alreadyPrintedText: results.text });
2710
+ } else {
2711
+ process.stderr.write('\n━━━ Results ━━━\n');
2712
+ for (const img of results.images) process.stderr.write(`🖼️ Image: ${img.imageUrl}\n`);
2713
+ for (const d of results.designs) process.stderr.write(`🎨 ${d.desc}\n`);
2714
+ process.stderr.write(`🔗 ${APP_URL}/projects/${projectId}\n`);
2715
+ printRunUsage(await fetchRunUsage(baseUrl, headers, streamRunId));
2716
+ for (const task of results.animationTasks) await pollVideo(baseUrl, headers, task.taskId, task.snapshotId);
2717
+ for (const task of results.musicTasks) await pollMusic(baseUrl, headers, task.taskId);
2718
+ }
2690
2719
  } else {
2691
2720
  // Default: fire-and-forget + poll
2692
2721
  const { runId } = await submitRun(baseUrl, headers, projectId, finalPrompt, {
@@ -2730,10 +2759,16 @@ if (!command || command === '--help' || command === '-h' || command === 'help')
2730
2759
  if (sub === 'get') {
2731
2760
  const runId = args[2];
2732
2761
  if (!runId) { console.error('Usage: makaron responses get <runId> [--wait] [--json] [--pick <field>] [--materialize|--export-compositions]'); process.exit(1); }
2733
- let wait = false, jsonOutput = false, pick = null, exportCompositions = false, publishExports = false;
2762
+ let wait = false, jsonOutput = false, pick = null, exportCompositions = false, publishExports = false, includeEvents = false, afterSeq = null;
2734
2763
  for (let i = 3; i < args.length; i++) {
2735
2764
  if (args[i] === '--wait') wait = true;
2736
2765
  if (args[i] === '--json') jsonOutput = true;
2766
+ if (args[i] === '--events') includeEvents = true;
2767
+ if (args[i] === '--after' && args[i + 1]) {
2768
+ afterSeq = Number(args[++i]);
2769
+ if (!Number.isSafeInteger(afterSeq) || afterSeq < 0) throw new Error('--after requires a non-negative integer sequence');
2770
+ includeEvents = true;
2771
+ }
2737
2772
  if (args[i] === '--export-compositions') exportCompositions = true;
2738
2773
  if (args[i] === '--materialize') {
2739
2774
  exportCompositions = true;
@@ -2757,7 +2792,8 @@ if (!command || command === '--help' || command === '-h' || command === 'help')
2757
2792
  console.log(JSON.stringify(data, null, 2));
2758
2793
  }
2759
2794
  } else {
2760
- const res = await fetch(`${baseUrl}/api/agent/run/${runId}`, { headers });
2795
+ const eventQuery = includeEvents ? `?events=true${afterSeq !== null ? `&after=${afterSeq}` : ''}` : '';
2796
+ const res = await fetch(`${baseUrl}/api/agent/run/${runId}${eventQuery}`, { headers });
2761
2797
  if (!res.ok) { process.stderr.write(`Error ${res.status}: ${await res.text()}\n`); process.exit(1); }
2762
2798
  let data = await res.json();
2763
2799
  data = await reconcileRunWithProjectMedia(baseUrl, headers, data);
@@ -2770,7 +2806,7 @@ if (!command || command === '--help' || command === '-h' || command === 'help')
2770
2806
  } else {
2771
2807
  console.log(JSON.stringify(data, null, 2));
2772
2808
  }
2773
- if (data.status === 'failed' || data.status === 'aborted') process.exit(1);
2809
+ if (data.status === 'failed' || data.status === 'aborted') process.exitCode = 1;
2774
2810
  }
2775
2811
 
2776
2812
  } else if (sub === 'watch') {
@@ -3130,7 +3166,7 @@ if (!command || command === '--help' || command === '-h' || command === 'help')
3130
3166
  if (text) console.log(text);
3131
3167
 
3132
3168
  } else if (sub === 'retake') {
3133
- const params = { model: 'fal-h3-max' };
3169
+ const params = { model: 'kling-4' };
3134
3170
  let wait = false, json = false;
3135
3171
  for (let i = 2; i < args.length; i++) {
3136
3172
  const flag = args[i];
@@ -3144,12 +3180,12 @@ if (!command || command === '--help' || command === '-h' || command === 'help')
3144
3180
  else if ((flag === '--model' || flag === '--video-model') && args[i + 1]) params.model = args[++i];
3145
3181
  else if (flag === '--project' && args[i + 1]) params.project_id = args[++i];
3146
3182
  else if (flag === '--request-id' && args[i + 1]) params.request_id = args[++i];
3147
- else { console.error('Usage: makaron video retake --video <url|file> --start <seconds> --end <seconds> --prompt "change" [--model seedance-2.5-eco|seedance-2.5|fal-h3-max] [--project <id>] [--wait] [--json] [--request-id <uuid>] [--audio-mode original|generated]'); process.exit(1); }
3183
+ else { console.error('Usage: makaron video retake --video <url|file> --start <seconds> --end <seconds> --prompt "change" [--model seedance-2.5-eco|seedance-2.5|fal-h3-max|kling-4] [--project <id>] [--wait] [--json] [--request-id <uuid>] [--audio-mode original|generated]\nDefault: kling-4 at 720p; source >=3s, original audio only. Select another compatible model explicitly for generated audio.'); process.exit(1); }
3148
3184
  }
3149
3185
  if (!params.video_url || !params.prompt || !Number.isFinite(params.start) || !Number.isFinite(params.end)
3150
3186
  || params.start < 0 || params.end - params.start < .1 || params.end - params.start > 15
3151
3187
  || (params.audio_mode && !['original','generated'].includes(params.audio_mode))
3152
- || !['seedance-2.5-eco', 'seedance-2.5', 'fal-h3-max'].includes(params.model)) {
3188
+ || !['seedance-2.5-eco', 'seedance-2.5', 'fal-h3-max', 'kling-4'].includes(params.model)) {
3153
3189
  console.error('Retake needs one video, a prompt, a valid 0.1–15 second interval, and a supported model.'); process.exit(1);
3154
3190
  }
3155
3191
  if (!isHttpUrl(params.video_url)) {
@@ -3225,11 +3261,14 @@ if (!command || command === '--help' || command === '-h' || command === 'help')
3225
3261
  const isGrok = selectedVideoModel === 'grok';
3226
3262
  const isGoogleOmni = selectedVideoModel === 'google-omni';
3227
3263
  const isSyncLipsync = selectedVideoModel === 'sync-lipsync-v3';
3228
- const supportsNativeTextToVideo = isSeedanceModel || isWan30 || isMinimaxH3 || isFalH3Max || isFalReference || isGrok || isGoogleOmni;
3264
+ const isKling4 = selectedVideoModel === 'kling-4';
3265
+ const supportsNativeTextToVideo = selectedVideoModel === 'kling-4' || selectedVideoModel === 'kling-4-flash' || isSeedanceModel || isWan30 || isMinimaxH3 || isFalH3Max || isFalReference || isGrok || isGoogleOmni;
3229
3266
  if (!script || (!images.length && !videos.length && !audios.length && !referenceVoices.length && !supportsNativeTextToVideo)) {
3230
3267
  console.error('Usage: makaron video create --script "..." [--image <url>] [--video <file|url>] [--audio <file|url>] [--duration 30] [--video-model seedance-2.5|wan-3.0|wan-3.0-prime|minimax-h3|minimax-h3-max]');
3231
3268
  process.exit(1);
3232
3269
  }
3270
+ if (isKling4 && (images.length > 10 || videos.length > 5 || audios.length)) { console.error('Kling 4.0 accepts at most 10 images and 5 videos, with no audio references.'); process.exit(1); }
3271
+ if (isKling4 && duration != null && (!Number.isInteger(duration) || duration < 3 || duration > 30)) { console.error('Kling 4.0 output duration must be an integer from 3 to 30 seconds.'); process.exit(1); }
3233
3272
  if (isFalReference && (images.length > 9 || videos.length > 3 || audios.length > 3 || images.length + videos.length + audios.length > 12)) { console.error('FAL H3 Max accepts at most 9 images, 3 videos, 3 audios, 12 total.'); process.exit(1); }
3234
3273
  if (isFalReference && duration != null && (!Number.isInteger(duration) || duration < 5 || duration > 15)) { console.error('FAL H3 Max output duration must be an integer from 5 to 15 seconds.'); process.exit(1); }
3235
3274
  if (isSeedance25 && images.length > 30) { console.error('Seedance 2.5 supports at most 30 image references.'); process.exit(1); }
@@ -3268,7 +3307,8 @@ if (!command || command === '--help' || command === '-h' || command === 'help')
3268
3307
  let providerMaxDuration = isSeedance25 ? SEEDANCE25_MAX_VIDEO_REFERENCE_DURATION : MAX_VIDEO_PROVIDER_REFERENCE_DURATION;
3269
3308
  if (isGrok) providerMaxDuration = inferredOperation === 'edit' ? 8.7 : 15;
3270
3309
  if (isSyncLipsync) providerMaxDuration = 60;
3271
- const providerMaxPixels = isSyncLipsync || isMinimaxH3 || isWan30 ? Infinity : isSeedance25 ? SEEDANCE25_MAX_VIDEO_FRAME_PIXELS : MAX_VIDEO_FRAME_PIXELS;
3310
+ if (isKling4) providerMaxDuration = 30;
3311
+ const providerMaxPixels = isSyncLipsync || isMinimaxH3 || isWan30 || isKling4 ? Infinity : isSeedance25 ? SEEDANCE25_MAX_VIDEO_FRAME_PIXELS : MAX_VIDEO_FRAME_PIXELS;
3272
3312
  const localImages = images.filter(image => !isHttpUrl(image));
3273
3313
  if (localImages.length) {
3274
3314
  const uploadedImages = await uploadImageFilesViaSignedUrl(baseUrl, headers, undefined, localImages);
@@ -3283,8 +3323,10 @@ if (!command || command === '--help' || command === '-h' || command === 'help')
3283
3323
  maxDuration: providerMaxDuration,
3284
3324
  durationTolerance: MAX_VIDEO_PROVIDER_REFERENCE_DURATION_TOLERANCE,
3285
3325
  maxFramePixels: providerMaxPixels,
3286
- maxFileSize: isWan30 ? MULEROUTER_WAN_MAX_VIDEO_FILE_SIZE : isSeedance25 || isSyncLipsync ? 200 * 1024 * 1024 : MAX_VIDEO_UPLOAD_FILE_SIZE,
3287
- ...(isGrok ? {
3326
+ maxFileSize: isWan30 ? MULEROUTER_WAN_MAX_VIDEO_FILE_SIZE : isSeedance25 || isSyncLipsync || isKling4 ? 200 * 1024 * 1024 : MAX_VIDEO_UPLOAD_FILE_SIZE,
3327
+ ...(isKling4 ? {
3328
+ allowedExtensions: ['mp4', 'mov'], minSide: 720, maxSide: 2160,
3329
+ } : isGrok ? {
3288
3330
  allowedExtensions: ['mp4'],
3289
3331
  } : selectedVideoModel === 'minimax-h3' ? {
3290
3332
  allowedExtensions: ['mp4', 'mov'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "makaron-cli",
3
- "version": "0.17.3",
3
+ "version": "0.17.5",
4
4
  "description": "Talk to Makaron Agent from the terminal — create projects, edit images, generate videos",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -111,7 +111,7 @@ npx makaron-cli chat --project auto --image photo.jpg --json -b "make it cinemat
111
111
  npx makaron-cli chat --project auto --image img1.jpg --image img2.jpg --json -b "combine these"
112
112
  ```
113
113
 
114
- `chat` routes image and video models automatically. Use `--agent-model` only when the user explicitly asks to select or compare the reasoning/tool-calling Agent LLM. Accepted values are `auto`, the base model IDs (`gpt-6-luna`, `gpt-6.1-sol`, `gpt-6-sol`, `gpt-5.6-terra`, `gpt-5.6-sol`, `gpt-5.6-luna`, `grok-4.6`, `deepseek-v4-pro`, `deepseek-flash`), and the personal-plan routes (`gpt-6-luna-codex-subscription`, `gpt-6.1-sol-codex-subscription`, `gpt-6-sol-codex-subscription`, `gpt-5.6-terra-codex-subscription`, `gpt-5.6-sol-codex-subscription`, `gpt-5.6-luna-codex-subscription`). `auto` uses GPT-6 Luna through the Codex subscription for eligible accounts (including admins) and through Azure API otherwise; base GPT-5.6, GPT-6 and GPT-6.1 IDs select Azure API, while suffixed IDs explicitly request the personal plan where authorized. Never put an image or video model ID in `--agent-model`.
114
+ `chat` routes image and video models automatically. Use `--agent-model` only when the user explicitly asks to select or compare the reasoning/tool-calling Agent LLM. Accepted values are `auto`, the base model IDs (`gpt-6-luna`, `gpt-6.1-sol`, `gpt-6-sol`, `gpt-5.6-terra`, `gpt-5.6-sol`, `gpt-5.6-luna`, `grok-4.6`, `deepseek-v4-pro`, `deepseek-flash`), and the personal-plan routes (`gpt-6-luna-codex-subscription`, `gpt-6.1-sol-codex-subscription`, `gpt-6-sol-codex-subscription`, `gpt-5.6-terra-codex-subscription`, `gpt-5.6-sol-codex-subscription`, `gpt-5.6-luna-codex-subscription`). `auto` defaults to DeepSeek Flash with native vision, following the server-configured Agent model; eligible accounts can use the Codex subscription when that default is a GPT model; base GPT-5.6, GPT-6 and GPT-6.1 IDs select Azure API, while suffixed IDs explicitly request the personal plan where authorized. Never put an image or video model ID in `--agent-model`.
115
115
 
116
116
  ```bash
117
117
  npx makaron-cli chat --project auto --agent-model deepseek-v4-pro --json -b "make a 20s badminton video"
@@ -388,7 +388,7 @@ Segment edits have two intents: modify changes the inside of the existing sequen
388
388
 
389
389
  Chat segment inspection also reads source speech through ASR, reusing cached transcripts. It returns selected speech with source/output timecodes separately from adjacent speech, so the edit can follow the retained narration. Original audio is the default; Chat may select `audio_mode: generated` for requested new sound inside the selection. ASR does not guarantee music-beat or lip synchronization, and unavailable/untimed speech is reported rather than assigned invented timings. Direct `video retake` uses the caller's completed prompt and does not perform Agent interpretation or ASR planning.
390
390
 
391
- `video retake` uses original-source seconds, accepts a 0.1–15s range in a source up to 120s, and automatically replaces only that range while preserving duration. Audio defaults to original; `--audio-mode generated` uses synchronized new audio inside the selection and source audio outside. Models: `fal-h3-max` (default), `seedance-2.5-eco` (preferred Seedance option), and explicitly selected native `seedance-2.5`. For sources shorter than 2 seconds, explicitly use Seedance. Local files require `--project`. Keep the root taskId and request ID; resume polling or replay the same request ID instead of paying for another generation.
391
+ `video retake` uses original-source seconds, accepts a 0.1–15s range in a source up to 120s, and automatically replaces only that range while preserving duration. Audio defaults to original; `--audio-mode generated` uses synchronized new audio inside the selection and source audio outside. Models: `kling-4` (default, source >=3s, original audio only), `fal-h3-max`, `seedance-2.5-eco` (preferred Seedance option), and explicitly selected native `seedance-2.5`. For sources shorter than 3 seconds, explicitly select a compatible model: H3 for sources >=2s or Seedance for shorter sources. Generated audio requires an explicitly selected H3 or Seedance model. Local files require `--project`. Keep the root taskId and request ID; resume polling or replay the same request ID instead of paying for another generation.
392
392
 
393
393
  `video create` returns a provider task id and does not create or update a Makaron project timeline. For project/timeline video editing, use:
394
394
 
@@ -396,7 +396,9 @@ Chat segment inspection also reads source speech through ASR, reusing cached tra
396
396
  npx makaron-cli chat --project <id|auto> --video input.mp4 -b "make it funny"
397
397
  ```
398
398
 
399
- Options for `video create`: `--script "..."`, `--script-file <path>`, `--image <url>` (repeatable, up to the selected model limit), `--video <file|url>` and `--audio <file|url>` (repeatable where supported), `--voice <xai-preset-id>` (repeatable, Grok only), `--duration <seconds>`, `--aspect 9:16|16:9|1:1`, `--video-model seedance-fast|seedance-mini|seedance|seedance-2.5|wan-3.0|wan-3.0-prime|kling|grok|google-omni|minimax-h3|minimax-h3-max|fal-h3-max|sync-lipsync-v3`, `--video-resolution auto|480p|720p|768p|1080p|2k|4k`. Default model is FAL H3 Max (`fal-h3-max`) at 768p (480p/1080p optional): native text-to-video or image/video/audio reference-to-video, integer 5-15s, up to 9 images + 3 videos + 3 audios (12 total). SeeDance accepts native text-to-video with no image and integer output duration 4-15s (default 5s); every Seedance image input uses reference-to-video, including one image. `seedance-mini` supports 480p/720p and is best for cheaper drafts/multi-size tests. Wan 3.0 and Wan 3.0 Prime both expose 480p/720p/1080p/2K/4K; 2K/4K automatically use the matching FlashVSR endpoint. MiniMax H3 accepts native text-to-video, 4-15s output, public 768p/2k resolution, and up to 9 image, up to 3 video, and up to 3 audio feature references through Makaron Agent/chat; a single image keeps the `reference_image` role. fal H3 Turbo (`minimax-h3-max`) accepts native text-to-video or exactly one start image for image-to-video, exact 5/10/15s duration, and 480p/768p; it does not accept reference video/audio or multiple images. `sync-lipsync-v3` requires exactly one video plus one MP3/WAV and preserves that replacement audio while aligning the mouth. H3 defaults to 768p; request 2k explicitly for maximum/final quality. Kling supports 5-15s. Grok text-only generation supports 480p/720p/1080p; any 1-7 image or preset voice input uses reference-to-video and is capped at 720p. Grok edit/extend uses `grok-imagine-video` internally. Gemini Omni image-only generation always uses `reference_to_video`, including one image, with up to 6 images when no video reference is provided.
399
+ Kling 4.0: use `--video-model kling-4` for native text-to-video or image/video feature references, integer 3–30s at 720p (default) or 1080p. Up to 10 images and 5 videos; source videos must each be 3s or longer, total at most 30s, 720–2160px per side, 24–60fps and at most 200MB each. `--video-operation edit` requires exactly one source video and preserves its canvas/audio. Explicit keyframe I2V, extension and replacement-audio controls are not exposed. Retake defaults to `kling-4` at 720p, original audio only, source at least 3s, no final/middle frame control. `kling-4-flash` is unavailable: no verified independent callable API or price; never silently substitute the standard model.
400
+
401
+ Options for `video create`: `--script "..."`, `--script-file <path>`, `--image <url>` (repeatable, up to the selected model limit), `--video <file|url>` and `--audio <file|url>` (repeatable where supported), `--voice <xai-preset-id>` (repeatable, Grok only), `--duration <seconds>`, `--aspect 9:16|16:9|1:1`, `--video-model seedance-fast|seedance-mini|seedance|seedance-2.5|wan-3.0|wan-3.0-prime|kling|kling-4|grok|google-omni|minimax-h3|minimax-h3-max|fal-h3-max|sync-lipsync-v3`, `--video-resolution auto|480p|720p|768p|1080p|2k|4k`. Default model is FAL H3 Max (`fal-h3-max`) at 768p (480p/1080p optional): native text-to-video or image/video/audio reference-to-video, integer 5-15s, up to 9 images + 3 videos + 3 audios (12 total). SeeDance accepts native text-to-video with no image and integer output duration 4-15s (default 5s); every Seedance image input uses reference-to-video, including one image. `seedance-mini` supports 480p/720p and is best for cheaper drafts/multi-size tests. Wan 3.0 and Wan 3.0 Prime both expose 480p/720p/1080p/2K/4K; 2K/4K automatically use the matching FlashVSR endpoint. MiniMax H3 accepts native text-to-video, 4-15s output, public 768p/2k resolution, and up to 9 image, up to 3 video, and up to 3 audio feature references through Makaron Agent/chat; a single image keeps the `reference_image` role. fal H3 Turbo (`minimax-h3-max`) accepts native text-to-video or exactly one start image for image-to-video, exact 5/10/15s duration, and 480p/768p; it does not accept reference video/audio or multiple images. `sync-lipsync-v3` requires exactly one video plus one MP3/WAV and preserves that replacement audio while aligning the mouth. H3 defaults to 768p; request 2k explicitly for maximum/final quality. Kling supports 5-15s. Grok text-only generation supports 480p/720p/1080p; any 1-7 image or preset voice input uses reference-to-video and is capped at 720p. Grok edit/extend uses `grok-imagine-video` internally. Gemini Omni image-only generation always uses `reference_to_video`, including one image, with up to 6 images when no video reference is provided.
400
402
 
401
403
  Provider integration contract: every image passed to video generation is a feature reference by default, even when there is exactly one image. Never infer image-to-video/first-frame mode from image count. The sole current exception is explicitly selected `minimax-h3-max`, whose declared capability maps exactly one selected image to native image-to-video; it does not accept reference video/audio or multiple images.
402
404