llm-strings 1.4.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/parse.cjs CHANGED
@@ -1,159 +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
-
122
- // src/parse.ts
123
- function parse(connectionString) {
124
- const url = new URL(connectionString);
125
- if (url.protocol !== "llm:") {
126
- throw new Error(
127
- `Invalid scheme: expected "llm://", got "${url.protocol}//"`
128
- );
129
- }
130
- const { host, alias: hostAlias } = resolveHostAlias(url.host);
131
- const model = url.pathname.replace(/^\//, "");
132
- const label = url.username || void 0;
133
- const apiKey = url.password || void 0;
134
- const params = {};
135
- for (const [key, value] of url.searchParams) {
136
- params[key] = value;
137
- }
138
- return {
139
- raw: connectionString,
140
- host,
141
- hostAlias,
142
- model,
143
- label,
144
- apiKey,
145
- params
146
- };
147
- }
148
- function build(config) {
149
- const { host } = resolveHostAlias(config.host);
150
- const auth = config.label || config.apiKey ? `${config.label ?? ""}${config.apiKey ? `:${config.apiKey}` : ""}@` : "";
151
- const query = new URLSearchParams(config.params).toString();
152
- const qs = query ? `?${query}` : "";
153
- return `llm://${auth}${host}/${config.model}${qs}`;
154
- }
155
- // Annotate the CommonJS export names for ESM import in node:
156
- 0 && (module.exports = {
157
- build,
158
- parse
159
- });
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}`}
package/dist/parse.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as HostAlias } from './provider-core-B934MuhJ.cjs';
1
+ import { a as HostAlias } from './provider-core-CjpJ4qyF.cjs';
2
2
 
3
3
  interface LlmConnectionConfig {
4
4
  /** The original connection string */
@@ -7,7 +7,7 @@ interface LlmConnectionConfig {
7
7
  host: string;
8
8
  /** Short provider alias that was expanded to host, if any. */
9
9
  hostAlias?: HostAlias;
10
- /** Model name (e.g. "gpt-5.2") */
10
+ /** Model name (e.g. "gpt-5.5") */
11
11
  model: string;
12
12
  /** Optional label or app name */
13
13
  label?: string;
@@ -23,8 +23,8 @@ interface LlmConnectionConfig {
23
23
  *
24
24
  * @example
25
25
  * ```ts
26
- * parse("llm://api.openai.com/gpt-5.2?temp=0.7&max_tokens=1500")
27
- * parse("llm://app-name:sk-proj-123456@api.openai.com/gpt-5.2?temp=0.7")
26
+ * parse("llm://api.openai.com/gpt-4o?temp=0.7&max_tokens=1500")
27
+ * parse("llm://app-name:sk-proj-123456@api.openai.com/gpt-4o?temp=0.7")
28
28
  * ```
29
29
  */
30
30
  declare function parse(connectionString: string): LlmConnectionConfig;
package/dist/parse.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as HostAlias } from './provider-core-B934MuhJ.js';
1
+ import { a as HostAlias } from './provider-core-CjpJ4qyF.js';
2
2
 
3
3
  interface LlmConnectionConfig {
4
4
  /** The original connection string */
@@ -7,7 +7,7 @@ interface LlmConnectionConfig {
7
7
  host: string;
8
8
  /** Short provider alias that was expanded to host, if any. */
9
9
  hostAlias?: HostAlias;
10
- /** Model name (e.g. "gpt-5.2") */
10
+ /** Model name (e.g. "gpt-5.5") */
11
11
  model: string;
12
12
  /** Optional label or app name */
13
13
  label?: string;
@@ -23,8 +23,8 @@ interface LlmConnectionConfig {
23
23
  *
24
24
  * @example
25
25
  * ```ts
26
- * parse("llm://api.openai.com/gpt-5.2?temp=0.7&max_tokens=1500")
27
- * parse("llm://app-name:sk-proj-123456@api.openai.com/gpt-5.2?temp=0.7")
26
+ * parse("llm://api.openai.com/gpt-4o?temp=0.7&max_tokens=1500")
27
+ * parse("llm://app-name:sk-proj-123456@api.openai.com/gpt-4o?temp=0.7")
28
28
  * ```
29
29
  */
30
30
  declare function parse(connectionString: string): LlmConnectionConfig;
package/dist/parse.js CHANGED
@@ -1,9 +1 @@
1
- import {
2
- build,
3
- parse
4
- } from "./chunk-5YTG2NRX.js";
5
- import "./chunk-76EFNZCF.js";
6
- export {
7
- build,
8
- parse
9
- };
1
+ import{build as o,parse as r}from"./chunk-M5ENVTNI.js";import"./chunk-LIYUWJME.js";export{o as build,r as parse};
@@ -18,20 +18,14 @@ interface HostResolution {
18
18
  */
19
19
  declare function resolveHostAlias(host: string, env?: Env): HostResolution;
20
20
  declare function providerFromHostAlias(alias: string): Provider | undefined;
21
+ declare function modelMatchesFamily(model: string, family: string): boolean;
21
22
  declare function detectProvider(host: string): Provider | undefined;
22
23
  /**
23
24
  * Shorthand aliases → canonical param name.
24
25
  * Canonical names use snake_case and follow OpenAI conventions where possible.
25
26
  */
26
27
  declare const ALIASES: Record<string, string>;
27
- /**
28
- * Canonical param name → provider-specific API param name.
29
- * Only includes params the provider actually supports.
30
- */
31
- declare const PROVIDER_PARAMS: Record<Provider, Record<string, string>>;
32
- /**
33
- * Validation specs per provider, keyed by provider-specific param name.
34
- */
28
+ /** Validation spec for a single provider parameter. */
35
29
  interface ParamSpec {
36
30
  type: "number" | "string" | "boolean";
37
31
  min?: number;
@@ -40,7 +34,39 @@ interface ParamSpec {
40
34
  default?: string | number | boolean;
41
35
  description?: string;
42
36
  }
37
+ /**
38
+ * All per-provider configuration in one place.
39
+ * To add a new provider: add it to the Provider type, HOST_ALIASES,
40
+ * detectProvider, and add an entry to PROVIDER_DEFINITIONS below.
41
+ */
42
+ interface ProviderDefinition {
43
+ /** Canonical param name → provider-specific API param name. */
44
+ params: Record<string, string>;
45
+ /** Provider-specific param name → validation spec. */
46
+ specs: Record<string, ParamSpec>;
47
+ /** Cache value accepted by this provider (e.g. "ephemeral"). Absent = automatic or unsupported. */
48
+ cacheValue?: string;
49
+ /** Valid cache TTL strings. Absent = no TTL selection. */
50
+ cacheTtls?: string[];
51
+ }
52
+ declare const PROVIDER_DEFINITIONS: Record<Provider, ProviderDefinition>;
53
+ /** Canonical param name → provider-specific API param name. */
54
+ declare const PROVIDER_PARAMS: Record<Provider, Record<string, string>>;
55
+ /** Validation specs per provider, keyed by provider-specific param name. */
43
56
  declare const PARAM_SPECS: Record<Provider, Record<string, ParamSpec>>;
57
+ /**
58
+ * Cache value normalization per provider.
59
+ * Omitted providers auto-cache (OpenAI) or don't support the param at all.
60
+ */
61
+ declare const CACHE_VALUES: Partial<Record<Provider, string>>;
62
+ /** Valid cache TTL values per provider. Omitted providers don't support TTL selection. */
63
+ declare const CACHE_TTLS: Partial<Record<Provider, string[]>>;
64
+ /**
65
+ * Extra reasoning model family prefixes beyond what the patterns below detect.
66
+ * The o-series (o1, o3, …) and gpt-[5-9] series are auto-detected by pattern.
67
+ * Add a new entry here only for future series with different naming conventions.
68
+ */
69
+ declare const REASONING_MODEL_PREFIXES: readonly string[];
44
70
  /** OpenAI reasoning models don't support standard sampling params. */
45
71
  declare function isReasoningModel(model: string): boolean;
46
72
  /** Providers that can route to OpenAI models (and need reasoning-model checks). */
@@ -62,11 +88,5 @@ type BedrockModelFamily = "anthropic" | "meta" | "amazon" | "mistral" | "cohere"
62
88
  declare function detectBedrockModelFamily(model: string): BedrockModelFamily | undefined;
63
89
  /** Whether a Bedrock model supports prompt caching (Claude and Nova only). */
64
90
  declare function bedrockSupportsCaching(model: string): boolean;
65
- /** Cache value normalization per provider. */
66
- declare const CACHE_VALUES: Record<Provider, string | undefined>;
67
- /** Valid cache TTL values per provider. */
68
- declare const CACHE_TTLS: Record<Provider, string[] | undefined>;
69
- /** Match a duration expression like "5m", "1h", "30m". */
70
- declare const DURATION_RE: RegExp;
71
91
 
72
- export { ALIASES as A, type BedrockModelFamily as B, CACHE_TTLS as C, DURATION_RE as D, HOST_ALIASES as H, type Provider as P, REASONING_MODEL_UNSUPPORTED as R, type HostAlias as a, type HostResolution as b, CACHE_VALUES as c, PARAM_SPECS as d, PROVIDER_PARAMS as e, type ParamSpec as f, bedrockSupportsCaching as g, canHostOpenAIModels as h, detectBedrockModelFamily as i, detectGatewaySubProvider as j, detectProvider as k, isGatewayProvider as l, isReasoningModel as m, providerFromHostAlias as p, resolveHostAlias as r };
92
+ export { ALIASES as A, type BedrockModelFamily as B, CACHE_TTLS as C, HOST_ALIASES as H, type Provider as P, REASONING_MODEL_PREFIXES as R, type HostAlias as a, type HostResolution as b, CACHE_VALUES as c, PARAM_SPECS as d, PROVIDER_DEFINITIONS as e, PROVIDER_PARAMS as f, type ParamSpec as g, type ProviderDefinition as h, REASONING_MODEL_UNSUPPORTED as i, bedrockSupportsCaching as j, canHostOpenAIModels as k, detectBedrockModelFamily as l, detectGatewaySubProvider as m, detectProvider as n, isGatewayProvider as o, isReasoningModel as p, modelMatchesFamily as q, resolveHostAlias as r, providerFromHostAlias as s };
@@ -18,20 +18,14 @@ interface HostResolution {
18
18
  */
19
19
  declare function resolveHostAlias(host: string, env?: Env): HostResolution;
20
20
  declare function providerFromHostAlias(alias: string): Provider | undefined;
21
+ declare function modelMatchesFamily(model: string, family: string): boolean;
21
22
  declare function detectProvider(host: string): Provider | undefined;
22
23
  /**
23
24
  * Shorthand aliases → canonical param name.
24
25
  * Canonical names use snake_case and follow OpenAI conventions where possible.
25
26
  */
26
27
  declare const ALIASES: Record<string, string>;
27
- /**
28
- * Canonical param name → provider-specific API param name.
29
- * Only includes params the provider actually supports.
30
- */
31
- declare const PROVIDER_PARAMS: Record<Provider, Record<string, string>>;
32
- /**
33
- * Validation specs per provider, keyed by provider-specific param name.
34
- */
28
+ /** Validation spec for a single provider parameter. */
35
29
  interface ParamSpec {
36
30
  type: "number" | "string" | "boolean";
37
31
  min?: number;
@@ -40,7 +34,39 @@ interface ParamSpec {
40
34
  default?: string | number | boolean;
41
35
  description?: string;
42
36
  }
37
+ /**
38
+ * All per-provider configuration in one place.
39
+ * To add a new provider: add it to the Provider type, HOST_ALIASES,
40
+ * detectProvider, and add an entry to PROVIDER_DEFINITIONS below.
41
+ */
42
+ interface ProviderDefinition {
43
+ /** Canonical param name → provider-specific API param name. */
44
+ params: Record<string, string>;
45
+ /** Provider-specific param name → validation spec. */
46
+ specs: Record<string, ParamSpec>;
47
+ /** Cache value accepted by this provider (e.g. "ephemeral"). Absent = automatic or unsupported. */
48
+ cacheValue?: string;
49
+ /** Valid cache TTL strings. Absent = no TTL selection. */
50
+ cacheTtls?: string[];
51
+ }
52
+ declare const PROVIDER_DEFINITIONS: Record<Provider, ProviderDefinition>;
53
+ /** Canonical param name → provider-specific API param name. */
54
+ declare const PROVIDER_PARAMS: Record<Provider, Record<string, string>>;
55
+ /** Validation specs per provider, keyed by provider-specific param name. */
43
56
  declare const PARAM_SPECS: Record<Provider, Record<string, ParamSpec>>;
57
+ /**
58
+ * Cache value normalization per provider.
59
+ * Omitted providers auto-cache (OpenAI) or don't support the param at all.
60
+ */
61
+ declare const CACHE_VALUES: Partial<Record<Provider, string>>;
62
+ /** Valid cache TTL values per provider. Omitted providers don't support TTL selection. */
63
+ declare const CACHE_TTLS: Partial<Record<Provider, string[]>>;
64
+ /**
65
+ * Extra reasoning model family prefixes beyond what the patterns below detect.
66
+ * The o-series (o1, o3, …) and gpt-[5-9] series are auto-detected by pattern.
67
+ * Add a new entry here only for future series with different naming conventions.
68
+ */
69
+ declare const REASONING_MODEL_PREFIXES: readonly string[];
44
70
  /** OpenAI reasoning models don't support standard sampling params. */
45
71
  declare function isReasoningModel(model: string): boolean;
46
72
  /** Providers that can route to OpenAI models (and need reasoning-model checks). */
@@ -62,11 +88,5 @@ type BedrockModelFamily = "anthropic" | "meta" | "amazon" | "mistral" | "cohere"
62
88
  declare function detectBedrockModelFamily(model: string): BedrockModelFamily | undefined;
63
89
  /** Whether a Bedrock model supports prompt caching (Claude and Nova only). */
64
90
  declare function bedrockSupportsCaching(model: string): boolean;
65
- /** Cache value normalization per provider. */
66
- declare const CACHE_VALUES: Record<Provider, string | undefined>;
67
- /** Valid cache TTL values per provider. */
68
- declare const CACHE_TTLS: Record<Provider, string[] | undefined>;
69
- /** Match a duration expression like "5m", "1h", "30m". */
70
- declare const DURATION_RE: RegExp;
71
91
 
72
- export { ALIASES as A, type BedrockModelFamily as B, CACHE_TTLS as C, DURATION_RE as D, HOST_ALIASES as H, type Provider as P, REASONING_MODEL_UNSUPPORTED as R, type HostAlias as a, type HostResolution as b, CACHE_VALUES as c, PARAM_SPECS as d, PROVIDER_PARAMS as e, type ParamSpec as f, bedrockSupportsCaching as g, canHostOpenAIModels as h, detectBedrockModelFamily as i, detectGatewaySubProvider as j, detectProvider as k, isGatewayProvider as l, isReasoningModel as m, providerFromHostAlias as p, resolveHostAlias as r };
92
+ export { ALIASES as A, type BedrockModelFamily as B, CACHE_TTLS as C, HOST_ALIASES as H, type Provider as P, REASONING_MODEL_PREFIXES as R, type HostAlias as a, type HostResolution as b, CACHE_VALUES as c, PARAM_SPECS as d, PROVIDER_DEFINITIONS as e, PROVIDER_PARAMS as f, type ParamSpec as g, type ProviderDefinition as h, REASONING_MODEL_UNSUPPORTED as i, bedrockSupportsCaching as j, canHostOpenAIModels as k, detectBedrockModelFamily as l, detectGatewaySubProvider as m, detectProvider as n, isGatewayProvider as o, isReasoningModel as p, modelMatchesFamily as q, resolveHostAlias as r, providerFromHostAlias as s };