@broberg/ai-sdk 0.78.7 → 0.78.8

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
@@ -417,6 +417,7 @@ declare const chatInputSchema: z.ZodObject<{
417
417
  purpose: z.ZodOptional<z.ZodString>;
418
418
  allowFloating: z.ZodOptional<z.ZodBoolean>;
419
419
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
420
+ retryOn429: z.ZodOptional<z.ZodBoolean>;
420
421
  promptCacheKey: z.ZodOptional<z.ZodString>;
421
422
  promptCache: z.ZodOptional<z.ZodBoolean>;
422
423
  prompt: z.ZodOptional<z.ZodString>;
@@ -502,6 +503,7 @@ declare const visionInputSchema: z.ZodObject<{
502
503
  purpose: z.ZodOptional<z.ZodString>;
503
504
  allowFloating: z.ZodOptional<z.ZodBoolean>;
504
505
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
506
+ retryOn429: z.ZodOptional<z.ZodBoolean>;
505
507
  image: z.ZodUnion<readonly [z.ZodString, z.ZodInstanceOf<Uint8Array<ArrayBuffer>>]>;
506
508
  prompt: z.ZodString;
507
509
  mimeType: z.ZodOptional<z.ZodString>;
@@ -552,6 +554,7 @@ declare const videoInputSchema: z.ZodObject<{
552
554
  purpose: z.ZodOptional<z.ZodString>;
553
555
  allowFloating: z.ZodOptional<z.ZodBoolean>;
554
556
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
557
+ retryOn429: z.ZodOptional<z.ZodBoolean>;
555
558
  video: z.ZodUnion<readonly [z.ZodString, z.ZodInstanceOf<Uint8Array<ArrayBuffer>>]>;
556
559
  prompt: z.ZodString;
557
560
  mimeType: z.ZodOptional<z.ZodString>;
@@ -594,6 +597,7 @@ declare const translateInputSchema: z.ZodObject<{
594
597
  purpose: z.ZodOptional<z.ZodString>;
595
598
  allowFloating: z.ZodOptional<z.ZodBoolean>;
596
599
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
600
+ retryOn429: z.ZodOptional<z.ZodBoolean>;
597
601
  text: z.ZodString;
598
602
  to: z.ZodString;
599
603
  from: z.ZodOptional<z.ZodString>;
@@ -635,6 +639,7 @@ declare const imageInputSchema: z.ZodObject<{
635
639
  purpose: z.ZodOptional<z.ZodString>;
636
640
  allowFloating: z.ZodOptional<z.ZodBoolean>;
637
641
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
642
+ retryOn429: z.ZodOptional<z.ZodBoolean>;
638
643
  prompt: z.ZodString;
639
644
  width: z.ZodOptional<z.ZodNumber>;
640
645
  height: z.ZodOptional<z.ZodNumber>;
@@ -692,6 +697,7 @@ declare const animateInputSchema: z.ZodObject<{
692
697
  purpose: z.ZodOptional<z.ZodString>;
693
698
  allowFloating: z.ZodOptional<z.ZodBoolean>;
694
699
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
700
+ retryOn429: z.ZodOptional<z.ZodBoolean>;
695
701
  image: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodInstanceOf<Uint8Array<ArrayBuffer>>]>>;
696
702
  prompt: z.ZodOptional<z.ZodString>;
697
703
  durationSec: z.ZodOptional<z.ZodNumber>;
@@ -735,6 +741,7 @@ declare const trainStyleInputSchema: z.ZodObject<{
735
741
  purpose: z.ZodOptional<z.ZodString>;
736
742
  allowFloating: z.ZodOptional<z.ZodBoolean>;
737
743
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
744
+ retryOn429: z.ZodOptional<z.ZodBoolean>;
738
745
  images: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
739
746
  isStyle: z.ZodOptional<z.ZodBoolean>;
740
747
  triggerWord: z.ZodOptional<z.ZodString>;
@@ -778,6 +785,7 @@ declare const embeddingInputSchema: z.ZodObject<{
778
785
  purpose: z.ZodOptional<z.ZodString>;
779
786
  allowFloating: z.ZodOptional<z.ZodBoolean>;
780
787
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
788
+ retryOn429: z.ZodOptional<z.ZodBoolean>;
781
789
  text: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
782
790
  }, z.core.$strip>;
783
791
  declare const transcribeInputSchema: z.ZodObject<{
@@ -817,6 +825,7 @@ declare const transcribeInputSchema: z.ZodObject<{
817
825
  purpose: z.ZodOptional<z.ZodString>;
818
826
  allowFloating: z.ZodOptional<z.ZodBoolean>;
819
827
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
828
+ retryOn429: z.ZodOptional<z.ZodBoolean>;
820
829
  audio: z.ZodUnion<readonly [z.ZodString, z.ZodInstanceOf<Uint8Array<ArrayBuffer>>]>;
821
830
  language: z.ZodOptional<z.ZodString>;
822
831
  durationSec: z.ZodOptional<z.ZodNumber>;
@@ -870,6 +879,7 @@ declare const ocrInputSchema: z.ZodObject<{
870
879
  purpose: z.ZodOptional<z.ZodString>;
871
880
  allowFloating: z.ZodOptional<z.ZodBoolean>;
872
881
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
882
+ retryOn429: z.ZodOptional<z.ZodBoolean>;
873
883
  document: z.ZodUnion<readonly [z.ZodString, z.ZodInstanceOf<Uint8Array<ArrayBuffer>>]>;
874
884
  mimeType: z.ZodOptional<z.ZodString>;
875
885
  }, z.core.$strip>;
@@ -910,6 +920,7 @@ declare const moderationInputSchema: z.ZodObject<{
910
920
  purpose: z.ZodOptional<z.ZodString>;
911
921
  allowFloating: z.ZodOptional<z.ZodBoolean>;
912
922
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
923
+ retryOn429: z.ZodOptional<z.ZodBoolean>;
913
924
  input: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
914
925
  }, z.core.$strip>;
915
926
  declare const vectorizeInputSchema: z.ZodObject<{
@@ -949,6 +960,7 @@ declare const vectorizeInputSchema: z.ZodObject<{
949
960
  purpose: z.ZodOptional<z.ZodString>;
950
961
  allowFloating: z.ZodOptional<z.ZodBoolean>;
951
962
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
963
+ retryOn429: z.ZodOptional<z.ZodBoolean>;
952
964
  image: z.ZodUnion<readonly [z.ZodString, z.ZodInstanceOf<Uint8Array<ArrayBuffer>>]>;
953
965
  shapeStacking: z.ZodOptional<z.ZodEnum<{
954
966
  hierarchical: "hierarchical";
@@ -992,6 +1004,7 @@ declare const judgeInputSchema: z.ZodObject<{
992
1004
  purpose: z.ZodOptional<z.ZodString>;
993
1005
  allowFloating: z.ZodOptional<z.ZodBoolean>;
994
1006
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1007
+ retryOn429: z.ZodOptional<z.ZodBoolean>;
995
1008
  state: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
996
1009
  questions: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
997
1010
  type: z.ZodLiteral<"noul">;
@@ -1047,6 +1060,7 @@ declare const podcastInputSchema: z.ZodObject<{
1047
1060
  purpose: z.ZodOptional<z.ZodString>;
1048
1061
  allowFloating: z.ZodOptional<z.ZodBoolean>;
1049
1062
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1063
+ retryOn429: z.ZodOptional<z.ZodBoolean>;
1050
1064
  script: z.ZodArray<z.ZodObject<{
1051
1065
  speaker: z.ZodString;
1052
1066
  text: z.ZodString;
@@ -1098,6 +1112,7 @@ declare const ttsInputSchema: z.ZodObject<{
1098
1112
  purpose: z.ZodOptional<z.ZodString>;
1099
1113
  allowFloating: z.ZodOptional<z.ZodBoolean>;
1100
1114
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1115
+ retryOn429: z.ZodOptional<z.ZodBoolean>;
1101
1116
  text: z.ZodString;
1102
1117
  voice: z.ZodString;
1103
1118
  pronunciations: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -1114,6 +1129,7 @@ declare const ttsInputSchema: z.ZodObject<{
1114
1129
  rate: z.ZodOptional<z.ZodNumber>;
1115
1130
  }, z.core.$strip>;
1116
1131
  declare const aiConfigSchema: z.ZodObject<{
1132
+ retryOn429: z.ZodOptional<z.ZodBoolean>;
1117
1133
  byok: z.ZodOptional<z.ZodBoolean>;
1118
1134
  labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1119
1135
  promptCache: z.ZodOptional<z.ZodBoolean>;
@@ -1605,8 +1621,8 @@ declare const falStubAdapter: ProviderAdapter;
1605
1621
  * wires the live adapters. */
1606
1622
  declare const stubProviders: Record<string, ProviderAdapter>;
1607
1623
 
1608
- declare const VERSION: "0.78.7";
1609
- declare const SDK_TAG: "@broberg/ai-sdk@0.78.7";
1624
+ declare const VERSION: "0.78.8";
1625
+ declare const SDK_TAG: "@broberg/ai-sdk@0.78.8";
1610
1626
 
1611
1627
  /** Built-in defaults. Every entry is overridable via AiConfig.defaults or a
1612
1628
  * per-call override.
@@ -2096,6 +2112,9 @@ interface HttpResponse {
2096
2112
  * holds what the server actually said, which is the only useful thing to show on a
2097
2113
  * gateway error. */
2098
2114
  text: string;
2115
+ /** F089 — the server's Retry-After, in ms (seconds or an HTTP date). Absent when the
2116
+ * header was not sent or could not be read. */
2117
+ retryAfterMs?: number;
2099
2118
  }
2100
2119
  /** Subprocess transport result — already normalized from the `claude -p` JSON.
2101
2120
  * costUsd is always 0 (Max plan is not a metered charge); subprocess flags it. */
package/dist/index.js CHANGED
@@ -461,8 +461,30 @@ async function httpTransport(req) {
461
461
  } catch {
462
462
  json = void 0;
463
463
  }
464
- return { ok: res.ok, status: res.status, json, text };
464
+ const out = { ok: res.ok, status: res.status, json, text };
465
+ const ra = parseRetryAfter(res.headers?.get?.("retry-after") ?? null);
466
+ if (ra !== void 0) out.retryAfterMs = ra;
467
+ return out;
468
+ }
469
+ function parseRetryAfter(v, now = Date.now()) {
470
+ if (v === null || v.trim() === "") return void 0;
471
+ const t = v.trim();
472
+ if (/^\d+(\.\d+)?$/.test(t)) return Math.round(Number(t) * 1e3);
473
+ const at = Date.parse(t);
474
+ if (Number.isNaN(at)) return void 0;
475
+ const ms = at - now;
476
+ return ms >= 0 ? ms : void 0;
465
477
  }
478
+ var ProviderHttpError = class extends Error {
479
+ status;
480
+ retryAfterMs;
481
+ constructor(message, status, retryAfterMs) {
482
+ super(message);
483
+ this.name = "ProviderHttpError";
484
+ this.status = status;
485
+ if (retryAfterMs !== void 0) this.retryAfterMs = retryAfterMs;
486
+ }
487
+ };
466
488
  function errorBody(json, rawText) {
467
489
  const fallback = rawText && rawText.trim() ? rawText.slice(0, 300) : "(no body)";
468
490
  if (json === void 0 || json === null) return fallback;
@@ -1209,7 +1231,7 @@ function makeOpenAICompatibleAdapter(config) {
1209
1231
  }
1210
1232
  });
1211
1233
  if (!res.ok) {
1212
- throw new Error(`${config.name} ${res.status}: ${errorBody(res.json, res.text)}`);
1234
+ throw new ProviderHttpError(`${config.name} ${res.status}: ${errorBody(res.json, res.text)}`, res.status, res.retryAfterMs);
1213
1235
  }
1214
1236
  const data = res.json;
1215
1237
  const msg = data.choices?.[0]?.message;
@@ -4402,7 +4424,10 @@ var callOptions = {
4402
4424
  allowFloating: z.boolean().optional(),
4403
4425
  /** Consumer-defined attribution dimensions (e.g. {tenantId}) ridden into the
4404
4426
  * cost sink for per-tenant/per-customer cost breakdown (F011). */
4405
- labels: z.record(z.string(), z.string()).optional()
4427
+ labels: z.record(z.string(), z.string()).optional(),
4428
+ /** F089 — on HTTP 429 wait the provider's Retry-After (cap 10 s, 2 s if unstated) and try
4429
+ * the SAME route once more before any fallback. Default on; false turns it off. */
4430
+ retryOn429: z.boolean().optional()
4406
4431
  };
4407
4432
  var chatInputSchema = z.object({
4408
4433
  /** F039 — reuse a cached prompt prefix on Mistral at 10% of the input rate.
@@ -4641,6 +4666,8 @@ var availabilitySchema = z.object({
4641
4666
  fallback: z.union([z.string(), z.array(z.string()).max(L.fallback)]).optional()
4642
4667
  });
4643
4668
  var aiConfigSchema = z.object({
4669
+ /** F089 — client-wide default for the one retry on HTTP 429 (default on). */
4670
+ retryOn429: z.boolean().optional(),
4644
4671
  /** F069.1 — customer-key mode. Every provider must be built with byokAdapter(), so no
4645
4672
  * call can fall back to the fleet's env keys; createAI throws at setup otherwise. */
4646
4673
  byok: z.boolean().optional(),
@@ -4671,8 +4698,8 @@ var aiConfigSchema = z.object({
4671
4698
  import { randomUUID } from "crypto";
4672
4699
 
4673
4700
  // src/version.ts
4674
- var VERSION = "0.78.7";
4675
- var SDK_TAG = "@broberg/ai-sdk@0.78.7";
4701
+ var VERSION = "0.78.8";
4702
+ var SDK_TAG = "@broberg/ai-sdk@0.78.8";
4676
4703
 
4677
4704
  // src/cost/sinks/upmetrics.ts
4678
4705
  function isRetryableStatus(status) {
@@ -4970,6 +4997,8 @@ var DEFAULT_TRAINSTYLE_SPEC = {
4970
4997
  model: "fal-ai/flux-lora-fast-training",
4971
4998
  transport: "http"
4972
4999
  };
5000
+ var RETRY_429_CAP_MS = 1e4;
5001
+ var RETRY_429_DEFAULT_MS = 2e3;
4973
5002
  var DEFAULT_ANIMATE_SPEC = {
4974
5003
  provider: "bfl",
4975
5004
  model: "flux-3-video",
@@ -5159,6 +5188,7 @@ function createAI(config = {}) {
5159
5188
  return true;
5160
5189
  }
5161
5190
  async function runCapability(opts) {
5191
+ const retry429 = opts.retryOn429 ?? cfg.retryOn429 ?? true;
5162
5192
  const routes = [
5163
5193
  applyAvailability(opts.primary),
5164
5194
  ...(opts.fallback ?? []).map(
@@ -5170,35 +5200,49 @@ function createAI(config = {}) {
5170
5200
  const spec = routes[i];
5171
5201
  const floating = checkPinning(spec, opts.allowFloating);
5172
5202
  await preflight(spec, opts.estIn, opts.estOut);
5173
- const t0 = performance.now();
5174
- try {
5175
- const res = await opts.invoke(spec);
5176
- enrich(res.usage, opts.capability, i === 0 ? opts.tier : void 0, opts.purpose, performance.now() - t0, opts.labels);
5177
- if (floating) res.usage.floating = true;
5178
- await settle(res.usage);
5179
- await report(res.usage);
5180
- return res;
5181
- } catch (e) {
5182
- lastErr = e;
5183
- const labels = { ...cfg.labels, ...opts.labels };
5184
- await reportFailure(
5185
- {
5186
- provider: spec.provider,
5187
- model: spec.model,
5188
- transport: spec.transport,
5189
- capability: opts.capability,
5190
- ...i === 0 && opts.tier ? { tier: opts.tier } : {},
5191
- ...opts.purpose ? { purpose: opts.purpose } : {},
5192
- ...Object.keys(labels).length ? { labels } : {},
5193
- latencyMs: Math.round(performance.now() - t0)
5194
- },
5195
- e
5196
- );
5197
- if (isCallerAbort(e)) throw e;
5203
+ for (let attempt = 0; attempt < 2; attempt++) {
5204
+ const t0 = performance.now();
5205
+ try {
5206
+ const res = await opts.invoke(spec);
5207
+ enrich(res.usage, opts.capability, i === 0 ? opts.tier : void 0, opts.purpose, performance.now() - t0, opts.labels);
5208
+ if (floating) res.usage.floating = true;
5209
+ await settle(res.usage);
5210
+ await report(res.usage);
5211
+ return res;
5212
+ } catch (e) {
5213
+ lastErr = e;
5214
+ const labels = { ...cfg.labels, ...opts.labels };
5215
+ await reportFailure(
5216
+ {
5217
+ provider: spec.provider,
5218
+ model: spec.model,
5219
+ transport: spec.transport,
5220
+ capability: opts.capability,
5221
+ ...i === 0 && opts.tier ? { tier: opts.tier } : {},
5222
+ ...opts.purpose ? { purpose: opts.purpose } : {},
5223
+ ...Object.keys(labels).length ? { labels } : {},
5224
+ latencyMs: Math.round(performance.now() - t0)
5225
+ },
5226
+ e
5227
+ );
5228
+ if (isCallerAbort(e)) throw e;
5229
+ const wait = attempt === 0 && retry429 ? retryWaitFor429(e) : void 0;
5230
+ if (wait !== void 0) {
5231
+ await new Promise((r) => setTimeout(r, wait));
5232
+ continue;
5233
+ }
5234
+ break;
5235
+ }
5198
5236
  }
5199
5237
  }
5200
5238
  throw lastErr;
5201
5239
  }
5240
+ function retryWaitFor429(e) {
5241
+ const err = e;
5242
+ if (err?.status !== 429) return void 0;
5243
+ const ms = err.retryAfterMs ?? RETRY_429_DEFAULT_MS;
5244
+ return ms <= RETRY_429_CAP_MS ? ms : void 0;
5245
+ }
5202
5246
  function eligibleForFallback(e) {
5203
5247
  const status = e?.status;
5204
5248
  if (status === void 0) return true;
@@ -5307,6 +5351,7 @@ function createAI(config = {}) {
5307
5351
  capability: "chat",
5308
5352
  tier,
5309
5353
  purpose: input.purpose,
5354
+ retryOn429: input.retryOn429,
5310
5355
  labels: input.labels,
5311
5356
  allowFloating: input.allowFloating,
5312
5357
  estIn,
@@ -5333,6 +5378,7 @@ function createAI(config = {}) {
5333
5378
  capability: "vision",
5334
5379
  tier,
5335
5380
  purpose: input.purpose,
5381
+ retryOn429: input.retryOn429,
5336
5382
  labels: input.labels,
5337
5383
  allowFloating: input.allowFloating,
5338
5384
  estIn: estTokens(input.prompt) + 1e3,
@@ -5355,6 +5401,7 @@ function createAI(config = {}) {
5355
5401
  capability: "video",
5356
5402
  tier,
5357
5403
  purpose: input.purpose,
5404
+ retryOn429: input.retryOn429,
5358
5405
  labels: input.labels,
5359
5406
  allowFloating: input.allowFloating,
5360
5407
  estIn: estTokens(input.prompt) + 4e3,
@@ -5378,6 +5425,7 @@ function createAI(config = {}) {
5378
5425
  capability: "translate",
5379
5426
  tier,
5380
5427
  purpose: input.purpose,
5428
+ retryOn429: input.retryOn429,
5381
5429
  labels: input.labels,
5382
5430
  allowFloating: input.allowFloating,
5383
5431
  estIn,
@@ -5403,6 +5451,7 @@ function createAI(config = {}) {
5403
5451
  fallback: input.fallback,
5404
5452
  capability: "image",
5405
5453
  purpose: input.purpose,
5454
+ retryOn429: input.retryOn429,
5406
5455
  labels: input.labels,
5407
5456
  allowFloating: input.allowFloating,
5408
5457
  estIn: 0,
@@ -5436,6 +5485,7 @@ function createAI(config = {}) {
5436
5485
  fallback: input.fallback,
5437
5486
  capability: "animate",
5438
5487
  purpose: input.purpose,
5488
+ retryOn429: input.retryOn429,
5439
5489
  labels: input.labels,
5440
5490
  allowFloating: input.allowFloating,
5441
5491
  estIn: 0,
@@ -5469,6 +5519,7 @@ function createAI(config = {}) {
5469
5519
  fallback: input.fallback,
5470
5520
  capability: "trainStyle",
5471
5521
  purpose: input.purpose,
5522
+ retryOn429: input.retryOn429,
5472
5523
  labels: input.labels,
5473
5524
  allowFloating: input.allowFloating,
5474
5525
  estIn: 0,
@@ -5496,6 +5547,7 @@ function createAI(config = {}) {
5496
5547
  fallback: input.fallback,
5497
5548
  capability: "ocr",
5498
5549
  purpose: input.purpose,
5550
+ retryOn429: input.retryOn429,
5499
5551
  labels: input.labels,
5500
5552
  allowFloating: input.allowFloating,
5501
5553
  estIn: 0,
@@ -5516,6 +5568,7 @@ function createAI(config = {}) {
5516
5568
  fallback: input.fallback,
5517
5569
  capability: "moderation",
5518
5570
  purpose: input.purpose,
5571
+ retryOn429: input.retryOn429,
5519
5572
  labels: input.labels,
5520
5573
  allowFloating: input.allowFloating,
5521
5574
  estIn: items.reduce((n, s) => n + estTokens(s), 0),
@@ -5539,6 +5592,7 @@ function createAI(config = {}) {
5539
5592
  fallback: input.fallback,
5540
5593
  capability: "judge",
5541
5594
  purpose: input.purpose,
5595
+ retryOn429: input.retryOn429,
5542
5596
  labels: input.labels,
5543
5597
  allowFloating: input.allowFloating,
5544
5598
  estIn: estTokens(stateText) + estTokens(JSON.stringify(input.questions)),
@@ -5558,6 +5612,7 @@ function createAI(config = {}) {
5558
5612
  fallback: input.fallback,
5559
5613
  capability: "vectorize",
5560
5614
  purpose: input.purpose,
5615
+ retryOn429: input.retryOn429,
5561
5616
  labels: input.labels,
5562
5617
  estIn: 0,
5563
5618
  estOut: 0,
@@ -5583,6 +5638,7 @@ function createAI(config = {}) {
5583
5638
  fallback: input.fallback,
5584
5639
  capability: "podcast",
5585
5640
  purpose: input.purpose,
5641
+ retryOn429: input.retryOn429,
5586
5642
  labels: input.labels,
5587
5643
  allowFloating: input.allowFloating,
5588
5644
  estIn: chars,
@@ -5603,6 +5659,7 @@ function createAI(config = {}) {
5603
5659
  fallback: input.fallback,
5604
5660
  capability: "tts",
5605
5661
  purpose: input.purpose,
5662
+ retryOn429: input.retryOn429,
5606
5663
  labels: input.labels,
5607
5664
  allowFloating: input.allowFloating,
5608
5665
  estIn: input.text.length,
@@ -5634,6 +5691,7 @@ function createAI(config = {}) {
5634
5691
  capability: "embedding",
5635
5692
  tier,
5636
5693
  purpose: input.purpose,
5694
+ retryOn429: input.retryOn429,
5637
5695
  labels: input.labels,
5638
5696
  allowFloating: input.allowFloating,
5639
5697
  estIn: text.reduce((n, t) => n + estTokens(t), 0),
@@ -5654,6 +5712,7 @@ function createAI(config = {}) {
5654
5712
  fallback: input.fallback,
5655
5713
  capability: "transcribe",
5656
5714
  purpose: input.purpose,
5715
+ retryOn429: input.retryOn429,
5657
5716
  labels: input.labels,
5658
5717
  allowFloating: input.allowFloating,
5659
5718
  estIn: 0,