@shop-os/modelkit 0.15.1 → 0.16.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/CHANGELOG.md +17 -0
- package/README.md +29 -2
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.d.cts +30 -2
- package/dist/catalog.d.ts +30 -2
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +295 -86
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +92 -2
- package/dist/index.d.ts +92 -2
- package/dist/index.js +290 -86
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -140,8 +140,8 @@ function normalizeExposure(value) {
|
|
|
140
140
|
if (value.every(
|
|
141
141
|
(entry) => SURFACES.includes(entry)
|
|
142
142
|
)) {
|
|
143
|
-
const
|
|
144
|
-
return SURFACES.filter((surface) =>
|
|
143
|
+
const present3 = new Set(value);
|
|
144
|
+
return SURFACES.filter((surface) => present3.has(surface));
|
|
145
145
|
}
|
|
146
146
|
return value;
|
|
147
147
|
}
|
|
@@ -8446,9 +8446,6 @@ var aiSdkTextAdapter = {
|
|
|
8446
8446
|
// src/adapters/ark.ts
|
|
8447
8447
|
import { z as z7 } from "zod";
|
|
8448
8448
|
|
|
8449
|
-
// src/retry.ts
|
|
8450
|
-
import { z as z6 } from "zod";
|
|
8451
|
-
|
|
8452
8449
|
// src/json.ts
|
|
8453
8450
|
import { z as z5 } from "zod";
|
|
8454
8451
|
var JsonValueSchema = z5.lazy(
|
|
@@ -8485,6 +8482,7 @@ function describeThrown(cause) {
|
|
|
8485
8482
|
}
|
|
8486
8483
|
|
|
8487
8484
|
// src/retry.ts
|
|
8485
|
+
import { z as z6 } from "zod";
|
|
8488
8486
|
var textBody = z6.string();
|
|
8489
8487
|
var BILLING_CODES = /* @__PURE__ */ new Set([
|
|
8490
8488
|
"insufficient_quota",
|
|
@@ -8781,10 +8779,36 @@ function arkKey(ctx) {
|
|
|
8781
8779
|
}
|
|
8782
8780
|
return key;
|
|
8783
8781
|
}
|
|
8784
|
-
|
|
8782
|
+
var ARK_CODES = /* @__PURE__ */ new Map([
|
|
8783
|
+
["AccountOverdueError", { status: 403, code: "provider_billing" }],
|
|
8784
|
+
["OperationDenied.ServiceOverdue", { status: 403, code: "provider_billing" }],
|
|
8785
|
+
["QuotaExceeded", { status: 429, code: "provider_billing" }],
|
|
8786
|
+
["ModelNotOpen", { status: 404, code: "provider_rejected" }],
|
|
8787
|
+
["InvalidEndpointOrModel.NotFound", { status: 404, code: "provider_rejected" }]
|
|
8788
|
+
]);
|
|
8789
|
+
var ArkErrorBodySchema = z7.object({ error: z7.object({ code: z7.string() }) });
|
|
8790
|
+
function arkErrorCode(body) {
|
|
8791
|
+
const text2 = z7.string().safeParse(body);
|
|
8792
|
+
let decoded = body;
|
|
8793
|
+
if (text2.success) {
|
|
8794
|
+
try {
|
|
8795
|
+
decoded = JsonValueSchema.parse(JSON.parse(text2.data));
|
|
8796
|
+
} catch {
|
|
8797
|
+
return void 0;
|
|
8798
|
+
}
|
|
8799
|
+
}
|
|
8800
|
+
const parsed = ArkErrorBodySchema.safeParse(decoded);
|
|
8801
|
+
return parsed.success ? parsed.data.error.code : void 0;
|
|
8802
|
+
}
|
|
8803
|
+
function arkCodeRule(status, code) {
|
|
8804
|
+
const rule = code === void 0 ? void 0 : ARK_CODES.get(code);
|
|
8805
|
+
if (!rule || status !== void 0 && status !== rule.status) return void 0;
|
|
8806
|
+
return rule;
|
|
8807
|
+
}
|
|
8808
|
+
function throwArkError(status, body, model, code = arkErrorCode(body)) {
|
|
8785
8809
|
const parsed = z7.string().safeParse(body);
|
|
8786
8810
|
const text2 = parsed.success ? parsed.data : JSON.stringify(body ?? "");
|
|
8787
|
-
if (/sensitive.?content|human.?face/i.test(text2)) {
|
|
8811
|
+
if (/sensitive.?content|human.?face/i.test(`${code ?? ""} ${text2}`)) {
|
|
8788
8812
|
const init = {
|
|
8789
8813
|
code: "content_blocked",
|
|
8790
8814
|
message: `ark rejected the request: ${text2.slice(0, 500)}`,
|
|
@@ -8796,15 +8820,18 @@ function throwArkError(status, body, model) {
|
|
|
8796
8820
|
if (status !== void 0) init.status = status;
|
|
8797
8821
|
throw new ModelKitError(init);
|
|
8798
8822
|
}
|
|
8799
|
-
|
|
8800
|
-
|
|
8801
|
-
|
|
8802
|
-
|
|
8823
|
+
const rule = arkCodeRule(status, code);
|
|
8824
|
+
if (rule || status === void 0) {
|
|
8825
|
+
const init = {
|
|
8826
|
+
code: rule?.code ?? "provider_rejected",
|
|
8827
|
+
message: `ark rejected the request${code ? ` (${code})` : ""}: ${text2.slice(0, 500)}`,
|
|
8803
8828
|
provider: "ark",
|
|
8804
8829
|
model,
|
|
8805
8830
|
body,
|
|
8806
8831
|
retryable: false
|
|
8807
|
-
}
|
|
8832
|
+
};
|
|
8833
|
+
if (status !== void 0) init.status = status;
|
|
8834
|
+
throw new ModelKitError(init);
|
|
8808
8835
|
}
|
|
8809
8836
|
throw classifyHttpError(status, body, "ark", model);
|
|
8810
8837
|
}
|
|
@@ -8920,9 +8947,15 @@ var SeedanceResponseSchema = z7.object({
|
|
|
8920
8947
|
duration: z7.number().optional(),
|
|
8921
8948
|
framespersecond: z7.number().optional(),
|
|
8922
8949
|
resolution: z7.string().optional(),
|
|
8923
|
-
error: z7.union([
|
|
8950
|
+
error: z7.union([
|
|
8951
|
+
z7.string(),
|
|
8952
|
+
z7.object({ code: z7.string().optional(), message: z7.string().optional() })
|
|
8953
|
+
]).optional()
|
|
8954
|
+
});
|
|
8955
|
+
var SeedanceErrorSchema = z7.object({
|
|
8956
|
+
code: z7.string().optional(),
|
|
8957
|
+
message: z7.string().optional()
|
|
8924
8958
|
});
|
|
8925
|
-
var SeedanceErrorMessageSchema = z7.object({ message: z7.string().optional() });
|
|
8926
8959
|
function seedanceResolution(req) {
|
|
8927
8960
|
return req.resolution ?? "720p";
|
|
8928
8961
|
}
|
|
@@ -8943,10 +8976,14 @@ function seedanceInitialDuration(req) {
|
|
|
8943
8976
|
function seedanceErrorMessage(error, status) {
|
|
8944
8977
|
const asString = z7.string().safeParse(error);
|
|
8945
8978
|
if (asString.success) return asString.data;
|
|
8946
|
-
const asObject =
|
|
8979
|
+
const asObject = SeedanceErrorSchema.safeParse(error);
|
|
8947
8980
|
if (asObject.success && asObject.data.message !== void 0) return asObject.data.message;
|
|
8948
8981
|
return `Seedance task ${status}`;
|
|
8949
8982
|
}
|
|
8983
|
+
function seedanceErrorCode(error) {
|
|
8984
|
+
const parsed = SeedanceErrorSchema.safeParse(error);
|
|
8985
|
+
return parsed.success ? parsed.data.code : void 0;
|
|
8986
|
+
}
|
|
8950
8987
|
function seedanceJob(ctx, key, jobId, usage5) {
|
|
8951
8988
|
const modelId = ctx.model.id;
|
|
8952
8989
|
const fetchStatus = async () => {
|
|
@@ -8954,9 +8991,9 @@ function seedanceJob(ctx, key, jobId, usage5) {
|
|
|
8954
8991
|
headers: { Authorization: `Bearer ${key}` }
|
|
8955
8992
|
});
|
|
8956
8993
|
if (!res.ok) {
|
|
8957
|
-
if (ctx.call.maxRetries !== 0 && (res.status === 429 || res.status >= 500))
|
|
8958
|
-
return void 0;
|
|
8959
8994
|
const text2 = await res.text().catch(() => "");
|
|
8995
|
+
const transient = (res.status === 429 || res.status >= 500) && !arkCodeRule(res.status, arkErrorCode(text2));
|
|
8996
|
+
if (ctx.call.maxRetries !== 0 && transient) return void 0;
|
|
8960
8997
|
throwArkError(res.status, text2, modelId);
|
|
8961
8998
|
}
|
|
8962
8999
|
const parsed = SeedanceResponseSchema.safeParse(await res.json());
|
|
@@ -9016,7 +9053,12 @@ function seedanceJob(ctx, key, jobId, usage5) {
|
|
|
9016
9053
|
};
|
|
9017
9054
|
}
|
|
9018
9055
|
if (status === "failed" || status === "expired" || status === "cancelled") {
|
|
9019
|
-
throwArkError(
|
|
9056
|
+
throwArkError(
|
|
9057
|
+
void 0,
|
|
9058
|
+
seedanceErrorMessage(polled.error, status),
|
|
9059
|
+
modelId,
|
|
9060
|
+
seedanceErrorCode(polled.error)
|
|
9061
|
+
);
|
|
9020
9062
|
}
|
|
9021
9063
|
return void 0;
|
|
9022
9064
|
}, pollOpts);
|
|
@@ -10799,8 +10841,8 @@ function falMediaError(row2, message, code) {
|
|
|
10799
10841
|
retryable: false
|
|
10800
10842
|
});
|
|
10801
10843
|
}
|
|
10802
|
-
function refuseMedia(row2,
|
|
10803
|
-
const extra = Object.entries(
|
|
10844
|
+
function refuseMedia(row2, present3) {
|
|
10845
|
+
const extra = Object.entries(present3).find(([, set]) => set);
|
|
10804
10846
|
if (extra) throw falMediaError(row2, `does not take ${extra[0]}`, "unsupported_option");
|
|
10805
10847
|
}
|
|
10806
10848
|
function setIf(input, key, value) {
|
|
@@ -17953,16 +17995,16 @@ function resolveVideoOptions(model, request, onUnsupported = "error") {
|
|
|
17953
17995
|
}
|
|
17954
17996
|
function checkVideoRequired(model, req) {
|
|
17955
17997
|
const c = model.constraints;
|
|
17956
|
-
const
|
|
17998
|
+
const present3 = (input) => input === "references" ? compact(req.referenceImages).length + compact(req.referenceVideos).length + compact(req.referenceAudios).length > 0 : input !== "sourceAudio" && req[input] !== void 0;
|
|
17957
17999
|
for (const input of c.requires ?? []) {
|
|
17958
|
-
if (!
|
|
18000
|
+
if (!present3(input))
|
|
17959
18001
|
throw new ModelKitError({
|
|
17960
18002
|
code: "missing_input",
|
|
17961
18003
|
message: `${model.id} requires ${input}`,
|
|
17962
18004
|
model: model.id
|
|
17963
18005
|
});
|
|
17964
18006
|
}
|
|
17965
|
-
if (c.requiresOneOf && !c.requiresOneOf.some(
|
|
18007
|
+
if (c.requiresOneOf && !c.requiresOneOf.some(present3)) {
|
|
17966
18008
|
throw new ModelKitError({
|
|
17967
18009
|
code: "missing_input",
|
|
17968
18010
|
message: `${model.id} requires one of: ${c.requiresOneOf.join(", ")}`,
|
|
@@ -18010,8 +18052,8 @@ function resolveAudioOptions(model, request, onUnsupported = "error") {
|
|
|
18010
18052
|
if (references.length > 0) merged.references = references;
|
|
18011
18053
|
else delete merged.references;
|
|
18012
18054
|
for (const input of c.requires ?? []) {
|
|
18013
|
-
const
|
|
18014
|
-
if (!
|
|
18055
|
+
const present3 = input === "references" ? references.length > 0 : input === "sourceVideo" && merged.sourceVideo !== void 0;
|
|
18056
|
+
if (!present3)
|
|
18015
18057
|
throw new ModelKitError({
|
|
18016
18058
|
code: "missing_input",
|
|
18017
18059
|
message: `${model.id} requires ${input}`,
|
|
@@ -18065,12 +18107,12 @@ function unsupported3(model, message) {
|
|
|
18065
18107
|
model: model.id
|
|
18066
18108
|
});
|
|
18067
18109
|
}
|
|
18068
|
-
function checkRequired(model,
|
|
18110
|
+
function checkRequired(model, present3) {
|
|
18069
18111
|
for (const input of model.constraints.requires ?? []) {
|
|
18070
|
-
if (
|
|
18112
|
+
if (present3[input] !== true) throw missing2(model, input);
|
|
18071
18113
|
}
|
|
18072
18114
|
const oneOf = model.constraints.requiresOneOf;
|
|
18073
|
-
if (oneOf !== void 0 && !oneOf.some((input) =>
|
|
18115
|
+
if (oneOf !== void 0 && !oneOf.some((input) => present3[input] === true)) {
|
|
18074
18116
|
throw missing2(model, `one of ${oneOf.join(", ")}`);
|
|
18075
18117
|
}
|
|
18076
18118
|
}
|
|
@@ -18402,6 +18444,39 @@ function resolveKeys(config, names, tier = "pro") {
|
|
|
18402
18444
|
}
|
|
18403
18445
|
return config.keys.pro;
|
|
18404
18446
|
}
|
|
18447
|
+
function present2(value) {
|
|
18448
|
+
return value !== void 0 && value.trim() !== "";
|
|
18449
|
+
}
|
|
18450
|
+
function overrideHolds(override, name) {
|
|
18451
|
+
if (!override || name === "aws" || !present2(override[name])) return false;
|
|
18452
|
+
return name !== "higgsfield" || present2(override.higgsfieldSecret);
|
|
18453
|
+
}
|
|
18454
|
+
function overrideCovers(override, names) {
|
|
18455
|
+
return names.filter((name) => overrideHolds(override, name));
|
|
18456
|
+
}
|
|
18457
|
+
function resolveCallKeys(config, names, tier = "pro", override) {
|
|
18458
|
+
const covered = overrideCovers(override, names);
|
|
18459
|
+
const tierNames = names.filter((name) => !covered.includes(name));
|
|
18460
|
+
const base = resolveKeys(config, tierNames, tier);
|
|
18461
|
+
if (!override || covered.length === 0)
|
|
18462
|
+
return { keys: base, source: tierSource(config, tierNames, tier), tierNames };
|
|
18463
|
+
const keys = { ...base };
|
|
18464
|
+
for (const name of covered) {
|
|
18465
|
+
const value = name === "aws" ? void 0 : override[name];
|
|
18466
|
+
if (name === "aws" || !present2(value)) continue;
|
|
18467
|
+
keys[name] = value;
|
|
18468
|
+
if (name === "higgsfield" && present2(override.higgsfieldSecret))
|
|
18469
|
+
keys.higgsfieldSecret = override.higgsfieldSecret;
|
|
18470
|
+
}
|
|
18471
|
+
return { keys, source: "byok", tierNames };
|
|
18472
|
+
}
|
|
18473
|
+
function keySourceField(source2) {
|
|
18474
|
+
return source2 === void 0 ? {} : { keySource: source2 };
|
|
18475
|
+
}
|
|
18476
|
+
function tierSource(config, names, tier) {
|
|
18477
|
+
if (tier === "enterprise") return hasAll(config.keys.enterprise, names) ? "enterprise" : "pro";
|
|
18478
|
+
return tier;
|
|
18479
|
+
}
|
|
18405
18480
|
function keysFromEnv(env, prefix = "") {
|
|
18406
18481
|
const pick2 = (...names) => names.map((n) => env[`${prefix}${n}`]).find((v) => v && v.length > 0);
|
|
18407
18482
|
const keys = {};
|
|
@@ -18426,10 +18501,10 @@ function keysFromEnv(env, prefix = "") {
|
|
|
18426
18501
|
set("fish", pick2("FISH_AUDIO_API_KEY"));
|
|
18427
18502
|
set("elevenlabs", pick2("ELEVENLABS_API_KEY"));
|
|
18428
18503
|
set("cloudflare", pick2("CF_AIG_TOKEN"));
|
|
18429
|
-
const
|
|
18504
|
+
const bearer2 = pick2("AWS_BEARER_TOKEN_BEDROCK");
|
|
18430
18505
|
const accessKeyId = pick2("AWS_ACCESS_KEY_ID");
|
|
18431
18506
|
const secretAccessKey = pick2("AWS_SECRET_ACCESS_KEY");
|
|
18432
|
-
if (
|
|
18507
|
+
if (bearer2 || accessKeyId && secretAccessKey) {
|
|
18433
18508
|
const aws = {
|
|
18434
18509
|
region: env[`${prefix}BEDROCK_REGION`] || "us-east-1"
|
|
18435
18510
|
};
|
|
@@ -18439,12 +18514,101 @@ function keysFromEnv(env, prefix = "") {
|
|
|
18439
18514
|
}
|
|
18440
18515
|
const sessionToken = pick2("AWS_SESSION_TOKEN");
|
|
18441
18516
|
if (sessionToken) aws.sessionToken = sessionToken;
|
|
18442
|
-
if (
|
|
18517
|
+
if (bearer2) aws.apiKey = bearer2;
|
|
18443
18518
|
keys.aws = aws;
|
|
18444
18519
|
}
|
|
18445
18520
|
return keys;
|
|
18446
18521
|
}
|
|
18447
18522
|
|
|
18523
|
+
// src/byok.ts
|
|
18524
|
+
var API_KEY = { id: "apiKey", label: "API key", required: true, secret: true };
|
|
18525
|
+
var BYOK_PROVIDERS = {
|
|
18526
|
+
ark: {
|
|
18527
|
+
id: "ark",
|
|
18528
|
+
label: "BytePlus ModelArk",
|
|
18529
|
+
keyName: "ark",
|
|
18530
|
+
fields: [
|
|
18531
|
+
API_KEY,
|
|
18532
|
+
{ id: "accessKeyId", label: "Access key ID", required: false, secret: true },
|
|
18533
|
+
{ id: "secretAccessKey", label: "Secret access key", required: false, secret: true },
|
|
18534
|
+
{ id: "assetGroupId", label: "Asset group ID", required: false, secret: false }
|
|
18535
|
+
]
|
|
18536
|
+
},
|
|
18537
|
+
fal: { id: "fal", label: "fal", keyName: "fal", fields: [API_KEY] },
|
|
18538
|
+
replicate: { id: "replicate", label: "Replicate", keyName: "replicate", fields: [API_KEY] },
|
|
18539
|
+
openai: { id: "openai", label: "OpenAI", keyName: "openai", fields: [API_KEY] },
|
|
18540
|
+
google: { id: "google", label: "Google AI Studio", keyName: "google", fields: [API_KEY] }
|
|
18541
|
+
};
|
|
18542
|
+
var BY_KEY_NAME = new Map(
|
|
18543
|
+
Object.values(BYOK_PROVIDERS).map((provider) => [provider.keyName, provider.id])
|
|
18544
|
+
);
|
|
18545
|
+
function byokProviderForModel(model) {
|
|
18546
|
+
const names = model.adapter === "ai-sdk-text" ? [textKeyName(model)] : ADAPTER_KEYS[model.adapter];
|
|
18547
|
+
const [name, ...rest] = names;
|
|
18548
|
+
if (name === void 0 || rest.length > 0) return null;
|
|
18549
|
+
return BY_KEY_NAME.get(name) ?? null;
|
|
18550
|
+
}
|
|
18551
|
+
function modelsPoweredBy(provider, catalog) {
|
|
18552
|
+
return [...catalog].filter((model) => byokProviderForModel(model) === provider);
|
|
18553
|
+
}
|
|
18554
|
+
function keyOverrideFor(secrets) {
|
|
18555
|
+
const override = {};
|
|
18556
|
+
for (const provider of Object.values(BYOK_PROVIDERS)) {
|
|
18557
|
+
const apiKey = secrets[provider.id]?.apiKey?.trim();
|
|
18558
|
+
if (apiKey) override[provider.keyName] = apiKey;
|
|
18559
|
+
}
|
|
18560
|
+
return override;
|
|
18561
|
+
}
|
|
18562
|
+
var bearer = (apiKey) => ({ Authorization: `Bearer ${apiKey}` });
|
|
18563
|
+
var PROBES = {
|
|
18564
|
+
ark: {
|
|
18565
|
+
url: (endpoints) => `${endpoints.ark ?? ARK_BASE_URL}/contents/generations/tasks?page_num=1&page_size=1`,
|
|
18566
|
+
headers: bearer
|
|
18567
|
+
},
|
|
18568
|
+
fal: {
|
|
18569
|
+
url: () => "https://api.fal.ai/v1/assets/collections?limit=1",
|
|
18570
|
+
headers: (apiKey) => ({ Authorization: `Key ${apiKey}` }),
|
|
18571
|
+
unverifiableStatus: 403
|
|
18572
|
+
},
|
|
18573
|
+
replicate: {
|
|
18574
|
+
url: () => "https://api.replicate.com/v1/account",
|
|
18575
|
+
headers: bearer
|
|
18576
|
+
},
|
|
18577
|
+
openai: {
|
|
18578
|
+
url: () => "https://api.openai.com/v1/models",
|
|
18579
|
+
headers: bearer,
|
|
18580
|
+
unverifiableStatus: 403
|
|
18581
|
+
},
|
|
18582
|
+
google: {
|
|
18583
|
+
url: () => "https://generativelanguage.googleapis.com/v1beta/models?pageSize=1",
|
|
18584
|
+
headers: (apiKey) => ({ "x-goog-api-key": apiKey }),
|
|
18585
|
+
unverifiableStatus: 403
|
|
18586
|
+
}
|
|
18587
|
+
};
|
|
18588
|
+
async function testProviderKey(provider, secret, opts = {}) {
|
|
18589
|
+
const apiKey = secret.apiKey?.trim();
|
|
18590
|
+
if (!apiKey) return { ok: false, reason: "invalid" };
|
|
18591
|
+
const probe = PROBES[provider];
|
|
18592
|
+
const fetchImpl = opts.fetch ?? globalThis.fetch;
|
|
18593
|
+
let res;
|
|
18594
|
+
try {
|
|
18595
|
+
res = await fetchImpl(probe.url(opts.endpoints ?? {}), {
|
|
18596
|
+
method: "GET",
|
|
18597
|
+
headers: probe.headers(apiKey),
|
|
18598
|
+
...opts.signal !== void 0 && { signal: opts.signal }
|
|
18599
|
+
});
|
|
18600
|
+
} catch (cause) {
|
|
18601
|
+
if (opts.signal?.aborted) throw cause;
|
|
18602
|
+
return { ok: false, reason: "unreachable" };
|
|
18603
|
+
}
|
|
18604
|
+
await res.body?.cancel().catch(() => void 0);
|
|
18605
|
+
if (res.ok) return { ok: true, credit: "unknown" };
|
|
18606
|
+
if (res.status === probe.unverifiableStatus) return { ok: false, reason: "unverifiable" };
|
|
18607
|
+
if (res.status === 400 || res.status === 401) return { ok: false, reason: "invalid" };
|
|
18608
|
+
if (res.status === 402 || res.status === 403) return { ok: false, reason: "denied" };
|
|
18609
|
+
return { ok: false, reason: "unreachable" };
|
|
18610
|
+
}
|
|
18611
|
+
|
|
18448
18612
|
// src/text.ts
|
|
18449
18613
|
import "ai";
|
|
18450
18614
|
import { z as z33 } from "zod";
|
|
@@ -18535,12 +18699,10 @@ function createTextSteps(initial, resolve, callerProviderOptions) {
|
|
|
18535
18699
|
const grouped = /* @__PURE__ */ new Map();
|
|
18536
18700
|
for (const [index, step] of results.entries()) {
|
|
18537
18701
|
const target = steps.get(index) ?? initial;
|
|
18538
|
-
const event =
|
|
18539
|
-
target.entry,
|
|
18540
|
-
target.
|
|
18541
|
-
|
|
18542
|
-
step.providerMetadata
|
|
18543
|
-
);
|
|
18702
|
+
const event = {
|
|
18703
|
+
...textUsageEvent(target.entry, target.provider, step.usage, step.providerMetadata),
|
|
18704
|
+
...keySourceField(target.keySource)
|
|
18705
|
+
};
|
|
18544
18706
|
const previous = grouped.get(target.entry.id);
|
|
18545
18707
|
if (previous) {
|
|
18546
18708
|
previous.quantity += event.quantity;
|
|
@@ -18598,8 +18760,9 @@ function preferredAnthropicTransport(model, routing) {
|
|
|
18598
18760
|
if (isAnthropicTransport(row2)) return row2;
|
|
18599
18761
|
return routing.anthropic ?? "direct";
|
|
18600
18762
|
}
|
|
18601
|
-
function resolveAnthropicTransport(model, config, tier, warn) {
|
|
18763
|
+
function resolveAnthropicTransport(model, config, tier, warn, keyOverride) {
|
|
18602
18764
|
if (model.adapter !== "ai-sdk-text" || textProviderOf(model) !== "anthropic") return void 0;
|
|
18765
|
+
if (overrideCovers(keyOverride, ["anthropic"]).length > 0) return "direct";
|
|
18603
18766
|
const rowValue = model.providerOptions?.["modelkit"]?.["transport"];
|
|
18604
18767
|
if (rowValue !== void 0 && !isAnthropicTransport(rowValue))
|
|
18605
18768
|
warn(
|
|
@@ -18688,8 +18851,7 @@ function providerJobMethods(kind, deps) {
|
|
|
18688
18851
|
const { methods, adapter, ctx } = target(sub.model, rest);
|
|
18689
18852
|
if (!methods.result) throw missing3(adapter, ctx.model);
|
|
18690
18853
|
const result = await methods.result(sub, ctx, webhook);
|
|
18691
|
-
const
|
|
18692
|
-
const usage5 = sub.submittedAt === void 0 ? base : deps.timed(base, sub.submittedAt);
|
|
18854
|
+
const usage5 = deps.rowUsage(ctx, result.usage, sub.submittedAt);
|
|
18693
18855
|
await deps.emit(usage5);
|
|
18694
18856
|
return { ...result, usage: usage5 };
|
|
18695
18857
|
},
|
|
@@ -18817,7 +18979,7 @@ function audioNodeMethods(deps) {
|
|
|
18817
18979
|
if (!adapter.generateSpeech) throw noMethod(adapter, model, "generate speech");
|
|
18818
18980
|
const startedAt = Date.now();
|
|
18819
18981
|
const result = await adapter.generateSpeech(resolved, ctx);
|
|
18820
|
-
return { ...result, usage: await deps.settle(
|
|
18982
|
+
return { ...result, usage: await deps.settle(ctx, result.usage, startedAt) };
|
|
18821
18983
|
},
|
|
18822
18984
|
async changeVoice(req, call = {}) {
|
|
18823
18985
|
mediaRetryOptions(call);
|
|
@@ -18832,7 +18994,7 @@ function audioNodeMethods(deps) {
|
|
|
18832
18994
|
if (!adapter.changeVoice) throw noMethod(adapter, model, "change a voice");
|
|
18833
18995
|
const startedAt = Date.now();
|
|
18834
18996
|
const result = await adapter.changeVoice(resolved, ctx);
|
|
18835
|
-
return { ...result, usage: await deps.settle(
|
|
18997
|
+
return { ...result, usage: await deps.settle(ctx, result.usage, startedAt) };
|
|
18836
18998
|
},
|
|
18837
18999
|
async lipsync(req, call = {}) {
|
|
18838
19000
|
mediaRetryOptions(call);
|
|
@@ -18847,7 +19009,7 @@ function audioNodeMethods(deps) {
|
|
|
18847
19009
|
if (!adapter.lipsync) throw noMethod(adapter, model, "lipsync");
|
|
18848
19010
|
const startedAt = Date.now();
|
|
18849
19011
|
const job = deps.wrapVideoJob(
|
|
18850
|
-
|
|
19012
|
+
ctx,
|
|
18851
19013
|
await adapter.lipsync(resolved, ctx),
|
|
18852
19014
|
warnings,
|
|
18853
19015
|
startedAt
|
|
@@ -18872,7 +19034,7 @@ function audioNodeMethods(deps) {
|
|
|
18872
19034
|
if (!adapter.transcribe) throw noMethod(adapter, model, "transcribe");
|
|
18873
19035
|
const startedAt = Date.now();
|
|
18874
19036
|
const result = await adapter.transcribe(resolved, ctx);
|
|
18875
|
-
return { ...result, usage: await deps.settle(
|
|
19037
|
+
return { ...result, usage: await deps.settle(ctx, result.usage, startedAt) };
|
|
18876
19038
|
},
|
|
18877
19039
|
async createVoice(req, call = {}) {
|
|
18878
19040
|
mediaRetryOptions(call);
|
|
@@ -18883,7 +19045,7 @@ function audioNodeMethods(deps) {
|
|
|
18883
19045
|
if (!adapter.createVoice) throw noMethod(adapter, model, "clone a voice");
|
|
18884
19046
|
const startedAt = Date.now();
|
|
18885
19047
|
const result = await adapter.createVoice(resolved, ctx);
|
|
18886
|
-
return { ...result, usage: await deps.settle(
|
|
19048
|
+
return { ...result, usage: await deps.settle(ctx, result.usage, startedAt) };
|
|
18887
19049
|
},
|
|
18888
19050
|
async designVoice(req, call = {}) {
|
|
18889
19051
|
mediaRetryOptions(call);
|
|
@@ -18898,7 +19060,7 @@ function audioNodeMethods(deps) {
|
|
|
18898
19060
|
if (!adapter.designVoice) throw noMethod(adapter, model, "design a voice");
|
|
18899
19061
|
const startedAt = Date.now();
|
|
18900
19062
|
const result = await adapter.designVoice(resolved, ctx);
|
|
18901
|
-
return { ...result, usage: await deps.settle(
|
|
19063
|
+
return { ...result, usage: await deps.settle(ctx, result.usage, startedAt) };
|
|
18902
19064
|
},
|
|
18903
19065
|
async deleteVoice(req, call = {}) {
|
|
18904
19066
|
mediaRetryOptions(call);
|
|
@@ -18934,11 +19096,11 @@ function audioNodeMethods(deps) {
|
|
|
18934
19096
|
const { audio, usage: usage5, raw } = outcome.result;
|
|
18935
19097
|
return {
|
|
18936
19098
|
audio,
|
|
18937
|
-
usage: await deps.settle(
|
|
19099
|
+
usage: await deps.settle(ctx, usage5, startedAt),
|
|
18938
19100
|
...raw !== void 0 && { raw }
|
|
18939
19101
|
};
|
|
18940
19102
|
}
|
|
18941
|
-
const job = deps.wrapVideoJob(
|
|
19103
|
+
const job = deps.wrapVideoJob(ctx, outcome.job, warnings, startedAt);
|
|
18942
19104
|
const out = await job.result(waitOptions(call, ctx.signal));
|
|
18943
19105
|
return {
|
|
18944
19106
|
video: out.video,
|
|
@@ -18950,14 +19112,28 @@ function audioNodeMethods(deps) {
|
|
|
18950
19112
|
}
|
|
18951
19113
|
|
|
18952
19114
|
// src/client.ts
|
|
18953
|
-
function
|
|
18954
|
-
const routing = config.routing ?? {};
|
|
18955
|
-
if (tier !== "sloosh") return routing;
|
|
19115
|
+
function directRouting(routing) {
|
|
18956
19116
|
const direct = { ...routing };
|
|
18957
19117
|
if (direct.text === "cloudflare") direct.text = "direct";
|
|
18958
19118
|
if (direct.fal === "cloudflare-passthrough") direct.fal = "direct";
|
|
18959
19119
|
return direct;
|
|
18960
19120
|
}
|
|
19121
|
+
function routingFor(config, model, call, transport) {
|
|
19122
|
+
const routing = config.routing ?? {};
|
|
19123
|
+
const direct = directRouting(routing);
|
|
19124
|
+
if (call.tier === "sloosh") return direct;
|
|
19125
|
+
const byok = overrideCovers(call.keyOverride, requiredKeys(model, direct, transport));
|
|
19126
|
+
return byok.length > 0 ? direct : routing;
|
|
19127
|
+
}
|
|
19128
|
+
function byokKeyMissing(provider, model) {
|
|
19129
|
+
return new ModelKitError({
|
|
19130
|
+
code: "byok_key_missing",
|
|
19131
|
+
message: `${model} needs the customer's ${provider} key and the call has none`,
|
|
19132
|
+
provider,
|
|
19133
|
+
model,
|
|
19134
|
+
retryable: false
|
|
19135
|
+
});
|
|
19136
|
+
}
|
|
18961
19137
|
function requiredKeys(model, routing, transport) {
|
|
18962
19138
|
if (model.adapter === "fal" && routing.fal === "cloudflare-passthrough") return ["cloudflare"];
|
|
18963
19139
|
if (model.adapter === "ai-sdk-text") {
|
|
@@ -19059,21 +19235,35 @@ function createModelKit(config, adapters) {
|
|
|
19059
19235
|
message: `No adapter registered for ${model.adapter}`,
|
|
19060
19236
|
model: model.id
|
|
19061
19237
|
});
|
|
19062
|
-
const transport = resolveAnthropicTransport(
|
|
19063
|
-
|
|
19238
|
+
const transport = resolveAnthropicTransport(
|
|
19239
|
+
model,
|
|
19240
|
+
config,
|
|
19241
|
+
call.tier,
|
|
19242
|
+
warnOnce,
|
|
19243
|
+
call.keyOverride
|
|
19244
|
+
);
|
|
19245
|
+
const routing = routingFor(config, model, call, transport);
|
|
19064
19246
|
const names = requiredKeys(model, routing, transport);
|
|
19247
|
+
if (call.requireOverride && overrideCovers(call.keyOverride, names).length === 0)
|
|
19248
|
+
throw byokKeyMissing(names[0] ?? model.adapter, model.id);
|
|
19249
|
+
const { keys, source: source2, tierNames } = resolveCallKeys(
|
|
19250
|
+
config,
|
|
19251
|
+
names,
|
|
19252
|
+
call.tier,
|
|
19253
|
+
call.keyOverride
|
|
19254
|
+
);
|
|
19065
19255
|
if (call.tier === "enterprise") {
|
|
19066
|
-
const missing3 = missingEnterpriseKeys(config,
|
|
19256
|
+
const missing3 = missingEnterpriseKeys(config, tierNames);
|
|
19067
19257
|
if (missing3.length > 0)
|
|
19068
19258
|
logger.warn(
|
|
19069
19259
|
`[modelkit] enterprise keys incomplete for ${model.adapter}; using pro`,
|
|
19070
19260
|
{ missing: missing3 }
|
|
19071
19261
|
);
|
|
19072
19262
|
}
|
|
19073
|
-
const keys = resolveKeys(config, names, call.tier);
|
|
19074
19263
|
const ctx = {
|
|
19075
19264
|
model,
|
|
19076
19265
|
keys,
|
|
19266
|
+
keySource: source2,
|
|
19077
19267
|
routing,
|
|
19078
19268
|
fetch: fetchImpl,
|
|
19079
19269
|
logger,
|
|
@@ -19088,7 +19278,7 @@ function createModelKit(config, adapters) {
|
|
|
19088
19278
|
const jobDeps = {
|
|
19089
19279
|
catalog,
|
|
19090
19280
|
context: (model, call) => context(model, call, []),
|
|
19091
|
-
|
|
19281
|
+
rowUsage,
|
|
19092
19282
|
emit
|
|
19093
19283
|
};
|
|
19094
19284
|
const videoToolJobs = providerJobMethods(VIDEO_TOOL_JOB, jobDeps);
|
|
@@ -19097,6 +19287,15 @@ function createModelKit(config, adapters) {
|
|
|
19097
19287
|
if (event.latencyMs !== void 0) return event;
|
|
19098
19288
|
return { ...event, latencyMs: Math.max(0, Date.now() - startedAt) };
|
|
19099
19289
|
}
|
|
19290
|
+
function rowUsage(ctx, event, startedAt) {
|
|
19291
|
+
const stamped = {
|
|
19292
|
+
...event,
|
|
19293
|
+
model: ctx.model.id,
|
|
19294
|
+
unit: ctx.model.usage.unit,
|
|
19295
|
+
...keySourceField(ctx.keySource)
|
|
19296
|
+
};
|
|
19297
|
+
return startedAt === void 0 ? stamped : timed(stamped, startedAt);
|
|
19298
|
+
}
|
|
19100
19299
|
function textTimed(event, stepCount, startedAt) {
|
|
19101
19300
|
return stepCount === 1 ? timed(event, startedAt) : event;
|
|
19102
19301
|
}
|
|
@@ -19113,6 +19312,7 @@ function createModelKit(config, adapters) {
|
|
|
19113
19312
|
}
|
|
19114
19313
|
function textTarget(model, call) {
|
|
19115
19314
|
if (!isCatalogId(model)) {
|
|
19315
|
+
if (call.requireOverride) throw byokKeyMissing(model.provider, model.modelId);
|
|
19116
19316
|
return {
|
|
19117
19317
|
entry: passthroughTextModel(model),
|
|
19118
19318
|
languageModel: model,
|
|
@@ -19136,7 +19336,8 @@ function createModelKit(config, adapters) {
|
|
|
19136
19336
|
return {
|
|
19137
19337
|
entry,
|
|
19138
19338
|
languageModel: adapter.languageModel(ctx),
|
|
19139
|
-
provider: textUsageProvider(entry, ctx.anthropicTransport)
|
|
19339
|
+
provider: textUsageProvider(entry, ctx.anthropicTransport),
|
|
19340
|
+
...keySourceField(ctx.keySource)
|
|
19140
19341
|
};
|
|
19141
19342
|
}
|
|
19142
19343
|
async function passthroughImage(req, call) {
|
|
@@ -19308,7 +19509,7 @@ function createModelKit(config, adapters) {
|
|
|
19308
19509
|
result: () => done
|
|
19309
19510
|
};
|
|
19310
19511
|
}
|
|
19311
|
-
function wrapVideoJob(
|
|
19512
|
+
function wrapVideoJob(ctx, job, warnings, startedAt) {
|
|
19312
19513
|
const result = job.result.bind(job);
|
|
19313
19514
|
let settled;
|
|
19314
19515
|
return {
|
|
@@ -19318,10 +19519,7 @@ function createModelKit(config, adapters) {
|
|
|
19318
19519
|
if (settled) return settled;
|
|
19319
19520
|
const pending = result(opts).then(
|
|
19320
19521
|
async (out) => {
|
|
19321
|
-
const usage5 =
|
|
19322
|
-
{ ...out.usage, model: model.id, unit: model.usage.unit },
|
|
19323
|
-
startedAt
|
|
19324
|
-
);
|
|
19522
|
+
const usage5 = rowUsage(ctx, out.usage, startedAt);
|
|
19325
19523
|
await emit(usage5);
|
|
19326
19524
|
return { ...out, usage: usage5 };
|
|
19327
19525
|
},
|
|
@@ -19342,8 +19540,8 @@ function createModelKit(config, adapters) {
|
|
|
19342
19540
|
const signal = combineSignals(abortSignal, call.signal);
|
|
19343
19541
|
return context(model, signal ? { ...call, signal } : call, warnings);
|
|
19344
19542
|
},
|
|
19345
|
-
async settle(
|
|
19346
|
-
const usage5 =
|
|
19543
|
+
async settle(ctx, event, startedAt) {
|
|
19544
|
+
const usage5 = rowUsage(ctx, event, startedAt);
|
|
19347
19545
|
await emit(usage5);
|
|
19348
19546
|
return usage5;
|
|
19349
19547
|
},
|
|
@@ -19356,6 +19554,8 @@ function createModelKit(config, adapters) {
|
|
|
19356
19554
|
async generateImage(req, call = {}) {
|
|
19357
19555
|
mediaRetryOptions(call);
|
|
19358
19556
|
if (!isCatalogId(req.model)) {
|
|
19557
|
+
if (call.requireOverride)
|
|
19558
|
+
throw byokKeyMissing(req.model.provider, req.model.modelId);
|
|
19359
19559
|
return passthroughImage({ ...req, model: req.model }, call);
|
|
19360
19560
|
}
|
|
19361
19561
|
const model = catalog.require(req.model);
|
|
@@ -19381,10 +19581,7 @@ function createModelKit(config, adapters) {
|
|
|
19381
19581
|
});
|
|
19382
19582
|
const startedAt = Date.now();
|
|
19383
19583
|
const result = await adapter.generateImage(request, ctx);
|
|
19384
|
-
const usage5 =
|
|
19385
|
-
{ ...result.usage, model: model.id, unit: model.usage.unit },
|
|
19386
|
-
startedAt
|
|
19387
|
-
);
|
|
19584
|
+
const usage5 = rowUsage(ctx, result.usage, startedAt);
|
|
19388
19585
|
await emit(usage5);
|
|
19389
19586
|
const images = result.images.map(toGeneratedImage);
|
|
19390
19587
|
const first = images[0];
|
|
@@ -19399,6 +19596,8 @@ function createModelKit(config, adapters) {
|
|
|
19399
19596
|
async generateVideo(req, call = {}) {
|
|
19400
19597
|
mediaRetryOptions(call);
|
|
19401
19598
|
if (!isCatalogId(req.model)) {
|
|
19599
|
+
if (call.requireOverride)
|
|
19600
|
+
throw byokKeyMissing(req.model.provider, req.model.modelId);
|
|
19402
19601
|
return passthroughVideo({ ...req, model: req.model }, call);
|
|
19403
19602
|
}
|
|
19404
19603
|
const model = catalog.require(req.model);
|
|
@@ -19424,7 +19623,7 @@ function createModelKit(config, adapters) {
|
|
|
19424
19623
|
});
|
|
19425
19624
|
const startedAt = Date.now();
|
|
19426
19625
|
const job = await adapter.generateVideo(request, ctx);
|
|
19427
|
-
return wrapVideoJob(
|
|
19626
|
+
return wrapVideoJob(ctx, job, warnings, startedAt);
|
|
19428
19627
|
},
|
|
19429
19628
|
async resumeVideo(req, jobId, call = {}) {
|
|
19430
19629
|
mediaRetryOptions(call);
|
|
@@ -19469,7 +19668,7 @@ function createModelKit(config, adapters) {
|
|
|
19469
19668
|
});
|
|
19470
19669
|
const startedAt = Date.now();
|
|
19471
19670
|
const job = adapter.resumeVideo(request, jobId, ctx);
|
|
19472
|
-
return wrapVideoJob(
|
|
19671
|
+
return wrapVideoJob(ctx, { ...job, jobId }, warnings, startedAt);
|
|
19473
19672
|
},
|
|
19474
19673
|
async generateAudio(req, call = {}) {
|
|
19475
19674
|
mediaRetryOptions(call);
|
|
@@ -19493,10 +19692,7 @@ function createModelKit(config, adapters) {
|
|
|
19493
19692
|
}
|
|
19494
19693
|
const startedAt = Date.now();
|
|
19495
19694
|
const result = await adapter.generateAudio(resolved, ctx);
|
|
19496
|
-
const usage5 =
|
|
19497
|
-
{ ...result.usage, model: model.id, unit: model.usage.unit },
|
|
19498
|
-
startedAt
|
|
19499
|
-
);
|
|
19695
|
+
const usage5 = rowUsage(ctx, result.usage, startedAt);
|
|
19500
19696
|
await emit(usage5);
|
|
19501
19697
|
return { ...result, usage: usage5 };
|
|
19502
19698
|
},
|
|
@@ -19509,7 +19705,7 @@ function createModelKit(config, adapters) {
|
|
|
19509
19705
|
return "url" in ref ? { type: "file", data: ref.url, mediaType } : { type: "file", data: ref.bytes, mediaType };
|
|
19510
19706
|
},
|
|
19511
19707
|
languageModel(modelId, call = {}) {
|
|
19512
|
-
const { entry, languageModel: model, provider } = textTarget(modelId, call);
|
|
19708
|
+
const { entry, languageModel: model, provider, keySource } = textTarget(modelId, call);
|
|
19513
19709
|
if (model.specificationVersion !== "v3")
|
|
19514
19710
|
throw new ModelKitError({
|
|
19515
19711
|
code: "unsupported_option",
|
|
@@ -19520,7 +19716,8 @@ function createModelKit(config, adapters) {
|
|
|
19520
19716
|
model,
|
|
19521
19717
|
providerOptions: withoutModelkit(entry.providerOptions),
|
|
19522
19718
|
catalog: entry,
|
|
19523
|
-
usageProvider: provider
|
|
19719
|
+
usageProvider: provider,
|
|
19720
|
+
...keySourceField(keySource)
|
|
19524
19721
|
};
|
|
19525
19722
|
},
|
|
19526
19723
|
submitVideoTool: videoToolJobs.submit,
|
|
@@ -19536,7 +19733,7 @@ function createModelKit(config, adapters) {
|
|
|
19536
19733
|
if (entry.type !== "text") return entry.adapter;
|
|
19537
19734
|
return textUsageProvider(
|
|
19538
19735
|
entry,
|
|
19539
|
-
resolveAnthropicTransport(entry, config, call.tier, warnOnce)
|
|
19736
|
+
resolveAnthropicTransport(entry, config, call.tier, warnOnce, call.keyOverride)
|
|
19540
19737
|
);
|
|
19541
19738
|
},
|
|
19542
19739
|
async generateText(options, call = {}) {
|
|
@@ -19585,7 +19782,7 @@ function createModelKit(config, adapters) {
|
|
|
19585
19782
|
});
|
|
19586
19783
|
},
|
|
19587
19784
|
async generateObject(options, call = {}) {
|
|
19588
|
-
const { entry, languageModel: languageModel2, provider } = textTarget(options.model, call);
|
|
19785
|
+
const { entry, languageModel: languageModel2, provider, keySource } = textTarget(options.model, call);
|
|
19589
19786
|
const sdkOptions = {
|
|
19590
19787
|
...options,
|
|
19591
19788
|
...textAbortOptions(options.abortSignal, call.signal),
|
|
@@ -19596,16 +19793,17 @@ function createModelKit(config, adapters) {
|
|
|
19596
19793
|
const result = await aiGenerateObject2(sdkOptions);
|
|
19597
19794
|
await emit(
|
|
19598
19795
|
timed(
|
|
19599
|
-
withRowUnit(
|
|
19600
|
-
textUsageEvent(entry, provider, result.usage, result.providerMetadata)
|
|
19601
|
-
|
|
19796
|
+
withRowUnit({
|
|
19797
|
+
...textUsageEvent(entry, provider, result.usage, result.providerMetadata),
|
|
19798
|
+
...keySourceField(keySource)
|
|
19799
|
+
}),
|
|
19602
19800
|
startedAt
|
|
19603
19801
|
)
|
|
19604
19802
|
);
|
|
19605
19803
|
return result;
|
|
19606
19804
|
},
|
|
19607
19805
|
streamObject(options, call = {}) {
|
|
19608
|
-
const { entry, languageModel: languageModel2, provider } = textTarget(options.model, call);
|
|
19806
|
+
const { entry, languageModel: languageModel2, provider, keySource } = textTarget(options.model, call);
|
|
19609
19807
|
const callerOnFinish = options.onFinish;
|
|
19610
19808
|
const startedAt = Date.now();
|
|
19611
19809
|
const sdkOptions = {
|
|
@@ -19616,14 +19814,15 @@ function createModelKit(config, adapters) {
|
|
|
19616
19814
|
onFinish: async (event) => {
|
|
19617
19815
|
await emit(
|
|
19618
19816
|
timed(
|
|
19619
|
-
withRowUnit(
|
|
19620
|
-
textUsageEvent(
|
|
19817
|
+
withRowUnit({
|
|
19818
|
+
...textUsageEvent(
|
|
19621
19819
|
entry,
|
|
19622
19820
|
provider,
|
|
19623
19821
|
event.usage,
|
|
19624
19822
|
event.providerMetadata
|
|
19625
|
-
)
|
|
19626
|
-
|
|
19823
|
+
),
|
|
19824
|
+
...keySourceField(keySource)
|
|
19825
|
+
}),
|
|
19627
19826
|
startedAt
|
|
19628
19827
|
)
|
|
19629
19828
|
);
|
|
@@ -19666,6 +19865,7 @@ export {
|
|
|
19666
19865
|
ADAPTER_KEYS,
|
|
19667
19866
|
ARRAY_INPUT_SPEC_KEYS,
|
|
19668
19867
|
AUDIO_INPUT_SPEC_KEYS,
|
|
19868
|
+
BYOK_PROVIDERS,
|
|
19669
19869
|
Catalog,
|
|
19670
19870
|
CatalogModelSchema,
|
|
19671
19871
|
CatalogModelSchemaBase,
|
|
@@ -19690,6 +19890,7 @@ export {
|
|
|
19690
19890
|
aiSdkTextAdapter,
|
|
19691
19891
|
arkAdapter,
|
|
19692
19892
|
aspectRatioToSize,
|
|
19893
|
+
byokProviderForModel,
|
|
19693
19894
|
classifyHttpError,
|
|
19694
19895
|
compareCatalogOrder,
|
|
19695
19896
|
createDefaultModelKit,
|
|
@@ -19717,6 +19918,7 @@ export {
|
|
|
19717
19918
|
isListed,
|
|
19718
19919
|
isListedOn,
|
|
19719
19920
|
isModelKitError,
|
|
19921
|
+
keyOverrideFor,
|
|
19720
19922
|
keysFromEnv,
|
|
19721
19923
|
languageModel,
|
|
19722
19924
|
liveCatalog,
|
|
@@ -19733,6 +19935,7 @@ export {
|
|
|
19733
19935
|
model3dSeedFits,
|
|
19734
19936
|
model3dSkus,
|
|
19735
19937
|
model3dTexture,
|
|
19938
|
+
modelsPoweredBy,
|
|
19736
19939
|
nearestAspectRatio,
|
|
19737
19940
|
normalizeExposure,
|
|
19738
19941
|
openaiImageAdapter,
|
|
@@ -19763,6 +19966,7 @@ export {
|
|
|
19763
19966
|
streamObject,
|
|
19764
19967
|
streamText,
|
|
19765
19968
|
takesTargetAspectRatio,
|
|
19969
|
+
testProviderKey,
|
|
19766
19970
|
textUsageEvent,
|
|
19767
19971
|
toGeneratedImage,
|
|
19768
19972
|
validateInputSpec,
|