@broberg/ai-sdk 0.49.1 → 0.49.3

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.js CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  listMediaPrices,
19
19
  pricingFreshness,
20
20
  pricingGeneratedAt
21
- } from "./chunk-HXF7VDWZ.js";
21
+ } from "./chunk-4SIHCELN.js";
22
22
 
23
23
  // src/cost/default-hosts.ts
24
24
  var DEFAULT_BASE_URLS = {
@@ -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.3";
3414
+ var SDK_TAG = "@broberg/ai-sdk@0.49.3";
3414
3415
 
3415
3416
  // src/cost/sinks/upmetrics.ts
3416
3417
  function isRetryableStatus(status) {