@blockrun/llm 3.1.0 → 3.2.1
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/dist/index.cjs +53 -2
- package/dist/index.d.cts +35 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +53 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2606,11 +2606,62 @@ var VideoClient = class {
|
|
|
2606
2606
|
const budgetMs = options?.budgetMs ?? DEFAULT_GENERATE_BUDGET_MS;
|
|
2607
2607
|
return this.submitAndPoll(body, budgetMs);
|
|
2608
2608
|
}
|
|
2609
|
+
/**
|
|
2610
|
+
* Generate a video from a standard Seedance `content[]` body.
|
|
2611
|
+
*
|
|
2612
|
+
* Targets the gateway's `POST /v1/videos` endpoint, which accepts the
|
|
2613
|
+
* mainstream multimodal `content` array (text + a single reference image)
|
|
2614
|
+
* used by other Seedance APIs — so callers already holding a
|
|
2615
|
+
* `content[]`-shaped request can submit it unchanged. The gateway validates
|
|
2616
|
+
* unsupported inputs *before* charging, then delegates to the same x402
|
|
2617
|
+
* submit+poll pipeline as {@link generate}.
|
|
2618
|
+
*
|
|
2619
|
+
* Most SDK users should prefer {@link generate} (structured options like
|
|
2620
|
+
* `imageUrl` / `lastFrameUrl`) — this exists for migrating existing
|
|
2621
|
+
* `content[]` payloads with no reshaping.
|
|
2622
|
+
*
|
|
2623
|
+
* @param content - The Seedance `content` array, e.g.
|
|
2624
|
+
* `[{ type: "text", text: "a red apple spinning" }]` or a text item plus
|
|
2625
|
+
* `{ type: "image_url", image_url: { url: "https://..." } }`.
|
|
2626
|
+
* @param options - `model`, `budgetMs`, plus the same camelCase render options
|
|
2627
|
+
* as {@link generate} (`durationSeconds`, `aspectRatio`, `resolution`,
|
|
2628
|
+
* `generateAudio`, `seed`, `watermark`, `returnLastFrame`). These are mapped
|
|
2629
|
+
* to the gateway's snake_case fields for you. Any other keys you pass are
|
|
2630
|
+
* forwarded verbatim (use snake_case for those, since the gateway reads
|
|
2631
|
+
* snake_case only).
|
|
2632
|
+
*/
|
|
2633
|
+
async generateFromContent(content, options) {
|
|
2634
|
+
if (!Array.isArray(content) || content.length === 0) {
|
|
2635
|
+
throw new Error("content must be a non-empty array of Seedance content items.");
|
|
2636
|
+
}
|
|
2637
|
+
const {
|
|
2638
|
+
model,
|
|
2639
|
+
budgetMs,
|
|
2640
|
+
durationSeconds,
|
|
2641
|
+
aspectRatio,
|
|
2642
|
+
resolution,
|
|
2643
|
+
generateAudio,
|
|
2644
|
+
seed,
|
|
2645
|
+
watermark,
|
|
2646
|
+
returnLastFrame,
|
|
2647
|
+
...extra
|
|
2648
|
+
} = options ?? {};
|
|
2649
|
+
const body = { content, ...extra };
|
|
2650
|
+
if (model !== void 0) body.model = model;
|
|
2651
|
+
if (durationSeconds !== void 0) body.duration_seconds = durationSeconds;
|
|
2652
|
+
if (aspectRatio !== void 0) body.aspect_ratio = aspectRatio;
|
|
2653
|
+
if (resolution !== void 0) body.resolution = resolution;
|
|
2654
|
+
if (generateAudio !== void 0) body.generate_audio = generateAudio;
|
|
2655
|
+
if (seed !== void 0) body.seed = seed;
|
|
2656
|
+
if (watermark !== void 0) body.watermark = watermark;
|
|
2657
|
+
if (returnLastFrame !== void 0) body.return_last_frame = returnLastFrame;
|
|
2658
|
+
return this.submitAndPoll(body, budgetMs ?? DEFAULT_GENERATE_BUDGET_MS, "/v1/videos");
|
|
2659
|
+
}
|
|
2609
2660
|
// --------------------------------------------------------------------
|
|
2610
2661
|
// Internal: async submit + poll
|
|
2611
2662
|
// --------------------------------------------------------------------
|
|
2612
|
-
async submitAndPoll(body, budgetMs) {
|
|
2613
|
-
const submitUrl = `${this.apiUrl}
|
|
2663
|
+
async submitAndPoll(body, budgetMs, submitPath = "/v1/videos/generations") {
|
|
2664
|
+
const submitUrl = `${this.apiUrl}${submitPath}`;
|
|
2614
2665
|
const resp402 = await this.fetchWithTimeout(submitUrl, {
|
|
2615
2666
|
method: "POST",
|
|
2616
2667
|
headers: { "Content-Type": "application/json" },
|
package/dist/index.d.cts
CHANGED
|
@@ -1698,6 +1698,41 @@ declare class VideoClient {
|
|
|
1698
1698
|
generate(prompt: string, options?: VideoGenerateOptions & {
|
|
1699
1699
|
budgetMs?: number;
|
|
1700
1700
|
}): Promise<VideoResponse>;
|
|
1701
|
+
/**
|
|
1702
|
+
* Generate a video from a standard Seedance `content[]` body.
|
|
1703
|
+
*
|
|
1704
|
+
* Targets the gateway's `POST /v1/videos` endpoint, which accepts the
|
|
1705
|
+
* mainstream multimodal `content` array (text + a single reference image)
|
|
1706
|
+
* used by other Seedance APIs — so callers already holding a
|
|
1707
|
+
* `content[]`-shaped request can submit it unchanged. The gateway validates
|
|
1708
|
+
* unsupported inputs *before* charging, then delegates to the same x402
|
|
1709
|
+
* submit+poll pipeline as {@link generate}.
|
|
1710
|
+
*
|
|
1711
|
+
* Most SDK users should prefer {@link generate} (structured options like
|
|
1712
|
+
* `imageUrl` / `lastFrameUrl`) — this exists for migrating existing
|
|
1713
|
+
* `content[]` payloads with no reshaping.
|
|
1714
|
+
*
|
|
1715
|
+
* @param content - The Seedance `content` array, e.g.
|
|
1716
|
+
* `[{ type: "text", text: "a red apple spinning" }]` or a text item plus
|
|
1717
|
+
* `{ type: "image_url", image_url: { url: "https://..." } }`.
|
|
1718
|
+
* @param options - `model`, `budgetMs`, plus the same camelCase render options
|
|
1719
|
+
* as {@link generate} (`durationSeconds`, `aspectRatio`, `resolution`,
|
|
1720
|
+
* `generateAudio`, `seed`, `watermark`, `returnLastFrame`). These are mapped
|
|
1721
|
+
* to the gateway's snake_case fields for you. Any other keys you pass are
|
|
1722
|
+
* forwarded verbatim (use snake_case for those, since the gateway reads
|
|
1723
|
+
* snake_case only).
|
|
1724
|
+
*/
|
|
1725
|
+
generateFromContent(content: Array<Record<string, unknown>>, options?: {
|
|
1726
|
+
model?: string;
|
|
1727
|
+
budgetMs?: number;
|
|
1728
|
+
durationSeconds?: number;
|
|
1729
|
+
aspectRatio?: string;
|
|
1730
|
+
resolution?: string;
|
|
1731
|
+
generateAudio?: boolean;
|
|
1732
|
+
seed?: number;
|
|
1733
|
+
watermark?: boolean;
|
|
1734
|
+
returnLastFrame?: boolean;
|
|
1735
|
+
} & Record<string, unknown>): Promise<VideoResponse>;
|
|
1701
1736
|
private submitAndPoll;
|
|
1702
1737
|
private absolute;
|
|
1703
1738
|
private extractPaymentRequired;
|
package/dist/index.d.ts
CHANGED
|
@@ -1698,6 +1698,41 @@ declare class VideoClient {
|
|
|
1698
1698
|
generate(prompt: string, options?: VideoGenerateOptions & {
|
|
1699
1699
|
budgetMs?: number;
|
|
1700
1700
|
}): Promise<VideoResponse>;
|
|
1701
|
+
/**
|
|
1702
|
+
* Generate a video from a standard Seedance `content[]` body.
|
|
1703
|
+
*
|
|
1704
|
+
* Targets the gateway's `POST /v1/videos` endpoint, which accepts the
|
|
1705
|
+
* mainstream multimodal `content` array (text + a single reference image)
|
|
1706
|
+
* used by other Seedance APIs — so callers already holding a
|
|
1707
|
+
* `content[]`-shaped request can submit it unchanged. The gateway validates
|
|
1708
|
+
* unsupported inputs *before* charging, then delegates to the same x402
|
|
1709
|
+
* submit+poll pipeline as {@link generate}.
|
|
1710
|
+
*
|
|
1711
|
+
* Most SDK users should prefer {@link generate} (structured options like
|
|
1712
|
+
* `imageUrl` / `lastFrameUrl`) — this exists for migrating existing
|
|
1713
|
+
* `content[]` payloads with no reshaping.
|
|
1714
|
+
*
|
|
1715
|
+
* @param content - The Seedance `content` array, e.g.
|
|
1716
|
+
* `[{ type: "text", text: "a red apple spinning" }]` or a text item plus
|
|
1717
|
+
* `{ type: "image_url", image_url: { url: "https://..." } }`.
|
|
1718
|
+
* @param options - `model`, `budgetMs`, plus the same camelCase render options
|
|
1719
|
+
* as {@link generate} (`durationSeconds`, `aspectRatio`, `resolution`,
|
|
1720
|
+
* `generateAudio`, `seed`, `watermark`, `returnLastFrame`). These are mapped
|
|
1721
|
+
* to the gateway's snake_case fields for you. Any other keys you pass are
|
|
1722
|
+
* forwarded verbatim (use snake_case for those, since the gateway reads
|
|
1723
|
+
* snake_case only).
|
|
1724
|
+
*/
|
|
1725
|
+
generateFromContent(content: Array<Record<string, unknown>>, options?: {
|
|
1726
|
+
model?: string;
|
|
1727
|
+
budgetMs?: number;
|
|
1728
|
+
durationSeconds?: number;
|
|
1729
|
+
aspectRatio?: string;
|
|
1730
|
+
resolution?: string;
|
|
1731
|
+
generateAudio?: boolean;
|
|
1732
|
+
seed?: number;
|
|
1733
|
+
watermark?: boolean;
|
|
1734
|
+
returnLastFrame?: boolean;
|
|
1735
|
+
} & Record<string, unknown>): Promise<VideoResponse>;
|
|
1701
1736
|
private submitAndPoll;
|
|
1702
1737
|
private absolute;
|
|
1703
1738
|
private extractPaymentRequired;
|
package/dist/index.js
CHANGED
|
@@ -2499,11 +2499,62 @@ var VideoClient = class {
|
|
|
2499
2499
|
const budgetMs = options?.budgetMs ?? DEFAULT_GENERATE_BUDGET_MS;
|
|
2500
2500
|
return this.submitAndPoll(body, budgetMs);
|
|
2501
2501
|
}
|
|
2502
|
+
/**
|
|
2503
|
+
* Generate a video from a standard Seedance `content[]` body.
|
|
2504
|
+
*
|
|
2505
|
+
* Targets the gateway's `POST /v1/videos` endpoint, which accepts the
|
|
2506
|
+
* mainstream multimodal `content` array (text + a single reference image)
|
|
2507
|
+
* used by other Seedance APIs — so callers already holding a
|
|
2508
|
+
* `content[]`-shaped request can submit it unchanged. The gateway validates
|
|
2509
|
+
* unsupported inputs *before* charging, then delegates to the same x402
|
|
2510
|
+
* submit+poll pipeline as {@link generate}.
|
|
2511
|
+
*
|
|
2512
|
+
* Most SDK users should prefer {@link generate} (structured options like
|
|
2513
|
+
* `imageUrl` / `lastFrameUrl`) — this exists for migrating existing
|
|
2514
|
+
* `content[]` payloads with no reshaping.
|
|
2515
|
+
*
|
|
2516
|
+
* @param content - The Seedance `content` array, e.g.
|
|
2517
|
+
* `[{ type: "text", text: "a red apple spinning" }]` or a text item plus
|
|
2518
|
+
* `{ type: "image_url", image_url: { url: "https://..." } }`.
|
|
2519
|
+
* @param options - `model`, `budgetMs`, plus the same camelCase render options
|
|
2520
|
+
* as {@link generate} (`durationSeconds`, `aspectRatio`, `resolution`,
|
|
2521
|
+
* `generateAudio`, `seed`, `watermark`, `returnLastFrame`). These are mapped
|
|
2522
|
+
* to the gateway's snake_case fields for you. Any other keys you pass are
|
|
2523
|
+
* forwarded verbatim (use snake_case for those, since the gateway reads
|
|
2524
|
+
* snake_case only).
|
|
2525
|
+
*/
|
|
2526
|
+
async generateFromContent(content, options) {
|
|
2527
|
+
if (!Array.isArray(content) || content.length === 0) {
|
|
2528
|
+
throw new Error("content must be a non-empty array of Seedance content items.");
|
|
2529
|
+
}
|
|
2530
|
+
const {
|
|
2531
|
+
model,
|
|
2532
|
+
budgetMs,
|
|
2533
|
+
durationSeconds,
|
|
2534
|
+
aspectRatio,
|
|
2535
|
+
resolution,
|
|
2536
|
+
generateAudio,
|
|
2537
|
+
seed,
|
|
2538
|
+
watermark,
|
|
2539
|
+
returnLastFrame,
|
|
2540
|
+
...extra
|
|
2541
|
+
} = options ?? {};
|
|
2542
|
+
const body = { content, ...extra };
|
|
2543
|
+
if (model !== void 0) body.model = model;
|
|
2544
|
+
if (durationSeconds !== void 0) body.duration_seconds = durationSeconds;
|
|
2545
|
+
if (aspectRatio !== void 0) body.aspect_ratio = aspectRatio;
|
|
2546
|
+
if (resolution !== void 0) body.resolution = resolution;
|
|
2547
|
+
if (generateAudio !== void 0) body.generate_audio = generateAudio;
|
|
2548
|
+
if (seed !== void 0) body.seed = seed;
|
|
2549
|
+
if (watermark !== void 0) body.watermark = watermark;
|
|
2550
|
+
if (returnLastFrame !== void 0) body.return_last_frame = returnLastFrame;
|
|
2551
|
+
return this.submitAndPoll(body, budgetMs ?? DEFAULT_GENERATE_BUDGET_MS, "/v1/videos");
|
|
2552
|
+
}
|
|
2502
2553
|
// --------------------------------------------------------------------
|
|
2503
2554
|
// Internal: async submit + poll
|
|
2504
2555
|
// --------------------------------------------------------------------
|
|
2505
|
-
async submitAndPoll(body, budgetMs) {
|
|
2506
|
-
const submitUrl = `${this.apiUrl}
|
|
2556
|
+
async submitAndPoll(body, budgetMs, submitPath = "/v1/videos/generations") {
|
|
2557
|
+
const submitUrl = `${this.apiUrl}${submitPath}`;
|
|
2507
2558
|
const resp402 = await this.fetchWithTimeout(submitUrl, {
|
|
2508
2559
|
method: "POST",
|
|
2509
2560
|
headers: { "Content-Type": "application/json" },
|