@adaline/anthropic 1.13.7 → 1.13.10

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
@@ -2,162 +2,198 @@
2
2
 
3
3
  var zod = require('zod');
4
4
 
5
- var ma=Object.defineProperty,ca=Object.defineProperties;var ua=Object.getOwnPropertyDescriptors;var fo=Object.getOwnPropertySymbols;var ga=Object.prototype.hasOwnProperty,ha=Object.prototype.propertyIsEnumerable;var ge=(o,t)=>(t=Symbol[o])?t:Symbol.for("Symbol."+o),ya=o=>{throw TypeError(o)};var Co=(o,t,n)=>t in o?ma(o,t,{enumerable:true,configurable:true,writable:true,value:n}):o[t]=n,R=(o,t)=>{for(var n in t||(t={}))ga.call(t,n)&&Co(o,n,t[n]);if(fo)for(var n of fo(t))ha.call(t,n)&&Co(o,n,t[n]);return o},J=(o,t)=>ca(o,ua(t));var j=(o,t,n)=>new Promise((a,i)=>{var d=l=>{try{m(n.next(l));}catch(g){i(g);}},p=l=>{try{m(n.throw(l));}catch(g){i(g);}},m=l=>l.done?a(l.value):Promise.resolve(l.value).then(d,p);m((n=n.apply(o,t)).next());}),To=function(o,t){this[0]=o,this[1]=t;},at=(o,t,n)=>{var a=(p,m,l,g)=>{try{var u=n[p](m),M=(m=u.value)instanceof To,S=u.done;Promise.resolve(M?m[0]:m).then(q=>M?a(p==="return"?p:"next",m[1]?{done:q.done,value:q.value}:q,l,g):l({value:q,done:S})).catch(q=>a("throw",q,l,g));}catch(q){g(q);}},i=p=>d[p]=m=>new Promise((l,g)=>a(p,m,l,g)),d={};return n=n.apply(o,t),d[ge("asyncIterator")]=()=>d,i("next"),i("throw"),i("return"),d},bo=o=>{var t=o[ge("asyncIterator")],n=false,a,i={};return t==null?(t=o[ge("iterator")](),a=d=>i[d]=p=>t[d](p)):(t=t.call(o),a=d=>i[d]=p=>{if(n){if(n=false,d==="throw")throw p;return p}return n=true,{done:false,value:new To(new Promise(m=>{var l=t[d](p);l instanceof Object||ya("Object expected"),m(l);}),1)}}),i[ge("iterator")]=()=>i,a("next"),"throw"in t?a("throw"):i.throw=d=>{throw d},"return"in t&&a("return"),i};var ne="system",Y="user",O="assistant",pe="tool",fa=[ne,Y,O,pe],rt=zod.z.enum(fa),Ca=[O],Ta=zod.z.enum(Ca),So="error",xo="safety",ba=zod.z.object({type:zod.z.literal(xo),value:zod.z.object({category:zod.z.string(),probability:zod.z.string(),blocked:zod.z.boolean(),message:zod.z.string()})}),vo="response_error",Ma=zod.z.object({type:zod.z.literal(vo),value:zod.z.object({code:zod.z.string(),message:zod.z.string(),provider:zod.z.string().optional()})}),ka=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(So),value:zod.z.discriminatedUnion("type",[ba,Ma]),metadata:o}),Oo="partial-error",Ra=zod.z.object({type:zod.z.literal(xo),category:zod.z.string().optional(),probability:zod.z.string().optional(),blocked:zod.z.boolean().optional(),message:zod.z.string().optional()}),Sa=zod.z.object({type:zod.z.literal(vo),code:zod.z.string().optional(),message:zod.z.string().optional(),provider:zod.z.string().optional()}),xa=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(Oo),value:zod.z.discriminatedUnion("type",[Ra,Sa]),metadata:o}),W="image",lt="base64",va=["png","jpeg","webp","gif"],Oa=zod.z.object({type:zod.z.literal(lt),base64:zod.z.string(),mediaType:zod.z.enum(va)}),_a="url",Ea=zod.z.object({type:zod.z.literal(_a),url:zod.z.string()}),Aa=zod.z.discriminatedUnion("type",[Oa,Ea]),Pa=["low","medium","high","auto"],wa=zod.z.enum(Pa),qa=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(W),detail:wa,value:Aa,metadata:o}),_o="pdf",ja="base64",Ia=zod.z.object({type:zod.z.literal(ja),base64:zod.z.string()}),La="url",Ba=zod.z.object({type:zod.z.literal(La),url:zod.z.string()}),Ua=zod.z.discriminatedUnion("type",[Ia,Ba]),Na=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(_o),value:Ua,file:zod.z.object({name:zod.z.string(),id:zod.z.string(),size:zod.z.number().optional()}),metadata:o}),Z="reasoning",he="partial-reasoning",ye="thinking",pt="redacted",st=zod.z.object({type:zod.z.literal(ye),thinking:zod.z.string(),signature:zod.z.string()}),Eo=zod.z.object({type:zod.z.literal(pt),data:zod.z.string()}),Da=zod.z.discriminatedUnion("type",[st,Eo]),dt=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(Z),value:Da,metadata:o}),za=zod.z.object({type:zod.z.literal(ye),thinking:st.shape.thinking.optional(),signature:st.shape.signature.optional()}),Va=zod.z.discriminatedUnion("type",[za,Eo]),mt=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(he),value:Va,metadata:o}),Ao="search-result",$a=zod.z.object({type:zod.z.string().optional(),query:zod.z.string(),responses:zod.z.array(zod.z.object({source:zod.z.string(),url:zod.z.string(),title:zod.z.string(),snippet:zod.z.string().optional()})),references:zod.z.array(zod.z.object({text:zod.z.string(),responseIndices:zod.z.array(zod.z.number()),startIndex:zod.z.number().optional(),endIndex:zod.z.number().optional(),confidenceScores:zod.z.array(zod.z.number()).optional()}))}),Fa=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(Ao),value:$a,metadata:o}),Po="partial-search-result",Ha=zod.z.object({type:zod.z.string().optional(),query:zod.z.string().optional(),responses:zod.z.array(zod.z.object({source:zod.z.string().optional(),url:zod.z.string().optional(),title:zod.z.string().optional(),snippet:zod.z.string().optional()})).optional(),references:zod.z.array(zod.z.object({text:zod.z.string().optional(),responseIndices:zod.z.array(zod.z.number()).optional(),startIndex:zod.z.number().optional(),endIndex:zod.z.number().optional(),confidenceScores:zod.z.array(zod.z.number()).optional()})).optional()}),Ka=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(Po),value:Ha,metadata:o}),E="text",wo=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(E),value:zod.z.string(),metadata:o}),ct="partial-text",qo=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(ct),value:zod.z.string(),metadata:o}),U="tool-call",jo=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(U),index:zod.z.number().int().nonnegative(),id:zod.z.string().min(1),name:zod.z.string().min(1),arguments:zod.z.string(),serverName:zod.z.string().optional(),thoughtSignature:zod.z.string().optional(),metadata:o}),ut="partial-tool-call",Io=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(ut),index:zod.z.number().int().nonnegative(),id:zod.z.string().optional(),name:zod.z.string().optional(),arguments:zod.z.string().optional(),serverName:zod.z.string().optional(),thoughtSignature:zod.z.string().optional(),metadata:o}),z="tool-response",Lo=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(z),index:zod.z.number().int().nonnegative(),id:zod.z.string().min(1),name:zod.z.string().min(1),data:zod.z.string(),apiResponse:zod.z.object({statusCode:zod.z.number().int().nonnegative()}).optional(),metadata:o}),Bo="partial-tool-response",Uo=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(Bo),index:zod.z.number().int().nonnegative(),id:zod.z.string().optional(),name:zod.z.string().optional(),data:zod.z.string().optional(),apiResponse:zod.z.object({statusCode:zod.z.number().int().nonnegative()}).optional(),metadata:o}),Ga=[E,W,_o,U,z,Z,So,Ao],No=zod.z.enum(Ga),Ja=(o=zod.z.undefined(),t=zod.z.undefined(),n=zod.z.undefined(),a=zod.z.undefined(),i=zod.z.undefined(),d=zod.z.undefined(),p=zod.z.undefined(),m=zod.z.undefined())=>zod.z.discriminatedUnion("modality",[wo(o),qa(t),Na(n),jo(a),Lo(i),dt(d),ka(p),Fa(m)]),Wa=[ct,ut,he,Oo,Po];zod.z.enum(Wa);var Za=(o=zod.z.undefined(),t=zod.z.undefined(),n=zod.z.undefined(),a=zod.z.undefined(),i=zod.z.undefined(),d=zod.z.undefined())=>zod.z.discriminatedUnion("modality",[qo(o),Io(t),mt(a),Uo(n),xa(i),Ka(d)]);var gt=(o=rt,t=zod.z.undefined(),n=zod.z.undefined(),a=zod.z.undefined(),i=zod.z.undefined(),d=zod.z.undefined(),p=zod.z.undefined(),m=zod.z.undefined())=>zod.z.object({role:o,content:zod.z.array(Ja(t,n,a,i,p,d)),metadata:m}),se=(o=Ta,t=zod.z.undefined(),n=zod.z.undefined(),a=zod.z.undefined(),i=zod.z.undefined(),d=zod.z.undefined())=>zod.z.object({role:o,partialContent:Za(t,n,a,d),metadata:i}),Xa=zod.z.object({promptTokens:zod.z.number().nonnegative(),completionTokens:zod.z.number().nonnegative(),totalTokens:zod.z.number().nonnegative()}),Mo=zod.z.object({token:zod.z.string(),logProb:zod.z.number(),bytes:zod.z.array(zod.z.number().int()).nullable()}),Ya=Mo.extend({topLogProbs:zod.z.array(Mo)}),Do=zod.z.array(Ya);zod.z.object({messages:zod.z.array(gt()),usage:Xa.optional(),logProbs:Do.optional()});var Qa=zod.z.object({promptTokens:zod.z.number().nonnegative().optional(),completionTokens:zod.z.number().nonnegative().optional(),totalTokens:zod.z.number().nonnegative().optional()});zod.z.object({partialMessages:zod.z.array(se()),usage:Qa.optional(),logProbs:Do.optional()});var fe=(o=zod.z.record(zod.z.string(),zod.z.any()).optional())=>o,ei=zod.z.object({enabled:zod.z.boolean().default(true),allowedTools:zod.z.array(zod.z.string().min(1))}),zo=zod.z.object({type:zod.z.literal("url"),url:zod.z.string().url().refine(o=>o.startsWith("https://"),{message:"MCP server URL must start with https://"}),name:zod.z.string().min(1),toolConfiguration:ei.optional(),authorizationToken:zod.z.string().min(1).optional()}),ti=["object","array","number","string","boolean","enum"],ko=zod.z.enum(ti),oi=zod.z.object({anyOf:zod.z.array(zod.z.any()).optional(),type:zod.z.union([ko,zod.z.array(zod.z.union([ko,zod.z.literal("null")]))]).optional(),default:zod.z.any().optional(),title:zod.z.string().optional(),description:zod.z.string().max(4096).optional(),properties:zod.z.record(zod.z.any()).optional(),required:zod.z.array(zod.z.string()).optional(),minItems:zod.z.number().int().min(0).optional(),maxItems:zod.z.number().int().optional(),items:zod.z.record(zod.z.any()).optional(),enum:zod.z.array(zod.z.union([zod.z.string(),zod.z.number(),zod.z.boolean(),zod.z.null()])).optional(),minimum:zod.z.number().optional(),maximum:zod.z.number().optional(),minLength:zod.z.number().int().min(0).optional(),maxLength:zod.z.number().int().optional(),$ref:zod.z.string().optional()}),ni=zod.z.object({type:zod.z.enum(["object"]),required:zod.z.array(zod.z.string()),$defs:zod.z.record(zod.z.any()).optional(),properties:zod.z.record(oi),additionalProperties:zod.z.literal(false)});zod.z.object({name:zod.z.string().regex(/^[a-zA-Z0-9_]{1,64}$/).max(64),description:zod.z.string().max(4096),strict:zod.z.boolean().optional(),schema:ni}).optional();var Q="text",Vo="token",ai=[Q,Vo],$o=zod.z.enum(ai),ii=zod.z.array(zod.z.string().min(1)),si=zod.z.array(zod.z.array(zod.z.number().int().nonnegative())),Fo=(o=zod.z.undefined())=>zod.z.discriminatedUnion("modality",[zod.z.object({modality:zod.z.literal(Q),metadata:o,requests:ii}),zod.z.object({modality:zod.z.literal(Vo),metadata:o,requests:si})]),ht="float",ri=zod.z.object({index:zod.z.number().int().nonnegative(),embedding:zod.z.array(zod.z.number())}),yt="base64",li=zod.z.object({index:zod.z.number().int().nonnegative(),embedding:zod.z.string().base64()}),Ro=zod.z.object({totalTokens:zod.z.number().int().nonnegative()});zod.z.discriminatedUnion("encodingFormat",[zod.z.object({encodingFormat:zod.z.literal(ht),embeddings:zod.z.array(ri),usage:Ro.optional()}),zod.z.object({encodingFormat:zod.z.literal(yt),embeddings:zod.z.array(li),usage:Ro.optional()})]);var pi=o=>{let t=new WeakSet;return JSON.stringify(o,(n,a)=>{if(typeof a=="object"&&a!==null){if(t.has(a))return;t.add(a);}return a})},di=o=>o==null?"unknown error":typeof o=="string"?o:o instanceof Error?o.message:pi(o),it="GatewayBaseError",ee=class Ho extends Error{constructor({info:t,cause:n},a){super(`[${a!=null?a:it}]: ${t}
6
- Message: ${di(n)}`),this.name=it,this.info=t,this.cause=n,this.name=a!=null?a:it,Object.setPrototypeOf(this,new.target.prototype);}static isGatewayBaseError(t){return t instanceof Ho}toJSON(){return {name:this.name,info:this.info,cause:this.cause,message:this.message,stack:this.stack}}},mi=zod.z.object({inputPricePerMillion:zod.z.number().nonnegative().describe("Price per 1M input tokens"),outputPricePerMillion:zod.z.number().nonnegative().describe("Price per 1M output tokens")}).describe("Input/output price pair (per 1M tokens) for a specific category within a ChatModel pricing tier."),ci=zod.z.object({base:mi.describe("Base (uncached, non\u2011reasoning) rates")}).describe("Holds the `ChatModelTokenPairPrice` for different categories (e.g., base) within a single pricing tier."),ui=zod.z.object({minTokens:zod.z.number().int().nonnegative().describe("Inclusive lower token bound for this tier."),maxTokens:zod.z.number().int().nullable().optional().describe("Exclusive upper token bound; `null` means \u221E."),prices:ci.describe("Price categories and rates for this specific token range.")}).refine(o=>o.maxTokens===null||typeof o.maxTokens=="number"&&o.maxTokens>o.minTokens,{message:"maxTokens must be > minTokens (or null for infinite).",path:["maxTokens"]}).describe("A single pricing tier defined by a token range and associated prices.");zod.z.object({modelName:zod.z.string().describe("Model name this schedule applies to."),currency:zod.z.string().default("USD").describe("Currency code (e.g., USD)."),tokenRanges:zod.z.array(ui).min(1).describe("Pricing tiers (`ChatModelTokenRangePrice`) schedule, sorted by minTokens.")}).superRefine((o,t)=>{let{tokenRanges:n}=o;n[0].minTokens!==0&&t.addIssue({code:zod.z.ZodIssueCode.custom,path:["tokenRanges",0,"minTokens"],message:"The first tier must have minTokens = 0."});for(let i=1;i<n.length;i++){let d=n[i-1],p=n[i];if(d.maxTokens===null){t.addIssue({code:zod.z.ZodIssueCode.custom,path:["tokenRanges",i-1,"maxTokens"],message:"Cannot define any tokenRanges after an infinite tier (maxTokens = null)."});break}p.minTokens!==d.maxTokens&&t.addIssue({code:zod.z.ZodIssueCode.custom,path:["tokenRanges",i,"minTokens"],message:`Tier ${i} minTokens (${p.minTokens}) must equal previous tier's maxTokens (${d.maxTokens}) for contiguity.`}),p.minTokens<d.minTokens&&t.addIssue({code:zod.z.ZodIssueCode.custom,path:["tokenRanges",i,"minTokens"],message:`tokenRanges must be sorted by ascending minTokens. Tier ${i} (${p.minTokens}) starts before Tier ${i-1} (${d.minTokens}).`});}let a=n[n.length-1];n.every(i=>i.maxTokens!==null||i===a)&&a.maxTokens!==null&&t.addIssue({code:zod.z.ZodIssueCode.custom,path:["tokenRanges",n.length-1,"maxTokens"],message:"The final tier must have maxTokens = null (representing infinity)."});}).describe("Complete pricing schedule for a single chat model, including all its token-based tiers.");var gi="function";var hi=zod.z.enum(["object","array","number","string","boolean","null"]),yi=zod.z.object({anyOf:zod.z.array(zod.z.any()).optional(),type:hi.optional(),default:zod.z.any().optional(),title:zod.z.string().optional(),description:zod.z.string().max(4096).optional(),properties:zod.z.record(zod.z.any()).optional(),required:zod.z.array(zod.z.string()).optional(),minItems:zod.z.number().int().min(0).optional(),maxItems:zod.z.number().int().optional(),items:zod.z.record(zod.z.any()).optional(),enum:zod.z.array(zod.z.union([zod.z.string(),zod.z.number(),zod.z.boolean(),zod.z.null()])).optional(),minimum:zod.z.number().optional(),maximum:zod.z.number().optional(),minLength:zod.z.number().int().min(0).optional(),maxLength:zod.z.number().int().optional()});zod.z.object({type:zod.z.enum(["object"]),title:zod.z.string().optional(),$defs:zod.z.record(zod.z.any()).optional(),properties:zod.z.record(yi).optional(),required:zod.z.array(zod.z.string()).optional()});var fi=zod.z.object({name:zod.z.string().regex(/^[a-zA-Z0-9_]{1,64}$/).max(64),description:zod.z.string().max(4096),parameters:zod.z.any(),strict:zod.z.boolean().optional()});var Ci=zod.z.enum(["function"]),Ti=zod.z.object({maxAttempts:zod.z.number().int().positive(),initialDelay:zod.z.number().int().positive(),exponentialFactor:zod.z.number().int().positive()}),bi=zod.z.object({type:zod.z.literal("http"),method:zod.z.enum(["get","post"]),url:zod.z.string().url(),headers:zod.z.record(zod.z.string()).optional(),query:zod.z.record(zod.z.string()).optional(),body:zod.z.record(zod.z.any()).optional(),proxyUrl:zod.z.string().url().optional(),proxyHeaders:zod.z.record(zod.z.string()).optional(),retry:Ti.optional()}),Mi=zod.z.discriminatedUnion("type",[bi]),ki=zod.z.object({type:Ci,definition:zod.z.object({schema:fi}),request:Mi.optional()}),Ri=[gi];zod.z.enum(Ri);var Ko=(o=zod.z.undefined())=>zod.z.discriminatedUnion("type",[ki.extend({metadata:o})]),Go=o=>wo().parse({modality:E,value:o}),ft=(o,t,n,a,i,d)=>jo().parse({modality:U,index:o,id:t,name:n,arguments:a,serverName:i,thoughtSignature:d}),Jo=(o,t,n,a,i,d)=>Lo().parse({modality:z,index:o,id:t,name:n,data:a,apiResponse:i,metadata:d});var Ct=(o,t)=>se().parse({role:o,partialContent:qo().parse({modality:ct,value:t})}),Ce=(o,t,n,a,i,d,p)=>se().parse({role:o,partialContent:Io().parse({modality:ut,index:t,id:n,name:a,arguments:i,serverName:d,thoughtSignature:p})}),Wo=(o,t,n,a,i)=>se().parse({role:o,partialContent:Uo().parse({modality:Bo,index:t,id:n,name:a,data:i})}),Zo=(o,t)=>dt().parse({modality:Z,value:{type:ye,thinking:o,signature:t}});var Xo=o=>dt().parse({modality:Z,value:{type:pt,data:o}});var Te=(o,t,n)=>se().parse({role:o,partialContent:mt().parse({modality:he,value:{type:ye,thinking:t,signature:n}})}),Yo=(o,t)=>se().parse({role:o,partialContent:mt().parse({modality:he,value:{type:pt,data:t}})});var Si=Object.defineProperty,Qo=Object.getOwnPropertySymbols,xi=Object.prototype.hasOwnProperty,vi=Object.prototype.propertyIsEnumerable,en=(o,t,n)=>t in o?Si(o,t,{enumerable:true,configurable:true,writable:true,value:n}):o[t]=n,de=(o,t)=>{for(var n in t||(t={}))xi.call(t,n)&&en(o,n,t[n]);if(Qo)for(var n of Qo(t))vi.call(t,n)&&en(o,n,t[n]);return o},tn="ProviderError",Tt=class dn extends ee{constructor({info:t,cause:n}){super({info:t,cause:n},tn),this.name=tn,this.info=t,this.cause=n;}static isProviderError(t){return t instanceof dn}};var on="ModelResponseError",K=class mn extends ee{constructor({info:t,cause:n}){super({info:t,cause:n},on),this.name=on,this.cause=n,this.info=t;}static isModelResponseError(t){return t instanceof mn}},nn="InvalidModelRequestError",me=class cn extends ee{constructor({info:t,cause:n}){super({info:t,cause:n},nn),this.name=nn,this.cause=n,this.info=t,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidModelRequestError(t){return t instanceof cn}},an="InvalidConfigError",X=class un extends ee{constructor({info:t,cause:n}){super({info:t,cause:n},an),this.name=an,this.cause=n,this.info=t,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidConfigError(t){return t instanceof un}},sn="InvalidMessagesError",N=class gn extends ee{constructor({info:t,cause:n}){super({info:t,cause:n},sn),this.name=sn,this.cause=n,this.info=t,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidMessagesError(t){return t instanceof gn}},rn="InvalidToolsError",bt=class hn extends ee{constructor({info:t,cause:n}){super({info:t,cause:n},rn),this.name=rn,this.cause=n,this.info=t,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidToolsError(t){return t instanceof hn}},ln="InvalidEmbeddingRequestsError",Mt=class yn extends ee{constructor({info:t,cause:n}){super({info:t,cause:n},ln),this.name=ln,this.info=t,this.cause=n,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidEmbeddingRequestsError(t){return t instanceof yn}},kt="multi-string",fn=zod.z.object({type:zod.z.literal(kt),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),max:zod.z.number().int().positive()}),Oi=o=>zod.z.array(zod.z.string()).max(o).default([]).optional(),Cn=o=>({def:fn.parse(de({type:kt},o)),schema:Oi(o.max)}),Rt="object-schema",Tn=zod.z.object({type:zod.z.literal(Rt),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),objectSchema:zod.z.any()}),_i=o=>o.optional(),bn=o=>({def:Tn.parse(de({type:Rt},o)),schema:_i(o.objectSchema)}),Mn="paired-select",Ei=zod.z.object({value:zod.z.string().min(1),label:zod.z.string().min(1)}),pn=zod.z.object({key:zod.z.string().min(1),label:zod.z.string().min(1),description:zod.z.string().min(1).max(500).optional(),choices:zod.z.array(Ei).min(1)}),Ai=zod.z.object({type:zod.z.literal(Mn),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),fields:zod.z.tuple([pn,pn]),uniqueByField:zod.z.string().min(1).optional()});var St="range",kn=zod.z.object({type:zod.z.literal(St),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),min:zod.z.number().int(),max:zod.z.number().int(),step:zod.z.number().positive(),default:zod.z.number()}),Pi=(o,t,n,a)=>zod.z.number().min(o).max(t).step(n).default(a).optional(),ae=o=>({def:kn.parse(de({type:St},o)),schema:Pi(o.min,o.max,o.step,o.default)}),xt="select-boolean",Rn=zod.z.object({type:zod.z.literal(xt),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),default:zod.z.boolean().nullable()}),wi=o=>zod.z.boolean().nullable().default(o).optional(),re=o=>({def:Rn.parse(de({type:xt},o)),schema:wi(o.default)}),vt="select-string",Sn=zod.z.object({type:zod.z.literal(vt),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),default:zod.z.string(),choices:zod.z.array(zod.z.string())}),qi=(o,t)=>zod.z.enum(t).nullable().default(o).optional(),ce=o=>({def:Sn.parse(de({type:vt},o)),schema:qi(o.default,o.choices)}),xn="string",ji=zod.z.object({type:zod.z.literal(xn),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),default:zod.z.string().optional(),minLength:zod.z.number().int().nonnegative().optional(),maxLength:zod.z.number().int().positive().optional()});var Ii=[St,kt,vt,Rt,xt,Mn,xn];zod.z.enum(Ii);var vn=zod.z.discriminatedUnion("type",[kn,fn,Sn,Rn,Tn,Ai,ji]),C=(o=rt,t=No)=>zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1),roles:zod.z.record(o,zod.z.string().min(1).optional()),modalities:zod.z.array(t).nonempty(),maxInputTokens:zod.z.number().int().positive().min(1),maxOutputTokens:zod.z.number().int().positive().min(1),maxReasoningTokens:zod.z.number().int().positive().min(1).optional(),config:zod.z.object({def:zod.z.record(zod.z.string().min(1),vn),schema:zod.z.instanceof(zod.z.ZodObject)}).refine(n=>{var a,i;let d=Object.keys(n.def),p=Object.keys((i=(a=n.schema)==null?void 0:a.shape)!=null?i:{});return d.every(m=>p.includes(m))&&p.every(m=>d.includes(m))},{message:"Keys in 'config.def' must exactly match keys in 'config.schema'"}),price:zod.z.custom()}),V=(o=$o)=>zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1),modalities:zod.z.array(o).nonempty(),maxInputTokens:zod.z.number().int().positive().min(1),maxOutputTokens:zod.z.number().int().positive().min(1),config:zod.z.object({def:zod.z.record(zod.z.string().min(1),vn),schema:zod.z.instanceof(zod.z.ZodObject)}).refine(t=>{var n,a;let i=Object.keys(t.def),d=Object.keys((a=(n=t.schema)==null?void 0:n.shape)!=null?a:{});return i.every(p=>d.includes(p))&&d.every(p=>i.includes(p))},{message:"Keys in 'config.def' must exactly match keys in 'config.schema'"})});zod.z.record(zod.z.string());zod.z.record(zod.z.union([zod.z.boolean(),zod.z.string(),zod.z.number(),zod.z.object({}),zod.z.array(zod.z.any()),zod.z.null(),zod.z.undefined()]));zod.z.string().url();var Li={type:"range",title:"Temperature",description:"Adjusts the model's creativity level. With a setting of 0, the model strictly picks the most probable next word. For endeavors that benefit from a dash of inventiveness, consider dialing it up to 0.7 or higher, enabling the model to produce text that's unexpectedly fresh."},Bi={type:"range",title:"Max tokens",description:"Specify the total tokens for generation, where one token approximates four English characters. Setting this to 0 defaults to the model's maximum capacity."},Ui={type:"range",title:"Max reasoning tokens",description:"Specify the total tokens for reasoning, where one token approximates four English characters."},Ni=o=>({type:"multi",title:"Stop sequence",description:`Enter up to ${o} sequences that will halt additional text output. The generated text will exclude these sequences.`}),Di={type:"range",title:"Top A",description:"Considers only the top tokens that have 'sufficiently high' probabilities relative to the most likely token, functioning like a dynamic Top-P. A lower Top-A value narrows down the token choices based on the highest probability token, while a higher Top-A value refines the filtering without necessarily impacting the creativity of the output."},zi={type:"range",title:"Top P",description:"Selects a subset of likely tokens for generation, restricting choices to the top-P fraction of possibilities, such as the top 10% when P=0.1. This approach can limit the variety of the output. By default, it's set to 1, indicating no restriction. It's advised to adjust this parameter or temperature to modulate output diversity, but not to modify both simultaneously."},Vi={type:"range",title:"Top K",description:"Select only from the highest K probabilities for each following word, effectively eliminating the less likely 'long tail' options."},$i={type:"range",title:"Min P",description:"Specifies the minimum probability a token must have to be considered, in relation to the probability of the most likely token. (This value varies based on the confidence level of the top token.) For example, if Min-P is set to 0.1, only tokens with at least 1/10th the probability of the highest-ranked token will be considered."},Fi={type:"range",title:"Frequency penalty",description:"Minimize redundancy. By assigning a penalty to frequently used tokens within the text, the likelihood of repeating identical phrases is reduced. The default setting for this penalty is zero."},Hi={type:"range",title:"Presence penalty",description:"Enhance the introduction of novel subjects by reducing the preference for tokens that have already appeared in the text, thus boosting the chances of exploring fresh topics. The standard setting for this is zero."},Ki={type:"range",title:"Seed",description:"When seed is fixed to a specific value, the model makes a best effort to provide the same response for repeated requests. Deterministic output isn't guaranteed. Also, changing the model or parameter settings, such as the temperature, can cause variations in the response even when you use the same seed value. By default, a random seed value is used."},Gi={type:"range",title:"Repetition penalty",description:"Reduces the likelihood of repeating tokens from the input. Increasing this value makes the model less prone to repetition, but setting it too high may lead to less coherent output, often resulting in run-on sentences missing smaller words. The token penalty is scaled according to the original token's probability."},Ji={type:"boolean",title:"Log probs",description:"Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned."},Wi={type:"range",title:"Top log probs",description:"The number of most likely tokens to return at each token position, each with an associated log probability. 'logprobs' must be set to true if this parameter is used."},Zi={type:"boolean",title:"Echo",description:"If true, the response will contain the prompt."},Xi={type:"select",title:"Response format",description:"Choose the response format of your model. For JSON, you must include the string 'JSON' in some form within your system / user prompt."},Yi={type:"select",title:"Response format",description:"Choose the response format of your model. 'json_object' colloquially known as JSON mode, instructs the model to respond with a valid JSON (must include the term 'json' in prompt). 'json_schema' colloquially known as structured outputs, allows you to specify a strict response schema that the model will adhere to."},Qi={type:"object",title:"Response schema",description:"When response format is set to 'json_schema', the model will return a JSON object of the specified schema."},es={type:"object",title:"MCP servers",description:"MCP servers to use for the model."},A={TEMPERATURE:Li,MAX_TOKENS:Bi,STOP:Ni,TOP_A:Di,TOP_P:zi,TOP_K:Vi,MIN_P:$i,FREQUENCY_PENALTY:Fi,PRESENCE_PENALTY:Hi,REPETITION_PENALTY:Gi,SEED:Ki,LOG_PROBS:Ji,TOP_LOG_PROBS:Wi,ECHO:Zi,RESPONSE_FORMAT:Xi,RESPONSE_FORMAT_WITH_SCHEMA:Yi,RESPONSE_SCHEMA:Qi,MAX_REASONING_TOKENS:Ui,MCP_SERVERS:es};var be=o=>Object.fromEntries(Object.entries(o).filter(([t,n])=>n!=null));var ie=o=>o==null?void 0:o.replace(/\/$/,"");var Ot=ae({param:"temperature",title:A.TEMPERATURE.title,description:A.TEMPERATURE.description,min:0,max:1,step:.01,default:1}),_t=o=>ae({param:"max_tokens",title:A.MAX_TOKENS.title,description:A.MAX_TOKENS.description,min:0,max:o,step:1,default:0}),Et=o=>Cn({param:"stop_sequences",title:A.STOP(o).title,description:A.STOP(o).description,max:o}),At=ae({param:"top_p",title:A.TOP_P.title,description:A.TOP_P.description,min:0,max:1,step:.01,default:1}),Pt=ae({param:"top_k",title:A.TOP_K.title,description:A.TOP_K.description,min:0,max:1,step:.01,default:1}),wt=ce({param:"tool_choice",title:"Tool choice",description:"Controls which (if any) tool is called by the model. 'any' means the model will call any of the provided tools. 'auto' means the model can pick between generating a message or calling a tool.",default:"auto",choices:["auto","any"]}),qt=re({param:"mcp",title:"MCP",description:"Enable or disable Model Context Protocol (MCP) functionality for this model.",default:false}),jt=bn({param:"mcp_servers",title:A.MCP_SERVERS.title,description:A.MCP_SERVERS.description,objectSchema:zod.z.array(zo)});var Me=(o,t)=>zod.z.object({temperature:Ot.schema,maxTokens:_t(o).schema,stop:Et(t).schema,topP:At.schema,topK:Pt.schema,toolChoice:wt.schema,mcp:qt.schema,mcpServers:jt.schema}),ke=(o,t)=>({temperature:Ot.def,maxTokens:_t(o).def,stop:Et(t).def,topP:At.def,topK:Pt.def,toolChoice:wt.def,mcp:qt.def,mcpServers:jt.def});var On=(o,t)=>ae({param:"max_reasoning_tokens",title:A.MAX_REASONING_TOKENS.title,description:A.MAX_REASONING_TOKENS.description,min:o,max:t,step:1,default:0}),_n=re({param:"reasoning_enabled",title:"Reasoning Enabled",description:`Controls whether the model is allowed to think for a longer period of time before generating a response.
7
- This can be useful for complex tasks that require more time to think.`,default:false}),En=(o,t,n,a)=>J(R({},ke(o,t)),{reasoningEnabled:_n.def,maxReasoningTokens:On(n,a).def}),An=(o,t,n,a)=>Me(o,t).extend({reasoningEnabled:_n.schema,maxReasoningTokens:On(n,a).schema});var It=ce({param:"encoding_format",title:"Encoding format",description:"Select the encoding format for the word embedding.",default:"",choices:["base64",""]}),Lt=ce({param:"input_type",title:"Input type",description:"Select the input type for the word embedding.",default:"",choices:["query","document",""]}),Bt=re({param:"truncation",title:"Truncation",description:"Select the truncation for the word embedding.",default:true});var Pn=()=>zod.z.object({encodingFormat:It.schema,inputType:Lt.schema,truncation:Bt.schema}),wn=()=>({encodingFormat:It.def,inputType:Lt.def,truncation:Bt.def});var h={base:(o,t)=>({def:ke(o,t),schema:Me(o,t)}),extendedThinking:(o,t,n,a)=>({def:En(o,t,n,a),schema:An(o,t,n,a)})},_={base:()=>({def:wn(),schema:Pn()})};var as="anthropic",te=class{constructor(){this.version="v1";this.name=as;this.chatModelFactories={[Wt]:{model:He,modelOptions:Fn,modelSchema:Zt},[eo]:{model:We,modelOptions:Gn,modelSchema:to},[Yt]:{model:Je,modelOptions:Kn,modelSchema:Qt},[Ne]:{model:De,modelOptions:zn,modelSchema:Kt},[ze]:{model:Ve,modelOptions:Vn,modelSchema:Gt},[Ke]:{model:Ge,modelOptions:Hn,modelSchema:Xt},[$e]:{model:Fe,modelOptions:$n,modelSchema:Jt},[xe]:{model:ve,modelOptions:jn,modelSchema:Nt},[qe]:{model:je,modelOptions:Un,modelSchema:$t},[Ie]:{model:Le,modelOptions:Nn,modelSchema:Ft},[Be]:{model:Ue,modelOptions:Dn,modelSchema:Ht},[Re]:{model:Se,modelOptions:qn,modelSchema:Ut},[Oe]:{model:_e,modelOptions:In,modelSchema:Dt},[Ee]:{model:Ae,modelOptions:Ln,modelSchema:zt},[Pe]:{model:we,modelOptions:Bn,modelSchema:Vt}};this.embeddingModelFactories={[uo]:{model:tt,modelOptions:Qn,modelSchema:go},[mo]:{model:et,modelOptions:Yn,modelSchema:co},[oo]:{model:Ze,modelOptions:Jn,modelSchema:no},[ao]:{model:Xe,modelOptions:Wn,modelSchema:io},[so]:{model:Ye,modelOptions:Zn,modelSchema:ro},[lo]:{model:Qe,modelOptions:Xn,modelSchema:po}};}chatModelLiterals(){return Object.keys(this.chatModelFactories)}chatModelSchemas(){return Object.keys(this.chatModelFactories).reduce((t,n)=>(t[n]=this.chatModelFactories[n].modelSchema,t),{})}chatModel(t){let n=t.modelName;if(!(n in this.chatModelFactories))throw new Tt({info:`Anthropic chat model: ${n} not found`,cause:new Error(`Anthropic chat model: ${n} not found, available chat models:
8
- ${this.chatModelLiterals().join(", ")}`)});let a=this.chatModelFactories[n].model,i=this.chatModelFactories[n].modelOptions.parse(t);return new a(i)}embeddingModelLiterals(){return Object.keys(this.embeddingModelFactories)}embeddingModelSchemas(){return Object.keys(this.embeddingModelFactories).reduce((t,n)=>(t[n]=this.embeddingModelFactories[n].modelSchema,t),{})}embeddingModel(t){let n=t.modelName;if(!(n in this.embeddingModelFactories))throw new Tt({info:`Anthropic embedding model: ${n} not found`,cause:new Error(`Anthropic embedding model: ${n} not found, available embedding models:
9
- ${this.embeddingModelLiterals().join(", ")}`)});let a=this.embeddingModelFactories[n].model,i=this.embeddingModelFactories[n].modelOptions.parse(t);return new a(i)}};te.chatBaseUrl="https://api.anthropic.com/v1",te.embeddingBaseUrl="https://api.voyageai.com/v1";var k={"claude-3-opus-20240229":{modelName:"claude-3-opus-20240229",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:15,outputPricePerMillion:75}}}]},"claude-3-sonnet-20240229":{modelName:"claude-3-sonnet-20240229",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:15}}}]},"claude-3-5-sonnet-20240620":{modelName:"claude-3-5-sonnet-20240620",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:15}}}]},"claude-3-5-sonnet-20241022":{modelName:"claude-3-5-sonnet-20241022",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:15}}}]},"claude-3-7-sonnet-20250219":{modelName:"claude-3-7-sonnet-20250219",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:15}}}]},"claude-3-haiku-20240307":{modelName:"claude-3-haiku-20240307",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.25,outputPricePerMillion:1.25}}}]},"claude-3-haiku-20241022":{modelName:"claude-3-haiku-20241022",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.25,outputPricePerMillion:1.25}}}]},"claude-3-5-haiku-20241022":{modelName:"claude-3-5-haiku-20241022",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.8,outputPricePerMillion:4}}}]},"claude-4-sonnet-20250514":{modelName:"claude-4-sonnet-20250514",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:15}}}]},"claude-4-opus-20250514":{modelName:"claude-4-opus-20250514",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:15,outputPricePerMillion:75}}}]},"claude-sonnet-4-5-20250929":{modelName:"claude-sonnet-4-5-20250929",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:15}}}]},"claude-sonnet-4-6":{modelName:"claude-sonnet-4-6",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:15}}}]},"claude-haiku-4-5-20251001":{modelName:"claude-haiku-4-5-20251001",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1,outputPricePerMillion:5}}}]},"claude-opus-4-5-20251101":{modelName:"claude-opus-4-5-20251101",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:5,outputPricePerMillion:25}}}]},"claude-opus-4-6":{modelName:"claude-opus-4-6",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:5,outputPricePerMillion:25}}}]},"claude-opus-4-7":{modelName:"claude-opus-4-7",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:5,outputPricePerMillion:25}}}]}};var T=zod.z.enum([ne,Y,O,pe]),b={system:ne,user:Y,assistant:O,tool:Y};var I=[E,W,U,z],L=zod.z.enum([E,W,U,z]),P=[E,W,U,z,Z],w=zod.z.enum([E,W,U,z,Z]);var rs=zod.z.object({type:zod.z.literal("text"),text:zod.z.string()}),ls=zod.z.object({type:zod.z.literal("tool_use"),id:zod.z.string(),name:zod.z.string(),input:zod.z.record(zod.z.any())}),ps=zod.z.object({type:zod.z.literal("thinking"),thinking:zod.z.string(),signature:zod.z.string()}),ds=zod.z.object({type:zod.z.literal("redacted_thinking"),data:zod.z.string()}),ms=zod.z.object({type:zod.z.literal("mcp_tool_use"),id:zod.z.string(),name:zod.z.string(),server_name:zod.z.string(),input:zod.z.record(zod.z.any())}),cs=zod.z.object({type:zod.z.literal("mcp_tool_result"),tool_use_id:zod.z.string(),is_error:zod.z.boolean(),content:zod.z.array(zod.z.any())}),ta=zod.z.object({content:zod.z.array(zod.z.discriminatedUnion("type",[rs,ls,ps,ds,ms,cs])),id:zod.z.string(),model:zod.z.string(),role:zod.z.string(),stop_reason:zod.z.string(),stop_sequence:zod.z.null(),type:zod.z.literal("message"),usage:zod.z.object({input_tokens:zod.z.number(),output_tokens:zod.z.number(),cache_creation_input_tokens:zod.z.number().nullish(),cache_read_input_tokens:zod.z.number().nullish()})}),oa=zod.z.object({type:zod.z.literal("message_start"),message:zod.z.object({id:zod.z.string(),type:zod.z.literal("message"),role:zod.z.string(),model:zod.z.string(),stop_reason:zod.z.string().nullable(),stop_sequence:zod.z.string().nullable(),content:zod.z.array(zod.z.any()),usage:zod.z.object({input_tokens:zod.z.number(),output_tokens:zod.z.number()})})}),na=zod.z.object({type:zod.z.literal("message_delta"),delta:zod.z.object({stop_reason:zod.z.string().nullable(),stop_sequence:zod.z.string().nullable()}),usage:zod.z.object({output_tokens:zod.z.number()})}),us=zod.z.object({type:zod.z.literal("text"),text:zod.z.string()}),gs=zod.z.object({type:zod.z.literal("tool_use"),id:zod.z.string(),name:zod.z.string(),input:zod.z.object({})}),hs=zod.z.object({type:zod.z.literal("thinking"),thinking:zod.z.string()}),ys=zod.z.object({type:zod.z.literal("redacted_thinking"),data:zod.z.string()}),fs=zod.z.object({type:zod.z.literal("mcp_tool_use"),id:zod.z.string(),name:zod.z.string(),server_name:zod.z.string(),input:zod.z.record(zod.z.any())}),Cs=zod.z.object({type:zod.z.literal("mcp_tool_result"),tool_use_id:zod.z.string(),is_error:zod.z.boolean(),content:zod.z.array(zod.z.any())}),aa=zod.z.object({type:zod.z.literal("content_block_start"),index:zod.z.number(),content_block:zod.z.discriminatedUnion("type",[us,gs,hs,ys,fs,Cs])}),Ts=zod.z.object({type:zod.z.literal("text_delta"),text:zod.z.string()}),bs=zod.z.object({type:zod.z.literal("input_json_delta"),partial_json:zod.z.string()}),Ms=zod.z.object({type:zod.z.literal("thinking_delta"),thinking:zod.z.string()}),ks=zod.z.object({type:zod.z.literal("signature_delta"),signature:zod.z.string()}),ia=zod.z.object({type:zod.z.literal("content_block_delta"),index:zod.z.number(),delta:zod.z.discriminatedUnion("type",[Ts,bs,Ms,ks])});var Rs=zod.z.object({type:zod.z.literal("thinking"),thinking:zod.z.string().optional(),signature:zod.z.string().optional()}),Ss=zod.z.object({type:zod.z.literal("redacted_thinking"),data:zod.z.string()}),xs=zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1).optional(),input_schema:zod.z.any()}),vs=zod.z.object({type:zod.z.enum(["auto","any"])}),Os=zod.z.object({type:zod.z.literal("tool"),name:zod.z.string().min(1)}),ho=zod.z.object({text:zod.z.string().min(1),type:zod.z.literal("text")}),sa=zod.z.object({type:zod.z.literal("image"),source:zod.z.object({type:zod.z.literal("base64"),media_type:zod.z.enum(["image/jpeg","image/png","image/gif","image/webp"]),data:zod.z.string().base64()})}),al=zod.z.object({id:zod.z.string().min(1),type:zod.z.literal("tool_use"),name:zod.z.string().min(1),input:zod.z.record(zod.z.any())}),ra=zod.z.object({type:zod.z.literal("tool_result"),tool_use_id:zod.z.string().min(1),content:zod.z.string().min(1).or(zod.z.array(zod.z.union([ho,sa])).min(1))}),il=zod.z.object({type:zod.z.literal("mcp_tool_use"),id:zod.z.string().min(1),name:zod.z.string().min(1),server_name:zod.z.string().min(1),input:zod.z.record(zod.z.any())}),sl=zod.z.object({type:zod.z.literal("mcp_tool_result"),tool_use_id:zod.z.string().min(1),is_error:zod.z.boolean().default(false),content:zod.z.array(zod.z.any())}),_s=zod.z.object({enabled:zod.z.boolean().default(true),allowed_tools:zod.z.array(zod.z.string().min(1)).optional()}),Es=zod.z.object({type:zod.z.literal("url"),url:zod.z.string().url().refine(o=>o.startsWith("https://"),{message:"MCP server URL must start with https://"}),name:zod.z.string().min(1),tool_configuration:_s.optional(),authorization_token:zod.z.string().min(1).optional()}),As=zod.z.object({role:zod.z.literal("user"),content:zod.z.string().min(1).or(zod.z.array(zod.z.union([ho,sa,ra])).min(1))}),Ps=zod.z.object({role:zod.z.literal("assistant"),content:zod.z.string().min(1).or(zod.z.array(zod.z.union([ho,ra,Rs,Ss])).min(1))}),ws=zod.z.union([As,Ps]),la=zod.z.object({model:zod.z.string().min(1).optional(),messages:zod.z.array(ws).min(1),system:zod.z.string().min(1).optional(),max_tokens:zod.z.number().min(0).optional(),stop_sequences:zod.z.array(zod.z.string().min(1)).optional(),temperature:zod.z.number().min(0).max(1).optional(),tool_choice:zod.z.union([vs,Os]).optional(),tools:zod.z.array(xs).min(1).optional(),top_p:zod.z.number().min(0).max(1).optional(),top_k:zod.z.number().min(0).optional(),mcp_servers:zod.z.array(Es).min(1).optional()});var f=zod.z.object({modelName:zod.z.string(),apiKey:zod.z.string(),completeChatUrl:zod.z.string().url().optional(),streamChatUrl:zod.z.string().url().optional()}),y=class{constructor(t,n){this.version="v1";let a=f.parse(n);this.modelSchema=t,this.modelName=a.modelName,this.apiKey=a.apiKey,this.baseUrl=ie(te.chatBaseUrl),this.completeChatUrl=ie(a.completeChatUrl||`${this.baseUrl}/messages`),this.streamChatUrl=ie(a.streamChatUrl||`${this.baseUrl}/messages`);}getDefaultBaseUrl(){return this.baseUrl}getDefaultHeaders(){return {"x-api-key":`${this.apiKey}`,"anthropic-version":"2023-06-01","content-type":"application/json","anthropic-dangerous-direct-browser-access":"true"}}getDefaultParams(){return {model:this.modelName}}getRetryDelay(t,n){let a=0,i=true;return t["x-should-retry"]&&(i=t["x-should-retry"].toLowerCase()!=="false"),t["retry-after"]&&(a=parseInt(t["retry-after"])*1e3),{shouldRetry:i,delayMs:a}}getTokenCount(t){return t.reduce((n,a)=>n+a.content.map(i=>i.modality==="text"?i.value:"").join(" ").length,0)}transformModelRequest(t){let n=la.safeParse(t);if(!n.success)throw new me({info:"Invalid model request",cause:n.error});let a=n.data,i=a.model;if(a.tool_choice&&(!a.tools||a.tools.length===0))throw new me({info:`Invalid model request for model : '${this.modelName}'`,cause:new Error("'tools' are required when 'tool_choice' is specified")});let d={};a.tool_choice&&(a.tool_choice.type==="tool"?d.toolChoice=a.tool_choice.name:d.toolChoice=a.tool_choice.type),d.maxTokens=a.max_tokens,d.temperature=a.temperature,d.topP=a.top_p,d.topK=a.top_k,d.stop=a.stop_sequences;let p=fe().parse(be(d)),m=[],l={};a.system&&m.push({role:ne,content:[{modality:E,value:a.system}]}),a.messages.forEach(u=>{let M=u.role;switch(M){case "user":{let S=u.content;if(typeof S=="string")m.push({role:M,content:[{modality:E,value:S}]});else {let q=S.map(x=>{if(x.type==="text")return {modality:E,value:x.text};if(x.type==="image"){let v="auto",G=x.source.media_type.split("/")[1];return {modality:W,detail:v,value:{type:lt,mediaType:G,base64:x.source.data}}}else return {modality:z,id:x.tool_use_id,index:l[x.tool_use_id].index,name:l[x.tool_use_id].name,data:typeof x.content=="string"?x.content:JSON.stringify(x.content)}});m.push({role:M,content:q});}}break;case "assistant":{let S=u.content;if(typeof S=="string")m.push({role:M,content:[{modality:E,value:S}]});else {let q=S.map((x,v)=>{if(x.type==="text")return {modality:E,value:x.text};{let G={modality:U,id:x.id,index:v,name:x.name,arguments:JSON.stringify(x.input)};return l[x.id]=G,G}});m.push({role:M,content:q});}}break}});let g=[];return a.tools&&a.tools.forEach(u=>{g.push({type:"function",definition:{schema:{name:u.name,description:u.description||"",parameters:u.input_schema}}});}),{modelName:i,config:p,messages:m,tools:g.length>0?g:void 0}}transformConfig(t,n,a){let i=t.toolChoice,d=t.reasoningEnabled,p=t.maxReasoningTokens,m=t.mcp,l=t.mcpServers,g=R({},t);delete g.toolChoice,delete g.reasoningEnabled,delete g.maxReasoningTokens,delete g.mcp,delete g.mcpServers;let u=this.modelSchema.config.schema.safeParse(g);if(!u.success)throw new X({info:`Invalid config for model : '${this.modelName}'`,cause:u.error});let M=u.data;i!==void 0&&(M.toolChoice=i),Object.keys(M).forEach(v=>{if(!(v in this.modelSchema.config.def))throw new X({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`Invalid config key : '${v}',
10
- available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})});let S=Object.keys(M).reduce((v,G)=>{let le=this.modelSchema.config.def[G],nt=le.param,yo=M[G];return nt==="max_tokens"&&le.type==="range"&&yo===0?v[nt]=le.max:v[nt]=yo,v},{});if(!S.max_tokens){let v=this.modelSchema.config.def.maxTokens;S.max_tokens=v.max;}if("tool_choice"in S&&S.tool_choice!==void 0){let v=S.tool_choice;if(!a||a&&a.length===0)throw new X({info:`Invalid config for model : '${this.modelName}'`,cause:new Error("'tools' are required when 'toolChoice' is specified")});if(a&&a.length>0){let G=this.modelSchema.config.def.toolChoice;if(G.choices.includes(v))S.tool_choice={type:v};else if(a.map(le=>le.definition.schema.name).includes(v))S.tool_choice={type:"tool",name:v};else throw new X({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`toolChoice : '${v}' is not part of provided 'tools' names or
11
- one of [${G.choices.join(", ")}]`)})}}let q=d!==void 0,x=p!==void 0;if(q!==x)throw new X({info:`Invalid extended thinking config for model: '${this.modelName}'`,cause:new Error("Both 'reasoningEnabled' and 'maxReasoningTokens' must be defined together.")});if(q&&x){let v=S.max_tokens;if(d)if(p<v)S.thinking={type:"enabled",budget_tokens:p};else throw new X({info:`Invalid extended thinking token budget for model: '${this.modelName}'`,cause:new Error(`maxReasoningTokens (${p}) must be less than max_tokens (${v})`)})}return m&&l&&(S.mcp_servers=l),S}transformMessages(t){if(!t||t&&t.length===0)return {messages:[]};let n=p=>{let m=p.match(/^data:image\/[a-zA-Z]+;base64,/);return m?p.substring(m[0].length):p},a=t.map(p=>{let m=gt().safeParse(p);if(!m.success)throw new N({info:"Invalid messages",cause:m.error});return m.data});a.forEach(p=>{p.content.forEach(m=>{if(!this.modelSchema.modalities.includes(m.modality))throw new N({info:`Invalid message content for model : '${this.modelName}'`,cause:new Error(`model : '${this.modelName}' does not support modality : '${m.modality}', available modalities : [${this.modelSchema.modalities.join(", ")}]`)})});}),a.forEach(p=>{if(!Object.keys(this.modelSchema.roles).includes(p.role))throw new N({info:`Invalid message content for model : '${this.modelName}'`,cause:new Error(`model : '${this.modelName}' does not support role : '${p.role}', available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})}),a.forEach(p=>{p.content=p.content.filter(m=>m.modality!=="error"&&m.modality!=="search-result");});let i="",d=[];if(a.forEach(p=>{switch(p.role){case ne:{p.content.forEach(m=>{if(m.modality===E)i+=m.value;else throw new N({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${p.role}' cannot have content with modality : '${m.modality}'`)})});break}case O:{let m=[];p.content.forEach(l=>{if(l.modality===E)m.push({type:"text",text:l.value});else if(l.modality===U)l.serverName?m.push({type:"mcp_tool_use",id:l.id,name:l.name,server_name:l.serverName,input:JSON.parse(l.arguments)}):m.push({type:"tool_use",id:l.id,name:l.name,input:JSON.parse(l.arguments)});else if(l.modality===Z&&l.value.type==="thinking")m.push({type:"thinking",thinking:l.value.thinking,signature:l.value.signature});else if(l.modality===Z&&l.value.type==="redacted")m.push({type:"redacted_thinking",data:l.value.data});else if(l.modality===z)m.push({type:"mcp_tool_result",tool_use_id:l.id,content:JSON.parse(l.data),is_error:l.apiResponse&&l.apiResponse.statusCode!==200||false});else throw new N({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${p.role}' cannot have content with modality : '${l.modality}'`)})}),d.push({role:this.modelSchema.roles[p.role],content:m});break}case Y:{let m=[];p.content.forEach(l=>{if(l.modality===E)m.push({type:"text",text:l.value});else if(l.modality===W){if(l.value.type==="base64"){let g=l.value.base64;g=n(g),m.push({type:"image",source:{type:"base64",media_type:`image/${l.value.mediaType}`,data:g}});}else if(l.value.type==="url")throw new N({info:`Invalid message 'modality' for model : ${this.modelName}`,cause:new Error(`model: '${this.modelName}' does not support image content type: '${l.value.type}'`)})}else throw new N({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${p.role}' cannot have content with modality : '${l.modality}'`)})}),d.push({role:this.modelSchema.roles[p.role],content:m});break}case pe:{let m=[];p.content.forEach(l=>{if(l.modality===z)m.push({type:"tool_result",tool_use_id:l.id,content:l.data});else throw new N({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${p.role}' cannot have content with modality : '${l.modality}'`)})}),d.push({role:this.modelSchema.roles[p.role],content:m});break}default:throw new N({info:`Invalid message 'role' for model : ${this.modelName}`,cause:new Error(`role : '${p.role}' is not supported,
12
- available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})}}),d[0].role!==this.modelSchema.roles[Y])throw new N({info:`Invalid message 'role' for model : ${this.modelName}`,cause:new Error(`model : '${this.modelName}' requires first message to be from user`)});return {system:i,messages:d}}transformTools(t){if(!this.modelSchema.modalities.includes(U))throw new bt({info:`Invalid tool 'modality' for model : ${this.modelName}`,cause:new Error(`model : '${this.modelName}' does not support tool modality : '${U}'`)});return !t||t&&t.length===0?{tools:[]}:{tools:t.map(i=>{let d=Ko().safeParse(i);if(!d.success)throw new bt({info:"Invalid tools",cause:d.error});return d.data}).map(i=>({name:i.definition.schema.name,description:i.definition.schema.description,input_schema:i.definition.schema.parameters}))}}getCompleteChatUrl(t,n,a){return j(this,null,function*(){return new Promise(i=>{i(this.completeChatUrl);})})}getCompleteChatHeaders(t,n,a){return j(this,null,function*(){let i=this.getDefaultHeaders();if(t&&t.mcp&&t.mcpServers){let d=i["anthropic-beta"],p="mcp-client-2025-04-04";d?i=J(R({},i),{"anthropic-beta":`${d},${p}`}):i=J(R({},i),{"anthropic-beta":p});}return new Promise(d=>{d(i);})})}getCompleteChatData(t,n,a){return j(this,null,function*(){let i=this.transformConfig(t,n,a),d=this.transformMessages(n);if(d.messages&&d.messages.length===0)throw new N({info:"Messages are required",cause:new Error("Messages are required")});let p=a?this.transformTools(a):{};return new Promise(m=>{m(R(R(R(R({},this.getDefaultParams()),i),d),p));})})}transformCompleteChatResponse(t){let n=ta.safeParse(t);if(n.success){let a=n.data,d=a.content.map((l,g)=>{if(l.type==="text")return Go(l.text);if(l.type==="tool_use")return ft(g,l.id,l.name,JSON.stringify(l.input));if(l.type==="thinking")return Zo(l.thinking,l.signature);if(l.type==="redacted_thinking")return Xo(l.data);if(l.type==="mcp_tool_use")return ft(g,l.id,l.name,JSON.stringify(l.input),l.server_name);if(l.type==="mcp_tool_result")return Jo(g,l.tool_use_id,"mcp_tool_result",JSON.stringify(l.content),{statusCode:l.is_error?500:200})}),p=[{role:O,content:d}],m={promptTokens:a.usage.input_tokens,completionTokens:a.usage.output_tokens,totalTokens:a.usage.input_tokens+a.usage.output_tokens};return {messages:p,usage:m,logProbs:[]}}throw new K({info:"Invalid response from model",cause:n.error})}getStreamChatUrl(t,n,a){return j(this,null,function*(){return new Promise(i=>{i(this.streamChatUrl);})})}getStreamChatHeaders(t,n,a){return j(this,null,function*(){let i=this.getDefaultHeaders();if(t&&t.mcp&&t.mcpServers){let d=i["anthropic-beta"],p="mcp-client-2025-04-04";d?i=J(R({},i),{"anthropic-beta":`${d},${p}`}):i=J(R({},i),{"anthropic-beta":p});}return new Promise(d=>{d(i);})})}getStreamChatData(t,n,a){return j(this,null,function*(){let i=this.transformConfig(t,n,a),d=this.transformMessages(n);if(d.messages&&d.messages.length===0)throw new N({info:"Messages are required",cause:new Error("Messages are required")});let p=a?this.transformTools(a):{};return new Promise(m=>{m(R(R(R(R({stream:true},this.getDefaultParams()),i),d),p));})})}transformStreamChatResponseChunk(t,n){return at(this,null,function*(){let a=n+t,i=[],d="",p=0;for(;p<a.length;){let m=a.indexOf(`
13
- `,p);if(m===-1){d=a.substring(p);break}else {let l=a.substring(p,m).trim();l&&i.push(l),p=m+1;}}for(let m of i)if(m.startsWith("data: {")&&m.endsWith("}")){let l;try{l=JSON.parse(m.substring(6));}catch(g){throw new K({info:`Malformed JSON received in stream : ${l}`,cause:g})}if("type"in l){if(l.type==="message_stop")return;if(l.type==="message_start"){let g=oa.safeParse(l);if(g.success){let u=g.data;yield {partialResponse:{partialMessages:[],usage:{promptTokens:u.message.usage.input_tokens,completionTokens:u.message.usage.output_tokens,totalTokens:u.message.usage.input_tokens+u.message.usage.output_tokens}},buffer:n};}else throw new K({info:"Invalid response from model",cause:g.error})}else if(l.type==="message_delta"){let g=na.safeParse(l);if(g.success){let u=g.data;yield {partialResponse:{partialMessages:[],usage:{promptTokens:void 0,completionTokens:u.usage.output_tokens,totalTokens:u.usage.output_tokens}},buffer:n};}else throw new K({info:"Invalid response from model",cause:g.error})}else if(l.type==="content_block_start"){let g=aa.safeParse(l);if(g.success){let u=g.data,M=[];u.content_block.type==="text"?M.push(Ct(O,u.content_block.text)):u.content_block.type==="tool_use"?M.push(Ce(O,u.index,u.content_block.id,u.content_block.name,"")):u.content_block.type==="thinking"?M.push(Te(O,u.content_block.thinking)):u.content_block.type==="redacted_thinking"?M.push(Yo(O,u.content_block.data)):u.content_block.type==="mcp_tool_use"?M.push(Ce(O,u.index,u.content_block.id,u.content_block.name,JSON.stringify(u.content_block.input),u.content_block.server_name)):u.content_block.type==="mcp_tool_result"&&M.push(Wo(O,u.index,u.content_block.tool_use_id,"mcp_tool_result",JSON.stringify(u.content_block.content))),yield {partialResponse:{partialMessages:M},buffer:n};}else throw new K({info:"Invalid response from model",cause:g.error})}else if(l.type==="content_block_delta"){let g=ia.safeParse(l);if(g.success){let u=g.data,M=[];u.delta.type==="text_delta"?M.push(Ct(O,u.delta.text)):u.delta.type==="input_json_delta"?M.push(Ce(O,u.index,"","",u.delta.partial_json)):u.delta.type==="thinking_delta"?M.push(Te(O,u.delta.thinking)):u.delta.type==="signature_delta"&&M.push(Te(O,void 0,u.delta.signature)),yield {partialResponse:{partialMessages:M},buffer:n};}else throw new K({info:"Invalid response from model",cause:g.error})}}else throw new K({info:"Invalid JSON received in stream",cause:new Error(`Invalid JSON received in stream, expected 'type' property, received: ${JSON.stringify(l)}`)})}yield {partialResponse:{partialMessages:[]},buffer:d};})}transformProxyStreamChatResponseChunk(t,n,a,i,d){return at(this,null,function*(){yield*bo(this.transformStreamChatResponseChunk(t,n));})}getProxyStreamChatUrl(t,n,a){return j(this,null,function*(){return new Promise(i=>{i(this.streamChatUrl);})})}getProxyCompleteChatUrl(t,n,a){return j(this,null,function*(){return new Promise(i=>{i(this.completeChatUrl);})})}getProxyCompleteChatHeaders(t,n,a){return j(this,null,function*(){if(!n)return {};let i=R({},n);return delete i.host,delete i["content-length"],i})}getProxyStreamChatHeaders(t,n,a){return j(this,null,function*(){return yield this.getProxyCompleteChatHeaders(t,n,a)})}getModelPricing(){if(!(this.modelName in k))throw new K({info:`Invalid model pricing for model : '${this.modelName}'`,cause:new Error(`No pricing configuration found for model "${this.modelName}"`)});return k[this.modelName]}};var Re="claude-4-opus-20250514",qs="Our high-performance model with exceptional reasoning and efficiency. Training cutoff: March 2025.",Ut=C(T,w).parse({name:Re,description:qs,maxInputTokens:2e5,maxOutputTokens:32e3,maxReasoningTokens:32e3,roles:b,modalities:P,config:{def:h.extendedThinking(32e3,4,1024,32e3).def,schema:h.extendedThinking(32e3,4,1024,32e3).schema},price:k[Re]}),qn=f,Se=class extends y{constructor(t){super(Ut,t);}};var xe="claude-4-sonnet-20250514",js="Our most capable and intelligent model yet. Training cutoff: March 2025.",Nt=C(T,w).parse({name:xe,description:js,maxInputTokens:2e5,maxOutputTokens:64e3,maxReasoningTokens:64e3,roles:b,modalities:P,config:{def:h.extendedThinking(64e3,4,1024,64e3).def,schema:h.extendedThinking(64e3,4,1024,64e3).schema},price:k[xe]}),jn=f,ve=class extends y{constructor(t){super(Nt,t);}};var Oe="claude-opus-4-5-20251101",Is="Premium model combining maximum intelligence with practical performance. Ideal for complex specialized tasks, professional software engineering, and advanced agents. Training cutoff: August 2025.",Dt=C(T,w).parse({name:Oe,description:Is,maxInputTokens:2e5,maxOutputTokens:64e3,maxReasoningTokens:64e3,roles:b,modalities:P,config:{def:h.extendedThinking(64e3,4,1024,64e3).def,schema:h.extendedThinking(64e3,4,1024,64e3).schema},price:k[Oe]}),In=f,_e=class extends y{constructor(t){super(Dt,t);}};var Ee="claude-opus-4-6",Ls="Most intelligent model for building agents and coding. Features 128K max output tokens and 1M context window in beta. Training cutoff: August 2025.",zt=C(T,w).parse({name:Ee,description:Ls,maxInputTokens:2e5,maxOutputTokens:128e3,maxReasoningTokens:128e3,roles:b,modalities:P,config:{def:h.extendedThinking(128e3,4,1024,128e3).def,schema:h.extendedThinking(128e3,4,1024,128e3).schema},price:k[Ee]}),Ln=f,Ae=class extends y{constructor(t){super(zt,t);}};var Pe="claude-opus-4-7",Bs="Most intelligent model for building agents and coding. Features 128K max output tokens and 200K context window. Training cutoff: January 2026.",Vt=C(T,w).parse({name:Pe,description:Bs,maxInputTokens:2e5,maxOutputTokens:128e3,maxReasoningTokens:128e3,roles:b,modalities:P,config:{def:h.extendedThinking(128e3,4,1024,128e3).def,schema:h.extendedThinking(128e3,4,1024,128e3).schema},price:k[Pe]}),Bn=f,we=class extends y{constructor(t){super(Vt,t);}};var qe="claude-sonnet-4-5-20250929",Us="Our best model for complex agents and coding, with the highest intelligence across most tasks. Training cutoff: July 2025.",$t=C(T,w).parse({name:qe,description:Us,maxInputTokens:2e5,maxOutputTokens:64e3,maxReasoningTokens:64e3,roles:b,modalities:P,config:{def:h.extendedThinking(64e3,4,1024,64e3).def,schema:h.extendedThinking(64e3,4,1024,64e3).schema},price:k[qe]}),Un=f,je=class extends y{constructor(t){super($t,t);}};var Ie="claude-sonnet-4-6",Ns="Balanced model for agentic reasoning and coding with strong performance at low latency. Training cutoff: August 2025.",Ft=C(T,w).parse({name:Ie,description:Ns,maxInputTokens:2e5,maxOutputTokens:64e3,maxReasoningTokens:64e3,roles:b,modalities:P,config:{def:h.extendedThinking(64e3,4,1024,64e3).def,schema:h.extendedThinking(64e3,4,1024,64e3).schema},price:k[Ie]}),Nn=f,Le=class extends y{constructor(t){super(Ft,t);}};var Be="claude-haiku-4-5-20251001",Ds="Fast and efficient model for high-throughput chat, extraction, and routing workloads.",Ht=C(T,L).parse({name:Be,description:Ds,maxInputTokens:2e5,maxOutputTokens:8192,roles:b,modalities:I,config:{def:h.base(8192,4).def,schema:h.base(8192,4).schema},price:k[Be]}),Dn=f,Ue=class extends y{constructor(t){super(Ht,t);}};var Ne="claude-3-5-sonnet-20240620",zs="Most intelligent model. Highest level of intelligence and capability.",Kt=C(T,L).parse({name:Ne,description:zs,maxInputTokens:2e5,maxOutputTokens:8192,roles:b,modalities:I,config:{def:h.base(8192,4).def,schema:h.base(8192,4).schema},price:k[Ne]}),zn=f,De=class extends y{constructor(t){super(Kt,t);}};var ze="claude-3-5-sonnet-20241022",Vs="Most intelligent model. Highest level of intelligence and capability.",Gt=C(T,L).parse({name:ze,description:Vs,maxInputTokens:2e5,maxOutputTokens:8192,roles:b,modalities:I,config:{def:h.base(8192,4).def,schema:h.base(8192,4).schema},price:k[ze]}),Vn=f,Ve=class extends y{constructor(t){super(Gt,t);}};var $e="claude-3-7-sonnet-20250219",$s="Most intelligent model. Highest level of intelligence and capability.",Jt=C(T,w).parse({name:$e,description:$s,maxInputTokens:2e5,maxOutputTokens:128e3,maxReasoningTokens:64e3,roles:b,modalities:P,config:{def:h.extendedThinking(128e3,4,1024,64e3).def,schema:h.extendedThinking(128e3,4,1024,64e3).schema},price:k[$e]}),$n=f,Fe=class extends y{constructor(t){super(Jt,t);}getDefaultHeaders(){let t=super.getDefaultHeaders(),n=t["anthropic-beta"],a="output-128k-2025-02-19";return n?t=J(R({},t),{"anthropic-beta":`${n},${a}`}):t=J(R({},t),{"anthropic-beta":a}),t}};var Wt="claude-3-haiku-20240307",Fs="Fastest and most compact model for near-instant responsiveness. Quick and accurate targeted performance.",Zt=C(T,L).parse({name:Wt,description:Fs,maxInputTokens:2e5,maxOutputTokens:4096,roles:b,modalities:I,config:{def:h.base(4096,4).def,schema:h.base(4096,4).schema}}),Fn=f,He=class extends y{constructor(t){super(Zt,t);}};var Ke="claude-3-5-haiku-20241022",Hs="Our fastest model with intelligence at blazing speeds.",Xt=C(T,L).parse({name:Ke,description:Hs,maxInputTokens:2e5,maxOutputTokens:8192,roles:b,modalities:I,config:{def:h.base(8192,4).def,schema:h.base(8192,4).schema},price:k[Ke]}),Hn=f,Ge=class extends y{constructor(t){super(Xt,t);}};var Yt="claude-3-opus-20240229",Ks="Powerful model for highly complex tasks. Top-level performance, intelligence, fluency, and understanding.",Qt=C(T,L).parse({name:Yt,description:Ks,maxInputTokens:2e5,maxOutputTokens:4096,roles:b,modalities:I,config:{def:h.base(4096,4).def,schema:h.base(4096,4).schema}}),Kn=f,Je=class extends y{constructor(t){super(Qt,t);}};var eo="claude-3-sonnet-20240229",Gs="Balance of intelligence and speed. Strong utility, balanced for scaled deployments.",to=C(T,L).parse({name:eo,description:Gs,maxInputTokens:2e5,maxOutputTokens:4096,roles:b,modalities:I,config:{def:h.base(4096,4).def,schema:h.base(4096,4).schema}}),Gn=f,We=class extends y{constructor(t){super(to,t);}};var $=[Q],F=zod.z.enum([Q]);var pa=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({total_tokens:zod.z.number()})});var Ws=zod.z.string().min(1).or(zod.z.array(zod.z.string().min(1)).min(1)),da=zod.z.object({model:zod.z.string().min(1).optional(),input:Ws,encoding_format:zod.z.enum(["base64"]).nullable().optional(),input_type:zod.z.enum(["query","document"]).nullable().optional(),truncation:zod.z.boolean().optional()});var D=zod.z.object({modelName:zod.z.string(),apiKey:zod.z.string(),getEmbeddingsUrl:zod.z.string().url().optional()}),B=class{constructor(t,n){this.version="v1";let a=D.parse(n);this.modelSchema=t,this.modelName=a.modelName,this.apiKey=a.apiKey,this.baseUrl=ie(te.embeddingBaseUrl),this.getEmbeddingsUrl=ie(a.getEmbeddingsUrl||`${this.baseUrl}/embeddings`);}getDefaultBaseUrl(){return this.baseUrl}getDefaultHeaders(){return {Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"}}getDefaultParams(){return {model:this.modelName}}getTokenCount(t){return t.requests.reduce((n,a)=>n+a.length,0)}getRetryDelay(t,n){return {shouldRetry:true,delayMs:0}}transformModelRequest(t){let n=da.safeParse(t);if(!n.success)throw new me({info:"Invalid model request",cause:n.error});let a=n.data,i=a.model,d={encodingFormat:a.encoding_format,inputType:a.input_type,truncation:a.truncation},p=fe().parse(be(d)),m;return typeof a.input=="string"?m={modality:Q,requests:[a.input]}:m={modality:Q,requests:a.input},{modelName:i,config:p,embeddingRequests:m}}transformConfig(t,n){"inputType"in t&&t.inputType===""&&delete t.inputType,"encodingFormat"in t&&t.encodingFormat===""&&delete t.encodingFormat;let a=this.modelSchema.config.schema.safeParse(t);if(!a.success)throw new X({info:`Invalid config for model : '${this.modelName}'`,cause:a.error});let i=a.data;return Object.keys(i).forEach(p=>{if(!this.modelSchema.config.def[p])throw new X({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`Invalid config key : '${p}',
14
- available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})}),Object.keys(i).reduce((p,m)=>{let g=this.modelSchema.config.def[m].param,u=i[m];return p[g]=u,p},{})}transformEmbeddingRequests(t){let n=Fo().safeParse(t);if(!n.success)throw new Mt({info:"Invalid embedding requests",cause:n.error});if(n.data.requests.length>128)throw new Mt({info:`Invalid embedding requests for model : '${this.modelName}'`,cause:new Error(`Max requests for model : '${this.modelName}' is 128`)});return {input:n.data.requests}}getGetEmbeddingsUrl(t,n){return j(this,null,function*(){return new Promise(a=>{a(this.getEmbeddingsUrl);})})}getGetEmbeddingsHeaders(t,n){return j(this,null,function*(){return new Promise(a=>{a(this.getDefaultHeaders());})})}getGetEmbeddingsData(t,n){return j(this,null,function*(){return new Promise(a=>{a(R(R(R({},this.getDefaultParams()),this.transformConfig(t,n)),this.transformEmbeddingRequests(n)));})})}transformGetEmbeddingsResponse(t){let n,a=pa.safeParse(t);if(a.success){let i=a.data;n=typeof i.data[0].embedding=="string"?yt:ht;let d=i.data.map(p=>typeof p.embedding=="string"?{index:p.index,embedding:p.embedding}:{index:p.index,embedding:p.embedding});return {encodingFormat:n,embeddings:d,usage:{totalTokens:i.usage.total_tokens}}}throw new K({info:"Invalid response from model",cause:a.error})}};var oo="voyage-code-2",Zs="Optimized for code retrieval.",no=V(F).parse({name:oo,description:Zs,modalities:$,maxInputTokens:16e3,maxOutputTokens:16e3,config:{def:_.base().def,schema:_.base().schema}}),Jn=D,Ze=class extends B{constructor(t){super(no,t);}};var ao="voyage-law-2",Xs="Optimized for legal and long-context retrieval and RAG. Also improved performance across all domains.",io=V(F).parse({name:ao,description:Xs,modalities:$,maxInputTokens:16e3,maxOutputTokens:16e3,config:{def:_.base().def,schema:_.base().schema}}),Wn=D,Xe=class extends B{constructor(t){super(io,t);}};var so="voyage-multilingual-2",Ys="Optimized for multilingual retrieval and RAG.",ro=V(F).parse({name:so,description:Ys,modalities:$,maxInputTokens:32e3,maxOutputTokens:32e3,config:{def:_.base().def,schema:_.base().schema}}),Zn=D,Ye=class extends B{constructor(t){super(ro,t);}};var lo="voyage-finance-2",Qs="Optimized for finance retrieval and RAG.",po=V(F).parse({name:lo,description:Qs,modalities:$,maxInputTokens:32e3,maxOutputTokens:32e3,config:{def:_.base().def,schema:_.base().schema}}),Xn=D,Qe=class extends B{constructor(t){super(po,t);}};var mo="voyage-3-lite",er="Optimized for latency and cost.",co=V(F).parse({name:mo,description:er,modalities:$,maxInputTokens:32e3,maxOutputTokens:32e3,config:{def:_.base().def,schema:_.base().schema}}),Yn=D,et=class extends B{constructor(t){super(co,t);}};var uo="voyage-3",tr="Optimized for quality.",go=V(F).parse({name:uo,description:tr,modalities:$,maxInputTokens:32e3,maxOutputTokens:32e3,config:{def:_.base().def,schema:_.base().schema}}),Qn=D,tt=class extends B{constructor(t){super(go,t);}};
5
+ var Wi=Object.defineProperty,Zi=Object.defineProperties;var Xi=Object.getOwnPropertyDescriptors;var Fo=Object.getOwnPropertySymbols;var Yi=Object.prototype.hasOwnProperty,Qi=Object.prototype.propertyIsEnumerable;var be=(o,t)=>(t=Symbol[o])?t:Symbol.for("Symbol."+o),ea=o=>{throw TypeError(o)};var Ho=(o,t,n)=>t in o?Wi(o,t,{enumerable:true,configurable:true,writable:true,value:n}):o[t]=n,P=(o,t)=>{for(var n in t||(t={}))Yi.call(t,n)&&Ho(o,n,t[n]);if(Fo)for(var n of Fo(t))Qi.call(t,n)&&Ho(o,n,t[n]);return o},Z=(o,t)=>Zi(o,Xi(t));var B=(o,t,n)=>new Promise((i,a)=>{var p=l=>{try{m(n.next(l));}catch(g){a(g);}},d=l=>{try{m(n.throw(l));}catch(g){a(g);}},m=l=>l.done?i(l.value):Promise.resolve(l.value).then(p,d);m((n=n.apply(o,t)).next());}),Ko=function(o,t){this[0]=o,this[1]=t;},Pt=(o,t,n)=>{var i=(d,m,l,g)=>{try{var u=n[d](m),E=(m=u.value)instanceof Ko,A=u.done;Promise.resolve(E?m[0]:m).then(N=>E?i(d==="return"?d:"next",m[1]?{done:N.done,value:N.value}:N,l,g):l({value:N,done:A})).catch(N=>i("throw",N,l,g));}catch(N){g(N);}},a=d=>p[d]=m=>new Promise((l,g)=>i(d,m,l,g)),p={};return n=n.apply(o,t),p[be("asyncIterator")]=()=>p,a("next"),a("throw"),a("return"),p},Jo=o=>{var t=o[be("asyncIterator")],n=false,i,a={};return t==null?(t=o[be("iterator")](),i=p=>a[p]=d=>t[p](d)):(t=t.call(o),i=p=>a[p]=d=>{if(n){if(n=false,p==="throw")throw d;return d}return n=true,{done:false,value:new Ko(new Promise(m=>{var l=t[p](d);l instanceof Object||ea("Object expected"),m(l);}),1)}}),a[be("iterator")]=()=>a,i("next"),"throw"in t?i("throw"):a.throw=p=>{throw p},"return"in t&&i("return"),a};var ie="system",ee="user",q="assistant",ge="tool",ta=[ie,ee,q,ge],Lt=zod.z.enum(ta),oa=[q],na=zod.z.enum(oa),Xo="error",Yo="safety",ia=zod.z.object({type:zod.z.literal(Yo),value:zod.z.object({category:zod.z.string(),probability:zod.z.string(),blocked:zod.z.boolean(),message:zod.z.string()})}),Qo="response_error",aa=zod.z.object({type:zod.z.literal(Qo),value:zod.z.object({code:zod.z.string(),message:zod.z.string(),provider:zod.z.string().optional()})}),sa=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(Xo),value:zod.z.discriminatedUnion("type",[ia,aa]),metadata:o}),en="partial-error",ra=zod.z.object({type:zod.z.literal(Yo),category:zod.z.string().optional(),probability:zod.z.string().optional(),blocked:zod.z.boolean().optional(),message:zod.z.string().optional()}),la=zod.z.object({type:zod.z.literal(Qo),code:zod.z.string().optional(),message:zod.z.string().optional(),provider:zod.z.string().optional()}),da=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(en),value:zod.z.discriminatedUnion("type",[ra,la]),metadata:o}),X="image",qt="base64",pa=["png","jpeg","webp","gif"],ma=zod.z.object({type:zod.z.literal(qt),base64:zod.z.string(),mediaType:zod.z.enum(pa)}),ca="url",ua=zod.z.object({type:zod.z.literal(ca),url:zod.z.string()}),ga=zod.z.discriminatedUnion("type",[ma,ua]),ha=["low","medium","high","auto"],ya=zod.z.enum(ha),fa=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(X),detail:ya,value:ga,metadata:o}),tn="pdf",ba="base64",Ca=zod.z.object({type:zod.z.literal(ba),base64:zod.z.string()}),Ta="url",Ma=zod.z.object({type:zod.z.literal(Ta),url:zod.z.string()}),ka=zod.z.discriminatedUnion("type",[Ca,Ma]),Sa=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(tn),value:ka,file:zod.z.object({name:zod.z.string(),id:zod.z.string(),size:zod.z.number().optional()}),metadata:o}),Y="reasoning",Ce="partial-reasoning",Te="thinking",jt="redacted",wt=zod.z.object({type:zod.z.literal(Te),thinking:zod.z.string(),signature:zod.z.string()}),on=zod.z.object({type:zod.z.literal(jt),data:zod.z.string()}),Ra=zod.z.discriminatedUnion("type",[wt,on]),It=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(Y),value:Ra,metadata:o}),Oa=zod.z.object({type:zod.z.literal(Te),thinking:wt.shape.thinking.optional(),signature:wt.shape.signature.optional()}),xa=zod.z.discriminatedUnion("type",[Oa,on]),Vt=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(Ce),value:xa,metadata:o}),nn="search-result",va=zod.z.object({type:zod.z.string().optional(),query:zod.z.string(),responses:zod.z.array(zod.z.object({source:zod.z.string(),url:zod.z.string(),title:zod.z.string(),snippet:zod.z.string().optional()})),references:zod.z.array(zod.z.object({text:zod.z.string(),responseIndices:zod.z.array(zod.z.number()),startIndex:zod.z.number().optional(),endIndex:zod.z.number().optional(),confidenceScores:zod.z.array(zod.z.number()).optional()}))}),Ea=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(nn),value:va,metadata:o}),an="partial-search-result",_a=zod.z.object({type:zod.z.string().optional(),query:zod.z.string().optional(),responses:zod.z.array(zod.z.object({source:zod.z.string().optional(),url:zod.z.string().optional(),title:zod.z.string().optional(),snippet:zod.z.string().optional()})).optional(),references:zod.z.array(zod.z.object({text:zod.z.string().optional(),responseIndices:zod.z.array(zod.z.number()).optional(),startIndex:zod.z.number().optional(),endIndex:zod.z.number().optional(),confidenceScores:zod.z.array(zod.z.number()).optional()})).optional()}),Pa=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(an),value:_a,metadata:o}),j="text",sn=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(j),value:zod.z.string(),metadata:o}),Dt="partial-text",rn=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(Dt),value:zod.z.string(),metadata:o}),F="tool-call",ln=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(F),index:zod.z.number().int().nonnegative(),id:zod.z.string().min(1),name:zod.z.string().min(1),arguments:zod.z.string(),serverName:zod.z.string().optional(),thoughtSignature:zod.z.string().optional(),metadata:o}),Nt="partial-tool-call",dn=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(Nt),index:zod.z.number().int().nonnegative(),id:zod.z.string().optional(),name:zod.z.string().optional(),arguments:zod.z.string().optional(),serverName:zod.z.string().optional(),thoughtSignature:zod.z.string().optional(),metadata:o}),K="tool-response",pn=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(K),index:zod.z.number().int().nonnegative(),id:zod.z.string().min(1),name:zod.z.string().min(1),data:zod.z.string(),apiResponse:zod.z.object({statusCode:zod.z.number().int().nonnegative()}).optional(),metadata:o}),mn="partial-tool-response",cn=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(mn),index:zod.z.number().int().nonnegative(),id:zod.z.string().optional(),name:zod.z.string().optional(),data:zod.z.string().optional(),apiResponse:zod.z.object({statusCode:zod.z.number().int().nonnegative()}).optional(),metadata:o}),Aa=[j,X,tn,F,K,Y,Xo,nn],un=zod.z.enum(Aa),wa=(o=zod.z.undefined(),t=zod.z.undefined(),n=zod.z.undefined(),i=zod.z.undefined(),a=zod.z.undefined(),p=zod.z.undefined(),d=zod.z.undefined(),m=zod.z.undefined())=>zod.z.discriminatedUnion("modality",[sn(o),fa(t),Sa(n),ln(i),pn(a),It(p),sa(d),Ea(m)]),La=[Dt,Nt,Ce,en,an];zod.z.enum(La);var qa=(o=zod.z.undefined(),t=zod.z.undefined(),n=zod.z.undefined(),i=zod.z.undefined(),a=zod.z.undefined(),p=zod.z.undefined())=>zod.z.discriminatedUnion("modality",[rn(o),dn(t),Vt(i),cn(n),da(a),Pa(p)]);var Bt=(o=Lt,t=zod.z.undefined(),n=zod.z.undefined(),i=zod.z.undefined(),a=zod.z.undefined(),p=zod.z.undefined(),d=zod.z.undefined(),m=zod.z.undefined())=>zod.z.object({role:o,content:zod.z.array(wa(t,n,i,a,d,p)),metadata:m}),le=(o=na,t=zod.z.undefined(),n=zod.z.undefined(),i=zod.z.undefined(),a=zod.z.undefined(),p=zod.z.undefined())=>zod.z.object({role:o,partialContent:qa(t,n,i,p),metadata:a}),ja=zod.z.object({promptTokens:zod.z.number().nonnegative(),completionTokens:zod.z.number().nonnegative(),totalTokens:zod.z.number().nonnegative()}),Go=zod.z.object({token:zod.z.string(),logProb:zod.z.number(),bytes:zod.z.array(zod.z.number().int()).nullable()}),Ia=Go.extend({topLogProbs:zod.z.array(Go)}),gn=zod.z.array(Ia);zod.z.object({messages:zod.z.array(Bt()),usage:ja.optional(),logProbs:gn.optional()});var Va=zod.z.object({promptTokens:zod.z.number().nonnegative().optional(),completionTokens:zod.z.number().nonnegative().optional(),totalTokens:zod.z.number().nonnegative().optional()});zod.z.object({partialMessages:zod.z.array(le()),usage:Va.optional(),logProbs:gn.optional()});var Me=(o=zod.z.record(zod.z.string(),zod.z.any()).optional())=>o,Da=zod.z.object({enabled:zod.z.boolean().default(true),allowedTools:zod.z.array(zod.z.string().min(1))}),hn=zod.z.object({type:zod.z.literal("url"),url:zod.z.string().url().refine(o=>o.startsWith("https://"),{message:"MCP server URL must start with https://"}),name:zod.z.string().min(1),toolConfiguration:Da.optional(),authorizationToken:zod.z.string().min(1).optional()}),Na=["object","array","number","string","boolean","enum"],Wo=zod.z.enum(Na),Ba=zod.z.object({anyOf:zod.z.array(zod.z.any()).optional(),type:zod.z.union([Wo,zod.z.array(zod.z.union([Wo,zod.z.literal("null")]))]).optional(),default:zod.z.any().optional(),title:zod.z.string().optional(),description:zod.z.string().max(4096).optional(),properties:zod.z.record(zod.z.any()).optional(),required:zod.z.array(zod.z.string()).optional(),minItems:zod.z.number().int().min(0).optional(),maxItems:zod.z.number().int().optional(),items:zod.z.record(zod.z.any()).optional(),enum:zod.z.array(zod.z.union([zod.z.string(),zod.z.number(),zod.z.boolean(),zod.z.null()])).optional(),minimum:zod.z.number().optional(),maximum:zod.z.number().optional(),minLength:zod.z.number().int().min(0).optional(),maxLength:zod.z.number().int().optional(),$ref:zod.z.string().optional()}),Ua=zod.z.object({type:zod.z.enum(["object"]),required:zod.z.array(zod.z.string()),$defs:zod.z.record(zod.z.any()).optional(),properties:zod.z.record(Ba),additionalProperties:zod.z.literal(false)});zod.z.object({name:zod.z.string().regex(/^[a-zA-Z0-9_]{1,64}$/).max(64),description:zod.z.string().max(4096),strict:zod.z.boolean().optional(),schema:Ua}).optional();var te="text",yn="token",za=[te,yn],fn=zod.z.enum(za),$a=zod.z.array(zod.z.string().min(1)),Fa=zod.z.array(zod.z.array(zod.z.number().int().nonnegative())),bn=(o=zod.z.undefined())=>zod.z.discriminatedUnion("modality",[zod.z.object({modality:zod.z.literal(te),metadata:o,requests:$a}),zod.z.object({modality:zod.z.literal(yn),metadata:o,requests:Fa})]),Ut="float",Ha=zod.z.object({index:zod.z.number().int().nonnegative(),embedding:zod.z.array(zod.z.number())}),zt="base64",Ka=zod.z.object({index:zod.z.number().int().nonnegative(),embedding:zod.z.string().base64()}),Zo=zod.z.object({totalTokens:zod.z.number().int().nonnegative()});zod.z.discriminatedUnion("encodingFormat",[zod.z.object({encodingFormat:zod.z.literal(Ut),embeddings:zod.z.array(Ha),usage:Zo.optional()}),zod.z.object({encodingFormat:zod.z.literal(zt),embeddings:zod.z.array(Ka),usage:Zo.optional()})]);var Ja=o=>{let t=new WeakSet;return JSON.stringify(o,(n,i)=>{if(typeof i=="object"&&i!==null){if(t.has(i))return;t.add(i);}return i})},Ga=o=>o==null?"unknown error":typeof o=="string"?o:o instanceof Error?o.message:Ja(o),At="GatewayBaseError",oe=class Cn extends Error{constructor({info:t,cause:n},i){super(`[${i!=null?i:At}]: ${t}
6
+ Message: ${Ga(n)}`),this.name=At,this.info=t,this.cause=n,this.name=i!=null?i:At,Object.setPrototypeOf(this,new.target.prototype);}static isGatewayBaseError(t){return t instanceof Cn}toJSON(){return {name:this.name,info:this.info,cause:this.cause,message:this.message,stack:this.stack}}},Wa=zod.z.object({inputPricePerMillion:zod.z.number().nonnegative().describe("Price per 1M input tokens"),outputPricePerMillion:zod.z.number().nonnegative().describe("Price per 1M output tokens")}).describe("Input/output price pair (per 1M tokens) for a specific category within a ChatModel pricing tier."),Za=zod.z.object({base:Wa.describe("Base (uncached, non\u2011reasoning) rates")}).describe("Holds the `ChatModelTokenPairPrice` for different categories (e.g., base) within a single pricing tier."),Xa=zod.z.object({minTokens:zod.z.number().int().nonnegative().describe("Inclusive lower token bound for this tier."),maxTokens:zod.z.number().int().nullable().optional().describe("Exclusive upper token bound; `null` means \u221E."),prices:Za.describe("Price categories and rates for this specific token range.")}).refine(o=>o.maxTokens===null||typeof o.maxTokens=="number"&&o.maxTokens>o.minTokens,{message:"maxTokens must be > minTokens (or null for infinite).",path:["maxTokens"]}).describe("A single pricing tier defined by a token range and associated prices.");zod.z.object({modelName:zod.z.string().describe("Model name this schedule applies to."),currency:zod.z.string().default("USD").describe("Currency code (e.g., USD)."),tokenRanges:zod.z.array(Xa).min(1).describe("Pricing tiers (`ChatModelTokenRangePrice`) schedule, sorted by minTokens.")}).superRefine((o,t)=>{let{tokenRanges:n}=o;n[0].minTokens!==0&&t.addIssue({code:zod.z.ZodIssueCode.custom,path:["tokenRanges",0,"minTokens"],message:"The first tier must have minTokens = 0."});for(let a=1;a<n.length;a++){let p=n[a-1],d=n[a];if(p.maxTokens===null){t.addIssue({code:zod.z.ZodIssueCode.custom,path:["tokenRanges",a-1,"maxTokens"],message:"Cannot define any tokenRanges after an infinite tier (maxTokens = null)."});break}d.minTokens!==p.maxTokens&&t.addIssue({code:zod.z.ZodIssueCode.custom,path:["tokenRanges",a,"minTokens"],message:`Tier ${a} minTokens (${d.minTokens}) must equal previous tier's maxTokens (${p.maxTokens}) for contiguity.`}),d.minTokens<p.minTokens&&t.addIssue({code:zod.z.ZodIssueCode.custom,path:["tokenRanges",a,"minTokens"],message:`tokenRanges must be sorted by ascending minTokens. Tier ${a} (${d.minTokens}) starts before Tier ${a-1} (${p.minTokens}).`});}let i=n[n.length-1];n.every(a=>a.maxTokens!==null||a===i)&&i.maxTokens!==null&&t.addIssue({code:zod.z.ZodIssueCode.custom,path:["tokenRanges",n.length-1,"maxTokens"],message:"The final tier must have maxTokens = null (representing infinity)."});}).describe("Complete pricing schedule for a single chat model, including all its token-based tiers.");var Tn=zod.z.object({modelName:zod.z.string().min(1).describe("Model name this price applies to."),currency:zod.z.string().default("USD").describe("Currency code (e.g., USD)."),inputPricePerMillion:zod.z.number().nonnegative().describe("Price per 1M input tokens.")}).describe("Complete (flat) pricing for a single embedding model."),Ya="function";var Qa=zod.z.enum(["object","array","number","string","boolean","null"]),es=zod.z.object({anyOf:zod.z.array(zod.z.any()).optional(),type:Qa.optional(),default:zod.z.any().optional(),title:zod.z.string().optional(),description:zod.z.string().max(4096).optional(),properties:zod.z.record(zod.z.any()).optional(),required:zod.z.array(zod.z.string()).optional(),minItems:zod.z.number().int().min(0).optional(),maxItems:zod.z.number().int().optional(),items:zod.z.record(zod.z.any()).optional(),enum:zod.z.array(zod.z.union([zod.z.string(),zod.z.number(),zod.z.boolean(),zod.z.null()])).optional(),minimum:zod.z.number().optional(),maximum:zod.z.number().optional(),minLength:zod.z.number().int().min(0).optional(),maxLength:zod.z.number().int().optional()});zod.z.object({type:zod.z.enum(["object"]),title:zod.z.string().optional(),$defs:zod.z.record(zod.z.any()).optional(),properties:zod.z.record(es).optional(),required:zod.z.array(zod.z.string()).optional()});var ts=zod.z.object({name:zod.z.string().regex(/^[a-zA-Z0-9_]{1,64}$/).max(64),description:zod.z.string().max(4096),parameters:zod.z.any(),strict:zod.z.boolean().optional()});var os=zod.z.enum(["function"]),ns=zod.z.object({maxAttempts:zod.z.number().int().positive(),initialDelay:zod.z.number().int().positive(),exponentialFactor:zod.z.number().int().positive()}),is=zod.z.object({type:zod.z.literal("http"),method:zod.z.enum(["get","post"]),url:zod.z.string().url(),headers:zod.z.record(zod.z.string()).optional(),query:zod.z.record(zod.z.string()).optional(),body:zod.z.record(zod.z.any()).optional(),proxyUrl:zod.z.string().url().optional(),proxyHeaders:zod.z.record(zod.z.string()).optional(),retry:ns.optional()}),as=zod.z.discriminatedUnion("type",[is]),ss=zod.z.object({type:os,definition:zod.z.object({schema:ts}),request:as.optional()}),rs=[Ya];zod.z.enum(rs);var Mn=(o=zod.z.undefined())=>zod.z.discriminatedUnion("type",[ss.extend({metadata:o})]),kn=o=>sn().parse({modality:j,value:o}),$t=(o,t,n,i,a,p)=>ln().parse({modality:F,index:o,id:t,name:n,arguments:i,serverName:a,thoughtSignature:p}),Sn=(o,t,n,i,a,p)=>pn().parse({modality:K,index:o,id:t,name:n,data:i,apiResponse:a,metadata:p});var Ft=(o,t)=>le().parse({role:o,partialContent:rn().parse({modality:Dt,value:t})}),ke=(o,t,n,i,a,p,d)=>le().parse({role:o,partialContent:dn().parse({modality:Nt,index:t,id:n,name:i,arguments:a,serverName:p,thoughtSignature:d})}),Rn=(o,t,n,i,a)=>le().parse({role:o,partialContent:cn().parse({modality:mn,index:t,id:n,name:i,data:a})}),On=(o,t)=>It().parse({modality:Y,value:{type:Te,thinking:o,signature:t}});var xn=o=>It().parse({modality:Y,value:{type:jt,data:o}});var Se=(o,t,n)=>le().parse({role:o,partialContent:Vt().parse({modality:Ce,value:{type:Te,thinking:t,signature:n}})}),vn=(o,t)=>le().parse({role:o,partialContent:Vt().parse({modality:Ce,value:{type:jt,data:t}})});var ls=Object.defineProperty,En=Object.getOwnPropertySymbols,ds=Object.prototype.hasOwnProperty,ps=Object.prototype.propertyIsEnumerable,_n=(o,t,n)=>t in o?ls(o,t,{enumerable:true,configurable:true,writable:true,value:n}):o[t]=n,he=(o,t)=>{for(var n in t||(t={}))ds.call(t,n)&&_n(o,n,t[n]);if(En)for(var n of En(t))ps.call(t,n)&&_n(o,n,t[n]);return o},Pn="ProviderError",Ht=class Dn extends oe{constructor({info:t,cause:n}){super({info:t,cause:n},Pn),this.name=Pn,this.info=t,this.cause=n;}static isProviderError(t){return t instanceof Dn}};var An="ModelResponseError",J=class Nn extends oe{constructor({info:t,cause:n}){super({info:t,cause:n},An),this.name=An,this.cause=n,this.info=t;}static isModelResponseError(t){return t instanceof Nn}},wn="InvalidModelRequestError",ye=class Bn extends oe{constructor({info:t,cause:n}){super({info:t,cause:n},wn),this.name=wn,this.cause=n,this.info=t,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidModelRequestError(t){return t instanceof Bn}},Ln="InvalidConfigError",Q=class Un extends oe{constructor({info:t,cause:n}){super({info:t,cause:n},Ln),this.name=Ln,this.cause=n,this.info=t,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidConfigError(t){return t instanceof Un}},qn="InvalidMessagesError",H=class zn extends oe{constructor({info:t,cause:n}){super({info:t,cause:n},qn),this.name=qn,this.cause=n,this.info=t,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidMessagesError(t){return t instanceof zn}},jn="InvalidToolsError",Kt=class $n extends oe{constructor({info:t,cause:n}){super({info:t,cause:n},jn),this.name=jn,this.cause=n,this.info=t,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidToolsError(t){return t instanceof $n}},In="InvalidEmbeddingRequestsError",Jt=class Fn extends oe{constructor({info:t,cause:n}){super({info:t,cause:n},In),this.name=In,this.info=t,this.cause=n,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidEmbeddingRequestsError(t){return t instanceof Fn}},Gt="multi-string",Hn=zod.z.object({type:zod.z.literal(Gt),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),max:zod.z.number().int().positive()}),ms=o=>zod.z.array(zod.z.string()).max(o).default([]).optional(),Kn=o=>({def:Hn.parse(he({type:Gt},o)),schema:ms(o.max)}),Wt="object-schema",Jn=zod.z.object({type:zod.z.literal(Wt),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),objectSchema:zod.z.any()}),cs=o=>o.optional(),Gn=o=>({def:Jn.parse(he({type:Wt},o)),schema:cs(o.objectSchema)}),Wn="paired-select",us=zod.z.object({value:zod.z.string().min(1),label:zod.z.string().min(1)}),Vn=zod.z.object({key:zod.z.string().min(1),label:zod.z.string().min(1),description:zod.z.string().min(1).max(500).optional(),choices:zod.z.array(us).min(1)}),gs=zod.z.object({type:zod.z.literal(Wn),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),fields:zod.z.tuple([Vn,Vn]),uniqueByField:zod.z.string().min(1).optional()});var Zt="range",Zn=zod.z.object({type:zod.z.literal(Zt),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),min:zod.z.number().int(),max:zod.z.number().int(),step:zod.z.number().positive(),default:zod.z.number()}),hs=(o,t,n,i)=>zod.z.number().min(o).max(t).step(n).default(i).optional(),ae=o=>({def:Zn.parse(he({type:Zt},o)),schema:hs(o.min,o.max,o.step,o.default)}),Xt="select-boolean",Xn=zod.z.object({type:zod.z.literal(Xt),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),default:zod.z.boolean().nullable()}),ys=o=>zod.z.boolean().nullable().default(o).optional(),de=o=>({def:Xn.parse(he({type:Xt},o)),schema:ys(o.default)}),Yt="select-string",Yn=zod.z.object({type:zod.z.literal(Yt),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),default:zod.z.string(),choices:zod.z.array(zod.z.string())}),fs=(o,t)=>zod.z.enum(t).nullable().default(o).optional(),se=o=>({def:Yn.parse(he({type:Yt},o)),schema:fs(o.default,o.choices)}),Qn="string",bs=zod.z.object({type:zod.z.literal(Qn),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),default:zod.z.string().optional(),minLength:zod.z.number().int().nonnegative().optional(),maxLength:zod.z.number().int().positive().optional()});var Cs=[Zt,Gt,Yt,Wt,Xt,Wn,Qn];zod.z.enum(Cs);var ei=zod.z.discriminatedUnion("type",[Zn,Hn,Yn,Xn,Jn,gs,bs]),T=(o=Lt,t=un)=>zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1),roles:zod.z.record(o,zod.z.string().min(1).optional()),modalities:zod.z.array(t).nonempty(),maxInputTokens:zod.z.number().int().positive().min(1),maxOutputTokens:zod.z.number().int().positive().min(1),maxReasoningTokens:zod.z.number().int().positive().min(1).optional(),config:zod.z.object({def:zod.z.record(zod.z.string().min(1),ei),schema:zod.z.instanceof(zod.z.ZodObject)}).refine(n=>{var i,a;let p=Object.keys(n.def),d=Object.keys((a=(i=n.schema)==null?void 0:i.shape)!=null?a:{});return p.every(m=>d.includes(m))&&d.every(m=>p.includes(m))},{message:"Keys in 'config.def' must exactly match keys in 'config.schema'"}),price:zod.z.custom()}),O=(o=fn)=>zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1),modalities:zod.z.array(o).nonempty(),maxInputTokens:zod.z.number().int().positive().min(1),maxOutputTokens:zod.z.number().int().positive().min(1),config:zod.z.object({def:zod.z.record(zod.z.string().min(1),ei),schema:zod.z.instanceof(zod.z.ZodObject)}).refine(t=>{var n,i;let a=Object.keys(t.def),p=Object.keys((i=(n=t.schema)==null?void 0:n.shape)!=null?i:{});return a.every(d=>p.includes(d))&&p.every(d=>a.includes(d))},{message:"Keys in 'config.def' must exactly match keys in 'config.schema'"}),price:zod.z.custom()});zod.z.record(zod.z.string());zod.z.record(zod.z.union([zod.z.boolean(),zod.z.string(),zod.z.number(),zod.z.object({}),zod.z.array(zod.z.any()),zod.z.null(),zod.z.undefined()]));zod.z.string().url();var Ts={type:"range",title:"Temperature",description:"Adjusts the model's creativity level. With a setting of 0, the model strictly picks the most probable next word. For endeavors that benefit from a dash of inventiveness, consider dialing it up to 0.7 or higher, enabling the model to produce text that's unexpectedly fresh."},Ms={type:"range",title:"Max tokens",description:"Specify the total tokens for generation, where one token approximates four English characters. Setting this to 0 defaults to the model's maximum capacity."},ks={type:"range",title:"Max reasoning tokens",description:"Specify the total tokens for reasoning, where one token approximates four English characters."},Ss=o=>({type:"multi",title:"Stop sequence",description:`Enter up to ${o} sequences that will halt additional text output. The generated text will exclude these sequences.`}),Rs={type:"range",title:"Top A",description:"Considers only the top tokens that have 'sufficiently high' probabilities relative to the most likely token, functioning like a dynamic Top-P. A lower Top-A value narrows down the token choices based on the highest probability token, while a higher Top-A value refines the filtering without necessarily impacting the creativity of the output."},Os={type:"range",title:"Top P",description:"Selects a subset of likely tokens for generation, restricting choices to the top-P fraction of possibilities, such as the top 10% when P=0.1. This approach can limit the variety of the output. By default, it's set to 1, indicating no restriction. It's advised to adjust this parameter or temperature to modulate output diversity, but not to modify both simultaneously."},xs={type:"range",title:"Top K",description:"Select only from the highest K probabilities for each following word, effectively eliminating the less likely 'long tail' options."},vs={type:"range",title:"Min P",description:"Specifies the minimum probability a token must have to be considered, in relation to the probability of the most likely token. (This value varies based on the confidence level of the top token.) For example, if Min-P is set to 0.1, only tokens with at least 1/10th the probability of the highest-ranked token will be considered."},Es={type:"range",title:"Frequency penalty",description:"Minimize redundancy. By assigning a penalty to frequently used tokens within the text, the likelihood of repeating identical phrases is reduced. The default setting for this penalty is zero."},_s={type:"range",title:"Presence penalty",description:"Enhance the introduction of novel subjects by reducing the preference for tokens that have already appeared in the text, thus boosting the chances of exploring fresh topics. The standard setting for this is zero."},Ps={type:"range",title:"Seed",description:"When seed is fixed to a specific value, the model makes a best effort to provide the same response for repeated requests. Deterministic output isn't guaranteed. Also, changing the model or parameter settings, such as the temperature, can cause variations in the response even when you use the same seed value. By default, a random seed value is used."},As={type:"range",title:"Repetition penalty",description:"Reduces the likelihood of repeating tokens from the input. Increasing this value makes the model less prone to repetition, but setting it too high may lead to less coherent output, often resulting in run-on sentences missing smaller words. The token penalty is scaled according to the original token's probability."},ws={type:"boolean",title:"Log probs",description:"Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned."},Ls={type:"range",title:"Top log probs",description:"The number of most likely tokens to return at each token position, each with an associated log probability. 'logprobs' must be set to true if this parameter is used."},qs={type:"boolean",title:"Echo",description:"If true, the response will contain the prompt."},js={type:"select",title:"Response format",description:"Choose the response format of your model. For JSON, you must include the string 'JSON' in some form within your system / user prompt."},Is={type:"select",title:"Response format",description:"Choose the response format of your model. 'json_object' colloquially known as JSON mode, instructs the model to respond with a valid JSON (must include the term 'json' in prompt). 'json_schema' colloquially known as structured outputs, allows you to specify a strict response schema that the model will adhere to."},Vs={type:"object",title:"Response schema",description:"When response format is set to 'json_schema', the model will return a JSON object of the specified schema."},Ds={type:"object",title:"MCP servers",description:"MCP servers to use for the model."},I={TEMPERATURE:Ts,MAX_TOKENS:Ms,STOP:Ss,TOP_A:Rs,TOP_P:Os,TOP_K:xs,MIN_P:vs,FREQUENCY_PENALTY:Es,PRESENCE_PENALTY:_s,REPETITION_PENALTY:As,SEED:Ps,LOG_PROBS:ws,TOP_LOG_PROBS:Ls,ECHO:qs,RESPONSE_FORMAT:js,RESPONSE_FORMAT_WITH_SCHEMA:Is,RESPONSE_SCHEMA:Vs,MAX_REASONING_TOKENS:ks,MCP_SERVERS:Ds};var Re=o=>Object.fromEntries(Object.entries(o).filter(([t,n])=>n!=null));var re=o=>o==null?void 0:o.replace(/\/$/,"");var Qt=ae({param:"temperature",title:I.TEMPERATURE.title,description:I.TEMPERATURE.description,min:0,max:1,step:.01,default:1}),eo=o=>ae({param:"max_tokens",title:I.MAX_TOKENS.title,description:I.MAX_TOKENS.description,min:0,max:o,step:1,default:0}),to=o=>Kn({param:"stop_sequences",title:I.STOP(o).title,description:I.STOP(o).description,max:o}),oo=ae({param:"top_p",title:I.TOP_P.title,description:I.TOP_P.description,min:0,max:1,step:.01,default:1}),no=ae({param:"top_k",title:I.TOP_K.title,description:I.TOP_K.description,min:0,max:1,step:.01,default:1}),io=se({param:"tool_choice",title:"Tool choice",description:"Controls which (if any) tool is called by the model. 'any' means the model will call any of the provided tools. 'auto' means the model can pick between generating a message or calling a tool.",default:"auto",choices:["auto","any"]}),ao=de({param:"mcp",title:"MCP",description:"Enable or disable Model Context Protocol (MCP) functionality for this model.",default:false}),so=Gn({param:"mcp_servers",title:I.MCP_SERVERS.title,description:I.MCP_SERVERS.description,objectSchema:zod.z.array(hn)});var Oe=(o,t)=>zod.z.object({temperature:Qt.schema,maxTokens:eo(o).schema,stop:to(t).schema,topP:oo.schema,topK:no.schema,toolChoice:io.schema,mcp:ao.schema,mcpServers:so.schema}),xe=(o,t)=>({temperature:Qt.def,maxTokens:eo(o).def,stop:to(t).def,topP:oo.def,topK:no.def,toolChoice:io.def,mcp:ao.def,mcpServers:so.def});var ti=(o,t)=>ae({param:"max_reasoning_tokens",title:I.MAX_REASONING_TOKENS.title,description:I.MAX_REASONING_TOKENS.description,min:o,max:t,step:1,default:0}),oi=de({param:"reasoning_enabled",title:"Reasoning Enabled",description:`Controls whether the model is allowed to think for a longer period of time before generating a response.
7
+ This can be useful for complex tasks that require more time to think.`,default:false}),ni=(o,t,n,i)=>Z(P({},xe(o,t)),{reasoningEnabled:oi.def,maxReasoningTokens:ti(n,i).def}),ii=(o,t,n,i)=>Oe(o,t).extend({reasoningEnabled:oi.schema,maxReasoningTokens:ti(n,i).schema});var pe=se({param:"encoding_format",title:"Encoding format",description:"Select the encoding format for the word embedding.",default:"",choices:["base64",""]}),me=se({param:"input_type",title:"Input type",description:"Select the input type for the word embedding.",default:"",choices:["query","document",""]}),ce=de({param:"truncation",title:"Truncation",description:"Select the truncation for the word embedding.",default:true}),ro=se({param:"output_dimension",title:"Output dimension",description:"Number of dimensions for the returned embeddings. Leave empty to use the model's default.",default:"",choices:["","256","512","1024","2048"]}),lo=se({param:"output_dtype",title:"Output data type",description:"Data type of the returned embeddings. Leave empty to use the model's default (float).",default:"",choices:["","float","int8","uint8","binary","ubinary"]});var ai=()=>zod.z.object({encodingFormat:pe.schema,inputType:me.schema,truncation:ce.schema}),si=()=>({encodingFormat:pe.def,inputType:me.def,truncation:ce.def});var ri=()=>zod.z.object({encodingFormat:pe.schema,inputType:me.schema,truncation:ce.schema,outputDimension:ro.schema,outputDtype:lo.schema}),li=()=>({encodingFormat:pe.def,inputType:me.def,truncation:ce.def,outputDimension:ro.def,outputDtype:lo.def});var h={base:(o,t)=>({def:xe(o,t),schema:Oe(o,t)}),extendedThinking:(o,t,n,i)=>({def:ni(o,t,n,i),schema:ii(o,t,n,i)})},y={base:()=>({def:si(),schema:ai()}),flexible:()=>({def:li(),schema:ri()})};var $s="anthropic",ne=class{constructor(){this.version="v1";this.name=$s;this.chatModelFactories={[Mo]:{model:We,modelOptions:Ti,modelSchema:ko},[xo]:{model:Qe,modelOptions:Si,modelSchema:vo},[Ro]:{model:Ye,modelOptions:ki,modelSchema:Oo},[$e]:{model:Fe,modelOptions:fi,modelSchema:bo},[He]:{model:Ke,modelOptions:bi,modelSchema:Co},[Ze]:{model:Xe,modelOptions:Mi,modelSchema:So},[Je]:{model:Ge,modelOptions:Ci,modelSchema:To},[_e]:{model:Pe,modelOptions:pi,modelSchema:mo},[Ve]:{model:De,modelOptions:gi,modelSchema:ho},[Ne]:{model:Be,modelOptions:hi,modelSchema:yo},[Ue]:{model:ze,modelOptions:yi,modelSchema:fo},[ve]:{model:Ee,modelOptions:di,modelSchema:po},[Ae]:{model:we,modelOptions:mi,modelSchema:co},[Le]:{model:qe,modelOptions:ci,modelSchema:uo},[je]:{model:Ie,modelOptions:ui,modelSchema:go}};this.embeddingModelFactories={[pt]:{model:mt,modelOptions:_i,modelSchema:Lo},[lt]:{model:dt,modelOptions:Ei,modelSchema:wo},[et]:{model:tt,modelOptions:Ri,modelSchema:Eo},[ot]:{model:nt,modelOptions:Oi,modelSchema:_o},[it]:{model:at,modelOptions:xi,modelSchema:Po},[st]:{model:rt,modelOptions:vi,modelSchema:Ao},[ct]:{model:ut,modelOptions:Pi,modelSchema:qo},[gt]:{model:ht,modelOptions:Ai,modelSchema:jo},[yt]:{model:ft,modelOptions:wi,modelSchema:Io},[bt]:{model:Ct,modelOptions:Li,modelSchema:Vo},[Tt]:{model:Mt,modelOptions:qi,modelSchema:Do},[kt]:{model:St,modelOptions:ji,modelSchema:No},[Rt]:{model:Ot,modelOptions:Ii,modelSchema:Bo},[xt]:{model:vt,modelOptions:Vi,modelSchema:Uo}};}chatModelLiterals(){return Object.keys(this.chatModelFactories)}chatModelSchemas(){return Object.keys(this.chatModelFactories).reduce((t,n)=>(t[n]=this.chatModelFactories[n].modelSchema,t),{})}chatModel(t){let n=t.modelName;if(!(n in this.chatModelFactories))throw new Ht({info:`Anthropic chat model: ${n} not found`,cause:new Error(`Anthropic chat model: ${n} not found, available chat models:
8
+ ${this.chatModelLiterals().join(", ")}`)});let i=this.chatModelFactories[n].model,a=this.chatModelFactories[n].modelOptions.parse(t);return new i(a)}embeddingModelLiterals(){return Object.keys(this.embeddingModelFactories)}embeddingModelSchemas(){return Object.keys(this.embeddingModelFactories).reduce((t,n)=>(t[n]=this.embeddingModelFactories[n].modelSchema,t),{})}embeddingModel(t){let n=t.modelName;if(!(n in this.embeddingModelFactories))throw new Ht({info:`Anthropic embedding model: ${n} not found`,cause:new Error(`Anthropic embedding model: ${n} not found, available embedding models:
9
+ ${this.embeddingModelLiterals().join(", ")}`)});let i=this.embeddingModelFactories[n].model,a=this.embeddingModelFactories[n].modelOptions.parse(t);return new i(a)}};ne.chatBaseUrl="https://api.anthropic.com/v1",ne.embeddingBaseUrl="https://api.voyageai.com/v1";var _={"claude-3-opus-20240229":{modelName:"claude-3-opus-20240229",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:15,outputPricePerMillion:75}}}]},"claude-3-sonnet-20240229":{modelName:"claude-3-sonnet-20240229",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:15}}}]},"claude-3-5-sonnet-20240620":{modelName:"claude-3-5-sonnet-20240620",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:15}}}]},"claude-3-5-sonnet-20241022":{modelName:"claude-3-5-sonnet-20241022",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:15}}}]},"claude-3-7-sonnet-20250219":{modelName:"claude-3-7-sonnet-20250219",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:15}}}]},"claude-3-haiku-20240307":{modelName:"claude-3-haiku-20240307",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.25,outputPricePerMillion:1.25}}}]},"claude-3-haiku-20241022":{modelName:"claude-3-haiku-20241022",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.25,outputPricePerMillion:1.25}}}]},"claude-3-5-haiku-20241022":{modelName:"claude-3-5-haiku-20241022",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.8,outputPricePerMillion:4}}}]},"claude-4-sonnet-20250514":{modelName:"claude-4-sonnet-20250514",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:15}}}]},"claude-4-opus-20250514":{modelName:"claude-4-opus-20250514",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:15,outputPricePerMillion:75}}}]},"claude-sonnet-4-5-20250929":{modelName:"claude-sonnet-4-5-20250929",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:15}}}]},"claude-sonnet-4-6":{modelName:"claude-sonnet-4-6",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:15}}}]},"claude-haiku-4-5-20251001":{modelName:"claude-haiku-4-5-20251001",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1,outputPricePerMillion:5}}}]},"claude-opus-4-5-20251101":{modelName:"claude-opus-4-5-20251101",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:5,outputPricePerMillion:25}}}]},"claude-opus-4-6":{modelName:"claude-opus-4-6",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:5,outputPricePerMillion:25}}}]},"claude-opus-4-7":{modelName:"claude-opus-4-7",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:5,outputPricePerMillion:25}}}]}};var M=zod.z.enum([ie,ee,q,ge]),k={system:ie,user:ee,assistant:q,tool:ee};var U=[j,X,F,K],z=zod.z.enum([j,X,F,K]),V=[j,X,F,K,Y],D=zod.z.enum([j,X,F,K,Y]);var Ks=zod.z.object({type:zod.z.literal("text"),text:zod.z.string()}),Js=zod.z.object({type:zod.z.literal("tool_use"),id:zod.z.string(),name:zod.z.string(),input:zod.z.record(zod.z.any())}),Gs=zod.z.object({type:zod.z.literal("thinking"),thinking:zod.z.string(),signature:zod.z.string()}),Ws=zod.z.object({type:zod.z.literal("redacted_thinking"),data:zod.z.string()}),Zs=zod.z.object({type:zod.z.literal("mcp_tool_use"),id:zod.z.string(),name:zod.z.string(),server_name:zod.z.string(),input:zod.z.record(zod.z.any())}),Xs=zod.z.object({type:zod.z.literal("mcp_tool_result"),tool_use_id:zod.z.string(),is_error:zod.z.boolean(),content:zod.z.array(zod.z.any())}),Ni=zod.z.object({content:zod.z.array(zod.z.discriminatedUnion("type",[Ks,Js,Gs,Ws,Zs,Xs])),id:zod.z.string(),model:zod.z.string(),role:zod.z.string(),stop_reason:zod.z.string(),stop_sequence:zod.z.null(),type:zod.z.literal("message"),usage:zod.z.object({input_tokens:zod.z.number(),output_tokens:zod.z.number(),cache_creation_input_tokens:zod.z.number().nullish(),cache_read_input_tokens:zod.z.number().nullish()})}),Bi=zod.z.object({type:zod.z.literal("message_start"),message:zod.z.object({id:zod.z.string(),type:zod.z.literal("message"),role:zod.z.string(),model:zod.z.string(),stop_reason:zod.z.string().nullable(),stop_sequence:zod.z.string().nullable(),content:zod.z.array(zod.z.any()),usage:zod.z.object({input_tokens:zod.z.number(),output_tokens:zod.z.number()})})}),Ui=zod.z.object({type:zod.z.literal("message_delta"),delta:zod.z.object({stop_reason:zod.z.string().nullable(),stop_sequence:zod.z.string().nullable()}),usage:zod.z.object({output_tokens:zod.z.number()})}),Ys=zod.z.object({type:zod.z.literal("text"),text:zod.z.string()}),Qs=zod.z.object({type:zod.z.literal("tool_use"),id:zod.z.string(),name:zod.z.string(),input:zod.z.object({})}),er=zod.z.object({type:zod.z.literal("thinking"),thinking:zod.z.string()}),tr=zod.z.object({type:zod.z.literal("redacted_thinking"),data:zod.z.string()}),or=zod.z.object({type:zod.z.literal("mcp_tool_use"),id:zod.z.string(),name:zod.z.string(),server_name:zod.z.string(),input:zod.z.record(zod.z.any())}),nr=zod.z.object({type:zod.z.literal("mcp_tool_result"),tool_use_id:zod.z.string(),is_error:zod.z.boolean(),content:zod.z.array(zod.z.any())}),zi=zod.z.object({type:zod.z.literal("content_block_start"),index:zod.z.number(),content_block:zod.z.discriminatedUnion("type",[Ys,Qs,er,tr,or,nr])}),ir=zod.z.object({type:zod.z.literal("text_delta"),text:zod.z.string()}),ar=zod.z.object({type:zod.z.literal("input_json_delta"),partial_json:zod.z.string()}),sr=zod.z.object({type:zod.z.literal("thinking_delta"),thinking:zod.z.string()}),rr=zod.z.object({type:zod.z.literal("signature_delta"),signature:zod.z.string()}),$i=zod.z.object({type:zod.z.literal("content_block_delta"),index:zod.z.number(),delta:zod.z.discriminatedUnion("type",[ir,ar,sr,rr])});var lr=zod.z.object({type:zod.z.literal("thinking"),thinking:zod.z.string().optional(),signature:zod.z.string().optional()}),dr=zod.z.object({type:zod.z.literal("redacted_thinking"),data:zod.z.string()}),pr=zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1).optional(),input_schema:zod.z.any()}),mr=zod.z.object({type:zod.z.enum(["auto","any"])}),cr=zod.z.object({type:zod.z.literal("tool"),name:zod.z.string().min(1)}),zo=zod.z.object({text:zod.z.string().min(1),type:zod.z.literal("text")}),Fi=zod.z.object({type:zod.z.literal("image"),source:zod.z.object({type:zod.z.literal("base64"),media_type:zod.z.enum(["image/jpeg","image/png","image/gif","image/webp"]),data:zod.z.string().base64()})}),od=zod.z.object({id:zod.z.string().min(1),type:zod.z.literal("tool_use"),name:zod.z.string().min(1),input:zod.z.record(zod.z.any())}),Hi=zod.z.object({type:zod.z.literal("tool_result"),tool_use_id:zod.z.string().min(1),content:zod.z.string().min(1).or(zod.z.array(zod.z.union([zo,Fi])).min(1))}),nd=zod.z.object({type:zod.z.literal("mcp_tool_use"),id:zod.z.string().min(1),name:zod.z.string().min(1),server_name:zod.z.string().min(1),input:zod.z.record(zod.z.any())}),id=zod.z.object({type:zod.z.literal("mcp_tool_result"),tool_use_id:zod.z.string().min(1),is_error:zod.z.boolean().default(false),content:zod.z.array(zod.z.any())}),ur=zod.z.object({enabled:zod.z.boolean().default(true),allowed_tools:zod.z.array(zod.z.string().min(1)).optional()}),gr=zod.z.object({type:zod.z.literal("url"),url:zod.z.string().url().refine(o=>o.startsWith("https://"),{message:"MCP server URL must start with https://"}),name:zod.z.string().min(1),tool_configuration:ur.optional(),authorization_token:zod.z.string().min(1).optional()}),hr=zod.z.object({role:zod.z.literal("user"),content:zod.z.string().min(1).or(zod.z.array(zod.z.union([zo,Fi,Hi])).min(1))}),yr=zod.z.object({role:zod.z.literal("assistant"),content:zod.z.string().min(1).or(zod.z.array(zod.z.union([zo,Hi,lr,dr])).min(1))}),fr=zod.z.union([hr,yr]),Ki=zod.z.object({model:zod.z.string().min(1).optional(),messages:zod.z.array(fr).min(1),system:zod.z.string().min(1).optional(),max_tokens:zod.z.number().min(0).optional(),stop_sequences:zod.z.array(zod.z.string().min(1)).optional(),temperature:zod.z.number().min(0).max(1).optional(),tool_choice:zod.z.union([mr,cr]).optional(),tools:zod.z.array(pr).min(1).optional(),top_p:zod.z.number().min(0).max(1).optional(),top_k:zod.z.number().min(0).optional(),mcp_servers:zod.z.array(gr).min(1).optional()});var b=zod.z.object({modelName:zod.z.string(),apiKey:zod.z.string(),completeChatUrl:zod.z.string().url().optional(),streamChatUrl:zod.z.string().url().optional()}),f=class{constructor(t,n){this.version="v1";let i=b.parse(n);this.modelSchema=t,this.modelName=i.modelName,this.apiKey=i.apiKey,this.baseUrl=re(ne.chatBaseUrl),this.completeChatUrl=re(i.completeChatUrl||`${this.baseUrl}/messages`),this.streamChatUrl=re(i.streamChatUrl||`${this.baseUrl}/messages`);}getDefaultBaseUrl(){return this.baseUrl}getDefaultHeaders(){return {"x-api-key":`${this.apiKey}`,"anthropic-version":"2023-06-01","content-type":"application/json","anthropic-dangerous-direct-browser-access":"true"}}getDefaultParams(){return {model:this.modelName}}getRetryDelay(t,n){let i=0,a=true;return t["x-should-retry"]&&(a=t["x-should-retry"].toLowerCase()!=="false"),t["retry-after"]&&(i=parseInt(t["retry-after"])*1e3),{shouldRetry:a,delayMs:i}}getTokenCount(t){return t.reduce((n,i)=>n+i.content.map(a=>a.modality==="text"?a.value:"").join(" ").length,0)}transformModelRequest(t){let n=Ki.safeParse(t);if(!n.success)throw new ye({info:"Invalid model request",cause:n.error});let i=n.data,a=i.model;if(i.tool_choice&&(!i.tools||i.tools.length===0))throw new ye({info:`Invalid model request for model : '${this.modelName}'`,cause:new Error("'tools' are required when 'tool_choice' is specified")});let p={};i.tool_choice&&(i.tool_choice.type==="tool"?p.toolChoice=i.tool_choice.name:p.toolChoice=i.tool_choice.type),p.maxTokens=i.max_tokens,p.temperature=i.temperature,p.topP=i.top_p,p.topK=i.top_k,p.stop=i.stop_sequences;let d=Me().parse(Re(p)),m=[],l={};i.system&&m.push({role:ie,content:[{modality:j,value:i.system}]}),i.messages.forEach(u=>{let E=u.role;switch(E){case "user":{let A=u.content;if(typeof A=="string")m.push({role:E,content:[{modality:j,value:A}]});else {let N=A.map(w=>{if(w.type==="text")return {modality:j,value:w.text};if(w.type==="image"){let L="auto",W=w.source.media_type.split("/")[1];return {modality:X,detail:L,value:{type:qt,mediaType:W,base64:w.source.data}}}else return {modality:K,id:w.tool_use_id,index:l[w.tool_use_id].index,name:l[w.tool_use_id].name,data:typeof w.content=="string"?w.content:JSON.stringify(w.content)}});m.push({role:E,content:N});}}break;case "assistant":{let A=u.content;if(typeof A=="string")m.push({role:E,content:[{modality:j,value:A}]});else {let N=A.map((w,L)=>{if(w.type==="text")return {modality:j,value:w.text};{let W={modality:F,id:w.id,index:L,name:w.name,arguments:JSON.stringify(w.input)};return l[w.id]=W,W}});m.push({role:E,content:N});}}break}});let g=[];return i.tools&&i.tools.forEach(u=>{g.push({type:"function",definition:{schema:{name:u.name,description:u.description||"",parameters:u.input_schema}}});}),{modelName:a,config:d,messages:m,tools:g.length>0?g:void 0}}transformConfig(t,n,i){let a=t.toolChoice,p=t.reasoningEnabled,d=t.maxReasoningTokens,m=t.mcp,l=t.mcpServers,g=P({},t);delete g.toolChoice,delete g.reasoningEnabled,delete g.maxReasoningTokens,delete g.mcp,delete g.mcpServers;let u=this.modelSchema.config.schema.safeParse(g);if(!u.success)throw new Q({info:`Invalid config for model : '${this.modelName}'`,cause:u.error});let E=u.data;a!==void 0&&(E.toolChoice=a),Object.keys(E).forEach(L=>{if(!(L in this.modelSchema.config.def))throw new Q({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 A=Object.keys(E).reduce((L,W)=>{let ue=this.modelSchema.config.def[W],_t=ue.param,$o=E[W];return _t==="max_tokens"&&ue.type==="range"&&$o===0?L[_t]=ue.max:L[_t]=$o,L},{});if(!A.max_tokens){let L=this.modelSchema.config.def.maxTokens;A.max_tokens=L.max;}if("tool_choice"in A&&A.tool_choice!==void 0){let L=A.tool_choice;if(!i||i&&i.length===0)throw new Q({info:`Invalid config for model : '${this.modelName}'`,cause:new Error("'tools' are required when 'toolChoice' is specified")});if(i&&i.length>0){let W=this.modelSchema.config.def.toolChoice;if(W.choices.includes(L))A.tool_choice={type:L};else if(i.map(ue=>ue.definition.schema.name).includes(L))A.tool_choice={type:"tool",name:L};else throw new Q({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`toolChoice : '${L}' is not part of provided 'tools' names or
11
+ one of [${W.choices.join(", ")}]`)})}}let N=p!==void 0,w=d!==void 0;if(N!==w)throw new Q({info:`Invalid extended thinking config for model: '${this.modelName}'`,cause:new Error("Both 'reasoningEnabled' and 'maxReasoningTokens' must be defined together.")});if(N&&w){let L=A.max_tokens;if(p)if(d<L)A.thinking={type:"enabled",budget_tokens:d};else throw new Q({info:`Invalid extended thinking token budget for model: '${this.modelName}'`,cause:new Error(`maxReasoningTokens (${d}) must be less than max_tokens (${L})`)})}return m&&l&&(A.mcp_servers=l),A}transformMessages(t){if(!t||t&&t.length===0)return {messages:[]};let n=d=>{let m=d.match(/^data:image\/[a-zA-Z]+;base64,/);return m?d.substring(m[0].length):d},i=t.map(d=>{let m=Bt().safeParse(d);if(!m.success)throw new H({info:"Invalid messages",cause:m.error});return m.data});i.forEach(d=>{d.content.forEach(m=>{if(!this.modelSchema.modalities.includes(m.modality))throw new H({info:`Invalid message content for model : '${this.modelName}'`,cause:new Error(`model : '${this.modelName}' does not support modality : '${m.modality}', available modalities : [${this.modelSchema.modalities.join(", ")}]`)})});}),i.forEach(d=>{if(!Object.keys(this.modelSchema.roles).includes(d.role))throw new H({info:`Invalid message content for model : '${this.modelName}'`,cause:new Error(`model : '${this.modelName}' does not support role : '${d.role}', available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})}),i.forEach(d=>{d.content=d.content.filter(m=>m.modality!=="error"&&m.modality!=="search-result");});let a="",p=[];if(i.forEach(d=>{switch(d.role){case ie:{d.content.forEach(m=>{if(m.modality===j)a+=m.value;else throw new H({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${d.role}' cannot have content with modality : '${m.modality}'`)})});break}case q:{let m=[];d.content.forEach(l=>{if(l.modality===j)m.push({type:"text",text:l.value});else if(l.modality===F)l.serverName?m.push({type:"mcp_tool_use",id:l.id,name:l.name,server_name:l.serverName,input:JSON.parse(l.arguments)}):m.push({type:"tool_use",id:l.id,name:l.name,input:JSON.parse(l.arguments)});else if(l.modality===Y&&l.value.type==="thinking")m.push({type:"thinking",thinking:l.value.thinking,signature:l.value.signature});else if(l.modality===Y&&l.value.type==="redacted")m.push({type:"redacted_thinking",data:l.value.data});else if(l.modality===K)m.push({type:"mcp_tool_result",tool_use_id:l.id,content:JSON.parse(l.data),is_error:l.apiResponse&&l.apiResponse.statusCode!==200||false});else throw new H({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${d.role}' cannot have content with modality : '${l.modality}'`)})}),p.push({role:this.modelSchema.roles[d.role],content:m});break}case ee:{let m=[];d.content.forEach(l=>{if(l.modality===j)m.push({type:"text",text:l.value});else if(l.modality===X){if(l.value.type==="base64"){let g=l.value.base64;g=n(g),m.push({type:"image",source:{type:"base64",media_type:`image/${l.value.mediaType}`,data:g}});}else if(l.value.type==="url")throw new H({info:`Invalid message 'modality' for model : ${this.modelName}`,cause:new Error(`model: '${this.modelName}' does not support image content type: '${l.value.type}'`)})}else throw new H({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${d.role}' cannot have content with modality : '${l.modality}'`)})}),p.push({role:this.modelSchema.roles[d.role],content:m});break}case ge:{let m=[];d.content.forEach(l=>{if(l.modality===K)m.push({type:"tool_result",tool_use_id:l.id,content:l.data});else throw new H({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${d.role}' cannot have content with modality : '${l.modality}'`)})}),p.push({role:this.modelSchema.roles[d.role],content:m});break}default:throw new H({info:`Invalid message 'role' for model : ${this.modelName}`,cause:new Error(`role : '${d.role}' is not supported,
12
+ available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})}}),p[0].role!==this.modelSchema.roles[ee])throw new H({info:`Invalid message 'role' for model : ${this.modelName}`,cause:new Error(`model : '${this.modelName}' requires first message to be from user`)});return {system:a,messages:p}}transformTools(t){if(!this.modelSchema.modalities.includes(F))throw new Kt({info:`Invalid tool 'modality' for model : ${this.modelName}`,cause:new Error(`model : '${this.modelName}' does not support tool modality : '${F}'`)});return !t||t&&t.length===0?{tools:[]}:{tools:t.map(a=>{let p=Mn().safeParse(a);if(!p.success)throw new Kt({info:"Invalid tools",cause:p.error});return p.data}).map(a=>({name:a.definition.schema.name,description:a.definition.schema.description,input_schema:a.definition.schema.parameters}))}}getCompleteChatUrl(t,n,i){return B(this,null,function*(){return new Promise(a=>{a(this.completeChatUrl);})})}getCompleteChatHeaders(t,n,i){return B(this,null,function*(){let a=this.getDefaultHeaders();if(t&&t.mcp&&t.mcpServers){let p=a["anthropic-beta"],d="mcp-client-2025-04-04";p?a=Z(P({},a),{"anthropic-beta":`${p},${d}`}):a=Z(P({},a),{"anthropic-beta":d});}return new Promise(p=>{p(a);})})}getCompleteChatData(t,n,i){return B(this,null,function*(){let a=this.transformConfig(t,n,i),p=this.transformMessages(n);if(p.messages&&p.messages.length===0)throw new H({info:"Messages are required",cause:new Error("Messages are required")});let d=i?this.transformTools(i):{};return new Promise(m=>{m(P(P(P(P({},this.getDefaultParams()),a),p),d));})})}transformCompleteChatResponse(t){let n=Ni.safeParse(t);if(n.success){let i=n.data,p=i.content.map((l,g)=>{if(l.type==="text")return kn(l.text);if(l.type==="tool_use")return $t(g,l.id,l.name,JSON.stringify(l.input));if(l.type==="thinking")return On(l.thinking,l.signature);if(l.type==="redacted_thinking")return xn(l.data);if(l.type==="mcp_tool_use")return $t(g,l.id,l.name,JSON.stringify(l.input),l.server_name);if(l.type==="mcp_tool_result")return Sn(g,l.tool_use_id,"mcp_tool_result",JSON.stringify(l.content),{statusCode:l.is_error?500:200})}),d=[{role:q,content:p}],m={promptTokens:i.usage.input_tokens,completionTokens:i.usage.output_tokens,totalTokens:i.usage.input_tokens+i.usage.output_tokens};return {messages:d,usage:m,logProbs:[]}}throw new J({info:"Invalid response from model",cause:n.error})}getStreamChatUrl(t,n,i){return B(this,null,function*(){return new Promise(a=>{a(this.streamChatUrl);})})}getStreamChatHeaders(t,n,i){return B(this,null,function*(){let a=this.getDefaultHeaders();if(t&&t.mcp&&t.mcpServers){let p=a["anthropic-beta"],d="mcp-client-2025-04-04";p?a=Z(P({},a),{"anthropic-beta":`${p},${d}`}):a=Z(P({},a),{"anthropic-beta":d});}return new Promise(p=>{p(a);})})}getStreamChatData(t,n,i){return B(this,null,function*(){let a=this.transformConfig(t,n,i),p=this.transformMessages(n);if(p.messages&&p.messages.length===0)throw new H({info:"Messages are required",cause:new Error("Messages are required")});let d=i?this.transformTools(i):{};return new Promise(m=>{m(P(P(P(P({stream:true},this.getDefaultParams()),a),p),d));})})}transformStreamChatResponseChunk(t,n){return Pt(this,null,function*(){let i=n+t,a=[],p="",d=0;for(;d<i.length;){let m=i.indexOf(`
13
+ `,d);if(m===-1){p=i.substring(d);break}else {let l=i.substring(d,m).trim();l&&a.push(l),d=m+1;}}for(let m of a)if(m.startsWith("data: {")&&m.endsWith("}")){let l;try{l=JSON.parse(m.substring(6));}catch(g){throw new J({info:`Malformed JSON received in stream : ${l}`,cause:g})}if("type"in l){if(l.type==="message_stop")return;if(l.type==="message_start"){let g=Bi.safeParse(l);if(g.success){let u=g.data;yield {partialResponse:{partialMessages:[],usage:{promptTokens:u.message.usage.input_tokens,completionTokens:u.message.usage.output_tokens,totalTokens:u.message.usage.input_tokens+u.message.usage.output_tokens}},buffer:n};}else throw new J({info:"Invalid response from model",cause:g.error})}else if(l.type==="message_delta"){let g=Ui.safeParse(l);if(g.success){let u=g.data;yield {partialResponse:{partialMessages:[],usage:{promptTokens:void 0,completionTokens:u.usage.output_tokens,totalTokens:u.usage.output_tokens}},buffer:n};}else throw new J({info:"Invalid response from model",cause:g.error})}else if(l.type==="content_block_start"){let g=zi.safeParse(l);if(g.success){let u=g.data,E=[];u.content_block.type==="text"?E.push(Ft(q,u.content_block.text)):u.content_block.type==="tool_use"?E.push(ke(q,u.index,u.content_block.id,u.content_block.name,"")):u.content_block.type==="thinking"?E.push(Se(q,u.content_block.thinking)):u.content_block.type==="redacted_thinking"?E.push(vn(q,u.content_block.data)):u.content_block.type==="mcp_tool_use"?E.push(ke(q,u.index,u.content_block.id,u.content_block.name,JSON.stringify(u.content_block.input),u.content_block.server_name)):u.content_block.type==="mcp_tool_result"&&E.push(Rn(q,u.index,u.content_block.tool_use_id,"mcp_tool_result",JSON.stringify(u.content_block.content))),yield {partialResponse:{partialMessages:E},buffer:n};}else throw new J({info:"Invalid response from model",cause:g.error})}else if(l.type==="content_block_delta"){let g=$i.safeParse(l);if(g.success){let u=g.data,E=[];u.delta.type==="text_delta"?E.push(Ft(q,u.delta.text)):u.delta.type==="input_json_delta"?E.push(ke(q,u.index,"","",u.delta.partial_json)):u.delta.type==="thinking_delta"?E.push(Se(q,u.delta.thinking)):u.delta.type==="signature_delta"&&E.push(Se(q,void 0,u.delta.signature)),yield {partialResponse:{partialMessages:E},buffer:n};}else throw new J({info:"Invalid response from model",cause:g.error})}}else throw new J({info:"Invalid JSON received in stream",cause:new Error(`Invalid JSON received in stream, expected 'type' property, received: ${JSON.stringify(l)}`)})}yield {partialResponse:{partialMessages:[]},buffer:p};})}transformProxyStreamChatResponseChunk(t,n,i,a,p){return Pt(this,null,function*(){yield*Jo(this.transformStreamChatResponseChunk(t,n));})}getProxyStreamChatUrl(t,n,i){return B(this,null,function*(){return new Promise(a=>{a(this.streamChatUrl);})})}getProxyCompleteChatUrl(t,n,i){return B(this,null,function*(){return new Promise(a=>{a(this.completeChatUrl);})})}getProxyCompleteChatHeaders(t,n,i){return B(this,null,function*(){if(!n)return {};let a=P({},n);return delete a.host,delete a["content-length"],a})}getProxyStreamChatHeaders(t,n,i){return B(this,null,function*(){return yield this.getProxyCompleteChatHeaders(t,n,i)})}getModelPricing(){if(!(this.modelName in _))throw new J({info:`Invalid model pricing for model : '${this.modelName}'`,cause:new Error(`No pricing configuration found for model "${this.modelName}"`)});return _[this.modelName]}};var ve="claude-4-opus-20250514",br="Our high-performance model with exceptional reasoning and efficiency. Training cutoff: March 2025.",po=T(M,D).parse({name:ve,description:br,maxInputTokens:2e5,maxOutputTokens:32e3,maxReasoningTokens:32e3,roles:k,modalities:V,config:{def:h.extendedThinking(32e3,4,1024,32e3).def,schema:h.extendedThinking(32e3,4,1024,32e3).schema},price:_[ve]}),di=b,Ee=class extends f{constructor(t){super(po,t);}};var _e="claude-4-sonnet-20250514",Cr="Our most capable and intelligent model yet. Training cutoff: March 2025.",mo=T(M,D).parse({name:_e,description:Cr,maxInputTokens:2e5,maxOutputTokens:64e3,maxReasoningTokens:64e3,roles:k,modalities:V,config:{def:h.extendedThinking(64e3,4,1024,64e3).def,schema:h.extendedThinking(64e3,4,1024,64e3).schema},price:_[_e]}),pi=b,Pe=class extends f{constructor(t){super(mo,t);}};var Ae="claude-opus-4-5-20251101",Tr="Premium model combining maximum intelligence with practical performance. Ideal for complex specialized tasks, professional software engineering, and advanced agents. Training cutoff: August 2025.",co=T(M,D).parse({name:Ae,description:Tr,maxInputTokens:2e5,maxOutputTokens:64e3,maxReasoningTokens:64e3,roles:k,modalities:V,config:{def:h.extendedThinking(64e3,4,1024,64e3).def,schema:h.extendedThinking(64e3,4,1024,64e3).schema},price:_[Ae]}),mi=b,we=class extends f{constructor(t){super(co,t);}};var Le="claude-opus-4-6",Mr="Most intelligent model for building agents and coding. Features 128K max output tokens and 1M context window in beta. Training cutoff: August 2025.",uo=T(M,D).parse({name:Le,description:Mr,maxInputTokens:2e5,maxOutputTokens:128e3,maxReasoningTokens:128e3,roles:k,modalities:V,config:{def:h.extendedThinking(128e3,4,1024,128e3).def,schema:h.extendedThinking(128e3,4,1024,128e3).schema},price:_[Le]}),ci=b,qe=class extends f{constructor(t){super(uo,t);}};var je="claude-opus-4-7",kr="Most intelligent model for building agents and coding. Features 128K max output tokens and 200K context window. Training cutoff: January 2026.",go=T(M,D).parse({name:je,description:kr,maxInputTokens:2e5,maxOutputTokens:128e3,maxReasoningTokens:128e3,roles:k,modalities:V,config:{def:h.extendedThinking(128e3,4,1024,128e3).def,schema:h.extendedThinking(128e3,4,1024,128e3).schema},price:_[je]}),ui=b,Ie=class extends f{constructor(t){super(go,t);}};var Ve="claude-sonnet-4-5-20250929",Sr="Our best model for complex agents and coding, with the highest intelligence across most tasks. Training cutoff: July 2025.",ho=T(M,D).parse({name:Ve,description:Sr,maxInputTokens:2e5,maxOutputTokens:64e3,maxReasoningTokens:64e3,roles:k,modalities:V,config:{def:h.extendedThinking(64e3,4,1024,64e3).def,schema:h.extendedThinking(64e3,4,1024,64e3).schema},price:_[Ve]}),gi=b,De=class extends f{constructor(t){super(ho,t);}};var Ne="claude-sonnet-4-6",Rr="Balanced model for agentic reasoning and coding with strong performance at low latency. Training cutoff: August 2025.",yo=T(M,D).parse({name:Ne,description:Rr,maxInputTokens:2e5,maxOutputTokens:64e3,maxReasoningTokens:64e3,roles:k,modalities:V,config:{def:h.extendedThinking(64e3,4,1024,64e3).def,schema:h.extendedThinking(64e3,4,1024,64e3).schema},price:_[Ne]}),hi=b,Be=class extends f{constructor(t){super(yo,t);}};var Ue="claude-haiku-4-5-20251001",Or="Fast and efficient model for high-throughput chat, extraction, and routing workloads.",fo=T(M,z).parse({name:Ue,description:Or,maxInputTokens:2e5,maxOutputTokens:8192,roles:k,modalities:U,config:{def:h.base(8192,4).def,schema:h.base(8192,4).schema},price:_[Ue]}),yi=b,ze=class extends f{constructor(t){super(fo,t);}};var $e="claude-3-5-sonnet-20240620",xr="Most intelligent model. Highest level of intelligence and capability.",bo=T(M,z).parse({name:$e,description:xr,maxInputTokens:2e5,maxOutputTokens:8192,roles:k,modalities:U,config:{def:h.base(8192,4).def,schema:h.base(8192,4).schema},price:_[$e]}),fi=b,Fe=class extends f{constructor(t){super(bo,t);}};var He="claude-3-5-sonnet-20241022",vr="Most intelligent model. Highest level of intelligence and capability.",Co=T(M,z).parse({name:He,description:vr,maxInputTokens:2e5,maxOutputTokens:8192,roles:k,modalities:U,config:{def:h.base(8192,4).def,schema:h.base(8192,4).schema},price:_[He]}),bi=b,Ke=class extends f{constructor(t){super(Co,t);}};var Je="claude-3-7-sonnet-20250219",Er="Most intelligent model. Highest level of intelligence and capability.",To=T(M,D).parse({name:Je,description:Er,maxInputTokens:2e5,maxOutputTokens:128e3,maxReasoningTokens:64e3,roles:k,modalities:V,config:{def:h.extendedThinking(128e3,4,1024,64e3).def,schema:h.extendedThinking(128e3,4,1024,64e3).schema},price:_[Je]}),Ci=b,Ge=class extends f{constructor(t){super(To,t);}getDefaultHeaders(){let t=super.getDefaultHeaders(),n=t["anthropic-beta"],i="output-128k-2025-02-19";return n?t=Z(P({},t),{"anthropic-beta":`${n},${i}`}):t=Z(P({},t),{"anthropic-beta":i}),t}};var Mo="claude-3-haiku-20240307",_r="Fastest and most compact model for near-instant responsiveness. Quick and accurate targeted performance.",ko=T(M,z).parse({name:Mo,description:_r,maxInputTokens:2e5,maxOutputTokens:4096,roles:k,modalities:U,config:{def:h.base(4096,4).def,schema:h.base(4096,4).schema}}),Ti=b,We=class extends f{constructor(t){super(ko,t);}};var Ze="claude-3-5-haiku-20241022",Pr="Our fastest model with intelligence at blazing speeds.",So=T(M,z).parse({name:Ze,description:Pr,maxInputTokens:2e5,maxOutputTokens:8192,roles:k,modalities:U,config:{def:h.base(8192,4).def,schema:h.base(8192,4).schema},price:_[Ze]}),Mi=b,Xe=class extends f{constructor(t){super(So,t);}};var Ro="claude-3-opus-20240229",Ar="Powerful model for highly complex tasks. Top-level performance, intelligence, fluency, and understanding.",Oo=T(M,z).parse({name:Ro,description:Ar,maxInputTokens:2e5,maxOutputTokens:4096,roles:k,modalities:U,config:{def:h.base(4096,4).def,schema:h.base(4096,4).schema}}),ki=b,Ye=class extends f{constructor(t){super(Oo,t);}};var xo="claude-3-sonnet-20240229",wr="Balance of intelligence and speed. Strong utility, balanced for scaled deployments.",vo=T(M,z).parse({name:xo,description:wr,maxInputTokens:2e5,maxOutputTokens:4096,roles:k,modalities:U,config:{def:h.base(4096,4).def,schema:h.base(4096,4).schema}}),Si=b,Qe=class extends f{constructor(t){super(vo,t);}};var x=[te],v=zod.z.enum([te]);var Ji=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({total_tokens:zod.z.number()})});var qr=zod.z.string().min(1).or(zod.z.array(zod.z.string().min(1)).min(1)),Gi=zod.z.object({model:zod.z.string().min(1).optional(),input:qr,encoding_format:zod.z.enum(["base64"]).nullable().optional(),input_type:zod.z.enum(["query","document"]).nullable().optional(),truncation:zod.z.boolean().optional(),output_dimension:zod.z.union([zod.z.literal(256),zod.z.literal(512),zod.z.literal(1024),zod.z.literal(2048)]).nullable().optional(),output_dtype:zod.z.enum(["float","int8","uint8","binary","ubinary"]).nullable().optional()});var C={"voyage-3.5":{modelName:"voyage-3.5",currency:"USD",inputPricePerMillion:.06},"voyage-3.5-lite":{modelName:"voyage-3.5-lite",currency:"USD",inputPricePerMillion:.02},"voyage-3-large":{modelName:"voyage-3-large",currency:"USD",inputPricePerMillion:.18},"voyage-code-3":{modelName:"voyage-code-3",currency:"USD",inputPricePerMillion:.18},"voyage-3":{modelName:"voyage-3",currency:"USD",inputPricePerMillion:.06},"voyage-3-lite":{modelName:"voyage-3-lite",currency:"USD",inputPricePerMillion:.02},"voyage-code-2":{modelName:"voyage-code-2",currency:"USD",inputPricePerMillion:.12},"voyage-finance-2":{modelName:"voyage-finance-2",currency:"USD",inputPricePerMillion:.12},"voyage-law-2":{modelName:"voyage-law-2",currency:"USD",inputPricePerMillion:.12},"voyage-multilingual-2":{modelName:"voyage-multilingual-2",currency:"USD",inputPricePerMillion:.12},"voyage-4-large":{modelName:"voyage-4-large",currency:"USD",inputPricePerMillion:.18},"voyage-4":{modelName:"voyage-4",currency:"USD",inputPricePerMillion:.06},"voyage-4-lite":{modelName:"voyage-4-lite",currency:"USD",inputPricePerMillion:.02},"voyage-4-nano":{modelName:"voyage-4-nano",currency:"USD",inputPricePerMillion:.01}};var R=zod.z.object({modelName:zod.z.string(),apiKey:zod.z.string(),getEmbeddingsUrl:zod.z.string().url().optional()}),S=class{constructor(t,n){this.version="v1";let i=R.parse(n);this.modelSchema=t,this.modelName=i.modelName,this.apiKey=i.apiKey,this.baseUrl=re(ne.embeddingBaseUrl),this.getEmbeddingsUrl=re(i.getEmbeddingsUrl||`${this.baseUrl}/embeddings`);}getDefaultBaseUrl(){return this.baseUrl}getDefaultHeaders(){return {Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"}}getDefaultParams(){return {model:this.modelName}}getTokenCount(t){return t.requests.reduce((n,i)=>n+i.length,0)}getRetryDelay(t,n){return {shouldRetry:true,delayMs:0}}transformModelRequest(t){let n=Gi.safeParse(t);if(!n.success)throw new ye({info:"Invalid model request",cause:n.error});let i=n.data,a=i.model,p={encodingFormat:i.encoding_format,inputType:i.input_type,truncation:i.truncation,outputDimension:i.output_dimension!==null&&i.output_dimension!==void 0?String(i.output_dimension):void 0,outputDtype:i.output_dtype},d=Me().parse(Re(p)),m;return typeof i.input=="string"?m={modality:te,requests:[i.input]}:m={modality:te,requests:i.input},{modelName:a,config:d,embeddingRequests:m}}transformConfig(t,n){"inputType"in t&&t.inputType===""&&delete t.inputType,"encodingFormat"in t&&t.encodingFormat===""&&delete t.encodingFormat,"outputDimension"in t&&t.outputDimension===""&&delete t.outputDimension,"outputDtype"in t&&t.outputDtype===""&&delete t.outputDtype;let i=this.modelSchema.config.schema.safeParse(t);if(!i.success)throw new Q({info:`Invalid config for model : '${this.modelName}'`,cause:i.error});let a=i.data;return Object.keys(a).forEach(d=>{if(!this.modelSchema.config.def[d])throw new Q({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`Invalid config key : '${d}',
14
+ available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})}),Object.keys(a).reduce((d,m)=>{let g=this.modelSchema.config.def[m].param,u=a[m];return g==="output_dimension"&&typeof u=="string"&&(u=Number(u)),d[g]=u,d},{})}transformEmbeddingRequests(t){let n=bn().safeParse(t);if(!n.success)throw new Jt({info:"Invalid embedding requests",cause:n.error});if(n.data.requests.length>128)throw new Jt({info:`Invalid embedding requests for model : '${this.modelName}'`,cause:new Error(`Max requests for model : '${this.modelName}' is 128`)});return {input:n.data.requests}}getGetEmbeddingsUrl(t,n){return B(this,null,function*(){return new Promise(i=>{i(this.getEmbeddingsUrl);})})}getGetEmbeddingsHeaders(t,n){return B(this,null,function*(){return new Promise(i=>{i(this.getDefaultHeaders());})})}getGetEmbeddingsData(t,n){return B(this,null,function*(){return new Promise(i=>{i(P(P(P({},this.getDefaultParams()),this.transformConfig(t,n)),this.transformEmbeddingRequests(n)));})})}transformGetEmbeddingsResponse(t){let n,i=Ji.safeParse(t);if(i.success){let a=i.data;n=typeof a.data[0].embedding=="string"?zt:Ut;let p=a.data.map(d=>typeof d.embedding=="string"?{index:d.index,embedding:d.embedding}:{index:d.index,embedding:d.embedding});return {encodingFormat:n,embeddings:p,usage:{totalTokens:a.usage.total_tokens}}}throw new J({info:"Invalid response from model",cause:i.error})}getModelPricing(){if(!(this.modelName in C))throw new J({info:`Invalid model pricing for model : '${this.modelName}'`,cause:new Error(`No pricing configuration found for model "${this.modelName}"`)});let t=C[this.modelName];return Tn.parse(t)}};var et="voyage-code-2",Ir="Optimized for code retrieval.",Eo=O(v).parse({name:et,description:Ir,modalities:x,maxInputTokens:16e3,maxOutputTokens:16e3,config:{def:y.base().def,schema:y.base().schema},price:C[et]}),Ri=R,tt=class extends S{constructor(t){super(Eo,t);}};var ot="voyage-law-2",Vr="Optimized for legal and long-context retrieval and RAG. Also improved performance across all domains.",_o=O(v).parse({name:ot,description:Vr,modalities:x,maxInputTokens:16e3,maxOutputTokens:16e3,config:{def:y.base().def,schema:y.base().schema},price:C[ot]}),Oi=R,nt=class extends S{constructor(t){super(_o,t);}};var it="voyage-multilingual-2",Dr="Optimized for multilingual retrieval and RAG.",Po=O(v).parse({name:it,description:Dr,modalities:x,maxInputTokens:32e3,maxOutputTokens:32e3,config:{def:y.base().def,schema:y.base().schema},price:C[it]}),xi=R,at=class extends S{constructor(t){super(Po,t);}};var st="voyage-finance-2",Nr="Optimized for finance retrieval and RAG.",Ao=O(v).parse({name:st,description:Nr,modalities:x,maxInputTokens:32e3,maxOutputTokens:32e3,config:{def:y.base().def,schema:y.base().schema},price:C[st]}),vi=R,rt=class extends S{constructor(t){super(Ao,t);}};var lt="voyage-3-lite",Br="Optimized for latency and cost.",wo=O(v).parse({name:lt,description:Br,modalities:x,maxInputTokens:32e3,maxOutputTokens:32e3,config:{def:y.base().def,schema:y.base().schema},price:C[lt]}),Ei=R,dt=class extends S{constructor(t){super(wo,t);}};var pt="voyage-3",Ur="Optimized for quality.",Lo=O(v).parse({name:pt,description:Ur,modalities:x,maxInputTokens:32e3,maxOutputTokens:32e3,config:{def:y.base().def,schema:y.base().schema},price:C[pt]}),_i=R,mt=class extends S{constructor(t){super(Lo,t);}};var ct="voyage-3-large",zr="Optimized for the highest general-purpose and multilingual retrieval quality.",qo=O(v).parse({name:ct,description:zr,modalities:x,maxInputTokens:32e3,maxOutputTokens:32e3,config:{def:y.flexible().def,schema:y.flexible().schema},price:C[ct]}),Pi=R,ut=class extends S{constructor(t){super(qo,t);}};var gt="voyage-3.5",$r="Optimized for general-purpose and multilingual retrieval quality.",jo=O(v).parse({name:gt,description:$r,modalities:x,maxInputTokens:32e3,maxOutputTokens:32e3,config:{def:y.flexible().def,schema:y.flexible().schema},price:C[gt]}),Ai=R,ht=class extends S{constructor(t){super(jo,t);}};var yt="voyage-3.5-lite",Fr="Optimized for latency and cost.",Io=O(v).parse({name:yt,description:Fr,modalities:x,maxInputTokens:32e3,maxOutputTokens:32e3,config:{def:y.flexible().def,schema:y.flexible().schema},price:C[yt]}),wi=R,ft=class extends S{constructor(t){super(Io,t);}};var bt="voyage-code-3",Hr="Optimized for code retrieval.",Vo=O(v).parse({name:bt,description:Hr,modalities:x,maxInputTokens:32e3,maxOutputTokens:32e3,config:{def:y.flexible().def,schema:y.flexible().schema},price:C[bt]}),Li=R,Ct=class extends S{constructor(t){super(Vo,t);}};var Tt="voyage-4-large",Kr="Highest-quality general-purpose and multilingual retrieval. 32K input tokens.",Do=O(v).parse({name:Tt,description:Kr,modalities:x,maxInputTokens:32e3,maxOutputTokens:32e3,config:{def:y.flexible().def,schema:y.flexible().schema},price:C[Tt]}),qi=R,Mt=class extends S{constructor(t){super(Do,t);}};var kt="voyage-4",Jr="Best balance of quality and cost for general-purpose retrieval. 32K input tokens.",No=O(v).parse({name:kt,description:Jr,modalities:x,maxInputTokens:32e3,maxOutputTokens:32e3,config:{def:y.flexible().def,schema:y.flexible().schema},price:C[kt]}),ji=R,St=class extends S{constructor(t){super(No,t);}};var Rt="voyage-4-lite",Gr="Lower-latency, lower-cost general-purpose retrieval. 32K input tokens.",Bo=O(v).parse({name:Rt,description:Gr,modalities:x,maxInputTokens:32e3,maxOutputTokens:32e3,config:{def:y.flexible().def,schema:y.flexible().schema},price:C[Rt]}),Ii=R,Ot=class extends S{constructor(t){super(Bo,t);}};var xt="voyage-4-nano",Wr="Smallest, fastest Voyage embedding for edge / open-weight deployments. 32K input tokens.",Uo=O(v).parse({name:xt,description:Wr,modalities:x,maxInputTokens:32e3,maxOutputTokens:32e3,config:{def:y.flexible().def,schema:y.flexible().schema},price:C[xt]}),Vi=R,vt=class extends S{constructor(t){super(Uo,t);}};
15
15
 
16
- exports.Anthropic = te;
16
+ exports.Anthropic = ne;
17
17
  exports.AnthropicChatModelConfigs = h;
18
- exports.AnthropicChatModelModalities = I;
19
- exports.AnthropicChatModelModalitiesEnum = L;
20
- exports.AnthropicChatModelRoles = T;
21
- exports.AnthropicChatModelRolesMap = b;
22
- exports.AnthropicCompleteChatMcpToolResultResponse = cs;
23
- exports.AnthropicCompleteChatMcpToolUseResponse = ms;
24
- exports.AnthropicCompleteChatResponse = ta;
25
- exports.AnthropicEmbeddingModelConfigs = _;
26
- exports.AnthropicEmbeddingModelModalities = $;
27
- exports.AnthropicEmbeddingModelModalitiesEnum = F;
28
- exports.AnthropicEmbeddingRequest = da;
29
- exports.AnthropicEmbeddingRequestInput = Ws;
30
- exports.AnthropicGetEmbeddingsResponse = pa;
31
- exports.AnthropicRequest = la;
32
- exports.AnthropicRequestAssistantMessage = Ps;
33
- exports.AnthropicRequestImageContent = sa;
34
- exports.AnthropicRequestMcpServer = Es;
35
- exports.AnthropicRequestMcpServerToolConfiguration = _s;
36
- exports.AnthropicRequestMcpToolResultContent = sl;
37
- exports.AnthropicRequestMcpToolUseContent = il;
38
- exports.AnthropicRequestMessage = ws;
39
- exports.AnthropicRequestRedactedThinkingContent = Ss;
40
- exports.AnthropicRequestTextContent = ho;
41
- exports.AnthropicRequestThinkingContent = Rs;
42
- exports.AnthropicRequestTool = xs;
43
- exports.AnthropicRequestToolCallContent = al;
44
- exports.AnthropicRequestToolChoiceEnum = vs;
45
- exports.AnthropicRequestToolChoiceTool = Os;
46
- exports.AnthropicRequestToolResponseContent = ra;
47
- exports.AnthropicRequestUserMessage = As;
48
- exports.AnthropicStreamChatContentBlockDeltaResponse = ia;
49
- exports.AnthropicStreamChatContentBlockStartMcpToolResultResponse = Cs;
50
- exports.AnthropicStreamChatContentBlockStartMcpToolUseResponse = fs;
51
- exports.AnthropicStreamChatContentBlockStartResponse = aa;
52
- exports.AnthropicStreamChatMessageDeltaResponse = na;
53
- exports.AnthropicStreamChatMessageStartResponse = oa;
54
- exports.AnthropicThinkingChatModelModalities = P;
55
- exports.AnthropicThinkingChatModelModalitiesEnum = w;
56
- exports.BaseChatModel = y;
57
- exports.BaseChatModelOptions = f;
58
- exports.BaseEmbeddingModel = B;
59
- exports.BaseEmbeddingModelOptions = D;
60
- exports.ChatModelBaseConfigDef = ke;
61
- exports.ChatModelBaseConfigSchema = Me;
62
- exports.ChatModelReasoningConfigDef = En;
63
- exports.ChatModelReasoningConfigSchema = An;
64
- exports.Claude3Haiku20240307 = He;
65
- exports.Claude3Haiku20240307Literal = Wt;
66
- exports.Claude3Haiku20240307Options = Fn;
67
- exports.Claude3Haiku20240307Schema = Zt;
68
- exports.Claude3Opus20240229 = Je;
69
- exports.Claude3Opus20240229Literal = Yt;
70
- exports.Claude3Opus20240229Options = Kn;
71
- exports.Claude3Opus20240229Schema = Qt;
72
- exports.Claude3Sonnet20240229 = We;
73
- exports.Claude3Sonnet20240229Literal = eo;
74
- exports.Claude3Sonnet20240229Options = Gn;
75
- exports.Claude3Sonnet20240229Schema = to;
76
- exports.Claude3_5Haiku20241022 = Ge;
77
- exports.Claude3_5Haiku20241022Literal = Ke;
78
- exports.Claude3_5Haiku20241022Options = Hn;
79
- exports.Claude3_5Haiku20241022Schema = Xt;
80
- exports.Claude3_5Sonnet20240620 = De;
81
- exports.Claude3_5Sonnet20240620Literal = Ne;
82
- exports.Claude3_5Sonnet20240620Options = zn;
83
- exports.Claude3_5Sonnet20240620Schema = Kt;
84
- exports.Claude3_5Sonnet20241022 = Ve;
85
- exports.Claude3_5Sonnet20241022Literal = ze;
86
- exports.Claude3_5Sonnet20241022Options = Vn;
87
- exports.Claude3_5Sonnet20241022Schema = Gt;
88
- exports.Claude3_7Sonnet20250219 = Fe;
89
- exports.Claude3_7Sonnet20250219Literal = $e;
90
- exports.Claude3_7Sonnet20250219Options = $n;
91
- exports.Claude3_7Sonnet20250219Schema = Jt;
92
- exports.Claude4Opus20250514 = Se;
93
- exports.Claude4Opus20250514Literal = Re;
94
- exports.Claude4Opus20250514Options = qn;
95
- exports.Claude4Opus20250514Schema = Ut;
96
- exports.Claude4Sonnet20250514 = ve;
97
- exports.Claude4Sonnet20250514Literal = xe;
98
- exports.Claude4Sonnet20250514Options = jn;
99
- exports.Claude4Sonnet20250514Schema = Nt;
100
- exports.ClaudeHaiku4_520251001 = Ue;
101
- exports.ClaudeHaiku4_520251001Literal = Be;
102
- exports.ClaudeHaiku4_520251001Options = Dn;
103
- exports.ClaudeHaiku4_520251001Schema = Ht;
104
- exports.ClaudeOpus4_520251101 = _e;
105
- exports.ClaudeOpus4_520251101Literal = Oe;
106
- exports.ClaudeOpus4_520251101Options = In;
107
- exports.ClaudeOpus4_520251101Schema = Dt;
108
- exports.ClaudeOpus4_6 = Ae;
109
- exports.ClaudeOpus4_6Literal = Ee;
110
- exports.ClaudeOpus4_6Options = Ln;
111
- exports.ClaudeOpus4_6Schema = zt;
112
- exports.ClaudeOpus4_7 = we;
113
- exports.ClaudeOpus4_7Literal = Pe;
114
- exports.ClaudeOpus4_7Options = Bn;
115
- exports.ClaudeOpus4_7Schema = Vt;
116
- exports.ClaudeSonnet4_520250929 = je;
117
- exports.ClaudeSonnet4_520250929Literal = qe;
118
- exports.ClaudeSonnet4_520250929Options = Un;
119
- exports.ClaudeSonnet4_520250929Schema = $t;
120
- exports.ClaudeSonnet4_6 = Le;
121
- exports.ClaudeSonnet4_6Literal = Ie;
122
- exports.ClaudeSonnet4_6Options = Nn;
123
- exports.ClaudeSonnet4_6Schema = Ft;
124
- exports.EmbeddingModelBaseConfigDef = wn;
125
- exports.EmbeddingModelBaseConfigSchema = Pn;
126
- exports.ProviderLiteral = as;
127
- exports.Voyage3 = tt;
128
- exports.Voyage3Lite = et;
129
- exports.Voyage3LiteLiteral = mo;
130
- exports.Voyage3LiteOptions = Yn;
131
- exports.Voyage3LiteSchema = co;
132
- exports.Voyage3Literal = uo;
133
- exports.Voyage3Options = Qn;
134
- exports.Voyage3Schema = go;
135
- exports.VoyageCode2 = Ze;
136
- exports.VoyageCode2Literal = oo;
137
- exports.VoyageCode2Options = Jn;
138
- exports.VoyageCode2Schema = no;
139
- exports.VoyageFinance2 = Qe;
140
- exports.VoyageFinance2Literal = lo;
141
- exports.VoyageFinance2Options = Xn;
142
- exports.VoyageFinance2Schema = po;
143
- exports.VoyageLaw2 = Xe;
144
- exports.VoyageLaw2Literal = ao;
145
- exports.VoyageLaw2Options = Wn;
146
- exports.VoyageLaw2Schema = io;
147
- exports.VoyageMultilingual2 = Ye;
148
- exports.VoyageMultilingual2Literal = so;
149
- exports.VoyageMultilingual2Options = Zn;
150
- exports.VoyageMultilingual2Schema = ro;
151
- exports.encodingFormat = It;
152
- exports.inputType = Lt;
153
- exports.maxTokens = _t;
154
- exports.mcp = qt;
155
- exports.mcpServers = jt;
156
- exports.stop = Et;
157
- exports.temperature = Ot;
158
- exports.toolChoice = wt;
159
- exports.topK = Pt;
160
- exports.topP = At;
161
- exports.truncation = Bt;
18
+ exports.AnthropicChatModelModalities = U;
19
+ exports.AnthropicChatModelModalitiesEnum = z;
20
+ exports.AnthropicChatModelRoles = M;
21
+ exports.AnthropicChatModelRolesMap = k;
22
+ exports.AnthropicCompleteChatMcpToolResultResponse = Xs;
23
+ exports.AnthropicCompleteChatMcpToolUseResponse = Zs;
24
+ exports.AnthropicCompleteChatResponse = Ni;
25
+ exports.AnthropicEmbeddingModelConfigs = y;
26
+ exports.AnthropicEmbeddingModelModalities = x;
27
+ exports.AnthropicEmbeddingModelModalitiesEnum = v;
28
+ exports.AnthropicEmbeddingRequest = Gi;
29
+ exports.AnthropicEmbeddingRequestInput = qr;
30
+ exports.AnthropicGetEmbeddingsResponse = Ji;
31
+ exports.AnthropicRequest = Ki;
32
+ exports.AnthropicRequestAssistantMessage = yr;
33
+ exports.AnthropicRequestImageContent = Fi;
34
+ exports.AnthropicRequestMcpServer = gr;
35
+ exports.AnthropicRequestMcpServerToolConfiguration = ur;
36
+ exports.AnthropicRequestMcpToolResultContent = id;
37
+ exports.AnthropicRequestMcpToolUseContent = nd;
38
+ exports.AnthropicRequestMessage = fr;
39
+ exports.AnthropicRequestRedactedThinkingContent = dr;
40
+ exports.AnthropicRequestTextContent = zo;
41
+ exports.AnthropicRequestThinkingContent = lr;
42
+ exports.AnthropicRequestTool = pr;
43
+ exports.AnthropicRequestToolCallContent = od;
44
+ exports.AnthropicRequestToolChoiceEnum = mr;
45
+ exports.AnthropicRequestToolChoiceTool = cr;
46
+ exports.AnthropicRequestToolResponseContent = Hi;
47
+ exports.AnthropicRequestUserMessage = hr;
48
+ exports.AnthropicStreamChatContentBlockDeltaResponse = $i;
49
+ exports.AnthropicStreamChatContentBlockStartMcpToolResultResponse = nr;
50
+ exports.AnthropicStreamChatContentBlockStartMcpToolUseResponse = or;
51
+ exports.AnthropicStreamChatContentBlockStartResponse = zi;
52
+ exports.AnthropicStreamChatMessageDeltaResponse = Ui;
53
+ exports.AnthropicStreamChatMessageStartResponse = Bi;
54
+ exports.AnthropicThinkingChatModelModalities = V;
55
+ exports.AnthropicThinkingChatModelModalitiesEnum = D;
56
+ exports.BaseChatModel = f;
57
+ exports.BaseChatModelOptions = b;
58
+ exports.BaseEmbeddingModel = S;
59
+ exports.BaseEmbeddingModelOptions = R;
60
+ exports.ChatModelBaseConfigDef = xe;
61
+ exports.ChatModelBaseConfigSchema = Oe;
62
+ exports.ChatModelReasoningConfigDef = ni;
63
+ exports.ChatModelReasoningConfigSchema = ii;
64
+ exports.Claude3Haiku20240307 = We;
65
+ exports.Claude3Haiku20240307Literal = Mo;
66
+ exports.Claude3Haiku20240307Options = Ti;
67
+ exports.Claude3Haiku20240307Schema = ko;
68
+ exports.Claude3Opus20240229 = Ye;
69
+ exports.Claude3Opus20240229Literal = Ro;
70
+ exports.Claude3Opus20240229Options = ki;
71
+ exports.Claude3Opus20240229Schema = Oo;
72
+ exports.Claude3Sonnet20240229 = Qe;
73
+ exports.Claude3Sonnet20240229Literal = xo;
74
+ exports.Claude3Sonnet20240229Options = Si;
75
+ exports.Claude3Sonnet20240229Schema = vo;
76
+ exports.Claude3_5Haiku20241022 = Xe;
77
+ exports.Claude3_5Haiku20241022Literal = Ze;
78
+ exports.Claude3_5Haiku20241022Options = Mi;
79
+ exports.Claude3_5Haiku20241022Schema = So;
80
+ exports.Claude3_5Sonnet20240620 = Fe;
81
+ exports.Claude3_5Sonnet20240620Literal = $e;
82
+ exports.Claude3_5Sonnet20240620Options = fi;
83
+ exports.Claude3_5Sonnet20240620Schema = bo;
84
+ exports.Claude3_5Sonnet20241022 = Ke;
85
+ exports.Claude3_5Sonnet20241022Literal = He;
86
+ exports.Claude3_5Sonnet20241022Options = bi;
87
+ exports.Claude3_5Sonnet20241022Schema = Co;
88
+ exports.Claude3_7Sonnet20250219 = Ge;
89
+ exports.Claude3_7Sonnet20250219Literal = Je;
90
+ exports.Claude3_7Sonnet20250219Options = Ci;
91
+ exports.Claude3_7Sonnet20250219Schema = To;
92
+ exports.Claude4Opus20250514 = Ee;
93
+ exports.Claude4Opus20250514Literal = ve;
94
+ exports.Claude4Opus20250514Options = di;
95
+ exports.Claude4Opus20250514Schema = po;
96
+ exports.Claude4Sonnet20250514 = Pe;
97
+ exports.Claude4Sonnet20250514Literal = _e;
98
+ exports.Claude4Sonnet20250514Options = pi;
99
+ exports.Claude4Sonnet20250514Schema = mo;
100
+ exports.ClaudeHaiku4_520251001 = ze;
101
+ exports.ClaudeHaiku4_520251001Literal = Ue;
102
+ exports.ClaudeHaiku4_520251001Options = yi;
103
+ exports.ClaudeHaiku4_520251001Schema = fo;
104
+ exports.ClaudeOpus4_520251101 = we;
105
+ exports.ClaudeOpus4_520251101Literal = Ae;
106
+ exports.ClaudeOpus4_520251101Options = mi;
107
+ exports.ClaudeOpus4_520251101Schema = co;
108
+ exports.ClaudeOpus4_6 = qe;
109
+ exports.ClaudeOpus4_6Literal = Le;
110
+ exports.ClaudeOpus4_6Options = ci;
111
+ exports.ClaudeOpus4_6Schema = uo;
112
+ exports.ClaudeOpus4_7 = Ie;
113
+ exports.ClaudeOpus4_7Literal = je;
114
+ exports.ClaudeOpus4_7Options = ui;
115
+ exports.ClaudeOpus4_7Schema = go;
116
+ exports.ClaudeSonnet4_520250929 = De;
117
+ exports.ClaudeSonnet4_520250929Literal = Ve;
118
+ exports.ClaudeSonnet4_520250929Options = gi;
119
+ exports.ClaudeSonnet4_520250929Schema = ho;
120
+ exports.ClaudeSonnet4_6 = Be;
121
+ exports.ClaudeSonnet4_6Literal = Ne;
122
+ exports.ClaudeSonnet4_6Options = hi;
123
+ exports.ClaudeSonnet4_6Schema = yo;
124
+ exports.EmbeddingModelBaseConfigDef = si;
125
+ exports.EmbeddingModelBaseConfigSchema = ai;
126
+ exports.EmbeddingModelFlexibleConfigDef = li;
127
+ exports.EmbeddingModelFlexibleConfigSchema = ri;
128
+ exports.ProviderLiteral = $s;
129
+ exports.Voyage3 = mt;
130
+ exports.Voyage3Large = ut;
131
+ exports.Voyage3LargeLiteral = ct;
132
+ exports.Voyage3LargeOptions = Pi;
133
+ exports.Voyage3LargeSchema = qo;
134
+ exports.Voyage3Lite = dt;
135
+ exports.Voyage3LiteLiteral = lt;
136
+ exports.Voyage3LiteOptions = Ei;
137
+ exports.Voyage3LiteSchema = wo;
138
+ exports.Voyage3Literal = pt;
139
+ exports.Voyage3Options = _i;
140
+ exports.Voyage3Schema = Lo;
141
+ exports.Voyage3_5 = ht;
142
+ exports.Voyage3_5Lite = ft;
143
+ exports.Voyage3_5LiteLiteral = yt;
144
+ exports.Voyage3_5LiteOptions = wi;
145
+ exports.Voyage3_5LiteSchema = Io;
146
+ exports.Voyage3_5Literal = gt;
147
+ exports.Voyage3_5Options = Ai;
148
+ exports.Voyage3_5Schema = jo;
149
+ exports.Voyage4 = St;
150
+ exports.Voyage4Large = Mt;
151
+ exports.Voyage4LargeLiteral = Tt;
152
+ exports.Voyage4LargeOptions = qi;
153
+ exports.Voyage4LargeSchema = Do;
154
+ exports.Voyage4Lite = Ot;
155
+ exports.Voyage4LiteLiteral = Rt;
156
+ exports.Voyage4LiteOptions = Ii;
157
+ exports.Voyage4LiteSchema = Bo;
158
+ exports.Voyage4Literal = kt;
159
+ exports.Voyage4Nano = vt;
160
+ exports.Voyage4NanoLiteral = xt;
161
+ exports.Voyage4NanoOptions = Vi;
162
+ exports.Voyage4NanoSchema = Uo;
163
+ exports.Voyage4Options = ji;
164
+ exports.Voyage4Schema = No;
165
+ exports.VoyageCode2 = tt;
166
+ exports.VoyageCode2Literal = et;
167
+ exports.VoyageCode2Options = Ri;
168
+ exports.VoyageCode2Schema = Eo;
169
+ exports.VoyageCode3 = Ct;
170
+ exports.VoyageCode3Literal = bt;
171
+ exports.VoyageCode3Options = Li;
172
+ exports.VoyageCode3Schema = Vo;
173
+ exports.VoyageFinance2 = rt;
174
+ exports.VoyageFinance2Literal = st;
175
+ exports.VoyageFinance2Options = vi;
176
+ exports.VoyageFinance2Schema = Ao;
177
+ exports.VoyageLaw2 = nt;
178
+ exports.VoyageLaw2Literal = ot;
179
+ exports.VoyageLaw2Options = Oi;
180
+ exports.VoyageLaw2Schema = _o;
181
+ exports.VoyageMultilingual2 = at;
182
+ exports.VoyageMultilingual2Literal = it;
183
+ exports.VoyageMultilingual2Options = xi;
184
+ exports.VoyageMultilingual2Schema = Po;
185
+ exports.encodingFormat = pe;
186
+ exports.inputType = me;
187
+ exports.maxTokens = eo;
188
+ exports.mcp = ao;
189
+ exports.mcpServers = so;
190
+ exports.outputDimension = ro;
191
+ exports.outputDtype = lo;
192
+ exports.stop = to;
193
+ exports.temperature = Qt;
194
+ exports.toolChoice = io;
195
+ exports.topK = no;
196
+ exports.topP = oo;
197
+ exports.truncation = ce;
162
198
  //# sourceMappingURL=index.js.map
163
199
  //# sourceMappingURL=index.js.map