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