@broberg/ai-sdk 0.72.0 → 0.73.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.d.ts CHANGED
@@ -1569,8 +1569,8 @@ declare const falStubAdapter: ProviderAdapter;
1569
1569
  * wires the live adapters. */
1570
1570
  declare const stubProviders: Record<string, ProviderAdapter>;
1571
1571
 
1572
- declare const VERSION: "0.72.0";
1573
- declare const SDK_TAG: "@broberg/ai-sdk@0.72.0";
1572
+ declare const VERSION: "0.73.0";
1573
+ declare const SDK_TAG: "@broberg/ai-sdk@0.73.0";
1574
1574
 
1575
1575
  /** Built-in defaults. Every entry is overridable via AiConfig.defaults or a
1576
1576
  * per-call override.
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  resolveModel,
12
12
  resolveTier,
13
13
  setAvailability
14
- } from "./chunk-KCHMZ6P5.js";
14
+ } from "./chunk-GMR2UFWI.js";
15
15
  import {
16
16
  DEFAULT_CLIP_SEC,
17
17
  MEDIA_PRICING,
@@ -23,7 +23,7 @@ import {
23
23
  listMediaPrices,
24
24
  pricingFreshness,
25
25
  pricingGeneratedAt
26
- } from "./chunk-ZL6TFGZ2.js";
26
+ } from "./chunk-XKN2PYBQ.js";
27
27
  import {
28
28
  PRICING,
29
29
  getPrice
@@ -3311,7 +3311,17 @@ function bflAdapter(config = {}) {
3311
3311
  const headers = { "content-type": "application/json", "x-key": apiKey };
3312
3312
  const body = { prompt: req.prompt };
3313
3313
  const flux2PromptOnly = !req.referenceImages?.length && !req.finetune && req.spec.model.startsWith("flux-2");
3314
- if (req.referenceImages?.length || flux2PromptOnly) {
3314
+ if (req.spec.model.startsWith("flux-3-image")) {
3315
+ if (req.finetune) throw new Error(`bfl adapter: ${req.spec.model} takes no finetune \u2014 finetunes run on flux-pro-1.1-ultra-finetuned`);
3316
+ if (req.referenceImages?.length) body.images = req.referenceImages.map(toBflImage);
3317
+ if (req.width) body.width = req.width;
3318
+ if (req.height) body.height = req.height;
3319
+ body.safety_tolerance = req.safetyTolerance ?? 2;
3320
+ if (req.spec.model === "flux-3-image-klein") {
3321
+ if (req.seed !== void 0) body.seed = req.seed;
3322
+ body.output_format = req.outputFormat ?? "jpeg";
3323
+ }
3324
+ } else if (req.referenceImages?.length || flux2PromptOnly) {
3315
3325
  req.referenceImages?.forEach((img, i) => {
3316
3326
  body[i === 0 ? "input_image" : `input_image_${i + 1}`] = toBflImage(img);
3317
3327
  });
@@ -3356,7 +3366,7 @@ function bflAdapter(config = {}) {
3356
3366
  usage.costUsd = submit.cost * BFL_CREDIT_USD;
3357
3367
  usage.costBasis = "reported";
3358
3368
  } else {
3359
- usage.costUsd = config.pricePerImage ?? getMediaPrice("bfl", "flux-pro-1.1-ultra-finetuned")?.usd ?? 0;
3369
+ usage.costUsd = config.pricePerImage ?? getMediaPrice("bfl", req.spec.model)?.usd ?? getMediaPrice("bfl", "flux-pro-1.1-ultra-finetuned")?.usd ?? 0;
3360
3370
  usage.costBasis = config.pricePerImage !== void 0 ? "computed" : "estimated";
3361
3371
  }
3362
3372
  return { url: sample, usage };
@@ -4448,8 +4458,8 @@ var aiConfigSchema = z.object({
4448
4458
  import { randomUUID } from "crypto";
4449
4459
 
4450
4460
  // src/version.ts
4451
- var VERSION = "0.72.0";
4452
- var SDK_TAG = "@broberg/ai-sdk@0.72.0";
4461
+ var VERSION = "0.73.0";
4462
+ var SDK_TAG = "@broberg/ai-sdk@0.73.0";
4453
4463
 
4454
4464
  // src/cost/sinks/upmetrics.ts
4455
4465
  function isRetryableStatus(status) {