@devvibex/aiflow 1.17.2 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -22
- package/package.json +1 -1
- package/src/index.d.ts +43 -26
- package/src/index.js +28 -16
package/README.md
CHANGED
|
@@ -258,7 +258,7 @@ models use `size` instead. `background`
|
|
|
258
258
|
`config.imageBackgroundModels`; `generateImageBatch` takes it top-level or per
|
|
259
259
|
page. The module default is set with `admin.updateConfig({ imageBackground })`.
|
|
260
260
|
|
|
261
|
-
### `aiflow.generateVideo({ prompt, model?, aspectRatio?, image?, lastFrame?, video?, referenceImages?, referenceVideos?, referenceAudios?, generateAudio?, signal? })`
|
|
261
|
+
### `aiflow.generateVideo({ prompt, model?, aspectRatio?, image?, lastFrame?, middleFrames?, video?, referenceImages?, referenceVideos?, referenceAudios?, generateAudio?, signal? })`
|
|
262
262
|
|
|
263
263
|
Returns `{ videoUrl, usage: { creditsUsed } }`. Pass `image` for image-to-video
|
|
264
264
|
or `video` for video-to-video; omit both for pure text-to-video.
|
|
@@ -267,9 +267,39 @@ or `video` for video-to-video; omit both for pure text-to-video.
|
|
|
267
267
|
to fix the frame the clip ends on as well — the video moves from `image` to
|
|
268
268
|
`lastFrame`. `lastFrame` requires `image`; Gemini Omni and Veo ignore it.
|
|
269
269
|
|
|
270
|
-
**Kling** (`model: 'kling'`, Kling
|
|
271
|
-
1080p, 16:9 / 9:16 / 1:1
|
|
272
|
-
`generateAudio
|
|
270
|
+
**Kling** (`model: 'kling'`, Kling 4.0): 3–30s clips in one generation
|
|
271
|
+
(`duration`), 720p or 1080p, 16:9 / 9:16 / 1:1 / 4:3 / 3:4 / 21:9, JPG / PNG
|
|
272
|
+
images only. Every clip has sound; `generateAudio` is ignored. On top of the
|
|
273
|
+
first and last frame it takes:
|
|
274
|
+
|
|
275
|
+
- `middleFrames` (≥ 1.18.0) — keyframes between `image` and `lastFrame`, in
|
|
276
|
+
order, up to 8 (10 images in all): the clip passes through each one.
|
|
277
|
+
- Reference mode, like Seedance: `referenceImages` (up to 10), `referenceVideos`
|
|
278
|
+
(motion / camera), and `referenceAudios` as **voices** — each clip (one clear
|
|
279
|
+
speaker, 5–30s, wav / mp3) becomes the voice a character speaks in, with lip
|
|
280
|
+
sync, up to 3.
|
|
281
|
+
- `video` — a clip to edit as the prompt says (MP4 / MOV, 3–30s). Reference
|
|
282
|
+
videos and the edited clip share one budget: up to 5 videos, ≤30s together.
|
|
283
|
+
|
|
284
|
+
Kling 4.0 Flash (`kling-flash`, 720p, 3–20s) takes a first frame, reference
|
|
285
|
+
images and videos and a clip to edit, but no last or middle frames and no
|
|
286
|
+
voices.
|
|
287
|
+
|
|
288
|
+
```js
|
|
289
|
+
const walk = await aiflow.generateVideo({
|
|
290
|
+
model: 'kling',
|
|
291
|
+
prompt: 'She crosses the room, pauses at the window, then sits down',
|
|
292
|
+
image: doorUrl,
|
|
293
|
+
middleFrames: [windowUrl],
|
|
294
|
+
lastFrame: sofaUrl,
|
|
295
|
+
});
|
|
296
|
+
const talk = await aiflow.generateVideo({
|
|
297
|
+
model: 'kling',
|
|
298
|
+
prompt: 'The man in @Image 1 says "Welcome to our shop" in the voice of @Audio 1',
|
|
299
|
+
referenceImages: [portraitFile],
|
|
300
|
+
referenceAudios: [voiceFile], // 5–30s, one speaker
|
|
301
|
+
});
|
|
302
|
+
```
|
|
273
303
|
|
|
274
304
|
```js
|
|
275
305
|
const clip = await aiflow.generateVideo({
|
|
@@ -324,8 +354,8 @@ const clip = await aiflow.generateVideo({
|
|
|
324
354
|
Reference audio is its own mode: it cannot be combined with `image` /
|
|
325
355
|
`lastFrame` (start and end frames).
|
|
326
356
|
|
|
327
|
-
The default model is **Gemini Omni
|
|
328
|
-
9:16 only
|
|
357
|
+
The default model is **Gemini Omni** (1.2 Flash): one clip of 10s by default and
|
|
358
|
+
3–15s with `duration`, **with sound**, 16:9 or 9:16 only. For a longer or extendable video use
|
|
329
359
|
`generateLongVideo` / `createVideoSession` below — same model, so a single clip
|
|
330
360
|
and an extended one look and sound alike. Veo and Seedance are opt-in per module.
|
|
331
361
|
|
|
@@ -336,16 +366,16 @@ prompt into a storyboard of ~10s beats, generates the opening clip, then extends
|
|
|
336
366
|
turn after turn — concatenating as it goes — until the timeline reaches the
|
|
337
367
|
length you asked for.
|
|
338
368
|
|
|
339
|
-
**Maximum
|
|
340
|
-
|
|
341
|
-
That is a model limit, not a setting — ask for more and you get
|
|
342
|
-
`warning` saying so. Past
|
|
369
|
+
**Maximum 30 seconds** (Gemini Omni 1.2). A video is one Gemini Omni chain: an
|
|
370
|
+
opening clip (10s by default) plus consecutive 3–10s extends, 30s in total.
|
|
371
|
+
That is a model limit, not a setting — ask for more and you get 30s back with a
|
|
372
|
+
`warning` saying so. Past 30s, generate several videos and join them with
|
|
343
373
|
`mergeVideos` (below) — the joins are hard cuts.
|
|
344
374
|
|
|
345
375
|
```js
|
|
346
376
|
const video = await aiflow.generateLongVideo({
|
|
347
377
|
prompt: 'A lighthouse keeper climbing the spiral stairs at dawn, then the lamp sweeping out over the water',
|
|
348
|
-
durationSeconds: 30, // 5-
|
|
378
|
+
durationSeconds: 30, // 5-30
|
|
349
379
|
aspectRatio: '16:9',
|
|
350
380
|
onProgress: ({ segmentsDone, segmentsPlanned, durationSeconds, videoUrl }) => {
|
|
351
381
|
// videoUrl is ALREADY PLAYABLE — show the partial video, not a spinner
|
|
@@ -361,17 +391,17 @@ video.warning; // set if it finished shorter than asked (still playable
|
|
|
361
391
|
```
|
|
362
392
|
|
|
363
393
|
The result is always ONE CONTINUOUS SHOT — each clip continues the last — and
|
|
364
|
-
`extendVideo` can lengthen it afterwards while it is still under
|
|
394
|
+
`extendVideo` can lengthen it afterwards while it is still under 30s.
|
|
365
395
|
|
|
366
396
|
Design the UI around four facts:
|
|
367
397
|
|
|
368
|
-
- **Cap the duration control at
|
|
398
|
+
- **Cap the duration control at 30s.** Preset chips (10s / 20s / 30s) say
|
|
369
399
|
it most clearly. Anything above is clamped, not honoured.
|
|
370
400
|
- **It takes a long time** — roughly 2.5–3 minutes per 10 seconds, so ~8 min for
|
|
371
|
-
a 30s video
|
|
401
|
+
a 30s video, the longest. `onProgress` fires after each clip, so
|
|
372
402
|
show progress and the partial video, which is already playable.
|
|
373
|
-
- **The result is "at least" the requested length** (up to the
|
|
374
|
-
|
|
403
|
+
- **The result is "at least" the requested length** (up to the 30s cap). Omni
|
|
404
|
+
picks each extension's length (3–10s), so the timeline overshoots by up to one
|
|
375
405
|
segment.
|
|
376
406
|
- **A short build still resolves.** If a turn fails or credits run out mid-way,
|
|
377
407
|
you get the shorter video plus `warning` explaining why — show both; it is not
|
|
@@ -379,11 +409,11 @@ Design the UI around four facts:
|
|
|
379
409
|
|
|
380
410
|
`resumeLongVideo(sessionId)` exists for the older **scene-based** long-form
|
|
381
411
|
builds (parallel scenes with hard cuts, `session.mode === 'scenes'`). No new
|
|
382
|
-
session is built that way while the
|
|
412
|
+
session is built that way while the cap is in place; the method stays for
|
|
383
413
|
sessions created before it.
|
|
384
414
|
|
|
385
415
|
Cost scales with the finished length (Omni bills per delivered second), so show a
|
|
386
|
-
credit estimate before calling. A deployment can lower the cap below
|
|
416
|
+
credit estimate before calling. A deployment can lower the cap below 30s
|
|
387
417
|
(`AIFLOW_VIDEO_MAX_TARGET_SECONDS`) but never raise it; either way a larger
|
|
388
418
|
request is clamped, not refused.
|
|
389
419
|
|
|
@@ -426,7 +456,7 @@ camera and subject must carry across the joins.
|
|
|
426
456
|
|
|
427
457
|
### Stateful video sessions — extend and concatenate (Gemini Omni)
|
|
428
458
|
|
|
429
|
-
Gemini Omni has no "generate
|
|
459
|
+
Gemini Omni has no "generate 30 seconds" mode and no concatenation endpoint. A
|
|
430
460
|
longer clip is built **turn by turn**: each turn appends 3–10s while the model
|
|
431
461
|
keeps the characters, motion and audio bed continuous, chaining on the previous
|
|
432
462
|
interaction it still holds server-side. The gateway concatenates the segments
|
|
@@ -436,7 +466,7 @@ never stitches anything itself.
|
|
|
436
466
|
Runs on Gemini Omni — Veo and Seedance hold no context between calls. Leave
|
|
437
467
|
`model` unset: the gateway uses Omni even when the module's video model is Veo
|
|
438
468
|
or Seedance, and refuses only a non-Omni model you pass explicitly. Total length
|
|
439
|
-
is capped at **
|
|
469
|
+
is capped at **30 seconds** (Gemini Omni 1.2).
|
|
440
470
|
|
|
441
471
|
```js
|
|
442
472
|
// 1. Open a session — generate the opening clip…
|
|
@@ -448,7 +478,7 @@ const opening = await aiflow.getVideoJob(jobId); // poll until 'succeeded'
|
|
|
448
478
|
|
|
449
479
|
// …or seed it from a clip you already have — an upload, a generateVideo or a
|
|
450
480
|
// mergeVideos result (no jobId — ready on return). The WHOLE clip stays on the
|
|
451
|
-
// timeline and counts toward the
|
|
481
|
+
// timeline and counts toward the 30s, so up to 27s; Omni continues from its end.
|
|
452
482
|
const { sessionId: seeded } = await aiflow.createVideoSession({
|
|
453
483
|
video: existingVideoUrlOrDataUrl,
|
|
454
484
|
});
|
|
@@ -464,7 +494,7 @@ turn.segmentUrl; // just the new tail
|
|
|
464
494
|
const session = await aiflow.getVideoSession(sessionId);
|
|
465
495
|
session.videoUrl; // play this
|
|
466
496
|
session.durationSeconds; // measured length so far
|
|
467
|
-
session.remainingSeconds; // left before the
|
|
497
|
+
session.remainingSeconds; // left before the 30s ceiling
|
|
468
498
|
session.canExtend; // gate your "Extend" button on THIS, nothing else
|
|
469
499
|
session.segments; // [{ url, durationSeconds, prompt, kind }, ...]
|
|
470
500
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devvibex/aiflow",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.0",
|
|
4
4
|
"description": "First-party LLM gateway SDK for apps generated on the VibeX platform — chat, streaming, image, video (including stateful multi-turn video extension with Gemini Omni), music (Lyria), sound effects (ElevenLabs), embeddings and real-time speech translation (Gemini Live) without shipping any third-party API key.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
package/src/index.d.ts
CHANGED
|
@@ -365,9 +365,9 @@ export interface VideoRequest {
|
|
|
365
365
|
resolution?: '480p' | '720p' | '1080p' | string;
|
|
366
366
|
/**
|
|
367
367
|
* Clip length in seconds — Seedance and Kling: an integer 4–15 on Seedance
|
|
368
|
-
* 2.0, 4–30 on 2.5, 3–
|
|
369
|
-
*
|
|
370
|
-
* {@link AIFlowClient.generateLongVideo}); Veo
|
|
368
|
+
* 2.0, 4–30 on 2.5, 3–30 on Kling 4.0 (clamped to that range, default 5). Gemini Omni
|
|
369
|
+
* 1.2 takes 3–15 and makes 10s when it is left out (longer:
|
|
370
|
+
* {@link AIFlowClient.generateLongVideo}); Veo takes 4, 6 or 8.
|
|
371
371
|
*/
|
|
372
372
|
duration?: number;
|
|
373
373
|
/** Burn the provider watermark into the output (Seedance only). */
|
|
@@ -384,24 +384,41 @@ export interface VideoRequest {
|
|
|
384
384
|
* Needs `@devvibex/aiflow` ≥ 1.15.0.
|
|
385
385
|
*/
|
|
386
386
|
lastFrame?: string | Blob;
|
|
387
|
+
/**
|
|
388
|
+
* Kling 4.0 only — keyframes between `image` and `lastFrame`, in the order
|
|
389
|
+
* the clip reaches them (up to 8; 10 images in all). Same formats as
|
|
390
|
+
* `image`, JPG / PNG, and requires it. Other models ignore them. Needs
|
|
391
|
+
* `@devvibex/aiflow` ≥ 1.18.0.
|
|
392
|
+
*/
|
|
393
|
+
middleFrames?: Array<string | Blob>;
|
|
394
|
+
/**
|
|
395
|
+
* A clip to work from: Gemini Omni and Kling (4.0 and 4.0 Flash) edit it
|
|
396
|
+
* as the prompt says (Kling: MP4 / MOV, 3–30s, 3–20s on Flash); Veo
|
|
397
|
+
* continues it by 7s.
|
|
398
|
+
*/
|
|
387
399
|
video?: string | Blob;
|
|
388
400
|
/**
|
|
389
|
-
* Seedance
|
|
390
|
-
* (
|
|
391
|
-
* prompt as @Image 1, @Image 2, … (or [Image 1]) in this
|
|
392
|
-
* `asset://`. Cannot be combined
|
|
401
|
+
* Seedance and Kling — reference images that keep a character, product or
|
|
402
|
+
* style (reference mode). Up to 9 on Seedance 2.0, 30 on 2.5, 10 on Kling.
|
|
403
|
+
* Cited in the prompt as @Image 1, @Image 2, … (or [Image 1]) in this
|
|
404
|
+
* order. `https://`, `data:` or (Seedance) `asset://`. Cannot be combined
|
|
405
|
+
* with `image` / `lastFrame`.
|
|
393
406
|
*/
|
|
394
407
|
referenceImages?: Array<string | Blob>;
|
|
395
408
|
/**
|
|
396
|
-
* Seedance
|
|
397
|
-
* or extend. Up to 3 on Seedance 2.0 (2–15s each,
|
|
398
|
-
* (≤30s total)
|
|
409
|
+
* Seedance and Kling — reference videos for motion/camera (on Seedance
|
|
410
|
+
* also the clip to edit or extend). Up to 3 on Seedance 2.0 (2–15s each,
|
|
411
|
+
* ≤15s total), 10 on 2.5 (≤30s total); on Kling up to 5 with `video`, 3s
|
|
412
|
+
* or longer each, ≤30s total (≤20s on Flash). `https://` (or `asset://` on
|
|
413
|
+
* Seedance) only. Cited as @Video 1, ….
|
|
399
414
|
*/
|
|
400
415
|
referenceVideos?: string[];
|
|
401
416
|
/**
|
|
402
|
-
* Seedance
|
|
417
|
+
* Seedance — reference audio (voice, music, rhythm), wav or mp3. Up to
|
|
403
418
|
* 3 on Seedance 2.0 (2–15s each, ≤15s total), and there it needs at least
|
|
404
419
|
* one reference image or video; 10 on 2.5 (≤30s total), audio alone allowed.
|
|
420
|
+
* Kling 4.0 — up to 3 voices: each clip (one clear speaker, 5–30s, no
|
|
421
|
+
* music) becomes the voice a character speaks in, with lip sync.
|
|
405
422
|
* Cited as @Audio 1, …. A voice or song with a character picture gives a
|
|
406
423
|
* lip-synced performance ("the woman in @Image 1 sings @Audio 1"). Pass the
|
|
407
424
|
* uploaded `File`s directly (sent as data URLs, ≥ 1.15.2) or https:// URLs;
|
|
@@ -409,9 +426,8 @@ export interface VideoRequest {
|
|
|
409
426
|
*/
|
|
410
427
|
referenceAudios?: Array<string | Blob>;
|
|
411
428
|
/**
|
|
412
|
-
* Seedance
|
|
413
|
-
*
|
|
414
|
-
* costs more per second).
|
|
429
|
+
* Seedance — whether the clip gets synchronized sound (voice, effects,
|
|
430
|
+
* music); on when omitted. Kling 4.0 always makes sound and ignores it.
|
|
415
431
|
*/
|
|
416
432
|
generateAudio?: boolean;
|
|
417
433
|
signal?: AbortSignal;
|
|
@@ -502,7 +518,7 @@ export interface VideoSegment {
|
|
|
502
518
|
*/
|
|
503
519
|
export interface VideoSession {
|
|
504
520
|
sessionId: string;
|
|
505
|
-
/** 'exhausted' once the
|
|
521
|
+
/** 'exhausted' once the model's ceiling (30s on Omni 1.2) is reached — a state, not an error. */
|
|
506
522
|
status: 'active' | 'exhausted';
|
|
507
523
|
model: string;
|
|
508
524
|
aspectRatio?: string;
|
|
@@ -516,7 +532,7 @@ export interface VideoSession {
|
|
|
516
532
|
thumbnailUrl?: string;
|
|
517
533
|
/** Measured length of `videoUrl`. */
|
|
518
534
|
durationSeconds: number;
|
|
519
|
-
/** Seconds left before Omni's
|
|
535
|
+
/** Seconds left before Omni's 30s ceiling. */
|
|
520
536
|
remainingSeconds: number;
|
|
521
537
|
/**
|
|
522
538
|
* Whether another extend turn is possible. The ONLY flag a UI should gate
|
|
@@ -568,7 +584,7 @@ export interface VideoSessionRequest {
|
|
|
568
584
|
* A clip you already have — an upload, a `generateVideo` or a
|
|
569
585
|
* `mergeVideos` result — to seed the timeline with instead of generating an
|
|
570
586
|
* opener. An `https://` or `data:` URL. The WHOLE clip stays on the timeline
|
|
571
|
-
* and counts toward the
|
|
587
|
+
* and counts toward the 30s cap, so it may be at most 27s (longer is a 400);
|
|
572
588
|
* the model continues from its last ~10s (Omni's input limit).
|
|
573
589
|
*/
|
|
574
590
|
video?: string;
|
|
@@ -601,14 +617,15 @@ export interface LongVideoRequest {
|
|
|
601
617
|
/** What the whole video shows. The gateway splits it into per-segment beats. */
|
|
602
618
|
prompt: string;
|
|
603
619
|
/**
|
|
604
|
-
* How long the finished video should be, in seconds — **5 to
|
|
620
|
+
* How long the finished video should be, in seconds — **5 to 30**.
|
|
605
621
|
*
|
|
606
|
-
*
|
|
607
|
-
*
|
|
608
|
-
* A larger number is CLAMPED to
|
|
622
|
+
* 30s is a model limit: a video is one Omni chain (an opening clip, 10s by
|
|
623
|
+
* default, then consecutive extends) and Google will not extend one past
|
|
624
|
+
* 30s on Omni 1.2. A larger number is CLAMPED to 30 and the result carries
|
|
625
|
+
* a `warning`.
|
|
609
626
|
*
|
|
610
|
-
* The result is "at least" this, up to the cap: Omni
|
|
611
|
-
*
|
|
627
|
+
* The result is "at least" this, up to the cap: Omni picks each
|
|
628
|
+
* extension's length (3–10s), so the timeline overshoots by up to one segment.
|
|
612
629
|
*/
|
|
613
630
|
durationSeconds: number;
|
|
614
631
|
/** Must be a Gemini Omni model; defaults to the module's video model. */
|
|
@@ -637,7 +654,7 @@ export interface LongVideoResponse extends VideoResponse {
|
|
|
637
654
|
segmentsDone?: number;
|
|
638
655
|
/**
|
|
639
656
|
* Set when the build came up short of `durationSeconds`, or when the request
|
|
640
|
-
* was clamped to the
|
|
657
|
+
* was clamped to the 30s maximum. The video is real and already paid for —
|
|
641
658
|
* show it, and the reason; do not treat it as an error.
|
|
642
659
|
*/
|
|
643
660
|
warning?: string;
|
|
@@ -1264,7 +1281,7 @@ export class AIFlowClient {
|
|
|
1264
1281
|
* the gateway storyboards the prompt into ~10s beats, generates them turn by
|
|
1265
1282
|
* turn and concatenates them into one finished clip.
|
|
1266
1283
|
*
|
|
1267
|
-
* **Maximum
|
|
1284
|
+
* **Maximum 30 seconds** (Gemini Omni 1.2) — see {@link LongVideoRequest.durationSeconds}.
|
|
1268
1285
|
* For anything longer, generate several videos and {@link mergeVideos} them;
|
|
1269
1286
|
* the joins are hard cuts.
|
|
1270
1287
|
*
|
|
@@ -1289,7 +1306,7 @@ export class AIFlowClient {
|
|
|
1289
1306
|
* regenerated. Resolves with the re-assembled video.
|
|
1290
1307
|
*
|
|
1291
1308
|
* Applies to SCENE-based sessions (`mode === 'scenes'`) only. None are
|
|
1292
|
-
* created while the
|
|
1309
|
+
* created while the cap is in place — every new build is continuous and
|
|
1293
1310
|
* is lengthened with {@link extendVideo} — so this serves sessions made
|
|
1294
1311
|
* before it. A continuous session is rejected with a 400.
|
|
1295
1312
|
*/
|
package/src/index.js
CHANGED
|
@@ -719,6 +719,7 @@ export class AIFlowClient {
|
|
|
719
719
|
watermark,
|
|
720
720
|
image,
|
|
721
721
|
lastFrame,
|
|
722
|
+
middleFrames,
|
|
722
723
|
video,
|
|
723
724
|
referenceImages,
|
|
724
725
|
referenceVideos,
|
|
@@ -735,6 +736,9 @@ export class AIFlowClient {
|
|
|
735
736
|
if (lastFrame && !image) {
|
|
736
737
|
throw new AIFlowError('lastFrame requires image (the first frame)');
|
|
737
738
|
}
|
|
739
|
+
if (middleFrames?.length && !image) {
|
|
740
|
+
throw new AIFlowError('middleFrames requires image (the first frame)');
|
|
741
|
+
}
|
|
738
742
|
const hasReferences =
|
|
739
743
|
!!referenceImages?.length ||
|
|
740
744
|
!!referenceVideos?.length ||
|
|
@@ -750,14 +754,21 @@ export class AIFlowClient {
|
|
|
750
754
|
);
|
|
751
755
|
}
|
|
752
756
|
// A File / Blob is sent as a data URL, so an upload can be passed as-is.
|
|
753
|
-
const [
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
757
|
+
const [
|
|
758
|
+
imageIn,
|
|
759
|
+
lastFrameIn,
|
|
760
|
+
middleFramesIn,
|
|
761
|
+
videoIn,
|
|
762
|
+
referenceImagesIn,
|
|
763
|
+
referenceAudiosIn,
|
|
764
|
+
] = await Promise.all([
|
|
765
|
+
toMediaInput(image),
|
|
766
|
+
toMediaInput(lastFrame),
|
|
767
|
+
middleFrames?.length && Promise.all(middleFrames.map(toMediaInput)),
|
|
768
|
+
toMediaInput(video),
|
|
769
|
+
referenceImages && Promise.all(referenceImages.map(toMediaInput)),
|
|
770
|
+
referenceAudios && Promise.all(referenceAudios.map(toMediaInput)),
|
|
771
|
+
]);
|
|
761
772
|
const badAudio = referenceAudiosIn?.find(
|
|
762
773
|
(a) =>
|
|
763
774
|
typeof a === 'string' &&
|
|
@@ -782,6 +793,7 @@ export class AIFlowClient {
|
|
|
782
793
|
watermark,
|
|
783
794
|
image: imageIn,
|
|
784
795
|
lastFrame: lastFrameIn,
|
|
796
|
+
middleFrames: middleFramesIn || undefined,
|
|
785
797
|
video: videoIn,
|
|
786
798
|
referenceImages: referenceImagesIn,
|
|
787
799
|
referenceVideos,
|
|
@@ -950,7 +962,7 @@ export class AIFlowClient {
|
|
|
950
962
|
}
|
|
951
963
|
|
|
952
964
|
// ── Stateful video sessions (Gemini Omni `extend`) ──────────────────────
|
|
953
|
-
// A session is ONE GROWING TIMELINE. Omni has no "generate
|
|
965
|
+
// A session is ONE GROWING TIMELINE. Omni has no "generate 30 seconds" mode
|
|
954
966
|
// and no concatenation endpoint: a long clip is built turn by turn, each turn
|
|
955
967
|
// appending 3–10s while the model keeps the characters, motion and audio bed
|
|
956
968
|
// continuous. The gateway concatenates the segments and always hands back the
|
|
@@ -970,7 +982,7 @@ export class AIFlowClient {
|
|
|
970
982
|
* - `video`: the timeline is SEEDED from a clip you already have (an
|
|
971
983
|
* upload, a `generateVideo` result, a `mergeVideos` result) — ready on
|
|
972
984
|
* return, no `jobId`. The WHOLE clip stays on the timeline and counts
|
|
973
|
-
* toward the
|
|
985
|
+
* toward the 30s cap, so it can be at most 27s; the model continues from
|
|
974
986
|
* its last ~10s (Omni's input limit).
|
|
975
987
|
*
|
|
976
988
|
* `aspectRatio` / `resolution` are fixed for the WHOLE session here: Omni
|
|
@@ -1037,14 +1049,14 @@ export class AIFlowClient {
|
|
|
1037
1049
|
* });
|
|
1038
1050
|
* ```
|
|
1039
1051
|
*
|
|
1040
|
-
* **Maximum
|
|
1041
|
-
*
|
|
1042
|
-
* A larger `durationSeconds` is CLAMPED to
|
|
1043
|
-
* `warning`. For anything longer, generate several videos and
|
|
1052
|
+
* **Maximum 30 seconds** (Gemini Omni 1.2). A video is one Omni chain — an
|
|
1053
|
+
* opening clip (10s by default) plus consecutive extends — and Google will not
|
|
1054
|
+
* extend one past 30s. A larger `durationSeconds` is CLAMPED to 30 and the
|
|
1055
|
+
* result carries a `warning`. For anything longer, generate several videos and
|
|
1044
1056
|
* {@link AIFlowClient#mergeVideos} them; the joins are hard cuts.
|
|
1045
1057
|
*
|
|
1046
1058
|
* Three things to design the UI around:
|
|
1047
|
-
* - cap the duration control at
|
|
1059
|
+
* - cap the duration control at 30s (chips of 10 / 20 / 30 read best);
|
|
1048
1060
|
* - it takes MINUTES (roughly two to three per 10s of video), and
|
|
1049
1061
|
* `onProgress` fires after every segment with a PLAYABLE partial
|
|
1050
1062
|
* `videoUrl` — show it rather than a spinner;
|
|
@@ -1219,7 +1231,7 @@ export class AIFlowClient {
|
|
|
1219
1231
|
* `remainingSeconds` for driving the extend control.
|
|
1220
1232
|
*
|
|
1221
1233
|
* `canExtend` is the ONLY thing a UI should gate its extend button on: it is
|
|
1222
|
-
* false both while the opening clip is still generating and once the
|
|
1234
|
+
* false both while the opening clip is still generating and once the 30s
|
|
1223
1235
|
* ceiling is reached, so a client never has to know the limit itself.
|
|
1224
1236
|
* @returns {Promise<object>}
|
|
1225
1237
|
*/
|