@broberg/ai-sdk 0.71.1 → 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/{chunk-KCHMZ6P5.js → chunk-GMR2UFWI.js} +2 -2
- package/dist/chunk-GMR2UFWI.js.map +1 -0
- package/dist/{chunk-ZL6TFGZ2.js → chunk-XKN2PYBQ.js} +16 -1
- package/dist/chunk-XKN2PYBQ.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +20 -8
- package/dist/index.js.map +1 -1
- package/dist/pricing.js +1 -1
- package/dist/registry.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-KCHMZ6P5.js.map +0 -1
- package/dist/chunk-ZL6TFGZ2.js.map +0 -1
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.
|
|
1573
|
-
declare const SDK_TAG: "@broberg/ai-sdk@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-
|
|
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-
|
|
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.
|
|
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.
|
|
4452
|
-
var SDK_TAG = "@broberg/ai-sdk@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) {
|
|
@@ -4773,9 +4783,10 @@ var DEFAULT_BFL_REFERENCE_SPEC = {
|
|
|
4773
4783
|
};
|
|
4774
4784
|
var DEFAULT_OCR_SPEC = { provider: "mistral", model: "mistral-ocr-4-1", transport: "http" };
|
|
4775
4785
|
var DEFAULT_MODERATION_SPEC = { provider: "mistral", model: "mistral-moderation-2603", transport: "http" };
|
|
4776
|
-
var
|
|
4786
|
+
var JEV_JUDGE_SPEC = { provider: "typesafe", model: "jev-1.13.0", transport: "http" };
|
|
4777
4787
|
var EU_JUDGE_SPEC = { provider: "microsoft-decision", model: "microsoft-decision-1-v1", transport: "http" };
|
|
4778
|
-
var
|
|
4788
|
+
var DEFAULT_JUDGE_SPEC = EU_JUDGE_SPEC;
|
|
4789
|
+
var JUDGE_SPECS = { typesafe: JEV_JUDGE_SPEC, "microsoft-decision": EU_JUDGE_SPEC };
|
|
4779
4790
|
function judgeSpecFromEnv() {
|
|
4780
4791
|
const v = process.env.AI_JUDGE_PROVIDER;
|
|
4781
4792
|
if (v === void 0 || v === "") return DEFAULT_JUDGE_SPEC;
|
|
@@ -4807,6 +4818,7 @@ var ROUTED_SPECS = [
|
|
|
4807
4818
|
DEFAULT_MODERATION_SPEC,
|
|
4808
4819
|
DEFAULT_JUDGE_SPEC,
|
|
4809
4820
|
EU_JUDGE_SPEC,
|
|
4821
|
+
JEV_JUDGE_SPEC,
|
|
4810
4822
|
DEFAULT_VECTORIZE_SPEC,
|
|
4811
4823
|
DEFAULT_PODCAST_SPEC,
|
|
4812
4824
|
DEFAULT_TTS_SPEC,
|