llm-strings 1.2.0 → 1.4.0

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.
Files changed (46) hide show
  1. package/README.md +3 -14
  2. package/dist/ai-sdk.cjs +355 -10
  3. package/dist/ai-sdk.d.cts +5 -4
  4. package/dist/ai-sdk.d.ts +5 -4
  5. package/dist/ai-sdk.js +87 -9
  6. package/dist/{chunk-BCOUH7LH.js → chunk-5YTG2NRX.js} +1 -2
  7. package/dist/{chunk-W4NIQY7M.js → chunk-76EFNZCF.js} +317 -4
  8. package/dist/{chunk-2ARD4TFU.js → chunk-DPVT3FFP.js} +1 -2
  9. package/dist/{chunk-RPXK2A7O.js → chunk-OBLFZFNR.js} +3 -4
  10. package/dist/index.cjs +317 -4
  11. package/dist/index.d.cts +1 -1
  12. package/dist/index.d.ts +1 -1
  13. package/dist/index.js +4 -5
  14. package/dist/normalize.cjs +157 -4
  15. package/dist/normalize.d.cts +1 -1
  16. package/dist/normalize.d.ts +1 -1
  17. package/dist/normalize.js +2 -3
  18. package/dist/parse.cjs +27 -1
  19. package/dist/parse.d.cts +1 -1
  20. package/dist/parse.d.ts +1 -1
  21. package/dist/parse.js +2 -3
  22. package/dist/{provider-core-BiAl8MCV.d.cts → provider-core-B934MuhJ.d.cts} +2 -2
  23. package/dist/{provider-core-BiAl8MCV.d.ts → provider-core-B934MuhJ.d.ts} +2 -2
  24. package/dist/providers.cjs +451 -445
  25. package/dist/providers.d.cts +3 -8
  26. package/dist/providers.d.ts +3 -8
  27. package/dist/providers.js +135 -442
  28. package/dist/validate.cjs +317 -4
  29. package/dist/validate.js +4 -5
  30. package/package.json +1 -1
  31. package/dist/ai-sdk.cjs.map +0 -1
  32. package/dist/ai-sdk.js.map +0 -1
  33. package/dist/chunk-2ARD4TFU.js.map +0 -1
  34. package/dist/chunk-BCOUH7LH.js.map +0 -1
  35. package/dist/chunk-RPXK2A7O.js.map +0 -1
  36. package/dist/chunk-W4NIQY7M.js.map +0 -1
  37. package/dist/index.cjs.map +0 -1
  38. package/dist/index.js.map +0 -1
  39. package/dist/normalize.cjs.map +0 -1
  40. package/dist/normalize.js.map +0 -1
  41. package/dist/parse.cjs.map +0 -1
  42. package/dist/parse.js.map +0 -1
  43. package/dist/providers.cjs.map +0 -1
  44. package/dist/providers.js.map +0 -1
  45. package/dist/validate.cjs.map +0 -1
  46. package/dist/validate.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -35,8 +35,10 @@ function hasOwn(object, key) {
35
35
  }
36
36
  var HOST_ALIASES = {
37
37
  openai: "api.openai.com",
38
+ azure: "models.inference.ai.azure.com",
38
39
  anthropic: "api.anthropic.com",
39
40
  google: "generativelanguage.googleapis.com",
41
+ "google-vertex": "aiplatform.googleapis.com",
40
42
  aistudio: "generativelanguage.googleapis.com",
41
43
  mistral: "api.mistral.ai",
42
44
  cohere: "api.cohere.com",
@@ -46,8 +48,16 @@ var HOST_ALIASES = {
46
48
  alibaba: "dashscope-intl.aliyuncs.com",
47
49
  alibabacloud: "dashscope-intl.aliyuncs.com",
48
50
  dashscope: "dashscope-intl.aliyuncs.com",
51
+ groq: "api.groq.com",
52
+ fal: "fal.run",
49
53
  fireworks: "api.fireworks.ai",
50
54
  fireworksai: "api.fireworks.ai",
55
+ "black-forest-labs": "api.bfl.ai",
56
+ bfl: "api.bfl.ai",
57
+ deepseek: "api.deepseek.com",
58
+ moonshotai: "api.moonshot.ai",
59
+ moonshot: "api.moonshot.ai",
60
+ perplexity: "api.perplexity.ai",
51
61
  venice: "api.venice.ai",
52
62
  parasail: "api.parasail.io",
53
63
  deepinfra: "api.deepinfra.com",
@@ -56,6 +66,23 @@ var HOST_ALIASES = {
56
66
  novitaai: "api.novita.ai",
57
67
  grok: "api.x.ai",
58
68
  xai: "api.x.ai",
69
+ together: "api.together.xyz",
70
+ togetherai: "api.together.xyz",
71
+ cerebras: "api.cerebras.ai",
72
+ replicate: "api.replicate.com",
73
+ prodia: "api.prodia.com",
74
+ luma: "api.lumalabs.ai",
75
+ bytedance: "ark.cn-beijing.volces.com",
76
+ kling: "api.klingai.com",
77
+ elevenlabs: "api.elevenlabs.io",
78
+ assemblyai: "api.assemblyai.com",
79
+ deepgram: "api.deepgram.com",
80
+ gladia: "api.gladia.io",
81
+ lmnt: "api.lmnt.com",
82
+ hume: "api.hume.ai",
83
+ revai: "api.rev.ai",
84
+ baseten: "api.baseten.co",
85
+ huggingface: "api-inference.huggingface.co",
59
86
  wandb: "api.inference.wandb.ai",
60
87
  weightsandbiases: "api.inference.wandb.ai",
61
88
  baidu: "qianfan.baidubce.com",
@@ -64,6 +91,18 @@ var HOST_ALIASES = {
64
91
  xiaomi: "api.xiaomimimo.com",
65
92
  minimax: "api.minimax.io"
66
93
  };
94
+ var HOST_ALIAS_PROVIDERS = {
95
+ aistudio: "google",
96
+ vertex: "google-vertex",
97
+ grok: "xai",
98
+ bfl: "black-forest-labs",
99
+ moonshot: "moonshotai",
100
+ alibaba: "alibaba",
101
+ alibabacloud: "alibaba",
102
+ dashscope: "alibaba",
103
+ togetherai: "together",
104
+ fireworksai: "fireworks"
105
+ };
67
106
  function readProcessEnv() {
68
107
  return typeof process !== "undefined" && process.env ? process.env : {};
69
108
  }
@@ -100,6 +139,9 @@ function providerFromHostAlias(alias) {
100
139
  if (hasOwn(PROVIDER_PARAMS, normalizedAlias)) {
101
140
  return normalizedAlias;
102
141
  }
142
+ if (hasOwn(HOST_ALIAS_PROVIDERS, normalizedAlias)) {
143
+ return HOST_ALIAS_PROVIDERS[normalizedAlias];
144
+ }
103
145
  return void 0;
104
146
  }
105
147
  function detectProvider(host) {
@@ -107,6 +149,34 @@ function detectProvider(host) {
107
149
  if (host.includes("openrouter")) return "openrouter";
108
150
  if (host.includes("gateway.ai.vercel")) return "vercel";
109
151
  if (host.includes("amazonaws") || host.includes("bedrock")) return "bedrock";
152
+ if (host.includes("aiplatform.googleapis")) return "google-vertex";
153
+ if (host.includes("api.x.ai")) return "xai";
154
+ if (host.includes("groq")) return "groq";
155
+ if (host.includes("fal.run") || host.includes("fal.ai")) return "fal";
156
+ if (host.includes("deepinfra")) return "deepinfra";
157
+ if (host.includes("bfl.ai")) return "black-forest-labs";
158
+ if (host.includes("together")) return "together";
159
+ if (host.includes("fireworks")) return "fireworks";
160
+ if (host.includes("deepseek")) return "deepseek";
161
+ if (host.includes("moonshot")) return "moonshotai";
162
+ if (host.includes("perplexity")) return "perplexity";
163
+ if (host.includes("dashscope") || host.includes("aliyuncs")) return "alibaba";
164
+ if (host.includes("cerebras")) return "cerebras";
165
+ if (host.includes("replicate")) return "replicate";
166
+ if (host.includes("prodia")) return "prodia";
167
+ if (host.includes("lumalabs") || host.includes("luma")) return "luma";
168
+ if (host.includes("volces") || host.includes("bytedance")) return "bytedance";
169
+ if (host.includes("kling")) return "kling";
170
+ if (host.includes("elevenlabs")) return "elevenlabs";
171
+ if (host.includes("assemblyai")) return "assemblyai";
172
+ if (host.includes("deepgram")) return "deepgram";
173
+ if (host.includes("gladia")) return "gladia";
174
+ if (host.includes("lmnt")) return "lmnt";
175
+ if (host.includes("hume")) return "hume";
176
+ if (host.includes("rev.ai")) return "revai";
177
+ if (host.includes("baseten")) return "baseten";
178
+ if (host.includes("huggingface")) return "huggingface";
179
+ if (host.includes("azure")) return "azure";
110
180
  if (host.includes("openai")) return "openai";
111
181
  if (host.includes("anthropic") || host.includes("claude")) return "anthropic";
112
182
  if (host.includes("googleapis") || host.includes("google")) return "google";
@@ -161,6 +231,33 @@ var ALIASES = {
161
231
  cachePoint: "cache",
162
232
  cache_point: "cache"
163
233
  };
234
+ var OPENAI_COMPATIBLE_PARAMS = {
235
+ temperature: "temperature",
236
+ max_tokens: "max_tokens",
237
+ top_p: "top_p",
238
+ top_k: "top_k",
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
+ var GOOGLE_COMPATIBLE_PARAMS = {
248
+ temperature: "temperature",
249
+ max_tokens: "maxOutputTokens",
250
+ top_p: "topP",
251
+ top_k: "topK",
252
+ frequency_penalty: "frequencyPenalty",
253
+ presence_penalty: "presencePenalty",
254
+ stop: "stopSequences",
255
+ n: "candidateCount",
256
+ stream: "stream",
257
+ seed: "seed",
258
+ responseMimeType: "responseMimeType",
259
+ responseSchema: "responseSchema"
260
+ };
164
261
  var PROVIDER_PARAMS = {
165
262
  openai: {
166
263
  temperature: "temperature",
@@ -174,6 +271,7 @@ var PROVIDER_PARAMS = {
174
271
  stream: "stream",
175
272
  effort: "reasoning_effort"
176
273
  },
274
+ azure: OPENAI_COMPATIBLE_PARAMS,
177
275
  anthropic: {
178
276
  temperature: "temperature",
179
277
  max_tokens: "max_tokens",
@@ -199,6 +297,7 @@ var PROVIDER_PARAMS = {
199
297
  responseMimeType: "responseMimeType",
200
298
  responseSchema: "responseSchema"
201
299
  },
300
+ "google-vertex": GOOGLE_COMPATIBLE_PARAMS,
202
301
  mistral: {
203
302
  temperature: "temperature",
204
303
  max_tokens: "max_tokens",
@@ -262,8 +361,139 @@ var PROVIDER_PARAMS = {
262
361
  seed: "seed",
263
362
  stream: "stream",
264
363
  effort: "reasoning_effort"
364
+ },
365
+ xai: OPENAI_COMPATIBLE_PARAMS,
366
+ groq: OPENAI_COMPATIBLE_PARAMS,
367
+ fal: {},
368
+ deepinfra: OPENAI_COMPATIBLE_PARAMS,
369
+ "black-forest-labs": {},
370
+ together: OPENAI_COMPATIBLE_PARAMS,
371
+ fireworks: OPENAI_COMPATIBLE_PARAMS,
372
+ deepseek: OPENAI_COMPATIBLE_PARAMS,
373
+ moonshotai: OPENAI_COMPATIBLE_PARAMS,
374
+ perplexity: OPENAI_COMPATIBLE_PARAMS,
375
+ alibaba: OPENAI_COMPATIBLE_PARAMS,
376
+ cerebras: OPENAI_COMPATIBLE_PARAMS,
377
+ replicate: {},
378
+ prodia: {},
379
+ luma: {},
380
+ bytedance: {},
381
+ kling: {},
382
+ elevenlabs: {},
383
+ assemblyai: {},
384
+ deepgram: {},
385
+ gladia: {},
386
+ lmnt: {},
387
+ hume: {},
388
+ revai: {},
389
+ baseten: OPENAI_COMPATIBLE_PARAMS,
390
+ huggingface: OPENAI_COMPATIBLE_PARAMS
391
+ };
392
+ var OPENAI_COMPATIBLE_PARAM_SPECS = {
393
+ temperature: {
394
+ type: "number",
395
+ min: 0,
396
+ max: 2,
397
+ default: 0.7,
398
+ description: "Controls randomness"
399
+ },
400
+ max_tokens: {
401
+ type: "number",
402
+ min: 1,
403
+ default: 4096,
404
+ description: "Maximum output tokens"
405
+ },
406
+ top_p: {
407
+ type: "number",
408
+ min: 0,
409
+ max: 1,
410
+ default: 1,
411
+ description: "Nucleus sampling"
412
+ },
413
+ top_k: {
414
+ type: "number",
415
+ min: 0,
416
+ default: 40,
417
+ description: "Top-K sampling"
418
+ },
419
+ frequency_penalty: {
420
+ type: "number",
421
+ min: -2,
422
+ max: 2,
423
+ default: 0,
424
+ description: "Penalize frequent tokens"
425
+ },
426
+ presence_penalty: {
427
+ type: "number",
428
+ min: -2,
429
+ max: 2,
430
+ default: 0,
431
+ description: "Penalize repeated topics"
432
+ },
433
+ stop: { type: "string", description: "Stop sequences" },
434
+ n: { type: "number", min: 1, default: 1, description: "Completions count" },
435
+ seed: { type: "number", description: "Random seed" },
436
+ stream: { type: "boolean", default: false, description: "Stream response" },
437
+ reasoning_effort: {
438
+ type: "string",
439
+ values: ["none", "minimal", "low", "medium", "high", "xhigh"],
440
+ default: "medium",
441
+ description: "Reasoning effort"
265
442
  }
266
443
  };
444
+ var GOOGLE_COMPATIBLE_PARAM_SPECS = {
445
+ temperature: {
446
+ type: "number",
447
+ min: 0,
448
+ max: 2,
449
+ default: 0.7,
450
+ description: "Controls randomness"
451
+ },
452
+ maxOutputTokens: {
453
+ type: "number",
454
+ min: 1,
455
+ default: 4096,
456
+ description: "Maximum output tokens"
457
+ },
458
+ topP: {
459
+ type: "number",
460
+ min: 0,
461
+ max: 1,
462
+ default: 1,
463
+ description: "Nucleus sampling"
464
+ },
465
+ topK: {
466
+ type: "number",
467
+ min: 0,
468
+ default: 40,
469
+ description: "Top-K sampling"
470
+ },
471
+ frequencyPenalty: {
472
+ type: "number",
473
+ min: -2,
474
+ max: 2,
475
+ default: 0,
476
+ description: "Penalize frequent tokens"
477
+ },
478
+ presencePenalty: {
479
+ type: "number",
480
+ min: -2,
481
+ max: 2,
482
+ default: 0,
483
+ description: "Penalize repeated topics"
484
+ },
485
+ stopSequences: { type: "string", description: "Stop sequences" },
486
+ candidateCount: {
487
+ type: "number",
488
+ min: 1,
489
+ default: 1,
490
+ description: "Candidate count"
491
+ },
492
+ stream: { type: "boolean", default: false, description: "Stream response" },
493
+ seed: { type: "number", description: "Random seed" },
494
+ responseMimeType: { type: "string", description: "Response MIME type" },
495
+ responseSchema: { type: "string", description: "Response schema" }
496
+ };
267
497
  var PARAM_SPECS = {
268
498
  openai: {
269
499
  temperature: {
@@ -311,6 +541,7 @@ var PARAM_SPECS = {
311
541
  description: "Reasoning effort"
312
542
  }
313
543
  },
544
+ azure: OPENAI_COMPATIBLE_PARAM_SPECS,
314
545
  anthropic: {
315
546
  temperature: {
316
547
  type: "number",
@@ -412,6 +643,7 @@ var PARAM_SPECS = {
412
643
  responseMimeType: { type: "string", description: "Response MIME type" },
413
644
  responseSchema: { type: "string", description: "Response schema" }
414
645
  },
646
+ "google-vertex": GOOGLE_COMPATIBLE_PARAM_SPECS,
415
647
  mistral: {
416
648
  temperature: {
417
649
  type: "number",
@@ -657,7 +889,33 @@ var PARAM_SPECS = {
657
889
  default: "medium",
658
890
  description: "Reasoning effort"
659
891
  }
660
- }
892
+ },
893
+ xai: OPENAI_COMPATIBLE_PARAM_SPECS,
894
+ groq: OPENAI_COMPATIBLE_PARAM_SPECS,
895
+ fal: {},
896
+ deepinfra: OPENAI_COMPATIBLE_PARAM_SPECS,
897
+ "black-forest-labs": {},
898
+ together: OPENAI_COMPATIBLE_PARAM_SPECS,
899
+ fireworks: OPENAI_COMPATIBLE_PARAM_SPECS,
900
+ deepseek: OPENAI_COMPATIBLE_PARAM_SPECS,
901
+ moonshotai: OPENAI_COMPATIBLE_PARAM_SPECS,
902
+ perplexity: OPENAI_COMPATIBLE_PARAM_SPECS,
903
+ alibaba: OPENAI_COMPATIBLE_PARAM_SPECS,
904
+ cerebras: OPENAI_COMPATIBLE_PARAM_SPECS,
905
+ replicate: {},
906
+ prodia: {},
907
+ luma: {},
908
+ bytedance: {},
909
+ kling: {},
910
+ elevenlabs: {},
911
+ assemblyai: {},
912
+ deepgram: {},
913
+ gladia: {},
914
+ lmnt: {},
915
+ hume: {},
916
+ revai: {},
917
+ baseten: OPENAI_COMPATIBLE_PARAM_SPECS,
918
+ huggingface: OPENAI_COMPATIBLE_PARAM_SPECS
661
919
  };
662
920
  function isReasoningModel(model) {
663
921
  const name = model.includes("/") ? model.split("/").pop() : model;
@@ -714,28 +972,84 @@ function bedrockSupportsCaching(model) {
714
972
  var CACHE_VALUES = {
715
973
  openai: void 0,
716
974
  // OpenAI auto-caches; no explicit param
975
+ azure: void 0,
717
976
  anthropic: "ephemeral",
718
977
  google: void 0,
719
978
  // Google uses explicit caching API, not a param
979
+ "google-vertex": void 0,
720
980
  mistral: void 0,
721
981
  cohere: void 0,
722
982
  bedrock: "ephemeral",
723
983
  // Supported for Claude models on Bedrock
724
984
  openrouter: void 0,
725
985
  // Depends on underlying provider
726
- vercel: void 0
986
+ vercel: void 0,
727
987
  // Depends on underlying provider
988
+ xai: void 0,
989
+ groq: void 0,
990
+ fal: void 0,
991
+ deepinfra: void 0,
992
+ "black-forest-labs": void 0,
993
+ together: void 0,
994
+ fireworks: void 0,
995
+ deepseek: void 0,
996
+ moonshotai: void 0,
997
+ perplexity: void 0,
998
+ alibaba: void 0,
999
+ cerebras: void 0,
1000
+ replicate: void 0,
1001
+ prodia: void 0,
1002
+ luma: void 0,
1003
+ bytedance: void 0,
1004
+ kling: void 0,
1005
+ elevenlabs: void 0,
1006
+ assemblyai: void 0,
1007
+ deepgram: void 0,
1008
+ gladia: void 0,
1009
+ lmnt: void 0,
1010
+ hume: void 0,
1011
+ revai: void 0,
1012
+ baseten: void 0,
1013
+ huggingface: void 0
728
1014
  };
729
1015
  var CACHE_TTLS = {
730
1016
  openai: void 0,
1017
+ azure: void 0,
731
1018
  anthropic: ["5m", "1h"],
732
1019
  google: void 0,
1020
+ "google-vertex": void 0,
733
1021
  mistral: void 0,
734
1022
  cohere: void 0,
735
1023
  bedrock: ["5m", "1h"],
736
1024
  // Claude on Bedrock uses same TTLs as direct Anthropic
737
1025
  openrouter: void 0,
738
- vercel: void 0
1026
+ vercel: void 0,
1027
+ xai: void 0,
1028
+ groq: void 0,
1029
+ fal: void 0,
1030
+ deepinfra: void 0,
1031
+ "black-forest-labs": void 0,
1032
+ together: void 0,
1033
+ fireworks: void 0,
1034
+ deepseek: void 0,
1035
+ moonshotai: void 0,
1036
+ perplexity: void 0,
1037
+ alibaba: void 0,
1038
+ cerebras: void 0,
1039
+ replicate: void 0,
1040
+ prodia: void 0,
1041
+ luma: void 0,
1042
+ bytedance: void 0,
1043
+ kling: void 0,
1044
+ elevenlabs: void 0,
1045
+ assemblyai: void 0,
1046
+ deepgram: void 0,
1047
+ gladia: void 0,
1048
+ lmnt: void 0,
1049
+ hume: void 0,
1050
+ revai: void 0,
1051
+ baseten: void 0,
1052
+ huggingface: void 0
739
1053
  };
740
1054
  var DURATION_RE = /^\d+[mh]$/;
741
1055
 
@@ -1035,4 +1349,3 @@ function validate(connectionString, options = {}) {
1035
1349
  resolveHostAlias,
1036
1350
  validate
1037
1351
  });
1038
- //# sourceMappingURL=index.cjs.map
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { LlmConnectionConfig, build, parse } from './parse.cjs';
2
2
  export { NormalizeChange, NormalizeOptions, NormalizeResult, normalize } from './normalize.cjs';
3
3
  export { ValidateOptions, ValidationIssue, validate } from './validate.cjs';
4
- export { H as HOST_ALIASES, a as HostAlias, b as HostResolution, r as resolveHostAlias } from './provider-core-BiAl8MCV.cjs';
4
+ export { H as HOST_ALIASES, a as HostAlias, b as HostResolution, r as resolveHostAlias } from './provider-core-B934MuhJ.cjs';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { LlmConnectionConfig, build, parse } from './parse.js';
2
2
  export { NormalizeChange, NormalizeOptions, NormalizeResult, normalize } from './normalize.js';
3
3
  export { ValidateOptions, ValidationIssue, validate } from './validate.js';
4
- export { H as HOST_ALIASES, a as HostAlias, b as HostResolution, r as resolveHostAlias } from './provider-core-BiAl8MCV.js';
4
+ export { H as HOST_ALIASES, a as HostAlias, b as HostResolution, r as resolveHostAlias } from './provider-core-B934MuhJ.js';
package/dist/index.js CHANGED
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  validate
3
- } from "./chunk-RPXK2A7O.js";
3
+ } from "./chunk-OBLFZFNR.js";
4
4
  import {
5
5
  normalize
6
- } from "./chunk-2ARD4TFU.js";
6
+ } from "./chunk-DPVT3FFP.js";
7
7
  import {
8
8
  build,
9
9
  parse
10
- } from "./chunk-BCOUH7LH.js";
10
+ } from "./chunk-5YTG2NRX.js";
11
11
  import {
12
12
  HOST_ALIASES,
13
13
  resolveHostAlias
14
- } from "./chunk-W4NIQY7M.js";
14
+ } from "./chunk-76EFNZCF.js";
15
15
  export {
16
16
  HOST_ALIASES,
17
17
  build,
@@ -20,4 +20,3 @@ export {
20
20
  resolveHostAlias,
21
21
  validate
22
22
  };
23
- //# sourceMappingURL=index.js.map