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/README.md CHANGED
@@ -213,12 +213,10 @@ The AI SDK adapter is available as a separate subpath so you can load it only
213
213
  where you need it:
214
214
 
215
215
  ```ts
216
- import { parse } from "llm-strings";
217
-
218
216
  const { createAiSdkProviderOptions } = await import("llm-strings/ai-sdk");
219
217
 
220
218
  const { providerOptions } = createAiSdkProviderOptions(
221
- parse("llm://api.anthropic.com/claude-sonnet-4-5?cache=1h&effort=max"),
219
+ "llm://api.anthropic.com/claude-sonnet-4-5?cache=1h&effort=max",
222
220
  );
223
221
 
224
222
  // {
@@ -468,7 +466,6 @@ Returns `true` if the Bedrock model supports prompt caching (Claude and Nova mod
468
466
  | `PARAM_SPECS` | Validation rules (type, min/max, enum) per provider, keyed by provider-specific param name |
469
467
  | `REASONING_MODEL_UNSUPPORTED` | Set of canonical params unsupported by reasoning models |
470
468
  | `PROVIDER_META` | Array of provider metadata (id, name, host, brand color) for UI integrations |
471
- | `MODELS` | Suggested model IDs per provider |
472
469
  | `CANONICAL_PARAM_SPECS` | Canonical param specs per provider with descriptions — useful for building UIs |
473
470
 
474
471
  ## TypeScript
@@ -498,14 +495,10 @@ import type {
498
495
 
499
496
  ## Provider Metadata (for UI integrations)
500
497
 
501
- The library exports metadata useful for building UIs — provider names, brand colors, suggested models, and canonical parameter specs:
498
+ The library exports metadata useful for building UIs — provider names, brand colors, and canonical parameter specs:
502
499
 
503
500
  ```ts
504
- import {
505
- PROVIDER_META,
506
- MODELS,
507
- CANONICAL_PARAM_SPECS,
508
- } from "llm-strings/providers";
501
+ import { PROVIDER_META, CANONICAL_PARAM_SPECS } from "llm-strings/providers";
509
502
 
510
503
  // Provider display info
511
504
  PROVIDER_META.forEach((p) => console.log(`${p.name}: ${p.host} (${p.color})`));
@@ -513,10 +506,6 @@ PROVIDER_META.forEach((p) => console.log(`${p.name}: ${p.host} (${p.color})`));
513
506
  // Anthropic: api.anthropic.com (#e8956a)
514
507
  // ...
515
508
 
516
- // Suggested models per provider
517
- MODELS.openai; // → ["gpt-5.2", "gpt-5.2-pro", "gpt-4.1", "gpt-4.1-mini", ...]
518
- MODELS.anthropic; // → ["claude-opus-4-6", "claude-sonnet-4-6", "claude-sonnet-4-5", ...]
519
-
520
509
  // Canonical param specs — useful for building config forms
521
510
  CANONICAL_PARAM_SPECS.openai.temperature;
522
511
  // → { type: "number", min: 0, max: 2, default: 0.7, description: "Controls randomness" }
package/dist/ai-sdk.cjs CHANGED
@@ -28,11 +28,115 @@ module.exports = __toCommonJS(ai_sdk_exports);
28
28
  function hasOwn(object, key) {
29
29
  return Object.prototype.hasOwnProperty.call(object, key);
30
30
  }
31
+ var HOST_ALIASES = {
32
+ openai: "api.openai.com",
33
+ azure: "models.inference.ai.azure.com",
34
+ anthropic: "api.anthropic.com",
35
+ google: "generativelanguage.googleapis.com",
36
+ "google-vertex": "aiplatform.googleapis.com",
37
+ aistudio: "generativelanguage.googleapis.com",
38
+ mistral: "api.mistral.ai",
39
+ cohere: "api.cohere.com",
40
+ bedrock: "bedrock-runtime.us-east-1.amazonaws.com",
41
+ openrouter: "openrouter.ai",
42
+ vercel: "gateway.ai.vercel.app",
43
+ alibaba: "dashscope-intl.aliyuncs.com",
44
+ alibabacloud: "dashscope-intl.aliyuncs.com",
45
+ dashscope: "dashscope-intl.aliyuncs.com",
46
+ groq: "api.groq.com",
47
+ fal: "fal.run",
48
+ fireworks: "api.fireworks.ai",
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",
56
+ venice: "api.venice.ai",
57
+ parasail: "api.parasail.io",
58
+ deepinfra: "api.deepinfra.com",
59
+ atlascloud: "api.atlascloud.ai",
60
+ novita: "api.novita.ai",
61
+ novitaai: "api.novita.ai",
62
+ grok: "api.x.ai",
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",
81
+ wandb: "api.inference.wandb.ai",
82
+ weightsandbiases: "api.inference.wandb.ai",
83
+ baidu: "qianfan.baidubce.com",
84
+ qianfan: "qianfan.baidubce.com",
85
+ vertex: "aiplatform.googleapis.com",
86
+ xiaomi: "api.xiaomimimo.com",
87
+ minimax: "api.minimax.io"
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
+ };
101
+ function readProcessEnv() {
102
+ return typeof process !== "undefined" && process.env ? process.env : {};
103
+ }
104
+ function normalizeHostValue(value) {
105
+ const trimmed = value.trim();
106
+ if (!trimmed) return trimmed;
107
+ try {
108
+ if (trimmed.includes("://")) {
109
+ return new URL(trimmed).host;
110
+ }
111
+ } catch {
112
+ }
113
+ return trimmed.replace(/^\/\//, "").split("/")[0] ?? trimmed;
114
+ }
115
+ function envHostOverride(alias, env) {
116
+ const upper = alias.toUpperCase();
117
+ const override = env[`LLM_STRINGS_${upper}_HOST`] ?? env[`LLM_STRINGS_HOST_${upper}`];
118
+ return override?.trim() ? override : void 0;
119
+ }
120
+ function resolveHostAlias(host, env = readProcessEnv()) {
121
+ const normalizedHost = host.toLowerCase();
122
+ if (!hasOwn(HOST_ALIASES, normalizedHost)) {
123
+ return { host };
124
+ }
125
+ const alias = normalizedHost;
126
+ const override = envHostOverride(alias, env);
127
+ return {
128
+ host: normalizeHostValue(override ?? HOST_ALIASES[alias]),
129
+ alias
130
+ };
131
+ }
31
132
  function providerFromHostAlias(alias) {
32
133
  const normalizedAlias = alias.toLowerCase();
33
134
  if (hasOwn(PROVIDER_PARAMS, normalizedAlias)) {
34
135
  return normalizedAlias;
35
136
  }
137
+ if (hasOwn(HOST_ALIAS_PROVIDERS, normalizedAlias)) {
138
+ return HOST_ALIAS_PROVIDERS[normalizedAlias];
139
+ }
36
140
  return void 0;
37
141
  }
38
142
  function detectProvider(host) {
@@ -40,6 +144,34 @@ function detectProvider(host) {
40
144
  if (host.includes("openrouter")) return "openrouter";
41
145
  if (host.includes("gateway.ai.vercel")) return "vercel";
42
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";
43
175
  if (host.includes("openai")) return "openai";
44
176
  if (host.includes("anthropic") || host.includes("claude")) return "anthropic";
45
177
  if (host.includes("googleapis") || host.includes("google")) return "google";
@@ -94,6 +226,33 @@ var ALIASES = {
94
226
  cachePoint: "cache",
95
227
  cache_point: "cache"
96
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
+ };
97
256
  var PROVIDER_PARAMS = {
98
257
  openai: {
99
258
  temperature: "temperature",
@@ -107,6 +266,7 @@ var PROVIDER_PARAMS = {
107
266
  stream: "stream",
108
267
  effort: "reasoning_effort"
109
268
  },
269
+ azure: OPENAI_COMPATIBLE_PARAMS,
110
270
  anthropic: {
111
271
  temperature: "temperature",
112
272
  max_tokens: "max_tokens",
@@ -132,6 +292,7 @@ var PROVIDER_PARAMS = {
132
292
  responseMimeType: "responseMimeType",
133
293
  responseSchema: "responseSchema"
134
294
  },
295
+ "google-vertex": GOOGLE_COMPATIBLE_PARAMS,
135
296
  mistral: {
136
297
  temperature: "temperature",
137
298
  max_tokens: "max_tokens",
@@ -195,7 +356,33 @@ var PROVIDER_PARAMS = {
195
356
  seed: "seed",
196
357
  stream: "stream",
197
358
  effort: "reasoning_effort"
198
- }
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
199
386
  };
200
387
  function isReasoningModel(model) {
201
388
  const name = model.includes("/") ? model.split("/").pop() : model;
@@ -245,28 +432,84 @@ function bedrockSupportsCaching(model) {
245
432
  var CACHE_VALUES = {
246
433
  openai: void 0,
247
434
  // OpenAI auto-caches; no explicit param
435
+ azure: void 0,
248
436
  anthropic: "ephemeral",
249
437
  google: void 0,
250
438
  // Google uses explicit caching API, not a param
439
+ "google-vertex": void 0,
251
440
  mistral: void 0,
252
441
  cohere: void 0,
253
442
  bedrock: "ephemeral",
254
443
  // Supported for Claude models on Bedrock
255
444
  openrouter: void 0,
256
445
  // Depends on underlying provider
257
- vercel: void 0
446
+ vercel: void 0,
258
447
  // Depends on underlying provider
448
+ xai: void 0,
449
+ groq: void 0,
450
+ fal: void 0,
451
+ deepinfra: void 0,
452
+ "black-forest-labs": void 0,
453
+ together: void 0,
454
+ fireworks: void 0,
455
+ deepseek: void 0,
456
+ moonshotai: void 0,
457
+ perplexity: void 0,
458
+ alibaba: void 0,
459
+ cerebras: void 0,
460
+ replicate: void 0,
461
+ prodia: void 0,
462
+ luma: void 0,
463
+ bytedance: void 0,
464
+ kling: void 0,
465
+ elevenlabs: void 0,
466
+ assemblyai: void 0,
467
+ deepgram: void 0,
468
+ gladia: void 0,
469
+ lmnt: void 0,
470
+ hume: void 0,
471
+ revai: void 0,
472
+ baseten: void 0,
473
+ huggingface: void 0
259
474
  };
260
475
  var CACHE_TTLS = {
261
476
  openai: void 0,
477
+ azure: void 0,
262
478
  anthropic: ["5m", "1h"],
263
479
  google: void 0,
480
+ "google-vertex": void 0,
264
481
  mistral: void 0,
265
482
  cohere: void 0,
266
483
  bedrock: ["5m", "1h"],
267
484
  // Claude on Bedrock uses same TTLs as direct Anthropic
268
485
  openrouter: void 0,
269
- vercel: void 0
486
+ vercel: void 0,
487
+ xai: void 0,
488
+ groq: void 0,
489
+ fal: void 0,
490
+ deepinfra: void 0,
491
+ "black-forest-labs": void 0,
492
+ together: void 0,
493
+ fireworks: void 0,
494
+ deepseek: void 0,
495
+ moonshotai: void 0,
496
+ perplexity: void 0,
497
+ alibaba: void 0,
498
+ cerebras: void 0,
499
+ replicate: void 0,
500
+ prodia: void 0,
501
+ luma: void 0,
502
+ bytedance: void 0,
503
+ kling: void 0,
504
+ elevenlabs: void 0,
505
+ assemblyai: void 0,
506
+ deepgram: void 0,
507
+ gladia: void 0,
508
+ lmnt: void 0,
509
+ hume: void 0,
510
+ revai: void 0,
511
+ baseten: void 0,
512
+ huggingface: void 0
270
513
  };
271
514
  var DURATION_RE = /^\d+[mh]$/;
272
515
 
@@ -368,16 +611,71 @@ function normalize(config, options = {}) {
368
611
  };
369
612
  }
370
613
 
614
+ // src/parse.ts
615
+ function parse(connectionString) {
616
+ const url = new URL(connectionString);
617
+ if (url.protocol !== "llm:") {
618
+ throw new Error(
619
+ `Invalid scheme: expected "llm://", got "${url.protocol}//"`
620
+ );
621
+ }
622
+ const { host, alias: hostAlias } = resolveHostAlias(url.host);
623
+ const model = url.pathname.replace(/^\//, "");
624
+ const label = url.username || void 0;
625
+ const apiKey = url.password || void 0;
626
+ const params = {};
627
+ for (const [key, value] of url.searchParams) {
628
+ params[key] = value;
629
+ }
630
+ return {
631
+ raw: connectionString,
632
+ host,
633
+ hostAlias,
634
+ model,
635
+ label,
636
+ apiKey,
637
+ params
638
+ };
639
+ }
640
+
371
641
  // src/ai-sdk.ts
372
642
  var PROVIDER_OPTION_KEYS = {
373
643
  openai: "openai",
644
+ azure: "azure",
374
645
  anthropic: "anthropic",
375
646
  google: "google",
647
+ "google-vertex": "vertex",
376
648
  mistral: "mistral",
377
649
  cohere: "cohere",
378
650
  bedrock: "bedrock",
379
651
  openrouter: "openrouter",
380
- vercel: "gateway"
652
+ vercel: "gateway",
653
+ xai: "xai",
654
+ groq: "groq",
655
+ fal: "fal",
656
+ deepinfra: "deepinfra",
657
+ "black-forest-labs": "blackForestLabs",
658
+ together: "together",
659
+ fireworks: "fireworks",
660
+ deepseek: "deepseek",
661
+ moonshotai: "moonshotai",
662
+ perplexity: "perplexity",
663
+ alibaba: "alibaba",
664
+ cerebras: "cerebras",
665
+ replicate: "replicate",
666
+ prodia: "prodia",
667
+ luma: "luma",
668
+ bytedance: "bytedance",
669
+ kling: "kling",
670
+ elevenlabs: "elevenlabs",
671
+ assemblyai: "assemblyai",
672
+ deepgram: "deepgram",
673
+ gladia: "gladia",
674
+ lmnt: "lmnt",
675
+ hume: "hume",
676
+ revai: "revai",
677
+ baseten: "baseten",
678
+ huggingface: "huggingface"
381
679
  };
382
680
  var TRUE_VALUES = /* @__PURE__ */ new Set(["true", "1", "yes", "on"]);
383
681
  var FALSE_VALUES = /* @__PURE__ */ new Set(["false", "0", "no", "off"]);
@@ -428,8 +726,7 @@ function mergeObjectOption(options, provider, key, value) {
428
726
  setProviderOption(options, provider, key, parsed);
429
727
  }
430
728
  }
431
- function addOpenAiOption(options, key, value) {
432
- const target = "openai";
729
+ function addOpenAiOption(options, key, value, target = "openai") {
433
730
  const mappings = {
434
731
  reasoning_effort: "reasoningEffort",
435
732
  max_completion_tokens: "maxCompletionTokens",
@@ -541,8 +838,7 @@ function addAnthropicOption(options, key, value) {
541
838
  }
542
839
  setProviderOption(options, target, optionKey, typedValue(value));
543
840
  }
544
- function addGoogleOption(options, key, value) {
545
- const target = "google";
841
+ function addGoogleOption(options, key, value, target = "google") {
546
842
  if (key === "thinking_budget" || key === "thinking_level" || key === "include_thoughts") {
547
843
  const current = options[target]?.thinkingConfig;
548
844
  const thinkingConfig = current && typeof current === "object" && !Array.isArray(current) ? { ...current } : {};
@@ -778,21 +1074,71 @@ function addOpenRouterOption(options, key, value) {
778
1074
  setProviderOption(options, target, "user", value);
779
1075
  }
780
1076
  }
1077
+ function addFlexibleProviderOption(options, target, key, value) {
1078
+ setProviderOption(options, target, key, typedValue(value));
1079
+ }
781
1080
  function addProviderSpecificOption(options, provider, key, value, includeGatewayOptions) {
782
1081
  if (provider === "vercel") {
783
1082
  if (includeGatewayOptions) addGatewayOption(options, key, value);
784
1083
  return;
785
1084
  }
786
1085
  if (provider === "openai") addOpenAiOption(options, key, value);
1086
+ if (provider === "azure") addOpenAiOption(options, key, value, "azure");
787
1087
  if (provider === "anthropic") addAnthropicOption(options, key, value);
788
1088
  if (provider === "google") addGoogleOption(options, key, value);
1089
+ if (provider === "google-vertex")
1090
+ addGoogleOption(options, key, value, "vertex");
789
1091
  if (provider === "mistral") addMistralOption(options, key, value);
790
1092
  if (provider === "cohere") addCohereOption(options, key, value);
791
1093
  if (provider === "bedrock") addBedrockOption(options, key, value);
792
1094
  if (provider === "openrouter") addOpenRouterOption(options, key, value);
1095
+ if (provider === "xai") addOpenAiOption(options, key, value, "xai");
1096
+ if (provider === "groq") addOpenAiOption(options, key, value, "groq");
1097
+ if (provider === "fal") addFlexibleProviderOption(options, "fal", key, value);
1098
+ if (provider === "deepinfra")
1099
+ addOpenAiOption(options, key, value, "deepinfra");
1100
+ if (provider === "black-forest-labs")
1101
+ addFlexibleProviderOption(options, "blackForestLabs", key, value);
1102
+ if (provider === "together") addOpenAiOption(options, key, value, "together");
1103
+ if (provider === "fireworks")
1104
+ addOpenAiOption(options, key, value, "fireworks");
1105
+ if (provider === "deepseek") addOpenAiOption(options, key, value, "deepseek");
1106
+ if (provider === "moonshotai")
1107
+ addOpenAiOption(options, key, value, "moonshotai");
1108
+ if (provider === "perplexity")
1109
+ addOpenAiOption(options, key, value, "perplexity");
1110
+ if (provider === "alibaba") addOpenAiOption(options, key, value, "alibaba");
1111
+ if (provider === "cerebras") addOpenAiOption(options, key, value, "cerebras");
1112
+ if (provider === "replicate")
1113
+ addFlexibleProviderOption(options, "replicate", key, value);
1114
+ if (provider === "prodia")
1115
+ addFlexibleProviderOption(options, "prodia", key, value);
1116
+ if (provider === "luma")
1117
+ addFlexibleProviderOption(options, "luma", key, value);
1118
+ if (provider === "bytedance")
1119
+ addFlexibleProviderOption(options, "bytedance", key, value);
1120
+ if (provider === "kling")
1121
+ addFlexibleProviderOption(options, "kling", key, value);
1122
+ if (provider === "elevenlabs")
1123
+ addFlexibleProviderOption(options, "elevenlabs", key, value);
1124
+ if (provider === "assemblyai")
1125
+ addFlexibleProviderOption(options, "assemblyai", key, value);
1126
+ if (provider === "deepgram")
1127
+ addFlexibleProviderOption(options, "deepgram", key, value);
1128
+ if (provider === "gladia")
1129
+ addFlexibleProviderOption(options, "gladia", key, value);
1130
+ if (provider === "lmnt")
1131
+ addFlexibleProviderOption(options, "lmnt", key, value);
1132
+ if (provider === "hume")
1133
+ addFlexibleProviderOption(options, "hume", key, value);
1134
+ if (provider === "revai")
1135
+ addFlexibleProviderOption(options, "revai", key, value);
1136
+ if (provider === "baseten") addOpenAiOption(options, key, value, "baseten");
1137
+ if (provider === "huggingface")
1138
+ addOpenAiOption(options, key, value, "huggingface");
793
1139
  }
794
1140
  function createAiSdkProviderOptions(configOrResult, options = {}) {
795
- const normalized = "changes" in configOrResult && "subProvider" in configOrResult ? configOrResult : normalize(configOrResult, options);
1141
+ const normalized = typeof configOrResult === "string" ? normalize(parse(configOrResult), options) : "changes" in configOrResult && "subProvider" in configOrResult ? configOrResult : normalize(configOrResult, options);
796
1142
  const providerOptions = {};
797
1143
  if (!normalized.provider) {
798
1144
  return {
@@ -828,4 +1174,3 @@ function createAiSdkProviderOptions(configOrResult, options = {}) {
828
1174
  0 && (module.exports = {
829
1175
  createAiSdkProviderOptions
830
1176
  });
831
- //# sourceMappingURL=ai-sdk.cjs.map
package/dist/ai-sdk.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { NormalizeOptions, NormalizeResult } from './normalize.cjs';
1
+ import { NormalizeResult, NormalizeOptions } from './normalize.cjs';
2
2
  import { LlmConnectionConfig } from './parse.cjs';
3
- import { P as Provider } from './provider-core-BiAl8MCV.cjs';
3
+ import { P as Provider } from './provider-core-B934MuhJ.cjs';
4
4
 
5
5
  type AiSdkProviderOptions = Record<string, Record<string, unknown>>;
6
6
  interface AiSdkProviderOptionsResult {
@@ -15,6 +15,7 @@ interface AiSdkProviderOptionsOptions extends NormalizeOptions {
15
15
  */
16
16
  includeGatewayOptions?: boolean;
17
17
  }
18
+ type AiSdkProviderOptionsInput = string | LlmConnectionConfig | NormalizeResult;
18
19
  /**
19
20
  * Build AI SDK `providerOptions` from an LLM connection config.
20
21
  *
@@ -22,6 +23,6 @@ interface AiSdkProviderOptionsOptions extends NormalizeOptions {
22
23
  * `maxOutputTokens` are intentionally not emitted here. This helper only emits
23
24
  * provider-specific AI SDK options under the correct provider key.
24
25
  */
25
- declare function createAiSdkProviderOptions(configOrResult: LlmConnectionConfig | NormalizeResult, options?: AiSdkProviderOptionsOptions): AiSdkProviderOptionsResult;
26
+ declare function createAiSdkProviderOptions(configOrResult: AiSdkProviderOptionsInput, options?: AiSdkProviderOptionsOptions): AiSdkProviderOptionsResult;
26
27
 
27
- export { type AiSdkProviderOptions, type AiSdkProviderOptionsOptions, type AiSdkProviderOptionsResult, createAiSdkProviderOptions };
28
+ export { type AiSdkProviderOptions, type AiSdkProviderOptionsInput, type AiSdkProviderOptionsOptions, type AiSdkProviderOptionsResult, createAiSdkProviderOptions };
package/dist/ai-sdk.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { NormalizeOptions, NormalizeResult } from './normalize.js';
1
+ import { NormalizeResult, NormalizeOptions } from './normalize.js';
2
2
  import { LlmConnectionConfig } from './parse.js';
3
- import { P as Provider } from './provider-core-BiAl8MCV.js';
3
+ import { P as Provider } from './provider-core-B934MuhJ.js';
4
4
 
5
5
  type AiSdkProviderOptions = Record<string, Record<string, unknown>>;
6
6
  interface AiSdkProviderOptionsResult {
@@ -15,6 +15,7 @@ interface AiSdkProviderOptionsOptions extends NormalizeOptions {
15
15
  */
16
16
  includeGatewayOptions?: boolean;
17
17
  }
18
+ type AiSdkProviderOptionsInput = string | LlmConnectionConfig | NormalizeResult;
18
19
  /**
19
20
  * Build AI SDK `providerOptions` from an LLM connection config.
20
21
  *
@@ -22,6 +23,6 @@ interface AiSdkProviderOptionsOptions extends NormalizeOptions {
22
23
  * `maxOutputTokens` are intentionally not emitted here. This helper only emits
23
24
  * provider-specific AI SDK options under the correct provider key.
24
25
  */
25
- declare function createAiSdkProviderOptions(configOrResult: LlmConnectionConfig | NormalizeResult, options?: AiSdkProviderOptionsOptions): AiSdkProviderOptionsResult;
26
+ declare function createAiSdkProviderOptions(configOrResult: AiSdkProviderOptionsInput, options?: AiSdkProviderOptionsOptions): AiSdkProviderOptionsResult;
26
27
 
27
- export { type AiSdkProviderOptions, type AiSdkProviderOptionsOptions, type AiSdkProviderOptionsResult, createAiSdkProviderOptions };
28
+ export { type AiSdkProviderOptions, type AiSdkProviderOptionsInput, type AiSdkProviderOptionsOptions, type AiSdkProviderOptionsResult, createAiSdkProviderOptions };