@adaline/openai 1.10.0 → 1.11.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/index.js CHANGED
@@ -4,214 +4,218 @@ var zod = require('zod');
4
4
  var provider = require('@adaline/provider');
5
5
  var types = require('@adaline/types');
6
6
 
7
- var Fn=Object.defineProperty,$n=Object.defineProperties;var Hn=Object.getOwnPropertyDescriptors;var bt=Object.getOwnPropertySymbols;var Vn=Object.prototype.hasOwnProperty,Kn=Object.prototype.propertyIsEnumerable;var ee=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Jn=t=>{throw TypeError(t)};var Pt=(t,e,n)=>e in t?Fn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,b=(t,e)=>{for(var n in e||(e={}))Vn.call(e,n)&&Pt(t,n,e[n]);if(bt)for(var n of bt(e))Kn.call(e,n)&&Pt(t,n,e[n]);return t},v=(t,e)=>$n(t,Hn(e));var A=(t,e,n)=>new Promise((o,s)=>{var a=l=>{try{r(n.next(l));}catch(T){s(T);}},m=l=>{try{r(n.throw(l));}catch(T){s(T);}},r=l=>l.done?o(l.value):Promise.resolve(l.value).then(a,m);r((n=n.apply(t,e)).next());}),St=function(t,e){this[0]=t,this[1]=e;},co=(t,e,n)=>{var o=(m,r,l,T)=>{try{var g=n[m](r),P=(r=g.value)instanceof St,O=g.done;Promise.resolve(P?r[0]:r).then(C=>P?o(m==="return"?m:"next",r[1]?{done:C.done,value:C.value}:C,l,T):l({value:C,done:O})).catch(C=>o("throw",C,l,T));}catch(C){T(C);}},s=m=>a[m]=r=>new Promise((l,T)=>o(m,r,l,T)),a={};return n=n.apply(t,e),a[ee("asyncIterator")]=()=>a,s("next"),s("throw"),s("return"),a},It=t=>{var e=t[ee("asyncIterator")],n=!1,o,s={};return e==null?(e=t[ee("iterator")](),o=a=>s[a]=m=>e[a](m)):(e=e.call(t),o=a=>s[a]=m=>{if(n){if(n=!1,a==="throw")throw m;return m}return n=!0,{done:!1,value:new St(new Promise(r=>{var l=e[a](m);l instanceof Object||Jn("Object expected"),r(l);}),1)}}),s[ee("iterator")]=()=>s,o("next"),"throw"in e?o("throw"):s.throw=a=>{throw a},"return"in e&&o("return"),s};var uo=provider.RangeConfigItem({param:"temperature",title:provider.CHAT_CONFIG.TEMPERATURE.title,description:provider.CHAT_CONFIG.TEMPERATURE.description,min:0,max:2,step:.01,default:1}),fo=t=>provider.RangeConfigItem({param:"max_completion_tokens",title:provider.CHAT_CONFIG.MAX_TOKENS.title,description:provider.CHAT_CONFIG.MAX_TOKENS.description,min:0,max:t,step:1,default:0}),_o=t=>provider.MultiStringConfigItem({param:"stop",title:provider.CHAT_CONFIG.STOP(t).title,description:provider.CHAT_CONFIG.STOP(t).description,max:t}),go=provider.RangeConfigItem({param:"top_p",title:provider.CHAT_CONFIG.TOP_P.title,description:provider.CHAT_CONFIG.TOP_P.description,min:0,max:1,step:.01,default:1}),To=provider.RangeConfigItem({param:"frequency_penalty",title:provider.CHAT_CONFIG.FREQUENCY_PENALTY.title,description:provider.CHAT_CONFIG.FREQUENCY_PENALTY.description,min:-2,max:2,step:.01,default:0}),Mo=provider.RangeConfigItem({param:"presence_penalty",title:provider.CHAT_CONFIG.PRESENCE_PENALTY.title,description:provider.CHAT_CONFIG.PRESENCE_PENALTY.description,min:-2,max:2,step:.01,default:0}),yo=provider.RangeConfigItem({param:"seed",title:provider.CHAT_CONFIG.SEED.title,description:provider.CHAT_CONFIG.SEED.description,min:0,max:1e6,step:1,default:0}),Oo=provider.SelectBooleanConfigItem({param:"logprobs",title:provider.CHAT_CONFIG.LOG_PROBS.title,description:provider.CHAT_CONFIG.LOG_PROBS.description,default:!1}),Co=provider.RangeConfigItem({param:"top_logprobs",title:provider.CHAT_CONFIG.TOP_LOG_PROBS.title,description:provider.CHAT_CONFIG.TOP_LOG_PROBS.description,min:0,max:20,step:1,default:0}),bo=provider.SelectStringConfigItem({param:"tool_choice",title:"Tool choice",description:"Controls which (if any) tool is called by the model. 'none' means the model will not call a function. 'auto' means the model can pick between generating a message or calling a tool.",default:"auto",choices:["auto","required","none"]}),Po=provider.SelectStringConfigItem({param:"reasoning_effort",title:"Reasoning Effort",description:"Controls the depth of the model's reasoning before delivering an answer. 'minimal' prioritizes speed, 'high' engages in deep reasoning.",default:"medium",choices:["minimal","low","medium","high"]}),So=provider.SelectStringConfigItem({param:"verbosity",title:"Verbosity",description:"Controls the length and detail of the model's responses, independent of reasoning depth. 'low' generates concise answers, 'high' provides comprehensive responses.",default:"medium",choices:["low","medium","high"]});var N=(t,e)=>zod.z.object({temperature:uo.schema,maxTokens:fo(t).schema,stop:_o(e).schema,topP:go.schema,frequencyPenalty:To.schema,presencePenalty:Mo.schema,seed:yo.schema.transform(n=>n===0?void 0:n),logProbs:Oo.schema,topLogProbs:Co.schema,toolChoice:bo.schema}),z=(t,e)=>({temperature:uo.def,maxTokens:fo(t).def,stop:_o(e).def,topP:go.def,frequencyPenalty:To.def,presencePenalty:Mo.def,seed:yo.def,logProbs:Oo.def,topLogProbs:Co.def,toolChoice:bo.def});var xt=provider.ObjectSchemaConfigItem({param:"response_schema",title:provider.CHAT_CONFIG.RESPONSE_SCHEMA.title,description:provider.CHAT_CONFIG.RESPONSE_SCHEMA.description,objectSchema:types.ResponseSchema}),Rt=provider.SelectStringConfigItem({param:"response_format",title:provider.CHAT_CONFIG.RESPONSE_FORMAT_WITH_SCHEMA.title,description:provider.CHAT_CONFIG.RESPONSE_FORMAT_WITH_SCHEMA.description,default:"text",choices:["text","json_object","json_schema"]}),j=(t,e)=>v(b({},z(t,e)),{responseFormat:Rt.def,responseSchema:xt.def}),F=(t,e)=>N(t,e).extend({responseFormat:Rt.schema,responseSchema:xt.schema});var At=(t,e)=>v(b({},z(t,e)),{reasoningEffort:Po.def,verbosity:So.def,responseFormat:j(t,e).responseFormat,responseSchema:j(t,e).responseSchema}),Et=(t,e)=>N(t,e).extend({reasoningEffort:Po.schema,verbosity:So.schema,responseFormat:F(t,e).shape.responseFormat,responseSchema:F(t,e).shape.responseSchema});var kt=provider.RangeConfigItem({param:"temperature",title:provider.CHAT_CONFIG.TEMPERATURE.title,description:provider.CHAT_CONFIG.TEMPERATURE.description,min:1,max:1,step:.01,default:1}),wt=provider.SelectStringConfigItem({param:"reasoning_effort",title:"Reasoning Effort",description:"Constrains effort on reasoning for reasoning models. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.",default:"medium",choices:["low","medium","high"]}),vt=(t,e)=>v(b({},j(t,e)),{temperature:kt.def,reasoningEffort:wt.def}),Dt=(t,e)=>F(t,e).extend({temperature:kt.schema,reasoningEffort:wt.schema});var qt=provider.SelectStringConfigItem({param:"response_format",title:provider.CHAT_CONFIG.RESPONSE_FORMAT.title,description:provider.CHAT_CONFIG.RESPONSE_FORMAT.description,default:"text",choices:["text","json_object"]}),Nt=(t,e)=>v(b({},z(t,e)),{responseFormat:qt.def}),zt=(t,e)=>N(t,e).extend({responseFormat:qt.schema});var Io=provider.SelectStringConfigItem({param:"encoding_format",title:"Encoding format",description:"Select the encoding format for the word embedding.",default:"float",choices:["float","base64"]}),xo=t=>provider.RangeConfigItem({param:"dimensions",title:"Dimensions",description:"Select the number of dimensions for the word embedding.",min:1,max:t,step:1,default:t});var te=()=>zod.z.object({encodingFormat:Io.schema}),ne=()=>({encodingFormat:Io.def});var Bt=t=>te().extend({dimensions:xo(t).schema}),Ut=t=>v(b({},ne()),{dimensions:xo(t).def});var i={base:(t,e)=>({def:z(t,e),schema:N(t,e)}),responseFormat:(t,e)=>({def:Nt(t,e),schema:zt(t,e)}),responseSchema:(t,e)=>({def:j(t,e),schema:F(t,e)}),oSeries:(t,e)=>({def:vt(t,e),schema:Dt(t,e)}),gpt5:(t,e)=>({def:At(t,e),schema:Et(t,e)})},D={base:()=>({def:ne(),schema:te()}),dimensions:t=>({def:Ut(t),schema:Bt(t)})};var _={"gpt-3.5-turbo-0125":{modelName:"gpt-3.5-turbo-0125",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:1.5}}}]},"gpt-3.5-turbo-1106":{modelName:"gpt-3.5-turbo-1106",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:1.5}}}]},"gpt-3.5-turbo":{modelName:"gpt-3.5-turbo",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:1.5}}}]},"gpt-4-0125-preview":{modelName:"gpt-4-0125-preview",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:30,outputPricePerMillion:60}}}]},"gpt-4-0613":{modelName:"gpt-4-0613",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:30,outputPricePerMillion:60}}}]},"gpt-4-1106-preview":{modelName:"gpt-4-1106-preview",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:30,outputPricePerMillion:60}}}]},"gpt-4-turbo-2024-04-09":{modelName:"gpt-4-turbo-2024-04-09",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:10,outputPricePerMillion:30}}}]},"gpt-4-turbo-preview":{modelName:"gpt-4-turbo-preview",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:10,outputPricePerMillion:30}}}]},"gpt-4-turbo":{modelName:"gpt-4-turbo",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:10,outputPricePerMillion:30}}}]},"gpt-4":{modelName:"gpt-4",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:30,outputPricePerMillion:60}}}]},"gpt-4o-2024-05-13":{modelName:"gpt-4o-2024-05-13",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:5,outputPricePerMillion:20}}}]},"gpt-4o-2024-08-06":{modelName:"gpt-4o-2024-08-06",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:2.5,outputPricePerMillion:10}}}]},"gpt-4o-mini-2024-07-18":{modelName:"gpt-4o-mini-2024-07-18",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.6,outputPricePerMillion:2.4}}}]},"gpt-4o-mini":{modelName:"gpt-4o-mini",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.6,outputPricePerMillion:2.4}}}]},"gpt-4o":{modelName:"gpt-4o",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:5,outputPricePerMillion:20}}}]},"o1-2024-12-17":{modelName:"o1-2024-12-17",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:15,outputPricePerMillion:60}}}]},o1:{modelName:"o1",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:15,outputPricePerMillion:60}}}]},"o3-mini-2025-01-31":{modelName:"o3-mini-2025-01-31",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1.1,outputPricePerMillion:4.4}}}]},"o3-mini":{modelName:"o3-mini",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1.1,outputPricePerMillion:4.4}}}]},"o3-2025-04-16":{modelName:"o3-2025-04-16",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:10,outputPricePerMillion:40}}}]},o3:{modelName:"o3",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:10,outputPricePerMillion:40}}}]},"o4-mini-2025-04-16":{modelName:"o4-mini-2025-04-16",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1.1,outputPricePerMillion:4.4}}}]},"o4-mini":{modelName:"o4-mini",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1.1,outputPricePerMillion:4.4}}}]},"gpt-4.1":{modelName:"gpt-4.1",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:2,outputPricePerMillion:8}}}]},"gpt-4.1-mini":{modelName:"gpt-4.1-mini",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.4,outputPricePerMillion:1.6}}}]},"gpt-4.1-nano":{modelName:"gpt-4.1-nano",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.1,outputPricePerMillion:.4}}}]},"gpt-5":{modelName:"gpt-5",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1.25,outputPricePerMillion:10}}}]},"gpt-5-mini":{modelName:"gpt-5-mini",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.25,outputPricePerMillion:2}}}]},"gpt-5-nano":{modelName:"gpt-5-nano",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.05,outputPricePerMillion:.4}}}]},"gpt-5-chat-latest":{modelName:"gpt-5-chat-latest",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1.25,outputPricePerMillion:10}}}]}};var ps="openai",$=class{constructor(){this.version="v1";this.name=ps;this.chatModelFactories={[pe]:{model:le,modelOptions:Ht,modelSchema:Eo},[se]:{model:ie,modelOptions:Ft,modelSchema:Ro},[ae]:{model:re,modelOptions:$t,modelSchema:Ao},[me]:{model:de,modelOptions:Vt,modelSchema:Go},[ce]:{model:he,modelOptions:Kt,modelSchema:ko},[ue]:{model:fe,modelOptions:Jt,modelSchema:wo},[_e]:{model:ge,modelOptions:Wt,modelSchema:vo},[Te]:{model:Me,modelOptions:Yt,modelSchema:Do},[ye]:{model:Oe,modelOptions:Qt,modelSchema:Lo},[Ce]:{model:be,modelOptions:Xt,modelSchema:qo},[Pe]:{model:Se,modelOptions:Zt,modelSchema:No},[Ie]:{model:xe,modelOptions:en,modelSchema:zo},[Re]:{model:Ae,modelOptions:on,modelSchema:Bo},[Ee]:{model:Ge,modelOptions:tn,modelSchema:Uo},[ke]:{model:we,modelOptions:nn,modelSchema:jo},[ve]:{model:De,modelOptions:sn,modelSchema:Fo},[Le]:{model:qe,modelOptions:an,modelSchema:$o},[Be]:{model:Ue,modelOptions:pn,modelSchema:Vo},[$e]:{model:He,modelOptions:mn,modelSchema:Jo},[Ve]:{model:Ke,modelOptions:dn,modelSchema:Wo},[je]:{model:Fe,modelOptions:ln,modelSchema:Ko},[Ne]:{model:ze,modelOptions:rn,modelSchema:Ho},[Ye]:{model:Qe,modelOptions:hn,modelSchema:Qo},[Je]:{model:We,modelOptions:cn,modelSchema:Yo},[st]:{model:oo,modelOptions:gn,modelSchema:it},[tt]:{model:eo,modelOptions:_n,modelSchema:nt},[Xo]:{model:Xe,modelOptions:un,modelSchema:Zo},[et]:{model:Ze,modelOptions:fn,modelSchema:ot},[at]:{model:to,modelOptions:Tn,modelSchema:rt},[pt]:{model:no,modelOptions:Mn,modelSchema:lt}};this.embeddingModelFactories={[mt]:{model:so,modelOptions:yn,modelSchema:dt},[ct]:{model:io,modelOptions:On,modelSchema:ht},[ut]:{model:ao,modelOptions:Cn,modelSchema:ft}};}chatModelLiterals(){return Object.keys(this.chatModelFactories)}chatModelSchemas(){return Object.keys(this.chatModelFactories).reduce((e,n)=>(e[n]=this.chatModelFactories[n].modelSchema,e),{})}chatModel(e){let n=e.modelName;if(!(n in this.chatModelFactories))throw new provider.ProviderError({info:`OpenAI chat model: ${n} not found`,cause:new Error(`OpenAI chat model: ${n} not found, available chat models:
7
+ var Kn=Object.defineProperty,Jn=Object.defineProperties;var Wn=Object.getOwnPropertyDescriptors;var It=Object.getOwnPropertySymbols;var Yn=Object.prototype.hasOwnProperty,Qn=Object.prototype.propertyIsEnumerable;var ee=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Xn=t=>{throw TypeError(t)};var xt=(t,e,n)=>e in t?Kn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,b=(t,e)=>{for(var n in e||(e={}))Yn.call(e,n)&&xt(t,n,e[n]);if(It)for(var n of It(e))Qn.call(e,n)&&xt(t,n,e[n]);return t},v=(t,e)=>Jn(t,Wn(e));var A=(t,e,n)=>new Promise((o,s)=>{var a=l=>{try{r(n.next(l));}catch(T){s(T);}},c=l=>{try{r(n.throw(l));}catch(T){s(T);}},r=l=>l.done?o(l.value):Promise.resolve(l.value).then(a,c);r((n=n.apply(t,e)).next());}),Rt=function(t,e){this[0]=t,this[1]=e;},uo=(t,e,n)=>{var o=(c,r,l,T)=>{try{var g=n[c](r),P=(r=g.value)instanceof Rt,O=g.done;Promise.resolve(P?r[0]:r).then(C=>P?o(c==="return"?c:"next",r[1]?{done:C.done,value:C.value}:C,l,T):l({value:C,done:O})).catch(C=>o("throw",C,l,T));}catch(C){T(C);}},s=c=>a[c]=r=>new Promise((l,T)=>o(c,r,l,T)),a={};return n=n.apply(t,e),a[ee("asyncIterator")]=()=>a,s("next"),s("throw"),s("return"),a},At=t=>{var e=t[ee("asyncIterator")],n=!1,o,s={};return e==null?(e=t[ee("iterator")](),o=a=>s[a]=c=>e[a](c)):(e=e.call(t),o=a=>s[a]=c=>{if(n){if(n=!1,a==="throw")throw c;return c}return n=!0,{done:!1,value:new Rt(new Promise(r=>{var l=e[a](c);l instanceof Object||Xn("Object expected"),r(l);}),1)}}),s[ee("iterator")]=()=>s,o("next"),"throw"in e?o("throw"):s.throw=a=>{throw a},"return"in e&&o("return"),s};var _o=provider.RangeConfigItem({param:"temperature",title:provider.CHAT_CONFIG.TEMPERATURE.title,description:provider.CHAT_CONFIG.TEMPERATURE.description,min:0,max:2,step:.01,default:1}),go=t=>provider.RangeConfigItem({param:"max_completion_tokens",title:provider.CHAT_CONFIG.MAX_TOKENS.title,description:provider.CHAT_CONFIG.MAX_TOKENS.description,min:0,max:t,step:1,default:0}),To=t=>provider.MultiStringConfigItem({param:"stop",title:provider.CHAT_CONFIG.STOP(t).title,description:provider.CHAT_CONFIG.STOP(t).description,max:t}),Mo=provider.RangeConfigItem({param:"top_p",title:provider.CHAT_CONFIG.TOP_P.title,description:provider.CHAT_CONFIG.TOP_P.description,min:0,max:1,step:.01,default:1}),yo=provider.RangeConfigItem({param:"frequency_penalty",title:provider.CHAT_CONFIG.FREQUENCY_PENALTY.title,description:provider.CHAT_CONFIG.FREQUENCY_PENALTY.description,min:-2,max:2,step:.01,default:0}),Oo=provider.RangeConfigItem({param:"presence_penalty",title:provider.CHAT_CONFIG.PRESENCE_PENALTY.title,description:provider.CHAT_CONFIG.PRESENCE_PENALTY.description,min:-2,max:2,step:.01,default:0}),Co=provider.RangeConfigItem({param:"seed",title:provider.CHAT_CONFIG.SEED.title,description:provider.CHAT_CONFIG.SEED.description,min:0,max:1e6,step:1,default:0}),bo=provider.SelectBooleanConfigItem({param:"logprobs",title:provider.CHAT_CONFIG.LOG_PROBS.title,description:provider.CHAT_CONFIG.LOG_PROBS.description,default:!1}),Po=provider.RangeConfigItem({param:"top_logprobs",title:provider.CHAT_CONFIG.TOP_LOG_PROBS.title,description:provider.CHAT_CONFIG.TOP_LOG_PROBS.description,min:0,max:20,step:1,default:0}),So=provider.SelectStringConfigItem({param:"tool_choice",title:"Tool choice",description:"Controls which (if any) tool is called by the model. 'none' means the model will not call a function. 'auto' means the model can pick between generating a message or calling a tool.",default:"auto",choices:["auto","required","none"]}),Io=provider.SelectStringConfigItem({param:"reasoning_effort",title:"Reasoning Effort",description:"Controls the depth of the model's reasoning before delivering an answer. 'minimal' prioritizes speed, 'high' engages in deep reasoning.",default:"medium",choices:["minimal","low","medium","high"]}),xo=provider.SelectStringConfigItem({param:"verbosity",title:"Verbosity",description:"Controls the length and detail of the model's responses, independent of reasoning depth. 'low' generates concise answers, 'high' provides comprehensive responses.",default:"medium",choices:["low","medium","high"]});var N=(t,e)=>zod.z.object({temperature:_o.schema,maxTokens:go(t).schema,stop:To(e).schema,topP:Mo.schema,frequencyPenalty:yo.schema,presencePenalty:Oo.schema,seed:Co.schema.transform(n=>n===0?void 0:n),logProbs:bo.schema,topLogProbs:Po.schema,toolChoice:So.schema}),z=(t,e)=>({temperature:_o.def,maxTokens:go(t).def,stop:To(e).def,topP:Mo.def,frequencyPenalty:yo.def,presencePenalty:Oo.def,seed:Co.def,logProbs:bo.def,topLogProbs:Po.def,toolChoice:So.def});var Gt=provider.ObjectSchemaConfigItem({param:"response_schema",title:provider.CHAT_CONFIG.RESPONSE_SCHEMA.title,description:provider.CHAT_CONFIG.RESPONSE_SCHEMA.description,objectSchema:types.ResponseSchema}),Et=provider.SelectStringConfigItem({param:"response_format",title:provider.CHAT_CONFIG.RESPONSE_FORMAT_WITH_SCHEMA.title,description:provider.CHAT_CONFIG.RESPONSE_FORMAT_WITH_SCHEMA.description,default:"text",choices:["text","json_object","json_schema"]}),j=(t,e)=>v(b({},z(t,e)),{responseFormat:Et.def,responseSchema:Gt.def}),F=(t,e)=>N(t,e).extend({responseFormat:Et.schema,responseSchema:Gt.schema});var kt=(t,e)=>v(b({},z(t,e)),{reasoningEffort:Io.def,verbosity:xo.def,responseFormat:j(t,e).responseFormat,responseSchema:j(t,e).responseSchema}),wt=(t,e)=>N(t,e).extend({reasoningEffort:Io.schema,verbosity:xo.schema,responseFormat:F(t,e).shape.responseFormat,responseSchema:F(t,e).shape.responseSchema});var Dt=provider.RangeConfigItem({param:"temperature",title:provider.CHAT_CONFIG.TEMPERATURE.title,description:provider.CHAT_CONFIG.TEMPERATURE.description,min:1,max:1,step:.01,default:1}),Lt=provider.SelectStringConfigItem({param:"reasoning_effort",title:"Reasoning Effort",description:"Constrains effort on reasoning for reasoning models. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.",default:"medium",choices:["low","medium","high"]}),qt=(t,e)=>v(b({},j(t,e)),{temperature:Dt.def,reasoningEffort:Lt.def}),Nt=(t,e)=>F(t,e).extend({temperature:Dt.schema,reasoningEffort:Lt.schema});var Bt=provider.SelectStringConfigItem({param:"response_format",title:provider.CHAT_CONFIG.RESPONSE_FORMAT.title,description:provider.CHAT_CONFIG.RESPONSE_FORMAT.description,default:"text",choices:["text","json_object"]}),Ut=(t,e)=>v(b({},z(t,e)),{responseFormat:Bt.def}),jt=(t,e)=>N(t,e).extend({responseFormat:Bt.schema});var Ro=provider.SelectStringConfigItem({param:"encoding_format",title:"Encoding format",description:"Select the encoding format for the word embedding.",default:"float",choices:["float","base64"]}),Ao=t=>provider.RangeConfigItem({param:"dimensions",title:"Dimensions",description:"Select the number of dimensions for the word embedding.",min:1,max:t,step:1,default:t});var te=()=>zod.z.object({encodingFormat:Ro.schema}),ne=()=>({encodingFormat:Ro.def});var Ft=t=>te().extend({dimensions:Ao(t).schema}),$t=t=>v(b({},ne()),{dimensions:Ao(t).def});var i={base:(t,e)=>({def:z(t,e),schema:N(t,e)}),responseFormat:(t,e)=>({def:Ut(t,e),schema:jt(t,e)}),responseSchema:(t,e)=>({def:j(t,e),schema:F(t,e)}),oSeries:(t,e)=>({def:qt(t,e),schema:Nt(t,e)}),gpt5:(t,e)=>({def:kt(t,e),schema:wt(t,e)})},D={base:()=>({def:ne(),schema:te()}),dimensions:t=>({def:$t(t),schema:Ft(t)})};var _={"gpt-3.5-turbo-0125":{modelName:"gpt-3.5-turbo-0125",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:1.5}}}]},"gpt-3.5-turbo-1106":{modelName:"gpt-3.5-turbo-1106",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:1.5}}}]},"gpt-3.5-turbo":{modelName:"gpt-3.5-turbo",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:1.5}}}]},"gpt-4-0125-preview":{modelName:"gpt-4-0125-preview",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:30,outputPricePerMillion:60}}}]},"gpt-4-0613":{modelName:"gpt-4-0613",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:30,outputPricePerMillion:60}}}]},"gpt-4-1106-preview":{modelName:"gpt-4-1106-preview",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:30,outputPricePerMillion:60}}}]},"gpt-4-turbo-2024-04-09":{modelName:"gpt-4-turbo-2024-04-09",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:10,outputPricePerMillion:30}}}]},"gpt-4-turbo-preview":{modelName:"gpt-4-turbo-preview",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:10,outputPricePerMillion:30}}}]},"gpt-4-turbo":{modelName:"gpt-4-turbo",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:10,outputPricePerMillion:30}}}]},"gpt-4":{modelName:"gpt-4",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:30,outputPricePerMillion:60}}}]},"gpt-4o-2024-05-13":{modelName:"gpt-4o-2024-05-13",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:5,outputPricePerMillion:20}}}]},"gpt-4o-2024-08-06":{modelName:"gpt-4o-2024-08-06",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:2.5,outputPricePerMillion:10}}}]},"gpt-4o-mini-2024-07-18":{modelName:"gpt-4o-mini-2024-07-18",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.6,outputPricePerMillion:2.4}}}]},"gpt-4o-mini":{modelName:"gpt-4o-mini",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.6,outputPricePerMillion:2.4}}}]},"gpt-4o":{modelName:"gpt-4o",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:5,outputPricePerMillion:20}}}]},"o1-2024-12-17":{modelName:"o1-2024-12-17",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:15,outputPricePerMillion:60}}}]},o1:{modelName:"o1",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:15,outputPricePerMillion:60}}}]},"o3-mini-2025-01-31":{modelName:"o3-mini-2025-01-31",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1.1,outputPricePerMillion:4.4}}}]},"o3-mini":{modelName:"o3-mini",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1.1,outputPricePerMillion:4.4}}}]},"o3-2025-04-16":{modelName:"o3-2025-04-16",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:10,outputPricePerMillion:40}}}]},o3:{modelName:"o3",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:10,outputPricePerMillion:40}}}]},"o4-mini-2025-04-16":{modelName:"o4-mini-2025-04-16",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1.1,outputPricePerMillion:4.4}}}]},"o4-mini":{modelName:"o4-mini",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1.1,outputPricePerMillion:4.4}}}]},"gpt-4.1":{modelName:"gpt-4.1",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:2,outputPricePerMillion:8}}}]},"gpt-4.1-mini":{modelName:"gpt-4.1-mini",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.4,outputPricePerMillion:1.6}}}]},"gpt-4.1-nano":{modelName:"gpt-4.1-nano",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.1,outputPricePerMillion:.4}}}]},"gpt-5":{modelName:"gpt-5",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1.25,outputPricePerMillion:10}}}]},"gpt-5-mini":{modelName:"gpt-5-mini",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.25,outputPricePerMillion:2}}}]},"gpt-5-nano":{modelName:"gpt-5-nano",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.05,outputPricePerMillion:.4}}}]},"gpt-5-chat-latest":{modelName:"gpt-5-chat-latest",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1.25,outputPricePerMillion:10}}}]},"gpt-5.1":{modelName:"gpt-5.1",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1.5,outputPricePerMillion:12}}}]}};var cs="openai",$=class{constructor(){this.version="v1";this.name=cs;this.chatModelFactories={[pe]:{model:le,modelOptions:Jt,modelSchema:ko},[se]:{model:ie,modelOptions:Vt,modelSchema:Go},[ae]:{model:re,modelOptions:Kt,modelSchema:Eo},[me]:{model:de,modelOptions:Wt,modelSchema:wo},[ce]:{model:he,modelOptions:Yt,modelSchema:vo},[ue]:{model:fe,modelOptions:Qt,modelSchema:Do},[_e]:{model:ge,modelOptions:Xt,modelSchema:Lo},[Te]:{model:Me,modelOptions:Zt,modelSchema:qo},[ye]:{model:Oe,modelOptions:en,modelSchema:No},[Pe]:{model:Se,modelOptions:tn,modelSchema:Bo},[Ce]:{model:be,modelOptions:on,modelSchema:zo},[Ie]:{model:xe,modelOptions:nn,modelSchema:Uo},[Re]:{model:Ae,modelOptions:sn,modelSchema:jo},[Ge]:{model:Ee,modelOptions:an,modelSchema:Fo},[ke]:{model:we,modelOptions:rn,modelSchema:$o},[ve]:{model:De,modelOptions:pn,modelSchema:Ho},[Le]:{model:qe,modelOptions:ln,modelSchema:Vo},[Ne]:{model:ze,modelOptions:mn,modelSchema:Ko},[je]:{model:Fe,modelOptions:cn,modelSchema:Wo},[Ve]:{model:Ke,modelOptions:un,modelSchema:Qo},[Je]:{model:We,modelOptions:fn,modelSchema:Xo},[$e]:{model:He,modelOptions:hn,modelSchema:Yo},[Be]:{model:Ue,modelOptions:dn,modelSchema:Jo},[Xe]:{model:Ze,modelOptions:gn,modelSchema:et},[Ye]:{model:Qe,modelOptions:_n,modelSchema:Zo},[rt]:{model:no,modelOptions:On,modelSchema:pt},[it]:{model:to,modelOptions:yn,modelSchema:at},[ot]:{model:eo,modelOptions:Tn,modelSchema:tt},[nt]:{model:oo,modelOptions:Mn,modelSchema:st},[lt]:{model:so,modelOptions:Cn,modelSchema:mt},[dt]:{model:io,modelOptions:bn,modelSchema:ct}};this.embeddingModelFactories={[ht]:{model:ao,modelOptions:Pn,modelSchema:ut},[ft]:{model:ro,modelOptions:Sn,modelSchema:_t},[gt]:{model:po,modelOptions:In,modelSchema:Tt}};}chatModelLiterals(){return Object.keys(this.chatModelFactories)}chatModelSchemas(){return Object.keys(this.chatModelFactories).reduce((e,n)=>(e[n]=this.chatModelFactories[n].modelSchema,e),{})}chatModel(e){let n=e.modelName;if(!(n in this.chatModelFactories))throw new provider.ProviderError({info:`OpenAI chat model: ${n} not found`,cause:new Error(`OpenAI chat model: ${n} not found, available chat models:
8
8
  [${this.chatModelLiterals().join(", ")}]`)});let o=this.chatModelFactories[n].model,s=this.chatModelFactories[n].modelOptions.parse(e);return new o(s)}embeddingModelLiterals(){return Object.keys(this.embeddingModelFactories)}embeddingModelSchemas(){return Object.keys(this.embeddingModelFactories).reduce((e,n)=>(e[n]=this.embeddingModelFactories[n].modelSchema,e),{})}embeddingModel(e){let n=e.modelName;if(!(n in this.embeddingModelFactories))throw new provider.ProviderError({info:`OpenAI embedding model: ${n} not found`,cause:new Error(`OpenAI embedding model: ${n} not found, available embedding models:
9
- [${this.embeddingModelLiterals().join(", ")}]`)});let o=this.embeddingModelFactories[n].model,s=this.embeddingModelFactories[n].modelOptions.parse(e);return new o(s)}};$.baseUrl="https://api.openai.com/v1";var u=zod.z.enum([types.SystemRoleLiteral,types.UserRoleLiteral,types.AssistantRoleLiteral,types.ToolRoleLiteral]),f={system:types.SystemRoleLiteral,user:types.UserRoleLiteral,assistant:types.AssistantRoleLiteral,tool:types.ToolRoleLiteral};var M=[types.TextModalityLiteral,types.ImageModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral],y=zod.z.enum([types.TextModalityLiteral,types.ImageModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral]),nr=[types.TextModalityLiteral],sr=zod.z.enum([types.TextModalityLiteral]),I=[types.TextModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral],x=zod.z.enum([types.TextModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral]);var lo=zod.z.object({token:zod.z.string(),logprob:zod.z.number(),bytes:zod.z.array(zod.z.number()).nullable()}),Rn=zod.z.object({content:zod.z.array(lo.extend({top_logprobs:zod.z.array(lo)})).nullable().optional(),refusal:zod.z.array(lo.extend({top_logprobs:zod.z.array(lo)})).nullable().optional()}).nullable(),ms=zod.z.array(zod.z.object({id:zod.z.string().min(1),type:zod.z.enum(["function"]),function:zod.z.object({name:zod.z.string(),arguments:zod.z.string()})})),An=zod.z.object({id:zod.z.string(),object:zod.z.literal("chat.completion"),created:zod.z.number(),model:zod.z.string(),system_fingerprint:zod.z.string().nullable(),choices:zod.z.array(zod.z.object({index:zod.z.number(),message:zod.z.object({role:zod.z.string(),content:zod.z.string().nullable().optional(),tool_calls:ms.optional(),refusal:zod.z.string().nullable().optional()}),logprobs:Rn.optional(),finish_reason:zod.z.string()})),usage:zod.z.object({prompt_tokens:zod.z.number(),completion_tokens:zod.z.number(),total_tokens:zod.z.number()})}),ds=zod.z.array(zod.z.object({index:zod.z.number().int(),id:zod.z.string().min(1).optional(),type:zod.z.enum(["function"]).optional(),function:zod.z.object({name:zod.z.string().min(1).optional(),arguments:zod.z.string().optional()}).optional()})),En=zod.z.object({id:zod.z.string(),object:zod.z.string(),created:zod.z.number(),model:zod.z.string(),system_fingerprint:zod.z.string().nullable().optional(),choices:zod.z.array(zod.z.object({index:zod.z.number(),delta:zod.z.object({content:zod.z.string().nullable().optional(),tool_calls:ds.optional(),refusal:zod.z.string().nullable().optional()}).or(zod.z.object({})),logprobs:Rn.optional(),finish_reason:zod.z.string().nullable()})),usage:zod.z.object({prompt_tokens:zod.z.number(),completion_tokens:zod.z.number(),total_tokens:zod.z.number()}).nullable().optional()});var cs=zod.z.object({type:zod.z.literal("function"),function:zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1).optional(),strict:zod.z.boolean().optional(),parameters:zod.z.any()})}),hs=zod.z.enum(["none","auto","required"]),us=zod.z.object({type:zod.z.literal("function"),function:zod.z.object({name:zod.z.string().min(1)})}),fs=zod.z.object({type:zod.z.enum(["text","json_object"])}).or(zod.z.object({type:zod.z.literal("json_schema"),json_schema:zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1).optional(),strict:zod.z.boolean().optional(),schema:zod.z.any()})})),gt=zod.z.object({text:zod.z.string().min(1),type:zod.z.literal("text")}),_s=zod.z.object({type:zod.z.literal("image_url"),image_url:zod.z.object({url:zod.z.string().url().min(1),detail:zod.z.enum(["low","high","auto"]).optional()})}),gs=zod.z.object({id:zod.z.string().min(1),type:zod.z.literal("function"),function:zod.z.object({name:zod.z.string().min(1),arguments:zod.z.string().min(1)})}),Ts=zod.z.object({role:zod.z.literal("system"),content:zod.z.string().min(1).or(zod.z.array(gt).min(1))}),Ms=zod.z.object({role:zod.z.literal("user"),content:zod.z.string().min(1).or(zod.z.array(zod.z.union([gt,_s])).min(1))}),ys=zod.z.object({role:zod.z.literal("assistant"),content:zod.z.string().min(1).or(zod.z.array(gt).min(1)).optional(),tool_calls:zod.z.array(gs).min(1).optional()}),Os=zod.z.object({role:zod.z.literal("tool"),tool_call_id:zod.z.string().min(1),content:zod.z.string().min(1)}),Cs=zod.z.union([Ts,Ms,ys,Os]),Gn=zod.z.object({model:zod.z.string().min(1).optional(),messages:zod.z.array(Cs).min(1),frequency_penalty:zod.z.number().min(-2).max(2).nullable().optional(),logprobs:zod.z.boolean().nullable().optional(),top_logprobs:zod.z.number().min(0).max(20).nullable().optional(),max_completion_tokens:zod.z.number().min(0).nullable().optional(),presence_penalty:zod.z.number().min(-2).max(2).nullable().optional(),response_format:fs.optional(),seed:zod.z.number().nullable().optional(),stop:zod.z.string().or(zod.z.array(zod.z.string()).max(4)).nullable().optional(),temperature:zod.z.number().min(0).max(2).nullable().optional(),top_p:zod.z.number().min(0).max(1).nullable().optional(),tools:zod.z.array(cs).optional(),tool_choice:hs.or(us).optional(),reasoning_effort:zod.z.enum(["minimal","low","medium","high"]).optional(),verbosity:zod.z.enum(["low","medium","high"]).optional()});var h=zod.z.object({modelName:zod.z.string(),apiKey:zod.z.string(),baseUrl:zod.z.string().url().optional(),completeChatUrl:zod.z.string().url().optional(),streamChatUrl:zod.z.string().url().optional(),organization:zod.z.string().optional()}),d=class{constructor(e,n){this.version="v1";let o=h.parse(n);this.modelSchema=e,this.modelName=o.modelName,this.apiKey=o.apiKey,this.baseUrl=provider.urlWithoutTrailingSlash(o.baseUrl||$.baseUrl),this.streamChatUrl=provider.urlWithoutTrailingSlash(o.streamChatUrl||`${this.baseUrl}/chat/completions`),this.completeChatUrl=provider.urlWithoutTrailingSlash(o.completeChatUrl||`${this.baseUrl}/chat/completions`),this.organization=o.organization;}getDefaultBaseUrl(){return this.baseUrl}getDefaultHeaders(){return b({Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},this.organization?{"OpenAI-Organization":this.organization}:{})}getDefaultParams(){return {model:this.modelName}}getRetryDelay(e){let n=r=>{let l=/(\d+)(h|m|s|ms)/g,T={h:36e5,m:6e4,s:1e3,ms:1},g,P=0;for(;(g=l.exec(r))!==null;){let O=parseInt(g[1]),C=g[2];P+=O*T[C];}return P},o=0,s=0,a=!0;e["x-ratelimit-reset-requests"]&&(o=n(e["x-ratelimit-reset-requests"])),e["x-ratelimit-reset-tokens"]&&(s=n(e["x-ratelimit-reset-tokens"]));let m=Math.max(o,s);return {shouldRetry:a,delayMs:m}}getTokenCount(e){return e.reduce((n,o)=>n+o.content.map(s=>s.modality==="text"?s.value:"").join(" ").length,0)}transformModelRequest(e){let n=Gn.safeParse(e);if(!n.success)throw new provider.InvalidModelRequestError({info:"Invalid model request",cause:n.error});let o=n.data,s=o.model;if(o.tool_choice&&(!o.tools||o.tools.length===0))throw new provider.InvalidModelRequestError({info:`Invalid model request for model : '${this.modelName}'`,cause:new Error("'tools' are required when 'tool_choice' is specified")});let a={};o.response_format&&(a.responseFormat=o.response_format.type,o.response_format.type==="json_schema"&&(a.responseSchema={name:o.response_format.json_schema.name,description:o.response_format.json_schema.description||"",strict:o.response_format.json_schema.strict,schema:o.response_format.json_schema.schema})),o.tool_choice&&(typeof o.tool_choice=="string"?a.toolChoice=o.tool_choice:a.toolChoice=o.tool_choice.function.name),a.seed=o.seed,a.maxTokens=o.max_completion_tokens,a.temperature=o.temperature,a.topP=o.top_p,a.presencePenalty=o.presence_penalty,a.frequencyPenalty=o.frequency_penalty,a.stop=o.stop,a.logProbs=o.logprobs,a.topLogProbs=o.top_logprobs,a.reasoningEffort=o.reasoning_effort,a.verbosity=o.verbosity;let m=types.Config().parse(provider.removeUndefinedEntries(a)),r=[],l={};o.messages.forEach(g=>{let P=g.role;switch(P){case"system":{let O=g.content;if(typeof O=="string")r.push({role:P,content:[{modality:types.TextModalityLiteral,value:O}]});else {let C=O.map(S=>({modality:types.TextModalityLiteral,value:S.text}));r.push({role:P,content:C});}}break;case"user":{let O=g.content;if(typeof O=="string")r.push({role:P,content:[{modality:types.TextModalityLiteral,value:O}]});else {let C=O.map(S=>S.type==="text"?{modality:types.TextModalityLiteral,value:S.text}:S.image_url.url.startsWith("data:")?{modality:types.ImageModalityLiteral,detail:S.image_url.detail||"auto",value:{type:types.Base64ImageContentTypeLiteral,base64:S.image_url.url,mediaType:provider.getMimeTypeFromBase64(S.image_url.url)}}:{modality:types.ImageModalityLiteral,detail:S.image_url.detail||"auto",value:{type:types.UrlImageContentTypeLiteral,url:S.image_url.url}});r.push({role:P,content:C});}}break;case"assistant":{let O=[];if(!g.content&&!g.tool_calls)throw new provider.InvalidModelRequestError({info:`Invalid model request for model : '${this.modelName}'`,cause:new Error("one of'content' or 'tool_calls' must be provided")});if(g.content){let C=g.content;typeof C=="string"?O.push({modality:types.TextModalityLiteral,value:C}):C.forEach(S=>{O.push({modality:types.TextModalityLiteral,value:S.text});});}g.tool_calls&&g.tool_calls.forEach((S,E)=>{let q={modality:types.ToolCallModalityLiteral,id:S.id,index:E,name:S.function.name,arguments:S.function.arguments};O.push(q),l[q.id]=q;}),r.push({role:P,content:O});}break;case"tool":{let O=g;r.push({role:P,content:[{modality:types.ToolResponseModalityLiteral,id:O.tool_call_id,index:l[O.tool_call_id].index,name:l[O.tool_call_id].name,data:O.content}]});}break}});let T=[];return o.tools&&o.tools.forEach(g=>{T.push({type:"function",definition:{schema:{name:g.function.name,description:g.function.description||"",strict:g.function.strict,parameters:g.function.parameters}}});}),{modelName:s,config:m,messages:r,tools:T.length>0?T:void 0}}transformConfig(e,n,o){let s=e.toolChoice;delete e.toolChoice;let a=this.modelSchema.config.schema.safeParse(e);if(!a.success)throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:a.error});let m=a.data;s!==void 0&&(m.toolChoice=s),Object.keys(m).forEach(l=>{if(!(l in this.modelSchema.config.def))throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`Invalid config key : '${l}',
10
- available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})});let r=Object.keys(m).reduce((l,T)=>{let g=this.modelSchema.config.def[T],P=g.param,O=m[T];return P==="max_completion_tokens"&&g.type==="range"&&O===0?l[P]=g.max:l[P]=O,l},{});if(r.top_logprobs&&!r.logprobs)throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error("'logprobs' must be 'true' when 'top_logprobs' is specified")});if("tool_choice"in r&&r.tool_choice!==void 0){let l=r.tool_choice;if(!o||o&&o.length===0)throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error("'tools' are required when 'toolChoice' is specified")});if(o&&o.length>0){let T=this.modelSchema.config.def.toolChoice;if(!T.choices.includes(l))if(o.map(g=>g.definition.schema.name).includes(l))r.tool_choice={type:"function",function:{name:l}};else throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`toolChoice : '${l}' is not part of provided 'tools' names or
9
+ [${this.embeddingModelLiterals().join(", ")}]`)});let o=this.embeddingModelFactories[n].model,s=this.embeddingModelFactories[n].modelOptions.parse(e);return new o(s)}};$.baseUrl="https://api.openai.com/v1";var h=zod.z.enum([types.SystemRoleLiteral,types.UserRoleLiteral,types.AssistantRoleLiteral,types.ToolRoleLiteral]),u={system:types.SystemRoleLiteral,user:types.UserRoleLiteral,assistant:types.AssistantRoleLiteral,tool:types.ToolRoleLiteral};var M=[types.TextModalityLiteral,types.ImageModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral],y=zod.z.enum([types.TextModalityLiteral,types.ImageModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral]),lr=[types.TextModalityLiteral],mr=zod.z.enum([types.TextModalityLiteral]),I=[types.TextModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral],x=zod.z.enum([types.TextModalityLiteral,types.ToolCallModalityLiteral,types.ToolResponseModalityLiteral]);var co=zod.z.object({token:zod.z.string(),logprob:zod.z.number(),bytes:zod.z.array(zod.z.number()).nullable()}),kn=zod.z.object({content:zod.z.array(co.extend({top_logprobs:zod.z.array(co)})).nullable().optional(),refusal:zod.z.array(co.extend({top_logprobs:zod.z.array(co)})).nullable().optional()}).nullable(),us=zod.z.array(zod.z.object({id:zod.z.string().min(1),type:zod.z.enum(["function"]),function:zod.z.object({name:zod.z.string(),arguments:zod.z.string()})})),wn=zod.z.object({id:zod.z.string(),object:zod.z.literal("chat.completion"),created:zod.z.number(),model:zod.z.string(),system_fingerprint:zod.z.string().nullable(),choices:zod.z.array(zod.z.object({index:zod.z.number(),message:zod.z.object({role:zod.z.string(),content:zod.z.string().nullable().optional(),tool_calls:us.optional(),refusal:zod.z.string().nullable().optional()}),logprobs:kn.optional(),finish_reason:zod.z.string()})),usage:zod.z.object({prompt_tokens:zod.z.number(),completion_tokens:zod.z.number(),total_tokens:zod.z.number()})}),fs=zod.z.array(zod.z.object({index:zod.z.number().int(),id:zod.z.string().min(1).optional(),type:zod.z.enum(["function"]).optional(),function:zod.z.object({name:zod.z.string().min(1).optional(),arguments:zod.z.string().optional()}).optional()})),vn=zod.z.object({id:zod.z.string(),object:zod.z.string(),created:zod.z.number(),model:zod.z.string(),system_fingerprint:zod.z.string().nullable().optional(),choices:zod.z.array(zod.z.object({index:zod.z.number(),delta:zod.z.object({content:zod.z.string().nullable().optional(),tool_calls:fs.optional(),refusal:zod.z.string().nullable().optional()}).or(zod.z.object({})),logprobs:kn.optional(),finish_reason:zod.z.string().nullable()})),usage:zod.z.object({prompt_tokens:zod.z.number(),completion_tokens:zod.z.number(),total_tokens:zod.z.number()}).nullable().optional()});var _s=zod.z.object({type:zod.z.literal("function"),function:zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1).optional(),strict:zod.z.boolean().optional(),parameters:zod.z.any()})}),gs=zod.z.enum(["none","auto","required"]),Ts=zod.z.object({type:zod.z.literal("function"),function:zod.z.object({name:zod.z.string().min(1)})}),Ms=zod.z.object({type:zod.z.enum(["text","json_object"])}).or(zod.z.object({type:zod.z.literal("json_schema"),json_schema:zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1).optional(),strict:zod.z.boolean().optional(),schema:zod.z.any()})})),yt=zod.z.object({text:zod.z.string().min(1),type:zod.z.literal("text")}),ys=zod.z.object({type:zod.z.literal("image_url"),image_url:zod.z.object({url:zod.z.string().url().min(1),detail:zod.z.enum(["low","high","auto"]).optional()})}),Os=zod.z.object({id:zod.z.string().min(1),type:zod.z.literal("function"),function:zod.z.object({name:zod.z.string().min(1),arguments:zod.z.string().min(1)})}),Cs=zod.z.object({role:zod.z.literal("system"),content:zod.z.string().min(1).or(zod.z.array(yt).min(1))}),bs=zod.z.object({role:zod.z.literal("user"),content:zod.z.string().min(1).or(zod.z.array(zod.z.union([yt,ys])).min(1))}),Ps=zod.z.object({role:zod.z.literal("assistant"),content:zod.z.string().min(1).or(zod.z.array(yt).min(1)).optional(),tool_calls:zod.z.array(Os).min(1).optional()}),Ss=zod.z.object({role:zod.z.literal("tool"),tool_call_id:zod.z.string().min(1),content:zod.z.string().min(1)}),Is=zod.z.union([Cs,bs,Ps,Ss]),Dn=zod.z.object({model:zod.z.string().min(1).optional(),messages:zod.z.array(Is).min(1),frequency_penalty:zod.z.number().min(-2).max(2).nullable().optional(),logprobs:zod.z.boolean().nullable().optional(),top_logprobs:zod.z.number().min(0).max(20).nullable().optional(),max_completion_tokens:zod.z.number().min(0).nullable().optional(),presence_penalty:zod.z.number().min(-2).max(2).nullable().optional(),response_format:Ms.optional(),seed:zod.z.number().nullable().optional(),stop:zod.z.string().or(zod.z.array(zod.z.string()).max(4)).nullable().optional(),temperature:zod.z.number().min(0).max(2).nullable().optional(),top_p:zod.z.number().min(0).max(1).nullable().optional(),tools:zod.z.array(_s).optional(),tool_choice:gs.or(Ts).optional(),reasoning_effort:zod.z.enum(["minimal","low","medium","high"]).optional(),verbosity:zod.z.enum(["low","medium","high"]).optional()});var d=zod.z.object({modelName:zod.z.string(),apiKey:zod.z.string(),baseUrl:zod.z.string().url().optional(),completeChatUrl:zod.z.string().url().optional(),streamChatUrl:zod.z.string().url().optional(),organization:zod.z.string().optional()}),m=class{constructor(e,n){this.version="v1";let o=d.parse(n);this.modelSchema=e,this.modelName=o.modelName,this.apiKey=o.apiKey,this.baseUrl=provider.urlWithoutTrailingSlash(o.baseUrl||$.baseUrl),this.streamChatUrl=provider.urlWithoutTrailingSlash(o.streamChatUrl||`${this.baseUrl}/chat/completions`),this.completeChatUrl=provider.urlWithoutTrailingSlash(o.completeChatUrl||`${this.baseUrl}/chat/completions`),this.organization=o.organization;}getDefaultBaseUrl(){return this.baseUrl}getDefaultHeaders(){return b({Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},this.organization?{"OpenAI-Organization":this.organization}:{})}getDefaultParams(){return {model:this.modelName}}getRetryDelay(e){let n=r=>{let l=/(\d+)(h|m|s|ms)/g,T={h:36e5,m:6e4,s:1e3,ms:1},g,P=0;for(;(g=l.exec(r))!==null;){let O=parseInt(g[1]),C=g[2];P+=O*T[C];}return P},o=0,s=0,a=!0;e["x-ratelimit-reset-requests"]&&(o=n(e["x-ratelimit-reset-requests"])),e["x-ratelimit-reset-tokens"]&&(s=n(e["x-ratelimit-reset-tokens"]));let c=Math.max(o,s);return {shouldRetry:a,delayMs:c}}getTokenCount(e){return e.reduce((n,o)=>n+o.content.map(s=>s.modality==="text"?s.value:"").join(" ").length,0)}transformModelRequest(e){let n=Dn.safeParse(e);if(!n.success)throw new provider.InvalidModelRequestError({info:"Invalid model request",cause:n.error});let o=n.data,s=o.model;if(o.tool_choice&&(!o.tools||o.tools.length===0))throw new provider.InvalidModelRequestError({info:`Invalid model request for model : '${this.modelName}'`,cause:new Error("'tools' are required when 'tool_choice' is specified")});let a={};o.response_format&&(a.responseFormat=o.response_format.type,o.response_format.type==="json_schema"&&(a.responseSchema={name:o.response_format.json_schema.name,description:o.response_format.json_schema.description||"",strict:o.response_format.json_schema.strict,schema:o.response_format.json_schema.schema})),o.tool_choice&&(typeof o.tool_choice=="string"?a.toolChoice=o.tool_choice:a.toolChoice=o.tool_choice.function.name),a.seed=o.seed,a.maxTokens=o.max_completion_tokens,a.temperature=o.temperature,a.topP=o.top_p,a.presencePenalty=o.presence_penalty,a.frequencyPenalty=o.frequency_penalty,a.stop=o.stop,a.logProbs=o.logprobs,a.topLogProbs=o.top_logprobs,a.reasoningEffort=o.reasoning_effort,a.verbosity=o.verbosity;let c=types.Config().parse(provider.removeUndefinedEntries(a)),r=[],l={};o.messages.forEach(g=>{let P=g.role;switch(P){case"system":{let O=g.content;if(typeof O=="string")r.push({role:P,content:[{modality:types.TextModalityLiteral,value:O}]});else {let C=O.map(S=>({modality:types.TextModalityLiteral,value:S.text}));r.push({role:P,content:C});}}break;case"user":{let O=g.content;if(typeof O=="string")r.push({role:P,content:[{modality:types.TextModalityLiteral,value:O}]});else {let C=O.map(S=>S.type==="text"?{modality:types.TextModalityLiteral,value:S.text}:S.image_url.url.startsWith("data:")?{modality:types.ImageModalityLiteral,detail:S.image_url.detail||"auto",value:{type:types.Base64ImageContentTypeLiteral,base64:S.image_url.url,mediaType:provider.getMimeTypeFromBase64(S.image_url.url)}}:{modality:types.ImageModalityLiteral,detail:S.image_url.detail||"auto",value:{type:types.UrlImageContentTypeLiteral,url:S.image_url.url}});r.push({role:P,content:C});}}break;case"assistant":{let O=[];if(!g.content&&!g.tool_calls)throw new provider.InvalidModelRequestError({info:`Invalid model request for model : '${this.modelName}'`,cause:new Error("one of'content' or 'tool_calls' must be provided")});if(g.content){let C=g.content;typeof C=="string"?O.push({modality:types.TextModalityLiteral,value:C}):C.forEach(S=>{O.push({modality:types.TextModalityLiteral,value:S.text});});}g.tool_calls&&g.tool_calls.forEach((S,G)=>{let q={modality:types.ToolCallModalityLiteral,id:S.id,index:G,name:S.function.name,arguments:S.function.arguments};O.push(q),l[q.id]=q;}),r.push({role:P,content:O});}break;case"tool":{let O=g;r.push({role:P,content:[{modality:types.ToolResponseModalityLiteral,id:O.tool_call_id,index:l[O.tool_call_id].index,name:l[O.tool_call_id].name,data:O.content}]});}break}});let T=[];return o.tools&&o.tools.forEach(g=>{T.push({type:"function",definition:{schema:{name:g.function.name,description:g.function.description||"",strict:g.function.strict,parameters:g.function.parameters}}});}),{modelName:s,config:c,messages:r,tools:T.length>0?T:void 0}}transformConfig(e,n,o){let s=e.toolChoice;delete e.toolChoice;let a=this.modelSchema.config.schema.safeParse(e);if(!a.success)throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:a.error});let c=a.data;s!==void 0&&(c.toolChoice=s),Object.keys(c).forEach(l=>{if(!(l in this.modelSchema.config.def))throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`Invalid config key : '${l}',
10
+ available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})});let r=Object.keys(c).reduce((l,T)=>{let g=this.modelSchema.config.def[T],P=g.param,O=c[T];return P==="max_completion_tokens"&&g.type==="range"&&O===0?l[P]=g.max:l[P]=O,l},{});if(r.top_logprobs&&!r.logprobs)throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error("'logprobs' must be 'true' when 'top_logprobs' is specified")});if("tool_choice"in r&&r.tool_choice!==void 0){let l=r.tool_choice;if(!o||o&&o.length===0)throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error("'tools' are required when 'toolChoice' is specified")});if(o&&o.length>0){let T=this.modelSchema.config.def.toolChoice;if(!T.choices.includes(l))if(o.map(g=>g.definition.schema.name).includes(l))r.tool_choice={type:"function",function:{name:l}};else throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`toolChoice : '${l}' is not part of provided 'tools' names or
11
11
  one of [${T.choices.join(", ")}]`)})}}if("response_format"in r&&r.response_format!==void 0){let l=r.response_format;if(l==="json_schema")if("response_schema"in r)r.response_format={type:"json_schema",json_schema:r.response_schema},delete r.response_schema;else throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelName}'`,cause:new Error("'responseSchema' is required in config when 'responseFormat' is 'json_schema'")});else r.response_format={type:l};}return r}transformMessages(e){if(!e||e&&e.length===0)return {messages:[]};let n=e.map(s=>{let a=types.Message().safeParse(s);if(!a.success)throw new provider.InvalidMessagesError({info:"Invalid messages",cause:a.error});return a.data});return n.forEach(s=>{s.content.forEach(a=>{if(!this.modelSchema.modalities.includes(a.modality))throw new provider.InvalidMessagesError({info:`Invalid message content for model : '${this.modelName}'`,cause:new Error(`model : '${this.modelName}' does not support modality : '${a.modality}',
12
12
  available modalities : [${this.modelSchema.modalities.join(", ")}]`)})});}),n.forEach(s=>{if(!Object.keys(this.modelSchema.roles).includes(s.role))throw new provider.InvalidMessagesError({info:`Invalid message content for model : '${this.modelName}'`,cause:new Error(`model : '${this.modelName}' does not support role : '${s.role}',
13
- available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})}),{messages:n.map(s=>{switch(s.role){case types.SystemRoleLiteral:{let a=[];return s.content.forEach(m=>{if(m.modality===types.TextModalityLiteral)a.push({type:"text",text:m.value});else throw new provider.InvalidMessagesError({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${s.role}' cannot have content with modality : '${m.modality}'`)})}),{role:this.modelSchema.roles[s.role],content:a}}case types.AssistantRoleLiteral:{let a=[],m=[];return s.content.forEach(r=>{if(r.modality===types.TextModalityLiteral)a.push({type:"text",text:r.value});else if(r.modality===types.ToolCallModalityLiteral)m.push({id:r.id,type:"function",function:{name:r.name,arguments:r.arguments}});else throw new provider.InvalidMessagesError({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${s.role}' cannot have content with modality : '${r.modality}'`)})}),b({role:this.modelSchema.roles[s.role],content:a},m.length>0?{tool_calls:m}:{})}case types.UserRoleLiteral:{let a=[],m=[];s.content.forEach(l=>{if(l.modality===types.TextModalityLiteral)a.push({type:"text",text:l.value});else if(l.modality===types.ImageModalityLiteral)m.push({type:"image_url",image_url:{url:l.value.type==="url"?l.value.url:l.value.base64,detail:l.detail}});else throw new provider.InvalidMessagesError({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${s.role}' cannot have content with modality : '${l.modality}'`)})});let r=[...a,...m];return {role:this.modelSchema.roles[s.role],content:r}}case types.ToolRoleLiteral:{if(s.content.length!==1)throw new provider.InvalidMessagesError({info:`Invalid message for role : '${s.role}'`,cause:new Error(`role : '${s.role}' must have exactly one content item`)});if(s.content[0].modality!==types.ToolResponseModalityLiteral)throw new provider.InvalidMessagesError({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${s.role}' must have content with modality : '${types.ToolResponseModalityLiteral}'`)});let a=s.content[0];return {role:this.modelSchema.roles[s.role],tool_call_id:a.id,content:a.data}}default:throw new provider.InvalidMessagesError({info:`Invalid message 'role' for model : ${this.modelName}`,cause:new Error(`role : '${s.role}' is not supported,
14
- available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})}})}}transformTools(e){if(!this.modelSchema.modalities.includes(types.ToolCallModalityLiteral))throw new provider.InvalidToolsError({info:`Invalid tool 'modality' for model : ${this.modelName}`,cause:new Error(`model : '${this.modelName}' does not support tool modality : '${types.ToolCallModalityLiteral}'`)});return !e||e&&e.length===0?{tools:[]}:{tools:e.map(s=>{let a=types.Tool().safeParse(s);if(!a.success)throw new provider.InvalidToolsError({info:"Invalid tools",cause:a.error});return a.data}).map(s=>({type:"function",function:s.definition.schema}))}}getCompleteChatUrl(e,n,o){return A(this,null,function*(){return new Promise(s=>{s(this.completeChatUrl);})})}getCompleteChatHeaders(e,n,o){return A(this,null,function*(){return new Promise(s=>{s(this.getDefaultHeaders());})})}getCompleteChatData(e,n,o){return A(this,null,function*(){let s=this.transformConfig(e,n,o),a=this.transformMessages(n);if(a.messages&&a.messages.length===0)throw new provider.InvalidMessagesError({info:"Messages are required",cause:new Error("Messages are required")});let m=o?this.transformTools(o):{};return new Promise(r=>{r(b(b(b(b({},this.getDefaultParams()),s),a),m));})})}transformCompleteChatResponse(e){let n=An.safeParse(e);if(n.success){if(n.data.choices.length===0)throw new provider.ModelResponseError({info:"Invalid response from model",cause:new Error(`No choices in response : ${JSON.stringify(n.data)}`)});let o=n.data,s=[{role:types.AssistantRoleLiteral,content:[]}],a=o.choices[0].message;a.content&&s[0].content.push(types.createTextContent(a.content)),a.refusal&&s[0].content.push(types.createTextContent(a.refusal)),a.tool_calls&&a.tool_calls.forEach((T,g)=>{s[0].content.push(types.createToolCallContent(g,T.id,T.function.name,T.function.arguments));});let m={promptTokens:o.usage.prompt_tokens,completionTokens:o.usage.completion_tokens,totalTokens:o.usage.total_tokens},r=[],l=o.choices[0].logprobs;return l&&(l.content&&r.push(...l.content.map(T=>({token:T.token,logProb:T.logprob,bytes:T.bytes,topLogProbs:T.top_logprobs.map(g=>({token:g.token,logProb:g.logprob,bytes:g.bytes}))}))),l.refusal&&r.push(...l.refusal.map(T=>({token:T.token,logProb:T.logprob,bytes:T.bytes,topLogProbs:T.top_logprobs.map(g=>({token:g.token,logProb:g.logprob,bytes:g.bytes}))})))),{messages:s,usage:m,logProbs:r}}throw new provider.ModelResponseError({info:"Invalid response from model",cause:n.error})}getStreamChatUrl(e,n,o){return A(this,null,function*(){return new Promise(s=>{s(this.streamChatUrl);})})}getStreamChatHeaders(e,n,o){return A(this,null,function*(){return new Promise(s=>{s(this.getDefaultHeaders());})})}getStreamChatData(e,n,o){return A(this,null,function*(){let s=this.transformConfig(e,n,o),a=this.transformMessages(n);if(a.messages&&a.messages.length===0)throw new provider.InvalidMessagesError({info:"Messages are required",cause:new Error("Messages are required")});let m=o?this.transformTools(o):{};return new Promise(r=>{r(b(b(b(b({stream:!0,stream_options:{include_usage:!0}},this.getDefaultParams()),s),a),m));})})}transformStreamChatResponseChunk(e,n){return co(this,null,function*(){var r,l;let o=n+e,s=[],a="",m=0;for(;m<o.length;){let T=o.indexOf(`
15
- `,m);if(T===-1){a=o.substring(m);break}else {let g=o.substring(m,T).trim();g&&s.push(g),m=T+1;}}for(let T of s){if(T==="data: [DONE]")return;if(T.startsWith("data: ")){let g=T.substring(6);try{let P=JSON.parse(g),O=En.safeParse(P);if(O.success){let C={partialMessages:[]},S=O.data;if(S.choices.length>0){let E=S.choices[0].delta;if(E!==void 0&&Object.keys(E).length!==0){if("content"in E&&E.content!==null)C.partialMessages.push(types.createPartialTextMessage(types.AssistantRoleLiteral,E.content));else if("refusal"in E&&E.refusal!==null)C.partialMessages.push(types.createPartialTextMessage(types.AssistantRoleLiteral,E.refusal));else if("tool_calls"in E&&E.tool_calls!==void 0){let q=E.tool_calls.at(0);C.partialMessages.push(types.createPartialToolCallMessage(types.AssistantRoleLiteral,q.index,q.id,(r=q.function)==null?void 0:r.name,(l=q.function)==null?void 0:l.arguments));}}}S.usage&&(C.usage={promptTokens:S.usage.prompt_tokens,completionTokens:S.usage.completion_tokens,totalTokens:S.usage.total_tokens}),yield {partialResponse:C,buffer:a};}else throw new provider.ModelResponseError({info:"Invalid response from model",cause:O.error})}catch(P){throw new provider.ModelResponseError({info:`Malformed JSON received in stream: ${g}`,cause:P})}}}yield {partialResponse:{partialMessages:[]},buffer:a};})}transformProxyStreamChatResponseChunk(e,n,o,s,a){return co(this,null,function*(){yield*It(this.transformStreamChatResponseChunk(e,n));})}getProxyStreamChatUrl(e,n,o){return A(this,null,function*(){return new Promise(s=>{s(this.streamChatUrl);})})}getProxyCompleteChatUrl(e,n,o){return A(this,null,function*(){return new Promise(s=>{s(this.completeChatUrl);})})}getProxyCompleteChatHeaders(e,n,o){return A(this,null,function*(){if(!n)return {};let s=b({},n);return delete s.host,delete s["content-length"],s})}getProxyStreamChatHeaders(e,n,o){return A(this,null,function*(){return yield this.getProxyCompleteChatHeaders(e,n,o)})}getModelPricing(){if(!(this.modelName in _))throw new provider.ModelResponseError({info:`Invalid model pricing for model : '${this.modelName}'`,cause:new Error(`No pricing configuration found for model "${this.modelName}"`)});return _[this.modelName]}};var se="gpt-3.5-turbo-0125",Ls="The latest GPT-3.5 Turbo model with higher accuracy at responding in requested formats and a fix for a bug which caused a text encoding issue for non-English language function calls. Training data up to Sept 2021.",Ro=provider.ChatModelSchema(u,x).parse({name:se,description:Ls,maxInputTokens:4092,maxOutputTokens:4092,roles:f,modalities:I,config:{def:i.responseFormat(4092,4).def,schema:i.responseFormat(4092,4).schema},price:_[se]}),Ft=h,ie=class extends d{constructor(e){super(Ro,e);}};var ae="gpt-3.5-turbo-1106",Ns="The latest GPT-3.5 Turbo model with improved instruction following, JSON mode, reproducible outputs, parallel function calling, and more. Returns a maximum of 4,096 output tokens. Training data up to Sept 2021.",Ao=provider.ChatModelSchema(u,x).parse({name:ae,description:Ns,maxInputTokens:4092,maxOutputTokens:16385,roles:f,modalities:I,config:{def:i.responseFormat(16385,4).def,schema:i.responseFormat(16385,4).schema},price:_[ae]}),$t=h,re=class extends d{constructor(e){super(Ao,e);}};var pe="gpt-3.5-turbo",Bs="Currently points to gpt-3.5-turbo-0125. Training data up to Sept 2021.",Eo=provider.ChatModelSchema(u,x).parse({name:pe,description:Bs,maxInputTokens:4092,maxOutputTokens:4092,roles:f,modalities:I,config:{def:i.responseFormat(4092,4).def,schema:i.responseFormat(4092,4).schema},price:_[pe]}),Ht=h,le=class extends d{constructor(e){super(Eo,e);}};var me="gpt-4-0125-preview",js="The latest GPT-4 model intended to reduce cases of \u201Claziness\u201D where the model doesn\u2019t complete a task. Training data up to Apr 2023.",Go=provider.ChatModelSchema(u,x).parse({name:me,description:js,maxInputTokens:128e3,maxOutputTokens:4092,roles:f,modalities:I,config:{def:i.base(4092,4).def,schema:i.base(4092,4).schema},price:_[me]}),Vt=h,de=class extends d{constructor(e){super(Go,e);}};var ce="gpt-4-0613",$s="Snapshot of gpt-4 from June 13th 2023 with improved function calling support. Training data up to Sept 2021.",ko=provider.ChatModelSchema(u,x).parse({name:ce,description:$s,maxInputTokens:8192,maxOutputTokens:4092,roles:f,modalities:I,config:{def:i.base(4092,4).def,schema:i.base(4092,4).schema},price:_[ce]}),Kt=h,he=class extends d{constructor(e){super(ko,e);}};var ue="gpt-4-1106-preview",Vs="GPT-4 Turbo model featuring improved instruction following, JSON mode, reproducible outputs, parallel function calling, and more. Returns a maximum of 4,096 output tokens. This preview model is not yet suited for production traffic. Training data up to Apr 2023.",wo=provider.ChatModelSchema(u,x).parse({name:ue,description:Vs,maxInputTokens:128e3,maxOutputTokens:4092,roles:f,modalities:I,config:{def:i.base(4092,4).def,schema:i.base(4092,4).schema},price:_[ue]}),Jt=h,fe=class extends d{constructor(e){super(wo,e);}};var _e="gpt-4.1",Js="Flagship model for complex tasks. It is well suited for problem solving across domains. Training data up to May 2024.",vo=provider.ChatModelSchema(u,y).parse({name:_e,description:Js,maxInputTokens:1047576,maxOutputTokens:32768,roles:f,modalities:M,config:{def:i.responseSchema(32768,4).def,schema:i.responseSchema(32768,4).schema},price:_[_e]}),Wt=h,ge=class extends d{constructor(e){super(vo,e);}};var Te="gpt-4.1-mini",Ys="Provides a balance between intelligence, speed, and cost that makes it an attractive model for many use cases. Training data up to May 2024.",Do=provider.ChatModelSchema(u,y).parse({name:Te,description:Ys,maxInputTokens:1047576,maxOutputTokens:32768,roles:f,modalities:M,config:{def:i.responseSchema(32768,4).def,schema:i.responseSchema(32768,4).schema},price:_[Te]}),Yt=h,Me=class extends d{constructor(e){super(Do,e);}};var ye="gpt-4.1-nano",Xs="Fastest, most cost-effective GPT-4.1 model. Training data up to May 2024.",Lo=provider.ChatModelSchema(u,y).parse({name:ye,description:Xs,maxInputTokens:1047576,maxOutputTokens:32768,roles:f,modalities:M,config:{def:i.responseSchema(32768,4).def,schema:i.responseSchema(32768,4).schema},price:_[ye]}),Qt=h,Oe=class extends d{constructor(e){super(Lo,e);}};var Ce="gpt-5",ei="Most advanced GPT-5 model for complex reasoning and problem-solving tasks. Training data up to October 2024.",qo=provider.ChatModelSchema(u,y).parse({name:Ce,description:ei,maxInputTokens:4e5,maxOutputTokens:131072,roles:f,modalities:M,config:{def:i.gpt5(131072,4).def,schema:i.gpt5(131072,4).schema},price:_[Ce]}),Xt=h,be=class extends d{constructor(e){super(qo,e);}};var Pe="gpt-5-mini",ti="Faster, more cost-effective GPT-5 model that balances intelligence and efficiency. Training data up to October 2024.",No=provider.ChatModelSchema(u,y).parse({name:Pe,description:ti,maxInputTokens:4e5,maxOutputTokens:131072,roles:f,modalities:M,config:{def:i.gpt5(131072,4).def,schema:i.gpt5(131072,4).schema},price:_[Pe]}),Zt=h,Se=class extends d{constructor(e){super(No,e);}};var Ie="gpt-5-nano",si="Most cost-effective GPT-5 model optimized for speed and efficiency. Training data up to October 2024.",zo=provider.ChatModelSchema(u,y).parse({name:Ie,description:si,maxInputTokens:4e5,maxOutputTokens:131072,roles:f,modalities:M,config:{def:i.gpt5(131072,4).def,schema:i.gpt5(131072,4).schema},price:_[Ie]}),en=h,xe=class extends d{constructor(e){super(zo,e);}};var Re="gpt-5-chat-latest",ri="Latest GPT-5 model optimized for conversational use. Does not support function calling or structured outputs. Training data up to October 2024.",pi=[types.TextModalityLiteral,types.ImageModalityLiteral],li=zod.z.enum([types.TextModalityLiteral,types.ImageModalityLiteral]),Bo=provider.ChatModelSchema(u,li).parse({name:Re,description:ri,maxInputTokens:4e5,maxOutputTokens:131072,roles:f,modalities:pi,config:{def:i.gpt5(131072,4).def,schema:i.gpt5(131072,4).schema},price:_[Re]}),on=h,Ae=class extends d{constructor(e){super(Bo,e);}};var Ee="gpt-4-turbo-2024-04-09",di="GPT-4 Turbo with Vision model. Vision requests can now use JSON mode and function calling. gpt-4-turbo currently points to this version. Training data up to Dec 2023.",Uo=provider.ChatModelSchema(u,y).parse({name:Ee,description:di,maxInputTokens:128e3,maxOutputTokens:4096,roles:f,modalities:M,config:{def:i.responseFormat(4096,4).def,schema:i.responseFormat(4096,4).schema},price:_[Ee]}),tn=h,Ge=class extends d{constructor(e){super(Uo,e);}};var ke="gpt-4-turbo-preview",hi="Currently points to gpt-4-0125-preview. Training data up to Apr 2023.",jo=provider.ChatModelSchema(u,x).parse({name:ke,description:hi,maxInputTokens:128e3,maxOutputTokens:4092,roles:f,modalities:I,config:{def:i.responseFormat(4092,4).def,schema:i.responseFormat(4092,4).schema},price:_[ke]}),nn=h,we=class extends d{constructor(e){super(jo,e);}};var ve="gpt-4-turbo",fi="The latest GPT-4 Turbo model with vision capabilities. Vision requests can now use JSON mode and function calling. Currently points to gpt-4-turbo-2024-04-09. Training data up to Dec 2023.",Fo=provider.ChatModelSchema(u,y).parse({name:ve,description:fi,maxInputTokens:128e3,maxOutputTokens:4092,roles:f,modalities:M,config:{def:i.responseFormat(4092,4).def,schema:i.responseFormat(4092,4).schema},price:_[ve]}),sn=h,De=class extends d{constructor(e){super(Fo,e);}};var Le="gpt-4",gi="Currently points to gpt-4-0613. Training data up to Sept 2021.",$o=provider.ChatModelSchema(u,x).parse({name:Le,description:gi,maxInputTokens:8192,maxOutputTokens:4092,roles:f,modalities:I,config:{def:i.base(4092,4).def,schema:i.base(4092,4).schema},price:_[Le]}),an=h,qe=class extends d{constructor(e){super($o,e);}};var Ne="gpt-4o-2024-05-13",Mi="Latest snapshot of gpt-4o that supports Structured Outputs. Training data up to Oct 2023.",Ho=provider.ChatModelSchema(u,y).parse({name:Ne,description:Mi,maxInputTokens:128e3,maxOutputTokens:4092,roles:f,modalities:M,config:{def:i.responseSchema(4092,4).def,schema:i.responseSchema(4092,4).schema},price:_[Ne]}),rn=h,ze=class extends d{constructor(e){super(Ho,e);}};var Be="gpt-4o-2024-08-06",Oi="Latest snapshot of gpt-4o that supports Structured Outputs. Training data up to Oct 2023.",Vo=provider.ChatModelSchema(u,y).parse({name:Be,description:Oi,maxInputTokens:128e3,maxOutputTokens:4092,roles:f,modalities:M,config:{def:i.responseSchema(4092,4).def,schema:i.responseSchema(4092,4).schema},price:_[Be]}),pn=h,Ue=class extends d{constructor(e){super(Vo,e);}};var je="gpt-4o-mini-2024-07-18",bi="Most advanced, multimodal flagship model that is cheaper and faster than GPT-4 Turbo. Currently points to gpt-4o-2024-05-13. Training data up to Oct 2023.",Ko=provider.ChatModelSchema(u,y).parse({name:je,description:bi,maxInputTokens:128e3,maxOutputTokens:4092,roles:f,modalities:M,config:{def:i.responseSchema(4092,4).def,schema:i.responseSchema(4092,4).schema},price:_[je]}),ln=h,Fe=class extends d{constructor(e){super(Ko,e);}};var $e="gpt-4o-mini",Si="Most advanced, multimodal flagship model that is cheaper and faster than GPT-4 Turbo. Currently points to gpt-4o-2024-05-13. Training data up to Oct 2023.",Jo=provider.ChatModelSchema(u,y).parse({name:$e,description:Si,maxInputTokens:128e3,maxOutputTokens:4092,roles:f,modalities:M,config:{def:i.responseSchema(4092,4).def,schema:i.responseSchema(4092,4).schema},price:_[$e]}),mn=h,He=class extends d{constructor(e){super(Jo,e);}};var Ve="gpt-4o",xi="Most advanced, multimodal flagship model that is cheaper and faster than GPT-4 Turbo. Currently points to gpt-4o-2024-05-13. Training data up to Oct 2023.",Wo=provider.ChatModelSchema(u,y).parse({name:Ve,description:xi,maxInputTokens:128e3,maxOutputTokens:4092,roles:f,modalities:M,config:{def:i.responseSchema(4092,4).def,schema:i.responseSchema(4092,4).schema},price:_[Ve]}),dn=h,Ke=class extends d{constructor(e){super(Wo,e);}};var Je="o1-2024-12-17",Ai="A stable release model for production use, offering robust performance and advanced features. Training data up to December 2024.",Yo=provider.ChatModelSchema(u,y).parse({name:Je,description:Ai,maxInputTokens:2e5,maxOutputTokens:1e5,roles:f,modalities:M,config:{def:i.oSeries(1e5,4).def,schema:i.oSeries(1e5,4).schema},price:_[Je]}),cn=h,We=class extends d{constructor(e){super(Yo,e);}};var Ye="o1",Gi="Highly capable general-purpose reasoning model with advanced capabilities in language, coding, and reasoning. Training data up to Oct 2023.",Qo=provider.ChatModelSchema(u,y).parse({name:Ye,description:Gi,maxInputTokens:2e5,maxOutputTokens:1e5,roles:f,modalities:M,config:{def:i.oSeries(1e5,4).def,schema:i.oSeries(1e5,4).schema},price:_[Ye]}),hn=h,Qe=class extends d{constructor(e){super(Qo,e);}};var Xo="o3-2025-04-16",wi="A new standard for math, science, coding, and visual reasoning tasks. Training data up to Jun 2024.",Zo=provider.ChatModelSchema(u,y).parse({name:Xo,description:wi,maxInputTokens:2e5,maxOutputTokens:1e5,roles:f,modalities:M,config:{def:i.oSeries(1e5,4).def,schema:i.oSeries(1e5,4).schema}}),un=h,Xe=class extends d{constructor(e){super(Zo,e);}};var et="o3",Di="A new standard for math, science, coding, and visual reasoning tasks. Training data up to Jun 2024.",ot=provider.ChatModelSchema(u,y).parse({name:et,description:Di,maxInputTokens:2e5,maxOutputTokens:1e5,roles:f,modalities:M,config:{def:i.oSeries(1e5,4).def,schema:i.oSeries(1e5,4).schema}}),fn=h,Ze=class extends d{constructor(e){super(ot,e);}};var tt="o3-mini",qi="o3-mini is the newest small reasoning model, providing high intelligence at the same cost and latency targets of o1-mini. Training data up to Sep 2023.",nt=provider.ChatModelSchema(u,x).parse({name:tt,description:qi,maxInputTokens:2e5,maxOutputTokens:1e5,roles:f,modalities:I,config:{def:i.oSeries(1e5,4).def,schema:i.oSeries(1e5,4).schema}}),_n=h,eo=class extends d{constructor(e){super(nt,e);}};var st="o3-mini-2025-01-31",zi="o3-mini is the newest small reasoning model, providing high intelligence at the same cost and latency targets of o1-mini. Training data up to Sep 2023.",it=provider.ChatModelSchema(u,x).parse({name:st,description:zi,maxInputTokens:2e5,maxOutputTokens:1e5,roles:f,modalities:I,config:{def:i.oSeries(1e5,4).def,schema:i.oSeries(1e5,4).schema}}),gn=h,oo=class extends d{constructor(e){super(it,e);}};var at="o4-mini-2025-04-16",Ui="Optimized for fast, effective reasoning with exceptionally efficient performance in coding and visual tasks. Training data up to Jun 2024.",rt=provider.ChatModelSchema(u,y).parse({name:at,description:Ui,maxInputTokens:2e5,maxOutputTokens:1e5,roles:f,modalities:M,config:{def:i.oSeries(1e5,4).def,schema:i.oSeries(1e5,4).schema}}),Tn=h,to=class extends d{constructor(e){super(rt,e);}};var pt="o4-mini",Fi="Optimized for fast, effective reasoning with exceptionally efficient performance in coding and visual tasks. Training data up to Jun 2024.",lt=provider.ChatModelSchema(u,y).parse({name:pt,description:Fi,maxInputTokens:2e5,maxOutputTokens:1e5,roles:f,modalities:M,config:{def:i.oSeries(1e5,4).def,schema:i.oSeries(1e5,4).schema}}),Mn=h,no=class extends d{constructor(e){super(lt,e);}};var W=[types.EmbeddingTextModalityLiteral,types.EmbeddingTokenModalityLiteral],Y=zod.z.enum([types.EmbeddingTextModalityLiteral,types.EmbeddingTokenModalityLiteral]);var zn=zod.z.object({object:zod.z.literal("list"),model:zod.z.string(),data:zod.z.array(zod.z.object({index:zod.z.number(),object:zod.z.literal("embedding"),embedding:zod.z.array(zod.z.number()).or(zod.z.string().base64())})),usage:zod.z.object({prompt_tokens:zod.z.number().nonnegative(),total_tokens:zod.z.number().nonnegative()})});var Hi=zod.z.string().min(1).or(zod.z.array(zod.z.string().min(1)).min(1)).or(zod.z.array(zod.z.number().int().nonnegative()).min(1)).or(zod.z.array(zod.z.array(zod.z.number().int().nonnegative()).min(1)).min(1)),Bn=zod.z.object({model:zod.z.string().min(1).optional(),input:Hi,encoding_format:zod.z.enum(["float","base64"]).optional(),dimensions:zod.z.number().int().min(1).optional()});var V=zod.z.object({modelName:zod.z.string(),apiKey:zod.z.string(),baseUrl:zod.z.string().url().optional(),getEmbeddingsUrl:zod.z.string().url().optional()}),B=class{constructor(e,n){this.version="v1";let o=V.parse(n);this.modelSchema=e,this.modelName=o.modelName,this.apiKey=o.apiKey,this.baseUrl=provider.urlWithoutTrailingSlash(o.baseUrl||$.baseUrl),this.getEmbeddingsUrl=provider.urlWithoutTrailingSlash(o.getEmbeddingsUrl||`${this.baseUrl}/embeddings`);}getDefaultBaseUrl(){return this.baseUrl}getDefaultHeaders(){return {Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"}}getDefaultParams(){return {model:this.modelSchema.name}}getRetryDelay(e){let n=r=>{let l=/(\d+)(h|m|s|ms)/g,T={h:36e5,m:6e4,s:1e3,ms:1},g,P=0;for(;(g=l.exec(r))!==null;){let O=parseInt(g[1]),C=g[2];P+=O*T[C];}return P},o=0,s=0,a=!0;e["x-ratelimit-reset-requests"]&&(o=n(e["x-ratelimit-reset-requests"])),e["x-ratelimit-reset-tokens"]&&(s=n(e["x-ratelimit-reset-tokens"]));let m=Math.max(o,s);return {shouldRetry:a,delayMs:m}}getTokenCount(e){return e.requests.reduce((n,o)=>n+o.length,0)}transformModelRequest(e){let n=Bn.safeParse(e);if(!n.success)throw new provider.InvalidModelRequestError({info:"Invalid model request",cause:n.error});let o=n.data,s=o.model,a={encodingFormat:o.encoding_format,dimensions:o.dimensions},m=types.Config().parse(provider.removeUndefinedEntries(a)),r,l;return typeof o.input=="string"?l=types.EmbeddingTextModalityLiteral:typeof o.input[0]=="string"?l=types.EmbeddingTextModalityLiteral:l=types.EmbeddingTokenModalityLiteral,l===types.EmbeddingTextModalityLiteral?typeof o.input=="string"?r={modality:l,requests:[o.input]}:r={modality:l,requests:o.input}:typeof o.input[0]=="number"?r={modality:l,requests:[o.input]}:r={modality:l,requests:o.input},{modelName:s,config:m,embeddingRequests:r}}transformConfig(e,n){let o=this.modelSchema.config.schema.safeParse(e);if(!o.success)throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelSchema.name}'`,cause:o.error});let s=o.data;return Object.keys(s).forEach(m=>{if(!this.modelSchema.config.def[m])throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelSchema.name}'`,cause:new Error(`Invalid config key : '${m}',
16
- available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})}),Object.keys(s).reduce((m,r)=>{let T=this.modelSchema.config.def[r].param,g=s[r];return m[T]=g,m},{})}transformEmbeddingRequests(e){let n=types.EmbeddingRequests().safeParse(e);if(!n.success)throw new provider.InvalidEmbeddingRequestsError({info:"Invalid embedding requests",cause:n.error});return {input:n.data.requests}}getGetEmbeddingsUrl(e,n){return A(this,null,function*(){return new Promise(o=>{o(this.getEmbeddingsUrl);})})}getGetEmbeddingsHeaders(e,n){return A(this,null,function*(){return new Promise(o=>{o(this.getDefaultHeaders());})})}getGetEmbeddingsData(e,n){return A(this,null,function*(){return new Promise(o=>{o(b(b(b({},this.getDefaultParams()),this.transformConfig(e,n)),this.transformEmbeddingRequests(n)));})})}transformGetEmbeddingsResponse(e){let n,o=zn.safeParse(e);if(o.success){let s=o.data;n=typeof s.data[0].embedding=="string"?types.Base64EmbeddingLiteral:types.FloatEmbeddingLiteral;let a=s.data.map(m=>typeof m.embedding=="string"?{index:m.index,embedding:m.embedding}:{index:m.index,embedding:m.embedding});return {encodingFormat:n,embeddings:a,usage:{totalTokens:s.usage.total_tokens}}}throw new provider.ModelResponseError({info:"Invalid response from model",cause:o.error})}};var mt="text-embedding-ada-002",ta="Most capable 2nd generation embedding model, replacing 16 first generation models",dt=provider.EmbeddingModelSchema(Y).parse({name:mt,description:ta,modalities:W,maxInputTokens:8192,maxOutputTokens:1536,config:{def:D.base().def,schema:D.base().schema}}),yn=V,so=class extends B{constructor(e){super(dt,e);}};var ct="text-embedding-3-small",sa="Increased performance over 2nd generation ada embedding model",ht=provider.EmbeddingModelSchema(Y).parse({name:ct,description:sa,modalities:W,maxInputTokens:8192,maxOutputTokens:1536,config:{def:D.dimensions(1536).def,schema:D.dimensions(1536).schema}}),On=V,io=class extends B{constructor(e){super(ht,e);}};var ut="text-embedding-3-large",aa="Most capable embedding model for both english and non-english tasks",ft=provider.EmbeddingModelSchema(Y).parse({name:ut,description:aa,modalities:W,maxInputTokens:8192,maxOutputTokens:3072,config:{def:D.dimensions(3072).def,schema:D.dimensions(3072).schema}}),Cn=V,ao=class extends B{constructor(e){super(ft,e);}};
13
+ available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})}),{messages:n.map(s=>{switch(s.role){case types.SystemRoleLiteral:{let a=[];return s.content.forEach(c=>{if(c.modality===types.TextModalityLiteral)a.push({type:"text",text:c.value});else throw new provider.InvalidMessagesError({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${s.role}' cannot have content with modality : '${c.modality}'`)})}),{role:this.modelSchema.roles[s.role],content:a}}case types.AssistantRoleLiteral:{let a=[],c=[];return s.content.forEach(r=>{if(r.modality===types.TextModalityLiteral)a.push({type:"text",text:r.value});else if(r.modality===types.ToolCallModalityLiteral)c.push({id:r.id,type:"function",function:{name:r.name,arguments:r.arguments}});else throw new provider.InvalidMessagesError({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${s.role}' cannot have content with modality : '${r.modality}'`)})}),b({role:this.modelSchema.roles[s.role],content:a},c.length>0?{tool_calls:c}:{})}case types.UserRoleLiteral:{let a=[],c=[];s.content.forEach(l=>{if(l.modality===types.TextModalityLiteral)a.push({type:"text",text:l.value});else if(l.modality===types.ImageModalityLiteral)c.push({type:"image_url",image_url:{url:l.value.type==="url"?l.value.url:l.value.base64,detail:l.detail}});else throw new provider.InvalidMessagesError({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${s.role}' cannot have content with modality : '${l.modality}'`)})});let r=[...a,...c];return {role:this.modelSchema.roles[s.role],content:r}}case types.ToolRoleLiteral:{if(s.content.length!==1)throw new provider.InvalidMessagesError({info:`Invalid message for role : '${s.role}'`,cause:new Error(`role : '${s.role}' must have exactly one content item`)});if(s.content[0].modality!==types.ToolResponseModalityLiteral)throw new provider.InvalidMessagesError({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${s.role}' must have content with modality : '${types.ToolResponseModalityLiteral}'`)});let a=s.content[0];return {role:this.modelSchema.roles[s.role],tool_call_id:a.id,content:a.data}}default:throw new provider.InvalidMessagesError({info:`Invalid message 'role' for model : ${this.modelName}`,cause:new Error(`role : '${s.role}' is not supported,
14
+ available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})}})}}transformTools(e){if(!this.modelSchema.modalities.includes(types.ToolCallModalityLiteral))throw new provider.InvalidToolsError({info:`Invalid tool 'modality' for model : ${this.modelName}`,cause:new Error(`model : '${this.modelName}' does not support tool modality : '${types.ToolCallModalityLiteral}'`)});return !e||e&&e.length===0?{tools:[]}:{tools:e.map(s=>{let a=types.Tool().safeParse(s);if(!a.success)throw new provider.InvalidToolsError({info:"Invalid tools",cause:a.error});return a.data}).map(s=>({type:"function",function:s.definition.schema}))}}getCompleteChatUrl(e,n,o){return A(this,null,function*(){return new Promise(s=>{s(this.completeChatUrl);})})}getCompleteChatHeaders(e,n,o){return A(this,null,function*(){return new Promise(s=>{s(this.getDefaultHeaders());})})}getCompleteChatData(e,n,o){return A(this,null,function*(){let s=this.transformConfig(e,n,o),a=this.transformMessages(n);if(a.messages&&a.messages.length===0)throw new provider.InvalidMessagesError({info:"Messages are required",cause:new Error("Messages are required")});let c=o?this.transformTools(o):{};return new Promise(r=>{r(b(b(b(b({},this.getDefaultParams()),s),a),c));})})}transformCompleteChatResponse(e){let n=wn.safeParse(e);if(n.success){if(n.data.choices.length===0)throw new provider.ModelResponseError({info:"Invalid response from model",cause:new Error(`No choices in response : ${JSON.stringify(n.data)}`)});let o=n.data,s=[{role:types.AssistantRoleLiteral,content:[]}],a=o.choices[0].message;a.content&&s[0].content.push(types.createTextContent(a.content)),a.refusal&&s[0].content.push(types.createTextContent(a.refusal)),a.tool_calls&&a.tool_calls.forEach((T,g)=>{s[0].content.push(types.createToolCallContent(g,T.id,T.function.name,T.function.arguments));});let c={promptTokens:o.usage.prompt_tokens,completionTokens:o.usage.completion_tokens,totalTokens:o.usage.total_tokens},r=[],l=o.choices[0].logprobs;return l&&(l.content&&r.push(...l.content.map(T=>({token:T.token,logProb:T.logprob,bytes:T.bytes,topLogProbs:T.top_logprobs.map(g=>({token:g.token,logProb:g.logprob,bytes:g.bytes}))}))),l.refusal&&r.push(...l.refusal.map(T=>({token:T.token,logProb:T.logprob,bytes:T.bytes,topLogProbs:T.top_logprobs.map(g=>({token:g.token,logProb:g.logprob,bytes:g.bytes}))})))),{messages:s,usage:c,logProbs:r}}throw new provider.ModelResponseError({info:"Invalid response from model",cause:n.error})}getStreamChatUrl(e,n,o){return A(this,null,function*(){return new Promise(s=>{s(this.streamChatUrl);})})}getStreamChatHeaders(e,n,o){return A(this,null,function*(){return new Promise(s=>{s(this.getDefaultHeaders());})})}getStreamChatData(e,n,o){return A(this,null,function*(){let s=this.transformConfig(e,n,o),a=this.transformMessages(n);if(a.messages&&a.messages.length===0)throw new provider.InvalidMessagesError({info:"Messages are required",cause:new Error("Messages are required")});let c=o?this.transformTools(o):{};return new Promise(r=>{r(b(b(b(b({stream:!0,stream_options:{include_usage:!0}},this.getDefaultParams()),s),a),c));})})}transformStreamChatResponseChunk(e,n){return uo(this,null,function*(){var r,l;let o=n+e,s=[],a="",c=0;for(;c<o.length;){let T=o.indexOf(`
15
+ `,c);if(T===-1){a=o.substring(c);break}else {let g=o.substring(c,T).trim();g&&s.push(g),c=T+1;}}for(let T of s){if(T==="data: [DONE]")return;if(T.startsWith("data: ")){let g=T.substring(6);try{let P=JSON.parse(g),O=vn.safeParse(P);if(O.success){let C={partialMessages:[]},S=O.data;if(S.choices.length>0){let G=S.choices[0].delta;if(G!==void 0&&Object.keys(G).length!==0){if("content"in G&&G.content!==null)C.partialMessages.push(types.createPartialTextMessage(types.AssistantRoleLiteral,G.content));else if("refusal"in G&&G.refusal!==null)C.partialMessages.push(types.createPartialTextMessage(types.AssistantRoleLiteral,G.refusal));else if("tool_calls"in G&&G.tool_calls!==void 0){let q=G.tool_calls.at(0);C.partialMessages.push(types.createPartialToolCallMessage(types.AssistantRoleLiteral,q.index,q.id,(r=q.function)==null?void 0:r.name,(l=q.function)==null?void 0:l.arguments));}}}S.usage&&(C.usage={promptTokens:S.usage.prompt_tokens,completionTokens:S.usage.completion_tokens,totalTokens:S.usage.total_tokens}),yield {partialResponse:C,buffer:a};}else throw new provider.ModelResponseError({info:"Invalid response from model",cause:O.error})}catch(P){throw new provider.ModelResponseError({info:`Malformed JSON received in stream: ${g}`,cause:P})}}}yield {partialResponse:{partialMessages:[]},buffer:a};})}transformProxyStreamChatResponseChunk(e,n,o,s,a){return uo(this,null,function*(){yield*At(this.transformStreamChatResponseChunk(e,n));})}getProxyStreamChatUrl(e,n,o){return A(this,null,function*(){return new Promise(s=>{s(this.streamChatUrl);})})}getProxyCompleteChatUrl(e,n,o){return A(this,null,function*(){return new Promise(s=>{s(this.completeChatUrl);})})}getProxyCompleteChatHeaders(e,n,o){return A(this,null,function*(){if(!n)return {};let s=b({},n);return delete s.host,delete s["content-length"],s})}getProxyStreamChatHeaders(e,n,o){return A(this,null,function*(){return yield this.getProxyCompleteChatHeaders(e,n,o)})}getModelPricing(){if(!(this.modelName in _))throw new provider.ModelResponseError({info:`Invalid model pricing for model : '${this.modelName}'`,cause:new Error(`No pricing configuration found for model "${this.modelName}"`)});return _[this.modelName]}};var se="gpt-3.5-turbo-0125",Bs="The latest GPT-3.5 Turbo model with higher accuracy at responding in requested formats and a fix for a bug which caused a text encoding issue for non-English language function calls. Training data up to Sept 2021.",Go=provider.ChatModelSchema(h,x).parse({name:se,description:Bs,maxInputTokens:4092,maxOutputTokens:4092,roles:u,modalities:I,config:{def:i.responseFormat(4092,4).def,schema:i.responseFormat(4092,4).schema},price:_[se]}),Vt=d,ie=class extends m{constructor(e){super(Go,e);}};var ae="gpt-3.5-turbo-1106",js="The latest GPT-3.5 Turbo model with improved instruction following, JSON mode, reproducible outputs, parallel function calling, and more. Returns a maximum of 4,096 output tokens. Training data up to Sept 2021.",Eo=provider.ChatModelSchema(h,x).parse({name:ae,description:js,maxInputTokens:4092,maxOutputTokens:16385,roles:u,modalities:I,config:{def:i.responseFormat(16385,4).def,schema:i.responseFormat(16385,4).schema},price:_[ae]}),Kt=d,re=class extends m{constructor(e){super(Eo,e);}};var pe="gpt-3.5-turbo",$s="Currently points to gpt-3.5-turbo-0125. Training data up to Sept 2021.",ko=provider.ChatModelSchema(h,x).parse({name:pe,description:$s,maxInputTokens:4092,maxOutputTokens:4092,roles:u,modalities:I,config:{def:i.responseFormat(4092,4).def,schema:i.responseFormat(4092,4).schema},price:_[pe]}),Jt=d,le=class extends m{constructor(e){super(ko,e);}};var me="gpt-4-0125-preview",Vs="The latest GPT-4 model intended to reduce cases of \u201Claziness\u201D where the model doesn\u2019t complete a task. Training data up to Apr 2023.",wo=provider.ChatModelSchema(h,x).parse({name:me,description:Vs,maxInputTokens:128e3,maxOutputTokens:4092,roles:u,modalities:I,config:{def:i.base(4092,4).def,schema:i.base(4092,4).schema},price:_[me]}),Wt=d,de=class extends m{constructor(e){super(wo,e);}};var ce="gpt-4-0613",Js="Snapshot of gpt-4 from June 13th 2023 with improved function calling support. Training data up to Sept 2021.",vo=provider.ChatModelSchema(h,x).parse({name:ce,description:Js,maxInputTokens:8192,maxOutputTokens:4092,roles:u,modalities:I,config:{def:i.base(4092,4).def,schema:i.base(4092,4).schema},price:_[ce]}),Yt=d,he=class extends m{constructor(e){super(vo,e);}};var ue="gpt-4-1106-preview",Ys="GPT-4 Turbo model featuring improved instruction following, JSON mode, reproducible outputs, parallel function calling, and more. Returns a maximum of 4,096 output tokens. This preview model is not yet suited for production traffic. Training data up to Apr 2023.",Do=provider.ChatModelSchema(h,x).parse({name:ue,description:Ys,maxInputTokens:128e3,maxOutputTokens:4092,roles:u,modalities:I,config:{def:i.base(4092,4).def,schema:i.base(4092,4).schema},price:_[ue]}),Qt=d,fe=class extends m{constructor(e){super(Do,e);}};var _e="gpt-4.1",Xs="Flagship model for complex tasks. It is well suited for problem solving across domains. Training data up to May 2024.",Lo=provider.ChatModelSchema(h,y).parse({name:_e,description:Xs,maxInputTokens:1047576,maxOutputTokens:32768,roles:u,modalities:M,config:{def:i.responseSchema(32768,4).def,schema:i.responseSchema(32768,4).schema},price:_[_e]}),Xt=d,ge=class extends m{constructor(e){super(Lo,e);}};var Te="gpt-4.1-mini",ei="Provides a balance between intelligence, speed, and cost that makes it an attractive model for many use cases. Training data up to May 2024.",qo=provider.ChatModelSchema(h,y).parse({name:Te,description:ei,maxInputTokens:1047576,maxOutputTokens:32768,roles:u,modalities:M,config:{def:i.responseSchema(32768,4).def,schema:i.responseSchema(32768,4).schema},price:_[Te]}),Zt=d,Me=class extends m{constructor(e){super(qo,e);}};var ye="gpt-4.1-nano",ti="Fastest, most cost-effective GPT-4.1 model. Training data up to May 2024.",No=provider.ChatModelSchema(h,y).parse({name:ye,description:ti,maxInputTokens:1047576,maxOutputTokens:32768,roles:u,modalities:M,config:{def:i.responseSchema(32768,4).def,schema:i.responseSchema(32768,4).schema},price:_[ye]}),en=d,Oe=class extends m{constructor(e){super(No,e);}};var Ce="gpt-5.1",si="Flagship GPT-5.1 model for coding and agentic tasks with configurable reasoning effort. Training data up to September 2024.",zo=provider.ChatModelSchema(h,y).parse({name:Ce,description:si,maxInputTokens:4e5,maxOutputTokens:128e3,roles:u,modalities:M,config:{def:i.gpt5(128e3,4).def,schema:i.gpt5(128e3,4).schema},price:_[Ce]}),on=d,be=class extends m{constructor(e){super(zo,e);}};var Pe="gpt-5",ai="Most advanced GPT-5 model for complex reasoning and problem-solving tasks. Training data up to October 2024.",Bo=provider.ChatModelSchema(h,y).parse({name:Pe,description:ai,maxInputTokens:4e5,maxOutputTokens:131072,roles:u,modalities:M,config:{def:i.gpt5(131072,4).def,schema:i.gpt5(131072,4).schema},price:_[Pe]}),tn=d,Se=class extends m{constructor(e){super(Bo,e);}};var Ie="gpt-5-mini",pi="Faster, more cost-effective GPT-5 model that balances intelligence and efficiency. Training data up to October 2024.",Uo=provider.ChatModelSchema(h,y).parse({name:Ie,description:pi,maxInputTokens:4e5,maxOutputTokens:131072,roles:u,modalities:M,config:{def:i.gpt5(131072,4).def,schema:i.gpt5(131072,4).schema},price:_[Ie]}),nn=d,xe=class extends m{constructor(e){super(Uo,e);}};var Re="gpt-5-nano",mi="Most cost-effective GPT-5 model optimized for speed and efficiency. Training data up to October 2024.",jo=provider.ChatModelSchema(h,y).parse({name:Re,description:mi,maxInputTokens:4e5,maxOutputTokens:131072,roles:u,modalities:M,config:{def:i.gpt5(131072,4).def,schema:i.gpt5(131072,4).schema},price:_[Re]}),sn=d,Ae=class extends m{constructor(e){super(jo,e);}};var Ge="gpt-5-chat-latest",hi="Latest GPT-5 model optimized for conversational use. Does not support function calling or structured outputs. Training data up to October 2024.",ui=[types.TextModalityLiteral,types.ImageModalityLiteral],fi=zod.z.enum([types.TextModalityLiteral,types.ImageModalityLiteral]),Fo=provider.ChatModelSchema(h,fi).parse({name:Ge,description:hi,maxInputTokens:4e5,maxOutputTokens:131072,roles:u,modalities:ui,config:{def:i.gpt5(131072,4).def,schema:i.gpt5(131072,4).schema},price:_[Ge]}),an=d,Ee=class extends m{constructor(e){super(Fo,e);}};var ke="gpt-4-turbo-2024-04-09",gi="GPT-4 Turbo with Vision model. Vision requests can now use JSON mode and function calling. gpt-4-turbo currently points to this version. Training data up to Dec 2023.",$o=provider.ChatModelSchema(h,y).parse({name:ke,description:gi,maxInputTokens:128e3,maxOutputTokens:4096,roles:u,modalities:M,config:{def:i.responseFormat(4096,4).def,schema:i.responseFormat(4096,4).schema},price:_[ke]}),rn=d,we=class extends m{constructor(e){super($o,e);}};var ve="gpt-4-turbo-preview",Mi="Currently points to gpt-4-0125-preview. Training data up to Apr 2023.",Ho=provider.ChatModelSchema(h,x).parse({name:ve,description:Mi,maxInputTokens:128e3,maxOutputTokens:4092,roles:u,modalities:I,config:{def:i.responseFormat(4092,4).def,schema:i.responseFormat(4092,4).schema},price:_[ve]}),pn=d,De=class extends m{constructor(e){super(Ho,e);}};var Le="gpt-4-turbo",Oi="The latest GPT-4 Turbo model with vision capabilities. Vision requests can now use JSON mode and function calling. Currently points to gpt-4-turbo-2024-04-09. Training data up to Dec 2023.",Vo=provider.ChatModelSchema(h,y).parse({name:Le,description:Oi,maxInputTokens:128e3,maxOutputTokens:4092,roles:u,modalities:M,config:{def:i.responseFormat(4092,4).def,schema:i.responseFormat(4092,4).schema},price:_[Le]}),ln=d,qe=class extends m{constructor(e){super(Vo,e);}};var Ne="gpt-4",bi="Currently points to gpt-4-0613. Training data up to Sept 2021.",Ko=provider.ChatModelSchema(h,x).parse({name:Ne,description:bi,maxInputTokens:8192,maxOutputTokens:4092,roles:u,modalities:I,config:{def:i.base(4092,4).def,schema:i.base(4092,4).schema},price:_[Ne]}),mn=d,ze=class extends m{constructor(e){super(Ko,e);}};var Be="gpt-4o-2024-05-13",Si="Latest snapshot of gpt-4o that supports Structured Outputs. Training data up to Oct 2023.",Jo=provider.ChatModelSchema(h,y).parse({name:Be,description:Si,maxInputTokens:128e3,maxOutputTokens:4092,roles:u,modalities:M,config:{def:i.responseSchema(4092,4).def,schema:i.responseSchema(4092,4).schema},price:_[Be]}),dn=d,Ue=class extends m{constructor(e){super(Jo,e);}};var je="gpt-4o-2024-08-06",xi="Latest snapshot of gpt-4o that supports Structured Outputs. Training data up to Oct 2023.",Wo=provider.ChatModelSchema(h,y).parse({name:je,description:xi,maxInputTokens:128e3,maxOutputTokens:4092,roles:u,modalities:M,config:{def:i.responseSchema(4092,4).def,schema:i.responseSchema(4092,4).schema},price:_[je]}),cn=d,Fe=class extends m{constructor(e){super(Wo,e);}};var $e="gpt-4o-mini-2024-07-18",Ai="Most advanced, multimodal flagship model that is cheaper and faster than GPT-4 Turbo. Currently points to gpt-4o-2024-05-13. Training data up to Oct 2023.",Yo=provider.ChatModelSchema(h,y).parse({name:$e,description:Ai,maxInputTokens:128e3,maxOutputTokens:4092,roles:u,modalities:M,config:{def:i.responseSchema(4092,4).def,schema:i.responseSchema(4092,4).schema},price:_[$e]}),hn=d,He=class extends m{constructor(e){super(Yo,e);}};var Ve="gpt-4o-mini",Ei="Most advanced, multimodal flagship model that is cheaper and faster than GPT-4 Turbo. Currently points to gpt-4o-2024-05-13. Training data up to Oct 2023.",Qo=provider.ChatModelSchema(h,y).parse({name:Ve,description:Ei,maxInputTokens:128e3,maxOutputTokens:4092,roles:u,modalities:M,config:{def:i.responseSchema(4092,4).def,schema:i.responseSchema(4092,4).schema},price:_[Ve]}),un=d,Ke=class extends m{constructor(e){super(Qo,e);}};var Je="gpt-4o",wi="Most advanced, multimodal flagship model that is cheaper and faster than GPT-4 Turbo. Currently points to gpt-4o-2024-05-13. Training data up to Oct 2023.",Xo=provider.ChatModelSchema(h,y).parse({name:Je,description:wi,maxInputTokens:128e3,maxOutputTokens:4092,roles:u,modalities:M,config:{def:i.responseSchema(4092,4).def,schema:i.responseSchema(4092,4).schema},price:_[Je]}),fn=d,We=class extends m{constructor(e){super(Xo,e);}};var Ye="o1-2024-12-17",Di="A stable release model for production use, offering robust performance and advanced features. Training data up to December 2024.",Zo=provider.ChatModelSchema(h,y).parse({name:Ye,description:Di,maxInputTokens:2e5,maxOutputTokens:1e5,roles:u,modalities:M,config:{def:i.oSeries(1e5,4).def,schema:i.oSeries(1e5,4).schema},price:_[Ye]}),_n=d,Qe=class extends m{constructor(e){super(Zo,e);}};var Xe="o1",qi="Highly capable general-purpose reasoning model with advanced capabilities in language, coding, and reasoning. Training data up to Oct 2023.",et=provider.ChatModelSchema(h,y).parse({name:Xe,description:qi,maxInputTokens:2e5,maxOutputTokens:1e5,roles:u,modalities:M,config:{def:i.oSeries(1e5,4).def,schema:i.oSeries(1e5,4).schema},price:_[Xe]}),gn=d,Ze=class extends m{constructor(e){super(et,e);}};var ot="o3-2025-04-16",zi="A new standard for math, science, coding, and visual reasoning tasks. Training data up to Jun 2024.",tt=provider.ChatModelSchema(h,y).parse({name:ot,description:zi,maxInputTokens:2e5,maxOutputTokens:1e5,roles:u,modalities:M,config:{def:i.oSeries(1e5,4).def,schema:i.oSeries(1e5,4).schema}}),Tn=d,eo=class extends m{constructor(e){super(tt,e);}};var nt="o3",Ui="A new standard for math, science, coding, and visual reasoning tasks. Training data up to Jun 2024.",st=provider.ChatModelSchema(h,y).parse({name:nt,description:Ui,maxInputTokens:2e5,maxOutputTokens:1e5,roles:u,modalities:M,config:{def:i.oSeries(1e5,4).def,schema:i.oSeries(1e5,4).schema}}),Mn=d,oo=class extends m{constructor(e){super(st,e);}};var it="o3-mini",Fi="o3-mini is the newest small reasoning model, providing high intelligence at the same cost and latency targets of o1-mini. Training data up to Sep 2023.",at=provider.ChatModelSchema(h,x).parse({name:it,description:Fi,maxInputTokens:2e5,maxOutputTokens:1e5,roles:u,modalities:I,config:{def:i.oSeries(1e5,4).def,schema:i.oSeries(1e5,4).schema}}),yn=d,to=class extends m{constructor(e){super(at,e);}};var rt="o3-mini-2025-01-31",Hi="o3-mini is the newest small reasoning model, providing high intelligence at the same cost and latency targets of o1-mini. Training data up to Sep 2023.",pt=provider.ChatModelSchema(h,x).parse({name:rt,description:Hi,maxInputTokens:2e5,maxOutputTokens:1e5,roles:u,modalities:I,config:{def:i.oSeries(1e5,4).def,schema:i.oSeries(1e5,4).schema}}),On=d,no=class extends m{constructor(e){super(pt,e);}};var lt="o4-mini-2025-04-16",Ki="Optimized for fast, effective reasoning with exceptionally efficient performance in coding and visual tasks. Training data up to Jun 2024.",mt=provider.ChatModelSchema(h,y).parse({name:lt,description:Ki,maxInputTokens:2e5,maxOutputTokens:1e5,roles:u,modalities:M,config:{def:i.oSeries(1e5,4).def,schema:i.oSeries(1e5,4).schema}}),Cn=d,so=class extends m{constructor(e){super(mt,e);}};var dt="o4-mini",Wi="Optimized for fast, effective reasoning with exceptionally efficient performance in coding and visual tasks. Training data up to Jun 2024.",ct=provider.ChatModelSchema(h,y).parse({name:dt,description:Wi,maxInputTokens:2e5,maxOutputTokens:1e5,roles:u,modalities:M,config:{def:i.oSeries(1e5,4).def,schema:i.oSeries(1e5,4).schema}}),bn=d,io=class extends m{constructor(e){super(ct,e);}};var W=[types.EmbeddingTextModalityLiteral,types.EmbeddingTokenModalityLiteral],Y=zod.z.enum([types.EmbeddingTextModalityLiteral,types.EmbeddingTokenModalityLiteral]);var Fn=zod.z.object({object:zod.z.literal("list"),model:zod.z.string(),data:zod.z.array(zod.z.object({index:zod.z.number(),object:zod.z.literal("embedding"),embedding:zod.z.array(zod.z.number()).or(zod.z.string().base64())})),usage:zod.z.object({prompt_tokens:zod.z.number().nonnegative(),total_tokens:zod.z.number().nonnegative()})});var Qi=zod.z.string().min(1).or(zod.z.array(zod.z.string().min(1)).min(1)).or(zod.z.array(zod.z.number().int().nonnegative()).min(1)).or(zod.z.array(zod.z.array(zod.z.number().int().nonnegative()).min(1)).min(1)),$n=zod.z.object({model:zod.z.string().min(1).optional(),input:Qi,encoding_format:zod.z.enum(["float","base64"]).optional(),dimensions:zod.z.number().int().min(1).optional()});var V=zod.z.object({modelName:zod.z.string(),apiKey:zod.z.string(),baseUrl:zod.z.string().url().optional(),getEmbeddingsUrl:zod.z.string().url().optional()}),B=class{constructor(e,n){this.version="v1";let o=V.parse(n);this.modelSchema=e,this.modelName=o.modelName,this.apiKey=o.apiKey,this.baseUrl=provider.urlWithoutTrailingSlash(o.baseUrl||$.baseUrl),this.getEmbeddingsUrl=provider.urlWithoutTrailingSlash(o.getEmbeddingsUrl||`${this.baseUrl}/embeddings`);}getDefaultBaseUrl(){return this.baseUrl}getDefaultHeaders(){return {Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"}}getDefaultParams(){return {model:this.modelSchema.name}}getRetryDelay(e){let n=r=>{let l=/(\d+)(h|m|s|ms)/g,T={h:36e5,m:6e4,s:1e3,ms:1},g,P=0;for(;(g=l.exec(r))!==null;){let O=parseInt(g[1]),C=g[2];P+=O*T[C];}return P},o=0,s=0,a=!0;e["x-ratelimit-reset-requests"]&&(o=n(e["x-ratelimit-reset-requests"])),e["x-ratelimit-reset-tokens"]&&(s=n(e["x-ratelimit-reset-tokens"]));let c=Math.max(o,s);return {shouldRetry:a,delayMs:c}}getTokenCount(e){return e.requests.reduce((n,o)=>n+o.length,0)}transformModelRequest(e){let n=$n.safeParse(e);if(!n.success)throw new provider.InvalidModelRequestError({info:"Invalid model request",cause:n.error});let o=n.data,s=o.model,a={encodingFormat:o.encoding_format,dimensions:o.dimensions},c=types.Config().parse(provider.removeUndefinedEntries(a)),r,l;return typeof o.input=="string"?l=types.EmbeddingTextModalityLiteral:typeof o.input[0]=="string"?l=types.EmbeddingTextModalityLiteral:l=types.EmbeddingTokenModalityLiteral,l===types.EmbeddingTextModalityLiteral?typeof o.input=="string"?r={modality:l,requests:[o.input]}:r={modality:l,requests:o.input}:typeof o.input[0]=="number"?r={modality:l,requests:[o.input]}:r={modality:l,requests:o.input},{modelName:s,config:c,embeddingRequests:r}}transformConfig(e,n){let o=this.modelSchema.config.schema.safeParse(e);if(!o.success)throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelSchema.name}'`,cause:o.error});let s=o.data;return Object.keys(s).forEach(c=>{if(!this.modelSchema.config.def[c])throw new provider.InvalidConfigError({info:`Invalid config for model : '${this.modelSchema.name}'`,cause:new Error(`Invalid config key : '${c}',
16
+ available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})}),Object.keys(s).reduce((c,r)=>{let T=this.modelSchema.config.def[r].param,g=s[r];return c[T]=g,c},{})}transformEmbeddingRequests(e){let n=types.EmbeddingRequests().safeParse(e);if(!n.success)throw new provider.InvalidEmbeddingRequestsError({info:"Invalid embedding requests",cause:n.error});return {input:n.data.requests}}getGetEmbeddingsUrl(e,n){return A(this,null,function*(){return new Promise(o=>{o(this.getEmbeddingsUrl);})})}getGetEmbeddingsHeaders(e,n){return A(this,null,function*(){return new Promise(o=>{o(this.getDefaultHeaders());})})}getGetEmbeddingsData(e,n){return A(this,null,function*(){return new Promise(o=>{o(b(b(b({},this.getDefaultParams()),this.transformConfig(e,n)),this.transformEmbeddingRequests(n)));})})}transformGetEmbeddingsResponse(e){let n,o=Fn.safeParse(e);if(o.success){let s=o.data;n=typeof s.data[0].embedding=="string"?types.Base64EmbeddingLiteral:types.FloatEmbeddingLiteral;let a=s.data.map(c=>typeof c.embedding=="string"?{index:c.index,embedding:c.embedding}:{index:c.index,embedding:c.embedding});return {encodingFormat:n,embeddings:a,usage:{totalTokens:s.usage.total_tokens}}}throw new provider.ModelResponseError({info:"Invalid response from model",cause:o.error})}};var ht="text-embedding-ada-002",pa="Most capable 2nd generation embedding model, replacing 16 first generation models",ut=provider.EmbeddingModelSchema(Y).parse({name:ht,description:pa,modalities:W,maxInputTokens:8192,maxOutputTokens:1536,config:{def:D.base().def,schema:D.base().schema}}),Pn=V,ao=class extends B{constructor(e){super(ut,e);}};var ft="text-embedding-3-small",ma="Increased performance over 2nd generation ada embedding model",_t=provider.EmbeddingModelSchema(Y).parse({name:ft,description:ma,modalities:W,maxInputTokens:8192,maxOutputTokens:1536,config:{def:D.dimensions(1536).def,schema:D.dimensions(1536).schema}}),Sn=V,ro=class extends B{constructor(e){super(_t,e);}};var gt="text-embedding-3-large",ca="Most capable embedding model for both english and non-english tasks",Tt=provider.EmbeddingModelSchema(Y).parse({name:gt,description:ca,modalities:W,maxInputTokens:8192,maxOutputTokens:3072,config:{def:D.dimensions(3072).def,schema:D.dimensions(3072).schema}}),In=V,po=class extends B{constructor(e){super(Tt,e);}};
17
17
 
18
- exports.BaseChatModel = d;
19
- exports.BaseChatModelOptions = h;
18
+ exports.BaseChatModel = m;
19
+ exports.BaseChatModelOptions = d;
20
20
  exports.BaseEmbeddingModel = B;
21
21
  exports.BaseEmbeddingModelOptions = V;
22
22
  exports.ChatModelBaseConfigDef = z;
23
23
  exports.ChatModelBaseConfigSchema = N;
24
- exports.ChatModelGPT5ConfigDef = At;
25
- exports.ChatModelGPT5ConfigSchema = Et;
26
- exports.ChatModelOSeriesConfigDef = vt;
27
- exports.ChatModelOSeriesConfigSchema = Dt;
28
- exports.ChatModelResponseFormatConfigDef = Nt;
29
- exports.ChatModelResponseFormatConfigSchema = zt;
24
+ exports.ChatModelGPT5ConfigDef = kt;
25
+ exports.ChatModelGPT5ConfigSchema = wt;
26
+ exports.ChatModelOSeriesConfigDef = qt;
27
+ exports.ChatModelOSeriesConfigSchema = Nt;
28
+ exports.ChatModelResponseFormatConfigDef = Ut;
29
+ exports.ChatModelResponseFormatConfigSchema = jt;
30
30
  exports.ChatModelResponseSchemaConfigDef = j;
31
31
  exports.ChatModelResponseSchemaConfigSchema = F;
32
32
  exports.EmbeddingModelBaseConfigDef = ne;
33
33
  exports.EmbeddingModelBaseConfigSchema = te;
34
- exports.EmbeddingModelDimensionsConfigDef = Ut;
35
- exports.EmbeddingModelDimensionsConfigSchema = Bt;
34
+ exports.EmbeddingModelDimensionsConfigDef = $t;
35
+ exports.EmbeddingModelDimensionsConfigSchema = Ft;
36
36
  exports.GPT_3_5_Turbo = le;
37
37
  exports.GPT_3_5_TurboLiteral = pe;
38
- exports.GPT_3_5_TurboOptions = Ht;
39
- exports.GPT_3_5_TurboSchema = Eo;
38
+ exports.GPT_3_5_TurboOptions = Jt;
39
+ exports.GPT_3_5_TurboSchema = ko;
40
40
  exports.GPT_3_5_Turbo_0125 = ie;
41
41
  exports.GPT_3_5_Turbo_0125Literal = se;
42
- exports.GPT_3_5_Turbo_0125Options = Ft;
43
- exports.GPT_3_5_Turbo_0125Schema = Ro;
42
+ exports.GPT_3_5_Turbo_0125Options = Vt;
43
+ exports.GPT_3_5_Turbo_0125Schema = Go;
44
44
  exports.GPT_3_5_Turbo_1106 = re;
45
45
  exports.GPT_3_5_Turbo_1106Literal = ae;
46
- exports.GPT_3_5_Turbo_1106Options = $t;
47
- exports.GPT_3_5_Turbo_1106Schema = Ao;
48
- exports.GPT_4 = qe;
49
- exports.GPT_4Literal = Le;
50
- exports.GPT_4Options = an;
51
- exports.GPT_4Schema = $o;
46
+ exports.GPT_3_5_Turbo_1106Options = Kt;
47
+ exports.GPT_3_5_Turbo_1106Schema = Eo;
48
+ exports.GPT_4 = ze;
49
+ exports.GPT_4Literal = Ne;
50
+ exports.GPT_4Options = mn;
51
+ exports.GPT_4Schema = Ko;
52
52
  exports.GPT_4_0125_Preview = de;
53
53
  exports.GPT_4_0125_PreviewLiteral = me;
54
- exports.GPT_4_0125_PreviewOptions = Vt;
55
- exports.GPT_4_0125_PreviewSchema = Go;
54
+ exports.GPT_4_0125_PreviewOptions = Wt;
55
+ exports.GPT_4_0125_PreviewSchema = wo;
56
56
  exports.GPT_4_0613 = he;
57
57
  exports.GPT_4_0613Literal = ce;
58
- exports.GPT_4_0613Options = Kt;
59
- exports.GPT_4_0613Schema = ko;
58
+ exports.GPT_4_0613Options = Yt;
59
+ exports.GPT_4_0613Schema = vo;
60
60
  exports.GPT_4_1 = ge;
61
61
  exports.GPT_4_1106_Preview = fe;
62
62
  exports.GPT_4_1106_PreviewLiteral = ue;
63
- exports.GPT_4_1106_PreviewOptions = Jt;
64
- exports.GPT_4_1106_PreviewSchema = wo;
63
+ exports.GPT_4_1106_PreviewOptions = Qt;
64
+ exports.GPT_4_1106_PreviewSchema = Do;
65
65
  exports.GPT_4_1Literal = _e;
66
- exports.GPT_4_1Options = Wt;
67
- exports.GPT_4_1Schema = vo;
66
+ exports.GPT_4_1Options = Xt;
67
+ exports.GPT_4_1Schema = Lo;
68
68
  exports.GPT_4_1_Mini = Me;
69
69
  exports.GPT_4_1_MiniLiteral = Te;
70
- exports.GPT_4_1_MiniOptions = Yt;
71
- exports.GPT_4_1_MiniSchema = Do;
70
+ exports.GPT_4_1_MiniOptions = Zt;
71
+ exports.GPT_4_1_MiniSchema = qo;
72
72
  exports.GPT_4_1_Nano = Oe;
73
73
  exports.GPT_4_1_NanoLiteral = ye;
74
- exports.GPT_4_1_NanoOptions = Qt;
75
- exports.GPT_4_1_NanoSchema = Lo;
76
- exports.GPT_4_Turbo = De;
77
- exports.GPT_4_TurboLiteral = ve;
78
- exports.GPT_4_TurboOptions = sn;
79
- exports.GPT_4_TurboSchema = Fo;
80
- exports.GPT_4_Turbo_2024_04_09 = Ge;
81
- exports.GPT_4_Turbo_2024_04_09Literal = Ee;
82
- exports.GPT_4_Turbo_2024_04_09Options = tn;
83
- exports.GPT_4_Turbo_2024_04_09Schema = Uo;
84
- exports.GPT_4_Turbo_Preview = we;
85
- exports.GPT_4_Turbo_PreviewLiteral = ke;
86
- exports.GPT_4_Turbo_PreviewOptions = nn;
87
- exports.GPT_4_Turbo_PreviewSchema = jo;
88
- exports.GPT_4o = Ke;
89
- exports.GPT_4oLiteral = Ve;
90
- exports.GPT_4oOptions = dn;
91
- exports.GPT_4oSchema = Wo;
92
- exports.GPT_4o_2024_05_13 = ze;
93
- exports.GPT_4o_2024_05_13Literal = Ne;
94
- exports.GPT_4o_2024_05_13Options = rn;
95
- exports.GPT_4o_2024_05_13Schema = Ho;
96
- exports.GPT_4o_2024_08_06 = Ue;
97
- exports.GPT_4o_2024_08_06Literal = Be;
98
- exports.GPT_4o_2024_08_06Options = pn;
99
- exports.GPT_4o_2024_08_06Schema = Vo;
100
- exports.GPT_4o_Mini = He;
101
- exports.GPT_4o_MiniLiteral = $e;
102
- exports.GPT_4o_MiniOptions = mn;
103
- exports.GPT_4o_MiniSchema = Jo;
104
- exports.GPT_4o_Mini_2024_07_18 = Fe;
105
- exports.GPT_4o_Mini_2024_07_18Literal = je;
106
- exports.GPT_4o_Mini_2024_07_18Options = ln;
107
- exports.GPT_4o_Mini_2024_07_18Schema = Ko;
108
- exports.GPT_5 = be;
109
- exports.GPT_5Literal = Ce;
110
- exports.GPT_5Options = Xt;
111
- exports.GPT_5Schema = qo;
112
- exports.GPT_5_ChatLatest = Ae;
113
- exports.GPT_5_ChatLatestLiteral = Re;
114
- exports.GPT_5_ChatLatestOptions = on;
115
- exports.GPT_5_ChatLatestSchema = Bo;
116
- exports.GPT_5_Mini = Se;
117
- exports.GPT_5_MiniLiteral = Pe;
118
- exports.GPT_5_MiniOptions = Zt;
119
- exports.GPT_5_MiniSchema = No;
120
- exports.GPT_5_Nano = xe;
121
- exports.GPT_5_NanoLiteral = Ie;
122
- exports.GPT_5_NanoOptions = en;
123
- exports.GPT_5_NanoSchema = zo;
124
- exports.O1 = Qe;
125
- exports.O1Literal = Ye;
126
- exports.O1Options = hn;
127
- exports.O1Schema = Qo;
128
- exports.O1_2024_12_17 = We;
129
- exports.O1_2024_12_17Literal = Je;
130
- exports.O1_2024_12_17Options = cn;
131
- exports.O1_2024_12_17Schema = Yo;
132
- exports.O3 = Ze;
133
- exports.O3Literal = et;
134
- exports.O3Mini = eo;
135
- exports.O3Mini2025_01_31 = oo;
136
- exports.O3Mini2025_01_31Literal = st;
137
- exports.O3Mini2025_01_31Options = gn;
138
- exports.O3Mini2025_01_31Schema = it;
139
- exports.O3MiniLiteral = tt;
140
- exports.O3MiniOptions = _n;
141
- exports.O3MiniSchema = nt;
142
- exports.O3Options = fn;
143
- exports.O3Schema = ot;
144
- exports.O3_2025_04_16 = Xe;
145
- exports.O3_2025_04_16Literal = Xo;
146
- exports.O3_2025_04_16Options = un;
147
- exports.O3_2025_04_16Schema = Zo;
148
- exports.O4_Mini = no;
149
- exports.O4_MiniLiteral = pt;
150
- exports.O4_MiniOptions = Mn;
151
- exports.O4_MiniSchema = lt;
152
- exports.O4_Mini_2025_04_16 = to;
153
- exports.O4_Mini_2025_04_16Literal = at;
154
- exports.O4_Mini_2025_04_16Options = Tn;
155
- exports.O4_Mini_2025_04_16Schema = rt;
74
+ exports.GPT_4_1_NanoOptions = en;
75
+ exports.GPT_4_1_NanoSchema = No;
76
+ exports.GPT_4_Turbo = qe;
77
+ exports.GPT_4_TurboLiteral = Le;
78
+ exports.GPT_4_TurboOptions = ln;
79
+ exports.GPT_4_TurboSchema = Vo;
80
+ exports.GPT_4_Turbo_2024_04_09 = we;
81
+ exports.GPT_4_Turbo_2024_04_09Literal = ke;
82
+ exports.GPT_4_Turbo_2024_04_09Options = rn;
83
+ exports.GPT_4_Turbo_2024_04_09Schema = $o;
84
+ exports.GPT_4_Turbo_Preview = De;
85
+ exports.GPT_4_Turbo_PreviewLiteral = ve;
86
+ exports.GPT_4_Turbo_PreviewOptions = pn;
87
+ exports.GPT_4_Turbo_PreviewSchema = Ho;
88
+ exports.GPT_4o = We;
89
+ exports.GPT_4oLiteral = Je;
90
+ exports.GPT_4oOptions = fn;
91
+ exports.GPT_4oSchema = Xo;
92
+ exports.GPT_4o_2024_05_13 = Ue;
93
+ exports.GPT_4o_2024_05_13Literal = Be;
94
+ exports.GPT_4o_2024_05_13Options = dn;
95
+ exports.GPT_4o_2024_05_13Schema = Jo;
96
+ exports.GPT_4o_2024_08_06 = Fe;
97
+ exports.GPT_4o_2024_08_06Literal = je;
98
+ exports.GPT_4o_2024_08_06Options = cn;
99
+ exports.GPT_4o_2024_08_06Schema = Wo;
100
+ exports.GPT_4o_Mini = Ke;
101
+ exports.GPT_4o_MiniLiteral = Ve;
102
+ exports.GPT_4o_MiniOptions = un;
103
+ exports.GPT_4o_MiniSchema = Qo;
104
+ exports.GPT_4o_Mini_2024_07_18 = He;
105
+ exports.GPT_4o_Mini_2024_07_18Literal = $e;
106
+ exports.GPT_4o_Mini_2024_07_18Options = hn;
107
+ exports.GPT_4o_Mini_2024_07_18Schema = Yo;
108
+ exports.GPT_5 = Se;
109
+ exports.GPT_5Literal = Pe;
110
+ exports.GPT_5Options = tn;
111
+ exports.GPT_5Schema = Bo;
112
+ exports.GPT_5_1 = be;
113
+ exports.GPT_5_1Literal = Ce;
114
+ exports.GPT_5_1Options = on;
115
+ exports.GPT_5_1Schema = zo;
116
+ exports.GPT_5_ChatLatest = Ee;
117
+ exports.GPT_5_ChatLatestLiteral = Ge;
118
+ exports.GPT_5_ChatLatestOptions = an;
119
+ exports.GPT_5_ChatLatestSchema = Fo;
120
+ exports.GPT_5_Mini = xe;
121
+ exports.GPT_5_MiniLiteral = Ie;
122
+ exports.GPT_5_MiniOptions = nn;
123
+ exports.GPT_5_MiniSchema = Uo;
124
+ exports.GPT_5_Nano = Ae;
125
+ exports.GPT_5_NanoLiteral = Re;
126
+ exports.GPT_5_NanoOptions = sn;
127
+ exports.GPT_5_NanoSchema = jo;
128
+ exports.O1 = Ze;
129
+ exports.O1Literal = Xe;
130
+ exports.O1Options = gn;
131
+ exports.O1Schema = et;
132
+ exports.O1_2024_12_17 = Qe;
133
+ exports.O1_2024_12_17Literal = Ye;
134
+ exports.O1_2024_12_17Options = _n;
135
+ exports.O1_2024_12_17Schema = Zo;
136
+ exports.O3 = oo;
137
+ exports.O3Literal = nt;
138
+ exports.O3Mini = to;
139
+ exports.O3Mini2025_01_31 = no;
140
+ exports.O3Mini2025_01_31Literal = rt;
141
+ exports.O3Mini2025_01_31Options = On;
142
+ exports.O3Mini2025_01_31Schema = pt;
143
+ exports.O3MiniLiteral = it;
144
+ exports.O3MiniOptions = yn;
145
+ exports.O3MiniSchema = at;
146
+ exports.O3Options = Mn;
147
+ exports.O3Schema = st;
148
+ exports.O3_2025_04_16 = eo;
149
+ exports.O3_2025_04_16Literal = ot;
150
+ exports.O3_2025_04_16Options = Tn;
151
+ exports.O3_2025_04_16Schema = tt;
152
+ exports.O4_Mini = io;
153
+ exports.O4_MiniLiteral = dt;
154
+ exports.O4_MiniOptions = bn;
155
+ exports.O4_MiniSchema = ct;
156
+ exports.O4_Mini_2025_04_16 = so;
157
+ exports.O4_Mini_2025_04_16Literal = lt;
158
+ exports.O4_Mini_2025_04_16Options = Cn;
159
+ exports.O4_Mini_2025_04_16Schema = mt;
156
160
  exports.OpenAI = $;
157
161
  exports.OpenAIChatModelConfigs = i;
158
162
  exports.OpenAIChatModelModalities = M;
159
163
  exports.OpenAIChatModelModalitiesEnum = y;
160
- exports.OpenAIChatModelRoles = u;
161
- exports.OpenAIChatModelRolesMap = f;
162
- exports.OpenAIChatModelTextModalities = nr;
163
- exports.OpenAIChatModelTextModalitiesEnum = sr;
164
+ exports.OpenAIChatModelRoles = h;
165
+ exports.OpenAIChatModelRolesMap = u;
166
+ exports.OpenAIChatModelTextModalities = lr;
167
+ exports.OpenAIChatModelTextModalitiesEnum = mr;
164
168
  exports.OpenAIChatModelTextToolModalities = I;
165
169
  exports.OpenAIChatModelTextToolModalitiesEnum = x;
166
- exports.OpenAIChatRequest = Gn;
167
- exports.OpenAIChatRequestAssistantMessage = ys;
168
- exports.OpenAIChatRequestImageContent = _s;
169
- exports.OpenAIChatRequestMessage = Cs;
170
- exports.OpenAIChatRequestResponseFormat = fs;
171
- exports.OpenAIChatRequestSystemMessage = Ts;
172
- exports.OpenAIChatRequestTextContent = gt;
173
- exports.OpenAIChatRequestTool = cs;
174
- exports.OpenAIChatRequestToolCallContent = gs;
175
- exports.OpenAIChatRequestToolChoiceEnum = hs;
176
- exports.OpenAIChatRequestToolChoiceFunction = us;
177
- exports.OpenAIChatRequestToolMessage = Os;
178
- exports.OpenAIChatRequestUserMessage = Ms;
179
- exports.OpenAICompleteChatResponse = An;
170
+ exports.OpenAIChatRequest = Dn;
171
+ exports.OpenAIChatRequestAssistantMessage = Ps;
172
+ exports.OpenAIChatRequestImageContent = ys;
173
+ exports.OpenAIChatRequestMessage = Is;
174
+ exports.OpenAIChatRequestResponseFormat = Ms;
175
+ exports.OpenAIChatRequestSystemMessage = Cs;
176
+ exports.OpenAIChatRequestTextContent = yt;
177
+ exports.OpenAIChatRequestTool = _s;
178
+ exports.OpenAIChatRequestToolCallContent = Os;
179
+ exports.OpenAIChatRequestToolChoiceEnum = gs;
180
+ exports.OpenAIChatRequestToolChoiceFunction = Ts;
181
+ exports.OpenAIChatRequestToolMessage = Ss;
182
+ exports.OpenAIChatRequestUserMessage = bs;
183
+ exports.OpenAICompleteChatResponse = wn;
180
184
  exports.OpenAIEmbeddingModelConfigs = D;
181
185
  exports.OpenAIEmbeddingModelModalities = W;
182
186
  exports.OpenAIEmbeddingModelModalitiesEnum = Y;
183
- exports.OpenAIEmbeddingRequest = Bn;
184
- exports.OpenAIEmbeddingRequestInput = Hi;
185
- exports.OpenAIGetEmbeddingsResponse = zn;
186
- exports.OpenAIStreamChatResponse = En;
187
- exports.OpenAIToolCallsCompleteChatResponse = ms;
188
- exports.OpenAIToolCallsStreamChatResponse = ds;
189
- exports.ProviderLiteral = ps;
190
- exports.Text_Embedding_3_Large = ao;
191
- exports.Text_Embedding_3_LargeLiteral = ut;
192
- exports.Text_Embedding_3_LargeSchema = ft;
193
- exports.Text_Embedding_3_Large_Options = Cn;
194
- exports.Text_Embedding_3_Small = io;
195
- exports.Text_Embedding_3_SmallLiteral = ct;
196
- exports.Text_Embedding_3_SmallSchema = ht;
197
- exports.Text_Embedding_3_Small_Options = On;
198
- exports.Text_Embedding_Ada002 = so;
199
- exports.Text_Embedding_Ada002Literal = mt;
200
- exports.Text_Embedding_Ada002Schema = dt;
201
- exports.Text_Embedding_Ada002_Options = yn;
202
- exports.dimensions = xo;
203
- exports.encodingFormat = Io;
204
- exports.frequencyPenalty = To;
205
- exports.logProbs = Oo;
206
- exports.maxTokens = fo;
207
- exports.presencePenalty = Mo;
208
- exports.reasoningEffort = Po;
209
- exports.seed = yo;
210
- exports.stop = _o;
211
- exports.temperature = uo;
212
- exports.toolChoice = bo;
213
- exports.topLogProbs = Co;
214
- exports.topP = go;
215
- exports.verbosity = So;
187
+ exports.OpenAIEmbeddingRequest = $n;
188
+ exports.OpenAIEmbeddingRequestInput = Qi;
189
+ exports.OpenAIGetEmbeddingsResponse = Fn;
190
+ exports.OpenAIStreamChatResponse = vn;
191
+ exports.OpenAIToolCallsCompleteChatResponse = us;
192
+ exports.OpenAIToolCallsStreamChatResponse = fs;
193
+ exports.ProviderLiteral = cs;
194
+ exports.Text_Embedding_3_Large = po;
195
+ exports.Text_Embedding_3_LargeLiteral = gt;
196
+ exports.Text_Embedding_3_LargeSchema = Tt;
197
+ exports.Text_Embedding_3_Large_Options = In;
198
+ exports.Text_Embedding_3_Small = ro;
199
+ exports.Text_Embedding_3_SmallLiteral = ft;
200
+ exports.Text_Embedding_3_SmallSchema = _t;
201
+ exports.Text_Embedding_3_Small_Options = Sn;
202
+ exports.Text_Embedding_Ada002 = ao;
203
+ exports.Text_Embedding_Ada002Literal = ht;
204
+ exports.Text_Embedding_Ada002Schema = ut;
205
+ exports.Text_Embedding_Ada002_Options = Pn;
206
+ exports.dimensions = Ao;
207
+ exports.encodingFormat = Ro;
208
+ exports.frequencyPenalty = yo;
209
+ exports.logProbs = bo;
210
+ exports.maxTokens = go;
211
+ exports.presencePenalty = Oo;
212
+ exports.reasoningEffort = Io;
213
+ exports.seed = Co;
214
+ exports.stop = To;
215
+ exports.temperature = _o;
216
+ exports.toolChoice = So;
217
+ exports.topLogProbs = Po;
218
+ exports.topP = Mo;
219
+ exports.verbosity = xo;
216
220
  //# sourceMappingURL=index.js.map
217
221
  //# sourceMappingURL=index.js.map