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.
@@ -1,1488 +0,0 @@
1
- // src/provider-core.ts
2
- function hasOwn(object, key) {
3
- return Object.prototype.hasOwnProperty.call(object, key);
4
- }
5
- var HOST_ALIASES = {
6
- openai: "api.openai.com",
7
- azure: "models.inference.ai.azure.com",
8
- anthropic: "api.anthropic.com",
9
- google: "generativelanguage.googleapis.com",
10
- "google-vertex": "aiplatform.googleapis.com",
11
- aistudio: "generativelanguage.googleapis.com",
12
- mistral: "api.mistral.ai",
13
- cohere: "api.cohere.com",
14
- bedrock: "bedrock-runtime.us-east-1.amazonaws.com",
15
- openrouter: "openrouter.ai",
16
- vercel: "gateway.ai.vercel.app",
17
- alibaba: "dashscope-intl.aliyuncs.com",
18
- alibabacloud: "dashscope-intl.aliyuncs.com",
19
- dashscope: "dashscope-intl.aliyuncs.com",
20
- groq: "api.groq.com",
21
- fal: "fal.run",
22
- fireworks: "api.fireworks.ai",
23
- fireworksai: "api.fireworks.ai",
24
- "black-forest-labs": "api.bfl.ai",
25
- bfl: "api.bfl.ai",
26
- deepseek: "api.deepseek.com",
27
- moonshotai: "api.moonshot.ai",
28
- moonshot: "api.moonshot.ai",
29
- perplexity: "api.perplexity.ai",
30
- venice: "api.venice.ai",
31
- parasail: "api.parasail.io",
32
- deepinfra: "api.deepinfra.com",
33
- atlascloud: "api.atlascloud.ai",
34
- novita: "api.novita.ai",
35
- novitaai: "api.novita.ai",
36
- grok: "api.x.ai",
37
- xai: "api.x.ai",
38
- together: "api.together.xyz",
39
- togetherai: "api.together.xyz",
40
- cerebras: "api.cerebras.ai",
41
- replicate: "api.replicate.com",
42
- prodia: "api.prodia.com",
43
- luma: "api.lumalabs.ai",
44
- bytedance: "ark.cn-beijing.volces.com",
45
- kling: "api.klingai.com",
46
- elevenlabs: "api.elevenlabs.io",
47
- assemblyai: "api.assemblyai.com",
48
- deepgram: "api.deepgram.com",
49
- gladia: "api.gladia.io",
50
- lmnt: "api.lmnt.com",
51
- hume: "api.hume.ai",
52
- revai: "api.rev.ai",
53
- baseten: "api.baseten.co",
54
- huggingface: "api-inference.huggingface.co",
55
- wandb: "api.inference.wandb.ai",
56
- weightsandbiases: "api.inference.wandb.ai",
57
- baidu: "qianfan.baidubce.com",
58
- qianfan: "qianfan.baidubce.com",
59
- vertex: "aiplatform.googleapis.com",
60
- xiaomi: "api.xiaomimimo.com",
61
- minimax: "api.minimax.io"
62
- };
63
- var HOST_ALIAS_PROVIDERS = {
64
- aistudio: "google",
65
- vertex: "google-vertex",
66
- grok: "xai",
67
- bfl: "black-forest-labs",
68
- moonshot: "moonshotai",
69
- alibaba: "alibaba",
70
- alibabacloud: "alibaba",
71
- dashscope: "alibaba",
72
- togetherai: "together",
73
- fireworksai: "fireworks"
74
- };
75
- function readProcessEnv() {
76
- return typeof process !== "undefined" && process.env ? process.env : {};
77
- }
78
- function normalizeHostValue(value) {
79
- const trimmed = value.trim();
80
- if (!trimmed) return trimmed;
81
- try {
82
- if (trimmed.includes("://")) {
83
- return new URL(trimmed).host;
84
- }
85
- } catch {
86
- }
87
- return trimmed.replace(/^\/\//, "").split("/")[0] ?? trimmed;
88
- }
89
- function envHostOverride(alias, env) {
90
- const upper = alias.toUpperCase();
91
- const override = env[`LLM_STRINGS_${upper}_HOST`] ?? env[`LLM_STRINGS_HOST_${upper}`];
92
- return override?.trim() ? override : void 0;
93
- }
94
- function resolveHostAlias(host, env = readProcessEnv()) {
95
- const normalizedHost = host.toLowerCase();
96
- if (!hasOwn(HOST_ALIASES, normalizedHost)) {
97
- return { host };
98
- }
99
- const alias = normalizedHost;
100
- const override = envHostOverride(alias, env);
101
- return {
102
- host: normalizeHostValue(override ?? HOST_ALIASES[alias]),
103
- alias
104
- };
105
- }
106
- function providerFromHostAlias(alias) {
107
- const normalizedAlias = alias.toLowerCase();
108
- if (hasOwn(PROVIDER_PARAMS, normalizedAlias)) {
109
- return normalizedAlias;
110
- }
111
- if (hasOwn(HOST_ALIAS_PROVIDERS, normalizedAlias)) {
112
- return HOST_ALIAS_PROVIDERS[normalizedAlias];
113
- }
114
- return void 0;
115
- }
116
- function canonicalHostName(host) {
117
- return normalizeHostValue(host).toLowerCase().split(":")[0] ?? host;
118
- }
119
- function hostMatches(host, ...domains) {
120
- return domains.some((domain) => {
121
- const normalizedDomain = domain.toLowerCase();
122
- return host === normalizedDomain || host.endsWith(`.${normalizedDomain}`);
123
- });
124
- }
125
- function hostHasLabel(host, ...labels) {
126
- const hostLabels = host.split(".");
127
- return labels.some((label) => hostLabels.includes(label.toLowerCase()));
128
- }
129
- function hostHasLabelPrefix(host, ...prefixes) {
130
- const hostLabels = host.split(".");
131
- return prefixes.some(
132
- (prefix) => hostLabels.some((label) => label.startsWith(prefix.toLowerCase()))
133
- );
134
- }
135
- var MODEL_FAMILY_DELIMITERS = /* @__PURE__ */ new Set(["-", "."]);
136
- function normalizeModelForMatching(model) {
137
- return model.trim().toLowerCase();
138
- }
139
- function modelLeafName(model) {
140
- const normalized = normalizeModelForMatching(model);
141
- const slash = normalized.lastIndexOf("/");
142
- return slash >= 0 ? normalized.slice(slash + 1) : normalized;
143
- }
144
- function modelMatchesFamily(model, family) {
145
- const name = modelLeafName(model);
146
- const normalizedFamily = normalizeModelForMatching(family);
147
- if (!name || !normalizedFamily) return false;
148
- if (name === normalizedFamily) return true;
149
- const delimiter = name[normalizedFamily.length];
150
- return name.startsWith(normalizedFamily) && delimiter !== void 0 && MODEL_FAMILY_DELIMITERS.has(delimiter);
151
- }
152
- function detectProvider(host) {
153
- host = canonicalHostName(host);
154
- if (hostMatches(host, "openrouter", "openrouter.ai")) return "openrouter";
155
- if (hostMatches(host, "vercel", "gateway.ai.vercel.app", "gateway.ai.vercel.sh")) {
156
- return "vercel";
157
- }
158
- if (hostMatches(host, "bedrock", "amazonaws.com") || hostHasLabelPrefix(host, "bedrock")) {
159
- return "bedrock";
160
- }
161
- if (hostMatches(host, "aiplatform.googleapis.com")) return "google-vertex";
162
- if (hostMatches(host, "xai", "x.ai", "api.x.ai")) return "xai";
163
- if (hostMatches(host, "groq", "groq.com", "api.groq.com")) return "groq";
164
- if (hostMatches(host, "fal", "fal.run", "fal.ai")) return "fal";
165
- if (hostMatches(host, "deepinfra", "deepinfra.com")) return "deepinfra";
166
- if (hostMatches(host, "bfl", "bfl.ai", "api.bfl.ai")) {
167
- return "black-forest-labs";
168
- }
169
- if (hostMatches(host, "together", "together.xyz")) return "together";
170
- if (hostMatches(host, "fireworks", "fireworks.ai")) return "fireworks";
171
- if (hostMatches(host, "deepseek", "deepseek.com")) return "deepseek";
172
- if (hostMatches(host, "moonshot", "moonshot.ai")) return "moonshotai";
173
- if (hostMatches(host, "perplexity", "perplexity.ai")) return "perplexity";
174
- if (hostMatches(host, "alibaba", "aliyuncs.com") || hostHasLabelPrefix(host, "dashscope")) {
175
- return "alibaba";
176
- }
177
- if (hostMatches(host, "cerebras", "cerebras.ai")) return "cerebras";
178
- if (hostMatches(host, "replicate", "replicate.com")) return "replicate";
179
- if (hostMatches(host, "prodia", "prodia.com")) return "prodia";
180
- if (hostMatches(host, "luma", "lumalabs.ai")) return "luma";
181
- if (hostMatches(host, "bytedance", "volces.com") || hostHasLabel(host, "bytedance")) {
182
- return "bytedance";
183
- }
184
- if (hostMatches(host, "kling", "klingai.com")) return "kling";
185
- if (hostMatches(host, "elevenlabs", "elevenlabs.io")) return "elevenlabs";
186
- if (hostMatches(host, "assemblyai", "assemblyai.com")) return "assemblyai";
187
- if (hostMatches(host, "deepgram", "deepgram.com")) return "deepgram";
188
- if (hostMatches(host, "gladia", "gladia.io")) return "gladia";
189
- if (hostMatches(host, "lmnt", "lmnt.com")) return "lmnt";
190
- if (hostMatches(host, "hume", "hume.ai")) return "hume";
191
- if (hostMatches(host, "revai", "rev.ai")) return "revai";
192
- if (hostMatches(host, "baseten", "baseten.co")) return "baseten";
193
- if (hostMatches(host, "huggingface", "huggingface.co")) return "huggingface";
194
- if (hostMatches(host, "azure", "azure.com")) return "azure";
195
- if (hostMatches(host, "openai", "openai.com")) return "openai";
196
- if (hostMatches(host, "anthropic", "anthropic.com", "claude.ai")) {
197
- return "anthropic";
198
- }
199
- if (hostMatches(host, "google", "googleapis.com")) return "google";
200
- if (hostMatches(host, "mistral", "mistral.ai")) return "mistral";
201
- if (hostMatches(host, "cohere", "cohere.com")) return "cohere";
202
- return void 0;
203
- }
204
- var ALIASES = {
205
- // temperature
206
- temp: "temperature",
207
- // max_tokens
208
- max: "max_tokens",
209
- max_out: "max_tokens",
210
- max_output: "max_tokens",
211
- max_output_tokens: "max_tokens",
212
- max_completion_tokens: "max_tokens",
213
- maxOutputTokens: "max_tokens",
214
- maxTokens: "max_tokens",
215
- // top_p
216
- topp: "top_p",
217
- topP: "top_p",
218
- nucleus: "top_p",
219
- // top_k
220
- topk: "top_k",
221
- topK: "top_k",
222
- // frequency_penalty
223
- freq: "frequency_penalty",
224
- freq_penalty: "frequency_penalty",
225
- frequencyPenalty: "frequency_penalty",
226
- repetition_penalty: "frequency_penalty",
227
- // presence_penalty
228
- pres: "presence_penalty",
229
- pres_penalty: "presence_penalty",
230
- presencePenalty: "presence_penalty",
231
- // stop
232
- stop_sequences: "stop",
233
- stopSequences: "stop",
234
- stop_sequence: "stop",
235
- // seed
236
- random_seed: "seed",
237
- randomSeed: "seed",
238
- // n (completions count)
239
- candidateCount: "n",
240
- candidate_count: "n",
241
- num_completions: "n",
242
- // effort / reasoning
243
- reasoning_effort: "effort",
244
- reasoningEffort: "effort",
245
- reasoning: "effort",
246
- thinking_effort: "effort",
247
- thinkingEffort: "effort",
248
- // cache
249
- cache_control: "cache",
250
- cacheControl: "cache",
251
- cachePoint: "cache",
252
- cache_point: "cache"
253
- };
254
- var OPENAI_COMPATIBLE_PARAMS = {
255
- temperature: "temperature",
256
- max_tokens: "max_tokens",
257
- max_completion_tokens: "max_completion_tokens",
258
- top_p: "top_p",
259
- top_k: "top_k",
260
- frequency_penalty: "frequency_penalty",
261
- presence_penalty: "presence_penalty",
262
- stop: "stop",
263
- n: "n",
264
- seed: "seed",
265
- stream: "stream",
266
- effort: "reasoning_effort"
267
- };
268
- var COMMON_IMAGE_PARAMS = {
269
- prompt: "prompt",
270
- negative_prompt: "negative_prompt",
271
- seed: "seed",
272
- image_size: "image_size",
273
- aspect_ratio: "aspect_ratio",
274
- output_format: "output_format",
275
- width: "width",
276
- height: "height"
277
- };
278
- var FAL_PARAMS = {
279
- ...COMMON_IMAGE_PARAMS,
280
- num_images: "num_images",
281
- enable_safety_checker: "enable_safety_checker",
282
- enable_safety_checks: "enable_safety_checks",
283
- enable_prompt_expansion: "enable_prompt_expansion",
284
- expand_prompt: "expand_prompt"
285
- };
286
- var REPLICATE_PARAMS = {
287
- ...COMMON_IMAGE_PARAMS,
288
- input: "input",
289
- version: "version",
290
- num_outputs: "num_outputs",
291
- num_inference_steps: "num_inference_steps",
292
- guidance_scale: "guidance_scale",
293
- stream: "stream",
294
- webhook: "webhook",
295
- webhook_events_filter: "webhook_events_filter"
296
- };
297
- var PRODIA_PARAMS = {
298
- ...COMMON_IMAGE_PARAMS,
299
- model: "model",
300
- style_preset: "style_preset",
301
- steps: "steps",
302
- cfg_scale: "cfg_scale",
303
- upscale: "upscale",
304
- sampler: "sampler",
305
- type: "type",
306
- config: "config",
307
- price: "price"
308
- };
309
- var LUMA_PARAMS = {
310
- prompt: "prompt",
311
- model: "model",
312
- aspect_ratio: "aspect_ratio",
313
- keyframes: "keyframes",
314
- loop: "loop",
315
- duration: "duration",
316
- type: "type",
317
- image_ref: "image_ref",
318
- video: "video",
319
- source: "source"
320
- };
321
- var OPENROUTER_ROUTING_PARAMS = {
322
- provider: "provider",
323
- order: "order",
324
- "provider.order": "provider.order",
325
- only: "only",
326
- "provider.only": "provider.only",
327
- ignore: "ignore",
328
- "provider.ignore": "provider.ignore",
329
- allow_fallbacks: "allow_fallbacks",
330
- "provider.allow_fallbacks": "provider.allow_fallbacks",
331
- require_parameters: "require_parameters",
332
- "provider.require_parameters": "provider.require_parameters",
333
- data_collection: "data_collection",
334
- "provider.data_collection": "provider.data_collection",
335
- zdr: "zdr",
336
- "provider.zdr": "provider.zdr",
337
- enforce_distillable_text: "enforce_distillable_text",
338
- "provider.enforce_distillable_text": "provider.enforce_distillable_text",
339
- quantizations: "quantizations",
340
- "provider.quantizations": "provider.quantizations",
341
- sort: "sort",
342
- "provider.sort": "provider.sort",
343
- preferred_min_throughput: "preferred_min_throughput",
344
- "provider.preferred_min_throughput": "provider.preferred_min_throughput",
345
- preferred_max_latency: "preferred_max_latency",
346
- "provider.preferred_max_latency": "provider.preferred_max_latency",
347
- max_price: "max_price",
348
- "provider.max_price": "provider.max_price",
349
- transforms: "transforms",
350
- plugins: "plugins"
351
- };
352
- var GOOGLE_COMPATIBLE_PARAMS = {
353
- temperature: "temperature",
354
- max_tokens: "maxOutputTokens",
355
- top_p: "topP",
356
- top_k: "topK",
357
- frequency_penalty: "frequencyPenalty",
358
- presence_penalty: "presencePenalty",
359
- stop: "stopSequences",
360
- n: "candidateCount",
361
- stream: "stream",
362
- seed: "seed",
363
- responseMimeType: "responseMimeType",
364
- responseSchema: "responseSchema"
365
- };
366
- var PROVIDER_PARAMS = {
367
- openai: {
368
- temperature: "temperature",
369
- max_tokens: "max_tokens",
370
- max_completion_tokens: "max_completion_tokens",
371
- top_p: "top_p",
372
- frequency_penalty: "frequency_penalty",
373
- presence_penalty: "presence_penalty",
374
- stop: "stop",
375
- n: "n",
376
- seed: "seed",
377
- stream: "stream",
378
- effort: "reasoning_effort"
379
- },
380
- azure: OPENAI_COMPATIBLE_PARAMS,
381
- anthropic: {
382
- temperature: "temperature",
383
- max_tokens: "max_tokens",
384
- top_p: "top_p",
385
- top_k: "top_k",
386
- stop: "stop_sequences",
387
- stream: "stream",
388
- effort: "effort",
389
- cache: "cache_control",
390
- cache_ttl: "cache_ttl"
391
- },
392
- google: {
393
- temperature: "temperature",
394
- max_tokens: "maxOutputTokens",
395
- top_p: "topP",
396
- top_k: "topK",
397
- frequency_penalty: "frequencyPenalty",
398
- presence_penalty: "presencePenalty",
399
- stop: "stopSequences",
400
- n: "candidateCount",
401
- stream: "stream",
402
- seed: "seed",
403
- responseMimeType: "responseMimeType",
404
- responseSchema: "responseSchema"
405
- },
406
- "google-vertex": GOOGLE_COMPATIBLE_PARAMS,
407
- mistral: {
408
- temperature: "temperature",
409
- max_tokens: "max_tokens",
410
- top_p: "top_p",
411
- frequency_penalty: "frequency_penalty",
412
- presence_penalty: "presence_penalty",
413
- stop: "stop",
414
- n: "n",
415
- seed: "random_seed",
416
- stream: "stream",
417
- safe_prompt: "safe_prompt",
418
- min_tokens: "min_tokens"
419
- },
420
- cohere: {
421
- temperature: "temperature",
422
- max_tokens: "max_tokens",
423
- top_p: "p",
424
- top_k: "k",
425
- frequency_penalty: "frequency_penalty",
426
- presence_penalty: "presence_penalty",
427
- stop: "stop_sequences",
428
- stream: "stream",
429
- seed: "seed"
430
- },
431
- bedrock: {
432
- // Bedrock Converse API uses camelCase
433
- temperature: "temperature",
434
- max_tokens: "maxTokens",
435
- top_p: "topP",
436
- top_k: "topK",
437
- // Claude models via additionalModelRequestFields
438
- stop: "stopSequences",
439
- stream: "stream",
440
- cache: "cache_control",
441
- cache_ttl: "cache_ttl"
442
- },
443
- openrouter: {
444
- // OpenAI-compatible API with extra routing params
445
- temperature: "temperature",
446
- max_tokens: "max_tokens",
447
- max_completion_tokens: "max_completion_tokens",
448
- top_p: "top_p",
449
- top_k: "top_k",
450
- frequency_penalty: "frequency_penalty",
451
- presence_penalty: "presence_penalty",
452
- stop: "stop",
453
- n: "n",
454
- seed: "seed",
455
- stream: "stream",
456
- effort: "reasoning_effort",
457
- ...OPENROUTER_ROUTING_PARAMS
458
- },
459
- vercel: {
460
- // OpenAI-compatible gateway
461
- temperature: "temperature",
462
- max_tokens: "max_tokens",
463
- max_completion_tokens: "max_completion_tokens",
464
- top_p: "top_p",
465
- top_k: "top_k",
466
- frequency_penalty: "frequency_penalty",
467
- presence_penalty: "presence_penalty",
468
- stop: "stop",
469
- n: "n",
470
- seed: "seed",
471
- stream: "stream",
472
- effort: "reasoning_effort"
473
- },
474
- xai: OPENAI_COMPATIBLE_PARAMS,
475
- groq: OPENAI_COMPATIBLE_PARAMS,
476
- fal: FAL_PARAMS,
477
- deepinfra: OPENAI_COMPATIBLE_PARAMS,
478
- "black-forest-labs": {},
479
- together: OPENAI_COMPATIBLE_PARAMS,
480
- fireworks: OPENAI_COMPATIBLE_PARAMS,
481
- deepseek: OPENAI_COMPATIBLE_PARAMS,
482
- moonshotai: OPENAI_COMPATIBLE_PARAMS,
483
- perplexity: OPENAI_COMPATIBLE_PARAMS,
484
- alibaba: OPENAI_COMPATIBLE_PARAMS,
485
- cerebras: OPENAI_COMPATIBLE_PARAMS,
486
- replicate: REPLICATE_PARAMS,
487
- prodia: PRODIA_PARAMS,
488
- luma: LUMA_PARAMS,
489
- bytedance: {},
490
- kling: {},
491
- elevenlabs: {},
492
- assemblyai: {},
493
- deepgram: {},
494
- gladia: {},
495
- lmnt: {},
496
- hume: {},
497
- revai: {},
498
- baseten: OPENAI_COMPATIBLE_PARAMS,
499
- huggingface: OPENAI_COMPATIBLE_PARAMS
500
- };
501
- var REASONING_EFFORT_VALUES = [
502
- "none",
503
- "minimal",
504
- "low",
505
- "medium",
506
- "high",
507
- "xhigh",
508
- "max"
509
- ];
510
- var OPENAI_COMPATIBLE_PARAM_SPECS = {
511
- temperature: {
512
- type: "number",
513
- min: 0,
514
- max: 2,
515
- default: 0.7,
516
- description: "Controls randomness"
517
- },
518
- max_tokens: {
519
- type: "number",
520
- min: 1,
521
- default: 4096,
522
- description: "Maximum output tokens"
523
- },
524
- max_completion_tokens: {
525
- type: "number",
526
- min: 1,
527
- default: 4096,
528
- description: "Maximum completion tokens (reasoning models)"
529
- },
530
- top_p: {
531
- type: "number",
532
- min: 0,
533
- max: 1,
534
- default: 1,
535
- description: "Nucleus sampling"
536
- },
537
- top_k: {
538
- type: "number",
539
- min: 0,
540
- default: 40,
541
- description: "Top-K sampling"
542
- },
543
- frequency_penalty: {
544
- type: "number",
545
- min: -2,
546
- max: 2,
547
- default: 0,
548
- description: "Penalize frequent tokens"
549
- },
550
- presence_penalty: {
551
- type: "number",
552
- min: -2,
553
- max: 2,
554
- default: 0,
555
- description: "Penalize repeated topics"
556
- },
557
- stop: { type: "string", description: "Stop sequences" },
558
- n: { type: "number", min: 1, default: 1, description: "Completions count" },
559
- seed: { type: "number", description: "Random seed" },
560
- stream: { type: "boolean", default: false, description: "Stream response" },
561
- reasoning_effort: {
562
- type: "string",
563
- values: REASONING_EFFORT_VALUES,
564
- default: "medium",
565
- description: "Reasoning effort"
566
- }
567
- };
568
- var OPENROUTER_ROUTING_PARAM_SPECS = {
569
- provider: { type: "string", description: "Provider routing preferences" },
570
- order: { type: "string", description: "Provider order" },
571
- "provider.order": { type: "string", description: "Provider order" },
572
- only: { type: "string", description: "Provider allowlist" },
573
- "provider.only": { type: "string", description: "Provider allowlist" },
574
- ignore: { type: "string", description: "Provider blocklist" },
575
- "provider.ignore": { type: "string", description: "Provider blocklist" },
576
- allow_fallbacks: {
577
- type: "boolean",
578
- default: true,
579
- description: "Allow fallback providers"
580
- },
581
- "provider.allow_fallbacks": {
582
- type: "boolean",
583
- default: true,
584
- description: "Allow fallback providers"
585
- },
586
- require_parameters: {
587
- type: "boolean",
588
- default: false,
589
- description: "Only route to providers that support all request params"
590
- },
591
- "provider.require_parameters": {
592
- type: "boolean",
593
- default: false,
594
- description: "Only route to providers that support all request params"
595
- },
596
- data_collection: {
597
- type: "string",
598
- values: ["allow", "deny"],
599
- default: "allow",
600
- description: "Provider data collection policy"
601
- },
602
- "provider.data_collection": {
603
- type: "string",
604
- values: ["allow", "deny"],
605
- default: "allow",
606
- description: "Provider data collection policy"
607
- },
608
- zdr: {
609
- type: "boolean",
610
- description: "Require zero data retention providers"
611
- },
612
- "provider.zdr": {
613
- type: "boolean",
614
- description: "Require zero data retention providers"
615
- },
616
- enforce_distillable_text: {
617
- type: "boolean",
618
- description: "Require providers that allow text distillation"
619
- },
620
- "provider.enforce_distillable_text": {
621
- type: "boolean",
622
- description: "Require providers that allow text distillation"
623
- },
624
- quantizations: {
625
- type: "string",
626
- description: "Allowed provider quantization levels"
627
- },
628
- "provider.quantizations": {
629
- type: "string",
630
- description: "Allowed provider quantization levels"
631
- },
632
- sort: {
633
- type: "string",
634
- values: ["price", "throughput", "latency", "cost", "ttft", "tps"],
635
- description: "Provider sort strategy"
636
- },
637
- "provider.sort": {
638
- type: "string",
639
- values: ["price", "throughput", "latency", "cost", "ttft", "tps"],
640
- description: "Provider sort strategy"
641
- },
642
- preferred_min_throughput: {
643
- type: "number",
644
- min: 0,
645
- description: "Preferred minimum provider throughput"
646
- },
647
- "provider.preferred_min_throughput": {
648
- type: "number",
649
- min: 0,
650
- description: "Preferred minimum provider throughput"
651
- },
652
- preferred_max_latency: {
653
- type: "number",
654
- min: 0,
655
- description: "Preferred maximum provider latency"
656
- },
657
- "provider.preferred_max_latency": {
658
- type: "number",
659
- min: 0,
660
- description: "Preferred maximum provider latency"
661
- },
662
- max_price: {
663
- type: "string",
664
- description: "Maximum provider price filter"
665
- },
666
- "provider.max_price": {
667
- type: "string",
668
- description: "Maximum provider price filter"
669
- },
670
- transforms: {
671
- type: "string",
672
- description: "Legacy OpenRouter message transforms"
673
- },
674
- plugins: {
675
- type: "string",
676
- description: "OpenRouter request plugins"
677
- }
678
- };
679
- var FAL_PARAM_SPECS = {
680
- prompt: { type: "string", description: "Prompt" },
681
- negative_prompt: { type: "string", description: "Negative prompt" },
682
- seed: { type: "number", description: "Random seed" },
683
- num_images: {
684
- type: "number",
685
- min: 1,
686
- description: "Number of images to generate"
687
- },
688
- image_size: { type: "string", description: "Output image size" },
689
- aspect_ratio: { type: "string", description: "Output aspect ratio" },
690
- enable_safety_checker: {
691
- type: "boolean",
692
- description: "Enable safety checker"
693
- },
694
- enable_safety_checks: {
695
- type: "boolean",
696
- description: "Enable safety checker"
697
- },
698
- enable_prompt_expansion: {
699
- type: "boolean",
700
- description: "Enable prompt expansion"
701
- },
702
- expand_prompt: {
703
- type: "boolean",
704
- description: "Enable prompt expansion"
705
- },
706
- output_format: {
707
- type: "string",
708
- values: ["jpeg", "jpg", "png", "webp", "gif"],
709
- description: "Output image format"
710
- },
711
- width: { type: "number", min: 1, description: "Image width" },
712
- height: { type: "number", min: 1, description: "Image height" }
713
- };
714
- var REPLICATE_PARAM_SPECS = {
715
- prompt: { type: "string", description: "Prompt" },
716
- negative_prompt: { type: "string", description: "Negative prompt" },
717
- input: { type: "string", description: "Model input object" },
718
- version: { type: "string", description: "Model version" },
719
- seed: { type: "number", description: "Random seed" },
720
- num_outputs: {
721
- type: "number",
722
- min: 1,
723
- description: "Number of outputs to generate"
724
- },
725
- num_inference_steps: {
726
- type: "number",
727
- min: 1,
728
- description: "Number of inference steps"
729
- },
730
- guidance_scale: {
731
- type: "number",
732
- min: 0,
733
- description: "Guidance scale"
734
- },
735
- image_size: { type: "string", description: "Output image size" },
736
- aspect_ratio: { type: "string", description: "Output aspect ratio" },
737
- output_format: { type: "string", description: "Output format" },
738
- width: { type: "number", min: 1, description: "Image width" },
739
- height: { type: "number", min: 1, description: "Image height" },
740
- stream: { type: "boolean", description: "Request streaming output" },
741
- webhook: { type: "string", description: "Webhook URL" },
742
- webhook_events_filter: {
743
- type: "string",
744
- description: "Webhook events filter"
745
- }
746
- };
747
- var PRODIA_PARAM_SPECS = {
748
- model: { type: "string", description: "Model name" },
749
- prompt: { type: "string", description: "Prompt" },
750
- negative_prompt: { type: "string", description: "Negative prompt" },
751
- style_preset: { type: "string", description: "Style preset" },
752
- steps: { type: "number", min: 1, description: "Generation steps" },
753
- cfg_scale: { type: "number", min: 0, description: "CFG scale" },
754
- seed: { type: "number", description: "Random seed" },
755
- upscale: { type: "boolean", description: "Enable 2x upscale" },
756
- sampler: { type: "string", description: "Sampler" },
757
- width: { type: "number", min: 1, max: 1024, description: "Image width" },
758
- height: { type: "number", min: 1, max: 1024, description: "Image height" },
759
- image_size: { type: "string", description: "Output image size" },
760
- aspect_ratio: { type: "string", description: "Output aspect ratio" },
761
- output_format: { type: "string", description: "Output format" },
762
- type: { type: "string", description: "Prodia v2 job type" },
763
- config: { type: "string", description: "Prodia v2 job config" },
764
- price: { type: "boolean", description: "Include Prodia v2 job price" }
765
- };
766
- var LUMA_PARAM_SPECS = {
767
- prompt: { type: "string", description: "Prompt" },
768
- model: { type: "string", description: "Model name" },
769
- aspect_ratio: { type: "string", description: "Output aspect ratio" },
770
- keyframes: { type: "string", description: "Generation keyframes" },
771
- loop: { type: "boolean", description: "Generate a looping video" },
772
- duration: { type: "string", description: "Generation duration" },
773
- type: { type: "string", description: "Generation type" },
774
- image_ref: { type: "string", description: "Image reference" },
775
- video: { type: "string", description: "Video options" },
776
- source: { type: "string", description: "Source generation or media" }
777
- };
778
- var GOOGLE_COMPATIBLE_PARAM_SPECS = {
779
- temperature: {
780
- type: "number",
781
- min: 0,
782
- max: 2,
783
- default: 0.7,
784
- description: "Controls randomness"
785
- },
786
- maxOutputTokens: {
787
- type: "number",
788
- min: 1,
789
- default: 4096,
790
- description: "Maximum output tokens"
791
- },
792
- topP: {
793
- type: "number",
794
- min: 0,
795
- max: 1,
796
- default: 1,
797
- description: "Nucleus sampling"
798
- },
799
- topK: {
800
- type: "number",
801
- min: 0,
802
- default: 40,
803
- description: "Top-K sampling"
804
- },
805
- frequencyPenalty: {
806
- type: "number",
807
- min: -2,
808
- max: 2,
809
- default: 0,
810
- description: "Penalize frequent tokens"
811
- },
812
- presencePenalty: {
813
- type: "number",
814
- min: -2,
815
- max: 2,
816
- default: 0,
817
- description: "Penalize repeated topics"
818
- },
819
- stopSequences: { type: "string", description: "Stop sequences" },
820
- candidateCount: {
821
- type: "number",
822
- min: 1,
823
- default: 1,
824
- description: "Candidate count"
825
- },
826
- stream: { type: "boolean", default: false, description: "Stream response" },
827
- seed: { type: "number", description: "Random seed" },
828
- responseMimeType: { type: "string", description: "Response MIME type" },
829
- responseSchema: { type: "string", description: "Response schema" }
830
- };
831
- var PARAM_SPECS = {
832
- openai: {
833
- temperature: {
834
- type: "number",
835
- min: 0,
836
- max: 2,
837
- default: 0.7,
838
- description: "Controls randomness"
839
- },
840
- max_tokens: {
841
- type: "number",
842
- min: 1,
843
- default: 4096,
844
- description: "Maximum output tokens"
845
- },
846
- max_completion_tokens: {
847
- type: "number",
848
- min: 1,
849
- default: 4096,
850
- description: "Maximum completion tokens (reasoning models)"
851
- },
852
- top_p: {
853
- type: "number",
854
- min: 0,
855
- max: 1,
856
- default: 1,
857
- description: "Nucleus sampling"
858
- },
859
- frequency_penalty: {
860
- type: "number",
861
- min: -2,
862
- max: 2,
863
- default: 0,
864
- description: "Penalize frequent tokens"
865
- },
866
- presence_penalty: {
867
- type: "number",
868
- min: -2,
869
- max: 2,
870
- default: 0,
871
- description: "Penalize repeated topics"
872
- },
873
- stop: { type: "string", description: "Stop sequences" },
874
- n: { type: "number", min: 1, default: 1, description: "Completions count" },
875
- seed: { type: "number", description: "Random seed" },
876
- stream: { type: "boolean", default: false, description: "Stream response" },
877
- reasoning_effort: {
878
- type: "string",
879
- values: REASONING_EFFORT_VALUES,
880
- default: "medium",
881
- description: "Reasoning effort"
882
- }
883
- },
884
- azure: OPENAI_COMPATIBLE_PARAM_SPECS,
885
- anthropic: {
886
- temperature: {
887
- type: "number",
888
- min: 0,
889
- max: 1,
890
- default: 0.7,
891
- description: "Controls randomness"
892
- },
893
- max_tokens: {
894
- type: "number",
895
- min: 1,
896
- default: 4096,
897
- description: "Maximum output tokens"
898
- },
899
- top_p: {
900
- type: "number",
901
- min: 0,
902
- max: 1,
903
- default: 1,
904
- description: "Nucleus sampling"
905
- },
906
- top_k: {
907
- type: "number",
908
- min: 0,
909
- default: 40,
910
- description: "Top-K sampling"
911
- },
912
- stop_sequences: { type: "string", description: "Stop sequences" },
913
- stream: { type: "boolean", default: false, description: "Stream response" },
914
- effort: {
915
- type: "string",
916
- values: REASONING_EFFORT_VALUES,
917
- default: "low",
918
- description: "Thinking effort"
919
- },
920
- cache_control: {
921
- type: "string",
922
- values: ["ephemeral"],
923
- default: "ephemeral",
924
- description: "Cache control"
925
- },
926
- cache_ttl: {
927
- type: "string",
928
- values: ["5m", "1h"],
929
- default: "5m",
930
- description: "Cache TTL"
931
- }
932
- },
933
- google: {
934
- temperature: {
935
- type: "number",
936
- min: 0,
937
- max: 2,
938
- default: 0.7,
939
- description: "Controls randomness"
940
- },
941
- maxOutputTokens: {
942
- type: "number",
943
- min: 1,
944
- default: 4096,
945
- description: "Maximum output tokens"
946
- },
947
- topP: {
948
- type: "number",
949
- min: 0,
950
- max: 1,
951
- default: 1,
952
- description: "Nucleus sampling"
953
- },
954
- topK: {
955
- type: "number",
956
- min: 0,
957
- default: 40,
958
- description: "Top-K sampling"
959
- },
960
- frequencyPenalty: {
961
- type: "number",
962
- min: -2,
963
- max: 2,
964
- default: 0,
965
- description: "Penalize frequent tokens"
966
- },
967
- presencePenalty: {
968
- type: "number",
969
- min: -2,
970
- max: 2,
971
- default: 0,
972
- description: "Penalize repeated topics"
973
- },
974
- stopSequences: { type: "string", description: "Stop sequences" },
975
- candidateCount: {
976
- type: "number",
977
- min: 1,
978
- default: 1,
979
- description: "Candidate count"
980
- },
981
- stream: { type: "boolean", default: false, description: "Stream response" },
982
- seed: { type: "number", description: "Random seed" },
983
- responseMimeType: { type: "string", description: "Response MIME type" },
984
- responseSchema: { type: "string", description: "Response schema" }
985
- },
986
- "google-vertex": GOOGLE_COMPATIBLE_PARAM_SPECS,
987
- mistral: {
988
- temperature: {
989
- type: "number",
990
- min: 0,
991
- max: 1,
992
- default: 0.7,
993
- description: "Controls randomness"
994
- },
995
- max_tokens: {
996
- type: "number",
997
- min: 1,
998
- default: 4096,
999
- description: "Maximum output tokens"
1000
- },
1001
- top_p: {
1002
- type: "number",
1003
- min: 0,
1004
- max: 1,
1005
- default: 1,
1006
- description: "Nucleus sampling"
1007
- },
1008
- frequency_penalty: {
1009
- type: "number",
1010
- min: -2,
1011
- max: 2,
1012
- default: 0,
1013
- description: "Penalize frequent tokens"
1014
- },
1015
- presence_penalty: {
1016
- type: "number",
1017
- min: -2,
1018
- max: 2,
1019
- default: 0,
1020
- description: "Penalize repeated topics"
1021
- },
1022
- stop: { type: "string", description: "Stop sequences" },
1023
- n: { type: "number", min: 1, default: 1, description: "Completions count" },
1024
- random_seed: { type: "number", description: "Random seed" },
1025
- stream: { type: "boolean", default: false, description: "Stream response" },
1026
- safe_prompt: {
1027
- type: "boolean",
1028
- default: false,
1029
- description: "Enable safe prompt"
1030
- },
1031
- min_tokens: {
1032
- type: "number",
1033
- min: 0,
1034
- default: 0,
1035
- description: "Minimum tokens"
1036
- }
1037
- },
1038
- cohere: {
1039
- temperature: {
1040
- type: "number",
1041
- min: 0,
1042
- max: 1,
1043
- default: 0.7,
1044
- description: "Controls randomness"
1045
- },
1046
- max_tokens: {
1047
- type: "number",
1048
- min: 1,
1049
- default: 4096,
1050
- description: "Maximum output tokens"
1051
- },
1052
- p: {
1053
- type: "number",
1054
- min: 0,
1055
- max: 1,
1056
- default: 1,
1057
- description: "Nucleus sampling (p)"
1058
- },
1059
- k: {
1060
- type: "number",
1061
- min: 0,
1062
- max: 500,
1063
- default: 40,
1064
- description: "Top-K sampling (k)"
1065
- },
1066
- frequency_penalty: {
1067
- type: "number",
1068
- min: 0,
1069
- max: 1,
1070
- default: 0,
1071
- description: "Penalize frequent tokens"
1072
- },
1073
- presence_penalty: {
1074
- type: "number",
1075
- min: 0,
1076
- max: 1,
1077
- default: 0,
1078
- description: "Penalize repeated topics"
1079
- },
1080
- stop_sequences: { type: "string", description: "Stop sequences" },
1081
- stream: { type: "boolean", default: false, description: "Stream response" },
1082
- seed: { type: "number", description: "Random seed" }
1083
- },
1084
- bedrock: {
1085
- // Converse API inferenceConfig params
1086
- temperature: {
1087
- type: "number",
1088
- min: 0,
1089
- max: 1,
1090
- default: 0.7,
1091
- description: "Controls randomness"
1092
- },
1093
- maxTokens: {
1094
- type: "number",
1095
- min: 1,
1096
- default: 4096,
1097
- description: "Maximum output tokens"
1098
- },
1099
- topP: {
1100
- type: "number",
1101
- min: 0,
1102
- max: 1,
1103
- default: 1,
1104
- description: "Nucleus sampling"
1105
- },
1106
- topK: {
1107
- type: "number",
1108
- min: 0,
1109
- default: 40,
1110
- description: "Top-K sampling"
1111
- },
1112
- stopSequences: { type: "string", description: "Stop sequences" },
1113
- stream: { type: "boolean", default: false, description: "Stream response" },
1114
- cache_control: {
1115
- type: "string",
1116
- values: ["ephemeral"],
1117
- default: "ephemeral",
1118
- description: "Cache control"
1119
- },
1120
- cache_ttl: {
1121
- type: "string",
1122
- values: ["5m", "1h"],
1123
- default: "5m",
1124
- description: "Cache TTL"
1125
- }
1126
- },
1127
- openrouter: {
1128
- // Loose validation — proxies to many providers with varying ranges
1129
- temperature: {
1130
- type: "number",
1131
- min: 0,
1132
- max: 2,
1133
- default: 0.7,
1134
- description: "Controls randomness"
1135
- },
1136
- max_tokens: {
1137
- type: "number",
1138
- min: 1,
1139
- default: 4096,
1140
- description: "Maximum output tokens"
1141
- },
1142
- max_completion_tokens: {
1143
- type: "number",
1144
- min: 1,
1145
- default: 4096,
1146
- description: "Maximum completion tokens (reasoning models)"
1147
- },
1148
- top_p: {
1149
- type: "number",
1150
- min: 0,
1151
- max: 1,
1152
- default: 1,
1153
- description: "Nucleus sampling"
1154
- },
1155
- top_k: {
1156
- type: "number",
1157
- min: 0,
1158
- default: 40,
1159
- description: "Top-K sampling"
1160
- },
1161
- frequency_penalty: {
1162
- type: "number",
1163
- min: -2,
1164
- max: 2,
1165
- default: 0,
1166
- description: "Penalize frequent tokens"
1167
- },
1168
- presence_penalty: {
1169
- type: "number",
1170
- min: -2,
1171
- max: 2,
1172
- default: 0,
1173
- description: "Penalize repeated topics"
1174
- },
1175
- stop: { type: "string", description: "Stop sequences" },
1176
- n: { type: "number", min: 1, default: 1, description: "Completions count" },
1177
- seed: { type: "number", description: "Random seed" },
1178
- stream: { type: "boolean", default: false, description: "Stream response" },
1179
- reasoning_effort: {
1180
- type: "string",
1181
- values: REASONING_EFFORT_VALUES,
1182
- default: "medium",
1183
- description: "Reasoning effort"
1184
- },
1185
- ...OPENROUTER_ROUTING_PARAM_SPECS
1186
- },
1187
- vercel: {
1188
- // Loose validation — proxies to many providers with varying ranges
1189
- temperature: {
1190
- type: "number",
1191
- min: 0,
1192
- max: 2,
1193
- default: 0.7,
1194
- description: "Controls randomness"
1195
- },
1196
- max_tokens: {
1197
- type: "number",
1198
- min: 1,
1199
- default: 4096,
1200
- description: "Maximum output tokens"
1201
- },
1202
- max_completion_tokens: {
1203
- type: "number",
1204
- min: 1,
1205
- default: 4096,
1206
- description: "Maximum completion tokens (reasoning models)"
1207
- },
1208
- top_p: {
1209
- type: "number",
1210
- min: 0,
1211
- max: 1,
1212
- default: 1,
1213
- description: "Nucleus sampling"
1214
- },
1215
- top_k: {
1216
- type: "number",
1217
- min: 0,
1218
- default: 40,
1219
- description: "Top-K sampling"
1220
- },
1221
- frequency_penalty: {
1222
- type: "number",
1223
- min: -2,
1224
- max: 2,
1225
- default: 0,
1226
- description: "Penalize frequent tokens"
1227
- },
1228
- presence_penalty: {
1229
- type: "number",
1230
- min: -2,
1231
- max: 2,
1232
- default: 0,
1233
- description: "Penalize repeated topics"
1234
- },
1235
- stop: { type: "string", description: "Stop sequences" },
1236
- n: { type: "number", min: 1, default: 1, description: "Completions count" },
1237
- seed: { type: "number", description: "Random seed" },
1238
- stream: { type: "boolean", default: false, description: "Stream response" },
1239
- reasoning_effort: {
1240
- type: "string",
1241
- values: REASONING_EFFORT_VALUES,
1242
- default: "medium",
1243
- description: "Reasoning effort"
1244
- },
1245
- order: { type: "string", description: "Gateway provider order" },
1246
- only: { type: "string", description: "Gateway provider allowlist" },
1247
- models: { type: "string", description: "Gateway fallback models" },
1248
- tags: { type: "string", description: "Gateway usage tags" },
1249
- sort: {
1250
- type: "string",
1251
- values: ["cost", "ttft", "tps"],
1252
- description: "Gateway provider sort strategy"
1253
- },
1254
- caching: {
1255
- type: "string",
1256
- values: ["auto"],
1257
- description: "Gateway automatic caching strategy"
1258
- },
1259
- user: { type: "string", description: "Gateway usage user identifier" },
1260
- byok: { type: "string", description: "Gateway BYOK credentials" },
1261
- zero_data_retention: {
1262
- type: "boolean",
1263
- description: "Gateway zero data retention routing"
1264
- },
1265
- zeroDataRetention: {
1266
- type: "boolean",
1267
- description: "Gateway zero data retention routing"
1268
- },
1269
- disallow_prompt_training: {
1270
- type: "boolean",
1271
- description: "Gateway prompt training opt-out routing"
1272
- },
1273
- disallowPromptTraining: {
1274
- type: "boolean",
1275
- description: "Gateway prompt training opt-out routing"
1276
- },
1277
- hipaa_compliant: {
1278
- type: "boolean",
1279
- description: "Gateway HIPAA-compliant routing"
1280
- },
1281
- hipaaCompliant: {
1282
- type: "boolean",
1283
- description: "Gateway HIPAA-compliant routing"
1284
- },
1285
- quota_entity_id: {
1286
- type: "string",
1287
- description: "Gateway quota entity identifier"
1288
- },
1289
- quotaEntityId: {
1290
- type: "string",
1291
- description: "Gateway quota entity identifier"
1292
- },
1293
- provider_timeouts: {
1294
- type: "string",
1295
- description: "Gateway provider timeouts"
1296
- },
1297
- providerTimeouts: {
1298
- type: "string",
1299
- description: "Gateway provider timeouts"
1300
- }
1301
- },
1302
- xai: OPENAI_COMPATIBLE_PARAM_SPECS,
1303
- groq: OPENAI_COMPATIBLE_PARAM_SPECS,
1304
- fal: FAL_PARAM_SPECS,
1305
- deepinfra: OPENAI_COMPATIBLE_PARAM_SPECS,
1306
- "black-forest-labs": {},
1307
- together: OPENAI_COMPATIBLE_PARAM_SPECS,
1308
- fireworks: OPENAI_COMPATIBLE_PARAM_SPECS,
1309
- deepseek: OPENAI_COMPATIBLE_PARAM_SPECS,
1310
- moonshotai: OPENAI_COMPATIBLE_PARAM_SPECS,
1311
- perplexity: OPENAI_COMPATIBLE_PARAM_SPECS,
1312
- alibaba: OPENAI_COMPATIBLE_PARAM_SPECS,
1313
- cerebras: OPENAI_COMPATIBLE_PARAM_SPECS,
1314
- replicate: REPLICATE_PARAM_SPECS,
1315
- prodia: PRODIA_PARAM_SPECS,
1316
- luma: LUMA_PARAM_SPECS,
1317
- bytedance: {},
1318
- kling: {},
1319
- elevenlabs: {},
1320
- assemblyai: {},
1321
- deepgram: {},
1322
- gladia: {},
1323
- lmnt: {},
1324
- hume: {},
1325
- revai: {},
1326
- baseten: OPENAI_COMPATIBLE_PARAM_SPECS,
1327
- huggingface: OPENAI_COMPATIBLE_PARAM_SPECS
1328
- };
1329
- function isReasoningModel(model) {
1330
- const name = modelLeafName(model);
1331
- const oSeries = name.match(/^o\d+/)?.[0];
1332
- const gptSeries = name.match(/^gpt-[5-9]/)?.[0];
1333
- return (oSeries ? modelMatchesFamily(name, oSeries) : false) || (gptSeries ? modelMatchesFamily(name, gptSeries) : false);
1334
- }
1335
- function canHostOpenAIModels(provider) {
1336
- return provider === "openai" || provider === "azure" || provider === "openrouter" || provider === "vercel";
1337
- }
1338
- function isGatewayProvider(provider) {
1339
- return provider === "openrouter" || provider === "vercel";
1340
- }
1341
- function detectGatewaySubProvider(model) {
1342
- const slash = model.indexOf("/");
1343
- if (slash < 1) return void 0;
1344
- const prefix = normalizeModelForMatching(model.slice(0, slash));
1345
- const direct = {
1346
- openai: "openai",
1347
- anthropic: "anthropic",
1348
- google: "google",
1349
- vertex: "google",
1350
- "google-vertex": "google",
1351
- mistral: "mistral",
1352
- cohere: "cohere"
1353
- };
1354
- return direct[prefix];
1355
- }
1356
- var REASONING_MODEL_UNSUPPORTED = /* @__PURE__ */ new Set([
1357
- "temperature",
1358
- "top_p",
1359
- "top_k",
1360
- "frequency_penalty",
1361
- "presence_penalty",
1362
- "n"
1363
- ]);
1364
- function detectBedrockModelFamily(model) {
1365
- const families = [
1366
- "anthropic",
1367
- "meta",
1368
- "amazon",
1369
- "mistral",
1370
- "cohere",
1371
- "ai21"
1372
- ];
1373
- const parts = modelLeafName(model).split(".");
1374
- return families.find((family) => parts.includes(family));
1375
- }
1376
- function bedrockSupportsCaching(model) {
1377
- const family = detectBedrockModelFamily(model);
1378
- if (family === "anthropic") return true;
1379
- if (family === "amazon") {
1380
- const parts = modelLeafName(model).split(".");
1381
- const amazonIndex = parts.indexOf("amazon");
1382
- const modelName = amazonIndex >= 0 ? parts[amazonIndex + 1] : void 0;
1383
- return modelName ? modelMatchesFamily(modelName, "nova") : false;
1384
- }
1385
- return false;
1386
- }
1387
- var CACHE_VALUES = {
1388
- openai: void 0,
1389
- // OpenAI auto-caches; no explicit param
1390
- azure: void 0,
1391
- anthropic: "ephemeral",
1392
- google: void 0,
1393
- // Google uses explicit caching API, not a param
1394
- "google-vertex": void 0,
1395
- mistral: void 0,
1396
- cohere: void 0,
1397
- bedrock: "ephemeral",
1398
- // Supported for Claude models on Bedrock
1399
- openrouter: void 0,
1400
- // Depends on underlying provider
1401
- vercel: void 0,
1402
- // Depends on underlying provider
1403
- xai: void 0,
1404
- groq: void 0,
1405
- fal: void 0,
1406
- deepinfra: void 0,
1407
- "black-forest-labs": void 0,
1408
- together: void 0,
1409
- fireworks: void 0,
1410
- deepseek: void 0,
1411
- moonshotai: void 0,
1412
- perplexity: void 0,
1413
- alibaba: void 0,
1414
- cerebras: void 0,
1415
- replicate: void 0,
1416
- prodia: void 0,
1417
- luma: void 0,
1418
- bytedance: void 0,
1419
- kling: void 0,
1420
- elevenlabs: void 0,
1421
- assemblyai: void 0,
1422
- deepgram: void 0,
1423
- gladia: void 0,
1424
- lmnt: void 0,
1425
- hume: void 0,
1426
- revai: void 0,
1427
- baseten: void 0,
1428
- huggingface: void 0
1429
- };
1430
- var CACHE_TTLS = {
1431
- openai: void 0,
1432
- azure: void 0,
1433
- anthropic: ["5m", "1h"],
1434
- google: void 0,
1435
- "google-vertex": void 0,
1436
- mistral: void 0,
1437
- cohere: void 0,
1438
- bedrock: ["5m", "1h"],
1439
- // Claude on Bedrock uses same TTLs as direct Anthropic
1440
- openrouter: void 0,
1441
- vercel: void 0,
1442
- xai: void 0,
1443
- groq: void 0,
1444
- fal: void 0,
1445
- deepinfra: void 0,
1446
- "black-forest-labs": void 0,
1447
- together: void 0,
1448
- fireworks: void 0,
1449
- deepseek: void 0,
1450
- moonshotai: void 0,
1451
- perplexity: void 0,
1452
- alibaba: void 0,
1453
- cerebras: void 0,
1454
- replicate: void 0,
1455
- prodia: void 0,
1456
- luma: void 0,
1457
- bytedance: void 0,
1458
- kling: void 0,
1459
- elevenlabs: void 0,
1460
- assemblyai: void 0,
1461
- deepgram: void 0,
1462
- gladia: void 0,
1463
- lmnt: void 0,
1464
- hume: void 0,
1465
- revai: void 0,
1466
- baseten: void 0,
1467
- huggingface: void 0
1468
- };
1469
-
1470
- export {
1471
- HOST_ALIASES,
1472
- resolveHostAlias,
1473
- providerFromHostAlias,
1474
- modelMatchesFamily,
1475
- detectProvider,
1476
- ALIASES,
1477
- PROVIDER_PARAMS,
1478
- PARAM_SPECS,
1479
- isReasoningModel,
1480
- canHostOpenAIModels,
1481
- isGatewayProvider,
1482
- detectGatewaySubProvider,
1483
- REASONING_MODEL_UNSUPPORTED,
1484
- detectBedrockModelFamily,
1485
- bedrockSupportsCaching,
1486
- CACHE_VALUES,
1487
- CACHE_TTLS
1488
- };