llm-strings 1.4.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,1267 +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/providers.ts
21
- var providers_exports = {};
22
- __export(providers_exports, {
23
- ALIASES: () => ALIASES,
24
- CACHE_TTLS: () => CACHE_TTLS,
25
- CACHE_VALUES: () => CACHE_VALUES,
26
- CANONICAL_PARAM_SPECS: () => CANONICAL_PARAM_SPECS,
27
- DURATION_RE: () => DURATION_RE,
28
- HOST_ALIASES: () => HOST_ALIASES,
29
- PARAM_SPECS: () => PARAM_SPECS,
30
- PROVIDER_META: () => PROVIDER_META,
31
- PROVIDER_PARAMS: () => PROVIDER_PARAMS,
32
- REASONING_MODEL_UNSUPPORTED: () => REASONING_MODEL_UNSUPPORTED,
33
- bedrockSupportsCaching: () => bedrockSupportsCaching,
34
- canHostOpenAIModels: () => canHostOpenAIModels,
35
- detectBedrockModelFamily: () => detectBedrockModelFamily,
36
- detectGatewaySubProvider: () => detectGatewaySubProvider,
37
- detectProvider: () => detectProvider,
38
- isGatewayProvider: () => isGatewayProvider,
39
- isReasoningModel: () => isReasoningModel,
40
- providerFromHostAlias: () => providerFromHostAlias,
41
- resolveHostAlias: () => resolveHostAlias
42
- });
43
- module.exports = __toCommonJS(providers_exports);
44
-
45
- // src/provider-core.ts
46
- function hasOwn(object, key) {
47
- return Object.prototype.hasOwnProperty.call(object, key);
48
- }
49
- var HOST_ALIASES = {
50
- openai: "api.openai.com",
51
- azure: "models.inference.ai.azure.com",
52
- anthropic: "api.anthropic.com",
53
- google: "generativelanguage.googleapis.com",
54
- "google-vertex": "aiplatform.googleapis.com",
55
- aistudio: "generativelanguage.googleapis.com",
56
- mistral: "api.mistral.ai",
57
- cohere: "api.cohere.com",
58
- bedrock: "bedrock-runtime.us-east-1.amazonaws.com",
59
- openrouter: "openrouter.ai",
60
- vercel: "gateway.ai.vercel.app",
61
- alibaba: "dashscope-intl.aliyuncs.com",
62
- alibabacloud: "dashscope-intl.aliyuncs.com",
63
- dashscope: "dashscope-intl.aliyuncs.com",
64
- groq: "api.groq.com",
65
- fal: "fal.run",
66
- fireworks: "api.fireworks.ai",
67
- fireworksai: "api.fireworks.ai",
68
- "black-forest-labs": "api.bfl.ai",
69
- bfl: "api.bfl.ai",
70
- deepseek: "api.deepseek.com",
71
- moonshotai: "api.moonshot.ai",
72
- moonshot: "api.moonshot.ai",
73
- perplexity: "api.perplexity.ai",
74
- venice: "api.venice.ai",
75
- parasail: "api.parasail.io",
76
- deepinfra: "api.deepinfra.com",
77
- atlascloud: "api.atlascloud.ai",
78
- novita: "api.novita.ai",
79
- novitaai: "api.novita.ai",
80
- grok: "api.x.ai",
81
- xai: "api.x.ai",
82
- together: "api.together.xyz",
83
- togetherai: "api.together.xyz",
84
- cerebras: "api.cerebras.ai",
85
- replicate: "api.replicate.com",
86
- prodia: "api.prodia.com",
87
- luma: "api.lumalabs.ai",
88
- bytedance: "ark.cn-beijing.volces.com",
89
- kling: "api.klingai.com",
90
- elevenlabs: "api.elevenlabs.io",
91
- assemblyai: "api.assemblyai.com",
92
- deepgram: "api.deepgram.com",
93
- gladia: "api.gladia.io",
94
- lmnt: "api.lmnt.com",
95
- hume: "api.hume.ai",
96
- revai: "api.rev.ai",
97
- baseten: "api.baseten.co",
98
- huggingface: "api-inference.huggingface.co",
99
- wandb: "api.inference.wandb.ai",
100
- weightsandbiases: "api.inference.wandb.ai",
101
- baidu: "qianfan.baidubce.com",
102
- qianfan: "qianfan.baidubce.com",
103
- vertex: "aiplatform.googleapis.com",
104
- xiaomi: "api.xiaomimimo.com",
105
- minimax: "api.minimax.io"
106
- };
107
- var HOST_ALIAS_PROVIDERS = {
108
- aistudio: "google",
109
- vertex: "google-vertex",
110
- grok: "xai",
111
- bfl: "black-forest-labs",
112
- moonshot: "moonshotai",
113
- alibaba: "alibaba",
114
- alibabacloud: "alibaba",
115
- dashscope: "alibaba",
116
- togetherai: "together",
117
- fireworksai: "fireworks"
118
- };
119
- function readProcessEnv() {
120
- return typeof process !== "undefined" && process.env ? process.env : {};
121
- }
122
- function normalizeHostValue(value) {
123
- const trimmed = value.trim();
124
- if (!trimmed) return trimmed;
125
- try {
126
- if (trimmed.includes("://")) {
127
- return new URL(trimmed).host;
128
- }
129
- } catch {
130
- }
131
- return trimmed.replace(/^\/\//, "").split("/")[0] ?? trimmed;
132
- }
133
- function envHostOverride(alias, env) {
134
- const upper = alias.toUpperCase();
135
- const override = env[`LLM_STRINGS_${upper}_HOST`] ?? env[`LLM_STRINGS_HOST_${upper}`];
136
- return override?.trim() ? override : void 0;
137
- }
138
- function resolveHostAlias(host, env = readProcessEnv()) {
139
- const normalizedHost = host.toLowerCase();
140
- if (!hasOwn(HOST_ALIASES, normalizedHost)) {
141
- return { host };
142
- }
143
- const alias = normalizedHost;
144
- const override = envHostOverride(alias, env);
145
- return {
146
- host: normalizeHostValue(override ?? HOST_ALIASES[alias]),
147
- alias
148
- };
149
- }
150
- function providerFromHostAlias(alias) {
151
- const normalizedAlias = alias.toLowerCase();
152
- if (hasOwn(PROVIDER_PARAMS, normalizedAlias)) {
153
- return normalizedAlias;
154
- }
155
- if (hasOwn(HOST_ALIAS_PROVIDERS, normalizedAlias)) {
156
- return HOST_ALIAS_PROVIDERS[normalizedAlias];
157
- }
158
- return void 0;
159
- }
160
- function detectProvider(host) {
161
- host = host.toLowerCase();
162
- if (host.includes("openrouter")) return "openrouter";
163
- if (host.includes("gateway.ai.vercel")) return "vercel";
164
- if (host.includes("amazonaws") || host.includes("bedrock")) return "bedrock";
165
- if (host.includes("aiplatform.googleapis")) return "google-vertex";
166
- if (host.includes("api.x.ai")) return "xai";
167
- if (host.includes("groq")) return "groq";
168
- if (host.includes("fal.run") || host.includes("fal.ai")) return "fal";
169
- if (host.includes("deepinfra")) return "deepinfra";
170
- if (host.includes("bfl.ai")) return "black-forest-labs";
171
- if (host.includes("together")) return "together";
172
- if (host.includes("fireworks")) return "fireworks";
173
- if (host.includes("deepseek")) return "deepseek";
174
- if (host.includes("moonshot")) return "moonshotai";
175
- if (host.includes("perplexity")) return "perplexity";
176
- if (host.includes("dashscope") || host.includes("aliyuncs")) return "alibaba";
177
- if (host.includes("cerebras")) return "cerebras";
178
- if (host.includes("replicate")) return "replicate";
179
- if (host.includes("prodia")) return "prodia";
180
- if (host.includes("lumalabs") || host.includes("luma")) return "luma";
181
- if (host.includes("volces") || host.includes("bytedance")) return "bytedance";
182
- if (host.includes("kling")) return "kling";
183
- if (host.includes("elevenlabs")) return "elevenlabs";
184
- if (host.includes("assemblyai")) return "assemblyai";
185
- if (host.includes("deepgram")) return "deepgram";
186
- if (host.includes("gladia")) return "gladia";
187
- if (host.includes("lmnt")) return "lmnt";
188
- if (host.includes("hume")) return "hume";
189
- if (host.includes("rev.ai")) return "revai";
190
- if (host.includes("baseten")) return "baseten";
191
- if (host.includes("huggingface")) return "huggingface";
192
- if (host.includes("azure")) return "azure";
193
- if (host.includes("openai")) return "openai";
194
- if (host.includes("anthropic") || host.includes("claude")) return "anthropic";
195
- if (host.includes("googleapis") || host.includes("google")) return "google";
196
- if (host.includes("mistral")) return "mistral";
197
- if (host.includes("cohere")) return "cohere";
198
- return void 0;
199
- }
200
- var ALIASES = {
201
- // temperature
202
- temp: "temperature",
203
- // max_tokens
204
- max: "max_tokens",
205
- max_out: "max_tokens",
206
- max_output: "max_tokens",
207
- max_output_tokens: "max_tokens",
208
- max_completion_tokens: "max_tokens",
209
- maxOutputTokens: "max_tokens",
210
- maxTokens: "max_tokens",
211
- // top_p
212
- topp: "top_p",
213
- topP: "top_p",
214
- nucleus: "top_p",
215
- // top_k
216
- topk: "top_k",
217
- topK: "top_k",
218
- // frequency_penalty
219
- freq: "frequency_penalty",
220
- freq_penalty: "frequency_penalty",
221
- frequencyPenalty: "frequency_penalty",
222
- repetition_penalty: "frequency_penalty",
223
- // presence_penalty
224
- pres: "presence_penalty",
225
- pres_penalty: "presence_penalty",
226
- presencePenalty: "presence_penalty",
227
- // stop
228
- stop_sequences: "stop",
229
- stopSequences: "stop",
230
- stop_sequence: "stop",
231
- // seed
232
- random_seed: "seed",
233
- randomSeed: "seed",
234
- // n (completions count)
235
- candidateCount: "n",
236
- candidate_count: "n",
237
- num_completions: "n",
238
- // effort / reasoning
239
- reasoning_effort: "effort",
240
- reasoning: "effort",
241
- // cache
242
- cache_control: "cache",
243
- cacheControl: "cache",
244
- cachePoint: "cache",
245
- cache_point: "cache"
246
- };
247
- var OPENAI_COMPATIBLE_PARAMS = {
248
- temperature: "temperature",
249
- max_tokens: "max_tokens",
250
- top_p: "top_p",
251
- top_k: "top_k",
252
- frequency_penalty: "frequency_penalty",
253
- presence_penalty: "presence_penalty",
254
- stop: "stop",
255
- n: "n",
256
- seed: "seed",
257
- stream: "stream",
258
- effort: "reasoning_effort"
259
- };
260
- var GOOGLE_COMPATIBLE_PARAMS = {
261
- temperature: "temperature",
262
- max_tokens: "maxOutputTokens",
263
- top_p: "topP",
264
- top_k: "topK",
265
- frequency_penalty: "frequencyPenalty",
266
- presence_penalty: "presencePenalty",
267
- stop: "stopSequences",
268
- n: "candidateCount",
269
- stream: "stream",
270
- seed: "seed",
271
- responseMimeType: "responseMimeType",
272
- responseSchema: "responseSchema"
273
- };
274
- var PROVIDER_PARAMS = {
275
- openai: {
276
- temperature: "temperature",
277
- max_tokens: "max_tokens",
278
- top_p: "top_p",
279
- frequency_penalty: "frequency_penalty",
280
- presence_penalty: "presence_penalty",
281
- stop: "stop",
282
- n: "n",
283
- seed: "seed",
284
- stream: "stream",
285
- effort: "reasoning_effort"
286
- },
287
- azure: OPENAI_COMPATIBLE_PARAMS,
288
- anthropic: {
289
- temperature: "temperature",
290
- max_tokens: "max_tokens",
291
- top_p: "top_p",
292
- top_k: "top_k",
293
- stop: "stop_sequences",
294
- stream: "stream",
295
- effort: "effort",
296
- cache: "cache_control",
297
- cache_ttl: "cache_ttl"
298
- },
299
- google: {
300
- temperature: "temperature",
301
- max_tokens: "maxOutputTokens",
302
- top_p: "topP",
303
- top_k: "topK",
304
- frequency_penalty: "frequencyPenalty",
305
- presence_penalty: "presencePenalty",
306
- stop: "stopSequences",
307
- n: "candidateCount",
308
- stream: "stream",
309
- seed: "seed",
310
- responseMimeType: "responseMimeType",
311
- responseSchema: "responseSchema"
312
- },
313
- "google-vertex": GOOGLE_COMPATIBLE_PARAMS,
314
- mistral: {
315
- temperature: "temperature",
316
- max_tokens: "max_tokens",
317
- top_p: "top_p",
318
- frequency_penalty: "frequency_penalty",
319
- presence_penalty: "presence_penalty",
320
- stop: "stop",
321
- n: "n",
322
- seed: "random_seed",
323
- stream: "stream",
324
- safe_prompt: "safe_prompt",
325
- min_tokens: "min_tokens"
326
- },
327
- cohere: {
328
- temperature: "temperature",
329
- max_tokens: "max_tokens",
330
- top_p: "p",
331
- top_k: "k",
332
- frequency_penalty: "frequency_penalty",
333
- presence_penalty: "presence_penalty",
334
- stop: "stop_sequences",
335
- stream: "stream",
336
- seed: "seed"
337
- },
338
- bedrock: {
339
- // Bedrock Converse API uses camelCase
340
- temperature: "temperature",
341
- max_tokens: "maxTokens",
342
- top_p: "topP",
343
- top_k: "topK",
344
- // Claude models via additionalModelRequestFields
345
- stop: "stopSequences",
346
- stream: "stream",
347
- cache: "cache_control",
348
- cache_ttl: "cache_ttl"
349
- },
350
- openrouter: {
351
- // OpenAI-compatible API with extra routing params
352
- temperature: "temperature",
353
- max_tokens: "max_tokens",
354
- top_p: "top_p",
355
- top_k: "top_k",
356
- frequency_penalty: "frequency_penalty",
357
- presence_penalty: "presence_penalty",
358
- stop: "stop",
359
- n: "n",
360
- seed: "seed",
361
- stream: "stream",
362
- effort: "reasoning_effort"
363
- },
364
- vercel: {
365
- // OpenAI-compatible gateway
366
- temperature: "temperature",
367
- max_tokens: "max_tokens",
368
- top_p: "top_p",
369
- top_k: "top_k",
370
- frequency_penalty: "frequency_penalty",
371
- presence_penalty: "presence_penalty",
372
- stop: "stop",
373
- n: "n",
374
- seed: "seed",
375
- stream: "stream",
376
- effort: "reasoning_effort"
377
- },
378
- xai: OPENAI_COMPATIBLE_PARAMS,
379
- groq: OPENAI_COMPATIBLE_PARAMS,
380
- fal: {},
381
- deepinfra: OPENAI_COMPATIBLE_PARAMS,
382
- "black-forest-labs": {},
383
- together: OPENAI_COMPATIBLE_PARAMS,
384
- fireworks: OPENAI_COMPATIBLE_PARAMS,
385
- deepseek: OPENAI_COMPATIBLE_PARAMS,
386
- moonshotai: OPENAI_COMPATIBLE_PARAMS,
387
- perplexity: OPENAI_COMPATIBLE_PARAMS,
388
- alibaba: OPENAI_COMPATIBLE_PARAMS,
389
- cerebras: OPENAI_COMPATIBLE_PARAMS,
390
- replicate: {},
391
- prodia: {},
392
- luma: {},
393
- bytedance: {},
394
- kling: {},
395
- elevenlabs: {},
396
- assemblyai: {},
397
- deepgram: {},
398
- gladia: {},
399
- lmnt: {},
400
- hume: {},
401
- revai: {},
402
- baseten: OPENAI_COMPATIBLE_PARAMS,
403
- huggingface: OPENAI_COMPATIBLE_PARAMS
404
- };
405
- var OPENAI_COMPATIBLE_PARAM_SPECS = {
406
- temperature: {
407
- type: "number",
408
- min: 0,
409
- max: 2,
410
- default: 0.7,
411
- description: "Controls randomness"
412
- },
413
- max_tokens: {
414
- type: "number",
415
- min: 1,
416
- default: 4096,
417
- description: "Maximum output tokens"
418
- },
419
- top_p: {
420
- type: "number",
421
- min: 0,
422
- max: 1,
423
- default: 1,
424
- description: "Nucleus sampling"
425
- },
426
- top_k: {
427
- type: "number",
428
- min: 0,
429
- default: 40,
430
- description: "Top-K sampling"
431
- },
432
- frequency_penalty: {
433
- type: "number",
434
- min: -2,
435
- max: 2,
436
- default: 0,
437
- description: "Penalize frequent tokens"
438
- },
439
- presence_penalty: {
440
- type: "number",
441
- min: -2,
442
- max: 2,
443
- default: 0,
444
- description: "Penalize repeated topics"
445
- },
446
- stop: { type: "string", description: "Stop sequences" },
447
- n: { type: "number", min: 1, default: 1, description: "Completions count" },
448
- seed: { type: "number", description: "Random seed" },
449
- stream: { type: "boolean", default: false, description: "Stream response" },
450
- reasoning_effort: {
451
- type: "string",
452
- values: ["none", "minimal", "low", "medium", "high", "xhigh"],
453
- default: "medium",
454
- description: "Reasoning effort"
455
- }
456
- };
457
- var GOOGLE_COMPATIBLE_PARAM_SPECS = {
458
- temperature: {
459
- type: "number",
460
- min: 0,
461
- max: 2,
462
- default: 0.7,
463
- description: "Controls randomness"
464
- },
465
- maxOutputTokens: {
466
- type: "number",
467
- min: 1,
468
- default: 4096,
469
- description: "Maximum output tokens"
470
- },
471
- topP: {
472
- type: "number",
473
- min: 0,
474
- max: 1,
475
- default: 1,
476
- description: "Nucleus sampling"
477
- },
478
- topK: {
479
- type: "number",
480
- min: 0,
481
- default: 40,
482
- description: "Top-K sampling"
483
- },
484
- frequencyPenalty: {
485
- type: "number",
486
- min: -2,
487
- max: 2,
488
- default: 0,
489
- description: "Penalize frequent tokens"
490
- },
491
- presencePenalty: {
492
- type: "number",
493
- min: -2,
494
- max: 2,
495
- default: 0,
496
- description: "Penalize repeated topics"
497
- },
498
- stopSequences: { type: "string", description: "Stop sequences" },
499
- candidateCount: {
500
- type: "number",
501
- min: 1,
502
- default: 1,
503
- description: "Candidate count"
504
- },
505
- stream: { type: "boolean", default: false, description: "Stream response" },
506
- seed: { type: "number", description: "Random seed" },
507
- responseMimeType: { type: "string", description: "Response MIME type" },
508
- responseSchema: { type: "string", description: "Response schema" }
509
- };
510
- var PARAM_SPECS = {
511
- openai: {
512
- temperature: {
513
- type: "number",
514
- min: 0,
515
- max: 2,
516
- default: 0.7,
517
- description: "Controls randomness"
518
- },
519
- max_tokens: {
520
- type: "number",
521
- min: 1,
522
- default: 4096,
523
- description: "Maximum output tokens"
524
- },
525
- top_p: {
526
- type: "number",
527
- min: 0,
528
- max: 1,
529
- default: 1,
530
- description: "Nucleus sampling"
531
- },
532
- frequency_penalty: {
533
- type: "number",
534
- min: -2,
535
- max: 2,
536
- default: 0,
537
- description: "Penalize frequent tokens"
538
- },
539
- presence_penalty: {
540
- type: "number",
541
- min: -2,
542
- max: 2,
543
- default: 0,
544
- description: "Penalize repeated topics"
545
- },
546
- stop: { type: "string", description: "Stop sequences" },
547
- n: { type: "number", min: 1, default: 1, description: "Completions count" },
548
- seed: { type: "number", description: "Random seed" },
549
- stream: { type: "boolean", default: false, description: "Stream response" },
550
- reasoning_effort: {
551
- type: "string",
552
- values: ["none", "minimal", "low", "medium", "high", "xhigh"],
553
- default: "medium",
554
- description: "Reasoning effort"
555
- }
556
- },
557
- azure: OPENAI_COMPATIBLE_PARAM_SPECS,
558
- anthropic: {
559
- temperature: {
560
- type: "number",
561
- min: 0,
562
- max: 1,
563
- default: 0.7,
564
- description: "Controls randomness"
565
- },
566
- max_tokens: {
567
- type: "number",
568
- min: 1,
569
- default: 4096,
570
- description: "Maximum output tokens"
571
- },
572
- top_p: {
573
- type: "number",
574
- min: 0,
575
- max: 1,
576
- default: 1,
577
- description: "Nucleus sampling"
578
- },
579
- top_k: {
580
- type: "number",
581
- min: 0,
582
- default: 40,
583
- description: "Top-K sampling"
584
- },
585
- stop_sequences: { type: "string", description: "Stop sequences" },
586
- stream: { type: "boolean", default: false, description: "Stream response" },
587
- effort: {
588
- type: "string",
589
- values: ["low", "medium", "high", "max"],
590
- default: "medium",
591
- description: "Thinking effort"
592
- },
593
- cache_control: {
594
- type: "string",
595
- values: ["ephemeral"],
596
- default: "ephemeral",
597
- description: "Cache control"
598
- },
599
- cache_ttl: {
600
- type: "string",
601
- values: ["5m", "1h"],
602
- default: "5m",
603
- description: "Cache TTL"
604
- }
605
- },
606
- google: {
607
- temperature: {
608
- type: "number",
609
- min: 0,
610
- max: 2,
611
- default: 0.7,
612
- description: "Controls randomness"
613
- },
614
- maxOutputTokens: {
615
- type: "number",
616
- min: 1,
617
- default: 4096,
618
- description: "Maximum output tokens"
619
- },
620
- topP: {
621
- type: "number",
622
- min: 0,
623
- max: 1,
624
- default: 1,
625
- description: "Nucleus sampling"
626
- },
627
- topK: {
628
- type: "number",
629
- min: 0,
630
- default: 40,
631
- description: "Top-K sampling"
632
- },
633
- frequencyPenalty: {
634
- type: "number",
635
- min: -2,
636
- max: 2,
637
- default: 0,
638
- description: "Penalize frequent tokens"
639
- },
640
- presencePenalty: {
641
- type: "number",
642
- min: -2,
643
- max: 2,
644
- default: 0,
645
- description: "Penalize repeated topics"
646
- },
647
- stopSequences: { type: "string", description: "Stop sequences" },
648
- candidateCount: {
649
- type: "number",
650
- min: 1,
651
- default: 1,
652
- description: "Candidate count"
653
- },
654
- stream: { type: "boolean", default: false, description: "Stream response" },
655
- seed: { type: "number", description: "Random seed" },
656
- responseMimeType: { type: "string", description: "Response MIME type" },
657
- responseSchema: { type: "string", description: "Response schema" }
658
- },
659
- "google-vertex": GOOGLE_COMPATIBLE_PARAM_SPECS,
660
- mistral: {
661
- temperature: {
662
- type: "number",
663
- min: 0,
664
- max: 1,
665
- default: 0.7,
666
- description: "Controls randomness"
667
- },
668
- max_tokens: {
669
- type: "number",
670
- min: 1,
671
- default: 4096,
672
- description: "Maximum output tokens"
673
- },
674
- top_p: {
675
- type: "number",
676
- min: 0,
677
- max: 1,
678
- default: 1,
679
- description: "Nucleus sampling"
680
- },
681
- frequency_penalty: {
682
- type: "number",
683
- min: -2,
684
- max: 2,
685
- default: 0,
686
- description: "Penalize frequent tokens"
687
- },
688
- presence_penalty: {
689
- type: "number",
690
- min: -2,
691
- max: 2,
692
- default: 0,
693
- description: "Penalize repeated topics"
694
- },
695
- stop: { type: "string", description: "Stop sequences" },
696
- n: { type: "number", min: 1, default: 1, description: "Completions count" },
697
- random_seed: { type: "number", description: "Random seed" },
698
- stream: { type: "boolean", default: false, description: "Stream response" },
699
- safe_prompt: {
700
- type: "boolean",
701
- default: false,
702
- description: "Enable safe prompt"
703
- },
704
- min_tokens: {
705
- type: "number",
706
- min: 0,
707
- default: 0,
708
- description: "Minimum tokens"
709
- }
710
- },
711
- cohere: {
712
- temperature: {
713
- type: "number",
714
- min: 0,
715
- max: 1,
716
- default: 0.7,
717
- description: "Controls randomness"
718
- },
719
- max_tokens: {
720
- type: "number",
721
- min: 1,
722
- default: 4096,
723
- description: "Maximum output tokens"
724
- },
725
- p: {
726
- type: "number",
727
- min: 0,
728
- max: 1,
729
- default: 1,
730
- description: "Nucleus sampling (p)"
731
- },
732
- k: {
733
- type: "number",
734
- min: 0,
735
- max: 500,
736
- default: 40,
737
- description: "Top-K sampling (k)"
738
- },
739
- frequency_penalty: {
740
- type: "number",
741
- min: 0,
742
- max: 1,
743
- default: 0,
744
- description: "Penalize frequent tokens"
745
- },
746
- presence_penalty: {
747
- type: "number",
748
- min: 0,
749
- max: 1,
750
- default: 0,
751
- description: "Penalize repeated topics"
752
- },
753
- stop_sequences: { type: "string", description: "Stop sequences" },
754
- stream: { type: "boolean", default: false, description: "Stream response" },
755
- seed: { type: "number", description: "Random seed" }
756
- },
757
- bedrock: {
758
- // Converse API inferenceConfig params
759
- temperature: {
760
- type: "number",
761
- min: 0,
762
- max: 1,
763
- default: 0.7,
764
- description: "Controls randomness"
765
- },
766
- maxTokens: {
767
- type: "number",
768
- min: 1,
769
- default: 4096,
770
- description: "Maximum output tokens"
771
- },
772
- topP: {
773
- type: "number",
774
- min: 0,
775
- max: 1,
776
- default: 1,
777
- description: "Nucleus sampling"
778
- },
779
- topK: {
780
- type: "number",
781
- min: 0,
782
- default: 40,
783
- description: "Top-K sampling"
784
- },
785
- stopSequences: { type: "string", description: "Stop sequences" },
786
- stream: { type: "boolean", default: false, description: "Stream response" },
787
- cache_control: {
788
- type: "string",
789
- values: ["ephemeral"],
790
- default: "ephemeral",
791
- description: "Cache control"
792
- },
793
- cache_ttl: {
794
- type: "string",
795
- values: ["5m", "1h"],
796
- default: "5m",
797
- description: "Cache TTL"
798
- }
799
- },
800
- openrouter: {
801
- // Loose validation — proxies to many providers with varying ranges
802
- temperature: {
803
- type: "number",
804
- min: 0,
805
- max: 2,
806
- default: 0.7,
807
- description: "Controls randomness"
808
- },
809
- max_tokens: {
810
- type: "number",
811
- min: 1,
812
- default: 4096,
813
- description: "Maximum output tokens"
814
- },
815
- top_p: {
816
- type: "number",
817
- min: 0,
818
- max: 1,
819
- default: 1,
820
- description: "Nucleus sampling"
821
- },
822
- top_k: {
823
- type: "number",
824
- min: 0,
825
- default: 40,
826
- description: "Top-K sampling"
827
- },
828
- frequency_penalty: {
829
- type: "number",
830
- min: -2,
831
- max: 2,
832
- default: 0,
833
- description: "Penalize frequent tokens"
834
- },
835
- presence_penalty: {
836
- type: "number",
837
- min: -2,
838
- max: 2,
839
- default: 0,
840
- description: "Penalize repeated topics"
841
- },
842
- stop: { type: "string", description: "Stop sequences" },
843
- n: { type: "number", min: 1, default: 1, description: "Completions count" },
844
- seed: { type: "number", description: "Random seed" },
845
- stream: { type: "boolean", default: false, description: "Stream response" },
846
- reasoning_effort: {
847
- type: "string",
848
- values: ["none", "minimal", "low", "medium", "high", "xhigh"],
849
- default: "medium",
850
- description: "Reasoning effort"
851
- }
852
- },
853
- vercel: {
854
- // Loose validation — proxies to many providers with varying ranges
855
- temperature: {
856
- type: "number",
857
- min: 0,
858
- max: 2,
859
- default: 0.7,
860
- description: "Controls randomness"
861
- },
862
- max_tokens: {
863
- type: "number",
864
- min: 1,
865
- default: 4096,
866
- description: "Maximum output tokens"
867
- },
868
- top_p: {
869
- type: "number",
870
- min: 0,
871
- max: 1,
872
- default: 1,
873
- description: "Nucleus sampling"
874
- },
875
- top_k: {
876
- type: "number",
877
- min: 0,
878
- default: 40,
879
- description: "Top-K sampling"
880
- },
881
- frequency_penalty: {
882
- type: "number",
883
- min: -2,
884
- max: 2,
885
- default: 0,
886
- description: "Penalize frequent tokens"
887
- },
888
- presence_penalty: {
889
- type: "number",
890
- min: -2,
891
- max: 2,
892
- default: 0,
893
- description: "Penalize repeated topics"
894
- },
895
- stop: { type: "string", description: "Stop sequences" },
896
- n: { type: "number", min: 1, default: 1, description: "Completions count" },
897
- seed: { type: "number", description: "Random seed" },
898
- stream: { type: "boolean", default: false, description: "Stream response" },
899
- reasoning_effort: {
900
- type: "string",
901
- values: ["none", "minimal", "low", "medium", "high", "xhigh"],
902
- default: "medium",
903
- description: "Reasoning effort"
904
- }
905
- },
906
- xai: OPENAI_COMPATIBLE_PARAM_SPECS,
907
- groq: OPENAI_COMPATIBLE_PARAM_SPECS,
908
- fal: {},
909
- deepinfra: OPENAI_COMPATIBLE_PARAM_SPECS,
910
- "black-forest-labs": {},
911
- together: OPENAI_COMPATIBLE_PARAM_SPECS,
912
- fireworks: OPENAI_COMPATIBLE_PARAM_SPECS,
913
- deepseek: OPENAI_COMPATIBLE_PARAM_SPECS,
914
- moonshotai: OPENAI_COMPATIBLE_PARAM_SPECS,
915
- perplexity: OPENAI_COMPATIBLE_PARAM_SPECS,
916
- alibaba: OPENAI_COMPATIBLE_PARAM_SPECS,
917
- cerebras: OPENAI_COMPATIBLE_PARAM_SPECS,
918
- replicate: {},
919
- prodia: {},
920
- luma: {},
921
- bytedance: {},
922
- kling: {},
923
- elevenlabs: {},
924
- assemblyai: {},
925
- deepgram: {},
926
- gladia: {},
927
- lmnt: {},
928
- hume: {},
929
- revai: {},
930
- baseten: OPENAI_COMPATIBLE_PARAM_SPECS,
931
- huggingface: OPENAI_COMPATIBLE_PARAM_SPECS
932
- };
933
- function isReasoningModel(model) {
934
- const name = model.includes("/") ? model.split("/").pop() : model;
935
- return /^o[134]/.test(name);
936
- }
937
- function canHostOpenAIModels(provider) {
938
- return provider === "openai" || provider === "openrouter" || provider === "vercel";
939
- }
940
- function isGatewayProvider(provider) {
941
- return provider === "openrouter" || provider === "vercel";
942
- }
943
- function detectGatewaySubProvider(model) {
944
- const slash = model.indexOf("/");
945
- if (slash < 1) return void 0;
946
- const prefix = model.slice(0, slash);
947
- const direct = [
948
- "openai",
949
- "anthropic",
950
- "google",
951
- "mistral",
952
- "cohere"
953
- ];
954
- return direct.find((p) => p === prefix);
955
- }
956
- var REASONING_MODEL_UNSUPPORTED = /* @__PURE__ */ new Set([
957
- "temperature",
958
- "top_p",
959
- "frequency_penalty",
960
- "presence_penalty",
961
- "n"
962
- ]);
963
- function detectBedrockModelFamily(model) {
964
- const parts = model.split(".");
965
- let prefix = parts[0];
966
- if (["us", "eu", "apac", "global"].includes(prefix) && parts.length > 1) {
967
- prefix = parts[1];
968
- }
969
- const families = [
970
- "anthropic",
971
- "meta",
972
- "amazon",
973
- "mistral",
974
- "cohere",
975
- "ai21"
976
- ];
977
- return families.find((f) => prefix === f);
978
- }
979
- function bedrockSupportsCaching(model) {
980
- const family = detectBedrockModelFamily(model);
981
- if (family === "anthropic") return true;
982
- if (family === "amazon" && model.includes("nova")) return true;
983
- return false;
984
- }
985
- var CACHE_VALUES = {
986
- openai: void 0,
987
- // OpenAI auto-caches; no explicit param
988
- azure: void 0,
989
- anthropic: "ephemeral",
990
- google: void 0,
991
- // Google uses explicit caching API, not a param
992
- "google-vertex": void 0,
993
- mistral: void 0,
994
- cohere: void 0,
995
- bedrock: "ephemeral",
996
- // Supported for Claude models on Bedrock
997
- openrouter: void 0,
998
- // Depends on underlying provider
999
- vercel: void 0,
1000
- // Depends on underlying provider
1001
- xai: void 0,
1002
- groq: void 0,
1003
- fal: void 0,
1004
- deepinfra: void 0,
1005
- "black-forest-labs": void 0,
1006
- together: void 0,
1007
- fireworks: void 0,
1008
- deepseek: void 0,
1009
- moonshotai: void 0,
1010
- perplexity: void 0,
1011
- alibaba: void 0,
1012
- cerebras: void 0,
1013
- replicate: void 0,
1014
- prodia: void 0,
1015
- luma: void 0,
1016
- bytedance: void 0,
1017
- kling: void 0,
1018
- elevenlabs: void 0,
1019
- assemblyai: void 0,
1020
- deepgram: void 0,
1021
- gladia: void 0,
1022
- lmnt: void 0,
1023
- hume: void 0,
1024
- revai: void 0,
1025
- baseten: void 0,
1026
- huggingface: void 0
1027
- };
1028
- var CACHE_TTLS = {
1029
- openai: void 0,
1030
- azure: void 0,
1031
- anthropic: ["5m", "1h"],
1032
- google: void 0,
1033
- "google-vertex": void 0,
1034
- mistral: void 0,
1035
- cohere: void 0,
1036
- bedrock: ["5m", "1h"],
1037
- // Claude on Bedrock uses same TTLs as direct Anthropic
1038
- openrouter: void 0,
1039
- vercel: void 0,
1040
- xai: void 0,
1041
- groq: void 0,
1042
- fal: void 0,
1043
- deepinfra: void 0,
1044
- "black-forest-labs": void 0,
1045
- together: void 0,
1046
- fireworks: void 0,
1047
- deepseek: void 0,
1048
- moonshotai: void 0,
1049
- perplexity: void 0,
1050
- alibaba: void 0,
1051
- cerebras: void 0,
1052
- replicate: void 0,
1053
- prodia: void 0,
1054
- luma: void 0,
1055
- bytedance: void 0,
1056
- kling: void 0,
1057
- elevenlabs: void 0,
1058
- assemblyai: void 0,
1059
- deepgram: void 0,
1060
- gladia: void 0,
1061
- lmnt: void 0,
1062
- hume: void 0,
1063
- revai: void 0,
1064
- baseten: void 0,
1065
- huggingface: void 0
1066
- };
1067
- var DURATION_RE = /^\d+[mh]$/;
1068
-
1069
- // src/provider-meta.ts
1070
- var PROVIDER_META = [
1071
- { id: "openai", name: "OpenAI", host: "api.openai.com", color: "#10a37f" },
1072
- {
1073
- id: "azure",
1074
- name: "Azure OpenAI",
1075
- host: "models.inference.ai.azure.com",
1076
- color: "#0078d4"
1077
- },
1078
- {
1079
- id: "anthropic",
1080
- name: "Anthropic",
1081
- host: "api.anthropic.com",
1082
- color: "#e8956a"
1083
- },
1084
- {
1085
- id: "google",
1086
- name: "Google",
1087
- host: "generativelanguage.googleapis.com",
1088
- color: "#4285f4"
1089
- },
1090
- {
1091
- id: "google-vertex",
1092
- name: "Google Vertex AI",
1093
- host: "aiplatform.googleapis.com",
1094
- color: "#34a853"
1095
- },
1096
- { id: "mistral", name: "Mistral", host: "api.mistral.ai", color: "#ff7000" },
1097
- { id: "cohere", name: "Cohere", host: "api.cohere.com", color: "#39594d" },
1098
- {
1099
- id: "bedrock",
1100
- name: "Bedrock",
1101
- host: "bedrock-runtime.us-east-1.amazonaws.com",
1102
- color: "#ff9900"
1103
- },
1104
- {
1105
- id: "openrouter",
1106
- name: "OpenRouter",
1107
- host: "openrouter.ai",
1108
- color: "#818cf8"
1109
- },
1110
- {
1111
- id: "vercel",
1112
- name: "Vercel",
1113
- host: "gateway.ai.vercel.app",
1114
- color: "#ededed"
1115
- },
1116
- { id: "xai", name: "xAI", host: "api.x.ai", color: "#111111" },
1117
- { id: "groq", name: "Groq", host: "api.groq.com", color: "#f55036" },
1118
- { id: "fal", name: "Fal", host: "fal.run", color: "#111111" },
1119
- {
1120
- id: "deepinfra",
1121
- name: "DeepInfra",
1122
- host: "api.deepinfra.com",
1123
- color: "#2563eb"
1124
- },
1125
- {
1126
- id: "black-forest-labs",
1127
- name: "Black Forest Labs",
1128
- host: "api.bfl.ai",
1129
- color: "#111111"
1130
- },
1131
- {
1132
- id: "together",
1133
- name: "Together.ai",
1134
- host: "api.together.xyz",
1135
- color: "#ff4f00"
1136
- },
1137
- {
1138
- id: "fireworks",
1139
- name: "Fireworks",
1140
- host: "api.fireworks.ai",
1141
- color: "#7c3aed"
1142
- },
1143
- {
1144
- id: "deepseek",
1145
- name: "DeepSeek",
1146
- host: "api.deepseek.com",
1147
- color: "#4d6bfe"
1148
- },
1149
- {
1150
- id: "moonshotai",
1151
- name: "Moonshot AI",
1152
- host: "api.moonshot.ai",
1153
- color: "#6b46ff"
1154
- },
1155
- {
1156
- id: "perplexity",
1157
- name: "Perplexity",
1158
- host: "api.perplexity.ai",
1159
- color: "#20b8cd"
1160
- },
1161
- {
1162
- id: "alibaba",
1163
- name: "Alibaba",
1164
- host: "dashscope-intl.aliyuncs.com",
1165
- color: "#ff6a00"
1166
- },
1167
- {
1168
- id: "cerebras",
1169
- name: "Cerebras",
1170
- host: "api.cerebras.ai",
1171
- color: "#d71920"
1172
- },
1173
- {
1174
- id: "replicate",
1175
- name: "Replicate",
1176
- host: "api.replicate.com",
1177
- color: "#111111"
1178
- },
1179
- { id: "prodia", name: "Prodia", host: "api.prodia.com", color: "#6d28d9" },
1180
- { id: "luma", name: "Luma", host: "api.lumalabs.ai", color: "#111111" },
1181
- {
1182
- id: "bytedance",
1183
- name: "ByteDance",
1184
- host: "ark.cn-beijing.volces.com",
1185
- color: "#2563eb"
1186
- },
1187
- { id: "kling", name: "Kling AI", host: "api.klingai.com", color: "#111111" },
1188
- {
1189
- id: "elevenlabs",
1190
- name: "ElevenLabs",
1191
- host: "api.elevenlabs.io",
1192
- color: "#111111"
1193
- },
1194
- {
1195
- id: "assemblyai",
1196
- name: "AssemblyAI",
1197
- host: "api.assemblyai.com",
1198
- color: "#4f46e5"
1199
- },
1200
- {
1201
- id: "deepgram",
1202
- name: "Deepgram",
1203
- host: "api.deepgram.com",
1204
- color: "#13ef93"
1205
- },
1206
- { id: "gladia", name: "Gladia", host: "api.gladia.io", color: "#7c3aed" },
1207
- { id: "lmnt", name: "LMNT", host: "api.lmnt.com", color: "#14b8a6" },
1208
- { id: "hume", name: "Hume", host: "api.hume.ai", color: "#8b5cf6" },
1209
- { id: "revai", name: "Rev.ai", host: "api.rev.ai", color: "#ef4444" },
1210
- {
1211
- id: "baseten",
1212
- name: "Baseten",
1213
- host: "api.baseten.co",
1214
- color: "#111111"
1215
- },
1216
- {
1217
- id: "huggingface",
1218
- name: "Hugging Face",
1219
- host: "api-inference.huggingface.co",
1220
- color: "#ffcc4d"
1221
- }
1222
- ];
1223
- function toCanonicalParamSpec(spec) {
1224
- return {
1225
- ...spec,
1226
- type: spec.values ? "enum" : spec.type,
1227
- default: spec.default ?? (spec.type === "string" && !spec.values ? "" : void 0)
1228
- };
1229
- }
1230
- function deriveCanonicalParamSpecs() {
1231
- const specs = {};
1232
- for (const provider of Object.keys(PROVIDER_PARAMS)) {
1233
- specs[provider] = {};
1234
- for (const [canonicalName, providerName] of Object.entries(
1235
- PROVIDER_PARAMS[provider]
1236
- )) {
1237
- const spec = PARAM_SPECS[provider][providerName];
1238
- if (spec) {
1239
- specs[provider][canonicalName] = toCanonicalParamSpec(spec);
1240
- }
1241
- }
1242
- }
1243
- return specs;
1244
- }
1245
- var CANONICAL_PARAM_SPECS = deriveCanonicalParamSpecs();
1246
- // Annotate the CommonJS export names for ESM import in node:
1247
- 0 && (module.exports = {
1248
- ALIASES,
1249
- CACHE_TTLS,
1250
- CACHE_VALUES,
1251
- CANONICAL_PARAM_SPECS,
1252
- DURATION_RE,
1253
- HOST_ALIASES,
1254
- PARAM_SPECS,
1255
- PROVIDER_META,
1256
- PROVIDER_PARAMS,
1257
- REASONING_MODEL_UNSUPPORTED,
1258
- bedrockSupportsCaching,
1259
- canHostOpenAIModels,
1260
- detectBedrockModelFamily,
1261
- detectGatewaySubProvider,
1262
- detectProvider,
1263
- isGatewayProvider,
1264
- isReasoningModel,
1265
- providerFromHostAlias,
1266
- resolveHostAlias
1267
- });
1
+ "use strict";var e,t=Object.defineProperty,o=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i={};function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}((e,o)=>{for(var a in o)t(e,a,{get:o[a],enumerable:!0})})(i,{ALIASES:()=>h,CACHE_TTLS:()=>A,CACHE_VALUES:()=>T,CANONICAL_PARAM_SPECS:()=>V,HOST_ALIASES:()=>p,PARAM_SPECS:()=>R,PROVIDER_DEFINITIONS:()=>z,PROVIDER_META:()=>K,PROVIDER_PARAMS:()=>C,REASONING_MODEL_PREFIXES:()=>M,REASONING_MODEL_UNSUPPORTED:()=>j,bedrockSupportsCaching:()=>D,canHostOpenAIModels:()=>I,detectBedrockModelFamily:()=>N,detectGatewaySubProvider:()=>L,detectProvider:()=>b,isGatewayProvider:()=>G,isReasoningModel:()=>E,modelMatchesFamily:()=>_,providerFromHostAlias:()=>l,resolveHostAlias:()=>m}),module.exports=(e=i,((e,i,n,p)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let s of a(i))r.call(e,s)||s===n||t(e,s,{get:()=>i[s],enumerable:!(p=o(i,s))||p.enumerable});return e})(t({},"__esModule",{value:!0}),e));var p={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"},s={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 m(e,t=function(){return"undefined"!=typeof process&&process.env?process.env:{}}()){const o=e.toLowerCase();if(!n(p,o))return{host:e};const a=o,r=function(e,t){const o=e.toUpperCase(),a=t[`LLM_STRINGS_${o}_HOST`]??t[`LLM_STRINGS_HOST_${o}`];return a?.trim()?a:void 0}(a,t);return{host:c(r??p[a]),alias:a}}function l(e){const t=e.toLowerCase();return n(C,t)?t:n(s,t)?s[t]:void 0}function d(e,...t){return t.some(t=>{const o=t.toLowerCase();return e===o||e.endsWith(`.${o}`)})}function u(e,...t){const o=e.split(".");return t.some(e=>o.some(t=>t.startsWith(e.toLowerCase())))}var f=new Set(["-","."]);function y(e){return e.trim().toLowerCase()}function g(e){const t=y(e),o=t.lastIndexOf("/");return o>=0?t.slice(o+1):t}function _(e,t){const o=g(e),a=y(t);if(!o||!a)return!1;if(o===a)return!0;const r=o[a.length];return o.startsWith(a)&&void 0!==r&&f.has(r)}function b(e){return d(e=function(e){return c(e).toLowerCase().split(":")[0]??e}(e),"openrouter","openrouter.ai")?"openrouter":d(e,"vercel","gateway.ai.vercel.app","gateway.ai.vercel.sh")?"vercel":d(e,"bedrock","amazonaws.com")||u(e,"bedrock")?"bedrock":d(e,"aiplatform.googleapis.com")?"google-vertex":d(e,"xai","x.ai","api.x.ai")?"xai":d(e,"groq","groq.com","api.groq.com")?"groq":d(e,"fal","fal.run","fal.ai")?"fal":d(e,"deepinfra","deepinfra.com")?"deepinfra":d(e,"bfl","bfl.ai","api.bfl.ai")?"black-forest-labs":d(e,"together","together.xyz")?"together":d(e,"fireworks","fireworks.ai")?"fireworks":d(e,"deepseek","deepseek.com")?"deepseek":d(e,"moonshot","moonshot.ai")?"moonshotai":d(e,"perplexity","perplexity.ai")?"perplexity":d(e,"alibaba","aliyuncs.com")||u(e,"dashscope")?"alibaba":d(e,"cerebras","cerebras.ai")?"cerebras":d(e,"replicate","replicate.com")?"replicate":d(e,"prodia","prodia.com")?"prodia":d(e,"luma","lumalabs.ai")?"luma":d(e,"bytedance","volces.com")||function(e,...t){const o=e.split(".");return t.some(e=>o.includes(e.toLowerCase()))}(e,"bytedance")?"bytedance":d(e,"kling","klingai.com")?"kling":d(e,"elevenlabs","elevenlabs.io")?"elevenlabs":d(e,"assemblyai","assemblyai.com")?"assemblyai":d(e,"deepgram","deepgram.com")?"deepgram":d(e,"gladia","gladia.io")?"gladia":d(e,"lmnt","lmnt.com")?"lmnt":d(e,"hume","hume.ai")?"hume":d(e,"revai","rev.ai")?"revai":d(e,"baseten","baseten.co")?"baseten":d(e,"huggingface","huggingface.co")?"huggingface":d(e,"azure","azure.com")?"azure":d(e,"openai","openai.com")?"openai":d(e,"anthropic","anthropic.com","claude.ai")?"anthropic":d(e,"google","googleapis.com")?"google":d(e,"mistral","mistral.ai")?"mistral":d(e,"cohere","cohere.com")?"cohere":void 0}var h={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"},v=["none","minimal","low","medium","high","xhigh","max"],k={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:v,default:"medium",description:"Reasoning effort"}}},x={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"}},w={prompt:"prompt",negative_prompt:"negative_prompt",seed:"seed",image_size:"image_size",aspect_ratio:"aspect_ratio",output_format:"output_format",width:"width",height:"height"},q={params:{...w,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:{...x,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"}}},P={params:{...w,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:{...x,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"}}},S={params:{...w,model:"model",style_preset:"style_preset",steps:"steps",cfg_scale:"cfg_scale",upscale:"upscale",sampler:"sampler",type:"type",config:"config",price:"price"},specs:{...x,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"}}},O={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"}}},z={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:v,default:"medium",description:"Reasoning effort"}}},azure:k,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:v,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:O,"google-vertex":O,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:{...k.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:{...k.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:{...k.params},specs:{...k.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:k,groq:k,fal:q,deepinfra:k,"black-forest-labs":{params:{},specs:{}},together:k,fireworks:k,deepseek:k,moonshotai:k,perplexity:k,alibaba:k,cerebras:k,replicate:P,prodia:S,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:k,huggingface:k},C=Object.fromEntries(Object.entries(z).map(([e,t])=>[e,t.params])),R=Object.fromEntries(Object.entries(z).map(([e,t])=>[e,t.specs])),T=Object.fromEntries(Object.entries(z).filter(([,e])=>void 0!==e.cacheValue).map(([e,t])=>[e,t.cacheValue])),A=Object.fromEntries(Object.entries(z).filter(([,e])=>void 0!==e.cacheTtls).map(([e,t])=>[e,t.cacheTtls])),M=[];function E(e){const t=g(e),o=t.match(/^o\d+/)?.[0],a=t.match(/^gpt-[5-9]/)?.[0];return void 0!==o&&_(t,o)||void 0!==a&&_(t,a)||M.some(e=>_(t,e))}function I(e){return"openai"===e||"azure"===e||"openrouter"===e||"vercel"===e}function G(e){return"openrouter"===e||"vercel"===e}function L(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"}[y(e.slice(0,t))]}var j=new Set(["temperature","top_p","top_k","frequency_penalty","presence_penalty","n"]);function N(e){const t=g(e).split(".");return["anthropic","meta","amazon","mistral","cohere","ai21"].find(e=>t.includes(e))}function D(e){const t=N(e);if("anthropic"===t)return!0;if("amazon"===t){const t=g(e).split("."),o=t.indexOf("amazon"),a=o>=0?t[o+1]:void 0;return!!a&&_(a,"nova")}return!1}var K=[{id:"openai",name:"OpenAI",host:"api.openai.com",color:"#10a37f"},{id:"azure",name:"Azure OpenAI",host:"models.inference.ai.azure.com",color:"#0078d4"},{id:"anthropic",name:"Anthropic",host:"api.anthropic.com",color:"#e8956a"},{id:"google",name:"Google",host:"generativelanguage.googleapis.com",color:"#4285f4"},{id:"google-vertex",name:"Google Vertex AI",host:"aiplatform.googleapis.com",color:"#34a853"},{id:"mistral",name:"Mistral",host:"api.mistral.ai",color:"#ff7000"},{id:"cohere",name:"Cohere",host:"api.cohere.com",color:"#39594d"},{id:"bedrock",name:"Bedrock",host:"bedrock-runtime.us-east-1.amazonaws.com",color:"#ff9900"},{id:"openrouter",name:"OpenRouter",host:"openrouter.ai",color:"#818cf8"},{id:"vercel",name:"Vercel",host:"gateway.ai.vercel.app",color:"#ededed"},{id:"xai",name:"xAI",host:"api.x.ai",color:"#111111"},{id:"groq",name:"Groq",host:"api.groq.com",color:"#f55036"},{id:"fal",name:"Fal",host:"fal.run",color:"#111111"},{id:"deepinfra",name:"DeepInfra",host:"api.deepinfra.com",color:"#2563eb"},{id:"black-forest-labs",name:"Black Forest Labs",host:"api.bfl.ai",color:"#111111"},{id:"together",name:"Together.ai",host:"api.together.xyz",color:"#ff4f00"},{id:"fireworks",name:"Fireworks",host:"api.fireworks.ai",color:"#7c3aed"},{id:"deepseek",name:"DeepSeek",host:"api.deepseek.com",color:"#4d6bfe"},{id:"moonshotai",name:"Moonshot AI",host:"api.moonshot.ai",color:"#6b46ff"},{id:"perplexity",name:"Perplexity",host:"api.perplexity.ai",color:"#20b8cd"},{id:"alibaba",name:"Alibaba",host:"dashscope-intl.aliyuncs.com",color:"#ff6a00"},{id:"cerebras",name:"Cerebras",host:"api.cerebras.ai",color:"#d71920"},{id:"replicate",name:"Replicate",host:"api.replicate.com",color:"#111111"},{id:"prodia",name:"Prodia",host:"api.prodia.com",color:"#6d28d9"},{id:"luma",name:"Luma",host:"api.lumalabs.ai",color:"#111111"},{id:"bytedance",name:"ByteDance",host:"ark.cn-beijing.volces.com",color:"#2563eb"},{id:"kling",name:"Kling AI",host:"api.klingai.com",color:"#111111"},{id:"elevenlabs",name:"ElevenLabs",host:"api.elevenlabs.io",color:"#111111"},{id:"assemblyai",name:"AssemblyAI",host:"api.assemblyai.com",color:"#4f46e5"},{id:"deepgram",name:"Deepgram",host:"api.deepgram.com",color:"#13ef93"},{id:"gladia",name:"Gladia",host:"api.gladia.io",color:"#7c3aed"},{id:"lmnt",name:"LMNT",host:"api.lmnt.com",color:"#14b8a6"},{id:"hume",name:"Hume",host:"api.hume.ai",color:"#8b5cf6"},{id:"revai",name:"Rev.ai",host:"api.rev.ai",color:"#ef4444"},{id:"baseten",name:"Baseten",host:"api.baseten.co",color:"#111111"},{id:"huggingface",name:"Hugging Face",host:"api-inference.huggingface.co",color:"#ffcc4d"}];function H(e){return{...e,type:e.values?"enum":e.type,default:e.default??("string"!==e.type||e.values?void 0:"")}}var V=function(){const e={};for(const t of Object.keys(C)){e[t]={};for(const[o,a]of Object.entries(C[t])){const r=R[t][a];r&&(e[t][o]=H(r))}}return e}();