@adaline/open-router 0.15.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as zod from 'zod';
2
2
  import { z } from 'zod';
3
3
  import { ChatModelV1, ChatModelSchemaType, UrlType, HeadersType, ParamsType, ProviderV1, EmbeddingModelSchemaType, EmbeddingModelV1 } from '@adaline/provider';
4
- import { MessageType, ConfigType, ToolType, ChatResponseType, PartialChatResponseType } from '@adaline/types';
4
+ import { MessageType, ConfigType, ToolType, ChatResponseType, PartialChatResponseType, ChatModelPriceType } from '@adaline/types';
5
5
 
6
6
  declare const OpenRouterChatModelConfigs: {
7
7
  readonly base: (maxOutputTokens: number, maxSequences: number) => {
@@ -950,6 +950,7 @@ declare class BaseChatModel implements ChatModelV1<ChatModelSchemaType> {
950
950
  getProxyCompleteChatUrl(data?: any, headers?: Record<string, string>, query?: Record<string, string>): Promise<UrlType>;
951
951
  getProxyCompleteChatHeaders(data?: any, headers?: Record<string, string>, query?: Record<string, string>): Promise<HeadersType>;
952
952
  getProxyStreamChatHeaders(data?: any, headers?: Record<string, string>, query?: Record<string, string>): Promise<HeadersType>;
953
+ getModelPricing(): ChatModelPriceType;
953
954
  }
954
955
 
955
956
  declare const BaseChatModelSchema: {
@@ -997,6 +998,20 @@ declare const BaseChatModelSchema: {
997
998
  }>;
998
999
  schema: zod.ZodObject<zod.ZodRawShape, zod.UnknownKeysParam, zod.ZodTypeAny, unknown, unknown>;
999
1000
  };
1001
+ price: {
1002
+ modelName: string;
1003
+ currency: string;
1004
+ tokenRanges: {
1005
+ minTokens: number;
1006
+ prices: {
1007
+ base: {
1008
+ inputPricePerMillion: number;
1009
+ outputPricePerMillion: number;
1010
+ };
1011
+ };
1012
+ maxTokens?: number | null | undefined;
1013
+ }[];
1014
+ };
1000
1015
  maxReasoningTokens?: number | undefined;
1001
1016
  };
1002
1017
 
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as zod from 'zod';
2
2
  import { z } from 'zod';
3
3
  import { ChatModelV1, ChatModelSchemaType, UrlType, HeadersType, ParamsType, ProviderV1, EmbeddingModelSchemaType, EmbeddingModelV1 } from '@adaline/provider';
4
- import { MessageType, ConfigType, ToolType, ChatResponseType, PartialChatResponseType } from '@adaline/types';
4
+ import { MessageType, ConfigType, ToolType, ChatResponseType, PartialChatResponseType, ChatModelPriceType } from '@adaline/types';
5
5
 
6
6
  declare const OpenRouterChatModelConfigs: {
7
7
  readonly base: (maxOutputTokens: number, maxSequences: number) => {
@@ -950,6 +950,7 @@ declare class BaseChatModel implements ChatModelV1<ChatModelSchemaType> {
950
950
  getProxyCompleteChatUrl(data?: any, headers?: Record<string, string>, query?: Record<string, string>): Promise<UrlType>;
951
951
  getProxyCompleteChatHeaders(data?: any, headers?: Record<string, string>, query?: Record<string, string>): Promise<HeadersType>;
952
952
  getProxyStreamChatHeaders(data?: any, headers?: Record<string, string>, query?: Record<string, string>): Promise<HeadersType>;
953
+ getModelPricing(): ChatModelPriceType;
953
954
  }
954
955
 
955
956
  declare const BaseChatModelSchema: {
@@ -997,6 +998,20 @@ declare const BaseChatModelSchema: {
997
998
  }>;
998
999
  schema: zod.ZodObject<zod.ZodRawShape, zod.UnknownKeysParam, zod.ZodTypeAny, unknown, unknown>;
999
1000
  };
1001
+ price: {
1002
+ modelName: string;
1003
+ currency: string;
1004
+ tokenRanges: {
1005
+ minTokens: number;
1006
+ prices: {
1007
+ base: {
1008
+ inputPricePerMillion: number;
1009
+ outputPricePerMillion: number;
1010
+ };
1011
+ };
1012
+ maxTokens?: number | null | undefined;
1013
+ }[];
1014
+ };
1000
1015
  maxReasoningTokens?: number | undefined;
1001
1016
  };
1002
1017
 
package/dist/index.js CHANGED
@@ -2,36 +2,36 @@
2
2
 
3
3
  var zod = require('zod');
4
4
 
5
- var Pt=Object.defineProperty;var Me=Object.getOwnPropertySymbols;var _t=Object.prototype.hasOwnProperty,St=Object.prototype.propertyIsEnumerable;var $=(o,t)=>(t=Symbol[o])?t:Symbol.for("Symbol."+o),wt=o=>{throw TypeError(o)};var Oe=(o,t,n)=>t in o?Pt(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,R=(o,t)=>{for(var n in t||(t={}))_t.call(t,n)&&Oe(o,n,t[n]);if(Me)for(var n of Me(t))St.call(t,n)&&Oe(o,n,t[n]);return o};var x=(o,t,n)=>new Promise((a,s)=>{var r=d=>{try{p(n.next(d));}catch(u){s(u);}},c=d=>{try{p(n.throw(d));}catch(u){s(u);}},p=d=>d.done?a(d.value):Promise.resolve(d.value).then(r,c);p((n=n.apply(o,t)).next());}),xe=function(o,t){this[0]=o,this[1]=t;},K=(o,t,n)=>{var a=(c,p,d,u)=>{try{var g=n[c](p),C=(p=g.value)instanceof xe,y=g.done;Promise.resolve(C?p[0]:p).then(f=>C?a(c==="return"?c:"next",p[1]?{done:f.done,value:f.value}:f,d,u):d({value:f,done:y})).catch(f=>a("throw",f,d,u));}catch(f){u(f);}},s=c=>r[c]=p=>new Promise((d,u)=>a(c,p,d,u)),r={};return n=n.apply(o,t),r[$("asyncIterator")]=()=>r,s("next"),s("throw"),s("return"),r},Ee=o=>{var t=o[$("asyncIterator")],n=!1,a,s={};return t==null?(t=o[$("iterator")](),a=r=>s[r]=c=>t[r](c)):(t=t.call(o),a=r=>s[r]=c=>{if(n){if(n=!1,r==="throw")throw c;return c}return n=!0,{done:!1,value:new xe(new Promise(p=>{var d=t[r](c);d instanceof Object||wt("Object expected"),p(d);}),1)}}),s[$("iterator")]=()=>s,a("next"),"throw"in t?a("throw"):s.throw=r=>{throw r},"return"in t&&a("return"),s};var jt=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})},kt=o=>o==null?"unknown error":typeof o=="string"?o:o instanceof Error?o.message:jt(o),V="GatewayBaseError",j=class we extends Error{constructor({info:t,cause:n},a){super(`[${a!=null?a:V}]: ${t}
6
- Message: ${kt(n)}`),this.name=V,this.info=t,this.cause=n,this.name=a!=null?a:V,Object.setPrototypeOf(this,new.target.prototype);}static isGatewayBaseError(t){return t instanceof we}toJSON(){return {name:this.name,info:this.info,cause:this.cause,message:this.message,stack:this.stack}}},I="system",q="user",E="assistant",L="tool",It=[I,q,E,L],Y=zod.z.enum(It),qt=[E],Lt=zod.z.enum(qt),_="image",W="base64",Nt=["png","jpeg","webp","gif"],Ut=zod.z.object({type:zod.z.literal(W),base64:zod.z.string(),media_type:zod.z.enum(Nt)}),J="url",Bt=zod.z.object({type:zod.z.literal(J),url:zod.z.string()}),$t=zod.z.discriminatedUnion("type",[Ut,Bt]),At=["low","medium","high","auto"],Ft=zod.z.enum(At),zt=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(_),detail:Ft,value:$t,metadata:o}),je="reasoning",ke="partial-reasoning",Ie="thinking",Dt="redacted",G=zod.z.object({type:zod.z.literal(Ie),thinking:zod.z.string(),signature:zod.z.string()}),qe=zod.z.object({type:zod.z.literal(Dt),data:zod.z.string()}),Ht=zod.z.discriminatedUnion("type",[G,qe]),Kt=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(je),value:Ht,metadata:o}),Vt=zod.z.object({type:zod.z.literal(Ie),thinking:G.shape.thinking.optional(),signature:G.shape.signature.optional()}),Gt=zod.z.discriminatedUnion("type",[Vt,qe]),Yt=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(ke),value:Gt,metadata:o}),T="text",Le=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(T),value:zod.z.string(),metadata:o}),X="partial-text",Ne=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(X),value:zod.z.string(),metadata:o}),P="tool-call",Ue=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(P),index:zod.z.number().int().nonnegative(),id:zod.z.string().min(1),name:zod.z.string().min(1),arguments:zod.z.string(),metadata:o}),Z="partial-tool-call",Be=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(Z),index:zod.z.number().int().nonnegative(),id:zod.z.string().optional(),name:zod.z.string().optional(),arguments:zod.z.string().optional(),metadata:o}),S="tool-response",Wt=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(S),index:zod.z.number().int().nonnegative(),id:zod.z.string().min(1),name:zod.z.string().min(1),data:zod.z.string(),metadata:o}),Jt=[T,_,P,S,je],$e=zod.z.enum(Jt),Xt=(o=zod.z.undefined(),t=zod.z.undefined(),n=zod.z.undefined(),a=zod.z.undefined(),s=zod.z.undefined())=>zod.z.discriminatedUnion("modality",[Le(o),zt(t),Ue(n),Wt(a),Kt(s)]),Zt=[X,Z,ke];zod.z.enum(Zt);var Qt=(o=zod.z.undefined(),t=zod.z.undefined(),n=zod.z.undefined())=>zod.z.discriminatedUnion("modality",[Ne(o),Be(t),Yt(n)]);var Q=(o=Y,t=zod.z.undefined(),n=zod.z.undefined(),a=zod.z.undefined(),s=zod.z.undefined(),r=zod.z.undefined(),c=zod.z.undefined())=>zod.z.object({role:o,content:zod.z.array(Xt(t,n,a,s,c)),metadata:r}),ee=(o=Lt,t=zod.z.undefined(),n=zod.z.undefined(),a=zod.z.undefined(),s=zod.z.undefined())=>zod.z.object({role:o,partialContent:Qt(t,n,a),metadata:s}),te=o=>Le().parse({modality:T,value:o}),Ae=(o,t,n,a)=>Ue().parse({modality:P,index:o,id:t,name:n,arguments:a});var oe=(o,t)=>ee().parse({role:o,partialContent:Ne().parse({modality:X,value:t})}),Fe=(o,t,n,a,s)=>ee().parse({role:o,partialContent:Be().parse({modality:Z,index:t,id:n,name:a,arguments:s})});var ze=(o=zod.z.record(zod.z.string(),zod.z.any()).optional())=>o,eo=["object","array","number","string","boolean","enum"],Pe=zod.z.enum(eo),to=zod.z.object({anyOf:zod.z.array(zod.z.any()).optional(),type:zod.z.union([Pe,zod.z.array(zod.z.union([Pe,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()}),oo=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(to),additionalProperties:zod.z.literal(!1)});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:oo}).optional();var no="function";var ao=zod.z.enum(["object","array","number","string","boolean","null"]),so=zod.z.object({anyOf:zod.z.array(zod.z.any()).optional(),type:ao.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(so).optional(),required:zod.z.array(zod.z.string()).optional()});var ro=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 io=zod.z.enum(["function"]),lo=zod.z.object({type:io,definition:zod.z.object({schema:ro})}),po=[no];zod.z.enum(po);var De=(o=zod.z.undefined())=>zod.z.discriminatedUnion("type",[lo.extend({metadata:o})]),mo="text",co="token",uo=[mo,co];zod.z.enum(uo);zod.z.array(zod.z.string().min(1));zod.z.array(zod.z.array(zod.z.number().int().nonnegative()));var ho="float",yo=zod.z.object({index:zod.z.number().int().nonnegative(),embedding:zod.z.array(zod.z.number())}),fo="base64",bo=zod.z.object({index:zod.z.number().int().nonnegative(),embedding:zod.z.string().base64()}),_e=zod.z.object({totalTokens:zod.z.number().int().nonnegative()});zod.z.discriminatedUnion("encodingFormat",[zod.z.object({encodingFormat:zod.z.literal(ho),embeddings:zod.z.array(yo),usage:_e.optional()}),zod.z.object({encodingFormat:zod.z.literal(fo),embeddings:zod.z.array(bo),usage:_e.optional()})]);var He=zod.z.object({promptTokens:zod.z.number().nonnegative(),completionTokens:zod.z.number().nonnegative(),totalTokens:zod.z.number().nonnegative()}),Se=zod.z.object({token:zod.z.string(),logProb:zod.z.number(),bytes:zod.z.array(zod.z.number().int()).nullable()}),Co=Se.extend({topLogProbs:zod.z.array(Se)}),Ke=zod.z.array(Co);zod.z.object({messages:zod.z.array(Q()),usage:He.optional(),logProbs:Ke.optional()});zod.z.object({partialMessages:zod.z.array(ee()),usage:He.optional(),logProbs:Ke.optional()});var To=Object.defineProperty,Ve=Object.getOwnPropertySymbols,Ro=Object.prototype.hasOwnProperty,vo=Object.prototype.propertyIsEnumerable,Ge=(o,t,n)=>t in o?To(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,A=(o,t)=>{for(var n in t||(t={}))Ro.call(t,n)&&Ge(o,n,t[n]);if(Ve)for(var n of Ve(t))vo.call(t,n)&&Ge(o,n,t[n]);return o},Ye="ProviderError",et=class tt extends j{constructor({info:t,cause:n}){super({info:t,cause:n},Ye),this.name=Ye,this.info=t,this.cause=n;}static isProviderError(t){return t instanceof tt}};var We="ModelResponseError",N=class ot extends j{constructor({info:t,cause:n}){super({info:t,cause:n},We),this.name=We,this.cause=n,this.info=t;}static isModelResponseError(t){return t instanceof ot}},Je="InvalidModelRequestError",F=class nt extends j{constructor({info:t,cause:n}){super({info:t,cause:n},Je),this.name=Je,this.cause=n,this.info=t,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidModelRequestError(t){return t instanceof nt}},Xe="InvalidConfigError",k=class at extends j{constructor({info:t,cause:n}){super({info:t,cause:n},Xe),this.name=Xe,this.cause=n,this.info=t,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidConfigError(t){return t instanceof at}},Ze="InvalidMessagesError",M=class st extends j{constructor({info:t,cause:n}){super({info:t,cause:n},Ze),this.name=Ze,this.cause=n,this.info=t,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidMessagesError(t){return t instanceof st}},Qe="InvalidToolsError",ne=class rt extends j{constructor({info:t,cause:n}){super({info:t,cause:n},Qe),this.name=Qe,this.cause=n,this.info=t,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidToolsError(t){return t instanceof rt}};var ae="multi-string",it=zod.z.object({type:zod.z.literal(ae),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()}),Mo=o=>zod.z.array(zod.z.string()).max(o).default([]).optional(),lt=o=>({def:it.parse(A({type:ae},o)),schema:Mo(o.max)}),pt="object-schema",Oo=zod.z.object({type:zod.z.literal(pt),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),objectSchema:zod.z.any()});var se="range",mt=zod.z.object({type:zod.z.literal(se),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()}),xo=(o,t,n,a)=>zod.z.number().min(o).max(t).step(n).default(a).optional(),O=o=>({def:mt.parse(A({type:se},o)),schema:xo(o.min,o.max,o.step,o.default)}),re="select-boolean",dt=zod.z.object({type:zod.z.literal(re),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()}),Eo=o=>zod.z.boolean().nullable().default(o).optional(),ct=o=>({def:dt.parse(A({type:re},o)),schema:Eo(o.default)}),ie="select-string",ut=zod.z.object({type:zod.z.literal(ie),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())}),Po=(o,t)=>zod.z.enum(t).nullable().default(o).optional(),le=o=>({def:ut.parse(A({type:ie},o)),schema:Po(o.default,o.choices)}),_o=[se,ae,ie,pt,re];zod.z.enum(_o);var So=zod.z.discriminatedUnion("type",[mt,it,ut,dt,Oo]),gt=(o=Y,t=$e)=>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),So),schema:zod.z.instanceof(zod.z.ZodObject)}).refine(n=>{var a,s;let r=Object.keys(n.def),c=Object.keys((s=(a=n.schema)==null?void 0:a.shape)!=null?s:{});return r.every(p=>c.includes(p))&&c.every(p=>r.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 wo={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."},jo={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."},ko={type:"range",title:"Max reasoning tokens",description:"Specify the total tokens for reasoning, where one token approximates four English characters."},Io=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.`}),qo={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."},Lo={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."},No={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."},Uo={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."},Bo={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."},$o={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."},Ao={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."},Fo={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."},zo={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."},Do={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."},Ho={type:"boolean",title:"Echo",description:"If true, the response will contain the prompt."},Ko={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."},Vo={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."},Go={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."},h={TEMPERATURE:wo,MAX_TOKENS:jo,STOP:Io,TOP_A:qo,TOP_P:Lo,TOP_K:No,MIN_P:Uo,FREQUENCY_PENALTY:Bo,PRESENCE_PENALTY:$o,REPETITION_PENALTY:Fo,SEED:Ao,LOG_PROBS:zo,TOP_LOG_PROBS:Do,ECHO:Ho,RESPONSE_FORMAT:Ko,RESPONSE_FORMAT_WITH_SCHEMA:Vo,RESPONSE_SCHEMA:Go,MAX_REASONING_TOKENS:ko};var ht=o=>Object.fromEntries(Object.entries(o).filter(([t,n])=>n!=null));var yt=o=>o.split(";")[0].split("/")[1],z=o=>o==null?void 0:o.replace(/\/$/,"");var pe=O({param:"temperature",title:h.TEMPERATURE.title,description:h.TEMPERATURE.description,min:0,max:2,step:.01,default:1}),me=o=>O({param:"max_tokens",title:h.MAX_TOKENS.title,description:h.MAX_TOKENS.description,min:0,max:o,step:1,default:0}),de=o=>lt({param:"stop",title:h.STOP(o).title,description:h.STOP(o).description,max:o}),kn=O({param:"top_a",title:h.TOP_A.title,description:h.TOP_A.description,min:0,max:1,step:.01,default:0}),In=O({param:"top_k",title:h.TOP_K.title,description:h.TOP_K.description,min:0,max:100,step:1,default:0}),ce=O({param:"top_p",title:h.TOP_P.title,description:h.TOP_P.description,min:0,max:1,step:.01,default:1}),qn=O({param:"min_p",title:h.MIN_P.title,description:h.MIN_P.description,min:0,max:1,step:.01,default:0}),ue=O({param:"frequency_penalty",title:h.FREQUENCY_PENALTY.title,description:h.FREQUENCY_PENALTY.description,min:-2,max:2,step:.01,default:0}),ge=O({param:"presence_penalty",title:h.PRESENCE_PENALTY.title,description:h.PRESENCE_PENALTY.description,min:-2,max:2,step:.01,default:0}),Ln=O({param:"repetition_penalty",title:h.REPETITION_PENALTY.title,description:h.REPETITION_PENALTY.description,min:0,max:2,step:.01,default:0}),he=O({param:"seed",title:h.SEED.title,description:h.SEED.description,min:0,max:1e6,step:1,default:0}),ye=ct({param:"logprobs",title:h.LOG_PROBS.title,description:h.LOG_PROBS.description,default:!1}),fe=O({param:"top_logprobs",title:h.TOP_LOG_PROBS.title,description:h.TOP_LOG_PROBS.description,min:0,max:20,step:1,default:0}),be=le({param:"tool_choice",title:"Tool choice",description:"Controls which (if any) tool is called by the model. 'none' means the model will not call a function. 'auto' means the model can pick between generating a message or calling a tool.",default:"auto",choices:["auto","required","none"]}),Nn=le({param:"response_format",title:h.RESPONSE_FORMAT.title,description:h.RESPONSE_FORMAT.description,default:"text",choices:["text","json_object"]});var ft=(o,t)=>zod.z.object({temperature:pe.schema,maxTokens:me(o).schema,stop:de(t).schema,topP:ce.schema,frequencyPenalty:ue.schema,presencePenalty:ge.schema,seed:he.schema.transform(n=>n===0?void 0:n),logProbs:ye.schema,topLogProbs:fe.schema,toolChoice:be.schema}),bt=(o,t)=>({temperature:pe.def,maxTokens:me(o).def,stop:de(t).def,topP:ce.def,frequencyPenalty:ue.def,presencePenalty:ge.def,seed:he.def,logProbs:ye.def,topLogProbs:fe.def,toolChoice:be.def});var Ce={base:(o,t)=>({def:bt(o,t),schema:ft(o,t)})};var Wo="open-router",U=class{constructor(){this.version="v1";this.name=Wo;this.embeddingModelFactories={};}chatModelLiterals(){return ["__base__"]}chatModelSchemas(){return {__base__:Te}}chatModel(t){let n=D,a=Re.parse(t);return new n(Te,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){throw new et({info:"Open Router does not support embedding models yet",cause:new Error("Open Router does not support embedding models yet")})}};U.baseUrl="https://openrouter.ai/api/v1";var Ct=zod.z.enum([I,q,E,L]),Tt={system:I,user:q,assistant:E,tool:L};var Rt=[T,_,P,S],vt=zod.z.enum([T,_,P,S]);var H=zod.z.object({token:zod.z.string(),logprob:zod.z.number(),bytes:zod.z.array(zod.z.number()).nullable()}),Mt=zod.z.object({content:zod.z.array(H.extend({top_logprobs:zod.z.array(H)})).nullable(),refusal:zod.z.array(H.extend({top_logprobs:zod.z.array(H)})).nullable()}).nullable(),Zo=zod.z.array(zod.z.object({id:zod.z.string().min(1),type:zod.z.enum(["function"]),function:zod.z.object({name:zod.z.string(),arguments:zod.z.string()})})),Ot=zod.z.object({id:zod.z.string(),object:zod.z.string(),created:zod.z.number(),model:zod.z.string(),system_fingerprint:zod.z.string().nullable().optional(),choices:zod.z.array(zod.z.object({index:zod.z.number(),message:zod.z.object({role:zod.z.string(),content:zod.z.string().nullable().optional(),tool_calls:Zo.optional(),refusal:zod.z.string().nullable().optional()}),logprobs:Mt.optional(),finish_reason:zod.z.string().nullable().optional()})),usage:zod.z.object({prompt_tokens:zod.z.number(),completion_tokens:zod.z.number(),total_tokens:zod.z.number()}).nullable().optional()}),Qo=zod.z.array(zod.z.object({index:zod.z.number().int(),id:zod.z.string().min(1).optional(),type:zod.z.enum(["function"]).optional(),function:zod.z.object({name:zod.z.string().min(1).optional(),arguments:zod.z.string().optional()}).optional()})),xt=zod.z.object({id:zod.z.string(),object:zod.z.string(),created:zod.z.number(),model:zod.z.string(),system_fingerprint:zod.z.string().nullable().optional(),choices:zod.z.array(zod.z.object({index:zod.z.number(),delta:zod.z.object({content:zod.z.string().nullable().optional(),tool_calls:Qo.optional(),refusal:zod.z.string().nullable().optional()}).or(zod.z.object({})),logprobs:Mt,finish_reason:zod.z.string().nullable().optional()})),usage:zod.z.object({prompt_tokens:zod.z.number(),completion_tokens:zod.z.number(),total_tokens:zod.z.number()}).nullable().optional()});var en=zod.z.object({type:zod.z.literal("function"),function:zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1).optional(),strict:zod.z.boolean().optional(),parameters:zod.z.any()})}),tn=zod.z.enum(["none","auto","required"]),on=zod.z.object({type:zod.z.literal("function"),function:zod.z.object({name:zod.z.string().min(1)})}),nn=zod.z.object({type:zod.z.enum(["text","json_object"])}).or(zod.z.object({type:zod.z.literal("json_schema"),json_schema:zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1).optional(),strict:zod.z.boolean().optional(),schema:zod.z.any()})})),ve=zod.z.object({text:zod.z.string().min(1),type:zod.z.literal("text")}),an=zod.z.object({type:zod.z.literal("image_url"),image_url:zod.z.object({url:zod.z.string().url().min(1),detail:zod.z.enum(["low","high","auto"]).optional()})}),sn=zod.z.object({id:zod.z.string().min(1),type:zod.z.literal("function"),function:zod.z.object({name:zod.z.string().min(1),arguments:zod.z.string().min(1)})}),rn=zod.z.object({role:zod.z.literal("system"),content:zod.z.string().min(1).or(zod.z.array(ve).min(1))}),ln=zod.z.object({role:zod.z.literal("user"),content:zod.z.string().min(1).or(zod.z.array(zod.z.union([ve,an])).min(1))}),pn=zod.z.object({role:zod.z.literal("assistant"),content:zod.z.string().min(1).or(zod.z.array(ve).min(1)).optional(),tool_calls:zod.z.array(sn).min(1).optional()}),mn=zod.z.object({role:zod.z.literal("tool"),tool_call_id:zod.z.string().min(1),content:zod.z.string().min(1)}),dn=zod.z.union([rn,ln,pn,mn]),Et=zod.z.object({model:zod.z.string().min(1).optional(),messages:zod.z.array(dn).min(1),frequency_penalty:zod.z.number().min(-2).max(2).nullable().optional(),logprobs:zod.z.boolean().nullable().optional(),top_logprobs:zod.z.number().min(0).max(20).nullable().optional(),max_tokens:zod.z.number().min(0).nullable().optional(),presence_penalty:zod.z.number().min(-2).max(2).nullable().optional(),repetition_penalty:zod.z.number().min(0).max(2).nullable().optional(),response_format:nn.optional(),seed:zod.z.number().nullable().optional(),stop:zod.z.string().or(zod.z.array(zod.z.string()).max(4)).nullable().optional(),top_a:zod.z.number().min(0).max(1).nullable().optional(),temperature:zod.z.number().min(0).max(2).nullable().optional(),top_p:zod.z.number().min(0).max(1).nullable().optional(),top_k:zod.z.number().min(0).max(100).nullable().optional(),min_p:zod.z.number().min(0).max(1).nullable().optional(),tools:zod.z.array(en).optional(),tool_choice:tn.or(on).optional()});var Re=zod.z.object({modelName:zod.z.string(),apiKey:zod.z.string(),openRouterReferer:zod.z.string().optional(),openRouterTitle:zod.z.string().optional()}),D=class{constructor(t,n){this.version="v1";let a=Re.parse(n);this.modelSchema=t,this.modelName=a.modelName,this.apiKey=a.apiKey,this.baseUrl=z(U.baseUrl),this.streamChatUrl=z(`${this.baseUrl}/chat/completions`),this.completeChatUrl=z(`${this.baseUrl}/chat/completions`),this.openRouterReferer=a.openRouterReferer,this.openRouterTitle=a.openRouterTitle;}getDefaultBaseUrl(){return this.baseUrl}getDefaultHeaders(){return R(R({Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},this.openRouterReferer?{"HTTP-Referer":this.openRouterReferer}:{}),this.openRouterTitle?{"X-Title":this.openRouterTitle}:{})}getDefaultParams(){return {model:this.modelName}}getRetryDelay(t){return {shouldRetry:!0,delayMs:0}}getTokenCount(t){return t.reduce((n,a)=>n+a.content.map(s=>s.modality==="text"?s.value:"").join(" ").length,0)}transformModelRequest(t){let n=Et.safeParse(t);if(!n.success)throw new F({info:"Invalid model request",cause:n.error});let a=n.data,s=a.model;if(a.tool_choice&&(!a.tools||a.tools.length===0))throw new F({info:`Invalid model request for model : '${this.modelName}'`,cause:new Error("'tools' are required when 'tool_choice' is specified")});let r={};a.response_format&&(r.responseFormat=a.response_format.type,a.response_format.type==="json_schema"&&(r.responseSchema={name:a.response_format.json_schema.name,description:a.response_format.json_schema.description||"",strict:a.response_format.json_schema.strict,schema:a.response_format.json_schema.schema})),a.tool_choice&&(typeof a.tool_choice=="string"?r.toolChoice=a.tool_choice:r.toolChoice=a.tool_choice.function.name),r.seed=a.seed,r.maxTokens=a.max_tokens,r.temperature=a.temperature,r.topA=a.top_a,r.topP=a.top_p,r.minP=a.min_p,r.topK=a.top_k,r.repetitionPenalty=a.repetition_penalty,r.presencePenalty=a.presence_penalty,r.frequencyPenalty=a.frequency_penalty,r.stop=a.stop,r.logProbs=a.logprobs,r.topLogProbs=a.top_logprobs;let c=ze().parse(ht(r)),p=[],d={};a.messages.forEach(g=>{let C=g.role;switch(C){case"system":{let y=g.content;if(typeof y=="string")p.push({role:C,content:[{modality:T,value:y}]});else {let f=y.map(b=>({modality:T,value:b.text}));p.push({role:C,content:f});}}break;case"user":{let y=g.content;if(typeof y=="string")p.push({role:C,content:[{modality:T,value:y}]});else {let f=y.map(b=>b.type==="text"?{modality:T,value:b.text}:b.image_url.url.startsWith("data:")?{modality:_,detail:b.image_url.detail||"auto",value:{type:W,base64:b.image_url.url,media_type:yt(b.image_url.url)}}:{modality:_,detail:b.image_url.detail||"auto",value:{type:J,url:b.image_url.url}});p.push({role:C,content:f});}}break;case"assistant":{let y=[];if(!g.content&&!g.tool_calls)throw new F({info:`Invalid model request for model : '${this.modelName}'`,cause:new Error("one of'content' or 'tool_calls' must be provided")});if(g.content){let f=g.content;typeof f=="string"?y.push({modality:T,value:f}):f.forEach(b=>{y.push({modality:T,value:b.text});});}g.tool_calls&&g.tool_calls.forEach((b,v)=>{let w={modality:P,id:b.id,index:v,name:b.function.name,arguments:b.function.arguments};y.push(w),d[w.id]=w;}),p.push({role:C,content:y});}break;case"tool":{let y=g;p.push({role:C,content:[{modality:S,id:y.tool_call_id,index:d[y.tool_call_id].index,name:d[y.tool_call_id].name,data:y.content}]});}break}});let u=[];return a.tools&&a.tools.forEach(g=>{u.push({type:"function",definition:{schema:{name:g.function.name,description:g.function.description||"",strict:g.function.strict,parameters:g.function.parameters}}});}),{modelName:s,config:c,messages:p,tools:u.length>0?u:void 0}}transformConfig(t,n,a){let s=t.toolChoice;delete t.toolChoice;let r=this.modelSchema.config.schema.safeParse(t);if(!r.success)throw new k({info:`Invalid config for model : '${this.modelName}'`,cause:r.error});let c=r.data;s!==void 0&&(c.toolChoice=s),Object.keys(c).forEach(d=>{if(!(d in this.modelSchema.config.def))throw new k({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`Invalid config key : '${d}',
7
- available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})});let p=Object.keys(c).reduce((d,u)=>{let g=this.modelSchema.config.def[u],C=g.param,y=c[u];return C==="max_tokens"&&g.type==="range"&&y===0?d[C]=g.max:d[C]=y,d},{});if(p.top_logprobs&&!p.logprobs)throw new k({info:`Invalid config for model : '${this.modelName}'`,cause:new Error("'logprobs' must be 'true' when 'top_logprobs' is specified")});if("tool_choice"in p&&p.tool_choice!==void 0){let d=p.tool_choice;if(!a||a&&a.length===0)throw new k({info:`Invalid config for model : '${this.modelName}'`,cause:new Error("'tools' are required when 'toolChoice' is specified")});if(a&&a.length>0){let u=this.modelSchema.config.def.toolChoice;if(!u.choices.includes(d))if(a.map(g=>g.definition.schema.name).includes(d))p.tool_choice={type:"function",function:{name:d}};else throw new k({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`toolChoice : '${d}' is not part of provided 'tools' names or
8
- one of [${u.choices.join(", ")}]`)})}}if("response_format"in p&&p.response_format!==void 0){let d=p.response_format;if(d==="json_schema")if("response_schema"in p)p.response_format={type:"json_schema",json_schema:p.response_schema},delete p.response_schema;else throw new k({info:`Invalid config for model : '${this.modelName}'`,cause:new Error("'responseSchema' is required in config when 'responseFormat' is 'json_schema'")});else p.response_format={type:d};}return p}transformMessages(t){if(!t||t&&t.length===0)return {messages:[]};let n=t.map(s=>{let r=Q().safeParse(s);if(!r.success)throw new M({info:"Invalid messages",cause:r.error});return r.data});return n.forEach(s=>{s.content.forEach(r=>{if(!this.modelSchema.modalities.includes(r.modality))throw new M({info:`Invalid message content for model : '${this.modelName}'`,cause:new Error(`model : '${this.modelName}' does not support modality : '${r.modality}',
9
- available modalities : [${this.modelSchema.modalities.join(", ")}]`)})});}),n.forEach(s=>{if(!Object.keys(this.modelSchema.roles).includes(s.role))throw new M({info:`Invalid message content for model : '${this.modelName}'`,cause:new Error(`model : '${this.modelName}' does not support role : '${s.role}',
10
- available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})}),{messages:n.map(s=>{switch(s.role){case I:{let r=[];return s.content.forEach(c=>{if(c.modality===T)r.push({type:"text",text:c.value});else throw new M({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${s.role}' cannot have content with modality : '${c.modality}'`)})}),{role:this.modelSchema.roles[s.role],content:r}}case E:{let r=[],c=[];return s.content.forEach(p=>{if(p.modality===T)r.push({type:"text",text:p.value});else if(p.modality===P)c.push({id:p.id,type:"function",function:{name:p.name,arguments:p.arguments}});else throw new M({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${s.role}' cannot have content with modality : '${p.modality}'`)})}),R(R({role:this.modelSchema.roles[s.role]},r.length>0?{content:r}:{}),c.length>0?{tool_calls:c}:{})}case q:{let r=[],c=[];s.content.forEach(d=>{if(d.modality===T)r.push({type:"text",text:d.value});else if(d.modality===_)c.push({type:"image_url",image_url:{url:d.value.type==="url"?d.value.url:d.value.base64,detail:d.detail}});else throw new M({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${s.role}' cannot have content with modality : '${d.modality}'`)})});let p=[...r,...c];return {role:this.modelSchema.roles[s.role],content:p}}case L:{if(s.content.length!==1)throw new M({info:`Invalid message for role : '${s.role}'`,cause:new Error(`role : '${s.role}' must have exactly one content item`)});if(s.content[0].modality!==S)throw new M({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${s.role}' must have content with modality : '${S}'`)});let r=s.content[0];return {role:this.modelSchema.roles[s.role],tool_call_id:r.id,content:r.data}}default:throw new M({info:`Invalid message 'role' for model : ${this.modelName}`,cause:new Error(`role : '${s.role}' is not supported,
11
- available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})}})}}transformTools(t){if(!this.modelSchema.modalities.includes(P))throw new ne({info:`Invalid tool 'modality' for model : ${this.modelName}`,cause:new Error(`model : '${this.modelName}' does not support tool modality : '${P}'`)});return !t||t&&t.length===0?{tools:[]}:{tools:t.map(s=>{let r=De().safeParse(s);if(!r.success)throw new ne({info:"Invalid tools",cause:r.error});return r.data}).map(s=>({type:"function",function:s.definition.schema}))}}getCompleteChatUrl(t,n,a){return x(this,null,function*(){return new Promise(s=>{s(this.completeChatUrl);})})}getCompleteChatHeaders(t,n,a){return x(this,null,function*(){return new Promise(s=>{s(this.getDefaultHeaders());})})}getCompleteChatData(t,n,a){return x(this,null,function*(){let s=this.transformConfig(t,n,a),r=this.transformMessages(n);if(r.messages&&r.messages.length===0)throw new M({info:"Messages are required",cause:new Error("Messages are required")});let c=a?this.transformTools(a):{};return new Promise(p=>{p(R(R(R(R({},this.getDefaultParams()),s),r),c));})})}transformCompleteChatResponse(t){let n=Ot.safeParse(t);if(n.success){if(n.data.choices.length===0)throw new N({info:"Invalid response from model",cause:new Error(`No choices in response : ${JSON.stringify(n.data)}`)});let a=n.data,s=[{role:E,content:[]}],r=a.choices[0].message;r.content&&s[0].content.push(te(r.content)),r.refusal&&s[0].content.push(te(r.refusal)),r.tool_calls&&r.tool_calls.forEach((u,g)=>{s[0].content.push(Ae(g,u.id,u.function.name,u.function.arguments));});let c;a.usage&&(c={promptTokens:a.usage.prompt_tokens,completionTokens:a.usage.completion_tokens,totalTokens:a.usage.total_tokens});let p=[],d=a.choices[0].logprobs;return d&&(d.content&&p.push(...d.content.map(u=>({token:u.token,logProb:u.logprob,bytes:u.bytes,topLogProbs:u.top_logprobs.map(g=>({token:g.token,logProb:g.logprob,bytes:g.bytes}))}))),d.refusal&&p.push(...d.refusal.map(u=>({token:u.token,logProb:u.logprob,bytes:u.bytes,topLogProbs:u.top_logprobs.map(g=>({token:g.token,logProb:g.logprob,bytes:g.bytes}))})))),{messages:s,usage:c,logProbs:p}}throw new N({info:"Invalid response from model",cause:n.error})}getStreamChatUrl(t,n,a){return x(this,null,function*(){return new Promise(s=>{s(this.streamChatUrl);})})}getStreamChatHeaders(t,n,a){return x(this,null,function*(){return new Promise(s=>{s(this.getDefaultHeaders());})})}getStreamChatData(t,n,a){return x(this,null,function*(){let s=this.transformConfig(t,n,a),r=this.transformMessages(n);if(r.messages&&r.messages.length===0)throw new M({info:"Messages are required",cause:new Error("Messages are required")});let c=a?this.transformTools(a):{};return new Promise(p=>{p(R(R(R(R({stream:!0,stream_options:{include_usage:!0}},this.getDefaultParams()),s),r),c));})})}transformStreamChatResponseChunk(t,n){return K(this,null,function*(){var p,d;let a=n+t,s=[],r="",c=0;for(;c<a.length;){let u=a.indexOf(`
12
- `,c);if(u===-1){r=a.substring(c);break}else {let g=a.substring(c,u).trim();g&&s.push(g),c=u+1;}}for(let u of s){if(u==="data: [DONE]")return;if(u.startsWith("data: ")){let g=u.substring(6);try{let C=JSON.parse(g),y=xt.safeParse(C);if(y.success){let f={partialMessages:[]},b=y.data;if(b.choices.length>0){let v=b.choices[0].delta;if(v!==void 0&&Object.keys(v).length!==0){if("content"in v&&v.content!==null)f.partialMessages.push(oe(E,v.content));else if("refusal"in v&&v.refusal!==null)f.partialMessages.push(oe(E,v.refusal));else if("tool_calls"in v&&v.tool_calls!==void 0){let w=v.tool_calls.at(0);f.partialMessages.push(Fe(E,w.index,w.id,(p=w.function)==null?void 0:p.name,(d=w.function)==null?void 0:d.arguments));}}}b.usage&&(f.usage={promptTokens:b.usage.prompt_tokens,completionTokens:b.usage.completion_tokens,totalTokens:b.usage.total_tokens}),yield {partialResponse:f,buffer:r};}else throw new N({info:"Invalid response from model",cause:y.error})}catch(C){throw new N({info:`Malformed JSON received in stream: ${g}`,cause:C})}}}yield {partialResponse:{partialMessages:[]},buffer:r};})}transformProxyStreamChatResponseChunk(t,n,a,s,r){return K(this,null,function*(){yield*Ee(this.transformStreamChatResponseChunk(t,n));})}getProxyStreamChatUrl(t,n,a){return x(this,null,function*(){return new Promise(s=>{s(this.streamChatUrl);})})}getProxyCompleteChatUrl(t,n,a){return x(this,null,function*(){return new Promise(s=>{s(this.completeChatUrl);})})}getProxyCompleteChatHeaders(t,n,a){return x(this,null,function*(){if(!n)return {};let s=R({},n);return delete s.host,delete s["content-length"],s})}getProxyStreamChatHeaders(t,n,a){return x(this,null,function*(){return yield this.getProxyCompleteChatHeaders(t,n,a)})}};var Te=gt(Ct,vt).parse({name:"__base__",description:"Base chat model for Open Router",maxInputTokens:128e3,maxOutputTokens:128e3,roles:Tt,modalities:Rt,config:{def:Ce.base(128e3,4).def,schema:Ce.base(128e3,4).schema}});
5
+ var Nn=Object.defineProperty;var xe=Object.getOwnPropertySymbols;var Un=Object.prototype.hasOwnProperty,Dn=Object.prototype.propertyIsEnumerable;var $=(o,n)=>(n=Symbol[o])?n:Symbol.for("Symbol."+o),wn=o=>{throw TypeError(o)};var Se=(o,n,i)=>n in o?Nn(o,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[n]=i,f=(o,n)=>{for(var i in n||(n={}))Un.call(n,i)&&Se(o,i,n[i]);if(xe)for(var i of xe(n))Dn.call(n,i)&&Se(o,i,n[i]);return o};var S=(o,n,i)=>new Promise((t,r)=>{var a=p=>{try{m(i.next(p));}catch(d){r(d);}},u=p=>{try{m(i.throw(p));}catch(d){r(d);}},m=p=>p.done?t(p.value):Promise.resolve(p.value).then(a,u);m((i=i.apply(o,n)).next());}),ve=function(o,n){this[0]=o,this[1]=n;},G=(o,n,i)=>{var t=(u,m,p,d)=>{try{var g=i[u](m),T=(m=g.value)instanceof ve,k=g.done;Promise.resolve(T?m[0]:m).then(b=>T?t(u==="return"?u:"next",m[1]?{done:b.done,value:b.value}:b,p,d):p({value:b,done:k})).catch(b=>t("throw",b,p,d));}catch(b){d(b);}},r=u=>a[u]=m=>new Promise((p,d)=>t(u,m,p,d)),a={};return i=i.apply(o,n),a[$("asyncIterator")]=()=>a,r("next"),r("throw"),r("return"),a},Ce=o=>{var n=o[$("asyncIterator")],i=!1,t,r={};return n==null?(n=o[$("iterator")](),t=a=>r[a]=u=>n[a](u)):(n=n.call(o),t=a=>r[a]=u=>{if(i){if(i=!1,a==="throw")throw u;return u}return i=!0,{done:!1,value:new ve(new Promise(m=>{var p=n[a](u);p instanceof Object||wn("Object expected"),m(p);}),1)}}),r[$("iterator")]=()=>r,t("next"),"throw"in n?t("throw"):r.throw=a=>{throw a},"return"in n&&t("return"),r};var O="system",E="user",v="assistant",_="tool",qn=[O,E,v,_],Y=zod.z.enum(qn),On=[v],En=zod.z.enum(On),N="image",J="base64",_n=["png","jpeg","webp","gif"],jn=zod.z.object({type:zod.z.literal(J),base64:zod.z.string(),media_type:zod.z.enum(_n)}),W="url",In=zod.z.object({type:zod.z.literal(W),url:zod.z.string()}),Ln=zod.z.discriminatedUnion("type",[jn,In]),$n=["low","medium","high","auto"],An=zod.z.enum($n),Bn=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(N),detail:An,value:Ln,metadata:o}),we="reasoning",qe="partial-reasoning",Oe="thinking",zn="redacted",K=zod.z.object({type:zod.z.literal(Oe),thinking:zod.z.string(),signature:zod.z.string()}),Ee=zod.z.object({type:zod.z.literal(zn),data:zod.z.string()}),Fn=zod.z.discriminatedUnion("type",[K,Ee]),Hn=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(we),value:Fn,metadata:o}),Gn=zod.z.object({type:zod.z.literal(Oe),thinking:K.shape.thinking.optional(),signature:K.shape.signature.optional()}),Vn=zod.z.discriminatedUnion("type",[Gn,Ee]),Kn=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(qe),value:Vn,metadata:o}),h="text",_e=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(h),value:zod.z.string(),metadata:o}),Z="partial-text",je=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(Z),value:zod.z.string(),metadata:o}),C="tool-call",Ie=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(C),index:zod.z.number().int().nonnegative(),id:zod.z.string().min(1),name:zod.z.string().min(1),arguments:zod.z.string(),metadata:o}),X="partial-tool-call",Le=(o=zod.z.undefined())=>zod.z.object({modality:zod.z.literal(X),index:zod.z.number().int().nonnegative(),id:zod.z.string().optional(),name:zod.z.string().optional(),arguments:zod.z.string().optional(),metadata:o}),U="tool-response",Yn=(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),data:zod.z.string(),metadata:o}),Jn=[h,N,C,U,we],$e=zod.z.enum(Jn),Wn=(o=zod.z.undefined(),n=zod.z.undefined(),i=zod.z.undefined(),t=zod.z.undefined(),r=zod.z.undefined())=>zod.z.discriminatedUnion("modality",[_e(o),Bn(n),Ie(i),Yn(t),Hn(r)]),Zn=[Z,X,qe];zod.z.enum(Zn);var Xn=(o=zod.z.undefined(),n=zod.z.undefined(),i=zod.z.undefined())=>zod.z.discriminatedUnion("modality",[je(o),Le(n),Kn(i)]);var Q=(o=Y,n=zod.z.undefined(),i=zod.z.undefined(),t=zod.z.undefined(),r=zod.z.undefined(),a=zod.z.undefined(),u=zod.z.undefined())=>zod.z.object({role:o,content:zod.z.array(Wn(n,i,t,r,u)),metadata:a}),ee=(o=En,n=zod.z.undefined(),i=zod.z.undefined(),t=zod.z.undefined(),r=zod.z.undefined())=>zod.z.object({role:o,partialContent:Xn(n,i,t),metadata:r}),Qn=zod.z.object({promptTokens:zod.z.number().nonnegative(),completionTokens:zod.z.number().nonnegative(),totalTokens:zod.z.number().nonnegative()}),Ne=zod.z.object({token:zod.z.string(),logProb:zod.z.number(),bytes:zod.z.array(zod.z.number().int()).nullable()}),ei=Ne.extend({topLogProbs:zod.z.array(Ne)}),Ae=zod.z.array(ei);zod.z.object({messages:zod.z.array(Q()),usage:Qn.optional(),logProbs:Ae.optional()});var ni=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(ee()),usage:ni.optional(),logProbs:Ae.optional()});var Be=(o=zod.z.record(zod.z.string(),zod.z.any()).optional())=>o,ii=["object","array","number","string","boolean","enum"],Ue=zod.z.enum(ii),oi=zod.z.object({anyOf:zod.z.array(zod.z.any()).optional(),type:zod.z.union([Ue,zod.z.array(zod.z.union([Ue,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()}),ti=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(!1)});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:ti}).optional();var ri="text",ai="token",li=[ri,ai];zod.z.enum(li);zod.z.array(zod.z.string().min(1));zod.z.array(zod.z.array(zod.z.number().int().nonnegative()));var mi="float",ci=zod.z.object({index:zod.z.number().int().nonnegative(),embedding:zod.z.array(zod.z.number())}),ui="base64",pi=zod.z.object({index:zod.z.number().int().nonnegative(),embedding:zod.z.string().base64()}),De=zod.z.object({totalTokens:zod.z.number().int().nonnegative()});zod.z.discriminatedUnion("encodingFormat",[zod.z.object({encodingFormat:zod.z.literal(mi),embeddings:zod.z.array(ci),usage:De.optional()}),zod.z.object({encodingFormat:zod.z.literal(ui),embeddings:zod.z.array(pi),usage:De.optional()})]);var di=o=>{let n=new WeakSet;return JSON.stringify(o,(i,t)=>{if(typeof t=="object"&&t!==null){if(n.has(t))return;n.add(t);}return t})},gi=o=>o==null?"unknown error":typeof o=="string"?o:o instanceof Error?o.message:di(o),V="GatewayBaseError",w=class ze extends Error{constructor({info:n,cause:i},t){super(`[${t!=null?t:V}]: ${n}
6
+ Message: ${gi(i)}`),this.name=V,this.info=n,this.cause=i,this.name=t!=null?t:V,Object.setPrototypeOf(this,new.target.prototype);}static isGatewayBaseError(n){return n instanceof ze}toJSON(){return {name:this.name,info:this.info,cause:this.cause,message:this.message,stack:this.stack}}},Pi=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."),ki=zod.z.object({base:Pi.describe("Base (uncached, non\u2011reasoning) rates")}).describe("Holds the `ChatModelTokenPairPrice` for different categories (e.g., base) within a single pricing tier."),bi=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:ki.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(bi).min(1).describe("Pricing tiers (`ChatModelTokenRangePrice`) schedule, sorted by minTokens.")}).superRefine((o,n)=>{let{tokenRanges:i}=o;i[0].minTokens!==0&&n.addIssue({code:zod.z.ZodIssueCode.custom,path:["tokenRanges",0,"minTokens"],message:"The first tier must have minTokens = 0."});for(let r=1;r<i.length;r++){let a=i[r-1],u=i[r];if(a.maxTokens===null){n.addIssue({code:zod.z.ZodIssueCode.custom,path:["tokenRanges",r-1,"maxTokens"],message:"Cannot define any tokenRanges after an infinite tier (maxTokens = null)."});break}u.minTokens!==a.maxTokens&&n.addIssue({code:zod.z.ZodIssueCode.custom,path:["tokenRanges",r,"minTokens"],message:`Tier ${r} minTokens (${u.minTokens}) must equal previous tier's maxTokens (${a.maxTokens}) for contiguity.`}),u.minTokens<a.minTokens&&n.addIssue({code:zod.z.ZodIssueCode.custom,path:["tokenRanges",r,"minTokens"],message:`tokenRanges must be sorted by ascending minTokens. Tier ${r} (${u.minTokens}) starts before Tier ${r-1} (${a.minTokens}).`});}let t=i[i.length-1];i.every(r=>r.maxTokens!==null||r===t)&&t.maxTokens!==null&&n.addIssue({code:zod.z.ZodIssueCode.custom,path:["tokenRanges",i.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 yi="function";var Ti=zod.z.enum(["object","array","number","string","boolean","null"]),hi=zod.z.object({anyOf:zod.z.array(zod.z.any()).optional(),type:Ti.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(hi).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 Mi=zod.z.enum(["function"]),Ri=zod.z.object({type:Mi,definition:zod.z.object({schema:fi})}),xi=[yi];zod.z.enum(xi);var Fe=(o=zod.z.undefined())=>zod.z.discriminatedUnion("type",[Ri.extend({metadata:o})]),ne=o=>_e().parse({modality:h,value:o}),He=(o,n,i,t)=>Ie().parse({modality:C,index:o,id:n,name:i,arguments:t});var ie=(o,n)=>ee().parse({role:o,partialContent:je().parse({modality:Z,value:n})}),Ge=(o,n,i,t,r)=>ee().parse({role:o,partialContent:Le().parse({modality:X,index:n,id:i,name:t,arguments:r})});var Si=Object.defineProperty,Ve=Object.getOwnPropertySymbols,vi=Object.prototype.hasOwnProperty,Ci=Object.prototype.propertyIsEnumerable,Ke=(o,n,i)=>n in o?Si(o,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[n]=i,A=(o,n)=>{for(var i in n||(n={}))vi.call(n,i)&&Ke(o,i,n[i]);if(Ve)for(var i of Ve(n))Ci.call(n,i)&&Ke(o,i,n[i]);return o},Ye="ProviderError",en=class nn extends w{constructor({info:n,cause:i}){super({info:n,cause:i},Ye),this.name=Ye,this.info=n,this.cause=i;}static isProviderError(n){return n instanceof nn}};var Je="ModelResponseError",j=class on extends w{constructor({info:n,cause:i}){super({info:n,cause:i},Je),this.name=Je,this.cause=i,this.info=n;}static isModelResponseError(n){return n instanceof on}},We="InvalidModelRequestError",B=class tn extends w{constructor({info:n,cause:i}){super({info:n,cause:i},We),this.name=We,this.cause=i,this.info=n,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidModelRequestError(n){return n instanceof tn}},Ze="InvalidConfigError",q=class rn extends w{constructor({info:n,cause:i}){super({info:n,cause:i},Ze),this.name=Ze,this.cause=i,this.info=n,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidConfigError(n){return n instanceof rn}},Xe="InvalidMessagesError",R=class an extends w{constructor({info:n,cause:i}){super({info:n,cause:i},Xe),this.name=Xe,this.cause=i,this.info=n,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidMessagesError(n){return n instanceof an}},Qe="InvalidToolsError",oe=class ln extends w{constructor({info:n,cause:i}){super({info:n,cause:i},Qe),this.name=Qe,this.cause=i,this.info=n,Object.setPrototypeOf(this,new.target.prototype);}static isInvalidToolsError(n){return n instanceof ln}};var te="multi-string",sn=zod.z.object({type:zod.z.literal(te),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()}),Ni=o=>zod.z.array(zod.z.string()).max(o).default([]).optional(),mn=o=>({def:sn.parse(A({type:te},o)),schema:Ni(o.max)}),cn="object-schema",Ui=zod.z.object({type:zod.z.literal(cn),param:zod.z.string().min(1),title:zod.z.string().min(1),description:zod.z.string().min(1).max(500),objectSchema:zod.z.any()});var re="range",un=zod.z.object({type:zod.z.literal(re),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()}),Di=(o,n,i,t)=>zod.z.number().min(o).max(n).step(i).default(t).optional(),x=o=>({def:un.parse(A({type:re},o)),schema:Di(o.min,o.max,o.step,o.default)}),ae="select-boolean",pn=zod.z.object({type:zod.z.literal(ae),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(),dn=o=>({def:pn.parse(A({type:ae},o)),schema:wi(o.default)}),le="select-string",gn=zod.z.object({type:zod.z.literal(le),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,n)=>zod.z.enum(n).nullable().default(o).optional(),se=o=>({def:gn.parse(A({type:le},o)),schema:qi(o.default,o.choices)}),Oi=[re,te,le,cn,ae];zod.z.enum(Oi);var Ei=zod.z.discriminatedUnion("type",[un,sn,gn,pn,Ui]),Pn=(o=Y,n=$e)=>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(n).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(i=>{var t,r;let a=Object.keys(i.def),u=Object.keys((r=(t=i.schema)==null?void 0:t.shape)!=null?r:{});return a.every(m=>u.includes(m))&&u.every(m=>a.includes(m))},{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 _i={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."},ji={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."},Ii={type:"range",title:"Max reasoning tokens",description:"Specify the total tokens for reasoning, where one token approximates four English characters."},Li=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.`}),$i={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."},Ai={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."},Bi={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."},zi={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."},Gi={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."},Vi={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."},Ki={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."},Yi={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."},Ji={type:"boolean",title:"Echo",description:"If true, the response will contain the prompt."},Wi={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."},Zi={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."},Xi={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."},P={TEMPERATURE:_i,MAX_TOKENS:ji,STOP:Li,TOP_A:$i,TOP_P:Ai,TOP_K:Bi,MIN_P:zi,FREQUENCY_PENALTY:Fi,PRESENCE_PENALTY:Hi,REPETITION_PENALTY:Vi,SEED:Gi,LOG_PROBS:Ki,TOP_LOG_PROBS:Yi,ECHO:Ji,RESPONSE_FORMAT:Wi,RESPONSE_FORMAT_WITH_SCHEMA:Zi,RESPONSE_SCHEMA:Xi,MAX_REASONING_TOKENS:Ii};var kn=o=>Object.fromEntries(Object.entries(o).filter(([n,i])=>i!=null));var bn=o=>o.split(";")[0].split("/")[1],z=o=>o==null?void 0:o.replace(/\/$/,"");var me=x({param:"temperature",title:P.TEMPERATURE.title,description:P.TEMPERATURE.description,min:0,max:2,step:.01,default:1}),ce=o=>x({param:"max_tokens",title:P.MAX_TOKENS.title,description:P.MAX_TOKENS.description,min:0,max:o,step:1,default:0}),ue=o=>mn({param:"stop",title:P.STOP(o).title,description:P.STOP(o).description,max:o}),$o=x({param:"top_a",title:P.TOP_A.title,description:P.TOP_A.description,min:0,max:1,step:.01,default:0}),Ao=x({param:"top_k",title:P.TOP_K.title,description:P.TOP_K.description,min:0,max:100,step:1,default:0}),pe=x({param:"top_p",title:P.TOP_P.title,description:P.TOP_P.description,min:0,max:1,step:.01,default:1}),Bo=x({param:"min_p",title:P.MIN_P.title,description:P.MIN_P.description,min:0,max:1,step:.01,default:0}),de=x({param:"frequency_penalty",title:P.FREQUENCY_PENALTY.title,description:P.FREQUENCY_PENALTY.description,min:-2,max:2,step:.01,default:0}),ge=x({param:"presence_penalty",title:P.PRESENCE_PENALTY.title,description:P.PRESENCE_PENALTY.description,min:-2,max:2,step:.01,default:0}),zo=x({param:"repetition_penalty",title:P.REPETITION_PENALTY.title,description:P.REPETITION_PENALTY.description,min:0,max:2,step:.01,default:0}),Pe=x({param:"seed",title:P.SEED.title,description:P.SEED.description,min:0,max:1e6,step:1,default:0}),ke=dn({param:"logprobs",title:P.LOG_PROBS.title,description:P.LOG_PROBS.description,default:!1}),be=x({param:"top_logprobs",title:P.TOP_LOG_PROBS.title,description:P.TOP_LOG_PROBS.description,min:0,max:20,step:1,default:0}),ye=se({param:"tool_choice",title:"Tool choice",description:"Controls which (if any) tool is called by the model. 'none' means the model will not call a function. 'auto' means the model can pick between generating a message or calling a tool.",default:"auto",choices:["auto","required","none"]}),Fo=se({param:"response_format",title:P.RESPONSE_FORMAT.title,description:P.RESPONSE_FORMAT.description,default:"text",choices:["text","json_object"]});var yn=(o,n)=>zod.z.object({temperature:me.schema,maxTokens:ce(o).schema,stop:ue(n).schema,topP:pe.schema,frequencyPenalty:de.schema,presencePenalty:ge.schema,seed:Pe.schema.transform(i=>i===0?void 0:i),logProbs:ke.schema,topLogProbs:be.schema,toolChoice:ye.schema}),Tn=(o,n)=>({temperature:me.def,maxTokens:ce(o).def,stop:ue(n).def,topP:pe.def,frequencyPenalty:de.def,presencePenalty:ge.def,seed:Pe.def,logProbs:ke.def,topLogProbs:be.def,toolChoice:ye.def});var Te={base:(o,n)=>({def:Tn(o,n),schema:yn(o,n)})};var eo="open-router",I=class{constructor(){this.version="v1";this.name=eo;this.embeddingModelFactories={};}chatModelLiterals(){return ["__base__"]}chatModelSchemas(){return {__base__:he}}chatModel(n){let i=F,t=fe.parse(n);return new i(he,t)}embeddingModelLiterals(){return Object.keys(this.embeddingModelFactories)}embeddingModelSchemas(){return Object.keys(this.embeddingModelFactories).reduce((n,i)=>(n[i]=this.embeddingModelFactories[i].modelSchema,n),{})}embeddingModel(n){throw new en({info:"Open Router does not support embedding models yet",cause:new Error("Open Router does not support embedding models yet")})}};I.baseUrl="https://openrouter.ai/api/v1";var Me={"microsoft/mai-ds-r1:free":{modelName:"microsoft/mai-ds-r1:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"google/gemini-2.5-pro-preview-03-25":{modelName:"google/gemini-2.5-pro-preview-03-25",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1.25,outputPricePerMillion:10}}}]},"thudm/glm-z1-32b:free":{modelName:"thudm/glm-z1-32b:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"thudm/glm-4-32b:free":{modelName:"thudm/glm-4-32b:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"google/gemini-2.5-flash-preview":{modelName:"google/gemini-2.5-flash-preview",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.15,outputPricePerMillion:.6}}}]},"google/gemini-2.5-flash-preview:thinking":{modelName:"google/gemini-2.5-flash-preview:thinking",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.15,outputPricePerMillion:3.5}}}]},"openai/o4-mini-high":{modelName:"openai/o4-mini-high",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1.1,outputPricePerMillion:4.4}}}]},"openai/o3":{modelName:"openai/o3",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:10,outputPricePerMillion:40}}}]},"openai/o4-mini":{modelName:"openai/o4-mini",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1.1,outputPricePerMillion:4.4}}}]},"shisa-ai/shisa-v2-llama3.3-70b:free":{modelName:"shisa-ai/shisa-v2-llama3.3-70b:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"qwen/qwen2.5-coder-7b-instruct":{modelName:"qwen/qwen2.5-coder-7b-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.19999999999999998,outputPricePerMillion:.19999999999999998}}}]},"openai/gpt-4.1":{modelName:"openai/gpt-4.1",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:2,outputPricePerMillion:8}}}]},"openai/gpt-4.1-mini":{modelName:"openai/gpt-4.1-mini",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.39999999999999997,outputPricePerMillion:1.5999999999999999}}}]},"openai/gpt-4.1-nano":{modelName:"openai/gpt-4.1-nano",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.09999999999999999,outputPricePerMillion:.39999999999999997}}}]},"eleutherai/llemma_7b":{modelName:"eleutherai/llemma_7b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.7999999999999999,outputPricePerMillion:1.2}}}]},"alfredpros/codellama-7b-instruct-solidity":{modelName:"alfredpros/codellama-7b-instruct-solidity",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.7999999999999999,outputPricePerMillion:1.2}}}]},"arliai/qwq-32b-arliai-rpr-v1:free":{modelName:"arliai/qwq-32b-arliai-rpr-v1:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"agentica-org/deepcoder-14b-preview:free":{modelName:"agentica-org/deepcoder-14b-preview:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"moonshotai/kimi-vl-a3b-thinking:free":{modelName:"moonshotai/kimi-vl-a3b-thinking:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"x-ai/grok-3-mini-beta":{modelName:"x-ai/grok-3-mini-beta",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.3,outputPricePerMillion:.5}}}]},"x-ai/grok-3-beta":{modelName:"x-ai/grok-3-beta",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:15}}}]},"nvidia/llama-3.1-nemotron-nano-8b-v1:free":{modelName:"nvidia/llama-3.1-nemotron-nano-8b-v1:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"nvidia/llama-3.3-nemotron-super-49b-v1:free":{modelName:"nvidia/llama-3.3-nemotron-super-49b-v1:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"nvidia/llama-3.1-nemotron-ultra-253b-v1:free":{modelName:"nvidia/llama-3.1-nemotron-ultra-253b-v1:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"meta-llama/llama-4-maverick:free":{modelName:"meta-llama/llama-4-maverick:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"meta-llama/llama-4-maverick":{modelName:"meta-llama/llama-4-maverick",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.16999999999999998,outputPricePerMillion:.6}}}]},"meta-llama/llama-4-scout:free":{modelName:"meta-llama/llama-4-scout:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"meta-llama/llama-4-scout":{modelName:"meta-llama/llama-4-scout",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.08,outputPricePerMillion:.3}}}]},"all-hands/openhands-lm-32b-v0.1":{modelName:"all-hands/openhands-lm-32b-v0.1",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:2.6,outputPricePerMillion:3.4}}}]},"mistral/ministral-8b":{modelName:"mistral/ministral-8b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.09999999999999999,outputPricePerMillion:.09999999999999999}}}]},"deepseek/deepseek-v3-base:free":{modelName:"deepseek/deepseek-v3-base:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"scb10x/llama3.1-typhoon2-8b-instruct":{modelName:"scb10x/llama3.1-typhoon2-8b-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.18,outputPricePerMillion:.18}}}]},"scb10x/llama3.1-typhoon2-70b-instruct":{modelName:"scb10x/llama3.1-typhoon2-70b-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.88,outputPricePerMillion:.88}}}]},"allenai/molmo-7b-d:free":{modelName:"allenai/molmo-7b-d:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"bytedance-research/ui-tars-72b:free":{modelName:"bytedance-research/ui-tars-72b:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"qwen/qwen2.5-vl-3b-instruct:free":{modelName:"qwen/qwen2.5-vl-3b-instruct:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"google/gemini-2.5-pro-exp-03-25:free":{modelName:"google/gemini-2.5-pro-exp-03-25:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"qwen/qwen2.5-vl-32b-instruct:free":{modelName:"qwen/qwen2.5-vl-32b-instruct:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"qwen/qwen2.5-vl-32b-instruct":{modelName:"qwen/qwen2.5-vl-32b-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.8999999999999999,outputPricePerMillion:.8999999999999999}}}]},"deepseek/deepseek-chat-v3-0324:free":{modelName:"deepseek/deepseek-chat-v3-0324:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"deepseek/deepseek-chat-v3-0324":{modelName:"deepseek/deepseek-chat-v3-0324",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.27,outputPricePerMillion:1.1}}}]},"featherless/qwerky-72b:free":{modelName:"featherless/qwerky-72b:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"openai/o1-pro":{modelName:"openai/o1-pro",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:150,outputPricePerMillion:600}}}]},"mistralai/mistral-small-3.1-24b-instruct:free":{modelName:"mistralai/mistral-small-3.1-24b-instruct:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"mistralai/mistral-small-3.1-24b-instruct":{modelName:"mistralai/mistral-small-3.1-24b-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.09999999999999999,outputPricePerMillion:.3}}}]},"open-r1/olympiccoder-32b:free":{modelName:"open-r1/olympiccoder-32b:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"steelskull/l3.3-electra-r1-70b":{modelName:"steelskull/l3.3-electra-r1-70b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.7,outputPricePerMillion:.95}}}]},"google/gemma-3-1b-it:free":{modelName:"google/gemma-3-1b-it:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"google/gemma-3-4b-it:free":{modelName:"google/gemma-3-4b-it:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"google/gemma-3-4b-it":{modelName:"google/gemma-3-4b-it",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.02,outputPricePerMillion:.04}}}]},"ai21/jamba-1.6-large":{modelName:"ai21/jamba-1.6-large",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:2,outputPricePerMillion:8}}}]},"ai21/jamba-1.6-mini":{modelName:"ai21/jamba-1.6-mini",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.19999999999999998,outputPricePerMillion:.39999999999999997}}}]},"google/gemma-3-12b-it:free":{modelName:"google/gemma-3-12b-it:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"google/gemma-3-12b-it":{modelName:"google/gemma-3-12b-it",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.049999999999999996,outputPricePerMillion:.09999999999999999}}}]},"cohere/command-a":{modelName:"cohere/command-a",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:2.5,outputPricePerMillion:10}}}]},"openai/gpt-4o-mini-search-preview":{modelName:"openai/gpt-4o-mini-search-preview",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.15,outputPricePerMillion:.6}}}]},"openai/gpt-4o-search-preview":{modelName:"openai/gpt-4o-search-preview",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:2.5,outputPricePerMillion:10}}}]},"rekaai/reka-flash-3:free":{modelName:"rekaai/reka-flash-3:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"google/gemma-3-27b-it:free":{modelName:"google/gemma-3-27b-it:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"google/gemma-3-27b-it":{modelName:"google/gemma-3-27b-it",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.09999999999999999,outputPricePerMillion:.19999999999999998}}}]},"thedrummer/anubis-pro-105b-v1":{modelName:"thedrummer/anubis-pro-105b-v1",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.7999999999999999,outputPricePerMillion:1}}}]},"latitudegames/wayfarer-large-70b-llama-3.3":{modelName:"latitudegames/wayfarer-large-70b-llama-3.3",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.7999999999999999,outputPricePerMillion:.8999999999999999}}}]},"thedrummer/skyfall-36b-v2":{modelName:"thedrummer/skyfall-36b-v2",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:.7999999999999999}}}]},"microsoft/phi-4-multimodal-instruct":{modelName:"microsoft/phi-4-multimodal-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.049999999999999996,outputPricePerMillion:.09999999999999999}}}]},"perplexity/sonar-reasoning-pro":{modelName:"perplexity/sonar-reasoning-pro",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:2,outputPricePerMillion:8}}}]},"perplexity/sonar-pro":{modelName:"perplexity/sonar-pro",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:15}}}]},"perplexity/sonar-deep-research":{modelName:"perplexity/sonar-deep-research",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:2,outputPricePerMillion:8}}}]},"deepseek/deepseek-r1-zero:free":{modelName:"deepseek/deepseek-r1-zero:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"qwen/qwq-32b:free":{modelName:"qwen/qwq-32b:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"qwen/qwq-32b":{modelName:"qwen/qwq-32b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.15,outputPricePerMillion:.19999999999999998}}}]},"moonshotai/moonlight-16b-a3b-instruct:free":{modelName:"moonshotai/moonlight-16b-a3b-instruct:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"nousresearch/deephermes-3-llama-3-8b-preview:free":{modelName:"nousresearch/deephermes-3-llama-3-8b-preview:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"openai/gpt-4.5-preview":{modelName:"openai/gpt-4.5-preview",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:75,outputPricePerMillion:150}}}]},"google/gemini-2.0-flash-lite-001":{modelName:"google/gemini-2.0-flash-lite-001",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.075,outputPricePerMillion:.3}}}]},"anthropic/claude-3.7-sonnet":{modelName:"anthropic/claude-3.7-sonnet",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:15}}}]},"anthropic/claude-3.7-sonnet:thinking":{modelName:"anthropic/claude-3.7-sonnet:thinking",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:15}}}]},"anthropic/claude-3.7-sonnet:beta":{modelName:"anthropic/claude-3.7-sonnet:beta",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:15}}}]},"perplexity/r1-1776":{modelName:"perplexity/r1-1776",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:2,outputPricePerMillion:8}}}]},"mistralai/mistral-saba":{modelName:"mistralai/mistral-saba",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.19999999999999998,outputPricePerMillion:.6}}}]},"cognitivecomputations/dolphin3.0-r1-mistral-24b:free":{modelName:"cognitivecomputations/dolphin3.0-r1-mistral-24b:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"cognitivecomputations/dolphin3.0-mistral-24b:free":{modelName:"cognitivecomputations/dolphin3.0-mistral-24b:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"meta-llama/llama-guard-3-8b":{modelName:"meta-llama/llama-guard-3-8b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.055,outputPricePerMillion:.055}}}]},"openai/o3-mini-high":{modelName:"openai/o3-mini-high",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1.1,outputPricePerMillion:4.4}}}]},"deepseek/deepseek-r1-distill-llama-8b":{modelName:"deepseek/deepseek-r1-distill-llama-8b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.04,outputPricePerMillion:.04}}}]},"google/gemini-2.0-flash-001":{modelName:"google/gemini-2.0-flash-001",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.09999999999999999,outputPricePerMillion:.39999999999999997}}}]},"qwen/qwen-vl-plus":{modelName:"qwen/qwen-vl-plus",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.21,outputPricePerMillion:.63}}}]},"aion-labs/aion-1.0":{modelName:"aion-labs/aion-1.0",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:4,outputPricePerMillion:8}}}]},"aion-labs/aion-1.0-mini":{modelName:"aion-labs/aion-1.0-mini",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.7,outputPricePerMillion:1.4}}}]},"aion-labs/aion-rp-llama-3.1-8b":{modelName:"aion-labs/aion-rp-llama-3.1-8b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.19999999999999998,outputPricePerMillion:.19999999999999998}}}]},"qwen/qwen-vl-max":{modelName:"qwen/qwen-vl-max",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.7999999999999999,outputPricePerMillion:3.1999999999999997}}}]},"qwen/qwen-turbo":{modelName:"qwen/qwen-turbo",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.049999999999999996,outputPricePerMillion:.19999999999999998}}}]},"qwen/qwen2.5-vl-72b-instruct:free":{modelName:"qwen/qwen2.5-vl-72b-instruct:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"qwen/qwen2.5-vl-72b-instruct":{modelName:"qwen/qwen2.5-vl-72b-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.7,outputPricePerMillion:.7}}}]},"qwen/qwen-plus":{modelName:"qwen/qwen-plus",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.39999999999999997,outputPricePerMillion:1.2}}}]},"qwen/qwen-max":{modelName:"qwen/qwen-max",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1.5999999999999999,outputPricePerMillion:6.3999999999999995}}}]},"openai/o3-mini":{modelName:"openai/o3-mini",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1.1,outputPricePerMillion:4.4}}}]},"deepseek/deepseek-r1-distill-qwen-1.5b":{modelName:"deepseek/deepseek-r1-distill-qwen-1.5b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.18,outputPricePerMillion:.18}}}]},"mistralai/mistral-small-24b-instruct-2501:free":{modelName:"mistralai/mistral-small-24b-instruct-2501:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"mistralai/mistral-small-24b-instruct-2501":{modelName:"mistralai/mistral-small-24b-instruct-2501",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.07,outputPricePerMillion:.14}}}]},"deepseek/deepseek-r1-distill-qwen-32b:free":{modelName:"deepseek/deepseek-r1-distill-qwen-32b:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"deepseek/deepseek-r1-distill-qwen-32b":{modelName:"deepseek/deepseek-r1-distill-qwen-32b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.12,outputPricePerMillion:.18}}}]},"deepseek/deepseek-r1-distill-qwen-14b:free":{modelName:"deepseek/deepseek-r1-distill-qwen-14b:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"deepseek/deepseek-r1-distill-qwen-14b":{modelName:"deepseek/deepseek-r1-distill-qwen-14b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.15,outputPricePerMillion:.15}}}]},"perplexity/sonar-reasoning":{modelName:"perplexity/sonar-reasoning",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1,outputPricePerMillion:5}}}]},"perplexity/sonar":{modelName:"perplexity/sonar",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1,outputPricePerMillion:1}}}]},"liquid/lfm-7b":{modelName:"liquid/lfm-7b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.01,outputPricePerMillion:.01}}}]},"liquid/lfm-3b":{modelName:"liquid/lfm-3b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.02,outputPricePerMillion:.02}}}]},"deepseek/deepseek-r1-distill-llama-70b:free":{modelName:"deepseek/deepseek-r1-distill-llama-70b:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"deepseek/deepseek-r1-distill-llama-70b":{modelName:"deepseek/deepseek-r1-distill-llama-70b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.09999999999999999,outputPricePerMillion:.39999999999999997}}}]},"deepseek/deepseek-r1:free":{modelName:"deepseek/deepseek-r1:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"deepseek/deepseek-r1":{modelName:"deepseek/deepseek-r1",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:2.1799999999999997}}}]},"sophosympatheia/rogue-rose-103b-v0.2:free":{modelName:"sophosympatheia/rogue-rose-103b-v0.2:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"minimax/minimax-01":{modelName:"minimax/minimax-01",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.19999999999999998,outputPricePerMillion:1.1}}}]},"mistralai/codestral-2501":{modelName:"mistralai/codestral-2501",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.3,outputPricePerMillion:.8999999999999999}}}]},"microsoft/phi-4":{modelName:"microsoft/phi-4",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.07,outputPricePerMillion:.14}}}]},"deepseek/deepseek-chat:free":{modelName:"deepseek/deepseek-chat:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"deepseek/deepseek-chat":{modelName:"deepseek/deepseek-chat",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.38,outputPricePerMillion:.8899999999999999}}}]},"sao10k/l3.3-euryale-70b":{modelName:"sao10k/l3.3-euryale-70b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.7,outputPricePerMillion:.7999999999999999}}}]},"openai/o1":{modelName:"openai/o1",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:15,outputPricePerMillion:60}}}]},"eva-unit-01/eva-llama-3.33-70b":{modelName:"eva-unit-01/eva-llama-3.33-70b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:4,outputPricePerMillion:6}}}]},"x-ai/grok-2-vision-1212":{modelName:"x-ai/grok-2-vision-1212",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:2,outputPricePerMillion:10}}}]},"x-ai/grok-2-1212":{modelName:"x-ai/grok-2-1212",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:2,outputPricePerMillion:10}}}]},"cohere/command-r7b-12-2024":{modelName:"cohere/command-r7b-12-2024",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.0375,outputPricePerMillion:.15}}}]},"google/gemini-2.0-flash-exp:free":{modelName:"google/gemini-2.0-flash-exp:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"meta-llama/llama-3.3-70b-instruct:free":{modelName:"meta-llama/llama-3.3-70b-instruct:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"meta-llama/llama-3.3-70b-instruct":{modelName:"meta-llama/llama-3.3-70b-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.09999999999999999,outputPricePerMillion:.25}}}]},"amazon/nova-lite-v1":{modelName:"amazon/nova-lite-v1",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.06,outputPricePerMillion:.24}}}]},"amazon/nova-micro-v1":{modelName:"amazon/nova-micro-v1",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.035,outputPricePerMillion:.14}}}]},"amazon/nova-pro-v1":{modelName:"amazon/nova-pro-v1",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.7999999999999999,outputPricePerMillion:3.1999999999999997}}}]},"qwen/qwq-32b-preview:free":{modelName:"qwen/qwq-32b-preview:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"qwen/qwq-32b-preview":{modelName:"qwen/qwq-32b-preview",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.19999999999999998,outputPricePerMillion:.19999999999999998}}}]},"google/learnlm-1.5-pro-experimental:free":{modelName:"google/learnlm-1.5-pro-experimental:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"eva-unit-01/eva-qwen-2.5-72b":{modelName:"eva-unit-01/eva-qwen-2.5-72b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.8999999999999999,outputPricePerMillion:1.2}}}]},"openai/gpt-4o-2024-11-20":{modelName:"openai/gpt-4o-2024-11-20",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:2.5,outputPricePerMillion:10}}}]},"mistralai/mistral-large-2411":{modelName:"mistralai/mistral-large-2411",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:2,outputPricePerMillion:6}}}]},"mistralai/mistral-large-2407":{modelName:"mistralai/mistral-large-2407",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:2,outputPricePerMillion:6}}}]},"mistralai/pixtral-large-2411":{modelName:"mistralai/pixtral-large-2411",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:2,outputPricePerMillion:6}}}]},"x-ai/grok-vision-beta":{modelName:"x-ai/grok-vision-beta",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:5,outputPricePerMillion:15}}}]},"infermatic/mn-inferor-12b":{modelName:"infermatic/mn-inferor-12b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.7999999999999999,outputPricePerMillion:1.2}}}]},"qwen/qwen-2.5-coder-32b-instruct:free":{modelName:"qwen/qwen-2.5-coder-32b-instruct:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"qwen/qwen-2.5-coder-32b-instruct":{modelName:"qwen/qwen-2.5-coder-32b-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.07,outputPricePerMillion:.15}}}]},"raifle/sorcererlm-8x22b":{modelName:"raifle/sorcererlm-8x22b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:4.5,outputPricePerMillion:4.5}}}]},"eva-unit-01/eva-qwen-2.5-32b":{modelName:"eva-unit-01/eva-qwen-2.5-32b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:2.6,outputPricePerMillion:3.4}}}]},"thedrummer/unslopnemo-12b":{modelName:"thedrummer/unslopnemo-12b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:.5}}}]},"anthropic/claude-3.5-haiku:beta":{modelName:"anthropic/claude-3.5-haiku:beta",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.7999999999999999,outputPricePerMillion:4}}}]},"anthropic/claude-3.5-haiku":{modelName:"anthropic/claude-3.5-haiku",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.7999999999999999,outputPricePerMillion:4}}}]},"anthropic/claude-3.5-haiku-20241022:beta":{modelName:"anthropic/claude-3.5-haiku-20241022:beta",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.7999999999999999,outputPricePerMillion:4}}}]},"anthropic/claude-3.5-haiku-20241022":{modelName:"anthropic/claude-3.5-haiku-20241022",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.7999999999999999,outputPricePerMillion:4}}}]},"neversleep/llama-3.1-lumimaid-70b":{modelName:"neversleep/llama-3.1-lumimaid-70b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1.5,outputPricePerMillion:2.25}}}]},"anthracite-org/magnum-v4-72b":{modelName:"anthracite-org/magnum-v4-72b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1.5,outputPricePerMillion:2.25}}}]},"anthropic/claude-3.5-sonnet:beta":{modelName:"anthropic/claude-3.5-sonnet:beta",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:15}}}]},"anthropic/claude-3.5-sonnet":{modelName:"anthropic/claude-3.5-sonnet",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:15}}}]},"x-ai/grok-beta":{modelName:"x-ai/grok-beta",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:5,outputPricePerMillion:15}}}]},"mistralai/ministral-8b":{modelName:"mistralai/ministral-8b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.09999999999999999,outputPricePerMillion:.09999999999999999}}}]},"mistralai/ministral-3b":{modelName:"mistralai/ministral-3b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.04,outputPricePerMillion:.04}}}]},"qwen/qwen-2.5-7b-instruct:free":{modelName:"qwen/qwen-2.5-7b-instruct:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"qwen/qwen-2.5-7b-instruct":{modelName:"qwen/qwen-2.5-7b-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.049999999999999996,outputPricePerMillion:.09999999999999999}}}]},"nvidia/llama-3.1-nemotron-70b-instruct:free":{modelName:"nvidia/llama-3.1-nemotron-70b-instruct:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"nvidia/llama-3.1-nemotron-70b-instruct":{modelName:"nvidia/llama-3.1-nemotron-70b-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.12,outputPricePerMillion:.3}}}]},"inflection/inflection-3-productivity":{modelName:"inflection/inflection-3-productivity",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:2.5,outputPricePerMillion:10}}}]},"inflection/inflection-3-pi":{modelName:"inflection/inflection-3-pi",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:2.5,outputPricePerMillion:10}}}]},"google/gemini-flash-1.5-8b":{modelName:"google/gemini-flash-1.5-8b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.0375,outputPricePerMillion:.15}}}]},"thedrummer/rocinante-12b":{modelName:"thedrummer/rocinante-12b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.25,outputPricePerMillion:.5}}}]},"anthracite-org/magnum-v2-72b":{modelName:"anthracite-org/magnum-v2-72b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:3}}}]},"liquid/lfm-40b":{modelName:"liquid/lfm-40b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.15,outputPricePerMillion:.15}}}]},"meta-llama/llama-3.2-3b-instruct:free":{modelName:"meta-llama/llama-3.2-3b-instruct:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"meta-llama/llama-3.2-3b-instruct":{modelName:"meta-llama/llama-3.2-3b-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.015,outputPricePerMillion:.024999999999999998}}}]},"meta-llama/llama-3.2-1b-instruct:free":{modelName:"meta-llama/llama-3.2-1b-instruct:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"meta-llama/llama-3.2-1b-instruct":{modelName:"meta-llama/llama-3.2-1b-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.01,outputPricePerMillion:.01}}}]},"meta-llama/llama-3.2-90b-vision-instruct":{modelName:"meta-llama/llama-3.2-90b-vision-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.8999999999999999,outputPricePerMillion:.8999999999999999}}}]},"meta-llama/llama-3.2-11b-vision-instruct:free":{modelName:"meta-llama/llama-3.2-11b-vision-instruct:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"meta-llama/llama-3.2-11b-vision-instruct":{modelName:"meta-llama/llama-3.2-11b-vision-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.049,outputPricePerMillion:.049}}}]},"qwen/qwen-2.5-72b-instruct:free":{modelName:"qwen/qwen-2.5-72b-instruct:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"qwen/qwen-2.5-72b-instruct":{modelName:"qwen/qwen-2.5-72b-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.12,outputPricePerMillion:.39}}}]},"qwen/qwen-2.5-vl-72b-instruct":{modelName:"qwen/qwen-2.5-vl-72b-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.6,outputPricePerMillion:.6}}}]},"neversleep/llama-3.1-lumimaid-8b":{modelName:"neversleep/llama-3.1-lumimaid-8b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.09375,outputPricePerMillion:.75}}}]},"openai/o1-preview":{modelName:"openai/o1-preview",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:15,outputPricePerMillion:60}}}]},"openai/o1-preview-2024-09-12":{modelName:"openai/o1-preview-2024-09-12",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:15,outputPricePerMillion:60}}}]},"openai/o1-mini":{modelName:"openai/o1-mini",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1.1,outputPricePerMillion:4.4}}}]},"openai/o1-mini-2024-09-12":{modelName:"openai/o1-mini-2024-09-12",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1.1,outputPricePerMillion:4.4}}}]},"mistralai/pixtral-12b":{modelName:"mistralai/pixtral-12b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.09999999999999999,outputPricePerMillion:.09999999999999999}}}]},"cohere/command-r-plus-08-2024":{modelName:"cohere/command-r-plus-08-2024",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:2.5,outputPricePerMillion:10}}}]},"cohere/command-r-08-2024":{modelName:"cohere/command-r-08-2024",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.15,outputPricePerMillion:.6}}}]},"qwen/qwen-2.5-vl-7b-instruct:free":{modelName:"qwen/qwen-2.5-vl-7b-instruct:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"qwen/qwen-2.5-vl-7b-instruct":{modelName:"qwen/qwen-2.5-vl-7b-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.19999999999999998,outputPricePerMillion:.19999999999999998}}}]},"sao10k/l3.1-euryale-70b":{modelName:"sao10k/l3.1-euryale-70b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.7,outputPricePerMillion:.7999999999999999}}}]},"google/gemini-flash-1.5-8b-exp":{modelName:"google/gemini-flash-1.5-8b-exp",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"ai21/jamba-1-5-mini":{modelName:"ai21/jamba-1-5-mini",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.19999999999999998,outputPricePerMillion:.39999999999999997}}}]},"ai21/jamba-1-5-large":{modelName:"ai21/jamba-1-5-large",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:2,outputPricePerMillion:8}}}]},"microsoft/phi-3.5-mini-128k-instruct":{modelName:"microsoft/phi-3.5-mini-128k-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.09999999999999999,outputPricePerMillion:.09999999999999999}}}]},"nousresearch/hermes-3-llama-3.1-70b":{modelName:"nousresearch/hermes-3-llama-3.1-70b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.12,outputPricePerMillion:.3}}}]},"nousresearch/hermes-3-llama-3.1-405b":{modelName:"nousresearch/hermes-3-llama-3.1-405b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.7999999999999999,outputPricePerMillion:.7999999999999999}}}]},"openai/chatgpt-4o-latest":{modelName:"openai/chatgpt-4o-latest",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:5,outputPricePerMillion:15}}}]},"sao10k/l3-lunaris-8b":{modelName:"sao10k/l3-lunaris-8b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.02,outputPricePerMillion:.049999999999999996}}}]},"aetherwiing/mn-starcannon-12b":{modelName:"aetherwiing/mn-starcannon-12b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.7999999999999999,outputPricePerMillion:1.2}}}]},"openai/gpt-4o-2024-08-06":{modelName:"openai/gpt-4o-2024-08-06",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:2.5,outputPricePerMillion:10}}}]},"meta-llama/llama-3.1-405b:free":{modelName:"meta-llama/llama-3.1-405b:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"meta-llama/llama-3.1-405b":{modelName:"meta-llama/llama-3.1-405b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:2,outputPricePerMillion:2}}}]},"nothingiisreal/mn-celeste-12b":{modelName:"nothingiisreal/mn-celeste-12b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.7999999999999999,outputPricePerMillion:1.2}}}]},"perplexity/llama-3.1-sonar-small-128k-online":{modelName:"perplexity/llama-3.1-sonar-small-128k-online",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.19999999999999998,outputPricePerMillion:.19999999999999998}}}]},"perplexity/llama-3.1-sonar-large-128k-online":{modelName:"perplexity/llama-3.1-sonar-large-128k-online",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1,outputPricePerMillion:1}}}]},"meta-llama/llama-3.1-8b-instruct:free":{modelName:"meta-llama/llama-3.1-8b-instruct:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"meta-llama/llama-3.1-8b-instruct":{modelName:"meta-llama/llama-3.1-8b-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.02,outputPricePerMillion:.03}}}]},"meta-llama/llama-3.1-405b-instruct":{modelName:"meta-llama/llama-3.1-405b-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.7999999999999999,outputPricePerMillion:.7999999999999999}}}]},"meta-llama/llama-3.1-70b-instruct":{modelName:"meta-llama/llama-3.1-70b-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.09999999999999999,outputPricePerMillion:.28}}}]},"mistralai/codestral-mamba":{modelName:"mistralai/codestral-mamba",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.25,outputPricePerMillion:.25}}}]},"mistralai/mistral-nemo:free":{modelName:"mistralai/mistral-nemo:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"mistralai/mistral-nemo":{modelName:"mistralai/mistral-nemo",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.03,outputPricePerMillion:.07}}}]},"openai/gpt-4o-mini":{modelName:"openai/gpt-4o-mini",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.15,outputPricePerMillion:.6}}}]},"openai/gpt-4o-mini-2024-07-18":{modelName:"openai/gpt-4o-mini-2024-07-18",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.15,outputPricePerMillion:.6}}}]},"google/gemma-2-27b-it":{modelName:"google/gemma-2-27b-it",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.7999999999999999,outputPricePerMillion:.7999999999999999}}}]},"alpindale/magnum-72b":{modelName:"alpindale/magnum-72b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:4,outputPricePerMillion:6}}}]},"google/gemma-2-9b-it:free":{modelName:"google/gemma-2-9b-it:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"google/gemma-2-9b-it":{modelName:"google/gemma-2-9b-it",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.07,outputPricePerMillion:.07}}}]},"01-ai/yi-large":{modelName:"01-ai/yi-large",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:3}}}]},"ai21/jamba-instruct":{modelName:"ai21/jamba-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:.7}}}]},"anthropic/claude-3.5-sonnet-20240620:beta":{modelName:"anthropic/claude-3.5-sonnet-20240620:beta",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:15}}}]},"anthropic/claude-3.5-sonnet-20240620":{modelName:"anthropic/claude-3.5-sonnet-20240620",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:15}}}]},"sao10k/l3-euryale-70b":{modelName:"sao10k/l3-euryale-70b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1.48,outputPricePerMillion:1.48}}}]},"cognitivecomputations/dolphin-mixtral-8x22b":{modelName:"cognitivecomputations/dolphin-mixtral-8x22b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.8999999999999999,outputPricePerMillion:.8999999999999999}}}]},"qwen/qwen-2-72b-instruct":{modelName:"qwen/qwen-2-72b-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.8999999999999999,outputPricePerMillion:.8999999999999999}}}]},"mistralai/mistral-7b-instruct:free":{modelName:"mistralai/mistral-7b-instruct:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"mistralai/mistral-7b-instruct":{modelName:"mistralai/mistral-7b-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.029,outputPricePerMillion:.055}}}]},"mistralai/mistral-7b-instruct-v0.3":{modelName:"mistralai/mistral-7b-instruct-v0.3",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.029,outputPricePerMillion:.055}}}]},"nousresearch/hermes-2-pro-llama-3-8b":{modelName:"nousresearch/hermes-2-pro-llama-3-8b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.024999999999999998,outputPricePerMillion:.04}}}]},"microsoft/phi-3-mini-128k-instruct":{modelName:"microsoft/phi-3-mini-128k-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.09999999999999999,outputPricePerMillion:.09999999999999999}}}]},"microsoft/phi-3-medium-128k-instruct":{modelName:"microsoft/phi-3-medium-128k-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1,outputPricePerMillion:1}}}]},"neversleep/llama-3-lumimaid-70b":{modelName:"neversleep/llama-3-lumimaid-70b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:4,outputPricePerMillion:6}}}]},"google/gemini-flash-1.5":{modelName:"google/gemini-flash-1.5",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.075,outputPricePerMillion:.3}}}]},"openai/gpt-4o":{modelName:"openai/gpt-4o",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:2.5,outputPricePerMillion:10}}}]},"openai/gpt-4o:extended":{modelName:"openai/gpt-4o:extended",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:6,outputPricePerMillion:18}}}]},"meta-llama/llama-guard-2-8b":{modelName:"meta-llama/llama-guard-2-8b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.19999999999999998,outputPricePerMillion:.19999999999999998}}}]},"openai/gpt-4o-2024-05-13":{modelName:"openai/gpt-4o-2024-05-13",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:5,outputPricePerMillion:15}}}]},"neversleep/llama-3-lumimaid-8b:extended":{modelName:"neversleep/llama-3-lumimaid-8b:extended",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.09375,outputPricePerMillion:.75}}}]},"neversleep/llama-3-lumimaid-8b":{modelName:"neversleep/llama-3-lumimaid-8b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.09375,outputPricePerMillion:.75}}}]},"sao10k/fimbulvetr-11b-v2":{modelName:"sao10k/fimbulvetr-11b-v2",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.7999999999999999,outputPricePerMillion:1.2}}}]},"meta-llama/llama-3-8b-instruct":{modelName:"meta-llama/llama-3-8b-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.03,outputPricePerMillion:.06}}}]},"meta-llama/llama-3-70b-instruct":{modelName:"meta-llama/llama-3-70b-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.3,outputPricePerMillion:.39999999999999997}}}]},"mistralai/mixtral-8x22b-instruct":{modelName:"mistralai/mixtral-8x22b-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.8999999999999999,outputPricePerMillion:.8999999999999999}}}]},"microsoft/wizardlm-2-8x22b":{modelName:"microsoft/wizardlm-2-8x22b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:.5}}}]},"microsoft/wizardlm-2-7b":{modelName:"microsoft/wizardlm-2-7b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.07,outputPricePerMillion:.07}}}]},"google/gemini-pro-1.5":{modelName:"google/gemini-pro-1.5",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1.25,outputPricePerMillion:5}}}]},"openai/gpt-4-turbo":{modelName:"openai/gpt-4-turbo",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:10,outputPricePerMillion:30}}}]},"cohere/command-r-plus":{modelName:"cohere/command-r-plus",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:15}}}]},"cohere/command-r-plus-04-2024":{modelName:"cohere/command-r-plus-04-2024",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:15}}}]},"sophosympatheia/midnight-rose-70b":{modelName:"sophosympatheia/midnight-rose-70b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.7999999999999999,outputPricePerMillion:.7999999999999999}}}]},"cohere/command":{modelName:"cohere/command",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1,outputPricePerMillion:2}}}]},"cohere/command-r":{modelName:"cohere/command-r",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:1.5}}}]},"anthropic/claude-3-haiku:beta":{modelName:"anthropic/claude-3-haiku:beta",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.25,outputPricePerMillion:1.25}}}]},"anthropic/claude-3-haiku":{modelName:"anthropic/claude-3-haiku",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.25,outputPricePerMillion:1.25}}}]},"anthropic/claude-3-opus:beta":{modelName:"anthropic/claude-3-opus:beta",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:15,outputPricePerMillion:75}}}]},"anthropic/claude-3-opus":{modelName:"anthropic/claude-3-opus",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:15,outputPricePerMillion:75}}}]},"anthropic/claude-3-sonnet:beta":{modelName:"anthropic/claude-3-sonnet:beta",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:15}}}]},"anthropic/claude-3-sonnet":{modelName:"anthropic/claude-3-sonnet",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:15}}}]},"cohere/command-r-03-2024":{modelName:"cohere/command-r-03-2024",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:1.5}}}]},"mistralai/mistral-large":{modelName:"mistralai/mistral-large",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:2,outputPricePerMillion:6}}}]},"openai/gpt-3.5-turbo-0613":{modelName:"openai/gpt-3.5-turbo-0613",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1,outputPricePerMillion:2}}}]},"openai/gpt-4-turbo-preview":{modelName:"openai/gpt-4-turbo-preview",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:10,outputPricePerMillion:30}}}]},"nousresearch/nous-hermes-2-mixtral-8x7b-dpo":{modelName:"nousresearch/nous-hermes-2-mixtral-8x7b-dpo",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.6,outputPricePerMillion:.6}}}]},"mistralai/mistral-medium":{modelName:"mistralai/mistral-medium",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:2.75,outputPricePerMillion:8.1}}}]},"mistralai/mistral-small":{modelName:"mistralai/mistral-small",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.19999999999999998,outputPricePerMillion:.6}}}]},"mistralai/mistral-tiny":{modelName:"mistralai/mistral-tiny",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.25,outputPricePerMillion:.25}}}]},"mistralai/mistral-7b-instruct-v0.2":{modelName:"mistralai/mistral-7b-instruct-v0.2",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.19999999999999998,outputPricePerMillion:.19999999999999998}}}]},"cognitivecomputations/dolphin-mixtral-8x7b":{modelName:"cognitivecomputations/dolphin-mixtral-8x7b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:.5}}}]},"google/gemini-pro-vision":{modelName:"google/gemini-pro-vision",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:1.5}}}]},"mistralai/mixtral-8x7b-instruct":{modelName:"mistralai/mixtral-8x7b-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.24,outputPricePerMillion:.24}}}]},"openchat/openchat-7b":{modelName:"openchat/openchat-7b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.07,outputPricePerMillion:.07}}}]},"neversleep/noromaid-20b":{modelName:"neversleep/noromaid-20b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.75,outputPricePerMillion:1.5}}}]},"anthropic/claude-2.1:beta":{modelName:"anthropic/claude-2.1:beta",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:8,outputPricePerMillion:24}}}]},"anthropic/claude-2.1":{modelName:"anthropic/claude-2.1",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:8,outputPricePerMillion:24}}}]},"anthropic/claude-2:beta":{modelName:"anthropic/claude-2:beta",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:8,outputPricePerMillion:24}}}]},"anthropic/claude-2":{modelName:"anthropic/claude-2",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:8,outputPricePerMillion:24}}}]},"undi95/toppy-m-7b":{modelName:"undi95/toppy-m-7b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.07,outputPricePerMillion:.07}}}]},"alpindale/goliath-120b":{modelName:"alpindale/goliath-120b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:6.5625,outputPricePerMillion:9.375}}}]},"openrouter/auto":{modelName:"openrouter/auto",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:-1e6,outputPricePerMillion:-1e6}}}]},"openai/gpt-3.5-turbo-1106":{modelName:"openai/gpt-3.5-turbo-1106",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1,outputPricePerMillion:2}}}]},"openai/gpt-4-1106-preview":{modelName:"openai/gpt-4-1106-preview",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:10,outputPricePerMillion:30}}}]},"google/palm-2-chat-bison-32k":{modelName:"google/palm-2-chat-bison-32k",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1,outputPricePerMillion:2}}}]},"google/palm-2-codechat-bison-32k":{modelName:"google/palm-2-codechat-bison-32k",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1,outputPricePerMillion:2}}}]},"jondurbin/airoboros-l2-70b":{modelName:"jondurbin/airoboros-l2-70b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:.5}}}]},"openai/gpt-3.5-turbo-instruct":{modelName:"openai/gpt-3.5-turbo-instruct",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1.5,outputPricePerMillion:2}}}]},"mistralai/mistral-7b-instruct-v0.1":{modelName:"mistralai/mistral-7b-instruct-v0.1",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.19999999999999998,outputPricePerMillion:.19999999999999998}}}]},"pygmalionai/mythalion-13b":{modelName:"pygmalionai/mythalion-13b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5625,outputPricePerMillion:1.125}}}]},"openai/gpt-3.5-turbo-16k":{modelName:"openai/gpt-3.5-turbo-16k",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:3,outputPricePerMillion:4}}}]},"openai/gpt-4-32k":{modelName:"openai/gpt-4-32k",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:60,outputPricePerMillion:120}}}]},"openai/gpt-4-32k-0314":{modelName:"openai/gpt-4-32k-0314",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:60,outputPricePerMillion:120}}}]},"nousresearch/nous-hermes-llama2-13b":{modelName:"nousresearch/nous-hermes-llama2-13b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.18,outputPricePerMillion:.18}}}]},"mancer/weaver":{modelName:"mancer/weaver",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1.125,outputPricePerMillion:1.125}}}]},"huggingfaceh4/zephyr-7b-beta:free":{modelName:"huggingfaceh4/zephyr-7b-beta:free",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:0,outputPricePerMillion:0}}}]},"anthropic/claude-2.0:beta":{modelName:"anthropic/claude-2.0:beta",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:8,outputPricePerMillion:24}}}]},"anthropic/claude-2.0":{modelName:"anthropic/claude-2.0",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:8,outputPricePerMillion:24}}}]},"undi95/remm-slerp-l2-13b":{modelName:"undi95/remm-slerp-l2-13b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5625,outputPricePerMillion:1.125}}}]},"google/palm-2-chat-bison":{modelName:"google/palm-2-chat-bison",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1,outputPricePerMillion:2}}}]},"google/palm-2-codechat-bison":{modelName:"google/palm-2-codechat-bison",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:1,outputPricePerMillion:2}}}]},"gryphe/mythomax-l2-13b":{modelName:"gryphe/mythomax-l2-13b",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.065,outputPricePerMillion:.065}}}]},"meta-llama/llama-2-13b-chat":{modelName:"meta-llama/llama-2-13b-chat",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.22,outputPricePerMillion:.22}}}]},"meta-llama/llama-2-70b-chat":{modelName:"meta-llama/llama-2-70b-chat",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.8999999999999999,outputPricePerMillion:.8999999999999999}}}]},"openai/gpt-3.5-turbo":{modelName:"openai/gpt-3.5-turbo",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:1.5}}}]},"openai/gpt-3.5-turbo-0125":{modelName:"openai/gpt-3.5-turbo-0125",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:.5,outputPricePerMillion:1.5}}}]},"openai/gpt-4":{modelName:"openai/gpt-4",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:30,outputPricePerMillion:60}}}]},"openai/gpt-4-0314":{modelName:"openai/gpt-4-0314",currency:"USD",tokenRanges:[{minTokens:0,maxTokens:null,prices:{base:{inputPricePerMillion:30,outputPricePerMillion:60}}}]}};var hn=zod.z.enum([O,E,v,_]),fn={system:O,user:E,assistant:v,tool:_};var Mn=[h,N,C,U],Rn=zod.z.enum([h,N,C,U]);var H=zod.z.object({token:zod.z.string(),logprob:zod.z.number(),bytes:zod.z.array(zod.z.number()).nullable()}),xn=zod.z.object({content:zod.z.array(H.extend({top_logprobs:zod.z.array(H)})).nullable(),refusal:zod.z.array(H.extend({top_logprobs:zod.z.array(H)})).nullable()}).nullable(),to=zod.z.array(zod.z.object({id:zod.z.string().min(1),type:zod.z.enum(["function"]),function:zod.z.object({name:zod.z.string(),arguments:zod.z.string()})})),Sn=zod.z.object({id:zod.z.string(),object:zod.z.string(),created:zod.z.number(),model:zod.z.string(),system_fingerprint:zod.z.string().nullable().optional(),choices:zod.z.array(zod.z.object({index:zod.z.number(),message:zod.z.object({role:zod.z.string(),content:zod.z.string().nullable().optional(),tool_calls:to.optional(),refusal:zod.z.string().nullable().optional()}),logprobs:xn.optional(),finish_reason:zod.z.string().nullable().optional()})),usage:zod.z.object({prompt_tokens:zod.z.number(),completion_tokens:zod.z.number(),total_tokens:zod.z.number()}).nullable().optional()}),ro=zod.z.array(zod.z.object({index:zod.z.number().int(),id:zod.z.string().min(1).optional(),type:zod.z.enum(["function"]).optional(),function:zod.z.object({name:zod.z.string().min(1).optional(),arguments:zod.z.string().optional()}).optional()})),vn=zod.z.object({id:zod.z.string(),object:zod.z.string(),created:zod.z.number(),model:zod.z.string(),system_fingerprint:zod.z.string().nullable().optional(),choices:zod.z.array(zod.z.object({index:zod.z.number(),delta:zod.z.object({content:zod.z.string().nullable().optional(),tool_calls:ro.optional(),refusal:zod.z.string().nullable().optional()}).or(zod.z.object({})),logprobs:xn,finish_reason:zod.z.string().nullable().optional()})),usage:zod.z.object({prompt_tokens:zod.z.number(),completion_tokens:zod.z.number(),total_tokens:zod.z.number()}).nullable().optional()});var ao=zod.z.object({type:zod.z.literal("function"),function:zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1).optional(),strict:zod.z.boolean().optional(),parameters:zod.z.any()})}),lo=zod.z.enum(["none","auto","required"]),so=zod.z.object({type:zod.z.literal("function"),function:zod.z.object({name:zod.z.string().min(1)})}),mo=zod.z.object({type:zod.z.enum(["text","json_object"])}).or(zod.z.object({type:zod.z.literal("json_schema"),json_schema:zod.z.object({name:zod.z.string().min(1),description:zod.z.string().min(1).optional(),strict:zod.z.boolean().optional(),schema:zod.z.any()})})),Re=zod.z.object({text:zod.z.string().min(1),type:zod.z.literal("text")}),co=zod.z.object({type:zod.z.literal("image_url"),image_url:zod.z.object({url:zod.z.string().url().min(1),detail:zod.z.enum(["low","high","auto"]).optional()})}),uo=zod.z.object({id:zod.z.string().min(1),type:zod.z.literal("function"),function:zod.z.object({name:zod.z.string().min(1),arguments:zod.z.string().min(1)})}),po=zod.z.object({role:zod.z.literal("system"),content:zod.z.string().min(1).or(zod.z.array(Re).min(1))}),go=zod.z.object({role:zod.z.literal("user"),content:zod.z.string().min(1).or(zod.z.array(zod.z.union([Re,co])).min(1))}),Po=zod.z.object({role:zod.z.literal("assistant"),content:zod.z.string().min(1).or(zod.z.array(Re).min(1)).optional(),tool_calls:zod.z.array(uo).min(1).optional()}),ko=zod.z.object({role:zod.z.literal("tool"),tool_call_id:zod.z.string().min(1),content:zod.z.string().min(1)}),bo=zod.z.union([po,go,Po,ko]),Cn=zod.z.object({model:zod.z.string().min(1).optional(),messages:zod.z.array(bo).min(1),frequency_penalty:zod.z.number().min(-2).max(2).nullable().optional(),logprobs:zod.z.boolean().nullable().optional(),top_logprobs:zod.z.number().min(0).max(20).nullable().optional(),max_tokens:zod.z.number().min(0).nullable().optional(),presence_penalty:zod.z.number().min(-2).max(2).nullable().optional(),repetition_penalty:zod.z.number().min(0).max(2).nullable().optional(),response_format:mo.optional(),seed:zod.z.number().nullable().optional(),stop:zod.z.string().or(zod.z.array(zod.z.string()).max(4)).nullable().optional(),top_a:zod.z.number().min(0).max(1).nullable().optional(),temperature:zod.z.number().min(0).max(2).nullable().optional(),top_p:zod.z.number().min(0).max(1).nullable().optional(),top_k:zod.z.number().min(0).max(100).nullable().optional(),min_p:zod.z.number().min(0).max(1).nullable().optional(),tools:zod.z.array(ao).optional(),tool_choice:lo.or(so).optional()});var fe=zod.z.object({modelName:zod.z.string(),apiKey:zod.z.string(),openRouterReferer:zod.z.string().optional(),openRouterTitle:zod.z.string().optional()}),F=class{constructor(n,i){this.version="v1";let t=fe.parse(i);this.modelSchema=n,this.modelName=t.modelName,this.apiKey=t.apiKey,this.baseUrl=z(I.baseUrl),this.streamChatUrl=z(`${this.baseUrl}/chat/completions`),this.completeChatUrl=z(`${this.baseUrl}/chat/completions`),this.openRouterReferer=t.openRouterReferer,this.openRouterTitle=t.openRouterTitle;}getDefaultBaseUrl(){return this.baseUrl}getDefaultHeaders(){return f(f({Authorization:`Bearer ${this.apiKey}`,"Content-Type":"application/json"},this.openRouterReferer?{"HTTP-Referer":this.openRouterReferer}:{}),this.openRouterTitle?{"X-Title":this.openRouterTitle}:{})}getDefaultParams(){return {model:this.modelName}}getRetryDelay(n){return {shouldRetry:!0,delayMs:0}}getTokenCount(n){return n.reduce((i,t)=>i+t.content.map(r=>r.modality==="text"?r.value:"").join(" ").length,0)}transformModelRequest(n){let i=Cn.safeParse(n);if(!i.success)throw new B({info:"Invalid model request",cause:i.error});let t=i.data,r=t.model;if(t.tool_choice&&(!t.tools||t.tools.length===0))throw new B({info:`Invalid model request for model : '${this.modelName}'`,cause:new Error("'tools' are required when 'tool_choice' is specified")});let a={};t.response_format&&(a.responseFormat=t.response_format.type,t.response_format.type==="json_schema"&&(a.responseSchema={name:t.response_format.json_schema.name,description:t.response_format.json_schema.description||"",strict:t.response_format.json_schema.strict,schema:t.response_format.json_schema.schema})),t.tool_choice&&(typeof t.tool_choice=="string"?a.toolChoice=t.tool_choice:a.toolChoice=t.tool_choice.function.name),a.seed=t.seed,a.maxTokens=t.max_tokens,a.temperature=t.temperature,a.topA=t.top_a,a.topP=t.top_p,a.minP=t.min_p,a.topK=t.top_k,a.repetitionPenalty=t.repetition_penalty,a.presencePenalty=t.presence_penalty,a.frequencyPenalty=t.frequency_penalty,a.stop=t.stop,a.logProbs=t.logprobs,a.topLogProbs=t.top_logprobs;let u=Be().parse(kn(a)),m=[],p={};t.messages.forEach(g=>{let T=g.role;switch(T){case"system":{let k=g.content;if(typeof k=="string")m.push({role:T,content:[{modality:h,value:k}]});else {let b=k.map(y=>({modality:h,value:y.text}));m.push({role:T,content:b});}}break;case"user":{let k=g.content;if(typeof k=="string")m.push({role:T,content:[{modality:h,value:k}]});else {let b=k.map(y=>y.type==="text"?{modality:h,value:y.text}:y.image_url.url.startsWith("data:")?{modality:N,detail:y.image_url.detail||"auto",value:{type:J,base64:y.image_url.url,media_type:bn(y.image_url.url)}}:{modality:N,detail:y.image_url.detail||"auto",value:{type:W,url:y.image_url.url}});m.push({role:T,content:b});}}break;case"assistant":{let k=[];if(!g.content&&!g.tool_calls)throw new B({info:`Invalid model request for model : '${this.modelName}'`,cause:new Error("one of'content' or 'tool_calls' must be provided")});if(g.content){let b=g.content;typeof b=="string"?k.push({modality:h,value:b}):b.forEach(y=>{k.push({modality:h,value:y.text});});}g.tool_calls&&g.tool_calls.forEach((y,M)=>{let D={modality:C,id:y.id,index:M,name:y.function.name,arguments:y.function.arguments};k.push(D),p[D.id]=D;}),m.push({role:T,content:k});}break;case"tool":{let k=g;m.push({role:T,content:[{modality:U,id:k.tool_call_id,index:p[k.tool_call_id].index,name:p[k.tool_call_id].name,data:k.content}]});}break}});let d=[];return t.tools&&t.tools.forEach(g=>{d.push({type:"function",definition:{schema:{name:g.function.name,description:g.function.description||"",strict:g.function.strict,parameters:g.function.parameters}}});}),{modelName:r,config:u,messages:m,tools:d.length>0?d:void 0}}transformConfig(n,i,t){let r=n.toolChoice;delete n.toolChoice;let a=this.modelSchema.config.schema.safeParse(n);if(!a.success)throw new q({info:`Invalid config for model : '${this.modelName}'`,cause:a.error});let u=a.data;r!==void 0&&(u.toolChoice=r),Object.keys(u).forEach(p=>{if(!(p in this.modelSchema.config.def))throw new q({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`Invalid config key : '${p}',
7
+ available keys : [${Object.keys(this.modelSchema.config.def).join(", ")}]`)})});let m=Object.keys(u).reduce((p,d)=>{let g=this.modelSchema.config.def[d],T=g.param,k=u[d];return T==="max_tokens"&&g.type==="range"&&k===0?p[T]=g.max:p[T]=k,p},{});if(m.top_logprobs&&!m.logprobs)throw new q({info:`Invalid config for model : '${this.modelName}'`,cause:new Error("'logprobs' must be 'true' when 'top_logprobs' is specified")});if("tool_choice"in m&&m.tool_choice!==void 0){let p=m.tool_choice;if(!t||t&&t.length===0)throw new q({info:`Invalid config for model : '${this.modelName}'`,cause:new Error("'tools' are required when 'toolChoice' is specified")});if(t&&t.length>0){let d=this.modelSchema.config.def.toolChoice;if(!d.choices.includes(p))if(t.map(g=>g.definition.schema.name).includes(p))m.tool_choice={type:"function",function:{name:p}};else throw new q({info:`Invalid config for model : '${this.modelName}'`,cause:new Error(`toolChoice : '${p}' is not part of provided 'tools' names or
8
+ one of [${d.choices.join(", ")}]`)})}}if("response_format"in m&&m.response_format!==void 0){let p=m.response_format;if(p==="json_schema")if("response_schema"in m)m.response_format={type:"json_schema",json_schema:m.response_schema},delete m.response_schema;else throw new q({info:`Invalid config for model : '${this.modelName}'`,cause:new Error("'responseSchema' is required in config when 'responseFormat' is 'json_schema'")});else m.response_format={type:p};}return m}transformMessages(n){if(!n||n&&n.length===0)return {messages:[]};let i=n.map(r=>{let a=Q().safeParse(r);if(!a.success)throw new R({info:"Invalid messages",cause:a.error});return a.data});return i.forEach(r=>{r.content.forEach(a=>{if(!this.modelSchema.modalities.includes(a.modality))throw new R({info:`Invalid message content for model : '${this.modelName}'`,cause:new Error(`model : '${this.modelName}' does not support modality : '${a.modality}',
9
+ available modalities : [${this.modelSchema.modalities.join(", ")}]`)})});}),i.forEach(r=>{if(!Object.keys(this.modelSchema.roles).includes(r.role))throw new R({info:`Invalid message content for model : '${this.modelName}'`,cause:new Error(`model : '${this.modelName}' does not support role : '${r.role}',
10
+ available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})}),{messages:i.map(r=>{switch(r.role){case O:{let a=[];return r.content.forEach(u=>{if(u.modality===h)a.push({type:"text",text:u.value});else throw new R({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${r.role}' cannot have content with modality : '${u.modality}'`)})}),{role:this.modelSchema.roles[r.role],content:a}}case v:{let a=[],u=[];return r.content.forEach(m=>{if(m.modality===h)a.push({type:"text",text:m.value});else if(m.modality===C)u.push({id:m.id,type:"function",function:{name:m.name,arguments:m.arguments}});else throw new R({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${r.role}' cannot have content with modality : '${m.modality}'`)})}),f(f({role:this.modelSchema.roles[r.role]},a.length>0?{content:a}:{}),u.length>0?{tool_calls:u}:{})}case E:{let a=[],u=[];r.content.forEach(p=>{if(p.modality===h)a.push({type:"text",text:p.value});else if(p.modality===N)u.push({type:"image_url",image_url:{url:p.value.type==="url"?p.value.url:p.value.base64,detail:p.detail}});else throw new R({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${r.role}' cannot have content with modality : '${p.modality}'`)})});let m=[...a,...u];return {role:this.modelSchema.roles[r.role],content:m}}case _:{if(r.content.length!==1)throw new R({info:`Invalid message for role : '${r.role}'`,cause:new Error(`role : '${r.role}' must have exactly one content item`)});if(r.content[0].modality!==U)throw new R({info:`Invalid message 'role' and 'modality' combination for model : ${this.modelName}`,cause:new Error(`role : '${r.role}' must have content with modality : '${U}'`)});let a=r.content[0];return {role:this.modelSchema.roles[r.role],tool_call_id:a.id,content:a.data}}default:throw new R({info:`Invalid message 'role' for model : ${this.modelName}`,cause:new Error(`role : '${r.role}' is not supported,
11
+ available roles : [${Object.keys(this.modelSchema.roles).join(", ")}]`)})}})}}transformTools(n){if(!this.modelSchema.modalities.includes(C))throw new oe({info:`Invalid tool 'modality' for model : ${this.modelName}`,cause:new Error(`model : '${this.modelName}' does not support tool modality : '${C}'`)});return !n||n&&n.length===0?{tools:[]}:{tools:n.map(r=>{let a=Fe().safeParse(r);if(!a.success)throw new oe({info:"Invalid tools",cause:a.error});return a.data}).map(r=>({type:"function",function:r.definition.schema}))}}getCompleteChatUrl(n,i,t){return S(this,null,function*(){return new Promise(r=>{r(this.completeChatUrl);})})}getCompleteChatHeaders(n,i,t){return S(this,null,function*(){return new Promise(r=>{r(this.getDefaultHeaders());})})}getCompleteChatData(n,i,t){return S(this,null,function*(){let r=this.transformConfig(n,i,t),a=this.transformMessages(i);if(a.messages&&a.messages.length===0)throw new R({info:"Messages are required",cause:new Error("Messages are required")});let u=t?this.transformTools(t):{};return new Promise(m=>{m(f(f(f(f({},this.getDefaultParams()),r),a),u));})})}transformCompleteChatResponse(n){let i=Sn.safeParse(n);if(i.success){if(i.data.choices.length===0)throw new j({info:"Invalid response from model",cause:new Error(`No choices in response : ${JSON.stringify(i.data)}`)});let t=i.data,r=[{role:v,content:[]}],a=t.choices[0].message;a.content&&r[0].content.push(ne(a.content)),a.refusal&&r[0].content.push(ne(a.refusal)),a.tool_calls&&a.tool_calls.forEach((d,g)=>{r[0].content.push(He(g,d.id,d.function.name,d.function.arguments));});let u;t.usage&&(u={promptTokens:t.usage.prompt_tokens,completionTokens:t.usage.completion_tokens,totalTokens:t.usage.total_tokens});let m=[],p=t.choices[0].logprobs;return p&&(p.content&&m.push(...p.content.map(d=>({token:d.token,logProb:d.logprob,bytes:d.bytes,topLogProbs:d.top_logprobs.map(g=>({token:g.token,logProb:g.logprob,bytes:g.bytes}))}))),p.refusal&&m.push(...p.refusal.map(d=>({token:d.token,logProb:d.logprob,bytes:d.bytes,topLogProbs:d.top_logprobs.map(g=>({token:g.token,logProb:g.logprob,bytes:g.bytes}))})))),{messages:r,usage:u,logProbs:m}}throw new j({info:"Invalid response from model",cause:i.error})}getStreamChatUrl(n,i,t){return S(this,null,function*(){return new Promise(r=>{r(this.streamChatUrl);})})}getStreamChatHeaders(n,i,t){return S(this,null,function*(){return new Promise(r=>{r(this.getDefaultHeaders());})})}getStreamChatData(n,i,t){return S(this,null,function*(){let r=this.transformConfig(n,i,t),a=this.transformMessages(i);if(a.messages&&a.messages.length===0)throw new R({info:"Messages are required",cause:new Error("Messages are required")});let u=t?this.transformTools(t):{};return new Promise(m=>{m(f(f(f(f({stream:!0,stream_options:{include_usage:!0}},this.getDefaultParams()),r),a),u));})})}transformStreamChatResponseChunk(n,i){return G(this,null,function*(){var m,p;let t=i+n,r=[],a="",u=0;for(;u<t.length;){let d=t.indexOf(`
12
+ `,u);if(d===-1){a=t.substring(u);break}else {let g=t.substring(u,d).trim();g&&r.push(g),u=d+1;}}for(let d of r){if(d==="data: [DONE]")return;if(d.startsWith("data: ")){let g=d.substring(6);try{let T=JSON.parse(g),k=vn.safeParse(T);if(k.success){let b={partialMessages:[]},y=k.data;if(y.choices.length>0){let M=y.choices[0].delta;if(M!==void 0&&Object.keys(M).length!==0){if("content"in M&&M.content!==null)b.partialMessages.push(ie(v,M.content));else if("refusal"in M&&M.refusal!==null)b.partialMessages.push(ie(v,M.refusal));else if("tool_calls"in M&&M.tool_calls!==void 0){let D=M.tool_calls.at(0);b.partialMessages.push(Ge(v,D.index,D.id,(m=D.function)==null?void 0:m.name,(p=D.function)==null?void 0:p.arguments));}}}y.usage&&(b.usage={promptTokens:y.usage.prompt_tokens,completionTokens:y.usage.completion_tokens,totalTokens:y.usage.total_tokens}),yield {partialResponse:b,buffer:a};}else throw new j({info:"Invalid response from model",cause:k.error})}catch(T){throw new j({info:`Malformed JSON received in stream: ${g}`,cause:T})}}}yield {partialResponse:{partialMessages:[]},buffer:a};})}transformProxyStreamChatResponseChunk(n,i,t,r,a){return G(this,null,function*(){yield*Ce(this.transformStreamChatResponseChunk(n,i));})}getProxyStreamChatUrl(n,i,t){return S(this,null,function*(){return new Promise(r=>{r(this.streamChatUrl);})})}getProxyCompleteChatUrl(n,i,t){return S(this,null,function*(){return new Promise(r=>{r(this.completeChatUrl);})})}getProxyCompleteChatHeaders(n,i,t){return S(this,null,function*(){if(!i)return {};let r=f({},i);return delete r.host,delete r["content-length"],r})}getProxyStreamChatHeaders(n,i,t){return S(this,null,function*(){return yield this.getProxyCompleteChatHeaders(n,i,t)})}getModelPricing(){if(!(this.modelName in Me))throw new j({info:`Invalid model pricing for model : '${this.modelName}'`,cause:new Error(`No pricing configuration found for model "${this.modelName}"`)});return Me[this.modelName]}};var he=Pn(hn,Rn).parse({name:"__base__",description:"Base chat model for Open Router",maxInputTokens:128e3,maxOutputTokens:128e3,roles:fn,modalities:Mn,config:{def:Te.base(128e3,4).def,schema:Te.base(128e3,4).schema}});
13
13
 
14
- exports.BaseChatModel = D;
15
- exports.BaseChatModelOptions = Re;
16
- exports.BaseChatModelSchema = Te;
17
- exports.ChatModelBaseConfigDef = bt;
18
- exports.ChatModelBaseConfigSchema = ft;
19
- exports.OpenRouter = U;
20
- exports.OpenRouterChatModelConfigs = Ce;
21
- exports.frequencyPenalty = ue;
22
- exports.logProbs = ye;
23
- exports.maxTokens = me;
24
- exports.minP = qn;
14
+ exports.BaseChatModel = F;
15
+ exports.BaseChatModelOptions = fe;
16
+ exports.BaseChatModelSchema = he;
17
+ exports.ChatModelBaseConfigDef = Tn;
18
+ exports.ChatModelBaseConfigSchema = yn;
19
+ exports.OpenRouter = I;
20
+ exports.OpenRouterChatModelConfigs = Te;
21
+ exports.frequencyPenalty = de;
22
+ exports.logProbs = ke;
23
+ exports.maxTokens = ce;
24
+ exports.minP = Bo;
25
25
  exports.presencePenalty = ge;
26
- exports.repetitionPenalty = Ln;
27
- exports.responseFormat = Nn;
28
- exports.seed = he;
29
- exports.stop = de;
30
- exports.temperature = pe;
31
- exports.toolChoice = be;
32
- exports.topA = kn;
33
- exports.topK = In;
34
- exports.topLogProbs = fe;
35
- exports.topP = ce;
26
+ exports.repetitionPenalty = zo;
27
+ exports.responseFormat = Fo;
28
+ exports.seed = Pe;
29
+ exports.stop = ue;
30
+ exports.temperature = me;
31
+ exports.toolChoice = ye;
32
+ exports.topA = $o;
33
+ exports.topK = Ao;
34
+ exports.topLogProbs = be;
35
+ exports.topP = pe;
36
36
  //# sourceMappingURL=index.js.map
37
37
  //# sourceMappingURL=index.js.map