@blockrun/llm 3.1.0 → 3.2.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/dist/index.cjs CHANGED
@@ -2606,11 +2606,41 @@ 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`, and any extra top-level body fields
2627
+ * (`resolution`, `durationSeconds`/`duration_seconds`, `aspectRatio`, …)
2628
+ * forwarded verbatim.
2629
+ */
2630
+ async generateFromContent(content, options) {
2631
+ if (!Array.isArray(content) || content.length === 0) {
2632
+ throw new Error("content must be a non-empty array of Seedance content items.");
2633
+ }
2634
+ const { model, budgetMs, ...extra } = options ?? {};
2635
+ const body = { content, ...extra };
2636
+ if (model !== void 0) body.model = model;
2637
+ return this.submitAndPoll(body, budgetMs ?? DEFAULT_GENERATE_BUDGET_MS, "/v1/videos");
2638
+ }
2609
2639
  // --------------------------------------------------------------------
2610
2640
  // Internal: async submit + poll
2611
2641
  // --------------------------------------------------------------------
2612
- async submitAndPoll(body, budgetMs) {
2613
- const submitUrl = `${this.apiUrl}/v1/videos/generations`;
2642
+ async submitAndPoll(body, budgetMs, submitPath = "/v1/videos/generations") {
2643
+ const submitUrl = `${this.apiUrl}${submitPath}`;
2614
2644
  const resp402 = await this.fetchWithTimeout(submitUrl, {
2615
2645
  method: "POST",
2616
2646
  headers: { "Content-Type": "application/json" },
package/dist/index.d.cts CHANGED
@@ -1698,6 +1698,31 @@ 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`, and any extra top-level body fields
1719
+ * (`resolution`, `durationSeconds`/`duration_seconds`, `aspectRatio`, …)
1720
+ * forwarded verbatim.
1721
+ */
1722
+ generateFromContent(content: Array<Record<string, unknown>>, options?: {
1723
+ model?: string;
1724
+ budgetMs?: number;
1725
+ } & Record<string, unknown>): Promise<VideoResponse>;
1701
1726
  private submitAndPoll;
1702
1727
  private absolute;
1703
1728
  private extractPaymentRequired;
package/dist/index.d.ts CHANGED
@@ -1698,6 +1698,31 @@ 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`, and any extra top-level body fields
1719
+ * (`resolution`, `durationSeconds`/`duration_seconds`, `aspectRatio`, …)
1720
+ * forwarded verbatim.
1721
+ */
1722
+ generateFromContent(content: Array<Record<string, unknown>>, options?: {
1723
+ model?: string;
1724
+ budgetMs?: number;
1725
+ } & Record<string, unknown>): Promise<VideoResponse>;
1701
1726
  private submitAndPoll;
1702
1727
  private absolute;
1703
1728
  private extractPaymentRequired;
package/dist/index.js CHANGED
@@ -2499,11 +2499,41 @@ 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`, and any extra top-level body fields
2520
+ * (`resolution`, `durationSeconds`/`duration_seconds`, `aspectRatio`, …)
2521
+ * forwarded verbatim.
2522
+ */
2523
+ async generateFromContent(content, options) {
2524
+ if (!Array.isArray(content) || content.length === 0) {
2525
+ throw new Error("content must be a non-empty array of Seedance content items.");
2526
+ }
2527
+ const { model, budgetMs, ...extra } = options ?? {};
2528
+ const body = { content, ...extra };
2529
+ if (model !== void 0) body.model = model;
2530
+ return this.submitAndPoll(body, budgetMs ?? DEFAULT_GENERATE_BUDGET_MS, "/v1/videos");
2531
+ }
2502
2532
  // --------------------------------------------------------------------
2503
2533
  // Internal: async submit + poll
2504
2534
  // --------------------------------------------------------------------
2505
- async submitAndPoll(body, budgetMs) {
2506
- const submitUrl = `${this.apiUrl}/v1/videos/generations`;
2535
+ async submitAndPoll(body, budgetMs, submitPath = "/v1/videos/generations") {
2536
+ const submitUrl = `${this.apiUrl}${submitPath}`;
2507
2537
  const resp402 = await this.fetchWithTimeout(submitUrl, {
2508
2538
  method: "POST",
2509
2539
  headers: { "Content-Type": "application/json" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockrun/llm",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "type": "module",
5
5
  "description": "BlockRun SDK - Pay-per-request AI (LLM, Image, Video, Music, Voice) via x402 on Base and Solana",
6
6
  "main": "dist/index.cjs",