llm-strings 1.5.0 → 1.5.1

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/ai-sdk.cjs CHANGED
@@ -1,2206 +1 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/ai-sdk.ts
21
- var ai_sdk_exports = {};
22
- __export(ai_sdk_exports, {
23
- createAiSdkProviderOptions: () => createAiSdkProviderOptions
24
- });
25
- module.exports = __toCommonJS(ai_sdk_exports);
26
-
27
- // src/provider-core.ts
28
- function hasOwn(object, key) {
29
- return Object.prototype.hasOwnProperty.call(object, key);
30
- }
31
- var HOST_ALIASES = {
32
- openai: "api.openai.com",
33
- azure: "models.inference.ai.azure.com",
34
- anthropic: "api.anthropic.com",
35
- google: "generativelanguage.googleapis.com",
36
- "google-vertex": "aiplatform.googleapis.com",
37
- aistudio: "generativelanguage.googleapis.com",
38
- mistral: "api.mistral.ai",
39
- cohere: "api.cohere.com",
40
- bedrock: "bedrock-runtime.us-east-1.amazonaws.com",
41
- openrouter: "openrouter.ai",
42
- vercel: "gateway.ai.vercel.app",
43
- alibaba: "dashscope-intl.aliyuncs.com",
44
- alibabacloud: "dashscope-intl.aliyuncs.com",
45
- dashscope: "dashscope-intl.aliyuncs.com",
46
- groq: "api.groq.com",
47
- fal: "fal.run",
48
- fireworks: "api.fireworks.ai",
49
- fireworksai: "api.fireworks.ai",
50
- "black-forest-labs": "api.bfl.ai",
51
- bfl: "api.bfl.ai",
52
- deepseek: "api.deepseek.com",
53
- moonshotai: "api.moonshot.ai",
54
- moonshot: "api.moonshot.ai",
55
- perplexity: "api.perplexity.ai",
56
- venice: "api.venice.ai",
57
- parasail: "api.parasail.io",
58
- deepinfra: "api.deepinfra.com",
59
- atlascloud: "api.atlascloud.ai",
60
- novita: "api.novita.ai",
61
- novitaai: "api.novita.ai",
62
- grok: "api.x.ai",
63
- xai: "api.x.ai",
64
- together: "api.together.xyz",
65
- togetherai: "api.together.xyz",
66
- cerebras: "api.cerebras.ai",
67
- replicate: "api.replicate.com",
68
- prodia: "api.prodia.com",
69
- luma: "api.lumalabs.ai",
70
- bytedance: "ark.cn-beijing.volces.com",
71
- kling: "api.klingai.com",
72
- elevenlabs: "api.elevenlabs.io",
73
- assemblyai: "api.assemblyai.com",
74
- deepgram: "api.deepgram.com",
75
- gladia: "api.gladia.io",
76
- lmnt: "api.lmnt.com",
77
- hume: "api.hume.ai",
78
- revai: "api.rev.ai",
79
- baseten: "api.baseten.co",
80
- huggingface: "api-inference.huggingface.co",
81
- wandb: "api.inference.wandb.ai",
82
- weightsandbiases: "api.inference.wandb.ai",
83
- baidu: "qianfan.baidubce.com",
84
- qianfan: "qianfan.baidubce.com",
85
- vertex: "aiplatform.googleapis.com",
86
- xiaomi: "api.xiaomimimo.com",
87
- minimax: "api.minimax.io"
88
- };
89
- var HOST_ALIAS_PROVIDERS = {
90
- aistudio: "google",
91
- vertex: "google-vertex",
92
- grok: "xai",
93
- bfl: "black-forest-labs",
94
- moonshot: "moonshotai",
95
- alibaba: "alibaba",
96
- alibabacloud: "alibaba",
97
- dashscope: "alibaba",
98
- togetherai: "together",
99
- fireworksai: "fireworks"
100
- };
101
- function readProcessEnv() {
102
- return typeof process !== "undefined" && process.env ? process.env : {};
103
- }
104
- function normalizeHostValue(value) {
105
- const trimmed = value.trim();
106
- if (!trimmed) return trimmed;
107
- try {
108
- if (trimmed.includes("://")) {
109
- return new URL(trimmed).host;
110
- }
111
- } catch {
112
- }
113
- return trimmed.replace(/^\/\//, "").split("/")[0] ?? trimmed;
114
- }
115
- function envHostOverride(alias, env) {
116
- const upper = alias.toUpperCase();
117
- const override = env[`LLM_STRINGS_${upper}_HOST`] ?? env[`LLM_STRINGS_HOST_${upper}`];
118
- return override?.trim() ? override : void 0;
119
- }
120
- function resolveHostAlias(host, env = readProcessEnv()) {
121
- const normalizedHost = host.toLowerCase();
122
- if (!hasOwn(HOST_ALIASES, normalizedHost)) {
123
- return { host };
124
- }
125
- const alias = normalizedHost;
126
- const override = envHostOverride(alias, env);
127
- return {
128
- host: normalizeHostValue(override ?? HOST_ALIASES[alias]),
129
- alias
130
- };
131
- }
132
- function providerFromHostAlias(alias) {
133
- const normalizedAlias = alias.toLowerCase();
134
- if (hasOwn(PROVIDER_PARAMS, normalizedAlias)) {
135
- return normalizedAlias;
136
- }
137
- if (hasOwn(HOST_ALIAS_PROVIDERS, normalizedAlias)) {
138
- return HOST_ALIAS_PROVIDERS[normalizedAlias];
139
- }
140
- return void 0;
141
- }
142
- function canonicalHostName(host) {
143
- return normalizeHostValue(host).toLowerCase().split(":")[0] ?? host;
144
- }
145
- function hostMatches(host, ...domains) {
146
- return domains.some((domain) => {
147
- const normalizedDomain = domain.toLowerCase();
148
- return host === normalizedDomain || host.endsWith(`.${normalizedDomain}`);
149
- });
150
- }
151
- function hostHasLabel(host, ...labels) {
152
- const hostLabels = host.split(".");
153
- return labels.some((label) => hostLabels.includes(label.toLowerCase()));
154
- }
155
- function hostHasLabelPrefix(host, ...prefixes) {
156
- const hostLabels = host.split(".");
157
- return prefixes.some(
158
- (prefix) => hostLabels.some((label) => label.startsWith(prefix.toLowerCase()))
159
- );
160
- }
161
- var MODEL_FAMILY_DELIMITERS = /* @__PURE__ */ new Set(["-", "."]);
162
- function normalizeModelForMatching(model) {
163
- return model.trim().toLowerCase();
164
- }
165
- function modelLeafName(model) {
166
- const normalized = normalizeModelForMatching(model);
167
- const slash = normalized.lastIndexOf("/");
168
- return slash >= 0 ? normalized.slice(slash + 1) : normalized;
169
- }
170
- function modelMatchesFamily(model, family) {
171
- const name = modelLeafName(model);
172
- const normalizedFamily = normalizeModelForMatching(family);
173
- if (!name || !normalizedFamily) return false;
174
- if (name === normalizedFamily) return true;
175
- const delimiter = name[normalizedFamily.length];
176
- return name.startsWith(normalizedFamily) && delimiter !== void 0 && MODEL_FAMILY_DELIMITERS.has(delimiter);
177
- }
178
- function detectProvider(host) {
179
- host = canonicalHostName(host);
180
- if (hostMatches(host, "openrouter", "openrouter.ai")) return "openrouter";
181
- if (hostMatches(host, "vercel", "gateway.ai.vercel.app", "gateway.ai.vercel.sh")) {
182
- return "vercel";
183
- }
184
- if (hostMatches(host, "bedrock", "amazonaws.com") || hostHasLabelPrefix(host, "bedrock")) {
185
- return "bedrock";
186
- }
187
- if (hostMatches(host, "aiplatform.googleapis.com")) return "google-vertex";
188
- if (hostMatches(host, "xai", "x.ai", "api.x.ai")) return "xai";
189
- if (hostMatches(host, "groq", "groq.com", "api.groq.com")) return "groq";
190
- if (hostMatches(host, "fal", "fal.run", "fal.ai")) return "fal";
191
- if (hostMatches(host, "deepinfra", "deepinfra.com")) return "deepinfra";
192
- if (hostMatches(host, "bfl", "bfl.ai", "api.bfl.ai")) {
193
- return "black-forest-labs";
194
- }
195
- if (hostMatches(host, "together", "together.xyz")) return "together";
196
- if (hostMatches(host, "fireworks", "fireworks.ai")) return "fireworks";
197
- if (hostMatches(host, "deepseek", "deepseek.com")) return "deepseek";
198
- if (hostMatches(host, "moonshot", "moonshot.ai")) return "moonshotai";
199
- if (hostMatches(host, "perplexity", "perplexity.ai")) return "perplexity";
200
- if (hostMatches(host, "alibaba", "aliyuncs.com") || hostHasLabelPrefix(host, "dashscope")) {
201
- return "alibaba";
202
- }
203
- if (hostMatches(host, "cerebras", "cerebras.ai")) return "cerebras";
204
- if (hostMatches(host, "replicate", "replicate.com")) return "replicate";
205
- if (hostMatches(host, "prodia", "prodia.com")) return "prodia";
206
- if (hostMatches(host, "luma", "lumalabs.ai")) return "luma";
207
- if (hostMatches(host, "bytedance", "volces.com") || hostHasLabel(host, "bytedance")) {
208
- return "bytedance";
209
- }
210
- if (hostMatches(host, "kling", "klingai.com")) return "kling";
211
- if (hostMatches(host, "elevenlabs", "elevenlabs.io")) return "elevenlabs";
212
- if (hostMatches(host, "assemblyai", "assemblyai.com")) return "assemblyai";
213
- if (hostMatches(host, "deepgram", "deepgram.com")) return "deepgram";
214
- if (hostMatches(host, "gladia", "gladia.io")) return "gladia";
215
- if (hostMatches(host, "lmnt", "lmnt.com")) return "lmnt";
216
- if (hostMatches(host, "hume", "hume.ai")) return "hume";
217
- if (hostMatches(host, "revai", "rev.ai")) return "revai";
218
- if (hostMatches(host, "baseten", "baseten.co")) return "baseten";
219
- if (hostMatches(host, "huggingface", "huggingface.co")) return "huggingface";
220
- if (hostMatches(host, "azure", "azure.com")) return "azure";
221
- if (hostMatches(host, "openai", "openai.com")) return "openai";
222
- if (hostMatches(host, "anthropic", "anthropic.com", "claude.ai")) {
223
- return "anthropic";
224
- }
225
- if (hostMatches(host, "google", "googleapis.com")) return "google";
226
- if (hostMatches(host, "mistral", "mistral.ai")) return "mistral";
227
- if (hostMatches(host, "cohere", "cohere.com")) return "cohere";
228
- return void 0;
229
- }
230
- var ALIASES = {
231
- // temperature
232
- temp: "temperature",
233
- // max_tokens
234
- max: "max_tokens",
235
- max_out: "max_tokens",
236
- max_output: "max_tokens",
237
- max_output_tokens: "max_tokens",
238
- max_completion_tokens: "max_tokens",
239
- maxOutputTokens: "max_tokens",
240
- maxTokens: "max_tokens",
241
- // top_p
242
- topp: "top_p",
243
- topP: "top_p",
244
- nucleus: "top_p",
245
- // top_k
246
- topk: "top_k",
247
- topK: "top_k",
248
- // frequency_penalty
249
- freq: "frequency_penalty",
250
- freq_penalty: "frequency_penalty",
251
- frequencyPenalty: "frequency_penalty",
252
- repetition_penalty: "frequency_penalty",
253
- // presence_penalty
254
- pres: "presence_penalty",
255
- pres_penalty: "presence_penalty",
256
- presencePenalty: "presence_penalty",
257
- // stop
258
- stop_sequences: "stop",
259
- stopSequences: "stop",
260
- stop_sequence: "stop",
261
- // seed
262
- random_seed: "seed",
263
- randomSeed: "seed",
264
- // n (completions count)
265
- candidateCount: "n",
266
- candidate_count: "n",
267
- num_completions: "n",
268
- // effort / reasoning
269
- reasoning_effort: "effort",
270
- reasoningEffort: "effort",
271
- reasoning: "effort",
272
- thinking_effort: "effort",
273
- thinkingEffort: "effort",
274
- // cache
275
- cache_control: "cache",
276
- cacheControl: "cache",
277
- cachePoint: "cache",
278
- cache_point: "cache"
279
- };
280
- var OPENAI_COMPATIBLE_PARAMS = {
281
- temperature: "temperature",
282
- max_tokens: "max_tokens",
283
- max_completion_tokens: "max_completion_tokens",
284
- top_p: "top_p",
285
- top_k: "top_k",
286
- frequency_penalty: "frequency_penalty",
287
- presence_penalty: "presence_penalty",
288
- stop: "stop",
289
- n: "n",
290
- seed: "seed",
291
- stream: "stream",
292
- effort: "reasoning_effort"
293
- };
294
- var COMMON_IMAGE_PARAMS = {
295
- prompt: "prompt",
296
- negative_prompt: "negative_prompt",
297
- seed: "seed",
298
- image_size: "image_size",
299
- aspect_ratio: "aspect_ratio",
300
- output_format: "output_format",
301
- width: "width",
302
- height: "height"
303
- };
304
- var FAL_PARAMS = {
305
- ...COMMON_IMAGE_PARAMS,
306
- num_images: "num_images",
307
- enable_safety_checker: "enable_safety_checker",
308
- enable_safety_checks: "enable_safety_checks",
309
- enable_prompt_expansion: "enable_prompt_expansion",
310
- expand_prompt: "expand_prompt"
311
- };
312
- var REPLICATE_PARAMS = {
313
- ...COMMON_IMAGE_PARAMS,
314
- input: "input",
315
- version: "version",
316
- num_outputs: "num_outputs",
317
- num_inference_steps: "num_inference_steps",
318
- guidance_scale: "guidance_scale",
319
- stream: "stream",
320
- webhook: "webhook",
321
- webhook_events_filter: "webhook_events_filter"
322
- };
323
- var PRODIA_PARAMS = {
324
- ...COMMON_IMAGE_PARAMS,
325
- model: "model",
326
- style_preset: "style_preset",
327
- steps: "steps",
328
- cfg_scale: "cfg_scale",
329
- upscale: "upscale",
330
- sampler: "sampler",
331
- type: "type",
332
- config: "config",
333
- price: "price"
334
- };
335
- var LUMA_PARAMS = {
336
- prompt: "prompt",
337
- model: "model",
338
- aspect_ratio: "aspect_ratio",
339
- keyframes: "keyframes",
340
- loop: "loop",
341
- duration: "duration",
342
- type: "type",
343
- image_ref: "image_ref",
344
- video: "video",
345
- source: "source"
346
- };
347
- var OPENROUTER_ROUTING_PARAMS = {
348
- provider: "provider",
349
- order: "order",
350
- "provider.order": "provider.order",
351
- only: "only",
352
- "provider.only": "provider.only",
353
- ignore: "ignore",
354
- "provider.ignore": "provider.ignore",
355
- allow_fallbacks: "allow_fallbacks",
356
- "provider.allow_fallbacks": "provider.allow_fallbacks",
357
- require_parameters: "require_parameters",
358
- "provider.require_parameters": "provider.require_parameters",
359
- data_collection: "data_collection",
360
- "provider.data_collection": "provider.data_collection",
361
- zdr: "zdr",
362
- "provider.zdr": "provider.zdr",
363
- enforce_distillable_text: "enforce_distillable_text",
364
- "provider.enforce_distillable_text": "provider.enforce_distillable_text",
365
- quantizations: "quantizations",
366
- "provider.quantizations": "provider.quantizations",
367
- sort: "sort",
368
- "provider.sort": "provider.sort",
369
- preferred_min_throughput: "preferred_min_throughput",
370
- "provider.preferred_min_throughput": "provider.preferred_min_throughput",
371
- preferred_max_latency: "preferred_max_latency",
372
- "provider.preferred_max_latency": "provider.preferred_max_latency",
373
- max_price: "max_price",
374
- "provider.max_price": "provider.max_price",
375
- transforms: "transforms",
376
- plugins: "plugins"
377
- };
378
- var GOOGLE_COMPATIBLE_PARAMS = {
379
- temperature: "temperature",
380
- max_tokens: "maxOutputTokens",
381
- top_p: "topP",
382
- top_k: "topK",
383
- frequency_penalty: "frequencyPenalty",
384
- presence_penalty: "presencePenalty",
385
- stop: "stopSequences",
386
- n: "candidateCount",
387
- stream: "stream",
388
- seed: "seed",
389
- responseMimeType: "responseMimeType",
390
- responseSchema: "responseSchema"
391
- };
392
- var PROVIDER_PARAMS = {
393
- openai: {
394
- temperature: "temperature",
395
- max_tokens: "max_tokens",
396
- max_completion_tokens: "max_completion_tokens",
397
- top_p: "top_p",
398
- frequency_penalty: "frequency_penalty",
399
- presence_penalty: "presence_penalty",
400
- stop: "stop",
401
- n: "n",
402
- seed: "seed",
403
- stream: "stream",
404
- effort: "reasoning_effort"
405
- },
406
- azure: OPENAI_COMPATIBLE_PARAMS,
407
- anthropic: {
408
- temperature: "temperature",
409
- max_tokens: "max_tokens",
410
- top_p: "top_p",
411
- top_k: "top_k",
412
- stop: "stop_sequences",
413
- stream: "stream",
414
- effort: "effort",
415
- cache: "cache_control",
416
- cache_ttl: "cache_ttl"
417
- },
418
- google: {
419
- temperature: "temperature",
420
- max_tokens: "maxOutputTokens",
421
- top_p: "topP",
422
- top_k: "topK",
423
- frequency_penalty: "frequencyPenalty",
424
- presence_penalty: "presencePenalty",
425
- stop: "stopSequences",
426
- n: "candidateCount",
427
- stream: "stream",
428
- seed: "seed",
429
- responseMimeType: "responseMimeType",
430
- responseSchema: "responseSchema"
431
- },
432
- "google-vertex": GOOGLE_COMPATIBLE_PARAMS,
433
- mistral: {
434
- temperature: "temperature",
435
- max_tokens: "max_tokens",
436
- top_p: "top_p",
437
- frequency_penalty: "frequency_penalty",
438
- presence_penalty: "presence_penalty",
439
- stop: "stop",
440
- n: "n",
441
- seed: "random_seed",
442
- stream: "stream",
443
- safe_prompt: "safe_prompt",
444
- min_tokens: "min_tokens"
445
- },
446
- cohere: {
447
- temperature: "temperature",
448
- max_tokens: "max_tokens",
449
- top_p: "p",
450
- top_k: "k",
451
- frequency_penalty: "frequency_penalty",
452
- presence_penalty: "presence_penalty",
453
- stop: "stop_sequences",
454
- stream: "stream",
455
- seed: "seed"
456
- },
457
- bedrock: {
458
- // Bedrock Converse API uses camelCase
459
- temperature: "temperature",
460
- max_tokens: "maxTokens",
461
- top_p: "topP",
462
- top_k: "topK",
463
- // Claude models via additionalModelRequestFields
464
- stop: "stopSequences",
465
- stream: "stream",
466
- cache: "cache_control",
467
- cache_ttl: "cache_ttl"
468
- },
469
- openrouter: {
470
- // OpenAI-compatible API with extra routing params
471
- temperature: "temperature",
472
- max_tokens: "max_tokens",
473
- max_completion_tokens: "max_completion_tokens",
474
- top_p: "top_p",
475
- top_k: "top_k",
476
- frequency_penalty: "frequency_penalty",
477
- presence_penalty: "presence_penalty",
478
- stop: "stop",
479
- n: "n",
480
- seed: "seed",
481
- stream: "stream",
482
- effort: "reasoning_effort",
483
- ...OPENROUTER_ROUTING_PARAMS
484
- },
485
- vercel: {
486
- // OpenAI-compatible gateway
487
- temperature: "temperature",
488
- max_tokens: "max_tokens",
489
- max_completion_tokens: "max_completion_tokens",
490
- top_p: "top_p",
491
- top_k: "top_k",
492
- frequency_penalty: "frequency_penalty",
493
- presence_penalty: "presence_penalty",
494
- stop: "stop",
495
- n: "n",
496
- seed: "seed",
497
- stream: "stream",
498
- effort: "reasoning_effort"
499
- },
500
- xai: OPENAI_COMPATIBLE_PARAMS,
501
- groq: OPENAI_COMPATIBLE_PARAMS,
502
- fal: FAL_PARAMS,
503
- deepinfra: OPENAI_COMPATIBLE_PARAMS,
504
- "black-forest-labs": {},
505
- together: OPENAI_COMPATIBLE_PARAMS,
506
- fireworks: OPENAI_COMPATIBLE_PARAMS,
507
- deepseek: OPENAI_COMPATIBLE_PARAMS,
508
- moonshotai: OPENAI_COMPATIBLE_PARAMS,
509
- perplexity: OPENAI_COMPATIBLE_PARAMS,
510
- alibaba: OPENAI_COMPATIBLE_PARAMS,
511
- cerebras: OPENAI_COMPATIBLE_PARAMS,
512
- replicate: REPLICATE_PARAMS,
513
- prodia: PRODIA_PARAMS,
514
- luma: LUMA_PARAMS,
515
- bytedance: {},
516
- kling: {},
517
- elevenlabs: {},
518
- assemblyai: {},
519
- deepgram: {},
520
- gladia: {},
521
- lmnt: {},
522
- hume: {},
523
- revai: {},
524
- baseten: OPENAI_COMPATIBLE_PARAMS,
525
- huggingface: OPENAI_COMPATIBLE_PARAMS
526
- };
527
- var REASONING_EFFORT_VALUES = [
528
- "none",
529
- "minimal",
530
- "low",
531
- "medium",
532
- "high",
533
- "xhigh",
534
- "max"
535
- ];
536
- var OPENAI_COMPATIBLE_PARAM_SPECS = {
537
- temperature: {
538
- type: "number",
539
- min: 0,
540
- max: 2,
541
- default: 0.7,
542
- description: "Controls randomness"
543
- },
544
- max_tokens: {
545
- type: "number",
546
- min: 1,
547
- default: 4096,
548
- description: "Maximum output tokens"
549
- },
550
- max_completion_tokens: {
551
- type: "number",
552
- min: 1,
553
- default: 4096,
554
- description: "Maximum completion tokens (reasoning models)"
555
- },
556
- top_p: {
557
- type: "number",
558
- min: 0,
559
- max: 1,
560
- default: 1,
561
- description: "Nucleus sampling"
562
- },
563
- top_k: {
564
- type: "number",
565
- min: 0,
566
- default: 40,
567
- description: "Top-K sampling"
568
- },
569
- frequency_penalty: {
570
- type: "number",
571
- min: -2,
572
- max: 2,
573
- default: 0,
574
- description: "Penalize frequent tokens"
575
- },
576
- presence_penalty: {
577
- type: "number",
578
- min: -2,
579
- max: 2,
580
- default: 0,
581
- description: "Penalize repeated topics"
582
- },
583
- stop: { type: "string", description: "Stop sequences" },
584
- n: { type: "number", min: 1, default: 1, description: "Completions count" },
585
- seed: { type: "number", description: "Random seed" },
586
- stream: { type: "boolean", default: false, description: "Stream response" },
587
- reasoning_effort: {
588
- type: "string",
589
- values: REASONING_EFFORT_VALUES,
590
- default: "medium",
591
- description: "Reasoning effort"
592
- }
593
- };
594
- var OPENROUTER_ROUTING_PARAM_SPECS = {
595
- provider: { type: "string", description: "Provider routing preferences" },
596
- order: { type: "string", description: "Provider order" },
597
- "provider.order": { type: "string", description: "Provider order" },
598
- only: { type: "string", description: "Provider allowlist" },
599
- "provider.only": { type: "string", description: "Provider allowlist" },
600
- ignore: { type: "string", description: "Provider blocklist" },
601
- "provider.ignore": { type: "string", description: "Provider blocklist" },
602
- allow_fallbacks: {
603
- type: "boolean",
604
- default: true,
605
- description: "Allow fallback providers"
606
- },
607
- "provider.allow_fallbacks": {
608
- type: "boolean",
609
- default: true,
610
- description: "Allow fallback providers"
611
- },
612
- require_parameters: {
613
- type: "boolean",
614
- default: false,
615
- description: "Only route to providers that support all request params"
616
- },
617
- "provider.require_parameters": {
618
- type: "boolean",
619
- default: false,
620
- description: "Only route to providers that support all request params"
621
- },
622
- data_collection: {
623
- type: "string",
624
- values: ["allow", "deny"],
625
- default: "allow",
626
- description: "Provider data collection policy"
627
- },
628
- "provider.data_collection": {
629
- type: "string",
630
- values: ["allow", "deny"],
631
- default: "allow",
632
- description: "Provider data collection policy"
633
- },
634
- zdr: {
635
- type: "boolean",
636
- description: "Require zero data retention providers"
637
- },
638
- "provider.zdr": {
639
- type: "boolean",
640
- description: "Require zero data retention providers"
641
- },
642
- enforce_distillable_text: {
643
- type: "boolean",
644
- description: "Require providers that allow text distillation"
645
- },
646
- "provider.enforce_distillable_text": {
647
- type: "boolean",
648
- description: "Require providers that allow text distillation"
649
- },
650
- quantizations: {
651
- type: "string",
652
- description: "Allowed provider quantization levels"
653
- },
654
- "provider.quantizations": {
655
- type: "string",
656
- description: "Allowed provider quantization levels"
657
- },
658
- sort: {
659
- type: "string",
660
- values: ["price", "throughput", "latency", "cost", "ttft", "tps"],
661
- description: "Provider sort strategy"
662
- },
663
- "provider.sort": {
664
- type: "string",
665
- values: ["price", "throughput", "latency", "cost", "ttft", "tps"],
666
- description: "Provider sort strategy"
667
- },
668
- preferred_min_throughput: {
669
- type: "number",
670
- min: 0,
671
- description: "Preferred minimum provider throughput"
672
- },
673
- "provider.preferred_min_throughput": {
674
- type: "number",
675
- min: 0,
676
- description: "Preferred minimum provider throughput"
677
- },
678
- preferred_max_latency: {
679
- type: "number",
680
- min: 0,
681
- description: "Preferred maximum provider latency"
682
- },
683
- "provider.preferred_max_latency": {
684
- type: "number",
685
- min: 0,
686
- description: "Preferred maximum provider latency"
687
- },
688
- max_price: {
689
- type: "string",
690
- description: "Maximum provider price filter"
691
- },
692
- "provider.max_price": {
693
- type: "string",
694
- description: "Maximum provider price filter"
695
- },
696
- transforms: {
697
- type: "string",
698
- description: "Legacy OpenRouter message transforms"
699
- },
700
- plugins: {
701
- type: "string",
702
- description: "OpenRouter request plugins"
703
- }
704
- };
705
- var FAL_PARAM_SPECS = {
706
- prompt: { type: "string", description: "Prompt" },
707
- negative_prompt: { type: "string", description: "Negative prompt" },
708
- seed: { type: "number", description: "Random seed" },
709
- num_images: {
710
- type: "number",
711
- min: 1,
712
- description: "Number of images to generate"
713
- },
714
- image_size: { type: "string", description: "Output image size" },
715
- aspect_ratio: { type: "string", description: "Output aspect ratio" },
716
- enable_safety_checker: {
717
- type: "boolean",
718
- description: "Enable safety checker"
719
- },
720
- enable_safety_checks: {
721
- type: "boolean",
722
- description: "Enable safety checker"
723
- },
724
- enable_prompt_expansion: {
725
- type: "boolean",
726
- description: "Enable prompt expansion"
727
- },
728
- expand_prompt: {
729
- type: "boolean",
730
- description: "Enable prompt expansion"
731
- },
732
- output_format: {
733
- type: "string",
734
- values: ["jpeg", "jpg", "png", "webp", "gif"],
735
- description: "Output image format"
736
- },
737
- width: { type: "number", min: 1, description: "Image width" },
738
- height: { type: "number", min: 1, description: "Image height" }
739
- };
740
- var REPLICATE_PARAM_SPECS = {
741
- prompt: { type: "string", description: "Prompt" },
742
- negative_prompt: { type: "string", description: "Negative prompt" },
743
- input: { type: "string", description: "Model input object" },
744
- version: { type: "string", description: "Model version" },
745
- seed: { type: "number", description: "Random seed" },
746
- num_outputs: {
747
- type: "number",
748
- min: 1,
749
- description: "Number of outputs to generate"
750
- },
751
- num_inference_steps: {
752
- type: "number",
753
- min: 1,
754
- description: "Number of inference steps"
755
- },
756
- guidance_scale: {
757
- type: "number",
758
- min: 0,
759
- description: "Guidance scale"
760
- },
761
- image_size: { type: "string", description: "Output image size" },
762
- aspect_ratio: { type: "string", description: "Output aspect ratio" },
763
- output_format: { type: "string", description: "Output format" },
764
- width: { type: "number", min: 1, description: "Image width" },
765
- height: { type: "number", min: 1, description: "Image height" },
766
- stream: { type: "boolean", description: "Request streaming output" },
767
- webhook: { type: "string", description: "Webhook URL" },
768
- webhook_events_filter: {
769
- type: "string",
770
- description: "Webhook events filter"
771
- }
772
- };
773
- var PRODIA_PARAM_SPECS = {
774
- model: { type: "string", description: "Model name" },
775
- prompt: { type: "string", description: "Prompt" },
776
- negative_prompt: { type: "string", description: "Negative prompt" },
777
- style_preset: { type: "string", description: "Style preset" },
778
- steps: { type: "number", min: 1, description: "Generation steps" },
779
- cfg_scale: { type: "number", min: 0, description: "CFG scale" },
780
- seed: { type: "number", description: "Random seed" },
781
- upscale: { type: "boolean", description: "Enable 2x upscale" },
782
- sampler: { type: "string", description: "Sampler" },
783
- width: { type: "number", min: 1, max: 1024, description: "Image width" },
784
- height: { type: "number", min: 1, max: 1024, description: "Image height" },
785
- image_size: { type: "string", description: "Output image size" },
786
- aspect_ratio: { type: "string", description: "Output aspect ratio" },
787
- output_format: { type: "string", description: "Output format" },
788
- type: { type: "string", description: "Prodia v2 job type" },
789
- config: { type: "string", description: "Prodia v2 job config" },
790
- price: { type: "boolean", description: "Include Prodia v2 job price" }
791
- };
792
- var LUMA_PARAM_SPECS = {
793
- prompt: { type: "string", description: "Prompt" },
794
- model: { type: "string", description: "Model name" },
795
- aspect_ratio: { type: "string", description: "Output aspect ratio" },
796
- keyframes: { type: "string", description: "Generation keyframes" },
797
- loop: { type: "boolean", description: "Generate a looping video" },
798
- duration: { type: "string", description: "Generation duration" },
799
- type: { type: "string", description: "Generation type" },
800
- image_ref: { type: "string", description: "Image reference" },
801
- video: { type: "string", description: "Video options" },
802
- source: { type: "string", description: "Source generation or media" }
803
- };
804
- var GOOGLE_COMPATIBLE_PARAM_SPECS = {
805
- temperature: {
806
- type: "number",
807
- min: 0,
808
- max: 2,
809
- default: 0.7,
810
- description: "Controls randomness"
811
- },
812
- maxOutputTokens: {
813
- type: "number",
814
- min: 1,
815
- default: 4096,
816
- description: "Maximum output tokens"
817
- },
818
- topP: {
819
- type: "number",
820
- min: 0,
821
- max: 1,
822
- default: 1,
823
- description: "Nucleus sampling"
824
- },
825
- topK: {
826
- type: "number",
827
- min: 0,
828
- default: 40,
829
- description: "Top-K sampling"
830
- },
831
- frequencyPenalty: {
832
- type: "number",
833
- min: -2,
834
- max: 2,
835
- default: 0,
836
- description: "Penalize frequent tokens"
837
- },
838
- presencePenalty: {
839
- type: "number",
840
- min: -2,
841
- max: 2,
842
- default: 0,
843
- description: "Penalize repeated topics"
844
- },
845
- stopSequences: { type: "string", description: "Stop sequences" },
846
- candidateCount: {
847
- type: "number",
848
- min: 1,
849
- default: 1,
850
- description: "Candidate count"
851
- },
852
- stream: { type: "boolean", default: false, description: "Stream response" },
853
- seed: { type: "number", description: "Random seed" },
854
- responseMimeType: { type: "string", description: "Response MIME type" },
855
- responseSchema: { type: "string", description: "Response schema" }
856
- };
857
- var PARAM_SPECS = {
858
- openai: {
859
- temperature: {
860
- type: "number",
861
- min: 0,
862
- max: 2,
863
- default: 0.7,
864
- description: "Controls randomness"
865
- },
866
- max_tokens: {
867
- type: "number",
868
- min: 1,
869
- default: 4096,
870
- description: "Maximum output tokens"
871
- },
872
- max_completion_tokens: {
873
- type: "number",
874
- min: 1,
875
- default: 4096,
876
- description: "Maximum completion tokens (reasoning models)"
877
- },
878
- top_p: {
879
- type: "number",
880
- min: 0,
881
- max: 1,
882
- default: 1,
883
- description: "Nucleus sampling"
884
- },
885
- frequency_penalty: {
886
- type: "number",
887
- min: -2,
888
- max: 2,
889
- default: 0,
890
- description: "Penalize frequent tokens"
891
- },
892
- presence_penalty: {
893
- type: "number",
894
- min: -2,
895
- max: 2,
896
- default: 0,
897
- description: "Penalize repeated topics"
898
- },
899
- stop: { type: "string", description: "Stop sequences" },
900
- n: { type: "number", min: 1, default: 1, description: "Completions count" },
901
- seed: { type: "number", description: "Random seed" },
902
- stream: { type: "boolean", default: false, description: "Stream response" },
903
- reasoning_effort: {
904
- type: "string",
905
- values: REASONING_EFFORT_VALUES,
906
- default: "medium",
907
- description: "Reasoning effort"
908
- }
909
- },
910
- azure: OPENAI_COMPATIBLE_PARAM_SPECS,
911
- anthropic: {
912
- temperature: {
913
- type: "number",
914
- min: 0,
915
- max: 1,
916
- default: 0.7,
917
- description: "Controls randomness"
918
- },
919
- max_tokens: {
920
- type: "number",
921
- min: 1,
922
- default: 4096,
923
- description: "Maximum output tokens"
924
- },
925
- top_p: {
926
- type: "number",
927
- min: 0,
928
- max: 1,
929
- default: 1,
930
- description: "Nucleus sampling"
931
- },
932
- top_k: {
933
- type: "number",
934
- min: 0,
935
- default: 40,
936
- description: "Top-K sampling"
937
- },
938
- stop_sequences: { type: "string", description: "Stop sequences" },
939
- stream: { type: "boolean", default: false, description: "Stream response" },
940
- effort: {
941
- type: "string",
942
- values: REASONING_EFFORT_VALUES,
943
- default: "low",
944
- description: "Thinking effort"
945
- },
946
- cache_control: {
947
- type: "string",
948
- values: ["ephemeral"],
949
- default: "ephemeral",
950
- description: "Cache control"
951
- },
952
- cache_ttl: {
953
- type: "string",
954
- values: ["5m", "1h"],
955
- default: "5m",
956
- description: "Cache TTL"
957
- }
958
- },
959
- google: {
960
- temperature: {
961
- type: "number",
962
- min: 0,
963
- max: 2,
964
- default: 0.7,
965
- description: "Controls randomness"
966
- },
967
- maxOutputTokens: {
968
- type: "number",
969
- min: 1,
970
- default: 4096,
971
- description: "Maximum output tokens"
972
- },
973
- topP: {
974
- type: "number",
975
- min: 0,
976
- max: 1,
977
- default: 1,
978
- description: "Nucleus sampling"
979
- },
980
- topK: {
981
- type: "number",
982
- min: 0,
983
- default: 40,
984
- description: "Top-K sampling"
985
- },
986
- frequencyPenalty: {
987
- type: "number",
988
- min: -2,
989
- max: 2,
990
- default: 0,
991
- description: "Penalize frequent tokens"
992
- },
993
- presencePenalty: {
994
- type: "number",
995
- min: -2,
996
- max: 2,
997
- default: 0,
998
- description: "Penalize repeated topics"
999
- },
1000
- stopSequences: { type: "string", description: "Stop sequences" },
1001
- candidateCount: {
1002
- type: "number",
1003
- min: 1,
1004
- default: 1,
1005
- description: "Candidate count"
1006
- },
1007
- stream: { type: "boolean", default: false, description: "Stream response" },
1008
- seed: { type: "number", description: "Random seed" },
1009
- responseMimeType: { type: "string", description: "Response MIME type" },
1010
- responseSchema: { type: "string", description: "Response schema" }
1011
- },
1012
- "google-vertex": GOOGLE_COMPATIBLE_PARAM_SPECS,
1013
- mistral: {
1014
- temperature: {
1015
- type: "number",
1016
- min: 0,
1017
- max: 1,
1018
- default: 0.7,
1019
- description: "Controls randomness"
1020
- },
1021
- max_tokens: {
1022
- type: "number",
1023
- min: 1,
1024
- default: 4096,
1025
- description: "Maximum output tokens"
1026
- },
1027
- top_p: {
1028
- type: "number",
1029
- min: 0,
1030
- max: 1,
1031
- default: 1,
1032
- description: "Nucleus sampling"
1033
- },
1034
- frequency_penalty: {
1035
- type: "number",
1036
- min: -2,
1037
- max: 2,
1038
- default: 0,
1039
- description: "Penalize frequent tokens"
1040
- },
1041
- presence_penalty: {
1042
- type: "number",
1043
- min: -2,
1044
- max: 2,
1045
- default: 0,
1046
- description: "Penalize repeated topics"
1047
- },
1048
- stop: { type: "string", description: "Stop sequences" },
1049
- n: { type: "number", min: 1, default: 1, description: "Completions count" },
1050
- random_seed: { type: "number", description: "Random seed" },
1051
- stream: { type: "boolean", default: false, description: "Stream response" },
1052
- safe_prompt: {
1053
- type: "boolean",
1054
- default: false,
1055
- description: "Enable safe prompt"
1056
- },
1057
- min_tokens: {
1058
- type: "number",
1059
- min: 0,
1060
- default: 0,
1061
- description: "Minimum tokens"
1062
- }
1063
- },
1064
- cohere: {
1065
- temperature: {
1066
- type: "number",
1067
- min: 0,
1068
- max: 1,
1069
- default: 0.7,
1070
- description: "Controls randomness"
1071
- },
1072
- max_tokens: {
1073
- type: "number",
1074
- min: 1,
1075
- default: 4096,
1076
- description: "Maximum output tokens"
1077
- },
1078
- p: {
1079
- type: "number",
1080
- min: 0,
1081
- max: 1,
1082
- default: 1,
1083
- description: "Nucleus sampling (p)"
1084
- },
1085
- k: {
1086
- type: "number",
1087
- min: 0,
1088
- max: 500,
1089
- default: 40,
1090
- description: "Top-K sampling (k)"
1091
- },
1092
- frequency_penalty: {
1093
- type: "number",
1094
- min: 0,
1095
- max: 1,
1096
- default: 0,
1097
- description: "Penalize frequent tokens"
1098
- },
1099
- presence_penalty: {
1100
- type: "number",
1101
- min: 0,
1102
- max: 1,
1103
- default: 0,
1104
- description: "Penalize repeated topics"
1105
- },
1106
- stop_sequences: { type: "string", description: "Stop sequences" },
1107
- stream: { type: "boolean", default: false, description: "Stream response" },
1108
- seed: { type: "number", description: "Random seed" }
1109
- },
1110
- bedrock: {
1111
- // Converse API inferenceConfig params
1112
- temperature: {
1113
- type: "number",
1114
- min: 0,
1115
- max: 1,
1116
- default: 0.7,
1117
- description: "Controls randomness"
1118
- },
1119
- maxTokens: {
1120
- type: "number",
1121
- min: 1,
1122
- default: 4096,
1123
- description: "Maximum output tokens"
1124
- },
1125
- topP: {
1126
- type: "number",
1127
- min: 0,
1128
- max: 1,
1129
- default: 1,
1130
- description: "Nucleus sampling"
1131
- },
1132
- topK: {
1133
- type: "number",
1134
- min: 0,
1135
- default: 40,
1136
- description: "Top-K sampling"
1137
- },
1138
- stopSequences: { type: "string", description: "Stop sequences" },
1139
- stream: { type: "boolean", default: false, description: "Stream response" },
1140
- cache_control: {
1141
- type: "string",
1142
- values: ["ephemeral"],
1143
- default: "ephemeral",
1144
- description: "Cache control"
1145
- },
1146
- cache_ttl: {
1147
- type: "string",
1148
- values: ["5m", "1h"],
1149
- default: "5m",
1150
- description: "Cache TTL"
1151
- }
1152
- },
1153
- openrouter: {
1154
- // Loose validation — proxies to many providers with varying ranges
1155
- temperature: {
1156
- type: "number",
1157
- min: 0,
1158
- max: 2,
1159
- default: 0.7,
1160
- description: "Controls randomness"
1161
- },
1162
- max_tokens: {
1163
- type: "number",
1164
- min: 1,
1165
- default: 4096,
1166
- description: "Maximum output tokens"
1167
- },
1168
- max_completion_tokens: {
1169
- type: "number",
1170
- min: 1,
1171
- default: 4096,
1172
- description: "Maximum completion tokens (reasoning models)"
1173
- },
1174
- top_p: {
1175
- type: "number",
1176
- min: 0,
1177
- max: 1,
1178
- default: 1,
1179
- description: "Nucleus sampling"
1180
- },
1181
- top_k: {
1182
- type: "number",
1183
- min: 0,
1184
- default: 40,
1185
- description: "Top-K sampling"
1186
- },
1187
- frequency_penalty: {
1188
- type: "number",
1189
- min: -2,
1190
- max: 2,
1191
- default: 0,
1192
- description: "Penalize frequent tokens"
1193
- },
1194
- presence_penalty: {
1195
- type: "number",
1196
- min: -2,
1197
- max: 2,
1198
- default: 0,
1199
- description: "Penalize repeated topics"
1200
- },
1201
- stop: { type: "string", description: "Stop sequences" },
1202
- n: { type: "number", min: 1, default: 1, description: "Completions count" },
1203
- seed: { type: "number", description: "Random seed" },
1204
- stream: { type: "boolean", default: false, description: "Stream response" },
1205
- reasoning_effort: {
1206
- type: "string",
1207
- values: REASONING_EFFORT_VALUES,
1208
- default: "medium",
1209
- description: "Reasoning effort"
1210
- },
1211
- ...OPENROUTER_ROUTING_PARAM_SPECS
1212
- },
1213
- vercel: {
1214
- // Loose validation — proxies to many providers with varying ranges
1215
- temperature: {
1216
- type: "number",
1217
- min: 0,
1218
- max: 2,
1219
- default: 0.7,
1220
- description: "Controls randomness"
1221
- },
1222
- max_tokens: {
1223
- type: "number",
1224
- min: 1,
1225
- default: 4096,
1226
- description: "Maximum output tokens"
1227
- },
1228
- max_completion_tokens: {
1229
- type: "number",
1230
- min: 1,
1231
- default: 4096,
1232
- description: "Maximum completion tokens (reasoning models)"
1233
- },
1234
- top_p: {
1235
- type: "number",
1236
- min: 0,
1237
- max: 1,
1238
- default: 1,
1239
- description: "Nucleus sampling"
1240
- },
1241
- top_k: {
1242
- type: "number",
1243
- min: 0,
1244
- default: 40,
1245
- description: "Top-K sampling"
1246
- },
1247
- frequency_penalty: {
1248
- type: "number",
1249
- min: -2,
1250
- max: 2,
1251
- default: 0,
1252
- description: "Penalize frequent tokens"
1253
- },
1254
- presence_penalty: {
1255
- type: "number",
1256
- min: -2,
1257
- max: 2,
1258
- default: 0,
1259
- description: "Penalize repeated topics"
1260
- },
1261
- stop: { type: "string", description: "Stop sequences" },
1262
- n: { type: "number", min: 1, default: 1, description: "Completions count" },
1263
- seed: { type: "number", description: "Random seed" },
1264
- stream: { type: "boolean", default: false, description: "Stream response" },
1265
- reasoning_effort: {
1266
- type: "string",
1267
- values: REASONING_EFFORT_VALUES,
1268
- default: "medium",
1269
- description: "Reasoning effort"
1270
- },
1271
- order: { type: "string", description: "Gateway provider order" },
1272
- only: { type: "string", description: "Gateway provider allowlist" },
1273
- models: { type: "string", description: "Gateway fallback models" },
1274
- tags: { type: "string", description: "Gateway usage tags" },
1275
- sort: {
1276
- type: "string",
1277
- values: ["cost", "ttft", "tps"],
1278
- description: "Gateway provider sort strategy"
1279
- },
1280
- caching: {
1281
- type: "string",
1282
- values: ["auto"],
1283
- description: "Gateway automatic caching strategy"
1284
- },
1285
- user: { type: "string", description: "Gateway usage user identifier" },
1286
- byok: { type: "string", description: "Gateway BYOK credentials" },
1287
- zero_data_retention: {
1288
- type: "boolean",
1289
- description: "Gateway zero data retention routing"
1290
- },
1291
- zeroDataRetention: {
1292
- type: "boolean",
1293
- description: "Gateway zero data retention routing"
1294
- },
1295
- disallow_prompt_training: {
1296
- type: "boolean",
1297
- description: "Gateway prompt training opt-out routing"
1298
- },
1299
- disallowPromptTraining: {
1300
- type: "boolean",
1301
- description: "Gateway prompt training opt-out routing"
1302
- },
1303
- hipaa_compliant: {
1304
- type: "boolean",
1305
- description: "Gateway HIPAA-compliant routing"
1306
- },
1307
- hipaaCompliant: {
1308
- type: "boolean",
1309
- description: "Gateway HIPAA-compliant routing"
1310
- },
1311
- quota_entity_id: {
1312
- type: "string",
1313
- description: "Gateway quota entity identifier"
1314
- },
1315
- quotaEntityId: {
1316
- type: "string",
1317
- description: "Gateway quota entity identifier"
1318
- },
1319
- provider_timeouts: {
1320
- type: "string",
1321
- description: "Gateway provider timeouts"
1322
- },
1323
- providerTimeouts: {
1324
- type: "string",
1325
- description: "Gateway provider timeouts"
1326
- }
1327
- },
1328
- xai: OPENAI_COMPATIBLE_PARAM_SPECS,
1329
- groq: OPENAI_COMPATIBLE_PARAM_SPECS,
1330
- fal: FAL_PARAM_SPECS,
1331
- deepinfra: OPENAI_COMPATIBLE_PARAM_SPECS,
1332
- "black-forest-labs": {},
1333
- together: OPENAI_COMPATIBLE_PARAM_SPECS,
1334
- fireworks: OPENAI_COMPATIBLE_PARAM_SPECS,
1335
- deepseek: OPENAI_COMPATIBLE_PARAM_SPECS,
1336
- moonshotai: OPENAI_COMPATIBLE_PARAM_SPECS,
1337
- perplexity: OPENAI_COMPATIBLE_PARAM_SPECS,
1338
- alibaba: OPENAI_COMPATIBLE_PARAM_SPECS,
1339
- cerebras: OPENAI_COMPATIBLE_PARAM_SPECS,
1340
- replicate: REPLICATE_PARAM_SPECS,
1341
- prodia: PRODIA_PARAM_SPECS,
1342
- luma: LUMA_PARAM_SPECS,
1343
- bytedance: {},
1344
- kling: {},
1345
- elevenlabs: {},
1346
- assemblyai: {},
1347
- deepgram: {},
1348
- gladia: {},
1349
- lmnt: {},
1350
- hume: {},
1351
- revai: {},
1352
- baseten: OPENAI_COMPATIBLE_PARAM_SPECS,
1353
- huggingface: OPENAI_COMPATIBLE_PARAM_SPECS
1354
- };
1355
- function isReasoningModel(model) {
1356
- const name = modelLeafName(model);
1357
- const oSeries = name.match(/^o\d+/)?.[0];
1358
- const gptSeries = name.match(/^gpt-[5-9]/)?.[0];
1359
- return (oSeries ? modelMatchesFamily(name, oSeries) : false) || (gptSeries ? modelMatchesFamily(name, gptSeries) : false);
1360
- }
1361
- function canHostOpenAIModels(provider) {
1362
- return provider === "openai" || provider === "azure" || provider === "openrouter" || provider === "vercel";
1363
- }
1364
- function isGatewayProvider(provider) {
1365
- return provider === "openrouter" || provider === "vercel";
1366
- }
1367
- function detectGatewaySubProvider(model) {
1368
- const slash = model.indexOf("/");
1369
- if (slash < 1) return void 0;
1370
- const prefix = normalizeModelForMatching(model.slice(0, slash));
1371
- const direct = {
1372
- openai: "openai",
1373
- anthropic: "anthropic",
1374
- google: "google",
1375
- vertex: "google",
1376
- "google-vertex": "google",
1377
- mistral: "mistral",
1378
- cohere: "cohere"
1379
- };
1380
- return direct[prefix];
1381
- }
1382
- var REASONING_MODEL_UNSUPPORTED = /* @__PURE__ */ new Set([
1383
- "temperature",
1384
- "top_p",
1385
- "top_k",
1386
- "frequency_penalty",
1387
- "presence_penalty",
1388
- "n"
1389
- ]);
1390
- function detectBedrockModelFamily(model) {
1391
- const families = [
1392
- "anthropic",
1393
- "meta",
1394
- "amazon",
1395
- "mistral",
1396
- "cohere",
1397
- "ai21"
1398
- ];
1399
- const parts = modelLeafName(model).split(".");
1400
- return families.find((family) => parts.includes(family));
1401
- }
1402
- function bedrockSupportsCaching(model) {
1403
- const family = detectBedrockModelFamily(model);
1404
- if (family === "anthropic") return true;
1405
- if (family === "amazon") {
1406
- const parts = modelLeafName(model).split(".");
1407
- const amazonIndex = parts.indexOf("amazon");
1408
- const modelName = amazonIndex >= 0 ? parts[amazonIndex + 1] : void 0;
1409
- return modelName ? modelMatchesFamily(modelName, "nova") : false;
1410
- }
1411
- return false;
1412
- }
1413
- var CACHE_VALUES = {
1414
- openai: void 0,
1415
- // OpenAI auto-caches; no explicit param
1416
- azure: void 0,
1417
- anthropic: "ephemeral",
1418
- google: void 0,
1419
- // Google uses explicit caching API, not a param
1420
- "google-vertex": void 0,
1421
- mistral: void 0,
1422
- cohere: void 0,
1423
- bedrock: "ephemeral",
1424
- // Supported for Claude models on Bedrock
1425
- openrouter: void 0,
1426
- // Depends on underlying provider
1427
- vercel: void 0,
1428
- // Depends on underlying provider
1429
- xai: void 0,
1430
- groq: void 0,
1431
- fal: void 0,
1432
- deepinfra: void 0,
1433
- "black-forest-labs": void 0,
1434
- together: void 0,
1435
- fireworks: void 0,
1436
- deepseek: void 0,
1437
- moonshotai: void 0,
1438
- perplexity: void 0,
1439
- alibaba: void 0,
1440
- cerebras: void 0,
1441
- replicate: void 0,
1442
- prodia: void 0,
1443
- luma: void 0,
1444
- bytedance: void 0,
1445
- kling: void 0,
1446
- elevenlabs: void 0,
1447
- assemblyai: void 0,
1448
- deepgram: void 0,
1449
- gladia: void 0,
1450
- lmnt: void 0,
1451
- hume: void 0,
1452
- revai: void 0,
1453
- baseten: void 0,
1454
- huggingface: void 0
1455
- };
1456
- var CACHE_TTLS = {
1457
- openai: void 0,
1458
- azure: void 0,
1459
- anthropic: ["5m", "1h"],
1460
- google: void 0,
1461
- "google-vertex": void 0,
1462
- mistral: void 0,
1463
- cohere: void 0,
1464
- bedrock: ["5m", "1h"],
1465
- // Claude on Bedrock uses same TTLs as direct Anthropic
1466
- openrouter: void 0,
1467
- vercel: void 0,
1468
- xai: void 0,
1469
- groq: void 0,
1470
- fal: void 0,
1471
- deepinfra: void 0,
1472
- "black-forest-labs": void 0,
1473
- together: void 0,
1474
- fireworks: void 0,
1475
- deepseek: void 0,
1476
- moonshotai: void 0,
1477
- perplexity: void 0,
1478
- alibaba: void 0,
1479
- cerebras: void 0,
1480
- replicate: void 0,
1481
- prodia: void 0,
1482
- luma: void 0,
1483
- bytedance: void 0,
1484
- kling: void 0,
1485
- elevenlabs: void 0,
1486
- assemblyai: void 0,
1487
- deepgram: void 0,
1488
- gladia: void 0,
1489
- lmnt: void 0,
1490
- hume: void 0,
1491
- revai: void 0,
1492
- baseten: void 0,
1493
- huggingface: void 0
1494
- };
1495
-
1496
- // src/normalize.ts
1497
- var DURATION_RE = /^\d+[mh]$/;
1498
- function normalize(config, options = {}) {
1499
- const provider = (config.hostAlias ? providerFromHostAlias(config.hostAlias) : void 0) ?? detectProvider(config.host);
1500
- const subProvider = provider && isGatewayProvider(provider) ? detectGatewaySubProvider(config.model) : void 0;
1501
- const changes = [];
1502
- const params = {};
1503
- for (const [rawKey, value] of Object.entries(config.params)) {
1504
- let key = rawKey;
1505
- if (ALIASES[key]) {
1506
- const canonical = ALIASES[key];
1507
- if (options.verbose) {
1508
- changes.push({
1509
- from: key,
1510
- to: canonical,
1511
- value,
1512
- reason: `alias: "${key}" \u2192 "${canonical}"`
1513
- });
1514
- }
1515
- key = canonical;
1516
- }
1517
- if (key === "cache" && provider) {
1518
- let cacheValue = CACHE_VALUES[provider];
1519
- if (provider === "bedrock" && !bedrockSupportsCaching(config.model)) {
1520
- cacheValue = void 0;
1521
- }
1522
- if (!cacheValue) {
1523
- if (options.verbose) {
1524
- changes.push({
1525
- from: "cache",
1526
- to: "(dropped)",
1527
- value,
1528
- reason: `${provider} does not use a cache param for this model (caching is automatic or unsupported)`
1529
- });
1530
- }
1531
- continue;
1532
- }
1533
- const isBool = value === "true" || value === "1" || value === "yes";
1534
- const isDuration = DURATION_RE.test(value);
1535
- if (isBool || isDuration) {
1536
- const providerKey = PROVIDER_PARAMS[provider]?.["cache"] ?? "cache";
1537
- if (options.verbose) {
1538
- changes.push({
1539
- from: "cache",
1540
- to: providerKey,
1541
- value: cacheValue,
1542
- reason: `cache=${value} \u2192 ${providerKey}=${cacheValue} for ${provider}`
1543
- });
1544
- }
1545
- params[providerKey] = cacheValue;
1546
- if (isDuration && CACHE_TTLS[provider]) {
1547
- if (options.verbose) {
1548
- changes.push({
1549
- from: "cache",
1550
- to: "cache_ttl",
1551
- value,
1552
- reason: `cache=${value} \u2192 cache_ttl=${value} for ${provider}`
1553
- });
1554
- }
1555
- params["cache_ttl"] = value;
1556
- }
1557
- continue;
1558
- }
1559
- }
1560
- if (provider && PROVIDER_PARAMS[provider]) {
1561
- const providerKey = PROVIDER_PARAMS[provider][key];
1562
- if (providerKey && providerKey !== key) {
1563
- if (options.verbose) {
1564
- changes.push({
1565
- from: key,
1566
- to: providerKey,
1567
- value,
1568
- reason: `${provider} uses "${providerKey}" instead of "${key}"`
1569
- });
1570
- }
1571
- key = providerKey;
1572
- }
1573
- }
1574
- if (provider && canHostOpenAIModels(provider) && isReasoningModel(config.model) && key === "max_tokens") {
1575
- if (options.verbose) {
1576
- changes.push({
1577
- from: "max_tokens",
1578
- to: "max_completion_tokens",
1579
- value,
1580
- reason: "OpenAI reasoning models use max_completion_tokens instead of max_tokens"
1581
- });
1582
- }
1583
- key = "max_completion_tokens";
1584
- }
1585
- if (provider && canHostOpenAIModels(provider) && isReasoningModel(config.model) && REASONING_MODEL_UNSUPPORTED.has(key)) {
1586
- if (options.verbose) {
1587
- changes.push({
1588
- from: key,
1589
- to: "(dropped)",
1590
- value,
1591
- reason: `${provider} reasoning model "${config.model}" does not support "${key}"`
1592
- });
1593
- }
1594
- continue;
1595
- }
1596
- params[key] = value;
1597
- }
1598
- return {
1599
- config: { ...config, params },
1600
- provider,
1601
- subProvider,
1602
- changes
1603
- };
1604
- }
1605
-
1606
- // src/parse.ts
1607
- function parse(connectionString) {
1608
- const url = new URL(connectionString);
1609
- if (url.protocol !== "llm:") {
1610
- throw new Error(
1611
- `Invalid scheme: expected "llm://", got "${url.protocol}//"`
1612
- );
1613
- }
1614
- const { host, alias: hostAlias } = resolveHostAlias(url.host);
1615
- const model = url.pathname.replace(/^\//, "");
1616
- const label = url.username || void 0;
1617
- const apiKey = url.password || void 0;
1618
- const params = {};
1619
- for (const [key, value] of url.searchParams) {
1620
- params[key] = value;
1621
- }
1622
- return {
1623
- raw: connectionString,
1624
- host,
1625
- hostAlias,
1626
- model,
1627
- label,
1628
- apiKey,
1629
- params
1630
- };
1631
- }
1632
-
1633
- // src/ai-sdk.ts
1634
- var PROVIDER_OPTION_KEYS = {
1635
- openai: "openai",
1636
- azure: "azure",
1637
- anthropic: "anthropic",
1638
- google: "google",
1639
- "google-vertex": "vertex",
1640
- mistral: "mistral",
1641
- cohere: "cohere",
1642
- bedrock: "bedrock",
1643
- openrouter: "openrouter",
1644
- vercel: "gateway",
1645
- xai: "xai",
1646
- groq: "groq",
1647
- fal: "fal",
1648
- deepinfra: "deepinfra",
1649
- "black-forest-labs": "blackForestLabs",
1650
- together: "together",
1651
- fireworks: "fireworks",
1652
- deepseek: "deepseek",
1653
- moonshotai: "moonshotai",
1654
- perplexity: "perplexity",
1655
- alibaba: "alibaba",
1656
- cerebras: "cerebras",
1657
- replicate: "replicate",
1658
- prodia: "prodia",
1659
- luma: "luma",
1660
- bytedance: "bytedance",
1661
- kling: "kling",
1662
- elevenlabs: "elevenlabs",
1663
- assemblyai: "assemblyai",
1664
- deepgram: "deepgram",
1665
- gladia: "gladia",
1666
- lmnt: "lmnt",
1667
- hume: "hume",
1668
- revai: "revai",
1669
- baseten: "baseten",
1670
- huggingface: "huggingface"
1671
- };
1672
- var TRUE_VALUES = /* @__PURE__ */ new Set(["true", "1", "yes", "on"]);
1673
- var FALSE_VALUES = /* @__PURE__ */ new Set(["false", "0", "no", "off"]);
1674
- function providerOptionsKey(provider) {
1675
- return PROVIDER_OPTION_KEYS[provider];
1676
- }
1677
- function setProviderOption(options, provider, key, value) {
1678
- options[provider] ?? (options[provider] = {});
1679
- options[provider][key] = value;
1680
- }
1681
- function parseBoolean(value) {
1682
- const normalized = value.trim().toLowerCase();
1683
- if (TRUE_VALUES.has(normalized)) return true;
1684
- if (FALSE_VALUES.has(normalized)) return false;
1685
- return void 0;
1686
- }
1687
- function parseNumber(value) {
1688
- if (!value.trim()) return void 0;
1689
- const parsed = Number(value);
1690
- return Number.isFinite(parsed) ? parsed : void 0;
1691
- }
1692
- function parseJson(value) {
1693
- try {
1694
- return JSON.parse(value);
1695
- } catch {
1696
- return void 0;
1697
- }
1698
- }
1699
- function parseStringList(value) {
1700
- const json = parseJson(value);
1701
- if (Array.isArray(json)) {
1702
- return json.filter((item) => typeof item === "string");
1703
- }
1704
- return value.split(",").map((item) => item.trim()).filter(Boolean);
1705
- }
1706
- function typedValue(value) {
1707
- const booleanValue = parseBoolean(value);
1708
- if (booleanValue !== void 0) return booleanValue;
1709
- const numberValue = parseNumber(value);
1710
- if (numberValue !== void 0) return numberValue;
1711
- const jsonValue = parseJson(value);
1712
- if (jsonValue !== void 0) return jsonValue;
1713
- return value;
1714
- }
1715
- function mergeObjectOption(options, provider, key, value) {
1716
- const parsed = parseJson(value);
1717
- if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
1718
- setProviderOption(options, provider, key, parsed);
1719
- }
1720
- }
1721
- function addOpenAiOption(options, key, value, target = "openai") {
1722
- const mappings = {
1723
- reasoning_effort: "reasoningEffort",
1724
- max_completion_tokens: "maxCompletionTokens",
1725
- parallel_tool_calls: "parallelToolCalls",
1726
- service_tier: "serviceTier",
1727
- strict_json_schema: "strictJsonSchema",
1728
- text_verbosity: "textVerbosity",
1729
- prompt_cache_key: "promptCacheKey",
1730
- prompt_cache_retention: "promptCacheRetention",
1731
- safety_identifier: "safetyIdentifier",
1732
- system_message_mode: "systemMessageMode",
1733
- force_reasoning: "forceReasoning",
1734
- reasoning_summary: "reasoningSummary",
1735
- previous_response_id: "previousResponseId",
1736
- max_tool_calls: "maxToolCalls",
1737
- allowed_tools: "allowedTools"
1738
- };
1739
- const directKeys = /* @__PURE__ */ new Set([
1740
- "conversation",
1741
- "instructions",
1742
- "logprobs",
1743
- "metadata",
1744
- "prediction",
1745
- "store",
1746
- "truncation",
1747
- "user"
1748
- ]);
1749
- if (!mappings[key] && !directKeys.has(key) && key !== "include") return;
1750
- const optionKey = mappings[key] ?? key;
1751
- if (key === "include") {
1752
- setProviderOption(options, target, optionKey, parseStringList(value));
1753
- return;
1754
- }
1755
- if (key === "metadata" || key === "prediction" || key === "allowed_tools") {
1756
- mergeObjectOption(options, target, optionKey, value);
1757
- return;
1758
- }
1759
- setProviderOption(options, target, optionKey, typedValue(value));
1760
- }
1761
- function addAnthropicOption(options, key, value) {
1762
- const target = "anthropic";
1763
- if (key === "cache_control" || key === "cacheControl") {
1764
- const ttl = options[target]?.cacheControl;
1765
- const ttlValue = ttl && typeof ttl === "object" && "ttl" in ttl ? ttl.ttl : void 0;
1766
- setProviderOption(options, target, "cacheControl", {
1767
- type: value === "ephemeral" ? "ephemeral" : value,
1768
- ...ttlValue ? { ttl: ttlValue } : {}
1769
- });
1770
- return;
1771
- }
1772
- if (key === "cache_ttl") {
1773
- const current = options[target]?.cacheControl;
1774
- setProviderOption(options, target, "cacheControl", {
1775
- ...current && typeof current === "object" ? current : {},
1776
- type: "ephemeral",
1777
- ttl: value
1778
- });
1779
- return;
1780
- }
1781
- if (key === "thinking") {
1782
- mergeObjectOption(options, target, "thinking", value);
1783
- return;
1784
- }
1785
- if (key === "thinking_budget" || key === "budget_tokens") {
1786
- const budgetTokens = parseNumber(value);
1787
- if (budgetTokens !== void 0) {
1788
- setProviderOption(options, target, "thinking", {
1789
- type: "enabled",
1790
- budgetTokens
1791
- });
1792
- }
1793
- return;
1794
- }
1795
- const mappings = {
1796
- send_reasoning: "sendReasoning",
1797
- structured_output_mode: "structuredOutputMode",
1798
- disable_parallel_tool_use: "disableParallelToolUse",
1799
- tool_streaming: "toolStreaming",
1800
- inference_geo: "inferenceGeo",
1801
- anthropic_beta: "anthropicBeta",
1802
- mcp_servers: "mcpServers",
1803
- task_budget: "taskBudget",
1804
- context_management: "contextManagement"
1805
- };
1806
- const directKeys = /* @__PURE__ */ new Set([
1807
- "effort",
1808
- "speed",
1809
- "sendReasoning",
1810
- "structuredOutputMode",
1811
- "disableParallelToolUse",
1812
- "toolStreaming",
1813
- "inferenceGeo",
1814
- "anthropicBeta",
1815
- "metadata",
1816
- "mcpServers",
1817
- "container",
1818
- "taskBudget",
1819
- "contextManagement"
1820
- ]);
1821
- if (!mappings[key] && !directKeys.has(key)) return;
1822
- const optionKey = mappings[key] ?? key;
1823
- if (key === "anthropic_beta") {
1824
- setProviderOption(options, target, optionKey, parseStringList(value));
1825
- return;
1826
- }
1827
- if (key === "metadata" || key === "mcp_servers" || key === "container" || key === "task_budget" || key === "context_management") {
1828
- mergeObjectOption(options, target, optionKey, value);
1829
- return;
1830
- }
1831
- setProviderOption(options, target, optionKey, typedValue(value));
1832
- }
1833
- function addGoogleOption(options, key, value, target = "google") {
1834
- if (key === "thinking_budget" || key === "thinking_level" || key === "include_thoughts") {
1835
- const current = options[target]?.thinkingConfig;
1836
- const thinkingConfig = current && typeof current === "object" && !Array.isArray(current) ? { ...current } : {};
1837
- if (key === "thinking_budget") {
1838
- const parsed = parseNumber(value);
1839
- if (parsed !== void 0) thinkingConfig.thinkingBudget = parsed;
1840
- }
1841
- if (key === "thinking_level") thinkingConfig.thinkingLevel = value;
1842
- if (key === "include_thoughts") {
1843
- const parsed = parseBoolean(value);
1844
- if (parsed !== void 0) thinkingConfig.includeThoughts = parsed;
1845
- }
1846
- setProviderOption(options, target, "thinkingConfig", thinkingConfig);
1847
- return;
1848
- }
1849
- const mappings = {
1850
- cached_content: "cachedContent",
1851
- structured_outputs: "structuredOutputs",
1852
- safety_settings: "safetySettings",
1853
- response_modalities: "responseModalities",
1854
- audio_timestamp: "audioTimestamp",
1855
- media_resolution: "mediaResolution",
1856
- image_config: "imageConfig",
1857
- retrieval_config: "retrievalConfig",
1858
- stream_function_call_arguments: "streamFunctionCallArguments",
1859
- service_tier: "serviceTier"
1860
- };
1861
- const directKeys = /* @__PURE__ */ new Set([
1862
- "cachedContent",
1863
- "structuredOutputs",
1864
- "safetySettings",
1865
- "threshold",
1866
- "audioTimestamp",
1867
- "labels",
1868
- "mediaResolution",
1869
- "imageConfig",
1870
- "retrievalConfig",
1871
- "responseModalities",
1872
- "streamFunctionCallArguments",
1873
- "serviceTier"
1874
- ]);
1875
- if (!mappings[key] && !directKeys.has(key)) return;
1876
- const optionKey = mappings[key] ?? key;
1877
- if (key === "response_modalities") {
1878
- setProviderOption(options, target, optionKey, parseStringList(value));
1879
- return;
1880
- }
1881
- if (key === "safety_settings" || key === "labels" || key === "image_config" || key === "retrieval_config") {
1882
- mergeObjectOption(options, target, optionKey, value);
1883
- return;
1884
- }
1885
- setProviderOption(options, target, optionKey, typedValue(value));
1886
- }
1887
- function addMistralOption(options, key, value) {
1888
- const target = "mistral";
1889
- const mappings = {
1890
- safe_prompt: "safePrompt",
1891
- document_image_limit: "documentImageLimit",
1892
- document_page_limit: "documentPageLimit",
1893
- structured_outputs: "structuredOutputs",
1894
- strict_json_schema: "strictJsonSchema",
1895
- parallel_tool_calls: "parallelToolCalls",
1896
- reasoning_effort: "reasoningEffort"
1897
- };
1898
- const directKeys = /* @__PURE__ */ new Set([
1899
- "safePrompt",
1900
- "documentImageLimit",
1901
- "documentPageLimit",
1902
- "structuredOutputs",
1903
- "strictJsonSchema",
1904
- "parallelToolCalls",
1905
- "reasoningEffort"
1906
- ]);
1907
- if (!mappings[key] && !directKeys.has(key)) return;
1908
- const optionKey = mappings[key] ?? key;
1909
- setProviderOption(options, target, optionKey, typedValue(value));
1910
- }
1911
- function addCohereOption(options, key, value) {
1912
- const target = "cohere";
1913
- if (key === "thinking") {
1914
- mergeObjectOption(options, target, "thinking", value);
1915
- return;
1916
- }
1917
- if (key === "thinking_token_budget" || key === "token_budget") {
1918
- const tokenBudget = parseNumber(value);
1919
- if (tokenBudget !== void 0) {
1920
- setProviderOption(options, target, "thinking", {
1921
- type: "enabled",
1922
- tokenBudget
1923
- });
1924
- }
1925
- return;
1926
- }
1927
- if (key === "thinking_type") {
1928
- const current = options[target]?.thinking;
1929
- setProviderOption(options, target, "thinking", {
1930
- ...current && typeof current === "object" ? current : {},
1931
- type: value
1932
- });
1933
- }
1934
- }
1935
- function addBedrockOption(options, key, value) {
1936
- const target = "bedrock";
1937
- if (key === "cache_control") {
1938
- setProviderOption(options, target, "cachePoint", {
1939
- type: value === "ephemeral" ? "default" : value
1940
- });
1941
- return;
1942
- }
1943
- if (key === "cache_ttl") {
1944
- const current = options[target]?.cachePoint;
1945
- setProviderOption(options, target, "cachePoint", {
1946
- ...current && typeof current === "object" ? current : {},
1947
- type: "default",
1948
- ttl: value
1949
- });
1950
- return;
1951
- }
1952
- if (key === "reasoning_config") {
1953
- mergeObjectOption(options, target, "reasoningConfig", value);
1954
- return;
1955
- }
1956
- if (key === "budget_tokens" || key === "reasoning_effort") {
1957
- const current = options[target]?.reasoningConfig;
1958
- const reasoningConfig = current && typeof current === "object" && !Array.isArray(current) ? { ...current } : {};
1959
- reasoningConfig.type = "enabled";
1960
- if (key === "budget_tokens") {
1961
- const budgetTokens = parseNumber(value);
1962
- if (budgetTokens !== void 0)
1963
- reasoningConfig.budgetTokens = budgetTokens;
1964
- }
1965
- if (key === "reasoning_effort") reasoningConfig.maxReasoningEffort = value;
1966
- setProviderOption(options, target, "reasoningConfig", reasoningConfig);
1967
- return;
1968
- }
1969
- const mappings = {
1970
- additional_model_request_fields: "additionalModelRequestFields",
1971
- anthropic_beta: "anthropicBeta",
1972
- service_tier: "serviceTier"
1973
- };
1974
- const directKeys = /* @__PURE__ */ new Set([
1975
- "additionalModelRequestFields",
1976
- "anthropicBeta",
1977
- "serviceTier"
1978
- ]);
1979
- if (!mappings[key] && !directKeys.has(key)) return;
1980
- const optionKey = mappings[key] ?? key;
1981
- if (key === "additional_model_request_fields") {
1982
- mergeObjectOption(options, target, optionKey, value);
1983
- return;
1984
- }
1985
- if (key === "anthropic_beta") {
1986
- setProviderOption(options, target, optionKey, parseStringList(value));
1987
- return;
1988
- }
1989
- setProviderOption(options, target, optionKey, typedValue(value));
1990
- }
1991
- function addGatewayOption(options, key, value) {
1992
- const target = "gateway";
1993
- const listKeys = /* @__PURE__ */ new Set(["only", "order", "tags", "models"]);
1994
- const objectKeys = /* @__PURE__ */ new Set(["byok", "provider_timeouts"]);
1995
- const mappings = {
1996
- zero_data_retention: "zeroDataRetention",
1997
- disallow_prompt_training: "disallowPromptTraining",
1998
- hipaa_compliant: "hipaaCompliant",
1999
- quota_entity_id: "quotaEntityId",
2000
- provider_timeouts: "providerTimeouts"
2001
- };
2002
- const directKeys = /* @__PURE__ */ new Set([
2003
- "sort",
2004
- "caching",
2005
- "user",
2006
- "zeroDataRetention",
2007
- "disallowPromptTraining",
2008
- "hipaaCompliant",
2009
- "quotaEntityId",
2010
- "providerTimeouts"
2011
- ]);
2012
- if (!mappings[key] && !directKeys.has(key) && !listKeys.has(key) && !objectKeys.has(key)) {
2013
- return;
2014
- }
2015
- const optionKey = mappings[key] ?? key;
2016
- if (listKeys.has(key)) {
2017
- setProviderOption(options, target, optionKey, parseStringList(value));
2018
- return;
2019
- }
2020
- if (objectKeys.has(key)) {
2021
- mergeObjectOption(options, target, optionKey, value);
2022
- return;
2023
- }
2024
- setProviderOption(options, target, optionKey, typedValue(value));
2025
- }
2026
- function addOpenRouterOption(options, key, value) {
2027
- const target = "openrouter";
2028
- const providerKey = key.startsWith("provider.") ? key.slice(9) : key;
2029
- const providerListKeys = /* @__PURE__ */ new Set([
2030
- "order",
2031
- "only",
2032
- "ignore",
2033
- "quantizations"
2034
- ]);
2035
- const providerObjectKeys = /* @__PURE__ */ new Set([
2036
- "provider",
2037
- "sort",
2038
- "preferred_min_throughput",
2039
- "preferred_max_latency",
2040
- "max_price"
2041
- ]);
2042
- const providerScalarKeys = /* @__PURE__ */ new Set([
2043
- "allow_fallbacks",
2044
- "require_parameters",
2045
- "data_collection",
2046
- "zdr",
2047
- "enforce_distillable_text"
2048
- ]);
2049
- if (key === "models") {
2050
- setProviderOption(options, target, "models", parseStringList(value));
2051
- return;
2052
- }
2053
- if (key === "transforms") {
2054
- setProviderOption(options, target, "transforms", parseStringList(value));
2055
- return;
2056
- }
2057
- if (key === "plugins") {
2058
- const parsed = parseJson(value);
2059
- setProviderOption(
2060
- options,
2061
- target,
2062
- "plugins",
2063
- Array.isArray(parsed) ? parsed : parseStringList(value)
2064
- );
2065
- return;
2066
- }
2067
- if (key.startsWith("provider.") || providerListKeys.has(providerKey) || providerScalarKeys.has(providerKey) || providerObjectKeys.has(providerKey)) {
2068
- if (providerKey === "provider") {
2069
- mergeObjectOption(options, target, "provider", value);
2070
- return;
2071
- }
2072
- const current = options[target]?.provider;
2073
- const providerOptions = current && typeof current === "object" && !Array.isArray(current) ? { ...current } : {};
2074
- if (providerListKeys.has(providerKey)) {
2075
- providerOptions[providerKey] = parseStringList(value);
2076
- } else if (providerObjectKeys.has(providerKey)) {
2077
- const parsed = parseJson(value);
2078
- providerOptions[providerKey] = parsed !== void 0 ? parsed : typedValue(value);
2079
- } else {
2080
- providerOptions[providerKey] = typedValue(value);
2081
- }
2082
- setProviderOption(options, target, "provider", providerOptions);
2083
- return;
2084
- }
2085
- if (key === "reasoning") {
2086
- mergeObjectOption(options, target, "reasoning", value);
2087
- return;
2088
- }
2089
- if (key === "reasoning_effort") {
2090
- const current = options[target]?.reasoning;
2091
- setProviderOption(options, target, "reasoning", {
2092
- ...current && typeof current === "object" ? current : {},
2093
- effort: value
2094
- });
2095
- return;
2096
- }
2097
- if (key === "reasoning_max_tokens" || key === "max_reasoning_tokens") {
2098
- const current = options[target]?.reasoning;
2099
- const maxTokens = parseNumber(value);
2100
- if (maxTokens !== void 0) {
2101
- setProviderOption(options, target, "reasoning", {
2102
- ...current && typeof current === "object" ? current : {},
2103
- max_tokens: maxTokens
2104
- });
2105
- }
2106
- return;
2107
- }
2108
- if (key === "reasoning_enabled" || key === "reasoning_exclude") {
2109
- const current = options[target]?.reasoning;
2110
- const parsed = parseBoolean(value);
2111
- if (parsed !== void 0) {
2112
- setProviderOption(options, target, "reasoning", {
2113
- ...current && typeof current === "object" ? current : {},
2114
- [key === "reasoning_enabled" ? "enabled" : "exclude"]: parsed
2115
- });
2116
- }
2117
- return;
2118
- }
2119
- if (key === "user") {
2120
- setProviderOption(options, target, "user", value);
2121
- }
2122
- }
2123
- function addFlexibleProviderOption(options, target, key, value) {
2124
- setProviderOption(options, target, key, typedValue(value));
2125
- }
2126
- var PROVIDER_OPTION_HANDLERS = {
2127
- openai: addOpenAiOption,
2128
- azure: (options, key, value) => addOpenAiOption(options, key, value, "azure"),
2129
- anthropic: addAnthropicOption,
2130
- google: addGoogleOption,
2131
- "google-vertex": (options, key, value) => addGoogleOption(options, key, value, "vertex"),
2132
- mistral: addMistralOption,
2133
- cohere: addCohereOption,
2134
- bedrock: addBedrockOption,
2135
- openrouter: addOpenRouterOption,
2136
- xai: (options, key, value) => addOpenAiOption(options, key, value, "xai"),
2137
- groq: (options, key, value) => addOpenAiOption(options, key, value, "groq"),
2138
- fal: (options, key, value) => addFlexibleProviderOption(options, "fal", key, value),
2139
- deepinfra: (options, key, value) => addOpenAiOption(options, key, value, "deepinfra"),
2140
- "black-forest-labs": (options, key, value) => addFlexibleProviderOption(options, "blackForestLabs", key, value),
2141
- together: (options, key, value) => addOpenAiOption(options, key, value, "together"),
2142
- fireworks: (options, key, value) => addOpenAiOption(options, key, value, "fireworks"),
2143
- deepseek: (options, key, value) => addOpenAiOption(options, key, value, "deepseek"),
2144
- moonshotai: (options, key, value) => addOpenAiOption(options, key, value, "moonshotai"),
2145
- perplexity: (options, key, value) => addOpenAiOption(options, key, value, "perplexity"),
2146
- alibaba: (options, key, value) => addOpenAiOption(options, key, value, "alibaba"),
2147
- cerebras: (options, key, value) => addOpenAiOption(options, key, value, "cerebras"),
2148
- replicate: (options, key, value) => addFlexibleProviderOption(options, "replicate", key, value),
2149
- prodia: (options, key, value) => addFlexibleProviderOption(options, "prodia", key, value),
2150
- luma: (options, key, value) => addFlexibleProviderOption(options, "luma", key, value),
2151
- bytedance: (options, key, value) => addFlexibleProviderOption(options, "bytedance", key, value),
2152
- kling: (options, key, value) => addFlexibleProviderOption(options, "kling", key, value),
2153
- elevenlabs: (options, key, value) => addFlexibleProviderOption(options, "elevenlabs", key, value),
2154
- assemblyai: (options, key, value) => addFlexibleProviderOption(options, "assemblyai", key, value),
2155
- deepgram: (options, key, value) => addFlexibleProviderOption(options, "deepgram", key, value),
2156
- gladia: (options, key, value) => addFlexibleProviderOption(options, "gladia", key, value),
2157
- lmnt: (options, key, value) => addFlexibleProviderOption(options, "lmnt", key, value),
2158
- hume: (options, key, value) => addFlexibleProviderOption(options, "hume", key, value),
2159
- revai: (options, key, value) => addFlexibleProviderOption(options, "revai", key, value),
2160
- baseten: (options, key, value) => addOpenAiOption(options, key, value, "baseten"),
2161
- huggingface: (options, key, value) => addOpenAiOption(options, key, value, "huggingface")
2162
- };
2163
- function addProviderSpecificOption(options, provider, key, value, includeGatewayOptions) {
2164
- if (provider === "vercel") {
2165
- if (includeGatewayOptions) addGatewayOption(options, key, value);
2166
- return;
2167
- }
2168
- PROVIDER_OPTION_HANDLERS[provider](options, key, value);
2169
- }
2170
- function createAiSdkProviderOptions(configOrResult, options = {}) {
2171
- const normalized = typeof configOrResult === "string" ? normalize(parse(configOrResult), options) : "changes" in configOrResult && "subProvider" in configOrResult ? configOrResult : normalize(configOrResult, options);
2172
- const providerOptions = {};
2173
- if (!normalized.provider) {
2174
- return {
2175
- provider: normalized.provider,
2176
- subProvider: normalized.subProvider,
2177
- providerOptions
2178
- };
2179
- }
2180
- const includeGatewayOptions = options.includeGatewayOptions ?? normalized.provider === "vercel";
2181
- for (const [key, value] of Object.entries(normalized.config.params)) {
2182
- addProviderSpecificOption(
2183
- providerOptions,
2184
- normalized.provider,
2185
- key,
2186
- value,
2187
- includeGatewayOptions
2188
- );
2189
- }
2190
- if (normalized.provider !== "vercel" && !providerOptions[providerOptionsKey(normalized.provider)]) {
2191
- return {
2192
- provider: normalized.provider,
2193
- subProvider: normalized.subProvider,
2194
- providerOptions: {}
2195
- };
2196
- }
2197
- return {
2198
- provider: normalized.provider,
2199
- subProvider: normalized.subProvider,
2200
- providerOptions
2201
- };
2202
- }
2203
- // Annotate the CommonJS export names for ESM import in node:
2204
- 0 && (module.exports = {
2205
- createAiSdkProviderOptions
2206
- });
1
+ "use strict";var e,t=Object.defineProperty,o=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,i={};function a(e,t){return Object.prototype.hasOwnProperty.call(e,t)}((e,o)=>{for(var r in o)t(e,r,{get:o[r],enumerable:!0})})(i,{createAiSdkProviderOptions:()=>Z}),module.exports=(e=i,((e,i,a,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let p of r(i))n.call(e,p)||p===a||t(e,p,{get:()=>i[p],enumerable:!(s=o(i,p))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={openai:"api.openai.com",azure:"models.inference.ai.azure.com",anthropic:"api.anthropic.com",google:"generativelanguage.googleapis.com","google-vertex":"aiplatform.googleapis.com",aistudio:"generativelanguage.googleapis.com",mistral:"api.mistral.ai",cohere:"api.cohere.com",bedrock:"bedrock-runtime.us-east-1.amazonaws.com",openrouter:"openrouter.ai",vercel:"gateway.ai.vercel.app",alibaba:"dashscope-intl.aliyuncs.com",alibabacloud:"dashscope-intl.aliyuncs.com",dashscope:"dashscope-intl.aliyuncs.com",groq:"api.groq.com",fal:"fal.run",fireworks:"api.fireworks.ai",fireworksai:"api.fireworks.ai","black-forest-labs":"api.bfl.ai",bfl:"api.bfl.ai",deepseek:"api.deepseek.com",moonshotai:"api.moonshot.ai",moonshot:"api.moonshot.ai",perplexity:"api.perplexity.ai",venice:"api.venice.ai",parasail:"api.parasail.io",deepinfra:"api.deepinfra.com",atlascloud:"api.atlascloud.ai",novita:"api.novita.ai",novitaai:"api.novita.ai",grok:"api.x.ai",xai:"api.x.ai",together:"api.together.xyz",togetherai:"api.together.xyz",cerebras:"api.cerebras.ai",replicate:"api.replicate.com",prodia:"api.prodia.com",luma:"api.lumalabs.ai",bytedance:"ark.cn-beijing.volces.com",kling:"api.klingai.com",elevenlabs:"api.elevenlabs.io",assemblyai:"api.assemblyai.com",deepgram:"api.deepgram.com",gladia:"api.gladia.io",lmnt:"api.lmnt.com",hume:"api.hume.ai",revai:"api.rev.ai",baseten:"api.baseten.co",huggingface:"api-inference.huggingface.co",wandb:"api.inference.wandb.ai",weightsandbiases:"api.inference.wandb.ai",baidu:"qianfan.baidubce.com",qianfan:"qianfan.baidubce.com",vertex:"aiplatform.googleapis.com",xiaomi:"api.xiaomimimo.com",minimax:"api.minimax.io"},p={aistudio:"google",vertex:"google-vertex",grok:"xai",bfl:"black-forest-labs",moonshot:"moonshotai",alibaba:"alibaba",alibabacloud:"alibaba",dashscope:"alibaba",togetherai:"together",fireworksai:"fireworks"};function c(e){const t=e.trim();if(!t)return t;try{if(t.includes("://"))return new URL(t).host}catch{}return t.replace(/^\/\//,"").split("/")[0]??t}function l(e,t=function(){return"undefined"!=typeof process&&process.env?process.env:{}}()){const o=e.toLowerCase();if(!a(s,o))return{host:e};const r=o,n=function(e,t){const o=e.toUpperCase(),r=t[`LLM_STRINGS_${o}_HOST`]??t[`LLM_STRINGS_HOST_${o}`];return r?.trim()?r:void 0}(r,t);return{host:c(n??s[r]),alias:r}}function m(e,...t){return t.some(t=>{const o=t.toLowerCase();return e===o||e.endsWith(`.${o}`)})}function d(e,...t){const o=e.split(".");return t.some(e=>o.some(t=>t.startsWith(e.toLowerCase())))}var u=new Set(["-","."]);function f(e){return e.trim().toLowerCase()}function g(e){const t=f(e),o=t.lastIndexOf("/");return o>=0?t.slice(o+1):t}function _(e,t){const o=g(e),r=f(t);if(!o||!r)return!1;if(o===r)return!0;const n=o[r.length];return o.startsWith(r)&&void 0!==n&&u.has(n)}function y(e){return m(e=function(e){return c(e).toLowerCase().split(":")[0]??e}(e),"openrouter","openrouter.ai")?"openrouter":m(e,"vercel","gateway.ai.vercel.app","gateway.ai.vercel.sh")?"vercel":m(e,"bedrock","amazonaws.com")||d(e,"bedrock")?"bedrock":m(e,"aiplatform.googleapis.com")?"google-vertex":m(e,"xai","x.ai","api.x.ai")?"xai":m(e,"groq","groq.com","api.groq.com")?"groq":m(e,"fal","fal.run","fal.ai")?"fal":m(e,"deepinfra","deepinfra.com")?"deepinfra":m(e,"bfl","bfl.ai","api.bfl.ai")?"black-forest-labs":m(e,"together","together.xyz")?"together":m(e,"fireworks","fireworks.ai")?"fireworks":m(e,"deepseek","deepseek.com")?"deepseek":m(e,"moonshot","moonshot.ai")?"moonshotai":m(e,"perplexity","perplexity.ai")?"perplexity":m(e,"alibaba","aliyuncs.com")||d(e,"dashscope")?"alibaba":m(e,"cerebras","cerebras.ai")?"cerebras":m(e,"replicate","replicate.com")?"replicate":m(e,"prodia","prodia.com")?"prodia":m(e,"luma","lumalabs.ai")?"luma":m(e,"bytedance","volces.com")||function(e,...t){const o=e.split(".");return t.some(e=>o.includes(e.toLowerCase()))}(e,"bytedance")?"bytedance":m(e,"kling","klingai.com")?"kling":m(e,"elevenlabs","elevenlabs.io")?"elevenlabs":m(e,"assemblyai","assemblyai.com")?"assemblyai":m(e,"deepgram","deepgram.com")?"deepgram":m(e,"gladia","gladia.io")?"gladia":m(e,"lmnt","lmnt.com")?"lmnt":m(e,"hume","hume.ai")?"hume":m(e,"revai","rev.ai")?"revai":m(e,"baseten","baseten.co")?"baseten":m(e,"huggingface","huggingface.co")?"huggingface":m(e,"azure","azure.com")?"azure":m(e,"openai","openai.com")?"openai":m(e,"anthropic","anthropic.com","claude.ai")?"anthropic":m(e,"google","googleapis.com")?"google":m(e,"mistral","mistral.ai")?"mistral":m(e,"cohere","cohere.com")?"cohere":void 0}var b={temp:"temperature",max:"max_tokens",max_out:"max_tokens",max_output:"max_tokens",max_output_tokens:"max_tokens",max_completion_tokens:"max_tokens",maxOutputTokens:"max_tokens",maxTokens:"max_tokens",topp:"top_p",topP:"top_p",nucleus:"top_p",topk:"top_k",topK:"top_k",freq:"frequency_penalty",freq_penalty:"frequency_penalty",frequencyPenalty:"frequency_penalty",repetition_penalty:"frequency_penalty",pres:"presence_penalty",pres_penalty:"presence_penalty",presencePenalty:"presence_penalty",stop_sequences:"stop",stopSequences:"stop",stop_sequence:"stop",random_seed:"seed",randomSeed:"seed",candidateCount:"n",candidate_count:"n",num_completions:"n",reasoning_effort:"effort",reasoningEffort:"effort",reasoning:"effort",thinking_effort:"effort",thinkingEffort:"effort",cache_control:"cache",cacheControl:"cache",cachePoint:"cache",cache_point:"cache",zeroDataRetention:"zero_data_retention",disallowPromptTraining:"disallow_prompt_training",hipaaCompliant:"hipaa_compliant",quotaEntityId:"quota_entity_id",providerTimeouts:"provider_timeouts"},h=["none","minimal","low","medium","high","xhigh","max"],v={params:{temperature:"temperature",max_tokens:"max_tokens",max_completion_tokens:"max_completion_tokens",top_p:"top_p",top_k:"top_k",frequency_penalty:"frequency_penalty",presence_penalty:"presence_penalty",stop:"stop",n:"n",seed:"seed",stream:"stream",effort:"reasoning_effort"},specs:{temperature:{type:"number",min:0,max:2,default:.7,description:"Controls randomness"},max_tokens:{type:"number",min:1,default:4096,description:"Maximum output tokens"},max_completion_tokens:{type:"number",min:1,default:4096,description:"Maximum completion tokens (reasoning models)"},top_p:{type:"number",min:0,max:1,default:1,description:"Nucleus sampling"},top_k:{type:"number",min:0,default:40,description:"Top-K sampling"},frequency_penalty:{type:"number",min:-2,max:2,default:0,description:"Penalize frequent tokens"},presence_penalty:{type:"number",min:-2,max:2,default:0,description:"Penalize repeated topics"},stop:{type:"string",description:"Stop sequences"},n:{type:"number",min:1,default:1,description:"Completions count"},seed:{type:"number",description:"Random seed"},stream:{type:"boolean",default:!1,description:"Stream response"},reasoning_effort:{type:"string",values:h,default:"medium",description:"Reasoning effort"}}},k={prompt:{type:"string",description:"Prompt"},negative_prompt:{type:"string",description:"Negative prompt"},seed:{type:"number",description:"Random seed"},image_size:{type:"string",description:"Output image size"},aspect_ratio:{type:"string",description:"Output aspect ratio"},output_format:{type:"string",description:"Output format"},width:{type:"number",min:1,description:"Image width"},height:{type:"number",min:1,description:"Image height"}},x={prompt:"prompt",negative_prompt:"negative_prompt",seed:"seed",image_size:"image_size",aspect_ratio:"aspect_ratio",output_format:"output_format",width:"width",height:"height"},w={params:{...x,num_images:"num_images",enable_safety_checker:"enable_safety_checker",enable_safety_checks:"enable_safety_checks",enable_prompt_expansion:"enable_prompt_expansion",expand_prompt:"expand_prompt"},specs:{...k,num_images:{type:"number",min:1,description:"Number of images to generate"},enable_safety_checker:{type:"boolean",description:"Enable safety checker"},enable_safety_checks:{type:"boolean",description:"Enable safety checker"},enable_prompt_expansion:{type:"boolean",description:"Enable prompt expansion"},expand_prompt:{type:"boolean",description:"Enable prompt expansion"},output_format:{type:"string",values:["jpeg","jpg","png","webp","gif"],description:"Output image format"}}},q={params:{...x,input:"input",version:"version",num_outputs:"num_outputs",num_inference_steps:"num_inference_steps",guidance_scale:"guidance_scale",stream:"stream",webhook:"webhook",webhook_events_filter:"webhook_events_filter"},specs:{...k,input:{type:"string",description:"Model input object"},version:{type:"string",description:"Model version"},num_outputs:{type:"number",min:1,description:"Number of outputs to generate"},num_inference_steps:{type:"number",min:1,description:"Number of inference steps"},guidance_scale:{type:"number",min:0,description:"Guidance scale"},stream:{type:"boolean",description:"Request streaming output"},webhook:{type:"string",description:"Webhook URL"},webhook_events_filter:{type:"string",description:"Webhook events filter"}}},P={params:{...x,model:"model",style_preset:"style_preset",steps:"steps",cfg_scale:"cfg_scale",upscale:"upscale",sampler:"sampler",type:"type",config:"config",price:"price"},specs:{...k,model:{type:"string",description:"Model name"},style_preset:{type:"string",description:"Style preset"},steps:{type:"number",min:1,description:"Generation steps"},cfg_scale:{type:"number",min:0,description:"CFG scale"},upscale:{type:"boolean",description:"Enable 2x upscale"},sampler:{type:"string",description:"Sampler"},width:{type:"number",min:1,max:1024,description:"Image width"},height:{type:"number",min:1,max:1024,description:"Image height"},type:{type:"string",description:"Prodia v2 job type"},config:{type:"string",description:"Prodia v2 job config"},price:{type:"boolean",description:"Include Prodia v2 job price"}}},S={params:{temperature:"temperature",max_tokens:"maxOutputTokens",top_p:"topP",top_k:"topK",frequency_penalty:"frequencyPenalty",presence_penalty:"presencePenalty",stop:"stopSequences",n:"candidateCount",stream:"stream",seed:"seed",responseMimeType:"responseMimeType",responseSchema:"responseSchema"},specs:{temperature:{type:"number",min:0,max:2,default:.7,description:"Controls randomness"},maxOutputTokens:{type:"number",min:1,default:4096,description:"Maximum output tokens"},topP:{type:"number",min:0,max:1,default:1,description:"Nucleus sampling"},topK:{type:"number",min:0,default:40,description:"Top-K sampling"},frequencyPenalty:{type:"number",min:-2,max:2,default:0,description:"Penalize frequent tokens"},presencePenalty:{type:"number",min:-2,max:2,default:0,description:"Penalize repeated topics"},stopSequences:{type:"string",description:"Stop sequences"},candidateCount:{type:"number",min:1,default:1,description:"Candidate count"},stream:{type:"boolean",default:!1,description:"Stream response"},seed:{type:"number",description:"Random seed"},responseMimeType:{type:"string",description:"Response MIME type"},responseSchema:{type:"string",description:"Response schema"}}},C={openai:{params:{temperature:"temperature",max_tokens:"max_tokens",max_completion_tokens:"max_completion_tokens",top_p:"top_p",frequency_penalty:"frequency_penalty",presence_penalty:"presence_penalty",stop:"stop",n:"n",seed:"seed",stream:"stream",effort:"reasoning_effort"},specs:{temperature:{type:"number",min:0,max:2,default:.7,description:"Controls randomness"},max_tokens:{type:"number",min:1,default:4096,description:"Maximum output tokens"},max_completion_tokens:{type:"number",min:1,default:4096,description:"Maximum completion tokens (reasoning models)"},top_p:{type:"number",min:0,max:1,default:1,description:"Nucleus sampling"},frequency_penalty:{type:"number",min:-2,max:2,default:0,description:"Penalize frequent tokens"},presence_penalty:{type:"number",min:-2,max:2,default:0,description:"Penalize repeated topics"},stop:{type:"string",description:"Stop sequences"},n:{type:"number",min:1,default:1,description:"Completions count"},seed:{type:"number",description:"Random seed"},stream:{type:"boolean",default:!1,description:"Stream response"},reasoning_effort:{type:"string",values:h,default:"medium",description:"Reasoning effort"}}},azure:v,anthropic:{params:{temperature:"temperature",max_tokens:"max_tokens",top_p:"top_p",top_k:"top_k",stop:"stop_sequences",stream:"stream",effort:"effort",cache:"cache_control",cache_ttl:"cache_ttl"},specs:{temperature:{type:"number",min:0,max:1,default:.7,description:"Controls randomness"},max_tokens:{type:"number",min:1,default:4096,description:"Maximum output tokens"},top_p:{type:"number",min:0,max:1,default:1,description:"Nucleus sampling"},top_k:{type:"number",min:0,default:40,description:"Top-K sampling"},stop_sequences:{type:"string",description:"Stop sequences"},stream:{type:"boolean",default:!1,description:"Stream response"},effort:{type:"string",values:h,default:"low",description:"Thinking effort"},cache_control:{type:"string",values:["ephemeral"],default:"ephemeral",description:"Cache control"},cache_ttl:{type:"string",values:["5m","1h"],default:"5m",description:"Cache TTL"}},cacheValue:"ephemeral",cacheTtls:["5m","1h"]},google:S,"google-vertex":S,mistral:{params:{temperature:"temperature",max_tokens:"max_tokens",top_p:"top_p",frequency_penalty:"frequency_penalty",presence_penalty:"presence_penalty",stop:"stop",n:"n",seed:"random_seed",stream:"stream",safe_prompt:"safe_prompt",min_tokens:"min_tokens"},specs:{temperature:{type:"number",min:0,max:1,default:.7,description:"Controls randomness"},max_tokens:{type:"number",min:1,default:4096,description:"Maximum output tokens"},top_p:{type:"number",min:0,max:1,default:1,description:"Nucleus sampling"},frequency_penalty:{type:"number",min:-2,max:2,default:0,description:"Penalize frequent tokens"},presence_penalty:{type:"number",min:-2,max:2,default:0,description:"Penalize repeated topics"},stop:{type:"string",description:"Stop sequences"},n:{type:"number",min:1,default:1,description:"Completions count"},random_seed:{type:"number",description:"Random seed"},stream:{type:"boolean",default:!1,description:"Stream response"},safe_prompt:{type:"boolean",default:!1,description:"Enable safe prompt"},min_tokens:{type:"number",min:0,default:0,description:"Minimum tokens"}}},cohere:{params:{temperature:"temperature",max_tokens:"max_tokens",top_p:"p",top_k:"k",frequency_penalty:"frequency_penalty",presence_penalty:"presence_penalty",stop:"stop_sequences",stream:"stream",seed:"seed"},specs:{temperature:{type:"number",min:0,max:1,default:.7,description:"Controls randomness"},max_tokens:{type:"number",min:1,default:4096,description:"Maximum output tokens"},p:{type:"number",min:0,max:1,default:1,description:"Nucleus sampling (p)"},k:{type:"number",min:0,max:500,default:40,description:"Top-K sampling (k)"},frequency_penalty:{type:"number",min:0,max:1,default:0,description:"Penalize frequent tokens"},presence_penalty:{type:"number",min:0,max:1,default:0,description:"Penalize repeated topics"},stop_sequences:{type:"string",description:"Stop sequences"},stream:{type:"boolean",default:!1,description:"Stream response"},seed:{type:"number",description:"Random seed"}}},bedrock:{params:{temperature:"temperature",max_tokens:"maxTokens",top_p:"topP",top_k:"topK",stop:"stopSequences",stream:"stream",cache:"cache_control",cache_ttl:"cache_ttl"},specs:{temperature:{type:"number",min:0,max:1,default:.7,description:"Controls randomness"},maxTokens:{type:"number",min:1,default:4096,description:"Maximum output tokens"},topP:{type:"number",min:0,max:1,default:1,description:"Nucleus sampling"},topK:{type:"number",min:0,default:40,description:"Top-K sampling"},stopSequences:{type:"string",description:"Stop sequences"},stream:{type:"boolean",default:!1,description:"Stream response"},cache_control:{type:"string",values:["ephemeral"],default:"ephemeral",description:"Cache control"},cache_ttl:{type:"string",values:["5m","1h"],default:"5m",description:"Cache TTL"}},cacheValue:"ephemeral",cacheTtls:["5m","1h"]},openrouter:{params:{...v.params,...{provider:"provider","provider.order":"provider.order","provider.only":"provider.only","provider.ignore":"provider.ignore","provider.allow_fallbacks":"provider.allow_fallbacks","provider.require_parameters":"provider.require_parameters","provider.data_collection":"provider.data_collection","provider.zdr":"provider.zdr","provider.enforce_distillable_text":"provider.enforce_distillable_text","provider.quantizations":"provider.quantizations","provider.sort":"provider.sort","provider.preferred_min_throughput":"provider.preferred_min_throughput","provider.preferred_max_latency":"provider.preferred_max_latency","provider.max_price":"provider.max_price",transforms:"transforms",plugins:"plugins"}},specs:{...v.specs,...{provider:{type:"string",description:"Provider routing preferences"},"provider.order":{type:"string",description:"Provider order"},"provider.only":{type:"string",description:"Provider allowlist"},"provider.ignore":{type:"string",description:"Provider blocklist"},"provider.allow_fallbacks":{type:"boolean",default:!0,description:"Allow fallback providers"},"provider.require_parameters":{type:"boolean",default:!1,description:"Only route to providers that support all request params"},"provider.data_collection":{type:"string",values:["allow","deny"],default:"allow",description:"Provider data collection policy"},"provider.zdr":{type:"boolean",description:"Require zero data retention providers"},"provider.enforce_distillable_text":{type:"boolean",description:"Require providers that allow text distillation"},"provider.quantizations":{type:"string",description:"Allowed provider quantization levels"},"provider.sort":{type:"string",values:["price","throughput","latency","cost","ttft","tps"],description:"Provider sort strategy"},"provider.preferred_min_throughput":{type:"number",min:0,description:"Preferred minimum provider throughput"},"provider.preferred_max_latency":{type:"number",min:0,description:"Preferred maximum provider latency"},"provider.max_price":{type:"string",description:"Maximum provider price filter"},transforms:{type:"string",description:"Legacy OpenRouter message transforms"},plugins:{type:"string",description:"OpenRouter request plugins"}}}},vercel:{params:{...v.params},specs:{...v.specs,order:{type:"string",description:"Gateway provider order"},only:{type:"string",description:"Gateway provider allowlist"},models:{type:"string",description:"Gateway fallback models"},tags:{type:"string",description:"Gateway usage tags"},sort:{type:"string",values:["cost","ttft","tps"],description:"Gateway provider sort strategy"},caching:{type:"string",values:["auto"],description:"Gateway automatic caching strategy"},user:{type:"string",description:"Gateway usage user identifier"},byok:{type:"string",description:"Gateway BYOK credentials"},zero_data_retention:{type:"boolean",description:"Gateway zero data retention routing"},disallow_prompt_training:{type:"boolean",description:"Gateway prompt training opt-out routing"},hipaa_compliant:{type:"boolean",description:"Gateway HIPAA-compliant routing"},quota_entity_id:{type:"string",description:"Gateway quota entity identifier"},provider_timeouts:{type:"string",description:"Gateway provider timeouts"}}},xai:v,groq:v,fal:w,deepinfra:v,"black-forest-labs":{params:{},specs:{}},together:v,fireworks:v,deepseek:v,moonshotai:v,perplexity:v,alibaba:v,cerebras:v,replicate:q,prodia:P,luma:{params:{prompt:"prompt",model:"model",aspect_ratio:"aspect_ratio",keyframes:"keyframes",loop:"loop",duration:"duration",type:"type",image_ref:"image_ref",video:"video",source:"source"},specs:{prompt:{type:"string",description:"Prompt"},model:{type:"string",description:"Model name"},aspect_ratio:{type:"string",description:"Output aspect ratio"},keyframes:{type:"string",description:"Generation keyframes"},loop:{type:"boolean",description:"Generate a looping video"},duration:{type:"string",description:"Generation duration"},type:{type:"string",description:"Generation type"},image_ref:{type:"string",description:"Image reference"},video:{type:"string",description:"Video options"},source:{type:"string",description:"Source generation or media"}}},bytedance:{params:{},specs:{}},kling:{params:{},specs:{}},elevenlabs:{params:{},specs:{}},assemblyai:{params:{},specs:{}},deepgram:{params:{},specs:{}},gladia:{params:{},specs:{}},lmnt:{params:{},specs:{}},hume:{params:{},specs:{}},revai:{params:{},specs:{}},baseten:v,huggingface:v},T=Object.fromEntries(Object.entries(C).map(([e,t])=>[e,t.params])),z=(Object.fromEntries(Object.entries(C).map(([e,t])=>[e,t.specs])),Object.fromEntries(Object.entries(C).filter(([,e])=>void 0!==e.cacheValue).map(([e,t])=>[e,t.cacheValue]))),O=Object.fromEntries(Object.entries(C).filter(([,e])=>void 0!==e.cacheTtls).map(([e,t])=>[e,t.cacheTtls])),j=[];function M(e){const t=g(e),o=t.match(/^o\d+/)?.[0],r=t.match(/^gpt-[5-9]/)?.[0];return void 0!==o&&_(t,o)||void 0!==r&&_(t,r)||j.some(e=>_(t,e))}function R(e){return"openai"===e||"azure"===e||"openrouter"===e||"vercel"===e}var G=new Set(["temperature","top_p","top_k","frequency_penalty","presence_penalty","n"]);function L(e){const t=function(e){const t=g(e).split(".");return["anthropic","meta","amazon","mistral","cohere","ai21"].find(e=>t.includes(e))}(e);if("anthropic"===t)return!0;if("amazon"===t){const t=g(e).split("."),o=t.indexOf("amazon"),r=o>=0?t[o+1]:void 0;return!!r&&_(r,"nova")}return!1}var A=/^\d+[mh]$/;function E(e,t={}){const o=(e.hostAlias?function(e){const t=e.toLowerCase();return a(T,t)?t:a(p,t)?p[t]:void 0}(e.hostAlias):void 0)??y(e.host),r=o&&function(e){return"openrouter"===e||"vercel"===e}(o)?function(e){const t=e.indexOf("/");if(t<1)return;return{openai:"openai",anthropic:"anthropic",google:"google",vertex:"google","google-vertex":"google",mistral:"mistral",cohere:"cohere"}[f(e.slice(0,t))]}(e.model):void 0,n=[],i={};for(const[r,a]of Object.entries(e.params)){let s=r;if(b[s]){const e=b[s];t.verbose&&n.push({from:s,to:e,value:a,reason:`alias: "${s}" → "${e}"`}),s=e}if("cache"===s&&o){let r=z[o];if("bedrock"!==o||L(e.model)||(r=void 0),!r){t.verbose&&n.push({from:"cache",to:"(dropped)",value:a,reason:`${o} does not use a cache param for this model (caching is automatic or unsupported)`});continue}const s="true"===a||"1"===a||"yes"===a,p=A.test(a);if(s||p){const e=T[o]?.cache??"cache";t.verbose&&n.push({from:"cache",to:e,value:r,reason:`cache=${a} → ${e}=${r} for ${o}`}),i[e]=r,p&&O[o]&&(t.verbose&&n.push({from:"cache",to:"cache_ttl",value:a,reason:`cache=${a} → cache_ttl=${a} for ${o}`}),i.cache_ttl=a);continue}}if(o&&T[o]){const e=T[o][s];e&&e!==s&&(t.verbose&&n.push({from:s,to:e,value:a,reason:`${o} uses "${e}" instead of "${s}"`}),s=e)}o&&R(o)&&M(e.model)&&"max_tokens"===s&&(t.verbose&&n.push({from:"max_tokens",to:"max_completion_tokens",value:a,reason:"OpenAI reasoning models use max_completion_tokens instead of max_tokens"}),s="max_completion_tokens"),o&&R(o)&&M(e.model)&&G.has(s)?t.verbose&&n.push({from:s,to:"(dropped)",value:a,reason:`${o} reasoning model "${e.model}" does not support "${s}"`}):i[s]=a}return{config:{...e,params:i},provider:o,subProvider:r,changes:n}}var $={openai:"openai",azure:"azure",anthropic:"anthropic",google:"google","google-vertex":"vertex",mistral:"mistral",cohere:"cohere",bedrock:"bedrock",openrouter:"openrouter",vercel:"gateway",xai:"xai",groq:"groq",fal:"fal",deepinfra:"deepinfra","black-forest-labs":"blackForestLabs",together:"together",fireworks:"fireworks",deepseek:"deepseek",moonshotai:"moonshotai",perplexity:"perplexity",alibaba:"alibaba",cerebras:"cerebras",replicate:"replicate",prodia:"prodia",luma:"luma",bytedance:"bytedance",kling:"kling",elevenlabs:"elevenlabs",assemblyai:"assemblyai",deepgram:"deepgram",gladia:"gladia",lmnt:"lmnt",hume:"hume",revai:"revai",baseten:"baseten",huggingface:"huggingface"},I=new Set(["true","1","yes","on"]),N=new Set(["false","0","no","off"]);function K(e,t,o,r){e[t]??(e[t]={}),e[t][o]=r}function B(e){const t=e.trim().toLowerCase();return!!I.has(t)||!N.has(t)&&void 0}function F(e){if(!e.trim())return;const t=Number(e);return Number.isFinite(t)?t:void 0}function W(e){try{return JSON.parse(e)}catch{return}}function U(e){const t=W(e);return Array.isArray(t)?t.filter(e=>"string"==typeof e):e.split(",").map(e=>e.trim()).filter(Boolean)}function V(e){const t=B(e);if(void 0!==t)return t;const o=F(e);if(void 0!==o)return o;const r=W(e);return void 0!==r?r:e}function D(e,t,o,r){const n=W(r);n&&"object"==typeof n&&!Array.isArray(n)&&K(e,t,o,n)}function J(e,t,o,r="openai"){const n={reasoning_effort:"reasoningEffort",max_completion_tokens:"maxCompletionTokens",parallel_tool_calls:"parallelToolCalls",service_tier:"serviceTier",strict_json_schema:"strictJsonSchema",text_verbosity:"textVerbosity",prompt_cache_key:"promptCacheKey",prompt_cache_retention:"promptCacheRetention",safety_identifier:"safetyIdentifier",system_message_mode:"systemMessageMode",force_reasoning:"forceReasoning",reasoning_summary:"reasoningSummary",previous_response_id:"previousResponseId",max_tool_calls:"maxToolCalls",allowed_tools:"allowedTools"};if(!n[t]&&!new Set(["conversation","instructions","logprobs","metadata","prediction","store","truncation","user"]).has(t)&&"include"!==t)return;const i=n[t]??t;"include"!==t?"metadata"!==t&&"prediction"!==t&&"allowed_tools"!==t?K(e,r,i,V(o)):D(e,r,i,o):K(e,r,i,U(o))}function H(e,t,o,r="google"){if("thinking_budget"===t||"thinking_level"===t||"include_thoughts"===t){const n=e[r]?.thinkingConfig,i=n&&"object"==typeof n&&!Array.isArray(n)?{...n}:{};if("thinking_budget"===t){const e=F(o);void 0!==e&&(i.thinkingBudget=e)}if("thinking_level"===t&&(i.thinkingLevel=o),"include_thoughts"===t){const e=B(o);void 0!==e&&(i.includeThoughts=e)}return void K(e,r,"thinkingConfig",i)}const n={cached_content:"cachedContent",structured_outputs:"structuredOutputs",safety_settings:"safetySettings",response_modalities:"responseModalities",audio_timestamp:"audioTimestamp",media_resolution:"mediaResolution",image_config:"imageConfig",retrieval_config:"retrievalConfig",stream_function_call_arguments:"streamFunctionCallArguments",service_tier:"serviceTier"};if(!n[t]&&!new Set(["cachedContent","structuredOutputs","safetySettings","threshold","audioTimestamp","labels","mediaResolution","imageConfig","retrievalConfig","responseModalities","streamFunctionCallArguments","serviceTier"]).has(t))return;const i=n[t]??t;"response_modalities"!==t?"safety_settings"!==t&&"labels"!==t&&"image_config"!==t&&"retrieval_config"!==t?K(e,r,i,V(o)):D(e,r,i,o):K(e,r,i,U(o))}function Y(e,t,o,r){K(e,t,o,V(r))}var Q={openai:J,azure:(e,t,o)=>J(e,t,o,"azure"),anthropic:function(e,t,o){const r="anthropic";if("cache_control"===t||"cacheControl"===t){const t=e[r]?.cacheControl,n=t&&"object"==typeof t&&"ttl"in t?t.ttl:void 0;return void K(e,r,"cacheControl",{type:"ephemeral"===o?"ephemeral":o,...n?{ttl:n}:{}})}if("cache_ttl"===t){const t=e[r]?.cacheControl;return void K(e,r,"cacheControl",{...t&&"object"==typeof t?t:{},type:"ephemeral",ttl:o})}if("thinking"===t)return void D(e,r,"thinking",o);if("thinking_budget"===t||"budget_tokens"===t){const t=F(o);return void(void 0!==t&&K(e,r,"thinking",{type:"enabled",budgetTokens:t}))}const n={send_reasoning:"sendReasoning",structured_output_mode:"structuredOutputMode",disable_parallel_tool_use:"disableParallelToolUse",tool_streaming:"toolStreaming",inference_geo:"inferenceGeo",anthropic_beta:"anthropicBeta",mcp_servers:"mcpServers",task_budget:"taskBudget",context_management:"contextManagement"};if(!n[t]&&!new Set(["effort","speed","sendReasoning","structuredOutputMode","disableParallelToolUse","toolStreaming","inferenceGeo","anthropicBeta","metadata","mcpServers","container","taskBudget","contextManagement"]).has(t))return;const i=n[t]??t;"anthropic_beta"!==t?"metadata"!==t&&"mcp_servers"!==t&&"container"!==t&&"task_budget"!==t&&"context_management"!==t?K(e,r,i,V(o)):D(e,r,i,o):K(e,r,i,U(o))},google:H,"google-vertex":(e,t,o)=>H(e,t,o,"vertex"),mistral:function(e,t,o){const r={safe_prompt:"safePrompt",document_image_limit:"documentImageLimit",document_page_limit:"documentPageLimit",structured_outputs:"structuredOutputs",strict_json_schema:"strictJsonSchema",parallel_tool_calls:"parallelToolCalls",reasoning_effort:"reasoningEffort"};if(!r[t]&&!new Set(["safePrompt","documentImageLimit","documentPageLimit","structuredOutputs","strictJsonSchema","parallelToolCalls","reasoningEffort"]).has(t))return;K(e,"mistral",r[t]??t,V(o))},cohere:function(e,t,o){const r="cohere";if("thinking"!==t){if("thinking_token_budget"===t||"token_budget"===t){const t=F(o);return void(void 0!==t&&K(e,r,"thinking",{type:"enabled",tokenBudget:t}))}if("thinking_type"===t){const t=e[r]?.thinking;K(e,r,"thinking",{...t&&"object"==typeof t?t:{},type:o})}}else D(e,r,"thinking",o)},bedrock:function(e,t,o){const r="bedrock";if("cache_control"===t)return void K(e,r,"cachePoint",{type:"ephemeral"===o?"default":o});if("cache_ttl"===t){const t=e[r]?.cachePoint;return void K(e,r,"cachePoint",{...t&&"object"==typeof t?t:{},type:"default",ttl:o})}if("reasoning_config"===t)return void D(e,r,"reasoningConfig",o);if("budget_tokens"===t||"reasoning_effort"===t){const n=e[r]?.reasoningConfig,i=n&&"object"==typeof n&&!Array.isArray(n)?{...n}:{};if(i.type="enabled","budget_tokens"===t){const e=F(o);void 0!==e&&(i.budgetTokens=e)}return"reasoning_effort"===t&&(i.maxReasoningEffort=o),void K(e,r,"reasoningConfig",i)}const n={additional_model_request_fields:"additionalModelRequestFields",anthropic_beta:"anthropicBeta",service_tier:"serviceTier"};if(!n[t]&&!new Set(["additionalModelRequestFields","anthropicBeta","serviceTier"]).has(t))return;const i=n[t]??t;"additional_model_request_fields"!==t?K(e,r,i,"anthropic_beta"!==t?V(o):U(o)):D(e,r,i,o)},openrouter:function(e,t,o){const r="openrouter",n=t.startsWith("provider.")?t.slice(9):t,i=new Set(["order","only","ignore","quantizations"]),a=new Set(["provider","sort","preferred_min_throughput","preferred_max_latency","max_price"]),s=new Set(["allow_fallbacks","require_parameters","data_collection","zdr","enforce_distillable_text"]);if("models"!==t)if("transforms"!==t){if("plugins"===t){const t=W(o);return void K(e,r,"plugins",Array.isArray(t)?t:U(o))}if(t.startsWith("provider.")||i.has(n)||s.has(n)||a.has(n)){if("provider"===n)return void D(e,r,"provider",o);const t=e[r]?.provider,s=t&&"object"==typeof t&&!Array.isArray(t)?{...t}:{};if(i.has(n))s[n]=U(o);else if(a.has(n)){const e=W(o);s[n]=void 0!==e?e:V(o)}else s[n]=V(o);return void K(e,r,"provider",s)}if("reasoning"!==t){if("reasoning_effort"===t){const t=e[r]?.reasoning;return void K(e,r,"reasoning",{...t&&"object"==typeof t?t:{},effort:o})}if("reasoning_max_tokens"===t||"max_reasoning_tokens"===t){const t=e[r]?.reasoning,n=F(o);return void(void 0!==n&&K(e,r,"reasoning",{...t&&"object"==typeof t?t:{},max_tokens:n}))}if("reasoning_enabled"===t||"reasoning_exclude"===t){const n=e[r]?.reasoning,i=B(o);return void(void 0!==i&&K(e,r,"reasoning",{...n&&"object"==typeof n?n:{},["reasoning_enabled"===t?"enabled":"exclude"]:i}))}"user"===t&&K(e,r,"user",o)}else D(e,r,"reasoning",o)}else K(e,r,"transforms",U(o));else K(e,r,"models",U(o))},xai:(e,t,o)=>J(e,t,o,"xai"),groq:(e,t,o)=>J(e,t,o,"groq"),fal:(e,t,o)=>Y(e,"fal",t,o),deepinfra:(e,t,o)=>J(e,t,o,"deepinfra"),"black-forest-labs":(e,t,o)=>Y(e,"blackForestLabs",t,o),together:(e,t,o)=>J(e,t,o,"together"),fireworks:(e,t,o)=>J(e,t,o,"fireworks"),deepseek:(e,t,o)=>J(e,t,o,"deepseek"),moonshotai:(e,t,o)=>J(e,t,o,"moonshotai"),perplexity:(e,t,o)=>J(e,t,o,"perplexity"),alibaba:(e,t,o)=>J(e,t,o,"alibaba"),cerebras:(e,t,o)=>J(e,t,o,"cerebras"),replicate:(e,t,o)=>Y(e,"replicate",t,o),prodia:(e,t,o)=>Y(e,"prodia",t,o),luma:(e,t,o)=>Y(e,"luma",t,o),bytedance:(e,t,o)=>Y(e,"bytedance",t,o),kling:(e,t,o)=>Y(e,"kling",t,o),elevenlabs:(e,t,o)=>Y(e,"elevenlabs",t,o),assemblyai:(e,t,o)=>Y(e,"assemblyai",t,o),deepgram:(e,t,o)=>Y(e,"deepgram",t,o),gladia:(e,t,o)=>Y(e,"gladia",t,o),lmnt:(e,t,o)=>Y(e,"lmnt",t,o),hume:(e,t,o)=>Y(e,"hume",t,o),revai:(e,t,o)=>Y(e,"revai",t,o),baseten:(e,t,o)=>J(e,t,o,"baseten"),huggingface:(e,t,o)=>J(e,t,o,"huggingface")};function X(e,t,o,r,n){"vercel"!==t?Q[t](e,o,r):n&&function(e,t,o){const r="gateway",n=new Set(["only","order","tags","models"]),i=new Set(["byok","provider_timeouts"]),a={zero_data_retention:"zeroDataRetention",disallow_prompt_training:"disallowPromptTraining",hipaa_compliant:"hipaaCompliant",quota_entity_id:"quotaEntityId",provider_timeouts:"providerTimeouts"};if(!(a[t]||new Set(["sort","caching","user","zeroDataRetention","disallowPromptTraining","hipaaCompliant","quotaEntityId","providerTimeouts"]).has(t)||n.has(t)||i.has(t)))return;const s=a[t]??t;n.has(t)?K(e,r,s,U(o)):i.has(t)?D(e,r,s,o):K(e,r,s,V(o))}(e,o,r)}function Z(e,t={}){const o="string"==typeof e?E(function(e){const t=new URL(e);if("llm:"!==t.protocol)throw new Error(`Invalid scheme: expected "llm://", got "${t.protocol}//"`);const{host:o,alias:r}=l(t.host),n=t.pathname.replace(/^\//,""),i=t.username||void 0,a=t.password||void 0,s={};for(const[e,o]of t.searchParams)s[e]=o;return{raw:e,host:o,hostAlias:r,model:n,label:i,apiKey:a,params:s}}(e),t):"changes"in e&&"subProvider"in e?e:E(e,t),r={};if(!o.provider)return{provider:o.provider,subProvider:o.subProvider,providerOptions:r};const n=t.includeGatewayOptions??"vercel"===o.provider;for(const[e,t]of Object.entries(o.config.params))X(r,o.provider,e,t,n);return"vercel"===o.provider||r[i=o.provider,$[i]]?{provider:o.provider,subProvider:o.subProvider,providerOptions:r}:{provider:o.provider,subProvider:o.subProvider,providerOptions:{}};var i}