@broberg/ai-sdk 0.49.1 → 0.49.2

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.d.ts CHANGED
@@ -2604,8 +2604,8 @@ declare const falStubAdapter: ProviderAdapter;
2604
2604
  * wires the live adapters. */
2605
2605
  declare const stubProviders: Record<string, ProviderAdapter>;
2606
2606
 
2607
- declare const VERSION: "0.49.1";
2608
- declare const SDK_TAG: "@broberg/ai-sdk@0.49.1";
2607
+ declare const VERSION: "0.49.2";
2608
+ declare const SDK_TAG: "@broberg/ai-sdk@0.49.2";
2609
2609
 
2610
2610
  /** Built-in defaults. Every entry is overridable via AiConfig.defaults or a
2611
2611
  * per-call override.
package/dist/index.js CHANGED
@@ -2646,8 +2646,9 @@ function bflAdapter(config = {}) {
2646
2646
  if (!apiKey) throw new Error("bfl adapter: BFL_API_KEY not set");
2647
2647
  const headers = { "content-type": "application/json", "x-key": apiKey };
2648
2648
  const body = { prompt: req.prompt };
2649
- if (req.referenceImages?.length) {
2650
- req.referenceImages.forEach((img, i) => {
2649
+ const flux2PromptOnly = !req.referenceImages?.length && !req.finetune && req.spec.model.startsWith("flux-2");
2650
+ if (req.referenceImages?.length || flux2PromptOnly) {
2651
+ req.referenceImages?.forEach((img, i) => {
2651
2652
  body[i === 0 ? "input_image" : `input_image_${i + 1}`] = toBflImage(img);
2652
2653
  });
2653
2654
  if (req.width) body.width = req.width;
@@ -2664,7 +2665,7 @@ function bflAdapter(config = {}) {
2664
2665
  }
2665
2666
  } else {
2666
2667
  throw new Error(
2667
- "bfl adapter: requires referenceImages (FLUX 2 multi-reference) or a finetune id. ai.image({ referenceImages: [...] }) needs no training; ai.image({ finetune }) uses a subject trained once in the BFL dashboard (dashboard.bfl.ai \u2014 finetune-create is not in the public API)."
2668
+ `bfl adapter: ${req.spec.model} requires referenceImages (FLUX 2 multi-reference) or a finetune id. For a plain prompt use a FLUX 2 model: override:{ provider:"bfl", model:"flux-2-pro" }. ai.image({ referenceImages: [...] }) needs no training; ai.image({ finetune }) uses a subject trained once in the BFL dashboard (dashboard.bfl.ai \u2014 finetune-create is not in the public API).`
2668
2669
  );
2669
2670
  }
2670
2671
  const submitRes = await doFetch(`${base}/v1/${req.spec.model}`, {
@@ -3409,8 +3410,8 @@ var aiConfigSchema = z.object({
3409
3410
  import { randomUUID } from "crypto";
3410
3411
 
3411
3412
  // src/version.ts
3412
- var VERSION = "0.49.1";
3413
- var SDK_TAG = "@broberg/ai-sdk@0.49.1";
3413
+ var VERSION = "0.49.2";
3414
+ var SDK_TAG = "@broberg/ai-sdk@0.49.2";
3414
3415
 
3415
3416
  // src/cost/sinks/upmetrics.ts
3416
3417
  function isRetryableStatus(status) {