@broberg/ai-sdk 0.51.0 → 0.53.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
@@ -2,6 +2,23 @@ import { z } from 'zod';
2
2
  export { AvailabilitySource, AvailabilityStatus, ModelStatus, ModelUnavailableError, ResolveOptions, ResolveResult, listModels, resolveModel } from './registry.js';
3
3
  export { DEFAULT_CLIP_SEC, MEDIA_PRICING_CHECKED_AT, MediaPrice, MediaUnit, PRICING_STALE_AFTER_DAYS, PricingFreshness, UnitFreshness, getMediaPrice, listMediaPrices, pricingFreshness, pricingGeneratedAt } from './pricing.js';
4
4
 
5
+ type FailureKind = "auth" | "not_found" | "rate_limit" | "server" | "timeout" | "network" | "other";
6
+ interface CallFailure {
7
+ provider: string;
8
+ /** The model we ASKED for (the route that failed). */
9
+ model: string;
10
+ transport: string;
11
+ capability: Capability;
12
+ tier?: Tier;
13
+ purpose?: string;
14
+ labels?: Record<string, string>;
15
+ latencyMs: number;
16
+ ts: string;
17
+ /** HTTP status as a string ("401", "503"), or "timeout" | "network" | "unknown". */
18
+ errorCode: string;
19
+ errorKind: FailureKind;
20
+ }
21
+
5
22
  /** Coarse data-residency of the endpoint a call went to.
6
23
  *
7
24
  * - `"eu"` — EU/EEA. **The only positive residency claim.** Nothing else is folded
@@ -234,7 +251,12 @@ type ToolCallLike = {
234
251
  * subprocess (Max plan); `subprocess:true` lets dashboards split free vs paid. */
235
252
  interface Usage {
236
253
  provider: string;
254
+ /** The model we ASKED for — the pricing key and the stable grouping. */
237
255
  model: string;
256
+ /** F071.2 — the model that ANSWERED, as the provider reported it. Differs from `model`
257
+ * when an alias like "mistral-large-latest" resolves to a dated model; that is how a
258
+ * silent overnight move becomes visible. Unset when the provider does not say. */
259
+ servedModel?: string;
238
260
  tier?: Tier;
239
261
  /** Data-residency of the endpoint that ACTUALLY answered (F042). Derived from the
240
262
  * host/region the request used, not from the provider's name — vertex, azure and
@@ -286,6 +308,9 @@ interface Usage {
286
308
  * Implementations must never throw into the caller (F3.3). */
287
309
  interface CostSink {
288
310
  record(usage: Usage): void | Promise<void>;
311
+ /** F071.1 — optional: a FAILED call attempt (no cost). Sinks that sum spend (sqlite,
312
+ * budget, your own) may ignore it; leaving it out means they never see failures. */
313
+ recordFailure?(failure: CallFailure): void | Promise<void>;
289
314
  }
290
315
  /** Backing store for a BudgetGuard's rolling total. Default is in-memory
291
316
  * (per createAI instance). A persistent store (e.g. sqliteBudgetStore) makes
@@ -1154,7 +1179,7 @@ declare const chatInputSchema: z.ZodObject<{
1154
1179
  responseFormat: z.ZodOptional<z.ZodEnum<["json", "text"]>>;
1155
1180
  }, "strip", z.ZodTypeAny, {
1156
1181
  system?: string | undefined;
1157
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
1182
+ tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
1158
1183
  prompt?: string | undefined;
1159
1184
  messages?: {
1160
1185
  content: string | ({
@@ -1191,7 +1216,7 @@ declare const chatInputSchema: z.ZodObject<{
1191
1216
  model?: string | undefined;
1192
1217
  transport?: "http" | "subprocess" | undefined;
1193
1218
  } | undefined;
1194
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
1219
+ fallback?: ("vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | {
1195
1220
  provider: string;
1196
1221
  model: string;
1197
1222
  transport: "http" | "subprocess";
@@ -1199,7 +1224,7 @@ declare const chatInputSchema: z.ZodObject<{
1199
1224
  labels?: Record<string, string> | undefined;
1200
1225
  }, {
1201
1226
  system?: string | undefined;
1202
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
1227
+ tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
1203
1228
  prompt?: string | undefined;
1204
1229
  messages?: {
1205
1230
  content: string | ({
@@ -1236,7 +1261,7 @@ declare const chatInputSchema: z.ZodObject<{
1236
1261
  model?: string | undefined;
1237
1262
  transport?: "http" | "subprocess" | undefined;
1238
1263
  } | undefined;
1239
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
1264
+ fallback?: ("vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | {
1240
1265
  provider: string;
1241
1266
  model: string;
1242
1267
  transport: "http" | "subprocess";
@@ -1283,7 +1308,7 @@ declare const visionInputSchema: z.ZodObject<{
1283
1308
  image: string | Uint8Array<ArrayBuffer>;
1284
1309
  prompt: string;
1285
1310
  system?: string | undefined;
1286
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
1311
+ tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
1287
1312
  mimeType?: string | undefined;
1288
1313
  purpose?: string | undefined;
1289
1314
  override?: {
@@ -1291,7 +1316,7 @@ declare const visionInputSchema: z.ZodObject<{
1291
1316
  model?: string | undefined;
1292
1317
  transport?: "http" | "subprocess" | undefined;
1293
1318
  } | undefined;
1294
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
1319
+ fallback?: ("vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | {
1295
1320
  provider: string;
1296
1321
  model: string;
1297
1322
  transport: "http" | "subprocess";
@@ -1301,7 +1326,7 @@ declare const visionInputSchema: z.ZodObject<{
1301
1326
  image: string | Uint8Array<ArrayBuffer>;
1302
1327
  prompt: string;
1303
1328
  system?: string | undefined;
1304
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
1329
+ tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
1305
1330
  mimeType?: string | undefined;
1306
1331
  purpose?: string | undefined;
1307
1332
  override?: {
@@ -1309,7 +1334,7 @@ declare const visionInputSchema: z.ZodObject<{
1309
1334
  model?: string | undefined;
1310
1335
  transport?: "http" | "subprocess" | undefined;
1311
1336
  } | undefined;
1312
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
1337
+ fallback?: ("vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | {
1313
1338
  provider: string;
1314
1339
  model: string;
1315
1340
  transport: "http" | "subprocess";
@@ -1355,7 +1380,7 @@ declare const videoInputSchema: z.ZodObject<{
1355
1380
  video: string | Uint8Array<ArrayBuffer>;
1356
1381
  prompt: string;
1357
1382
  system?: string | undefined;
1358
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
1383
+ tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
1359
1384
  mimeType?: string | undefined;
1360
1385
  purpose?: string | undefined;
1361
1386
  override?: {
@@ -1363,7 +1388,7 @@ declare const videoInputSchema: z.ZodObject<{
1363
1388
  model?: string | undefined;
1364
1389
  transport?: "http" | "subprocess" | undefined;
1365
1390
  } | undefined;
1366
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
1391
+ fallback?: ("vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | {
1367
1392
  provider: string;
1368
1393
  model: string;
1369
1394
  transport: "http" | "subprocess";
@@ -1373,7 +1398,7 @@ declare const videoInputSchema: z.ZodObject<{
1373
1398
  video: string | Uint8Array<ArrayBuffer>;
1374
1399
  prompt: string;
1375
1400
  system?: string | undefined;
1376
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
1401
+ tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
1377
1402
  mimeType?: string | undefined;
1378
1403
  purpose?: string | undefined;
1379
1404
  override?: {
@@ -1381,7 +1406,7 @@ declare const videoInputSchema: z.ZodObject<{
1381
1406
  model?: string | undefined;
1382
1407
  transport?: "http" | "subprocess" | undefined;
1383
1408
  } | undefined;
1384
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
1409
+ fallback?: ("vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | {
1385
1410
  provider: string;
1386
1411
  model: string;
1387
1412
  transport: "http" | "subprocess";
@@ -1424,14 +1449,14 @@ declare const translateInputSchema: z.ZodObject<{
1424
1449
  }, "strip", z.ZodTypeAny, {
1425
1450
  text: string;
1426
1451
  to: string;
1427
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
1452
+ tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
1428
1453
  purpose?: string | undefined;
1429
1454
  override?: {
1430
1455
  provider?: string | undefined;
1431
1456
  model?: string | undefined;
1432
1457
  transport?: "http" | "subprocess" | undefined;
1433
1458
  } | undefined;
1434
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
1459
+ fallback?: ("vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | {
1435
1460
  provider: string;
1436
1461
  model: string;
1437
1462
  transport: "http" | "subprocess";
@@ -1441,14 +1466,14 @@ declare const translateInputSchema: z.ZodObject<{
1441
1466
  }, {
1442
1467
  text: string;
1443
1468
  to: string;
1444
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
1469
+ tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
1445
1470
  purpose?: string | undefined;
1446
1471
  override?: {
1447
1472
  provider?: string | undefined;
1448
1473
  model?: string | undefined;
1449
1474
  transport?: "http" | "subprocess" | undefined;
1450
1475
  } | undefined;
1451
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
1476
+ fallback?: ("vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | {
1452
1477
  provider: string;
1453
1478
  model: string;
1454
1479
  transport: "http" | "subprocess";
@@ -1520,7 +1545,7 @@ declare const imageInputSchema: z.ZodObject<{
1520
1545
  retryOnBlack: z.ZodOptional<z.ZodBoolean>;
1521
1546
  }, "strip", z.ZodTypeAny, {
1522
1547
  prompt: string;
1523
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
1548
+ tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
1524
1549
  seed?: number | undefined;
1525
1550
  purpose?: string | undefined;
1526
1551
  outputFormat?: "jpeg" | "png" | "webp" | undefined;
@@ -1536,7 +1561,7 @@ declare const imageInputSchema: z.ZodObject<{
1536
1561
  model?: string | undefined;
1537
1562
  transport?: "http" | "subprocess" | undefined;
1538
1563
  } | undefined;
1539
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
1564
+ fallback?: ("vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | {
1540
1565
  provider: string;
1541
1566
  model: string;
1542
1567
  transport: "http" | "subprocess";
@@ -1549,7 +1574,7 @@ declare const imageInputSchema: z.ZodObject<{
1549
1574
  retryOnBlack?: boolean | undefined;
1550
1575
  }, {
1551
1576
  prompt: string;
1552
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
1577
+ tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
1553
1578
  seed?: number | undefined;
1554
1579
  purpose?: string | undefined;
1555
1580
  outputFormat?: "jpeg" | "png" | "webp" | undefined;
@@ -1565,7 +1590,7 @@ declare const imageInputSchema: z.ZodObject<{
1565
1590
  model?: string | undefined;
1566
1591
  transport?: "http" | "subprocess" | undefined;
1567
1592
  } | undefined;
1568
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
1593
+ fallback?: ("vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | {
1569
1594
  provider: string;
1570
1595
  model: string;
1571
1596
  transport: "http" | "subprocess";
@@ -1618,7 +1643,7 @@ declare const animateInputSchema: z.ZodObject<{
1618
1643
  resolution: z.ZodOptional<z.ZodString>;
1619
1644
  }, "strip", z.ZodTypeAny, {
1620
1645
  image: string | Uint8Array<ArrayBuffer>;
1621
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
1646
+ tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
1622
1647
  prompt?: string | undefined;
1623
1648
  resolution?: string | undefined;
1624
1649
  purpose?: string | undefined;
@@ -1627,7 +1652,7 @@ declare const animateInputSchema: z.ZodObject<{
1627
1652
  model?: string | undefined;
1628
1653
  transport?: "http" | "subprocess" | undefined;
1629
1654
  } | undefined;
1630
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
1655
+ fallback?: ("vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | {
1631
1656
  provider: string;
1632
1657
  model: string;
1633
1658
  transport: "http" | "subprocess";
@@ -1636,7 +1661,7 @@ declare const animateInputSchema: z.ZodObject<{
1636
1661
  durationSec?: number | undefined;
1637
1662
  }, {
1638
1663
  image: string | Uint8Array<ArrayBuffer>;
1639
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
1664
+ tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
1640
1665
  prompt?: string | undefined;
1641
1666
  resolution?: string | undefined;
1642
1667
  purpose?: string | undefined;
@@ -1645,7 +1670,7 @@ declare const animateInputSchema: z.ZodObject<{
1645
1670
  model?: string | undefined;
1646
1671
  transport?: "http" | "subprocess" | undefined;
1647
1672
  } | undefined;
1648
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
1673
+ fallback?: ("vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | {
1649
1674
  provider: string;
1650
1675
  model: string;
1651
1676
  transport: "http" | "subprocess";
@@ -1692,7 +1717,7 @@ declare const trainStyleInputSchema: z.ZodObject<{
1692
1717
  createMasks: z.ZodOptional<z.ZodBoolean>;
1693
1718
  }, "strip", z.ZodTypeAny, {
1694
1719
  images: string | string[];
1695
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
1720
+ tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
1696
1721
  purpose?: string | undefined;
1697
1722
  steps?: number | undefined;
1698
1723
  override?: {
@@ -1700,7 +1725,7 @@ declare const trainStyleInputSchema: z.ZodObject<{
1700
1725
  model?: string | undefined;
1701
1726
  transport?: "http" | "subprocess" | undefined;
1702
1727
  } | undefined;
1703
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
1728
+ fallback?: ("vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | {
1704
1729
  provider: string;
1705
1730
  model: string;
1706
1731
  transport: "http" | "subprocess";
@@ -1711,7 +1736,7 @@ declare const trainStyleInputSchema: z.ZodObject<{
1711
1736
  createMasks?: boolean | undefined;
1712
1737
  }, {
1713
1738
  images: string | string[];
1714
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
1739
+ tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
1715
1740
  purpose?: string | undefined;
1716
1741
  steps?: number | undefined;
1717
1742
  override?: {
@@ -1719,7 +1744,7 @@ declare const trainStyleInputSchema: z.ZodObject<{
1719
1744
  model?: string | undefined;
1720
1745
  transport?: "http" | "subprocess" | undefined;
1721
1746
  } | undefined;
1722
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
1747
+ fallback?: ("vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | {
1723
1748
  provider: string;
1724
1749
  model: string;
1725
1750
  transport: "http" | "subprocess";
@@ -1762,14 +1787,14 @@ declare const embeddingInputSchema: z.ZodObject<{
1762
1787
  text: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
1763
1788
  }, "strip", z.ZodTypeAny, {
1764
1789
  text: string | string[];
1765
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
1790
+ tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
1766
1791
  purpose?: string | undefined;
1767
1792
  override?: {
1768
1793
  provider?: string | undefined;
1769
1794
  model?: string | undefined;
1770
1795
  transport?: "http" | "subprocess" | undefined;
1771
1796
  } | undefined;
1772
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
1797
+ fallback?: ("vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | {
1773
1798
  provider: string;
1774
1799
  model: string;
1775
1800
  transport: "http" | "subprocess";
@@ -1777,14 +1802,14 @@ declare const embeddingInputSchema: z.ZodObject<{
1777
1802
  labels?: Record<string, string> | undefined;
1778
1803
  }, {
1779
1804
  text: string | string[];
1780
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
1805
+ tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
1781
1806
  purpose?: string | undefined;
1782
1807
  override?: {
1783
1808
  provider?: string | undefined;
1784
1809
  model?: string | undefined;
1785
1810
  transport?: "http" | "subprocess" | undefined;
1786
1811
  } | undefined;
1787
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
1812
+ fallback?: ("vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | {
1788
1813
  provider: string;
1789
1814
  model: string;
1790
1815
  transport: "http" | "subprocess";
@@ -1835,7 +1860,7 @@ declare const transcribeInputSchema: z.ZodObject<{
1835
1860
  timestamps: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["word", "segment"]>, z.ZodArray<z.ZodEnum<["word", "segment"]>, "many">]>>;
1836
1861
  }, "strip", z.ZodTypeAny, {
1837
1862
  audio: string | Uint8Array<ArrayBuffer>;
1838
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
1863
+ tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
1839
1864
  language?: string | undefined;
1840
1865
  purpose?: string | undefined;
1841
1866
  override?: {
@@ -1843,7 +1868,7 @@ declare const transcribeInputSchema: z.ZodObject<{
1843
1868
  model?: string | undefined;
1844
1869
  transport?: "http" | "subprocess" | undefined;
1845
1870
  } | undefined;
1846
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
1871
+ fallback?: ("vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | {
1847
1872
  provider: string;
1848
1873
  model: string;
1849
1874
  transport: "http" | "subprocess";
@@ -1854,7 +1879,7 @@ declare const transcribeInputSchema: z.ZodObject<{
1854
1879
  timestamps?: "word" | "segment" | ("word" | "segment")[] | undefined;
1855
1880
  }, {
1856
1881
  audio: string | Uint8Array<ArrayBuffer>;
1857
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
1882
+ tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
1858
1883
  language?: string | undefined;
1859
1884
  purpose?: string | undefined;
1860
1885
  override?: {
@@ -1862,7 +1887,7 @@ declare const transcribeInputSchema: z.ZodObject<{
1862
1887
  model?: string | undefined;
1863
1888
  transport?: "http" | "subprocess" | undefined;
1864
1889
  } | undefined;
1865
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
1890
+ fallback?: ("vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | {
1866
1891
  provider: string;
1867
1892
  model: string;
1868
1893
  transport: "http" | "subprocess";
@@ -1908,7 +1933,7 @@ declare const ocrInputSchema: z.ZodObject<{
1908
1933
  mimeType: z.ZodOptional<z.ZodString>;
1909
1934
  }, "strip", z.ZodTypeAny, {
1910
1935
  document: string | Uint8Array<ArrayBuffer>;
1911
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
1936
+ tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
1912
1937
  mimeType?: string | undefined;
1913
1938
  purpose?: string | undefined;
1914
1939
  override?: {
@@ -1916,7 +1941,7 @@ declare const ocrInputSchema: z.ZodObject<{
1916
1941
  model?: string | undefined;
1917
1942
  transport?: "http" | "subprocess" | undefined;
1918
1943
  } | undefined;
1919
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
1944
+ fallback?: ("vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | {
1920
1945
  provider: string;
1921
1946
  model: string;
1922
1947
  transport: "http" | "subprocess";
@@ -1924,7 +1949,7 @@ declare const ocrInputSchema: z.ZodObject<{
1924
1949
  labels?: Record<string, string> | undefined;
1925
1950
  }, {
1926
1951
  document: string | Uint8Array<ArrayBuffer>;
1927
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
1952
+ tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
1928
1953
  mimeType?: string | undefined;
1929
1954
  purpose?: string | undefined;
1930
1955
  override?: {
@@ -1932,7 +1957,7 @@ declare const ocrInputSchema: z.ZodObject<{
1932
1957
  model?: string | undefined;
1933
1958
  transport?: "http" | "subprocess" | undefined;
1934
1959
  } | undefined;
1935
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
1960
+ fallback?: ("vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | {
1936
1961
  provider: string;
1937
1962
  model: string;
1938
1963
  transport: "http" | "subprocess";
@@ -1972,14 +1997,14 @@ declare const moderationInputSchema: z.ZodObject<{
1972
1997
  input: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
1973
1998
  }, "strip", z.ZodTypeAny, {
1974
1999
  input: string | string[];
1975
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
2000
+ tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
1976
2001
  purpose?: string | undefined;
1977
2002
  override?: {
1978
2003
  provider?: string | undefined;
1979
2004
  model?: string | undefined;
1980
2005
  transport?: "http" | "subprocess" | undefined;
1981
2006
  } | undefined;
1982
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
2007
+ fallback?: ("vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | {
1983
2008
  provider: string;
1984
2009
  model: string;
1985
2010
  transport: "http" | "subprocess";
@@ -1987,14 +2012,14 @@ declare const moderationInputSchema: z.ZodObject<{
1987
2012
  labels?: Record<string, string> | undefined;
1988
2013
  }, {
1989
2014
  input: string | string[];
1990
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
2015
+ tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
1991
2016
  purpose?: string | undefined;
1992
2017
  override?: {
1993
2018
  provider?: string | undefined;
1994
2019
  model?: string | undefined;
1995
2020
  transport?: "http" | "subprocess" | undefined;
1996
2021
  } | undefined;
1997
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
2022
+ fallback?: ("vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | {
1998
2023
  provider: string;
1999
2024
  model: string;
2000
2025
  transport: "http" | "subprocess";
@@ -2132,14 +2157,14 @@ declare const judgeInputSchema: z.ZodObject<{
2132
2157
  instructions: string | unknown[] | Record<string, unknown> | null;
2133
2158
  criteria: (string | unknown[] | Record<string, unknown> | null)[];
2134
2159
  }>;
2135
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
2160
+ tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
2136
2161
  purpose?: string | undefined;
2137
2162
  override?: {
2138
2163
  provider?: string | undefined;
2139
2164
  model?: string | undefined;
2140
2165
  transport?: "http" | "subprocess" | undefined;
2141
2166
  } | undefined;
2142
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
2167
+ fallback?: ("vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | {
2143
2168
  provider: string;
2144
2169
  model: string;
2145
2170
  transport: "http" | "subprocess";
@@ -2163,14 +2188,14 @@ declare const judgeInputSchema: z.ZodObject<{
2163
2188
  instructions: string | unknown[] | Record<string, unknown> | null;
2164
2189
  criteria: (string | unknown[] | Record<string, unknown> | null)[];
2165
2190
  }>;
2166
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
2191
+ tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
2167
2192
  purpose?: string | undefined;
2168
2193
  override?: {
2169
2194
  provider?: string | undefined;
2170
2195
  model?: string | undefined;
2171
2196
  transport?: "http" | "subprocess" | undefined;
2172
2197
  } | undefined;
2173
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
2198
+ fallback?: ("vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | {
2174
2199
  provider: string;
2175
2200
  model: string;
2176
2201
  transport: "http" | "subprocess";
@@ -2248,7 +2273,7 @@ declare const podcastInputSchema: z.ZodObject<{
2248
2273
  speaker: string;
2249
2274
  }[];
2250
2275
  voices: Record<string, string>;
2251
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
2276
+ tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
2252
2277
  purpose?: string | undefined;
2253
2278
  pronunciations?: {
2254
2279
  word: string;
@@ -2262,7 +2287,7 @@ declare const podcastInputSchema: z.ZodObject<{
2262
2287
  model?: string | undefined;
2263
2288
  transport?: "http" | "subprocess" | undefined;
2264
2289
  } | undefined;
2265
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
2290
+ fallback?: ("vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | {
2266
2291
  provider: string;
2267
2292
  model: string;
2268
2293
  transport: "http" | "subprocess";
@@ -2275,7 +2300,7 @@ declare const podcastInputSchema: z.ZodObject<{
2275
2300
  speaker: string;
2276
2301
  }[];
2277
2302
  voices: Record<string, string>;
2278
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
2303
+ tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
2279
2304
  purpose?: string | undefined;
2280
2305
  pronunciations?: {
2281
2306
  word: string;
@@ -2289,7 +2314,7 @@ declare const podcastInputSchema: z.ZodObject<{
2289
2314
  model?: string | undefined;
2290
2315
  transport?: "http" | "subprocess" | undefined;
2291
2316
  } | undefined;
2292
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
2317
+ fallback?: ("vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | {
2293
2318
  provider: string;
2294
2319
  model: string;
2295
2320
  transport: "http" | "subprocess";
@@ -2370,7 +2395,7 @@ declare const ttsInputSchema: z.ZodObject<{
2370
2395
  }, "strip", z.ZodTypeAny, {
2371
2396
  text: string;
2372
2397
  voice: string;
2373
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
2398
+ tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
2374
2399
  purpose?: string | undefined;
2375
2400
  wordTimings?: boolean | undefined;
2376
2401
  pronunciations?: {
@@ -2385,7 +2410,7 @@ declare const ttsInputSchema: z.ZodObject<{
2385
2410
  model?: string | undefined;
2386
2411
  transport?: "http" | "subprocess" | undefined;
2387
2412
  } | undefined;
2388
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
2413
+ fallback?: ("vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | {
2389
2414
  provider: string;
2390
2415
  model: string;
2391
2416
  transport: "http" | "subprocess";
@@ -2398,7 +2423,7 @@ declare const ttsInputSchema: z.ZodObject<{
2398
2423
  }, {
2399
2424
  text: string;
2400
2425
  voice: string;
2401
- tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
2426
+ tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
2402
2427
  purpose?: string | undefined;
2403
2428
  wordTimings?: boolean | undefined;
2404
2429
  pronunciations?: {
@@ -2413,7 +2438,7 @@ declare const ttsInputSchema: z.ZodObject<{
2413
2438
  model?: string | undefined;
2414
2439
  transport?: "http" | "subprocess" | undefined;
2415
2440
  } | undefined;
2416
- fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
2441
+ fallback?: ("vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | {
2417
2442
  provider: string;
2418
2443
  model: string;
2419
2444
  transport: "http" | "subprocess";
@@ -2428,6 +2453,9 @@ declare const aiConfigSchema: z.ZodObject<{
2428
2453
  /** F069.1 — customer-key mode. Every provider must be built with byokAdapter(), so no
2429
2454
  * call can fall back to the fleet's env keys; createAI throws at setup otherwise. */
2430
2455
  byok: z.ZodOptional<z.ZodBoolean>;
2456
+ /** F069.2 — attribution labels stamped on EVERY call's usage (and so on every cost-sink
2457
+ * row), e.g. { byok: "true", tenantId }. A call's own `labels` win on the same key. */
2458
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
2431
2459
  /** F039.2 — client-wide opt-out from prompt caching (default: on where the
2432
2460
  * provider supports it). A per-call `promptCache` wins over this. */
2433
2461
  promptCache: z.ZodOptional<z.ZodBoolean>;
@@ -2471,8 +2499,9 @@ declare const aiConfigSchema: z.ZodObject<{
2471
2499
  }>>;
2472
2500
  }, "strip", z.ZodTypeAny, {
2473
2501
  promptCache?: boolean | undefined;
2502
+ labels?: Record<string, string> | undefined;
2474
2503
  byok?: boolean | undefined;
2475
- defaults?: Partial<Record<"fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding", {
2504
+ defaults?: Partial<Record<"vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap", {
2476
2505
  provider: string;
2477
2506
  model: string;
2478
2507
  transport: "http" | "subprocess";
@@ -2489,8 +2518,9 @@ declare const aiConfigSchema: z.ZodObject<{
2489
2518
  } | undefined;
2490
2519
  }, {
2491
2520
  promptCache?: boolean | undefined;
2521
+ labels?: Record<string, string> | undefined;
2492
2522
  byok?: boolean | undefined;
2493
- defaults?: Partial<Record<"fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding", {
2523
+ defaults?: Partial<Record<"vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap", {
2494
2524
  provider: string;
2495
2525
  model: string;
2496
2526
  transport: "http" | "subprocess";
@@ -2872,8 +2902,8 @@ declare const falStubAdapter: ProviderAdapter;
2872
2902
  * wires the live adapters. */
2873
2903
  declare const stubProviders: Record<string, ProviderAdapter>;
2874
2904
 
2875
- declare const VERSION: "0.51.0";
2876
- declare const SDK_TAG: "@broberg/ai-sdk@0.51.0";
2905
+ declare const VERSION: "0.53.0";
2906
+ declare const SDK_TAG: "@broberg/ai-sdk@0.53.0";
2877
2907
 
2878
2908
  /** Built-in defaults. Every entry is overridable via AiConfig.defaults or a
2879
2909
  * per-call override.