llm-strings 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/parse.cjs CHANGED
@@ -1,1234 +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/parse.ts
21
- var parse_exports = {};
22
- __export(parse_exports, {
23
- build: () => build,
24
- parse: () => parse
25
- });
26
- module.exports = __toCommonJS(parse_exports);
27
-
28
- // src/provider-core.ts
29
- function hasOwn(object, key) {
30
- return Object.prototype.hasOwnProperty.call(object, key);
31
- }
32
- var HOST_ALIASES = {
33
- openai: "api.openai.com",
34
- azure: "models.inference.ai.azure.com",
35
- anthropic: "api.anthropic.com",
36
- google: "generativelanguage.googleapis.com",
37
- "google-vertex": "aiplatform.googleapis.com",
38
- aistudio: "generativelanguage.googleapis.com",
39
- mistral: "api.mistral.ai",
40
- cohere: "api.cohere.com",
41
- bedrock: "bedrock-runtime.us-east-1.amazonaws.com",
42
- openrouter: "openrouter.ai",
43
- vercel: "gateway.ai.vercel.app",
44
- alibaba: "dashscope-intl.aliyuncs.com",
45
- alibabacloud: "dashscope-intl.aliyuncs.com",
46
- dashscope: "dashscope-intl.aliyuncs.com",
47
- groq: "api.groq.com",
48
- fal: "fal.run",
49
- fireworks: "api.fireworks.ai",
50
- fireworksai: "api.fireworks.ai",
51
- "black-forest-labs": "api.bfl.ai",
52
- bfl: "api.bfl.ai",
53
- deepseek: "api.deepseek.com",
54
- moonshotai: "api.moonshot.ai",
55
- moonshot: "api.moonshot.ai",
56
- perplexity: "api.perplexity.ai",
57
- venice: "api.venice.ai",
58
- parasail: "api.parasail.io",
59
- deepinfra: "api.deepinfra.com",
60
- atlascloud: "api.atlascloud.ai",
61
- novita: "api.novita.ai",
62
- novitaai: "api.novita.ai",
63
- grok: "api.x.ai",
64
- xai: "api.x.ai",
65
- together: "api.together.xyz",
66
- togetherai: "api.together.xyz",
67
- cerebras: "api.cerebras.ai",
68
- replicate: "api.replicate.com",
69
- prodia: "api.prodia.com",
70
- luma: "api.lumalabs.ai",
71
- bytedance: "ark.cn-beijing.volces.com",
72
- kling: "api.klingai.com",
73
- elevenlabs: "api.elevenlabs.io",
74
- assemblyai: "api.assemblyai.com",
75
- deepgram: "api.deepgram.com",
76
- gladia: "api.gladia.io",
77
- lmnt: "api.lmnt.com",
78
- hume: "api.hume.ai",
79
- revai: "api.rev.ai",
80
- baseten: "api.baseten.co",
81
- huggingface: "api-inference.huggingface.co",
82
- wandb: "api.inference.wandb.ai",
83
- weightsandbiases: "api.inference.wandb.ai",
84
- baidu: "qianfan.baidubce.com",
85
- qianfan: "qianfan.baidubce.com",
86
- vertex: "aiplatform.googleapis.com",
87
- xiaomi: "api.xiaomimimo.com",
88
- minimax: "api.minimax.io"
89
- };
90
- function readProcessEnv() {
91
- return typeof process !== "undefined" && process.env ? process.env : {};
92
- }
93
- function normalizeHostValue(value) {
94
- const trimmed = value.trim();
95
- if (!trimmed) return trimmed;
96
- try {
97
- if (trimmed.includes("://")) {
98
- return new URL(trimmed).host;
99
- }
100
- } catch {
101
- }
102
- return trimmed.replace(/^\/\//, "").split("/")[0] ?? trimmed;
103
- }
104
- function envHostOverride(alias, env) {
105
- const upper = alias.toUpperCase();
106
- const override = env[`LLM_STRINGS_${upper}_HOST`] ?? env[`LLM_STRINGS_HOST_${upper}`];
107
- return override?.trim() ? override : void 0;
108
- }
109
- function resolveHostAlias(host, env = readProcessEnv()) {
110
- const normalizedHost = host.toLowerCase();
111
- if (!hasOwn(HOST_ALIASES, normalizedHost)) {
112
- return { host };
113
- }
114
- const alias = normalizedHost;
115
- const override = envHostOverride(alias, env);
116
- return {
117
- host: normalizeHostValue(override ?? HOST_ALIASES[alias]),
118
- alias
119
- };
120
- }
121
- var OPENAI_COMPATIBLE_PARAMS = {
122
- temperature: "temperature",
123
- max_tokens: "max_tokens",
124
- max_completion_tokens: "max_completion_tokens",
125
- top_p: "top_p",
126
- top_k: "top_k",
127
- frequency_penalty: "frequency_penalty",
128
- presence_penalty: "presence_penalty",
129
- stop: "stop",
130
- n: "n",
131
- seed: "seed",
132
- stream: "stream",
133
- effort: "reasoning_effort"
134
- };
135
- var COMMON_IMAGE_PARAMS = {
136
- prompt: "prompt",
137
- negative_prompt: "negative_prompt",
138
- seed: "seed",
139
- image_size: "image_size",
140
- aspect_ratio: "aspect_ratio",
141
- output_format: "output_format",
142
- width: "width",
143
- height: "height"
144
- };
145
- var FAL_PARAMS = {
146
- ...COMMON_IMAGE_PARAMS,
147
- num_images: "num_images",
148
- enable_safety_checker: "enable_safety_checker",
149
- enable_safety_checks: "enable_safety_checks",
150
- enable_prompt_expansion: "enable_prompt_expansion",
151
- expand_prompt: "expand_prompt"
152
- };
153
- var REPLICATE_PARAMS = {
154
- ...COMMON_IMAGE_PARAMS,
155
- input: "input",
156
- version: "version",
157
- num_outputs: "num_outputs",
158
- num_inference_steps: "num_inference_steps",
159
- guidance_scale: "guidance_scale",
160
- stream: "stream",
161
- webhook: "webhook",
162
- webhook_events_filter: "webhook_events_filter"
163
- };
164
- var PRODIA_PARAMS = {
165
- ...COMMON_IMAGE_PARAMS,
166
- model: "model",
167
- style_preset: "style_preset",
168
- steps: "steps",
169
- cfg_scale: "cfg_scale",
170
- upscale: "upscale",
171
- sampler: "sampler",
172
- type: "type",
173
- config: "config",
174
- price: "price"
175
- };
176
- var LUMA_PARAMS = {
177
- prompt: "prompt",
178
- model: "model",
179
- aspect_ratio: "aspect_ratio",
180
- keyframes: "keyframes",
181
- loop: "loop",
182
- duration: "duration",
183
- type: "type",
184
- image_ref: "image_ref",
185
- video: "video",
186
- source: "source"
187
- };
188
- var OPENROUTER_ROUTING_PARAMS = {
189
- provider: "provider",
190
- order: "order",
191
- "provider.order": "provider.order",
192
- only: "only",
193
- "provider.only": "provider.only",
194
- ignore: "ignore",
195
- "provider.ignore": "provider.ignore",
196
- allow_fallbacks: "allow_fallbacks",
197
- "provider.allow_fallbacks": "provider.allow_fallbacks",
198
- require_parameters: "require_parameters",
199
- "provider.require_parameters": "provider.require_parameters",
200
- data_collection: "data_collection",
201
- "provider.data_collection": "provider.data_collection",
202
- zdr: "zdr",
203
- "provider.zdr": "provider.zdr",
204
- enforce_distillable_text: "enforce_distillable_text",
205
- "provider.enforce_distillable_text": "provider.enforce_distillable_text",
206
- quantizations: "quantizations",
207
- "provider.quantizations": "provider.quantizations",
208
- sort: "sort",
209
- "provider.sort": "provider.sort",
210
- preferred_min_throughput: "preferred_min_throughput",
211
- "provider.preferred_min_throughput": "provider.preferred_min_throughput",
212
- preferred_max_latency: "preferred_max_latency",
213
- "provider.preferred_max_latency": "provider.preferred_max_latency",
214
- max_price: "max_price",
215
- "provider.max_price": "provider.max_price",
216
- transforms: "transforms",
217
- plugins: "plugins"
218
- };
219
- var GOOGLE_COMPATIBLE_PARAMS = {
220
- temperature: "temperature",
221
- max_tokens: "maxOutputTokens",
222
- top_p: "topP",
223
- top_k: "topK",
224
- frequency_penalty: "frequencyPenalty",
225
- presence_penalty: "presencePenalty",
226
- stop: "stopSequences",
227
- n: "candidateCount",
228
- stream: "stream",
229
- seed: "seed",
230
- responseMimeType: "responseMimeType",
231
- responseSchema: "responseSchema"
232
- };
233
- var PROVIDER_PARAMS = {
234
- openai: {
235
- temperature: "temperature",
236
- max_tokens: "max_tokens",
237
- max_completion_tokens: "max_completion_tokens",
238
- top_p: "top_p",
239
- frequency_penalty: "frequency_penalty",
240
- presence_penalty: "presence_penalty",
241
- stop: "stop",
242
- n: "n",
243
- seed: "seed",
244
- stream: "stream",
245
- effort: "reasoning_effort"
246
- },
247
- azure: OPENAI_COMPATIBLE_PARAMS,
248
- anthropic: {
249
- temperature: "temperature",
250
- max_tokens: "max_tokens",
251
- top_p: "top_p",
252
- top_k: "top_k",
253
- stop: "stop_sequences",
254
- stream: "stream",
255
- effort: "effort",
256
- cache: "cache_control",
257
- cache_ttl: "cache_ttl"
258
- },
259
- google: {
260
- temperature: "temperature",
261
- max_tokens: "maxOutputTokens",
262
- top_p: "topP",
263
- top_k: "topK",
264
- frequency_penalty: "frequencyPenalty",
265
- presence_penalty: "presencePenalty",
266
- stop: "stopSequences",
267
- n: "candidateCount",
268
- stream: "stream",
269
- seed: "seed",
270
- responseMimeType: "responseMimeType",
271
- responseSchema: "responseSchema"
272
- },
273
- "google-vertex": GOOGLE_COMPATIBLE_PARAMS,
274
- mistral: {
275
- temperature: "temperature",
276
- max_tokens: "max_tokens",
277
- top_p: "top_p",
278
- frequency_penalty: "frequency_penalty",
279
- presence_penalty: "presence_penalty",
280
- stop: "stop",
281
- n: "n",
282
- seed: "random_seed",
283
- stream: "stream",
284
- safe_prompt: "safe_prompt",
285
- min_tokens: "min_tokens"
286
- },
287
- cohere: {
288
- temperature: "temperature",
289
- max_tokens: "max_tokens",
290
- top_p: "p",
291
- top_k: "k",
292
- frequency_penalty: "frequency_penalty",
293
- presence_penalty: "presence_penalty",
294
- stop: "stop_sequences",
295
- stream: "stream",
296
- seed: "seed"
297
- },
298
- bedrock: {
299
- // Bedrock Converse API uses camelCase
300
- temperature: "temperature",
301
- max_tokens: "maxTokens",
302
- top_p: "topP",
303
- top_k: "topK",
304
- // Claude models via additionalModelRequestFields
305
- stop: "stopSequences",
306
- stream: "stream",
307
- cache: "cache_control",
308
- cache_ttl: "cache_ttl"
309
- },
310
- openrouter: {
311
- // OpenAI-compatible API with extra routing params
312
- temperature: "temperature",
313
- max_tokens: "max_tokens",
314
- max_completion_tokens: "max_completion_tokens",
315
- top_p: "top_p",
316
- top_k: "top_k",
317
- frequency_penalty: "frequency_penalty",
318
- presence_penalty: "presence_penalty",
319
- stop: "stop",
320
- n: "n",
321
- seed: "seed",
322
- stream: "stream",
323
- effort: "reasoning_effort",
324
- ...OPENROUTER_ROUTING_PARAMS
325
- },
326
- vercel: {
327
- // OpenAI-compatible gateway
328
- temperature: "temperature",
329
- max_tokens: "max_tokens",
330
- max_completion_tokens: "max_completion_tokens",
331
- top_p: "top_p",
332
- top_k: "top_k",
333
- frequency_penalty: "frequency_penalty",
334
- presence_penalty: "presence_penalty",
335
- stop: "stop",
336
- n: "n",
337
- seed: "seed",
338
- stream: "stream",
339
- effort: "reasoning_effort"
340
- },
341
- xai: OPENAI_COMPATIBLE_PARAMS,
342
- groq: OPENAI_COMPATIBLE_PARAMS,
343
- fal: FAL_PARAMS,
344
- deepinfra: OPENAI_COMPATIBLE_PARAMS,
345
- "black-forest-labs": {},
346
- together: OPENAI_COMPATIBLE_PARAMS,
347
- fireworks: OPENAI_COMPATIBLE_PARAMS,
348
- deepseek: OPENAI_COMPATIBLE_PARAMS,
349
- moonshotai: OPENAI_COMPATIBLE_PARAMS,
350
- perplexity: OPENAI_COMPATIBLE_PARAMS,
351
- alibaba: OPENAI_COMPATIBLE_PARAMS,
352
- cerebras: OPENAI_COMPATIBLE_PARAMS,
353
- replicate: REPLICATE_PARAMS,
354
- prodia: PRODIA_PARAMS,
355
- luma: LUMA_PARAMS,
356
- bytedance: {},
357
- kling: {},
358
- elevenlabs: {},
359
- assemblyai: {},
360
- deepgram: {},
361
- gladia: {},
362
- lmnt: {},
363
- hume: {},
364
- revai: {},
365
- baseten: OPENAI_COMPATIBLE_PARAMS,
366
- huggingface: OPENAI_COMPATIBLE_PARAMS
367
- };
368
- var REASONING_EFFORT_VALUES = [
369
- "none",
370
- "minimal",
371
- "low",
372
- "medium",
373
- "high",
374
- "xhigh",
375
- "max"
376
- ];
377
- var OPENAI_COMPATIBLE_PARAM_SPECS = {
378
- temperature: {
379
- type: "number",
380
- min: 0,
381
- max: 2,
382
- default: 0.7,
383
- description: "Controls randomness"
384
- },
385
- max_tokens: {
386
- type: "number",
387
- min: 1,
388
- default: 4096,
389
- description: "Maximum output tokens"
390
- },
391
- max_completion_tokens: {
392
- type: "number",
393
- min: 1,
394
- default: 4096,
395
- description: "Maximum completion tokens (reasoning models)"
396
- },
397
- top_p: {
398
- type: "number",
399
- min: 0,
400
- max: 1,
401
- default: 1,
402
- description: "Nucleus sampling"
403
- },
404
- top_k: {
405
- type: "number",
406
- min: 0,
407
- default: 40,
408
- description: "Top-K sampling"
409
- },
410
- frequency_penalty: {
411
- type: "number",
412
- min: -2,
413
- max: 2,
414
- default: 0,
415
- description: "Penalize frequent tokens"
416
- },
417
- presence_penalty: {
418
- type: "number",
419
- min: -2,
420
- max: 2,
421
- default: 0,
422
- description: "Penalize repeated topics"
423
- },
424
- stop: { type: "string", description: "Stop sequences" },
425
- n: { type: "number", min: 1, default: 1, description: "Completions count" },
426
- seed: { type: "number", description: "Random seed" },
427
- stream: { type: "boolean", default: false, description: "Stream response" },
428
- reasoning_effort: {
429
- type: "string",
430
- values: REASONING_EFFORT_VALUES,
431
- default: "medium",
432
- description: "Reasoning effort"
433
- }
434
- };
435
- var OPENROUTER_ROUTING_PARAM_SPECS = {
436
- provider: { type: "string", description: "Provider routing preferences" },
437
- order: { type: "string", description: "Provider order" },
438
- "provider.order": { type: "string", description: "Provider order" },
439
- only: { type: "string", description: "Provider allowlist" },
440
- "provider.only": { type: "string", description: "Provider allowlist" },
441
- ignore: { type: "string", description: "Provider blocklist" },
442
- "provider.ignore": { type: "string", description: "Provider blocklist" },
443
- allow_fallbacks: {
444
- type: "boolean",
445
- default: true,
446
- description: "Allow fallback providers"
447
- },
448
- "provider.allow_fallbacks": {
449
- type: "boolean",
450
- default: true,
451
- description: "Allow fallback providers"
452
- },
453
- require_parameters: {
454
- type: "boolean",
455
- default: false,
456
- description: "Only route to providers that support all request params"
457
- },
458
- "provider.require_parameters": {
459
- type: "boolean",
460
- default: false,
461
- description: "Only route to providers that support all request params"
462
- },
463
- data_collection: {
464
- type: "string",
465
- values: ["allow", "deny"],
466
- default: "allow",
467
- description: "Provider data collection policy"
468
- },
469
- "provider.data_collection": {
470
- type: "string",
471
- values: ["allow", "deny"],
472
- default: "allow",
473
- description: "Provider data collection policy"
474
- },
475
- zdr: {
476
- type: "boolean",
477
- description: "Require zero data retention providers"
478
- },
479
- "provider.zdr": {
480
- type: "boolean",
481
- description: "Require zero data retention providers"
482
- },
483
- enforce_distillable_text: {
484
- type: "boolean",
485
- description: "Require providers that allow text distillation"
486
- },
487
- "provider.enforce_distillable_text": {
488
- type: "boolean",
489
- description: "Require providers that allow text distillation"
490
- },
491
- quantizations: {
492
- type: "string",
493
- description: "Allowed provider quantization levels"
494
- },
495
- "provider.quantizations": {
496
- type: "string",
497
- description: "Allowed provider quantization levels"
498
- },
499
- sort: {
500
- type: "string",
501
- values: ["price", "throughput", "latency", "cost", "ttft", "tps"],
502
- description: "Provider sort strategy"
503
- },
504
- "provider.sort": {
505
- type: "string",
506
- values: ["price", "throughput", "latency", "cost", "ttft", "tps"],
507
- description: "Provider sort strategy"
508
- },
509
- preferred_min_throughput: {
510
- type: "number",
511
- min: 0,
512
- description: "Preferred minimum provider throughput"
513
- },
514
- "provider.preferred_min_throughput": {
515
- type: "number",
516
- min: 0,
517
- description: "Preferred minimum provider throughput"
518
- },
519
- preferred_max_latency: {
520
- type: "number",
521
- min: 0,
522
- description: "Preferred maximum provider latency"
523
- },
524
- "provider.preferred_max_latency": {
525
- type: "number",
526
- min: 0,
527
- description: "Preferred maximum provider latency"
528
- },
529
- max_price: {
530
- type: "string",
531
- description: "Maximum provider price filter"
532
- },
533
- "provider.max_price": {
534
- type: "string",
535
- description: "Maximum provider price filter"
536
- },
537
- transforms: {
538
- type: "string",
539
- description: "Legacy OpenRouter message transforms"
540
- },
541
- plugins: {
542
- type: "string",
543
- description: "OpenRouter request plugins"
544
- }
545
- };
546
- var FAL_PARAM_SPECS = {
547
- prompt: { type: "string", description: "Prompt" },
548
- negative_prompt: { type: "string", description: "Negative prompt" },
549
- seed: { type: "number", description: "Random seed" },
550
- num_images: {
551
- type: "number",
552
- min: 1,
553
- description: "Number of images to generate"
554
- },
555
- image_size: { type: "string", description: "Output image size" },
556
- aspect_ratio: { type: "string", description: "Output aspect ratio" },
557
- enable_safety_checker: {
558
- type: "boolean",
559
- description: "Enable safety checker"
560
- },
561
- enable_safety_checks: {
562
- type: "boolean",
563
- description: "Enable safety checker"
564
- },
565
- enable_prompt_expansion: {
566
- type: "boolean",
567
- description: "Enable prompt expansion"
568
- },
569
- expand_prompt: {
570
- type: "boolean",
571
- description: "Enable prompt expansion"
572
- },
573
- output_format: {
574
- type: "string",
575
- values: ["jpeg", "jpg", "png", "webp", "gif"],
576
- description: "Output image format"
577
- },
578
- width: { type: "number", min: 1, description: "Image width" },
579
- height: { type: "number", min: 1, description: "Image height" }
580
- };
581
- var REPLICATE_PARAM_SPECS = {
582
- prompt: { type: "string", description: "Prompt" },
583
- negative_prompt: { type: "string", description: "Negative prompt" },
584
- input: { type: "string", description: "Model input object" },
585
- version: { type: "string", description: "Model version" },
586
- seed: { type: "number", description: "Random seed" },
587
- num_outputs: {
588
- type: "number",
589
- min: 1,
590
- description: "Number of outputs to generate"
591
- },
592
- num_inference_steps: {
593
- type: "number",
594
- min: 1,
595
- description: "Number of inference steps"
596
- },
597
- guidance_scale: {
598
- type: "number",
599
- min: 0,
600
- description: "Guidance scale"
601
- },
602
- image_size: { type: "string", description: "Output image size" },
603
- aspect_ratio: { type: "string", description: "Output aspect ratio" },
604
- output_format: { type: "string", description: "Output format" },
605
- width: { type: "number", min: 1, description: "Image width" },
606
- height: { type: "number", min: 1, description: "Image height" },
607
- stream: { type: "boolean", description: "Request streaming output" },
608
- webhook: { type: "string", description: "Webhook URL" },
609
- webhook_events_filter: {
610
- type: "string",
611
- description: "Webhook events filter"
612
- }
613
- };
614
- var PRODIA_PARAM_SPECS = {
615
- model: { type: "string", description: "Model name" },
616
- prompt: { type: "string", description: "Prompt" },
617
- negative_prompt: { type: "string", description: "Negative prompt" },
618
- style_preset: { type: "string", description: "Style preset" },
619
- steps: { type: "number", min: 1, description: "Generation steps" },
620
- cfg_scale: { type: "number", min: 0, description: "CFG scale" },
621
- seed: { type: "number", description: "Random seed" },
622
- upscale: { type: "boolean", description: "Enable 2x upscale" },
623
- sampler: { type: "string", description: "Sampler" },
624
- width: { type: "number", min: 1, max: 1024, description: "Image width" },
625
- height: { type: "number", min: 1, max: 1024, description: "Image height" },
626
- image_size: { type: "string", description: "Output image size" },
627
- aspect_ratio: { type: "string", description: "Output aspect ratio" },
628
- output_format: { type: "string", description: "Output format" },
629
- type: { type: "string", description: "Prodia v2 job type" },
630
- config: { type: "string", description: "Prodia v2 job config" },
631
- price: { type: "boolean", description: "Include Prodia v2 job price" }
632
- };
633
- var LUMA_PARAM_SPECS = {
634
- prompt: { type: "string", description: "Prompt" },
635
- model: { type: "string", description: "Model name" },
636
- aspect_ratio: { type: "string", description: "Output aspect ratio" },
637
- keyframes: { type: "string", description: "Generation keyframes" },
638
- loop: { type: "boolean", description: "Generate a looping video" },
639
- duration: { type: "string", description: "Generation duration" },
640
- type: { type: "string", description: "Generation type" },
641
- image_ref: { type: "string", description: "Image reference" },
642
- video: { type: "string", description: "Video options" },
643
- source: { type: "string", description: "Source generation or media" }
644
- };
645
- var GOOGLE_COMPATIBLE_PARAM_SPECS = {
646
- temperature: {
647
- type: "number",
648
- min: 0,
649
- max: 2,
650
- default: 0.7,
651
- description: "Controls randomness"
652
- },
653
- maxOutputTokens: {
654
- type: "number",
655
- min: 1,
656
- default: 4096,
657
- description: "Maximum output tokens"
658
- },
659
- topP: {
660
- type: "number",
661
- min: 0,
662
- max: 1,
663
- default: 1,
664
- description: "Nucleus sampling"
665
- },
666
- topK: {
667
- type: "number",
668
- min: 0,
669
- default: 40,
670
- description: "Top-K sampling"
671
- },
672
- frequencyPenalty: {
673
- type: "number",
674
- min: -2,
675
- max: 2,
676
- default: 0,
677
- description: "Penalize frequent tokens"
678
- },
679
- presencePenalty: {
680
- type: "number",
681
- min: -2,
682
- max: 2,
683
- default: 0,
684
- description: "Penalize repeated topics"
685
- },
686
- stopSequences: { type: "string", description: "Stop sequences" },
687
- candidateCount: {
688
- type: "number",
689
- min: 1,
690
- default: 1,
691
- description: "Candidate count"
692
- },
693
- stream: { type: "boolean", default: false, description: "Stream response" },
694
- seed: { type: "number", description: "Random seed" },
695
- responseMimeType: { type: "string", description: "Response MIME type" },
696
- responseSchema: { type: "string", description: "Response schema" }
697
- };
698
- var PARAM_SPECS = {
699
- openai: {
700
- temperature: {
701
- type: "number",
702
- min: 0,
703
- max: 2,
704
- default: 0.7,
705
- description: "Controls randomness"
706
- },
707
- max_tokens: {
708
- type: "number",
709
- min: 1,
710
- default: 4096,
711
- description: "Maximum output tokens"
712
- },
713
- max_completion_tokens: {
714
- type: "number",
715
- min: 1,
716
- default: 4096,
717
- description: "Maximum completion tokens (reasoning models)"
718
- },
719
- top_p: {
720
- type: "number",
721
- min: 0,
722
- max: 1,
723
- default: 1,
724
- description: "Nucleus sampling"
725
- },
726
- frequency_penalty: {
727
- type: "number",
728
- min: -2,
729
- max: 2,
730
- default: 0,
731
- description: "Penalize frequent tokens"
732
- },
733
- presence_penalty: {
734
- type: "number",
735
- min: -2,
736
- max: 2,
737
- default: 0,
738
- description: "Penalize repeated topics"
739
- },
740
- stop: { type: "string", description: "Stop sequences" },
741
- n: { type: "number", min: 1, default: 1, description: "Completions count" },
742
- seed: { type: "number", description: "Random seed" },
743
- stream: { type: "boolean", default: false, description: "Stream response" },
744
- reasoning_effort: {
745
- type: "string",
746
- values: REASONING_EFFORT_VALUES,
747
- default: "medium",
748
- description: "Reasoning effort"
749
- }
750
- },
751
- azure: OPENAI_COMPATIBLE_PARAM_SPECS,
752
- anthropic: {
753
- temperature: {
754
- type: "number",
755
- min: 0,
756
- max: 1,
757
- default: 0.7,
758
- description: "Controls randomness"
759
- },
760
- max_tokens: {
761
- type: "number",
762
- min: 1,
763
- default: 4096,
764
- description: "Maximum output tokens"
765
- },
766
- top_p: {
767
- type: "number",
768
- min: 0,
769
- max: 1,
770
- default: 1,
771
- description: "Nucleus sampling"
772
- },
773
- top_k: {
774
- type: "number",
775
- min: 0,
776
- default: 40,
777
- description: "Top-K sampling"
778
- },
779
- stop_sequences: { type: "string", description: "Stop sequences" },
780
- stream: { type: "boolean", default: false, description: "Stream response" },
781
- effort: {
782
- type: "string",
783
- values: REASONING_EFFORT_VALUES,
784
- default: "low",
785
- description: "Thinking effort"
786
- },
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
- google: {
801
- temperature: {
802
- type: "number",
803
- min: 0,
804
- max: 2,
805
- default: 0.7,
806
- description: "Controls randomness"
807
- },
808
- maxOutputTokens: {
809
- type: "number",
810
- min: 1,
811
- default: 4096,
812
- description: "Maximum output tokens"
813
- },
814
- topP: {
815
- type: "number",
816
- min: 0,
817
- max: 1,
818
- default: 1,
819
- description: "Nucleus sampling"
820
- },
821
- topK: {
822
- type: "number",
823
- min: 0,
824
- default: 40,
825
- description: "Top-K sampling"
826
- },
827
- frequencyPenalty: {
828
- type: "number",
829
- min: -2,
830
- max: 2,
831
- default: 0,
832
- description: "Penalize frequent tokens"
833
- },
834
- presencePenalty: {
835
- type: "number",
836
- min: -2,
837
- max: 2,
838
- default: 0,
839
- description: "Penalize repeated topics"
840
- },
841
- stopSequences: { type: "string", description: "Stop sequences" },
842
- candidateCount: {
843
- type: "number",
844
- min: 1,
845
- default: 1,
846
- description: "Candidate count"
847
- },
848
- stream: { type: "boolean", default: false, description: "Stream response" },
849
- seed: { type: "number", description: "Random seed" },
850
- responseMimeType: { type: "string", description: "Response MIME type" },
851
- responseSchema: { type: "string", description: "Response schema" }
852
- },
853
- "google-vertex": GOOGLE_COMPATIBLE_PARAM_SPECS,
854
- mistral: {
855
- temperature: {
856
- type: "number",
857
- min: 0,
858
- max: 1,
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
- frequency_penalty: {
876
- type: "number",
877
- min: -2,
878
- max: 2,
879
- default: 0,
880
- description: "Penalize frequent tokens"
881
- },
882
- presence_penalty: {
883
- type: "number",
884
- min: -2,
885
- max: 2,
886
- default: 0,
887
- description: "Penalize repeated topics"
888
- },
889
- stop: { type: "string", description: "Stop sequences" },
890
- n: { type: "number", min: 1, default: 1, description: "Completions count" },
891
- random_seed: { type: "number", description: "Random seed" },
892
- stream: { type: "boolean", default: false, description: "Stream response" },
893
- safe_prompt: {
894
- type: "boolean",
895
- default: false,
896
- description: "Enable safe prompt"
897
- },
898
- min_tokens: {
899
- type: "number",
900
- min: 0,
901
- default: 0,
902
- description: "Minimum tokens"
903
- }
904
- },
905
- cohere: {
906
- temperature: {
907
- type: "number",
908
- min: 0,
909
- max: 1,
910
- default: 0.7,
911
- description: "Controls randomness"
912
- },
913
- max_tokens: {
914
- type: "number",
915
- min: 1,
916
- default: 4096,
917
- description: "Maximum output tokens"
918
- },
919
- p: {
920
- type: "number",
921
- min: 0,
922
- max: 1,
923
- default: 1,
924
- description: "Nucleus sampling (p)"
925
- },
926
- k: {
927
- type: "number",
928
- min: 0,
929
- max: 500,
930
- default: 40,
931
- description: "Top-K sampling (k)"
932
- },
933
- frequency_penalty: {
934
- type: "number",
935
- min: 0,
936
- max: 1,
937
- default: 0,
938
- description: "Penalize frequent tokens"
939
- },
940
- presence_penalty: {
941
- type: "number",
942
- min: 0,
943
- max: 1,
944
- default: 0,
945
- description: "Penalize repeated topics"
946
- },
947
- stop_sequences: { type: "string", description: "Stop sequences" },
948
- stream: { type: "boolean", default: false, description: "Stream response" },
949
- seed: { type: "number", description: "Random seed" }
950
- },
951
- bedrock: {
952
- // Converse API inferenceConfig params
953
- temperature: {
954
- type: "number",
955
- min: 0,
956
- max: 1,
957
- default: 0.7,
958
- description: "Controls randomness"
959
- },
960
- maxTokens: {
961
- type: "number",
962
- min: 1,
963
- default: 4096,
964
- description: "Maximum output tokens"
965
- },
966
- topP: {
967
- type: "number",
968
- min: 0,
969
- max: 1,
970
- default: 1,
971
- description: "Nucleus sampling"
972
- },
973
- topK: {
974
- type: "number",
975
- min: 0,
976
- default: 40,
977
- description: "Top-K sampling"
978
- },
979
- stopSequences: { type: "string", description: "Stop sequences" },
980
- stream: { type: "boolean", default: false, description: "Stream response" },
981
- cache_control: {
982
- type: "string",
983
- values: ["ephemeral"],
984
- default: "ephemeral",
985
- description: "Cache control"
986
- },
987
- cache_ttl: {
988
- type: "string",
989
- values: ["5m", "1h"],
990
- default: "5m",
991
- description: "Cache TTL"
992
- }
993
- },
994
- openrouter: {
995
- // Loose validation — proxies to many providers with varying ranges
996
- temperature: {
997
- type: "number",
998
- min: 0,
999
- max: 2,
1000
- default: 0.7,
1001
- description: "Controls randomness"
1002
- },
1003
- max_tokens: {
1004
- type: "number",
1005
- min: 1,
1006
- default: 4096,
1007
- description: "Maximum output tokens"
1008
- },
1009
- max_completion_tokens: {
1010
- type: "number",
1011
- min: 1,
1012
- default: 4096,
1013
- description: "Maximum completion tokens (reasoning models)"
1014
- },
1015
- top_p: {
1016
- type: "number",
1017
- min: 0,
1018
- max: 1,
1019
- default: 1,
1020
- description: "Nucleus sampling"
1021
- },
1022
- top_k: {
1023
- type: "number",
1024
- min: 0,
1025
- default: 40,
1026
- description: "Top-K sampling"
1027
- },
1028
- frequency_penalty: {
1029
- type: "number",
1030
- min: -2,
1031
- max: 2,
1032
- default: 0,
1033
- description: "Penalize frequent tokens"
1034
- },
1035
- presence_penalty: {
1036
- type: "number",
1037
- min: -2,
1038
- max: 2,
1039
- default: 0,
1040
- description: "Penalize repeated topics"
1041
- },
1042
- stop: { type: "string", description: "Stop sequences" },
1043
- n: { type: "number", min: 1, default: 1, description: "Completions count" },
1044
- seed: { type: "number", description: "Random seed" },
1045
- stream: { type: "boolean", default: false, description: "Stream response" },
1046
- reasoning_effort: {
1047
- type: "string",
1048
- values: REASONING_EFFORT_VALUES,
1049
- default: "medium",
1050
- description: "Reasoning effort"
1051
- },
1052
- ...OPENROUTER_ROUTING_PARAM_SPECS
1053
- },
1054
- vercel: {
1055
- // Loose validation — proxies to many providers with varying ranges
1056
- temperature: {
1057
- type: "number",
1058
- min: 0,
1059
- max: 2,
1060
- default: 0.7,
1061
- description: "Controls randomness"
1062
- },
1063
- max_tokens: {
1064
- type: "number",
1065
- min: 1,
1066
- default: 4096,
1067
- description: "Maximum output tokens"
1068
- },
1069
- max_completion_tokens: {
1070
- type: "number",
1071
- min: 1,
1072
- default: 4096,
1073
- description: "Maximum completion tokens (reasoning models)"
1074
- },
1075
- top_p: {
1076
- type: "number",
1077
- min: 0,
1078
- max: 1,
1079
- default: 1,
1080
- description: "Nucleus sampling"
1081
- },
1082
- top_k: {
1083
- type: "number",
1084
- min: 0,
1085
- default: 40,
1086
- description: "Top-K sampling"
1087
- },
1088
- frequency_penalty: {
1089
- type: "number",
1090
- min: -2,
1091
- max: 2,
1092
- default: 0,
1093
- description: "Penalize frequent tokens"
1094
- },
1095
- presence_penalty: {
1096
- type: "number",
1097
- min: -2,
1098
- max: 2,
1099
- default: 0,
1100
- description: "Penalize repeated topics"
1101
- },
1102
- stop: { type: "string", description: "Stop sequences" },
1103
- n: { type: "number", min: 1, default: 1, description: "Completions count" },
1104
- seed: { type: "number", description: "Random seed" },
1105
- stream: { type: "boolean", default: false, description: "Stream response" },
1106
- reasoning_effort: {
1107
- type: "string",
1108
- values: REASONING_EFFORT_VALUES,
1109
- default: "medium",
1110
- description: "Reasoning effort"
1111
- },
1112
- order: { type: "string", description: "Gateway provider order" },
1113
- only: { type: "string", description: "Gateway provider allowlist" },
1114
- models: { type: "string", description: "Gateway fallback models" },
1115
- tags: { type: "string", description: "Gateway usage tags" },
1116
- sort: {
1117
- type: "string",
1118
- values: ["cost", "ttft", "tps"],
1119
- description: "Gateway provider sort strategy"
1120
- },
1121
- caching: {
1122
- type: "string",
1123
- values: ["auto"],
1124
- description: "Gateway automatic caching strategy"
1125
- },
1126
- user: { type: "string", description: "Gateway usage user identifier" },
1127
- byok: { type: "string", description: "Gateway BYOK credentials" },
1128
- zero_data_retention: {
1129
- type: "boolean",
1130
- description: "Gateway zero data retention routing"
1131
- },
1132
- zeroDataRetention: {
1133
- type: "boolean",
1134
- description: "Gateway zero data retention routing"
1135
- },
1136
- disallow_prompt_training: {
1137
- type: "boolean",
1138
- description: "Gateway prompt training opt-out routing"
1139
- },
1140
- disallowPromptTraining: {
1141
- type: "boolean",
1142
- description: "Gateway prompt training opt-out routing"
1143
- },
1144
- hipaa_compliant: {
1145
- type: "boolean",
1146
- description: "Gateway HIPAA-compliant routing"
1147
- },
1148
- hipaaCompliant: {
1149
- type: "boolean",
1150
- description: "Gateway HIPAA-compliant routing"
1151
- },
1152
- quota_entity_id: {
1153
- type: "string",
1154
- description: "Gateway quota entity identifier"
1155
- },
1156
- quotaEntityId: {
1157
- type: "string",
1158
- description: "Gateway quota entity identifier"
1159
- },
1160
- provider_timeouts: {
1161
- type: "string",
1162
- description: "Gateway provider timeouts"
1163
- },
1164
- providerTimeouts: {
1165
- type: "string",
1166
- description: "Gateway provider timeouts"
1167
- }
1168
- },
1169
- xai: OPENAI_COMPATIBLE_PARAM_SPECS,
1170
- groq: OPENAI_COMPATIBLE_PARAM_SPECS,
1171
- fal: FAL_PARAM_SPECS,
1172
- deepinfra: OPENAI_COMPATIBLE_PARAM_SPECS,
1173
- "black-forest-labs": {},
1174
- together: OPENAI_COMPATIBLE_PARAM_SPECS,
1175
- fireworks: OPENAI_COMPATIBLE_PARAM_SPECS,
1176
- deepseek: OPENAI_COMPATIBLE_PARAM_SPECS,
1177
- moonshotai: OPENAI_COMPATIBLE_PARAM_SPECS,
1178
- perplexity: OPENAI_COMPATIBLE_PARAM_SPECS,
1179
- alibaba: OPENAI_COMPATIBLE_PARAM_SPECS,
1180
- cerebras: OPENAI_COMPATIBLE_PARAM_SPECS,
1181
- replicate: REPLICATE_PARAM_SPECS,
1182
- prodia: PRODIA_PARAM_SPECS,
1183
- luma: LUMA_PARAM_SPECS,
1184
- bytedance: {},
1185
- kling: {},
1186
- elevenlabs: {},
1187
- assemblyai: {},
1188
- deepgram: {},
1189
- gladia: {},
1190
- lmnt: {},
1191
- hume: {},
1192
- revai: {},
1193
- baseten: OPENAI_COMPATIBLE_PARAM_SPECS,
1194
- huggingface: OPENAI_COMPATIBLE_PARAM_SPECS
1195
- };
1196
-
1197
- // src/parse.ts
1198
- function parse(connectionString) {
1199
- const url = new URL(connectionString);
1200
- if (url.protocol !== "llm:") {
1201
- throw new Error(
1202
- `Invalid scheme: expected "llm://", got "${url.protocol}//"`
1203
- );
1204
- }
1205
- const { host, alias: hostAlias } = resolveHostAlias(url.host);
1206
- const model = url.pathname.replace(/^\//, "");
1207
- const label = url.username || void 0;
1208
- const apiKey = url.password || void 0;
1209
- const params = {};
1210
- for (const [key, value] of url.searchParams) {
1211
- params[key] = value;
1212
- }
1213
- return {
1214
- raw: connectionString,
1215
- host,
1216
- hostAlias,
1217
- model,
1218
- label,
1219
- apiKey,
1220
- params
1221
- };
1222
- }
1223
- function build(config) {
1224
- const { host } = resolveHostAlias(config.host);
1225
- const auth = config.label || config.apiKey ? `${config.label ?? ""}${config.apiKey ? `:${config.apiKey}` : ""}@` : "";
1226
- const query = new URLSearchParams(config.params).toString();
1227
- const qs = query ? `?${query}` : "";
1228
- return `llm://${auth}${host}/${config.model}${qs}`;
1229
- }
1230
- // Annotate the CommonJS export names for ESM import in node:
1231
- 0 && (module.exports = {
1232
- build,
1233
- parse
1234
- });
1
+ "use strict";var e,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,a={};((e,r)=>{for(var i in r)t(e,i,{get:r[i],enumerable:!0})})(a,{build:()=>h,parse:()=>b}),module.exports=(e=a,((e,a,o,p)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let s of i(a))n.call(e,s)||s===o||t(e,s,{get:()=>a[s],enumerable:!(p=r(a,s))||p.enumerable});return e})(t({},"__esModule",{value:!0}),e));var o={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"};function p(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 s(e,t=function(){return"undefined"!=typeof process&&process.env?process.env:{}}()){const r=e.toLowerCase();if(i=o,n=r,!Object.prototype.hasOwnProperty.call(i,n))return{host:e};var i,n;const a=r,s=function(e,t){const r=e.toUpperCase(),i=t[`LLM_STRINGS_${r}_HOST`]??t[`LLM_STRINGS_HOST_${r}`];return i?.trim()?i:void 0}(a,t);return{host:p(s??o[a]),alias:a}}var m=["none","minimal","low","medium","high","xhigh","max"],c={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:m,default:"medium",description:"Reasoning effort"}}},l={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"}},d={prompt:"prompt",negative_prompt:"negative_prompt",seed:"seed",image_size:"image_size",aspect_ratio:"aspect_ratio",output_format:"output_format",width:"width",height:"height"},u={params:{...d,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:{...l,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"}}},y={params:{...d,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:{...l,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"}}},f={params:{...d,model:"model",style_preset:"style_preset",steps:"steps",cfg_scale:"cfg_scale",upscale:"upscale",sampler:"sampler",type:"type",config:"config",price:"price"},specs:{...l,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"}}},_={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"}}},g={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:m,default:"medium",description:"Reasoning effort"}}},azure:c,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:m,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:_,"google-vertex":_,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:{...c.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:{...c.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:{...c.params},specs:{...c.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:c,groq:c,fal:u,deepinfra:c,"black-forest-labs":{params:{},specs:{}},together:c,fireworks:c,deepseek:c,moonshotai:c,perplexity:c,alibaba:c,cerebras:c,replicate:y,prodia:f,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:c,huggingface:c};Object.fromEntries(Object.entries(g).map(([e,t])=>[e,t.params])),Object.fromEntries(Object.entries(g).map(([e,t])=>[e,t.specs])),Object.fromEntries(Object.entries(g).filter(([,e])=>void 0!==e.cacheValue).map(([e,t])=>[e,t.cacheValue])),Object.fromEntries(Object.entries(g).filter(([,e])=>void 0!==e.cacheTtls).map(([e,t])=>[e,t.cacheTtls]));function b(e){const t=new URL(e);if("llm:"!==t.protocol)throw new Error(`Invalid scheme: expected "llm://", got "${t.protocol}//"`);const{host:r,alias:i}=s(t.host),n=t.pathname.replace(/^\//,""),a=t.username||void 0,o=t.password||void 0,p={};for(const[e,r]of t.searchParams)p[e]=r;return{raw:e,host:r,hostAlias:i,model:n,label:a,apiKey:o,params:p}}function h(e){const{host:t}=s(e.host),r=e.label||e.apiKey?`${e.label??""}${e.apiKey?`:${e.apiKey}`:""}@`:"",i=new URLSearchParams(e.params).toString(),n=i?`?${i}`:"";return`llm://${r}${t}/${e.model}${n}`}