@agi-cli/web-ui 0.1.167 → 0.1.169
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.
|
@@ -130,7 +130,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
130
130
|
${D.url}`).join(`
|
|
131
131
|
|
|
132
132
|
`),maxHeight:"max-h-80",children:c.jsx("div",{className:"divide-y divide-border/50",children:C.map((D,w)=>c.jsxs("div",{className:"px-3 py-2 hover:bg-muted/20",children:[c.jsxs("a",{href:D.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-blue-600 dark:text-blue-400 hover:underline font-medium",children:[D.title,c.jsx(Yt,{className:"h-3 w-3 flex-shrink-0"})]}),c.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:D.snippet}),c.jsx("p",{className:"text-xs text-muted-foreground/60 truncate mt-0.5",children:D.url})]},`${D.url}-${w}`))})}),C.length===0&&c.jsx(be,{title:"results",maxHeight:"",children:c.jsx("div",{className:"px-3 py-2 text-muted-foreground/60 italic",children:"No results found"})})]})]});const m=h&&h.length>50?`${h.slice(0,50)}...`:h;return c.jsxs("div",{className:"text-xs",children:[c.jsxs(sa,{toolName:"web fetch",isExpanded:t,onToggle:n,isError:g,colorVariant:"purple",canExpand:!0,children:[m&&c.jsxs(c.Fragment,{children:[c.jsx(Ee,{}),c.jsx("span",{className:"text-foreground/70 truncate min-w-0",title:h,children:m})]}),c.jsx(Ee,{}),c.jsx(fn,{children:s})]}),t&&g&&u&&c.jsx(Mt,{error:u,stack:E,showStack:!0}),t&&!g&&c.jsxs("div",{className:"mt-2 ml-5 flex flex-col gap-2 max-w-full",children:[c.jsx(be,{title:"url",icon:c.jsx(kq,{className:"h-3 w-3"}),copyText:h,maxHeight:"",children:c.jsx("div",{className:"px-3 py-2 font-mono text-xs bg-muted/10 break-all",children:c.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 dark:text-blue-400 hover:underline",children:h})})}),d.content&&c.jsx(be,{title:"content",copyText:d.content,maxHeight:"max-h-80",children:c.jsx("div",{className:"px-3 py-2 text-xs text-foreground/80 whitespace-pre-wrap break-words",children:d.content})}),!d.content&&c.jsx(be,{title:"content",maxHeight:"",children:c.jsx("div",{className:"px-3 py-2 text-muted-foreground/60 italic",children:"No content returned"})})]})]})}function kAA({contentJson:A,debug:e,sessionId:t,onRetry:n}){const[r,o]=S.useState(!1),s=A.type==="balance_low"||A.errorType==="balance_low";A.isRetryable;let g,u,E,Q=!1;A.error&&typeof A.error=="object"?(g=A.error,g.message&&typeof g.message=="string"&&(u=g.message),g.type&&typeof g.type=="string"&&(E=g.type)):A.details&&typeof A.details=="object"?(g=A.details,A.message&&typeof A.message=="string"&&(u=A.message),A.type&&typeof A.type=="string"&&(E=A.type),A.isAborted===!0&&(Q=!0)):(A.message&&typeof A.message=="string"&&(u=A.message),A.type&&typeof A.type=="string"&&(E=A.type),A.isAborted===!0&&(Q=!0),g=A);let C;if(g?.responseBody&&typeof g.responseBody=="string")try{const m=JSON.parse(g.responseBody);m.error&&typeof m.error=="object"&&(C={type:typeof m.error.type=="string"?m.error.type:void 0,message:typeof m.error.message=="string"?m.error.message:void 0})}catch{}if(s)return c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(cs,{className:"h-4 w-4 text-amber-500"}),c.jsx("span",{className:"font-medium text-foreground",children:"Balance too low"})]}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Complete your top-up in the modal, then retry your request."}),n&&c.jsx("div",{className:"pt-1",children:c.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded bg-primary text-primary-foreground hover:bg-primary/90 transition-colors",children:[c.jsx(Rn,{className:"w-3 h-3"}),"Retry"]})})]});const d=m=>{if(m==null)return c.jsx("span",{className:"text-muted-foreground",children:"null"});if(typeof m=="boolean")return c.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:String(m)});if(typeof m=="number")return c.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:m});if(typeof m=="string"){if(m.startsWith("{")||m.startsWith("["))try{const D=JSON.parse(m);return c.jsx("pre",{className:"mt-1 p-2 bg-muted/50 rounded text-xs overflow-x-auto",children:c.jsx("code",{children:JSON.stringify(D,null,2)})})}catch{}return c.jsx("span",{className:"text-foreground",children:m})}return typeof m=="object"?c.jsx("pre",{className:"mt-1 p-2 bg-muted/50 rounded text-xs overflow-x-auto",children:c.jsx("code",{children:JSON.stringify(m,null,2)})}):c.jsx("span",{className:"text-foreground",children:String(m)})},I=["name","statusCode","url","model","isRetryable","cause"],h=new Set;return c.jsxs("div",{className:"space-y-2 text-sm",children:[Q&&c.jsx("div",{className:"text-amber-600 dark:text-amber-400 font-medium",children:"Request aborted"}),C?.message&&c.jsxs("div",{className:"space-y-1",children:[c.jsx("div",{className:"font-medium text-red-600 dark:text-red-400",children:"API Error:"}),c.jsx("div",{className:"text-foreground",children:C.message}),C.type&&c.jsxs("div",{className:"text-xs text-muted-foreground",children:["Type: ",C.type]})]}),!C?.message&&u&&c.jsxs("div",{className:"space-y-1",children:[c.jsx("div",{className:"font-medium text-red-600 dark:text-red-400",children:"Error:"}),c.jsx("div",{className:"text-foreground",children:u}),E&&c.jsxs("div",{className:"text-xs text-muted-foreground",children:["Type: ",E]})]}),n&&c.jsx("div",{className:"pt-2",children:c.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded bg-primary text-primary-foreground hover:bg-primary/90 transition-colors",children:[c.jsx(Rn,{className:"w-3 h-3"}),"Retry"]})}),g&&c.jsx("div",{className:"space-y-1.5",children:I.map(m=>{const D=g[m];return D==null?null:(h.add(m),c.jsxs("div",{className:"flex gap-2",children:[c.jsxs("span",{className:"font-medium text-muted-foreground min-w-[100px]",children:[m,":"]}),d(D)]},m))})}),g&&c.jsxs("div",{className:"mt-3 border-t border-border pt-2",children:[c.jsxs("button",{type:"button",onClick:()=>o(!r),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[r?c.jsx(In,{className:"h-3 w-3"}):c.jsx(it,{className:"h-3 w-3"}),r?"Hide":"View"," Raw Error Details"]}),r&&c.jsx("div",{className:"mt-2",children:c.jsx("pre",{className:"p-3 bg-muted/50 rounded text-xs overflow-x-auto max-h-96 overflow-y-auto",children:c.jsx("code",{children:JSON.stringify(g,null,2)})})})]}),e&&c.jsxs("details",{className:"mt-4 text-xs",children:[c.jsx("summary",{className:"cursor-pointer text-muted-foreground",children:"Debug Info"}),c.jsx("pre",{className:"mt-2 p-2 bg-muted/30 rounded overflow-x-auto",children:c.jsx("code",{children:JSON.stringify({contentJson:A,errorDetails:g,apiError:C},null,2)})})]})]})}function FT(A){return A?new Date(A).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):""}function Wp({session:A,onNavigate:e,compact:t}){return t?c.jsxs("button",{type:"button",onClick:()=>e?.(A.id),disabled:!e,className:"w-full text-left py-1 px-2 rounded text-xs hover:bg-muted/50 transition-colors flex items-center justify-between gap-2",children:[c.jsx("span",{className:"truncate text-foreground",children:A.title||"Untitled"}),e&&c.jsx(Yt,{className:"w-3 h-3 text-muted-foreground flex-shrink-0"})]}):c.jsxs("button",{type:"button",onClick:()=>e?.(A.id),disabled:!e,className:"w-full text-left p-2 rounded-md border border-border hover:bg-muted/50 transition-colors group",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"font-medium text-sm truncate text-foreground",children:A.title||"Untitled"}),e&&c.jsx(Yt,{className:"w-3 h-3 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0"})]}),c.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground mt-1",children:[A.agent&&c.jsx("span",{className:"text-violet-600 dark:text-violet-400",children:A.agent}),A.agent&&A.provider&&c.jsx("span",{children:"·"}),A.provider&&c.jsx("span",{children:A.provider}),A.messageCount!==void 0&&c.jsxs(c.Fragment,{children:[c.jsx("span",{children:"·"}),c.jsxs("span",{children:[A.messageCount," msgs"]})]}),A.createdAt&&c.jsxs(c.Fragment,{children:[c.jsx("span",{children:"·"}),c.jsx("span",{children:FT(A.createdAt)})]})]})]})}function a1({message:A,onNavigate:e,compact:t}){const n="sessionId"in A?A.sessionId:"",r="sessionTitle"in A?A.sessionTitle:null,o="content"in A?A.content:"contentPreview"in A?A.contentPreview:"matchedContent"in A?A.matchedContent:"";return t?c.jsxs("button",{type:"button",onClick:()=>e?.(n),disabled:!e||!n,className:"w-full text-left py-1 px-2 rounded text-xs hover:bg-muted/50 transition-colors flex items-center justify-between gap-2",children:[c.jsx("span",{className:"truncate text-foreground/80",children:o?.slice(0,50)||r||n.slice(0,8)}),e&&n&&c.jsx(Yt,{className:"w-3 h-3 text-muted-foreground flex-shrink-0"})]}):c.jsxs("button",{type:"button",onClick:()=>e?.(n),disabled:!e||!n,className:"w-full text-left p-2 rounded-md border border-border hover:bg-muted/50 transition-colors group",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"text-xs text-muted-foreground",children:r||n.slice(0,8)}),e&&n&&c.jsx(Yt,{className:"w-3 h-3 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0"})]}),o&&c.jsx("div",{className:"text-xs text-foreground/80 mt-1 line-clamp-2",children:o}),c.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground mt-1",children:[A.role&&c.jsx("span",{className:"capitalize",children:A.role}),A.createdAt&&c.jsxs(c.Fragment,{children:[c.jsx("span",{children:"·"}),c.jsx("span",{children:FT(A.createdAt)})]})]})]})}function r1({args:A,toolName:e}){const t=(s,g)=>g==null||typeof g=="boolean"&&!g||Array.isArray(g)&&g.length===0?null:c.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:[c.jsxs("span",{className:"opacity-60",children:[s,":"]}),c.jsx("span",{className:"text-foreground/80",children:typeof g=="string"?g:JSON.stringify(g)})]},s),o=({query_sessions:["agent","sessionType","startDate","endDate"],query_messages:["sessionId","role","search","toolName"],search_history:["query"],get_session_context:["sessionId","includeMessages"],get_parent_session:["includeMessages"]}[e]||Object.keys(A).slice(0,3)).filter(s=>A[s]!==void 0&&A[s]!==null).map(s=>t(s,A[s])).filter(Boolean);return o.length===0?null:c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap text-xs mb-2 pb-2 border-b border-border",children:[c.jsx(Bq,{className:"w-3 h-3 text-muted-foreground flex-shrink-0"}),o]})}function NAA({toolName:A,contentJson:e,toolDurationMs:t,isExpanded:n,onToggle:r,onNavigateToSession:o,compact:s}){const g=e.result||{},u=e.args||{},E=typeof g=="object"&&"ok"in g&&g.ok===!1,Q=E&&"error"in g&&typeof g.error=="string"?g.error:null,C=It(t);if(A==="present_action"){const h=g.links||[],m=g.summary,D=g.title;return h.length===0&&!m?null:c.jsxs("div",{className:"mt-2 mb-1",children:[D&&c.jsx("div",{className:"text-sm font-medium text-foreground mb-1.5",children:D}),m&&c.jsxs("div",{className:"text-xs text-muted-foreground mb-2 flex items-center gap-1.5",children:[c.jsx(bq,{className:"w-3.5 h-3.5 text-teal-500"}),c.jsx("span",{children:m})]}),h.length>0&&c.jsx("div",{className:"space-y-1.5",children:h.map(w=>c.jsxs("button",{type:"button",onClick:()=>o?.(w.sessionId),disabled:!o,className:"w-full text-left px-3 py-2 rounded-lg border border-teal-500/30 bg-teal-500/5 hover:bg-teal-500/10 transition-colors group flex items-center justify-between gap-2",children:[c.jsxs("div",{children:[c.jsx("div",{className:"font-medium text-sm text-foreground",children:w.title}),w.description&&c.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:w.description})]}),o&&c.jsx(Yt,{className:"w-4 h-4 text-teal-600 dark:text-teal-400 opacity-60 group-hover:opacity-100 transition-opacity flex-shrink-0"})]},w.sessionId))})]})}const d=()=>{switch(A){case"query_sessions":{const h=g.sessions||[],m=g.total;return`${h.length} session${h.length!==1?"s":""}${m?` of ${m}`:""}`}case"query_messages":{const h=g.messages||[];return`${h.length} message${h.length!==1?"s":""}`}case"search_history":{const h=u.query,m=g.results||[],D=h?`"${h.slice(0,20)}${h.length>20?"…":""}"`:"";return`${m.length} result${m.length!==1?"s":""}${D?` for ${D}`:""}`}case"get_session_context":return g.session?.title||u.sessionId?.slice(0,8)||"session";case"get_parent_session":return g.parentSession?.title||"parent session";default:return A}},I=()=>{const h=Object.keys(u).length>0&&!s;switch(A){case"query_sessions":{const m=g.sessions||[];return c.jsxs("div",{className:s?"p-1":"p-2",children:[h&&c.jsx(r1,{args:u,toolName:A}),m.length===0?c.jsx("div",{className:"text-xs text-muted-foreground",children:"No sessions found"}):c.jsxs("div",{className:s?"space-y-0.5":"space-y-2",children:[m.slice(0,s?5:10).map(D=>c.jsx(Wp,{session:D,onNavigate:o,compact:s},D.id)),m.length>(s?5:10)&&c.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["+",m.length-(s?5:10)," more"]})]})]})}case"query_messages":{const m=g.messages||[];return c.jsxs("div",{className:s?"p-1":"p-2",children:[h&&c.jsx(r1,{args:u,toolName:A}),m.length===0?c.jsx("div",{className:"text-xs text-muted-foreground",children:"No messages found"}):c.jsxs("div",{className:s?"space-y-0.5":"space-y-2",children:[m.slice(0,s?5:10).map(D=>c.jsx(a1,{message:D,onNavigate:o,compact:s},D.id)),m.length>(s?5:10)&&c.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["+",m.length-(s?5:10)," more"]})]})]})}case"search_history":{const m=g.results||[],D=u.query;return c.jsxs("div",{className:s?"p-1":"p-2",children:[D&&!s&&c.jsxs("div",{className:"flex items-center gap-1.5 text-xs mb-2 pb-2 border-b border-border",children:[c.jsx(us,{className:"w-3 h-3 text-muted-foreground flex-shrink-0"}),c.jsx("span",{className:"text-muted-foreground",children:"Query:"}),c.jsxs("span",{className:"text-foreground font-medium",children:['"',D,'"']})]}),m.length===0?c.jsx("div",{className:"text-xs text-muted-foreground",children:"No results found"}):c.jsxs("div",{className:s?"space-y-0.5":"space-y-2",children:[m.slice(0,s?5:10).map((w,b)=>c.jsx(a1,{message:w,onNavigate:o,compact:s},`${w.sessionId}-${w.messageId}-${b}`)),m.length>(s?5:10)&&c.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["+",m.length-(s?5:10)," more"]})]})]})}case"get_session_context":case"get_parent_session":{const m=A==="get_parent_session"?g.parentSession:g.session,D=g.stats,w=g.messages;return m?s?c.jsx("div",{className:"p-1",children:c.jsx(Wp,{session:m,onNavigate:o,compact:!0})}):c.jsxs("div",{className:"p-2 space-y-3",children:[c.jsx(Wp,{session:m,onNavigate:o}),D&&c.jsxs("div",{className:"flex gap-4 text-xs text-muted-foreground",children:[D.totalMessages!==void 0&&c.jsxs("span",{children:[D.totalMessages," messages"]}),D.totalToolCalls!==void 0&&c.jsxs("span",{children:[D.totalToolCalls," tool calls"]})]}),w&&w.length>0&&c.jsxs("div",{className:"space-y-1",children:[c.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Recent messages:"}),c.jsx("div",{className:"space-y-1 max-h-48 overflow-y-auto",children:w.slice(0,5).map(b=>c.jsxs("div",{className:"text-xs p-1.5 rounded bg-muted/30",children:[c.jsxs("span",{className:"font-medium capitalize text-foreground/70",children:[b.role,":"," "]}),c.jsx("span",{className:"text-foreground/60 line-clamp-2",children:b.content})]},b.id))})]})]}):c.jsx("div",{className:`text-xs text-muted-foreground ${s?"p-1":"p-2"}`,children:"Session not found"})}default:return c.jsx("pre",{className:"text-xs p-2 overflow-auto max-h-48",children:JSON.stringify(g,null,2)})}};return c.jsxs("div",{className:"text-xs",children:[c.jsxs(sa,{toolName:A,isExpanded:n,onToggle:r,isError:E,colorVariant:"default",canExpand:!0,children:[!s&&c.jsxs(c.Fragment,{children:[c.jsx(Ee,{}),c.jsx("span",{className:"text-foreground/70 min-w-0 truncate",children:d()})]}),!E&&!s&&c.jsxs(c.Fragment,{children:[c.jsx(Ee,{}),c.jsx($f,{children:"Done"}),c.jsx(Ee,{}),c.jsx(fn,{children:C})]}),E&&!s&&c.jsxs(c.Fragment,{children:[c.jsx(Ee,{}),c.jsx(Am,{children:"Error"}),c.jsxs(fn,{children:["· ",C]})]})]}),n&&E&&Q&&c.jsx(Mt,{error:Q}),n&&!E&&c.jsx("div",{className:s?"mt-1 ml-3":"mt-2 ml-5",children:s?c.jsx("div",{className:"border border-border rounded-md overflow-hidden max-h-48 overflow-y-auto",children:I()}):c.jsx(be,{title:"results",maxHeight:"max-h-96",children:I()})})]})}function SAA({part:A}){const[e,t]=S.useState(!0),n=S.useRef(null),r=S.useRef(!1);let o="";const s=A.contentJson||A.content;return s&&typeof s=="object"&&"text"in s?o=String(s.text):typeof s=="string"&&(o=s),S.useEffect(()=>{n.current&&e&&!A.completedAt&&!r.current&&(n.current.scrollTop=n.current.scrollHeight)},[o,e,A.completedAt]),!o||!o.trim()?null:c.jsxs("div",{className:"w-full",children:[c.jsxs("button",{type:"button",onClick:()=>t(!e),className:"flex items-center gap-2 text-xs text-muted-foreground hover:text-foreground transition-colors w-full",children:[e?c.jsx(In,{className:"h-3 w-3 flex-shrink-0"}):c.jsx(it,{className:"h-3 w-3 flex-shrink-0"}),c.jsx("span",{className:"font-medium",children:"Reasoning"}),!A.completedAt&&c.jsx("span",{className:"text-muted-foreground/60 animate-pulse",children:"thinking..."})]}),e&&c.jsx("div",{ref:n,className:"mt-2 p-3 bg-muted/30 rounded-md border border-border max-h-48 overflow-y-auto",role:"log",onMouseEnter:()=>{r.current=!0},onMouseLeave:()=>{r.current=!1},children:c.jsx("div",{className:"text-sm text-muted-foreground whitespace-pre-wrap font-mono",children:o})})]})}const MAA={Read:"read",Write:"write",Edit:"edit",Ls:"ls",Tree:"tree",Cd:"cd",Pwd:"pwd",Glob:"glob",Grep:"ripgrep",Bash:"bash",Terminal:"terminal",GitStatus:"git_status",GitDiff:"git_diff",GitCommit:"git_commit",ApplyPatch:"apply_patch",UpdateTodos:"update_todos",UpdatePlan:"update_todos",ProgressUpdate:"progress_update",Finish:"finish",WebSearch:"websearch"};function vAA(A){return MAA[A]??A}function i1({toolName:A,contentJson:e,toolDurationMs:t,debug:n,onNavigateToSession:r,compact:o,sessionId:s,onRetry:g}){const[u,E]=S.useState(!1),Q=vAA(A),d={contentJson:e,toolDurationMs:t??void 0,isExpanded:u,onToggle:()=>E(!u),compact:o};if(n)return c.jsx(wAA,{...d,toolName:A});switch(Q){case"read":return c.jsx(iAA,{...d});case"write":return c.jsx(oAA,{...d});case"edit":return c.jsx(sAA,{...d});case"bash":return c.jsx(cAA,{...d});case"git_status":return c.jsx(QAA,{...d});case"git_diff":return c.jsx(CAA,{...d});case"git_commit":return c.jsx(dAA,{...d});case"apply_patch":return c.jsx(IAA,{...d});case"ls":return c.jsx(pAA,{...d});case"tree":return c.jsx(hAA,{...d});case"ripgrep":case"grep":case"glob":return c.jsx(fAA,{...d});case"websearch":return c.jsx(xAA,{...d});case"finish":return c.jsx(mAA,{...d});case"update_todos":case"update_plan":return c.jsx(yAA,{...d});case"progress_update":return c.jsx(bAA,{...d});case"error":return c.jsx(kAA,{...d,sessionId:s,onRetry:g});case"query_sessions":case"query_messages":case"search_history":case"get_session_context":case"get_parent_session":case"present_action":return c.jsx(NAA,{toolName:A,...d,onNavigateToSession:r});default:return c.jsx(DAA,{...d,toolName:A})}}function Gh(A){const e=A.contentJson;if(e&&typeof e=="object")return e;try{if(A.content){const t=JSON.parse(A.content);if(t&&typeof t=="object"&&!Array.isArray(t))return t}}catch{}return null}function RAA(A){const e=Gh(A);if(!e)return;const t=e.args;if(t&&typeof t=="object"&&!Array.isArray(t))return t}function TAA(A){if(!A)return null;const e=["cmd","command","script","input"];for(const t of e){const n=A[t];if(typeof n=="string"&&n.trim().length>0)return n.trim()}return null}function FAA(A,e){if(!e)return null;const t=[{key:"path",match:!0},{key:"file",match:!0},{key:"target",match:!0},{key:"cwd",match:!0},{key:"query",match:!0},{key:"pattern",match:!0},{key:"glob",match:!0},{key:"dir",match:!0}];for(const{key:n}of t){const r=e[n];if(typeof r=="string"&&r.trim().length>0)return{key:n,value:r.trim()}}if(A==="bash"){const n=e.command;if(typeof n=="string"&&n.trim().length>0)return{key:"command",value:n.trim()}}return null}function OAA(A,e){if(!A)return null;const t=[];for(const[r,o]of Object.entries(A))if(!(e&&r===e)){if(typeof o=="string"||typeof o=="number"){const s=`${r}=${String(o)}`;t.push(s)}if(t.length>=3)break}if(!t.length)return null;const n=t.join(" ");return n.length>120?`${n.slice(0,117)}…`:n}const o1=S.memo(function({part:e,showLine:t,isLastToolCall:n,isLastProgressUpdate:r,onNavigateToSession:o,compact:s,pendingApproval:g,onApprove:u,onReject:E,sessionId:Q,onRetry:C}){if(e.type==="tool_call"&&!n&&!g||e.type==="tool_result"&&e.toolName==="progress_update"&&!r)return null;if(e.type==="text"){const b=e.contentJson||e.content;let y="";if(b&&typeof b=="object"&&"text"in b?y=String(b.text):typeof b=="string"&&(y=b),!y||!y.trim())return null}if(e.type==="reasoning"){const b=e.contentJson||e.content;let y="";if(b&&typeof b=="object"&&"text"in b?y=String(b.text):typeof b=="string"&&(y=b),!y||!y.trim())return null}const d=e.type==="tool_call"||e.type==="tool_result",I=["flex-1","min-w-0","max-w-full"];d||e.type==="reasoning"?I.push("pt-1"):e.type==="error"?I.push("pt-0.5"):e.type==="text"?(I.push("pt-0"),I.push("-mt-0.5")):I.push("pt-0");const h=I.join(" "),m=()=>{if(e.type==="reasoning")return c.jsx(nf,{className:"h-4 w-4 text-indigo-600 dark:text-indigo-300"});if(e.type==="tool_call")return c.jsx(Xe,{className:"h-4 w-4 text-amber-600 dark:text-amber-300 animate-spin"});if(e.type==="error")return Gh(e)?.isAborted===!0?c.jsx(Oq,{className:"h-4 w-4 text-amber-600 dark:text-amber-400"}):c.jsx(Fn,{className:"h-4 w-4 text-red-600 dark:text-red-400"});if(e.type==="tool_result"){const b=e.toolName||"";return b==="read"?c.jsx(Kg,{className:"h-4 w-4 text-blue-600 dark:text-blue-300"}):b==="write"?c.jsx(yr,{className:"h-4 w-4 text-emerald-600 dark:text-emerald-300"}):b==="edit"?c.jsx(yr,{className:"h-4 w-4 text-purple-600 dark:text-purple-300"}):b==="ls"?c.jsx(Sq,{className:"h-4 w-4 text-cyan-600 dark:text-cyan-300"}):b==="tree"?c.jsx(oR,{className:"h-4 w-4 text-cyan-600 dark:text-cyan-300"}):b==="bash"?c.jsx(br,{className:"h-4 w-4 text-muted-foreground"}):b==="ripgrep"||b==="grep"||b==="glob"?c.jsx(us,{className:"h-4 w-4 text-amber-600 dark:text-amber-300"}):b==="apply_patch"?c.jsx(Y0,{className:"h-4 w-4 text-purple-600 dark:text-purple-300"}):b==="git_status"?c.jsx(Pt,{className:"h-4 w-4 text-blue-600 dark:text-blue-300"}):b==="git_diff"?c.jsx(Y0,{className:"h-4 w-4 text-purple-600 dark:text-purple-300"}):b==="git_commit"?c.jsx(wg,{className:"h-4 w-4 text-emerald-600 dark:text-emerald-300"}):b==="finish"?c.jsx(ia,{className:"h-4 w-4 text-emerald-600 dark:text-emerald-300"}):b==="query_sessions"||b==="query_messages"||b==="search_history"||b==="get_session_context"||b==="get_parent_session"?c.jsx(H4,{className:"h-4 w-4 text-teal-600 dark:text-teal-300"}):c.jsx(br,{className:"h-4 w-4 text-muted-foreground"})}return c.jsx(Mi,{className:"h-4 w-4 text-violet-600 dark:text-violet-300"})},D=()=>{const b=e.toolName||"";let y;try{e.contentJson&&typeof e.contentJson=="object"?y=e.contentJson:typeof e.content=="string"?y=JSON.parse(e.content):y={}}catch{y={result:e.content}}return c.jsx(i1,{toolName:b,contentJson:y,toolDurationMs:e.toolDurationMs,debug:!1,onNavigateToSession:o,compact:s})},w=()=>{if(e.type==="reasoning")return c.jsx(SAA,{part:e});if(e.type==="text"){let b="";const y=e.contentJson||e.content;return y&&typeof y=="object"&&"text"in y?b=String(y.text):typeof y=="string"?b=y:y&&(b=JSON.stringify(y,null,2)),c.jsxs("div",{className:"relative group",children:[c.jsx("div",{className:"absolute -top-1 right-0 opacity-0 group-hover:opacity-100 transition-opacity z-10",children:c.jsx(ug,{text:b,className:"bg-background/80 backdrop-blur-sm border border-border/50 shadow-sm",size:"md"})}),c.jsx("div",{className:"text-base text-foreground leading-relaxed markdown-content max-w-full overflow-hidden",children:c.jsx(Y2,{remarkPlugins:[CT],components:{a:({href:M,children:F,...x})=>c.jsx("a",{href:M,target:"_blank",rel:"noopener noreferrer",onClick:k=>{window.self!==window.top&&M&&(k.preventDefault(),window.parent.postMessage({type:"agi-open-url",url:M},"*"))},...x,children:F}),pre:({children:M,...F})=>{const x=(()=>{if(!M)return"";const k=Array.isArray(M)?M[0]:M;if(k&&typeof k=="object"&&"props"in k){const v=k.props;if(typeof v.children=="string")return v.children}return""})();return c.jsxs("div",{className:"relative group/code my-3",children:[c.jsx("div",{className:"absolute top-2 right-2 opacity-0 group-hover/code:opacity-100 transition-opacity z-10",children:c.jsx(ug,{text:x,className:"bg-background/80 backdrop-blur-sm border border-border/50 shadow-sm",size:"sm"})}),c.jsx("pre",{...F,className:"overflow-x-auto",children:M})]})}},children:b})}),b.length>500&&c.jsx("div",{className:"absolute -bottom-1 right-0 opacity-0 group-hover:opacity-100 transition-opacity z-10",children:c.jsx(ug,{text:b,className:"bg-background/80 backdrop-blur-sm border border-border/50 shadow-sm",size:"md"})})]})}if(e.type==="error"){let b;try{e.contentJson&&typeof e.contentJson=="object"?b=e.contentJson:typeof e.content=="string"?b=JSON.parse(e.content):b={}}catch{b={message:e.content||"Unknown error"}}return c.jsx(i1,{toolName:"error",contentJson:b,toolDurationMs:e.toolDurationMs,debug:!1,compact:s,sessionId:Q,onRetry:C})}if(e.type==="tool_call"){const b=Gh(e),y=e.toolName||(typeof b?.name=="string"?b.name:"tool"),M=y.replace(/_/g," "),F=RAA(e),x=g?.args,k=F||x,v=FAA(y,k),R=OAA(k,v?.key),O=y==="bash"?TAA(k):null,T=[];if(O?T.push({key:"cmd",node:c.jsx("code",{className:"font-mono text-foreground/90 truncate max-w-xs",children:O})}):v&&T.push({key:"primary",node:c.jsx("code",{className:"font-mono text-foreground/85 truncate max-w-xs",children:v.value})}),R&&T.push({key:"args",node:c.jsx("span",{className:"text-muted-foreground/80 truncate max-w-xs",children:R})}),g&&g.callId===e.toolCallId&&u&&E)return c.jsx(nAA,{toolName:y,args:k,pendingApproval:g,onApprove:u,onReject:E});T.length===0&&T.push({key:"running",node:c.jsx("span",{className:"text-muted-foreground/75",children:"running…"})});const q=["flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-foreground/80 max-w-full"];return e.ephemeral&&q.push("animate-pulse"),c.jsxs("div",{className:q.join(" "),children:[c.jsx("span",{className:"font-medium text-foreground",children:M}),T.map(Y=>c.jsxs(S.Fragment,{children:[c.jsx("span",{className:"text-muted-foreground/65",children:"·"}),Y.node]},Y.key))]})}return e.type==="tool_result"?D():null};return c.jsxs("div",{className:"flex gap-3 pb-2 relative max-w-full overflow-hidden",children:[c.jsxs("div",{className:"flex-shrink-0 w-6 flex items-start justify-center relative pt-0.5",children:[c.jsx("div",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full relative bg-background",children:m()}),t&&c.jsx("div",{className:"absolute left-1/2 -translate-x-1/2 w-[2px] bg-border z-0",style:{top:"1.25rem",bottom:"-0.5rem"}})]}),c.jsx("div",{className:h,children:w()})]})},(A,e)=>A.part.id===e.part.id&&A.part.content===e.part.content&&A.part.contentJson===e.part.contentJson&&A.part.ephemeral===e.part.ephemeral&&A.part.completedAt===e.part.completedAt&&A.showLine===e.showLine&&A.isLastToolCall===e.isLastToolCall&&A.isLastProgressUpdate===e.isLastProgressUpdate&&A.onNavigateToSession===e.onNavigateToSession&&A.pendingApproval?.callId===e.pendingApproval?.callId&&A.onApprove===e.onApprove&&A.onReject===e.onReject),s1={currentMessageId:null,queuedMessages:[],queueLength:0};function LAA(A){const{data:e}=zt({queryKey:["queueState",A],enabled:!!A,initialData:s1,staleTime:1/0});return e??s1}function OT(A,e){const t=LAA(A);if(!A||!t)return{isQueued:!1,isRunning:!1,position:null};if(t.currentMessageId===e)return{isQueued:!1,isRunning:!0,position:null};const n=t.queuedMessages.find(r=>r.messageId===e);return n?{isQueued:!0,isRunning:!1,position:n.position}:{isQueued:!1,isRunning:!1,position:null}}function GAA(A){const e=xe();return $e({mutationFn:t=>{if(!A)throw new Error("No session ID");return mA.createBranch(A,t)},onSuccess:()=>{e.invalidateQueries({queryKey:["sessions"]}),A&&e.invalidateQueries({queryKey:["branches",A]})}})}function LT(A){return zt({queryKey:["parentSession",A],queryFn:()=>{if(!A)throw new Error("No session ID");return mA.getParentSession(A)},enabled:!!A})}function UAA({isOpen:A,onClose:e,sessionId:t,message:n,onBranchCreated:r}){const o=t2(t),s=GAA(t),[g,u]=S.useState(""),[E,Q]=S.useState(!0),C=S.useId(),d=S.useId(),I=n.parts?.find(D=>D.type==="text")?.content||"",h=(()=>{try{return JSON.parse(I)?.text?.slice(0,100)||""}catch{return I.slice(0,100)}})(),m=async D=>{D.preventDefault();try{const w=await s.mutateAsync({fromMessageId:n.id,title:g.trim()||void 0,provider:E?o?.provider:void 0,model:E?o?.model:void 0,agent:E?o?.agent:void 0});e(),r&&w.session&&r(w.session.id)}catch(w){console.error("Failed to create branch:",w)}};return c.jsx(Li,{isOpen:A,onClose:e,title:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Pt,{className:"h-5 w-5 text-primary"}),c.jsx("span",{children:"Branch Session"})]}),maxWidth:"md",children:c.jsxs("form",{onSubmit:m,className:"space-y-4",children:[c.jsxs("div",{className:"text-sm text-muted-foreground",children:[c.jsx("p",{children:"Creating branch from message:"}),c.jsxs("p",{className:"mt-1 p-2 bg-muted/50 rounded text-foreground italic truncate",children:['"',h,'..."']})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{htmlFor:C,className:"block text-sm font-medium text-foreground",children:"Branch Title (optional)"}),c.jsx("input",{id:C,type:"text",value:g,onChange:D=>u(D.target.value),placeholder:`Branch of ${o?.title||"Untitled"}`,className:"w-full px-3 py-2 bg-background border border-border rounded-md text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/50"})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("input",{id:d,type:"checkbox",checked:E,onChange:D=>Q(D.target.checked),className:"h-4 w-4 rounded border-border text-primary focus:ring-primary/50"}),c.jsx("label",{htmlFor:d,className:"text-sm text-foreground",children:"Use same provider/model/agent as parent"})]}),o&&c.jsx("div",{className:"text-xs text-muted-foreground bg-muted/30 rounded p-2",children:c.jsxs("div",{className:"flex gap-4",children:[c.jsxs("span",{children:[c.jsx("strong",{children:"Provider:"})," ",o.provider]}),c.jsxs("span",{children:[c.jsx("strong",{children:"Model:"})," ",o.model]}),c.jsxs("span",{children:[c.jsx("strong",{children:"Agent:"})," ",o.agent]})]})}),c.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[c.jsx("button",{type:"button",onClick:e,className:"px-4 py-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:"Cancel"}),c.jsx("button",{type:"submit",disabled:s.isPending,className:"px-4 py-2 text-sm bg-primary text-primary-foreground rounded-md hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:s.isPending?c.jsxs(c.Fragment,{children:[c.jsx(Xe,{className:"h-4 w-4 animate-spin"}),"Creating..."]}):c.jsxs(c.Fragment,{children:[c.jsx(Pt,{className:"h-4 w-4"}),"Create Branch"]})})]}),s.isError&&c.jsx("p",{className:"text-sm text-red-500",children:s.error?.message||"Failed to create branch"})]})})}const l1=["Generating...","Cooking up something...","Thinking...","Processing...","Working on it...","Crafting response...","Brewing magic...","Computing..."];function qAA(A){const e=A.split("").reduce((t,n)=>t+n.charCodeAt(0),0);return l1[e%l1.length]}const GT=S.memo(function({sessionId:e,message:t,showHeader:n,hasNextAssistantMessage:r,onBranchCreated:o,compact:s,showBranchButton:g=!0,onNavigateToSession:u,onRetry:E}){const{isQueued:Q}=OT(e,t.id),[C,d]=S.useState(!1),[I,h]=S.useState(!1),[m,D]=S.useState(!1),{pendingApprovals:w,removePendingApproval:b}=hf(),y=S.useCallback(async Z=>{if(e)try{await mA.approveToolCall(e,Z,!0),b(Z)}catch(U){console.error("Failed to approve tool call:",U)}},[e,b]),M=S.useCallback(async Z=>{if(e)try{await mA.approveToolCall(e,Z,!1),b(Z)}catch(U){console.error("Failed to reject tool call:",U)}},[e,b]),F=S.useMemo(()=>w.filter(Z=>Z.messageId===t.id),[w,t.id]),x=S.useCallback(async()=>{if(e)try{await Promise.all(F.map(Z=>mA.approveToolCall(e,Z.callId,!0)));for(const Z of F)b(Z.callId)}catch(Z){console.error("Failed to approve all tool calls:",Z)}},[e,F,b]),k=S.useMemo(()=>[...t.parts||[]].sort((U,_)=>{const V=(U.index??0)-(_.index??0);return V!==0?V:(U.startedAt??0)-(_.startedAt??0)}),[t.parts]),v=k.some(Z=>Z.toolName==="finish"),R=k.reduce((Z,U,_)=>U.type==="tool_result"&&U.toolName==="progress_update"?_:Z,-1),O=R>=0?k[R]:null,T=k.some(Z=>!(Z.type==="tool_result"&&Z.toolName==="progress_update")),K=k.findIndex(Z=>!(Z.type==="tool_result"&&Z.toolName==="progress_update")),q=t.status==="pending"&&!v&&!!O,Y=t.status==="pending"&&!v&&!O&&!Q,P=Z=>Z?new Date(Z).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"",J=t.status==="complete",j=S.useCallback(()=>{const Z=k.filter(U=>U.type==="text").map(U=>{try{return JSON.parse(U.content||"{}")?.text||""}catch{return U.content||""}}).join(`
|
|
133
|
-
`);navigator.clipboard.writeText(Z),D(!0),setTimeout(()=>D(!1),2e3)},[k]),W=S.useCallback(()=>{h(!0)},[]);return Q?null:c.jsxs("div",{className:"relative group",onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:[n&&c.jsxs("div",{className:"pb-2 flex items-center justify-between",children:[c.jsxs("div",{className:"inline-flex items-center bg-violet-500/10 border border-violet-500/30 dark:bg-violet-500/5 dark:border-violet-500/20 rounded-full pr-3 md:pr-4 flex-shrink min-w-0",children:[c.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-violet-500/50 bg-violet-500/20 dark:bg-violet-500/10",children:c.jsx(Mi,{className:"h-3.5 w-3.5 text-violet-700 dark:text-violet-300"})}),c.jsxs("div",{className:"flex items-center gap-x-1.5 md:gap-x-2 text-xs md:text-sm text-muted-foreground pl-2 md:pl-3 min-w-0",children:[t.agent&&!s&&c.jsx("span",{className:"font-medium text-violet-700 dark:text-violet-300 whitespace-nowrap",children:t.agent}),t.provider&&c.jsxs(c.Fragment,{children:[!s&&t.agent&&c.jsx("span",{className:"text-muted-foreground/50",children:"·"}),c.jsx(dn,{provider:t.provider,size:14,className:"opacity-70"})]}),t.model&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hidden md:inline text-muted-foreground/50",children:"·"}),c.jsx("span",{className:`hidden md:inline text-muted-foreground ${s?"truncate max-w-[120px]":""}`,title:t.model,children:t.model})]}),t.createdAt&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-muted-foreground/50",children:"·"}),c.jsx("span",{className:"text-muted-foreground whitespace-nowrap",children:P(t.createdAt)})]})]})]}),C&&J&&e&&g&&c.jsx("button",{type:"button",onClick:W,className:"ml-4 p-1.5 text-muted-foreground hover:text-primary transition-colors flex-shrink-0",title:"Branch from this message",children:c.jsx(Pt,{className:"h-4 w-4"})})]}),c.jsxs("div",{className:"relative ml-1",children:[k.map((Z,U)=>{const _=U===k.length-1,V=Z.type==="tool_call"&&Z.toolCallId?w.find(oA=>oA.callId===Z.toolCallId)??null:null,L=Z.type==="tool_result"&&Z.toolName==="finish",nA=(!_||r)&&!L,EA=Z.type==="tool_call"&&_;return Z.type==="tool_result"&&Z.toolName==="progress_update"?null:c.jsx(o1,{part:Z,showLine:nA,isFirstPart:U===K&&!n,isLastToolCall:EA,onNavigateToSession:u,compact:s,pendingApproval:V,onApprove:y,onReject:M,sessionId:e,onRetry:E},Z.id)}),F.length>1&&c.jsxs("div",{className:"flex items-center gap-3 py-2 px-3 my-2 bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 rounded-lg",children:[c.jsx(ER,{className:"h-4 w-4 text-amber-600 dark:text-amber-400 flex-shrink-0"}),c.jsxs("span",{className:"text-sm text-amber-800 dark:text-amber-200 flex-1",children:[F.length," tools waiting for approval"]}),c.jsxs("button",{type:"button",onClick:x,title:"Approve All (A)",className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded bg-amber-600 text-white hover:bg-amber-700 transition-colors",children:[c.jsx(f4,{className:"w-3.5 h-3.5"}),"Approve All",c.jsx("kbd",{className:"ml-1 text-[10px] opacity-70",children:"A"})]})]}),q&&O&&c.jsx(o1,{part:O,showLine:r,isFirstPart:!T&&!n,isLastProgressUpdate:!0,compact:s},O.id),Y&&c.jsxs("div",{className:"flex gap-3 pb-2 relative",children:[c.jsx("div",{className:"flex-shrink-0 w-6 flex items-start justify-center relative pt-0.5",children:c.jsx("div",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full relative bg-card text-violet-700 dark:bg-background dark:text-violet-300",children:c.jsx(Mi,{className:"h-4 w-4"})})}),c.jsx("div",{className:"flex-1 pt-0.5",children:c.jsx("div",{className:"text-base text-foreground animate-pulse",children:qAA(t.id)})})]})]}),J&&e&&c.jsx("div",{className:"grid ml-7 transition-[grid-template-rows] duration-200 ease-out",style:{gridTemplateRows:C?"1fr":"0fr"},children:c.jsx("div",{className:"overflow-hidden",children:c.jsxs("div",{className:"flex gap-2 mt-2",children:[g&&c.jsxs("button",{type:"button",onClick:W,className:"flex items-center gap-1.5 px-2 py-1 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/50 rounded transition-colors",children:[c.jsx(Pt,{className:"h-3 w-3"}),"Branch"]}),c.jsx("button",{type:"button",onClick:j,className:"flex items-center gap-1.5 px-2 py-1 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/50 rounded transition-colors",children:m?c.jsxs(c.Fragment,{children:[c.jsx(ia,{className:"h-3 w-3 text-green-500"}),"Copied"]}):c.jsxs(c.Fragment,{children:[c.jsx(rf,{className:"h-3 w-3"}),"Copy"]})})]})})}),I&&e&&c.jsx(UAA,{isOpen:I,onClose:()=>h(!1),sessionId:e,message:t,onBranchCreated:o})]})},(A,e)=>{const t=A.message.parts||[],n=e.message.parts||[];if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++){const o=t[r],s=n[r];if(o.id!==s.id||o.content!==s.content||o.contentJson!==s.contentJson||o.ephemeral!==s.ephemeral||o.completedAt!==s.completedAt)return!1}return A.message.id===e.message.id&&A.message.status===e.message.status&&A.message.completedAt===e.message.completedAt&&A.showHeader===e.showHeader&&A.hasNextAssistantMessage===e.hasNextAssistantMessage&&A.isLastMessage===e.isLastMessage&&A.sessionId===e.sessionId&&A.compact===e.compact&&A.onNavigateToSession===e.onNavigateToSession}),UT=S.memo(function({sessionId:e,message:t,nextAssistantMessageId:n}){const[r,o]=S.useState(null),s=t.parts||[],g=xe(),{isQueued:u,position:E}=OT(e,n??""),Q=Dh(T=>T.setPendingRestoreText),C=s.filter(T=>T.type==="text"),d=s.filter(T=>T.type==="image"),I=s.filter(T=>T.type==="file"),h=C[0];let m="";if(h){const T=h.contentJson||h.content;T&&typeof T=="object"&&"text"in T?m=String(T.text):typeof T=="string"?m=T:T&&(m=JSON.stringify(T,null,2))}const{researchContexts:D,cleanContent:w}=_8(m),b=[];for(const T of d)try{const K=T.contentJson||JSON.parse(T.content||"{}");if(K&&typeof K=="object"&&"data"in K){const q=K,Y=`data:${q.mediaType};base64,${q.data}`;b.push({id:T.id,src:Y})}}catch{}const y=[];for(const T of I)try{const K=T.contentJson||JSON.parse(T.content||"{}");if(K&&typeof K=="object"&&"type"in K){const q=K;if(q.type==="image"&&q.data){const Y=`data:${q.mediaType};base64,${q.data}`;b.push({id:T.id,src:Y})}else y.push({id:T.id,type:q.type,name:q.name})}}catch{}const M=T=>T?new Date(T).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"",F=w.trim().length>0,x=b.length>0,k=y.length>0,v=D.length>0;if(!F&&!x&&!k&&!v)return null;const R=async()=>{if(!(!e||!n)){Q(w);try{await mA.removeFromQueue(e,n),g.invalidateQueries({queryKey:["messages",e]})}catch(T){console.error("Failed to cancel queued message:",T)}}},O=async()=>{if(!(!e||!n))try{await mA.removeFromQueue(e,n),g.invalidateQueries({queryKey:["messages",e]})}catch(T){console.error("Failed to delete queued message:",T)}};return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"relative pb-8 pt-6",children:c.jsxs("div",{className:"flex gap-3 md:gap-4 justify-end",children:[c.jsxs("div",{className:"flex flex-col items-end min-w-0 flex-1 max-w-[calc(100%-3rem)] md:max-w-2xl",children:[c.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground pb-2 justify-end",children:[c.jsx("span",{className:"font-medium text-emerald-700 dark:text-emerald-300",children:"You"}),t.createdAt&&c.jsx("span",{children:"·"}),t.createdAt&&c.jsx("span",{children:M(t.createdAt)}),u&&c.jsxs(c.Fragment,{children:[c.jsx("span",{children:"·"}),c.jsxs("span",{className:"inline-flex items-center gap-1 text-amber-600 dark:text-amber-400",children:[c.jsx(nR,{className:"h-3 w-3"}),"Queued",E!==null&&E>0?` #${E+1}`:""]})]})]}),c.jsxs("div",{className:"inline-block max-w-full text-sm text-foreground leading-relaxed bg-emerald-500/5 border border-emerald-500/20 rounded-xl px-4 py-3 [word-break:break-word] overflow-hidden",children:[x&&c.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:b.map(T=>c.jsx("button",{type:"button",onClick:()=>o(T.src),className:"w-16 h-16 rounded-lg overflow-hidden bg-muted hover:ring-2 hover:ring-primary/50 transition-all",children:c.jsx("img",{src:T.src,alt:"Attachment",className:"w-full h-full object-cover"})},T.id))}),k&&c.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:y.map(T=>c.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-muted/50 border border-border",children:[T.type==="pdf"?c.jsx(Ha,{className:"w-4 h-4 text-red-500 flex-shrink-0"}):c.jsx(Kg,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}),c.jsx("span",{className:"text-xs truncate max-w-[150px]",children:T.name})]},T.id))}),v&&c.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:D.map(T=>c.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-teal-500/10 border border-teal-500/30",children:[c.jsx(is,{className:"w-4 h-4 text-teal-500 flex-shrink-0"}),c.jsx("span",{className:"text-xs text-teal-600 dark:text-teal-400",children:T.label})]},T.id))}),F&&c.jsx("div",{className:"prose prose-invert prose-sm [&>*:first-child]:mt-0 [&>*:last-child]:mb-0 [&_*]:[word-break:break-word] [&_*]:overflow-wrap-anywhere",children:c.jsx(Y2,{remarkPlugins:[CT],components:{a:({href:T,children:K,...q})=>c.jsx("a",{href:T,target:"_blank",rel:"noopener noreferrer",onClick:Y=>{window.self!==window.top&&T&&(Y.preventDefault(),window.parent.postMessage({type:"agi-open-url",url:T},"*"))},...q,children:K})},children:w})})]}),u&&c.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[c.jsxs("button",{type:"button",onClick:R,className:"inline-flex items-center gap-1.5 px-2.5 py-1 text-xs rounded-md bg-muted hover:bg-muted/80 text-muted-foreground hover:text-foreground transition-colors",title:"Cancel and restore to input",children:[c.jsx(cR,{className:"h-3 w-3"}),"Cancel"]}),c.jsxs("button",{type:"button",onClick:O,className:"inline-flex items-center gap-1.5 px-2.5 py-1 text-xs rounded-md bg-destructive/10 hover:bg-destructive/20 text-destructive transition-colors",title:"Delete from queue",children:[c.jsx(sf,{className:"h-3 w-3"}),"Delete"]})]})]}),c.jsx("div",{className:"flex-shrink-0 w-8 flex items-start justify-center",children:c.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full border-2 border-emerald-500/50 bg-emerald-500/20 dark:bg-emerald-500/10 relative bg-background",children:c.jsx(lf,{className:"h-4 w-4 text-emerald-700 dark:text-emerald-300"})})})]})}),r&&c.jsxs("div",{role:"dialog","aria-modal":"true",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4",onClick:()=>o(null),onKeyDown:T=>T.key==="Escape"&&o(null),tabIndex:-1,children:[c.jsx("button",{type:"button",onClick:()=>o(null),className:"absolute top-4 right-4 p-2 rounded-full bg-white/10 hover:bg-white/20 transition-colors",children:c.jsx(gt,{className:"w-6 h-6 text-white"})}),c.jsx("img",{src:r,alt:"Expanded attachment",className:"max-w-full max-h-full object-contain rounded-lg",onClick:T=>T.stopPropagation(),onKeyDown:T=>T.key==="Enter"&&T.stopPropagation()})]})]})},(A,e)=>{const t=A.message.parts?.[0],n=e.message.parts?.[0];return A.message.id===e.message.id&&t?.content===n?.content&&t?.contentJson===n?.contentJson&&A.message.createdAt===e.message.createdAt&&A.message.parts?.length===e.message.parts?.length&&A.sessionId===e.sessionId&&A.nextAssistantMessageId===e.nextAssistantMessageId}),KAA={openai:{id:"openai",models:[{id:"codex-mini-latest",label:"Codex Mini",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-04",releaseDate:"2025-05-16",lastUpdated:"2025-05-16",openWeights:!1,cost:{input:1.5,output:6,cacheRead:.375},limit:{context:2e5,output:1e5}},{id:"gpt-3.5-turbo",label:"GPT-3.5-turbo",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2021-09-01",releaseDate:"2023-03-01",lastUpdated:"2023-11-06",openWeights:!1,cost:{input:.5,output:1.5,cacheRead:1.25},limit:{context:16385,output:4096}},{id:"gpt-4",label:"GPT-4",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2023-11",releaseDate:"2023-11-06",lastUpdated:"2024-04-09",openWeights:!1,cost:{input:30,output:60},limit:{context:8192,output:8192}},{id:"gpt-4-turbo",label:"GPT-4 Turbo",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2023-12",releaseDate:"2023-11-06",lastUpdated:"2024-04-09",openWeights:!1,cost:{input:10,output:30},limit:{context:128e3,output:4096}},{id:"gpt-4.1",label:"GPT-4.1",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-04",releaseDate:"2025-04-14",lastUpdated:"2025-04-14",openWeights:!1,cost:{input:2,output:8,cacheRead:.5},limit:{context:1047576,output:32768}},{id:"gpt-4.1-mini",label:"GPT-4.1 mini",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-04",releaseDate:"2025-04-14",lastUpdated:"2025-04-14",openWeights:!1,cost:{input:.4,output:1.6,cacheRead:.1},limit:{context:1047576,output:32768}},{id:"gpt-4.1-nano",label:"GPT-4.1 nano",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-04",releaseDate:"2025-04-14",lastUpdated:"2025-04-14",openWeights:!1,cost:{input:.1,output:.4,cacheRead:.03},limit:{context:1047576,output:32768}},{id:"gpt-4o",label:"GPT-4o",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2023-09",releaseDate:"2024-05-13",lastUpdated:"2024-08-06",openWeights:!1,cost:{input:2.5,output:10,cacheRead:1.25},limit:{context:128e3,output:16384}},{id:"gpt-4o-2024-05-13",label:"GPT-4o (2024-05-13)",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2023-09",releaseDate:"2024-05-13",lastUpdated:"2024-05-13",openWeights:!1,cost:{input:5,output:15},limit:{context:128e3,output:4096}},{id:"gpt-4o-2024-08-06",label:"GPT-4o (2024-08-06)",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2023-09",releaseDate:"2024-08-06",lastUpdated:"2024-08-06",openWeights:!1,cost:{input:2.5,output:10,cacheRead:1.25},limit:{context:128e3,output:16384}},{id:"gpt-4o-2024-11-20",label:"GPT-4o (2024-11-20)",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2023-09",releaseDate:"2024-11-20",lastUpdated:"2024-11-20",openWeights:!1,cost:{input:2.5,output:10,cacheRead:1.25},limit:{context:128e3,output:16384}},{id:"gpt-4o-mini",label:"GPT-4o mini",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2023-09",releaseDate:"2024-07-18",lastUpdated:"2024-07-18",openWeights:!1,cost:{input:.15,output:.6,cacheRead:.08},limit:{context:128e3,output:16384}},{id:"gpt-5",label:"GPT-5",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-08-07",lastUpdated:"2025-08-07",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.125},limit:{context:4e5,output:128e3}},{id:"gpt-5-chat-latest",label:"GPT-5 Chat (latest)",modalities:{input:["text","image"],output:["text"]},toolCall:!1,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-09-30",releaseDate:"2025-08-07",lastUpdated:"2025-08-07",openWeights:!1,cost:{input:1.25,output:10},limit:{context:4e5,output:128e3}},{id:"gpt-5-codex",label:"GPT-5-Codex",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-09-15",lastUpdated:"2025-09-15",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.125},limit:{context:4e5,output:128e3}},{id:"gpt-5-mini",label:"GPT-5 Mini",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-05-30",releaseDate:"2025-08-07",lastUpdated:"2025-08-07",openWeights:!1,cost:{input:.25,output:2,cacheRead:.025},limit:{context:4e5,output:128e3}},{id:"gpt-5-nano",label:"GPT-5 Nano",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-05-30",releaseDate:"2025-08-07",lastUpdated:"2025-08-07",openWeights:!1,cost:{input:.05,output:.4,cacheRead:.005},limit:{context:4e5,output:128e3}},{id:"gpt-5-pro",label:"GPT-5 Pro",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-10-06",lastUpdated:"2025-10-06",openWeights:!1,cost:{input:15,output:120},limit:{context:4e5,output:272e3}},{id:"gpt-5.1",label:"GPT-5.1",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-11-13",lastUpdated:"2025-11-13",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.13},limit:{context:4e5,output:128e3}},{id:"gpt-5.1-chat-latest",label:"GPT-5.1 Chat",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-11-13",lastUpdated:"2025-11-13",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.125},limit:{context:128e3,output:16384}},{id:"gpt-5.1-codex",label:"GPT-5.1 Codex",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-11-13",lastUpdated:"2025-11-13",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.125},limit:{context:4e5,output:128e3}},{id:"gpt-5.1-codex-max",label:"GPT-5.1 Codex Max",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-11-13",lastUpdated:"2025-11-13",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.125},limit:{context:4e5,output:128e3}},{id:"gpt-5.1-codex-mini",label:"GPT-5.1 Codex mini",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-11-13",lastUpdated:"2025-11-13",openWeights:!1,cost:{input:.25,output:2,cacheRead:.025},limit:{context:4e5,output:128e3}},{id:"gpt-5.2",label:"GPT-5.2",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2025-08-31",releaseDate:"2025-12-11",lastUpdated:"2025-12-11",openWeights:!1,cost:{input:1.75,output:14,cacheRead:.175},limit:{context:4e5,output:128e3}},{id:"gpt-5.2-chat-latest",label:"GPT-5.2 Chat",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2025-08-31",releaseDate:"2025-12-11",lastUpdated:"2025-12-11",openWeights:!1,cost:{input:1.75,output:14,cacheRead:.175},limit:{context:128e3,output:16384}},{id:"gpt-5.2-codex",label:"GPT-5.2 Codex",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2025-08-31",releaseDate:"2025-12-11",lastUpdated:"2025-12-11",openWeights:!1,cost:{input:1.75,output:14,cacheRead:.175},limit:{context:4e5,output:128e3}},{id:"gpt-5.2-pro",label:"GPT-5.2 Pro",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2025-08-31",releaseDate:"2025-12-11",lastUpdated:"2025-12-11",openWeights:!1,cost:{input:21,output:168},limit:{context:4e5,output:128e3}},{id:"o1",label:"o1",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2023-09",releaseDate:"2024-12-05",lastUpdated:"2024-12-05",openWeights:!1,cost:{input:15,output:60,cacheRead:7.5},limit:{context:2e5,output:1e5}},{id:"o1-mini",label:"o1-mini",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!0,attachment:!1,temperature:!1,knowledge:"2023-09",releaseDate:"2024-09-12",lastUpdated:"2024-09-12",openWeights:!1,cost:{input:1.1,output:4.4,cacheRead:.55},limit:{context:128e3,output:65536}},{id:"o1-preview",label:"o1-preview",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2023-09",releaseDate:"2024-09-12",lastUpdated:"2024-09-12",openWeights:!1,cost:{input:15,output:60,cacheRead:7.5},limit:{context:128e3,output:32768}},{id:"o1-pro",label:"o1-pro",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2023-09",releaseDate:"2025-03-19",lastUpdated:"2025-03-19",openWeights:!1,cost:{input:150,output:600},limit:{context:2e5,output:1e5}},{id:"o3",label:"o3",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-05",releaseDate:"2025-04-16",lastUpdated:"2025-04-16",openWeights:!1,cost:{input:2,output:8,cacheRead:.5},limit:{context:2e5,output:1e5}},{id:"o3-deep-research",label:"o3-deep-research",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-05",releaseDate:"2024-06-26",lastUpdated:"2024-06-26",openWeights:!1,cost:{input:10,output:40,cacheRead:2.5},limit:{context:2e5,output:1e5}},{id:"o3-mini",label:"o3-mini",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!1,knowledge:"2024-05",releaseDate:"2024-12-20",lastUpdated:"2025-01-29",openWeights:!1,cost:{input:1.1,output:4.4,cacheRead:.55},limit:{context:2e5,output:1e5}},{id:"o3-pro",label:"o3-pro",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-05",releaseDate:"2025-06-10",lastUpdated:"2025-06-10",openWeights:!1,cost:{input:20,output:80},limit:{context:2e5,output:1e5}},{id:"o4-mini",label:"o4-mini",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-05",releaseDate:"2025-04-16",lastUpdated:"2025-04-16",openWeights:!1,cost:{input:1.1,output:4.4,cacheRead:.28},limit:{context:2e5,output:1e5}},{id:"o4-mini-deep-research",label:"o4-mini-deep-research",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-05",releaseDate:"2024-06-26",lastUpdated:"2024-06-26",openWeights:!1,cost:{input:2,output:8,cacheRead:.5},limit:{context:2e5,output:1e5}},{id:"text-embedding-3-large",label:"text-embedding-3-large",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!1,attachment:!1,temperature:!1,knowledge:"2024-01",releaseDate:"2024-01-25",lastUpdated:"2024-01-25",openWeights:!1,cost:{input:.13,output:0},limit:{context:8191,output:3072}},{id:"text-embedding-3-small",label:"text-embedding-3-small",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!1,attachment:!1,temperature:!1,knowledge:"2024-01",releaseDate:"2024-01-25",lastUpdated:"2024-01-25",openWeights:!1,cost:{input:.02,output:0},limit:{context:8191,output:1536}},{id:"text-embedding-ada-002",label:"text-embedding-ada-002",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!1,attachment:!1,temperature:!1,knowledge:"2022-12",releaseDate:"2022-12-15",lastUpdated:"2022-12-15",openWeights:!1,cost:{input:.1,output:0},limit:{context:8192,output:1536}}],label:"OpenAI",env:["OPENAI_API_KEY"],npm:"@ai-sdk/openai",doc:"https://platform.openai.com/docs/models"},anthropic:{id:"anthropic",models:[{id:"claude-3-5-haiku-20241022",label:"Claude Haiku 3.5",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-07-31",releaseDate:"2024-10-22",lastUpdated:"2024-10-22",openWeights:!1,cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},limit:{context:2e5,output:8192}},{id:"claude-3-5-haiku-latest",label:"Claude Haiku 3.5 (latest)",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-07-31",releaseDate:"2024-10-22",lastUpdated:"2024-10-22",openWeights:!1,cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},limit:{context:2e5,output:8192}},{id:"claude-3-5-sonnet-20240620",label:"Claude Sonnet 3.5",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-04-30",releaseDate:"2024-06-20",lastUpdated:"2024-06-20",openWeights:!1,cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},limit:{context:2e5,output:8192}},{id:"claude-3-5-sonnet-20241022",label:"Claude Sonnet 3.5 v2",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-04-30",releaseDate:"2024-10-22",lastUpdated:"2024-10-22",openWeights:!1,cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},limit:{context:2e5,output:8192}},{id:"claude-3-7-sonnet-20250219",label:"Claude Sonnet 3.7",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-10-31",releaseDate:"2025-02-19",lastUpdated:"2025-02-19",openWeights:!1,cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},limit:{context:2e5,output:64e3}},{id:"claude-3-7-sonnet-latest",label:"Claude Sonnet 3.7 (latest)",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-10-31",releaseDate:"2025-02-19",lastUpdated:"2025-02-19",openWeights:!1,cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},limit:{context:2e5,output:64e3}},{id:"claude-3-haiku-20240307",label:"Claude Haiku 3",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2023-08-31",releaseDate:"2024-03-13",lastUpdated:"2024-03-13",openWeights:!1,cost:{input:.25,output:1.25,cacheRead:.03,cacheWrite:.3},limit:{context:2e5,output:4096}},{id:"claude-3-opus-20240229",label:"Claude Opus 3",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2023-08-31",releaseDate:"2024-02-29",lastUpdated:"2024-02-29",openWeights:!1,cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},limit:{context:2e5,output:4096}},{id:"claude-3-sonnet-20240229",label:"Claude Sonnet 3",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2023-08-31",releaseDate:"2024-03-04",lastUpdated:"2024-03-04",openWeights:!1,cost:{input:3,output:15,cacheRead:.3,cacheWrite:.3},limit:{context:2e5,output:4096}},{id:"claude-haiku-4-5",label:"Claude Haiku 4.5 (latest)",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-02-28",releaseDate:"2025-10-15",lastUpdated:"2025-10-15",openWeights:!1,cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},limit:{context:2e5,output:64e3}},{id:"claude-haiku-4-5-20251001",label:"Claude Haiku 4.5",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-02-28",releaseDate:"2025-10-15",lastUpdated:"2025-10-15",openWeights:!1,cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},limit:{context:2e5,output:64e3}},{id:"claude-opus-4-0",label:"Claude Opus 4 (latest)",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-03-31",releaseDate:"2025-05-22",lastUpdated:"2025-05-22",openWeights:!1,cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},limit:{context:2e5,output:32e3}},{id:"claude-opus-4-1",label:"Claude Opus 4.1 (latest)",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-03-31",releaseDate:"2025-08-05",lastUpdated:"2025-08-05",openWeights:!1,cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},limit:{context:2e5,output:32e3}},{id:"claude-opus-4-1-20250805",label:"Claude Opus 4.1",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-03-31",releaseDate:"2025-08-05",lastUpdated:"2025-08-05",openWeights:!1,cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},limit:{context:2e5,output:32e3}},{id:"claude-opus-4-20250514",label:"Claude Opus 4",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-03-31",releaseDate:"2025-05-22",lastUpdated:"2025-05-22",openWeights:!1,cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},limit:{context:2e5,output:32e3}},{id:"claude-opus-4-5",label:"Claude Opus 4.5 (latest)",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-03-31",releaseDate:"2025-11-24",lastUpdated:"2025-11-24",openWeights:!1,cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},limit:{context:2e5,output:64e3}},{id:"claude-opus-4-5-20251101",label:"Claude Opus 4.5",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-03-31",releaseDate:"2025-11-01",lastUpdated:"2025-11-01",openWeights:!1,cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},limit:{context:2e5,output:64e3}},{id:"claude-sonnet-4-0",label:"Claude Sonnet 4 (latest)",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-03-31",releaseDate:"2025-05-22",lastUpdated:"2025-05-22",openWeights:!1,cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},limit:{context:2e5,output:64e3}},{id:"claude-sonnet-4-20250514",label:"Claude Sonnet 4",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-03-31",releaseDate:"2025-05-22",lastUpdated:"2025-05-22",openWeights:!1,cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},limit:{context:2e5,output:64e3}},{id:"claude-sonnet-4-5",label:"Claude Sonnet 4.5 (latest)",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-07-31",releaseDate:"2025-09-29",lastUpdated:"2025-09-29",openWeights:!1,cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},limit:{context:2e5,output:64e3}},{id:"claude-sonnet-4-5-20250929",label:"Claude Sonnet 4.5",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-07-31",releaseDate:"2025-09-29",lastUpdated:"2025-09-29",openWeights:!1,cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},limit:{context:2e5,output:64e3}}],label:"Anthropic",env:["ANTHROPIC_API_KEY"],npm:"@ai-sdk/anthropic",doc:"https://docs.anthropic.com/en/docs/about-claude/models"},google:{id:"google",models:[{id:"gemini-1.5-flash",label:"Gemini 1.5 Flash",modalities:{input:["text","image","audio","video"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-04",releaseDate:"2024-05-14",lastUpdated:"2024-05-14",openWeights:!1,cost:{input:.075,output:.3,cacheRead:.01875},limit:{context:1e6,output:8192}},{id:"gemini-1.5-flash-8b",label:"Gemini 1.5 Flash-8B",modalities:{input:["text","image","audio","video"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-04",releaseDate:"2024-10-03",lastUpdated:"2024-10-03",openWeights:!1,cost:{input:.0375,output:.15,cacheRead:.01},limit:{context:1e6,output:8192}},{id:"gemini-1.5-pro",label:"Gemini 1.5 Pro",modalities:{input:["text","image","audio","video"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-04",releaseDate:"2024-02-15",lastUpdated:"2024-02-15",openWeights:!1,cost:{input:1.25,output:5,cacheRead:.3125},limit:{context:1e6,output:8192}},{id:"gemini-2.0-flash",label:"Gemini 2.0 Flash",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-06",releaseDate:"2024-12-11",lastUpdated:"2024-12-11",openWeights:!1,cost:{input:.1,output:.4,cacheRead:.025},limit:{context:1048576,output:8192}},{id:"gemini-2.0-flash-lite",label:"Gemini 2.0 Flash Lite",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-06",releaseDate:"2024-12-11",lastUpdated:"2024-12-11",openWeights:!1,cost:{input:.075,output:.3},limit:{context:1048576,output:8192}},{id:"gemini-2.5-flash",label:"Gemini 2.5 Flash",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-03-20",lastUpdated:"2025-06-05",openWeights:!1,cost:{input:.3,output:2.5,cacheRead:.075},limit:{context:1048576,output:65536}},{id:"gemini-2.5-flash-image",label:"Gemini 2.5 Flash Image",modalities:{input:["text","image"],output:["text","image"]},toolCall:!1,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-06",releaseDate:"2025-08-26",lastUpdated:"2025-08-26",openWeights:!1,cost:{input:.3,output:30,cacheRead:.075},limit:{context:32768,output:32768}},{id:"gemini-2.5-flash-image-preview",label:"Gemini 2.5 Flash Image (Preview)",modalities:{input:["text","image"],output:["text","image"]},toolCall:!1,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-06",releaseDate:"2025-08-26",lastUpdated:"2025-08-26",openWeights:!1,cost:{input:.3,output:30,cacheRead:.075},limit:{context:32768,output:32768}},{id:"gemini-2.5-flash-lite",label:"Gemini 2.5 Flash Lite",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-06-17",lastUpdated:"2025-06-17",openWeights:!1,cost:{input:.1,output:.4,cacheRead:.025},limit:{context:1048576,output:65536}},{id:"gemini-2.5-flash-lite-preview-06-17",label:"Gemini 2.5 Flash Lite Preview 06-17",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-06-17",lastUpdated:"2025-06-17",openWeights:!1,cost:{input:.1,output:.4,cacheRead:.025},limit:{context:1048576,output:65536}},{id:"gemini-2.5-flash-lite-preview-09-2025",label:"Gemini 2.5 Flash Lite Preview 09-25",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-09-25",lastUpdated:"2025-09-25",openWeights:!1,cost:{input:.1,output:.4,cacheRead:.025},limit:{context:1048576,output:65536}},{id:"gemini-2.5-flash-preview-04-17",label:"Gemini 2.5 Flash Preview 04-17",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-04-17",lastUpdated:"2025-04-17",openWeights:!1,cost:{input:.15,output:.6,cacheRead:.0375},limit:{context:1048576,output:65536}},{id:"gemini-2.5-flash-preview-05-20",label:"Gemini 2.5 Flash Preview 05-20",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-05-20",lastUpdated:"2025-05-20",openWeights:!1,cost:{input:.15,output:.6,cacheRead:.0375},limit:{context:1048576,output:65536}},{id:"gemini-2.5-flash-preview-09-2025",label:"Gemini 2.5 Flash Preview 09-25",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-09-25",lastUpdated:"2025-09-25",openWeights:!1,cost:{input:.3,output:2.5,cacheRead:.075},limit:{context:1048576,output:65536}},{id:"gemini-2.5-flash-preview-tts",label:"Gemini 2.5 Flash Preview TTS",modalities:{input:["text"],output:["audio"]},toolCall:!1,reasoningText:!1,attachment:!1,temperature:!1,knowledge:"2025-01",releaseDate:"2025-05-01",lastUpdated:"2025-05-01",openWeights:!1,cost:{input:.5,output:10},limit:{context:8e3,output:16e3}},{id:"gemini-2.5-pro",label:"Gemini 2.5 Pro",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-03-20",lastUpdated:"2025-06-05",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.31},limit:{context:1048576,output:65536}},{id:"gemini-2.5-pro-preview-05-06",label:"Gemini 2.5 Pro Preview 05-06",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-05-06",lastUpdated:"2025-05-06",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.31},limit:{context:1048576,output:65536}},{id:"gemini-2.5-pro-preview-06-05",label:"Gemini 2.5 Pro Preview 06-05",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-06-05",lastUpdated:"2025-06-05",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.31},limit:{context:1048576,output:65536}},{id:"gemini-2.5-pro-preview-tts",label:"Gemini 2.5 Pro Preview TTS",modalities:{input:["text"],output:["audio"]},toolCall:!1,reasoningText:!1,attachment:!1,temperature:!1,knowledge:"2025-01",releaseDate:"2025-05-01",lastUpdated:"2025-05-01",openWeights:!1,cost:{input:1,output:20},limit:{context:8e3,output:16e3}},{id:"gemini-3-flash-preview",label:"Gemini 3 Flash Preview",modalities:{input:["text","image","video","audio","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-12-17",lastUpdated:"2025-12-17",openWeights:!1,cost:{input:.5,output:3,cacheRead:.05},limit:{context:1048576,output:65536}},{id:"gemini-3-pro-preview",label:"Gemini 3 Pro Preview",modalities:{input:["text","image","video","audio","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-11-18",lastUpdated:"2025-11-18",openWeights:!1,cost:{input:2,output:12,cacheRead:.2},limit:{context:1e6,output:64e3}},{id:"gemini-embedding-001",label:"Gemini Embedding 001",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!1,attachment:!1,temperature:!1,knowledge:"2025-05",releaseDate:"2025-05-20",lastUpdated:"2025-05-20",openWeights:!1,cost:{input:.15,output:0},limit:{context:2048,output:3072}},{id:"gemini-flash-latest",label:"Gemini Flash Latest",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-09-25",lastUpdated:"2025-09-25",openWeights:!1,cost:{input:.3,output:2.5,cacheRead:.075},limit:{context:1048576,output:65536}},{id:"gemini-flash-lite-latest",label:"Gemini Flash-Lite Latest",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-09-25",lastUpdated:"2025-09-25",openWeights:!1,cost:{input:.1,output:.4,cacheRead:.025},limit:{context:1048576,output:65536}},{id:"gemini-live-2.5-flash",label:"Gemini Live 2.5 Flash",modalities:{input:["text","image","audio","video"],output:["text","audio"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-09-01",lastUpdated:"2025-09-01",openWeights:!1,cost:{input:.5,output:2},limit:{context:128e3,output:8e3}},{id:"gemini-live-2.5-flash-preview-native-audio",label:"Gemini Live 2.5 Flash Preview Native Audio",modalities:{input:["text","audio","video"],output:["text","audio"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!1,knowledge:"2025-01",releaseDate:"2025-06-17",lastUpdated:"2025-09-18",openWeights:!1,cost:{input:.5,output:2},limit:{context:131072,output:65536}}],label:"Google",env:["GOOGLE_GENERATIVE_AI_API_KEY","GEMINI_API_KEY"],npm:"@ai-sdk/google",doc:"https://ai.google.dev/gemini-api/docs/pricing"},openrouter:{id:"openrouter",models:[{id:"anthropic/claude-3.5-haiku",label:"Claude Haiku 3.5",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-07-31",releaseDate:"2024-10-22",lastUpdated:"2024-10-22",openWeights:!1,cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},limit:{context:2e5,output:8192}},{id:"anthropic/claude-3.7-sonnet",label:"Claude Sonnet 3.7",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-01",releaseDate:"2025-02-19",lastUpdated:"2025-02-19",openWeights:!1,cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},limit:{context:2e5,output:128e3}},{id:"anthropic/claude-haiku-4.5",label:"Claude Haiku 4.5",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-02-28",releaseDate:"2025-10-15",lastUpdated:"2025-10-15",openWeights:!1,cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},limit:{context:2e5,output:64e3}},{id:"anthropic/claude-opus-4",label:"Claude Opus 4",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-03-31",releaseDate:"2025-05-22",lastUpdated:"2025-05-22",openWeights:!1,cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},limit:{context:2e5,output:32e3}},{id:"anthropic/claude-opus-4.1",label:"Claude Opus 4.1",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-03-31",releaseDate:"2025-08-05",lastUpdated:"2025-08-05",openWeights:!1,cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},limit:{context:2e5,output:32e3}},{id:"anthropic/claude-opus-4.5",label:"Claude Opus 4.5",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-05-30",releaseDate:"2025-11-24",lastUpdated:"2025-11-24",openWeights:!1,cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},limit:{context:2e5,output:32e3}},{id:"anthropic/claude-sonnet-4",label:"Claude Sonnet 4",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-03-31",releaseDate:"2025-05-22",lastUpdated:"2025-05-22",openWeights:!1,cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},limit:{context:2e5,output:64e3}},{id:"anthropic/claude-sonnet-4.5",label:"Claude Sonnet 4.5",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-07-31",releaseDate:"2025-09-29",lastUpdated:"2025-09-29",openWeights:!1,cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},limit:{context:1e6,output:64e3}},{id:"cognitivecomputations/dolphin3.0-mistral-24b",label:"Dolphin3.0 Mistral 24B",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-02-13",lastUpdated:"2025-02-13",openWeights:!0,cost:{input:0,output:0},limit:{context:32768,output:8192}},{id:"cognitivecomputations/dolphin3.0-r1-mistral-24b",label:"Dolphin3.0 R1 Mistral 24B",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-02-13",lastUpdated:"2025-02-13",openWeights:!0,cost:{input:0,output:0},limit:{context:32768,output:8192}},{id:"deepseek/deepseek-chat-v3-0324",label:"DeepSeek V3 0324",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-03-24",lastUpdated:"2025-03-24",openWeights:!0,cost:{input:0,output:0},limit:{context:16384,output:8192}},{id:"deepseek/deepseek-chat-v3.1",label:"DeepSeek-V3.1",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-07",releaseDate:"2025-08-21",lastUpdated:"2025-08-21",openWeights:!0,cost:{input:.2,output:.8},limit:{context:163840,output:163840}},{id:"deepseek/deepseek-r1-0528-qwen3-8b:free",label:"Deepseek R1 0528 Qwen3 8B (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-05",releaseDate:"2025-05-29",lastUpdated:"2025-05-29",openWeights:!0,cost:{input:0,output:0},limit:{context:131072,output:131072}},{id:"deepseek/deepseek-r1-0528:free",label:"R1 0528 (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-05",releaseDate:"2025-05-28",lastUpdated:"2025-05-28",openWeights:!0,cost:{input:0,output:0},limit:{context:163840,output:163840}},{id:"deepseek/deepseek-r1-distill-llama-70b",label:"DeepSeek R1 Distill Llama 70B",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-01-23",lastUpdated:"2025-01-23",openWeights:!0,cost:{input:0,output:0},limit:{context:8192,output:8192}},{id:"deepseek/deepseek-r1-distill-qwen-14b",label:"DeepSeek R1 Distill Qwen 14B",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-01-29",lastUpdated:"2025-01-29",openWeights:!0,cost:{input:0,output:0},limit:{context:64e3,output:8192}},{id:"deepseek/deepseek-r1:free",label:"R1 (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-01",releaseDate:"2025-01-20",lastUpdated:"2025-01-20",openWeights:!0,cost:{input:0,output:0},limit:{context:163840,output:163840}},{id:"deepseek/deepseek-v3-base:free",label:"DeepSeek V3 Base (free)",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-03",releaseDate:"2025-03-29",lastUpdated:"2025-03-29",openWeights:!0,cost:{input:0,output:0},limit:{context:163840,output:163840}},{id:"deepseek/deepseek-v3.1-terminus",label:"DeepSeek V3.1 Terminus",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-07",releaseDate:"2025-09-22",lastUpdated:"2025-09-22",openWeights:!0,cost:{input:.27,output:1},limit:{context:131072,output:65536}},{id:"deepseek/deepseek-v3.1-terminus:exacto",label:"DeepSeek V3.1 Terminus (exacto)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-07",releaseDate:"2025-09-22",lastUpdated:"2025-09-22",openWeights:!0,cost:{input:.27,output:1},limit:{context:131072,output:65536}},{id:"deepseek/deepseek-v3.2",label:"DeepSeek V3.2",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-07",releaseDate:"2025-12-01",lastUpdated:"2025-12-01",openWeights:!0,cost:{input:.28,output:.4},limit:{context:163840,output:65536},provider:{npm:"@openrouter/ai-sdk-provider"}},{id:"deepseek/deepseek-v3.2-speciale",label:"DeepSeek V3.2 Speciale",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-07",releaseDate:"2025-12-01",lastUpdated:"2025-12-01",openWeights:!0,cost:{input:.27,output:.41},limit:{context:163840,output:65536},provider:{npm:"@openrouter/ai-sdk-provider"}},{id:"featherless/qwerky-72b",label:"Qwerky 72B",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-03-20",lastUpdated:"2025-03-20",openWeights:!0,cost:{input:0,output:0},limit:{context:32768,output:8192}},{id:"google/gemini-2.0-flash-001",label:"Gemini 2.0 Flash",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-06",releaseDate:"2024-12-11",lastUpdated:"2024-12-11",openWeights:!1,cost:{input:.1,output:.4,cacheRead:.025},limit:{context:1048576,output:8192}},{id:"google/gemini-2.0-flash-exp:free",label:"Gemini 2.0 Flash Experimental (free)",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-12",releaseDate:"2024-12-11",lastUpdated:"2024-12-11",openWeights:!1,cost:{input:0,output:0},limit:{context:1048576,output:1048576}},{id:"google/gemini-2.5-flash",label:"Gemini 2.5 Flash",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-07-17",lastUpdated:"2025-07-17",openWeights:!1,cost:{input:.3,output:2.5,cacheRead:.0375},limit:{context:1048576,output:65536}},{id:"google/gemini-2.5-flash-lite",label:"Gemini 2.5 Flash Lite",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-06-17",lastUpdated:"2025-06-17",openWeights:!1,cost:{input:.1,output:.4,cacheRead:.025},limit:{context:1048576,output:65536}},{id:"google/gemini-2.5-flash-lite-preview-09-2025",label:"Gemini 2.5 Flash Lite Preview 09-25",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-09-25",lastUpdated:"2025-09-25",openWeights:!1,cost:{input:.1,output:.4,cacheRead:.025},limit:{context:1048576,output:65536}},{id:"google/gemini-2.5-flash-preview-09-2025",label:"Gemini 2.5 Flash Preview 09-25",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-09-25",lastUpdated:"2025-09-25",openWeights:!1,cost:{input:.3,output:2.5,cacheRead:.031},limit:{context:1048576,output:65536}},{id:"google/gemini-2.5-pro",label:"Gemini 2.5 Pro",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-03-20",lastUpdated:"2025-06-05",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.31},limit:{context:1048576,output:65536}},{id:"google/gemini-2.5-pro-preview-05-06",label:"Gemini 2.5 Pro Preview 05-06",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-05-06",lastUpdated:"2025-05-06",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.31},limit:{context:1048576,output:65536}},{id:"google/gemini-2.5-pro-preview-06-05",label:"Gemini 2.5 Pro Preview 06-05",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-06-05",lastUpdated:"2025-06-05",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.31},limit:{context:1048576,output:65536}},{id:"google/gemini-3-flash-preview",label:"Gemini 3 Flash Preview",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-12-17",lastUpdated:"2025-12-17",openWeights:!1,cost:{input:.5,output:3,cacheRead:.05},limit:{context:1048576,output:65536},provider:{npm:"@openrouter/ai-sdk-provider"}},{id:"google/gemini-3-pro-preview",label:"Gemini 3 Pro Preview",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-11-18",lastUpdated:"2025-11",openWeights:!1,cost:{input:2,output:12},limit:{context:105e4,output:66e3},provider:{npm:"@openrouter/ai-sdk-provider"}},{id:"google/gemma-2-9b-it:free",label:"Gemma 2 9B (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-06",releaseDate:"2024-06-28",lastUpdated:"2024-06-28",openWeights:!0,cost:{input:0,output:0},limit:{context:8192,output:8192}},{id:"google/gemma-3-12b-it",label:"Gemma 3 12B IT",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-10",releaseDate:"2025-03-13",lastUpdated:"2025-03-13",openWeights:!0,cost:{input:0,output:0},limit:{context:96e3,output:8192}},{id:"google/gemma-3-27b-it",label:"Gemma 3 27B IT",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-10",releaseDate:"2025-03-12",lastUpdated:"2025-03-12",openWeights:!0,cost:{input:0,output:0},limit:{context:96e3,output:8192}},{id:"google/gemma-3n-e4b-it",label:"Gemma 3n E4B IT",modalities:{input:["text","image","audio"],output:["text"]},toolCall:!1,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-10",releaseDate:"2025-05-20",lastUpdated:"2025-05-20",openWeights:!0,cost:{input:0,output:0},limit:{context:8192,output:8192}},{id:"google/gemma-3n-e4b-it:free",label:"Gemma 3n 4B (free)",modalities:{input:["text","image","audio"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2025-05",releaseDate:"2025-05-20",lastUpdated:"2025-05-20",openWeights:!0,cost:{input:0,output:0},limit:{context:8192,output:8192}},{id:"kwaipilot/kat-coder-pro:free",label:"Kat Coder Pro (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-11",releaseDate:"2025-11-10",lastUpdated:"2025-11-10",openWeights:!1,cost:{input:0,output:0},limit:{context:256e3,output:65536}},{id:"meta-llama/llama-3.2-11b-vision-instruct",label:"Llama 3.2 11B Vision Instruct",modalities:{input:["text","image"],output:["text"]},toolCall:!1,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2023-12",releaseDate:"2024-09-25",lastUpdated:"2024-09-25",openWeights:!0,cost:{input:0,output:0},limit:{context:131072,output:8192}},{id:"meta-llama/llama-3.3-70b-instruct:free",label:"Llama 3.3 70B Instruct (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-12",releaseDate:"2024-12-06",lastUpdated:"2024-12-06",openWeights:!0,cost:{input:0,output:0},limit:{context:65536,output:65536}},{id:"meta-llama/llama-4-scout:free",label:"Llama 4 Scout (free)",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-08",releaseDate:"2025-04-05",lastUpdated:"2025-04-05",openWeights:!0,cost:{input:0,output:0},limit:{context:64e3,output:64e3}},{id:"microsoft/mai-ds-r1:free",label:"MAI DS R1 (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-04-21",lastUpdated:"2025-04-21",openWeights:!0,cost:{input:0,output:0},limit:{context:163840,output:163840}},{id:"minimax/minimax-01",label:"MiniMax-01",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,releaseDate:"2025-01-15",lastUpdated:"2025-01-15",openWeights:!0,cost:{input:.2,output:1.1},limit:{context:1e6,output:1e6}},{id:"minimax/minimax-m1",label:"MiniMax M1",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,releaseDate:"2025-06-17",lastUpdated:"2025-06-17",openWeights:!0,cost:{input:.4,output:2.2},limit:{context:1e6,output:4e4}},{id:"minimax/minimax-m2",label:"MiniMax M2",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,releaseDate:"2025-10-23",lastUpdated:"2025-10-23",openWeights:!0,cost:{input:.28,output:1.15,cacheRead:.28,cacheWrite:1.15},limit:{context:196600,output:118e3},provider:{npm:"@openrouter/ai-sdk-provider"}},{id:"minimax/minimax-m2.1",label:"MiniMax M2.1",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,releaseDate:"2025-12-23",lastUpdated:"2025-12-23",openWeights:!0,cost:{input:.3,output:1.2},limit:{context:204800,output:131072},provider:{npm:"@openrouter/ai-sdk-provider"}},{id:"mistralai/codestral-2508",label:"Codestral 2508",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-05",releaseDate:"2025-08-01",lastUpdated:"2025-08-01",openWeights:!0,cost:{input:.3,output:.9},limit:{context:256e3,output:256e3}},{id:"mistralai/devstral-2512",label:"Devstral 2 2512",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-12",releaseDate:"2025-09-12",lastUpdated:"2025-09-12",openWeights:!0,cost:{input:.15,output:.6},limit:{context:262144,output:262144}},{id:"mistralai/devstral-2512:free",label:"Devstral 2 2512 (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-12",releaseDate:"2025-09-12",lastUpdated:"2025-09-12",openWeights:!0,cost:{input:0,output:0},limit:{context:262144,output:262144}},{id:"mistralai/devstral-medium-2507",label:"Devstral Medium",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-05",releaseDate:"2025-07-10",lastUpdated:"2025-07-10",openWeights:!0,cost:{input:.4,output:2},limit:{context:131072,output:131072}},{id:"mistralai/devstral-small-2505",label:"Devstral Small",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-05",releaseDate:"2025-05-07",lastUpdated:"2025-05-07",openWeights:!0,cost:{input:.06,output:.12},limit:{context:128e3,output:128e3}},{id:"mistralai/devstral-small-2505:free",label:"Devstral Small 2505 (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-05",releaseDate:"2025-05-21",lastUpdated:"2025-05-21",openWeights:!0,cost:{input:0,output:0},limit:{context:32768,output:32768}},{id:"mistralai/devstral-small-2507",label:"Devstral Small 1.1",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-05",releaseDate:"2025-07-10",lastUpdated:"2025-07-10",openWeights:!0,cost:{input:.1,output:.3},limit:{context:131072,output:131072}},{id:"mistralai/mistral-7b-instruct:free",label:"Mistral 7B Instruct (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-05",releaseDate:"2024-05-27",lastUpdated:"2024-05-27",openWeights:!0,cost:{input:0,output:0},limit:{context:32768,output:32768}},{id:"mistralai/mistral-medium-3",label:"Mistral Medium 3",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2025-05",releaseDate:"2025-05-07",lastUpdated:"2025-05-07",openWeights:!1,cost:{input:.4,output:2},limit:{context:131072,output:131072}},{id:"mistralai/mistral-medium-3.1",label:"Mistral Medium 3.1",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2025-05",releaseDate:"2025-08-12",lastUpdated:"2025-08-12",openWeights:!1,cost:{input:.4,output:2},limit:{context:262144,output:262144}},{id:"mistralai/mistral-nemo:free",label:"Mistral Nemo (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-07",releaseDate:"2024-07-19",lastUpdated:"2024-07-19",openWeights:!0,cost:{input:0,output:0},limit:{context:131072,output:131072}},{id:"mistralai/mistral-small-3.1-24b-instruct",label:"Mistral Small 3.1 24B Instruct",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-10",releaseDate:"2025-03-17",lastUpdated:"2025-03-17",openWeights:!0,cost:{input:0,output:0},limit:{context:128e3,output:8192}},{id:"mistralai/mistral-small-3.2-24b-instruct",label:"Mistral Small 3.2 24B Instruct",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-10",releaseDate:"2025-06-20",lastUpdated:"2025-06-20",openWeights:!0,cost:{input:0,output:0},limit:{context:96e3,output:8192}},{id:"mistralai/mistral-small-3.2-24b-instruct:free",label:"Mistral Small 3.2 24B (free)",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2025-06",releaseDate:"2025-06-20",lastUpdated:"2025-06-20",openWeights:!0,cost:{input:0,output:0},limit:{context:96e3,output:96e3}},{id:"moonshotai/kimi-dev-72b:free",label:"Kimi Dev 72b (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-06",releaseDate:"2025-06-16",lastUpdated:"2025-06-16",openWeights:!0,cost:{input:0,output:0},limit:{context:131072,output:131072}},{id:"moonshotai/kimi-k2",label:"Kimi K2",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-07-11",lastUpdated:"2025-07-11",openWeights:!0,cost:{input:.55,output:2.2},limit:{context:131072,output:32768}},{id:"moonshotai/kimi-k2-0905",label:"Kimi K2 Instruct 0905",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-09-05",lastUpdated:"2025-09-05",openWeights:!0,cost:{input:.6,output:2.5},limit:{context:262144,output:16384}},{id:"moonshotai/kimi-k2-0905:exacto",label:"Kimi K2 Instruct 0905 (exacto)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-09-05",lastUpdated:"2025-09-05",openWeights:!0,cost:{input:.6,output:2.5},limit:{context:262144,output:16384}},{id:"moonshotai/kimi-k2-thinking",label:"Kimi K2 Thinking",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-08",releaseDate:"2025-11-06",lastUpdated:"2025-11-06",openWeights:!0,cost:{input:.6,output:2.5,cacheRead:.15},limit:{context:262144,output:262144},provider:{npm:"@openrouter/ai-sdk-provider"}},{id:"moonshotai/kimi-k2:free",label:"Kimi K2 (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-11",lastUpdated:"2025-07-11",openWeights:!0,cost:{input:0,output:0},limit:{context:32800,output:32800}},{id:"moonshotai/kimi-k2.5",label:"Kimi K2.5",modalities:{input:["text","image","video"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2026-01-27",lastUpdated:"2026-01-27",openWeights:!0,cost:{input:.6,output:3,cacheRead:.1},limit:{context:262144,output:262144},provider:{npm:"@openrouter/ai-sdk-provider"}},{id:"nousresearch/deephermes-3-llama-3-8b-preview",label:"DeepHermes 3 Llama 3 8B Preview",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-04",releaseDate:"2025-02-28",lastUpdated:"2025-02-28",openWeights:!0,cost:{input:0,output:0},limit:{context:131072,output:8192}},{id:"nousresearch/hermes-4-405b",label:"Hermes 4 405B",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2023-12",releaseDate:"2025-08-25",lastUpdated:"2025-08-25",openWeights:!0,cost:{input:1,output:3},limit:{context:131072,output:131072}},{id:"nousresearch/hermes-4-70b",label:"Hermes 4 70B",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2023-12",releaseDate:"2025-08-25",lastUpdated:"2025-08-25",openWeights:!0,cost:{input:.13,output:.4},limit:{context:131072,output:131072}},{id:"nvidia/nemotron-nano-9b-v2",label:"nvidia-nemotron-nano-9b-v2",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-09",releaseDate:"2025-08-18",lastUpdated:"2025-08-18",openWeights:!0,cost:{input:.04,output:.16},limit:{context:131072,output:131072}},{id:"openai/gpt-4.1",label:"GPT-4.1",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-04",releaseDate:"2025-04-14",lastUpdated:"2025-04-14",openWeights:!1,cost:{input:2,output:8,cacheRead:.5},limit:{context:1047576,output:32768}},{id:"openai/gpt-4.1-mini",label:"GPT-4.1 Mini",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-04",releaseDate:"2025-04-14",lastUpdated:"2025-04-14",openWeights:!1,cost:{input:.4,output:1.6,cacheRead:.1},limit:{context:1047576,output:32768}},{id:"openai/gpt-4o-mini",label:"GPT-4o-mini",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-10",releaseDate:"2024-07-18",lastUpdated:"2024-07-18",openWeights:!1,cost:{input:.15,output:.6,cacheRead:.08},limit:{context:128e3,output:16384}},{id:"openai/gpt-5",label:"GPT-5",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-10-01",releaseDate:"2025-08-07",lastUpdated:"2025-08-07",openWeights:!1,cost:{input:1.25,output:10},limit:{context:4e5,output:128e3}},{id:"openai/gpt-5-chat",label:"GPT-5 Chat (latest)",modalities:{input:["text","image"],output:["text"]},toolCall:!1,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-09-30",releaseDate:"2025-08-07",lastUpdated:"2025-08-07",openWeights:!1,cost:{input:1.25,output:10},limit:{context:4e5,output:128e3}},{id:"openai/gpt-5-codex",label:"GPT-5 Codex",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-10-01",releaseDate:"2025-09-15",lastUpdated:"2025-09-15",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.125},limit:{context:4e5,output:128e3}},{id:"openai/gpt-5-image",label:"GPT-5 Image",modalities:{input:["text","image","pdf"],output:["text","image"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-10-01",releaseDate:"2025-10-14",lastUpdated:"2025-10-14",openWeights:!1,cost:{input:5,output:10,cacheRead:1.25},limit:{context:4e5,output:128e3}},{id:"openai/gpt-5-mini",label:"GPT-5 Mini",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-10-01",releaseDate:"2025-08-07",lastUpdated:"2025-08-07",openWeights:!1,cost:{input:.25,output:2},limit:{context:4e5,output:128e3}},{id:"openai/gpt-5-nano",label:"GPT-5 Nano",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-10-01",releaseDate:"2025-08-07",lastUpdated:"2025-08-07",openWeights:!1,cost:{input:.05,output:.4},limit:{context:4e5,output:128e3}},{id:"openai/gpt-5-pro",label:"GPT-5 Pro",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-10-06",lastUpdated:"2025-10-06",openWeights:!1,cost:{input:15,output:120},limit:{context:4e5,output:272e3}},{id:"openai/gpt-5.1",label:"GPT-5.1",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-09-30",releaseDate:"2025-11-13",lastUpdated:"2025-11-13",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.125},limit:{context:4e5,output:128e3}},{id:"openai/gpt-5.1-chat",label:"GPT-5.1 Chat",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-09-30",releaseDate:"2025-11-13",lastUpdated:"2025-11-13",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.125},limit:{context:128e3,output:16384}},{id:"openai/gpt-5.1-codex",label:"GPT-5.1-Codex",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-09-30",releaseDate:"2025-11-13",lastUpdated:"2025-11-13",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.125},limit:{context:4e5,output:128e3}},{id:"openai/gpt-5.1-codex-max",label:"GPT-5.1-Codex-Max",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-09-30",releaseDate:"2025-11-13",lastUpdated:"2025-11-13",openWeights:!1,cost:{input:1.1,output:9,cacheRead:.11},limit:{context:4e5,output:128e3}},{id:"openai/gpt-5.1-codex-mini",label:"GPT-5.1-Codex-Mini",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-09-30",releaseDate:"2025-11-13",lastUpdated:"2025-11-13",openWeights:!1,cost:{input:.25,output:2,cacheRead:.025},limit:{context:4e5,output:1e5}},{id:"openai/gpt-5.2",label:"GPT-5.2",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2025-08-31",releaseDate:"2025-12-11",lastUpdated:"2025-12-11",openWeights:!1,cost:{input:1.75,output:14,cacheRead:.175},limit:{context:4e5,output:128e3}},{id:"openai/gpt-5.2-chat-latest",label:"GPT-5.2 Chat",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2025-08-31",releaseDate:"2025-12-11",lastUpdated:"2025-12-11",openWeights:!1,cost:{input:1.75,output:14,cacheRead:.175},limit:{context:128e3,output:16384}},{id:"openai/gpt-5.2-codex",label:"GPT-5.2-Codex",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-08-31",releaseDate:"2026-01-14",lastUpdated:"2026-01-14",openWeights:!1,cost:{input:1.75,output:14,cacheRead:.175},limit:{context:4e5,output:128e3}},{id:"openai/gpt-5.2-pro",label:"GPT-5.2 Pro",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2025-08-31",releaseDate:"2025-12-11",lastUpdated:"2025-12-11",openWeights:!1,cost:{input:21,output:168},limit:{context:4e5,output:128e3}},{id:"openai/gpt-oss-120b",label:"GPT OSS 120B",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,releaseDate:"2025-08-05",lastUpdated:"2025-08-05",openWeights:!0,cost:{input:.072,output:.28},limit:{context:131072,output:32768}},{id:"openai/gpt-oss-120b:exacto",label:"GPT OSS 120B (exacto)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,releaseDate:"2025-08-05",lastUpdated:"2025-08-05",openWeights:!0,cost:{input:.05,output:.24},limit:{context:131072,output:32768}},{id:"openai/gpt-oss-20b",label:"GPT OSS 20B",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,releaseDate:"2025-08-05",lastUpdated:"2025-08-05",openWeights:!0,cost:{input:.05,output:.2},limit:{context:131072,output:32768}},{id:"openai/gpt-oss-safeguard-20b",label:"GPT OSS Safeguard 20B",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,releaseDate:"2025-10-29",lastUpdated:"2025-10-29",openWeights:!1,cost:{input:.075,output:.3},limit:{context:131072,output:65536}},{id:"openai/o4-mini",label:"o4 Mini",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-06",releaseDate:"2025-04-16",lastUpdated:"2025-04-16",openWeights:!1,cost:{input:1.1,output:4.4,cacheRead:.28},limit:{context:2e5,output:1e5}},{id:"openrouter/sherlock-dash-alpha",label:"Sherlock Dash Alpha",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2025-11",releaseDate:"2025-11-15",lastUpdated:"2025-12-14",openWeights:!1,cost:{input:0,output:0},limit:{context:184e4,output:0}},{id:"openrouter/sherlock-think-alpha",label:"Sherlock Think Alpha",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-11",releaseDate:"2025-11-15",lastUpdated:"2025-12-14",openWeights:!1,cost:{input:0,output:0},limit:{context:184e4,output:0}},{id:"qwen/qwen-2.5-coder-32b-instruct",label:"Qwen2.5 Coder 32B Instruct",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2024-11-11",lastUpdated:"2024-11-11",openWeights:!0,cost:{input:0,output:0},limit:{context:32768,output:8192}},{id:"qwen/qwen2.5-vl-32b-instruct:free",label:"Qwen2.5 VL 32B Instruct (free)",modalities:{input:["text","image","video"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2025-03",releaseDate:"2025-03-24",lastUpdated:"2025-03-24",openWeights:!0,cost:{input:0,output:0},limit:{context:8192,output:8192}},{id:"qwen/qwen2.5-vl-72b-instruct",label:"Qwen2.5 VL 72B Instruct",modalities:{input:["text","image"],output:["text"]},toolCall:!1,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-10",releaseDate:"2025-02-01",lastUpdated:"2025-02-01",openWeights:!0,cost:{input:0,output:0},limit:{context:32768,output:8192}},{id:"qwen/qwen2.5-vl-72b-instruct:free",label:"Qwen2.5 VL 72B Instruct (free)",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2025-02",releaseDate:"2025-02-01",lastUpdated:"2025-02-01",openWeights:!0,cost:{input:0,output:0},limit:{context:32768,output:32768}},{id:"qwen/qwen3-14b:free",label:"Qwen3 14B (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-04-28",lastUpdated:"2025-04-28",openWeights:!0,cost:{input:0,output:0},limit:{context:40960,output:40960}},{id:"qwen/qwen3-235b-a22b-07-25",label:"Qwen3 235B A22B Instruct 2507",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-04-28",lastUpdated:"2025-07-21",openWeights:!0,cost:{input:.15,output:.85},limit:{context:262144,output:131072}},{id:"qwen/qwen3-235b-a22b-07-25:free",label:"Qwen3 235B A22B Instruct 2507 (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-04-28",lastUpdated:"2025-07-21",openWeights:!0,cost:{input:0,output:0},limit:{context:262144,output:131072}},{id:"qwen/qwen3-235b-a22b-thinking-2507",label:"Qwen3 235B A22B Thinking 2507",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-25",lastUpdated:"2025-07-25",openWeights:!0,cost:{input:.078,output:.312},limit:{context:262144,output:81920}},{id:"qwen/qwen3-235b-a22b:free",label:"Qwen3 235B A22B (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-04-28",lastUpdated:"2025-04-28",openWeights:!0,cost:{input:0,output:0},limit:{context:131072,output:131072}},{id:"qwen/qwen3-30b-a3b-instruct-2507",label:"Qwen3 30B A3B Instruct 2507",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-29",lastUpdated:"2025-07-29",openWeights:!0,cost:{input:.2,output:.8},limit:{context:262e3,output:262e3}},{id:"qwen/qwen3-30b-a3b-thinking-2507",label:"Qwen3 30B A3B Thinking 2507",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-29",lastUpdated:"2025-07-29",openWeights:!0,cost:{input:.2,output:.8},limit:{context:262e3,output:262e3}},{id:"qwen/qwen3-30b-a3b:free",label:"Qwen3 30B A3B (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-04-28",lastUpdated:"2025-04-28",openWeights:!0,cost:{input:0,output:0},limit:{context:40960,output:40960}},{id:"qwen/qwen3-32b:free",label:"Qwen3 32B (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-04-28",lastUpdated:"2025-04-28",openWeights:!0,cost:{input:0,output:0},limit:{context:40960,output:40960}},{id:"qwen/qwen3-8b:free",label:"Qwen3 8B (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-04-28",lastUpdated:"2025-04-28",openWeights:!0,cost:{input:0,output:0},limit:{context:40960,output:40960}},{id:"qwen/qwen3-coder",label:"Qwen3 Coder",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-23",lastUpdated:"2025-07-23",openWeights:!0,cost:{input:.3,output:1.2},limit:{context:262144,output:66536}},{id:"qwen/qwen3-coder-30b-a3b-instruct",label:"Qwen3 Coder 30B A3B Instruct",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-31",lastUpdated:"2025-07-31",openWeights:!0,cost:{input:.07,output:.27},limit:{context:16e4,output:65536}},{id:"qwen/qwen3-coder-flash",label:"Qwen3 Coder Flash",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-23",lastUpdated:"2025-07-23",openWeights:!1,cost:{input:.3,output:1.5},limit:{context:128e3,output:66536}},{id:"qwen/qwen3-coder:exacto",label:"Qwen3 Coder (exacto)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-23",lastUpdated:"2025-07-23",openWeights:!0,cost:{input:.38,output:1.53},limit:{context:131072,output:32768}},{id:"qwen/qwen3-coder:free",label:"Qwen3 Coder 480B A35B Instruct (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-23",lastUpdated:"2025-07-23",openWeights:!0,cost:{input:0,output:0},limit:{context:262144,output:66536}},{id:"qwen/qwen3-max",label:"Qwen3 Max",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,releaseDate:"2025-09-05",lastUpdated:"2025-09-05",openWeights:!1,cost:{input:1.2,output:6},limit:{context:262144,output:32768}},{id:"qwen/qwen3-next-80b-a3b-instruct",label:"Qwen3 Next 80B A3B Instruct",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-09-11",lastUpdated:"2025-09-11",openWeights:!0,cost:{input:.14,output:1.4},limit:{context:262144,output:262144}},{id:"qwen/qwen3-next-80b-a3b-thinking",label:"Qwen3 Next 80B A3B Thinking",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-09-11",lastUpdated:"2025-09-11",openWeights:!0,cost:{input:.14,output:1.4},limit:{context:262144,output:262144}},{id:"qwen/qwq-32b:free",label:"QwQ 32B (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-03",releaseDate:"2025-03-05",lastUpdated:"2025-03-05",openWeights:!0,cost:{input:0,output:0},limit:{context:32768,output:32768}},{id:"rekaai/reka-flash-3",label:"Reka Flash 3",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-03-12",lastUpdated:"2025-03-12",openWeights:!0,cost:{input:0,output:0},limit:{context:32768,output:8192}},{id:"sarvamai/sarvam-m:free",label:"Sarvam-M (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-05",releaseDate:"2025-05-25",lastUpdated:"2025-05-25",openWeights:!0,cost:{input:0,output:0},limit:{context:32768,output:32768}},{id:"thudm/glm-z1-32b:free",label:"GLM Z1 32B (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-04-17",lastUpdated:"2025-04-17",openWeights:!0,cost:{input:0,output:0},limit:{context:32768,output:32768}},{id:"tngtech/deepseek-r1t2-chimera:free",label:"DeepSeek R1T2 Chimera (free)",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-07",releaseDate:"2025-07-08",lastUpdated:"2025-07-08",openWeights:!0,cost:{input:0,output:0},limit:{context:163840,output:163840}},{id:"x-ai/grok-3",label:"Grok 3",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-11",releaseDate:"2025-02-17",lastUpdated:"2025-02-17",openWeights:!1,cost:{input:3,output:15,cacheRead:.75,cacheWrite:15},limit:{context:131072,output:8192}},{id:"x-ai/grok-3-beta",label:"Grok 3 Beta",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-11",releaseDate:"2025-02-17",lastUpdated:"2025-02-17",openWeights:!1,cost:{input:3,output:15,cacheRead:.75,cacheWrite:15},limit:{context:131072,output:8192}},{id:"x-ai/grok-3-mini",label:"Grok 3 Mini",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-11",releaseDate:"2025-02-17",lastUpdated:"2025-02-17",openWeights:!1,cost:{input:.3,output:.5,cacheRead:.075,cacheWrite:.5},limit:{context:131072,output:8192}},{id:"x-ai/grok-3-mini-beta",label:"Grok 3 Mini Beta",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-11",releaseDate:"2025-02-17",lastUpdated:"2025-02-17",openWeights:!1,cost:{input:.3,output:.5,cacheRead:.075,cacheWrite:.5},limit:{context:131072,output:8192}},{id:"x-ai/grok-4",label:"Grok 4",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-07",releaseDate:"2025-07-09",lastUpdated:"2025-07-09",openWeights:!1,cost:{input:3,output:15,cacheRead:.75,cacheWrite:15},limit:{context:256e3,output:64e3}},{id:"x-ai/grok-4-fast",label:"Grok 4 Fast",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-11",releaseDate:"2025-08-19",lastUpdated:"2025-08-19",openWeights:!1,cost:{input:.2,output:.5,cacheRead:.05,cacheWrite:.05},limit:{context:2e6,output:3e4}},{id:"x-ai/grok-4.1-fast",label:"Grok 4.1 Fast",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-11",releaseDate:"2025-11-19",lastUpdated:"2025-11-19",openWeights:!1,cost:{input:.2,output:.5,cacheRead:.05,cacheWrite:.05},limit:{context:2e6,output:3e4}},{id:"x-ai/grok-code-fast-1",label:"Grok Code Fast 1",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-08",releaseDate:"2025-08-26",lastUpdated:"2025-08-26",openWeights:!1,cost:{input:.2,output:1.5,cacheRead:.02},limit:{context:256e3,output:1e4}},{id:"z-ai/glm-4.5",label:"GLM 4.5",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-28",lastUpdated:"2025-07-28",openWeights:!0,cost:{input:.6,output:2.2},limit:{context:128e3,output:96e3}},{id:"z-ai/glm-4.5-air",label:"GLM 4.5 Air",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-28",lastUpdated:"2025-07-28",openWeights:!0,cost:{input:.2,output:1.1},limit:{context:128e3,output:96e3}},{id:"z-ai/glm-4.5-air:free",label:"GLM 4.5 Air (free)",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-28",lastUpdated:"2025-07-28",openWeights:!0,cost:{input:0,output:0},limit:{context:128e3,output:96e3}},{id:"z-ai/glm-4.5v",label:"GLM 4.5V",modalities:{input:["text","image","video"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-04",releaseDate:"2025-08-11",lastUpdated:"2025-08-11",openWeights:!0,cost:{input:.6,output:1.8},limit:{context:64e3,output:16384}},{id:"z-ai/glm-4.6",label:"GLM 4.6",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-09",releaseDate:"2025-09-30",lastUpdated:"2025-09-30",openWeights:!0,cost:{input:.6,output:2.2,cacheRead:.11},limit:{context:2e5,output:128e3}},{id:"z-ai/glm-4.6:exacto",label:"GLM 4.6 (exacto)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-09",releaseDate:"2025-09-30",lastUpdated:"2025-09-30",openWeights:!0,cost:{input:.6,output:1.9,cacheRead:.11},limit:{context:2e5,output:128e3}},{id:"z-ai/glm-4.7",label:"GLM-4.7",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-12-22",lastUpdated:"2025-12-22",openWeights:!0,cost:{input:.6,output:2.2,cacheRead:.11},limit:{context:204800,output:131072},provider:{npm:"@openrouter/ai-sdk-provider"}}],label:"OpenRouter",env:["OPENROUTER_API_KEY"],npm:"@ai-sdk/openai-compatible",api:"https://openrouter.ai/api/v1",doc:"https://openrouter.ai/models"},opencode:{id:"opencode",models:[{id:"big-pickle",label:"Big Pickle",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-01",releaseDate:"2025-10-17",lastUpdated:"2025-10-17",openWeights:!1,cost:{input:0,output:0,cacheRead:0,cacheWrite:0},limit:{context:2e5,output:128e3}},{id:"claude-3-5-haiku",label:"Claude Haiku 3.5",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-07-31",releaseDate:"2024-10-22",lastUpdated:"2024-10-22",openWeights:!1,cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},limit:{context:2e5,output:8192},provider:{npm:"@ai-sdk/anthropic"}},{id:"claude-haiku-4-5",label:"Claude Haiku 4.5",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-02-28",releaseDate:"2025-10-15",lastUpdated:"2025-10-15",openWeights:!1,cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},limit:{context:2e5,output:64e3},provider:{npm:"@ai-sdk/anthropic"}},{id:"claude-opus-4-1",label:"Claude Opus 4.1",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-03-31",releaseDate:"2025-08-05",lastUpdated:"2025-08-05",openWeights:!1,cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},limit:{context:2e5,output:32e3},provider:{npm:"@ai-sdk/anthropic"}},{id:"claude-opus-4-5",label:"Claude Opus 4.5",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-03-31",releaseDate:"2025-11-24",lastUpdated:"2025-11-24",openWeights:!1,cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},limit:{context:2e5,output:64e3},provider:{npm:"@ai-sdk/anthropic"}},{id:"claude-sonnet-4",label:"Claude Sonnet 4",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-03-31",releaseDate:"2025-05-22",lastUpdated:"2025-05-22",openWeights:!1,cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},limit:{context:1e6,output:64e3},provider:{npm:"@ai-sdk/anthropic"}},{id:"claude-sonnet-4-5",label:"Claude Sonnet 4.5",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-07-31",releaseDate:"2025-09-29",lastUpdated:"2025-09-29",openWeights:!1,cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},limit:{context:1e6,output:64e3},provider:{npm:"@ai-sdk/anthropic"}},{id:"gemini-3-flash",label:"Gemini 3 Flash",modalities:{input:["text","image","video","audio","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-12-17",lastUpdated:"2025-12-17",openWeights:!1,cost:{input:.5,output:3,cacheRead:.05},limit:{context:1048576,output:65536},provider:{npm:"@ai-sdk/google"}},{id:"gemini-3-pro",label:"Gemini 3 Pro",modalities:{input:["text","image","video","audio","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-11-18",lastUpdated:"2025-11-18",openWeights:!1,cost:{input:2,output:12,cacheRead:.2},limit:{context:1048576,output:65536},provider:{npm:"@ai-sdk/google"}},{id:"glm-4.6",label:"GLM-4.6",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-09-30",lastUpdated:"2025-09-30",openWeights:!0,cost:{input:.6,output:2.2,cacheRead:.1},limit:{context:204800,output:131072}},{id:"glm-4.7",label:"GLM-4.7",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-12-22",lastUpdated:"2025-12-22",openWeights:!0,cost:{input:.6,output:2.2,cacheRead:.1},limit:{context:204800,output:131072}},{id:"glm-4.7-free",label:"GLM-4.7",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-12-22",lastUpdated:"2025-12-22",openWeights:!0,cost:{input:0,output:0,cacheRead:0},limit:{context:204800,output:131072}},{id:"gpt-5",label:"GPT-5",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-08-07",lastUpdated:"2025-08-07",openWeights:!1,cost:{input:1.07,output:8.5,cacheRead:.107},limit:{context:4e5,output:128e3},provider:{npm:"@ai-sdk/openai"}},{id:"gpt-5-codex",label:"GPT-5 Codex",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-09-15",lastUpdated:"2025-09-15",openWeights:!1,cost:{input:1.07,output:8.5,cacheRead:.107},limit:{context:4e5,output:128e3},provider:{npm:"@ai-sdk/openai"}},{id:"gpt-5-nano",label:"GPT-5 Nano",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-05-30",releaseDate:"2025-08-07",lastUpdated:"2025-08-07",openWeights:!1,cost:{input:0,output:0,cacheRead:0},limit:{context:4e5,output:128e3},provider:{npm:"@ai-sdk/openai"}},{id:"gpt-5.1",label:"GPT-5.1",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-11-13",lastUpdated:"2025-11-13",openWeights:!1,cost:{input:1.07,output:8.5,cacheRead:.107},limit:{context:4e5,output:128e3},provider:{npm:"@ai-sdk/openai"}},{id:"gpt-5.1-codex",label:"GPT-5.1 Codex",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-11-13",lastUpdated:"2025-11-13",openWeights:!1,cost:{input:1.07,output:8.5,cacheRead:.107},limit:{context:4e5,output:128e3},provider:{npm:"@ai-sdk/openai"}},{id:"gpt-5.1-codex-max",label:"GPT-5.1 Codex Max",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-11-13",lastUpdated:"2025-11-13",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.125},limit:{context:4e5,output:128e3},provider:{npm:"@ai-sdk/openai"}},{id:"gpt-5.1-codex-mini",label:"GPT-5.1 Codex Mini",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-11-13",lastUpdated:"2025-11-13",openWeights:!1,cost:{input:.25,output:2,cacheRead:.025},limit:{context:4e5,output:128e3},provider:{npm:"@ai-sdk/openai"}},{id:"gpt-5.2",label:"GPT-5.2",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2025-08-31",releaseDate:"2025-12-11",lastUpdated:"2025-12-11",openWeights:!1,cost:{input:1.75,output:14,cacheRead:.175},limit:{context:4e5,output:128e3},provider:{npm:"@ai-sdk/openai"}},{id:"gpt-5.2-codex",label:"GPT-5.2 Codex",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2025-08-31",releaseDate:"2026-01-14",lastUpdated:"2026-01-14",openWeights:!1,cost:{input:1.75,output:14,cacheRead:.175},limit:{context:4e5,output:128e3},provider:{npm:"@ai-sdk/openai"}},{id:"grok-code",label:"Grok Code Fast 1",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,releaseDate:"2025-08-20",lastUpdated:"2025-08-20",openWeights:!1,cost:{input:0,output:0,cacheRead:0,cacheWrite:0},limit:{context:256e3,output:256e3}},{id:"kimi-k2",label:"Kimi K2",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-09-05",lastUpdated:"2025-09-05",openWeights:!0,cost:{input:.4,output:2.5,cacheRead:.4},limit:{context:262144,output:262144}},{id:"kimi-k2-thinking",label:"Kimi K2 Thinking",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-09-05",lastUpdated:"2025-09-05",openWeights:!0,cost:{input:.4,output:2.5,cacheRead:.4},limit:{context:262144,output:262144}},{id:"kimi-k2.5",label:"Kimi K2.5",modalities:{input:["text","image","video"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2026-01-27",lastUpdated:"2026-01-27",openWeights:!0,cost:{input:1.2,output:1.2,cacheRead:.6},limit:{context:262144,output:262144}},{id:"minimax-m2.1",label:"MiniMax M2.1",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-01",releaseDate:"2025-12-23",lastUpdated:"2025-12-23",openWeights:!0,cost:{input:.3,output:1.2,cacheRead:.1},limit:{context:204800,output:131072}},{id:"minimax-m2.1-free",label:"MiniMax M2.1",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-01",releaseDate:"2025-12-23",lastUpdated:"2025-12-23",openWeights:!0,cost:{input:0,output:0,cacheRead:0},limit:{context:204800,output:131072},provider:{npm:"@ai-sdk/anthropic"}},{id:"qwen3-coder",label:"Qwen3 Coder",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-23",lastUpdated:"2025-07-23",openWeights:!0,cost:{input:.45,output:1.8},limit:{context:262144,output:65536}}],label:"OpenCode Zen",env:["OPENCODE_API_KEY"],npm:"@ai-sdk/openai-compatible",api:"https://opencode.ai/zen/v1",doc:"https://opencode.ai/docs/zen"},zai:{id:"zai",models:[{id:"glm-4.5",label:"GLM-4.5",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-28",lastUpdated:"2025-07-28",openWeights:!0,cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},limit:{context:131072,output:98304}},{id:"glm-4.5-air",label:"GLM-4.5-Air",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-28",lastUpdated:"2025-07-28",openWeights:!0,cost:{input:.2,output:1.1,cacheRead:.03,cacheWrite:0},limit:{context:131072,output:98304}},{id:"glm-4.5-flash",label:"GLM-4.5-Flash",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-28",lastUpdated:"2025-07-28",openWeights:!0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0},limit:{context:131072,output:98304}},{id:"glm-4.5v",label:"GLM-4.5V",modalities:{input:["text","image","video"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-04",releaseDate:"2025-08-11",lastUpdated:"2025-08-11",openWeights:!0,cost:{input:.6,output:1.8},limit:{context:64e3,output:16384}},{id:"glm-4.6",label:"GLM-4.6",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-09-30",lastUpdated:"2025-09-30",openWeights:!0,cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},limit:{context:204800,output:131072}},{id:"glm-4.6v",label:"GLM-4.6V",modalities:{input:["text","image","video"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-04",releaseDate:"2025-12-08",lastUpdated:"2025-12-08",openWeights:!0,cost:{input:.3,output:.9},limit:{context:128e3,output:32768}},{id:"glm-4.7",label:"GLM-4.7",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-12-22",lastUpdated:"2025-12-22",openWeights:!0,cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},limit:{context:204800,output:131072}}],label:"Z.AI",env:["ZHIPU_API_KEY"],npm:"@ai-sdk/openai-compatible",api:"https://api.z.ai/api/paas/v4",doc:"https://docs.z.ai/guides/overview/pricing"},"zai-coding":{id:"zai-coding",models:[{id:"glm-4.5",label:"GLM-4.5",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-28",lastUpdated:"2025-07-28",openWeights:!0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0},limit:{context:131072,output:98304}},{id:"glm-4.5-air",label:"GLM-4.5-Air",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-28",lastUpdated:"2025-07-28",openWeights:!0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0},limit:{context:131072,output:98304}},{id:"glm-4.5-flash",label:"GLM-4.5-Flash",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-28",lastUpdated:"2025-07-28",openWeights:!0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0},limit:{context:131072,output:98304}},{id:"glm-4.5v",label:"GLM-4.5V",modalities:{input:["text","image","video"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-04",releaseDate:"2025-08-11",lastUpdated:"2025-08-11",openWeights:!0,cost:{input:0,output:0},limit:{context:64e3,output:16384}},{id:"glm-4.6",label:"GLM-4.6",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-09-30",lastUpdated:"2025-09-30",openWeights:!0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0},limit:{context:204800,output:131072}},{id:"glm-4.6v",label:"GLM-4.6V",modalities:{input:["text","image","video"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-04",releaseDate:"2025-12-08",lastUpdated:"2025-12-08",openWeights:!0,cost:{input:0,output:0},limit:{context:128e3,output:32768}},{id:"glm-4.7",label:"GLM-4.7",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-12-22",lastUpdated:"2025-12-22",openWeights:!0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0},limit:{context:204800,output:131072}},{id:"glm-4.7-flash",label:"GLM-4.7-Flash",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2026-01-19",lastUpdated:"2026-01-19",openWeights:!0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0},limit:{context:2e5,output:131072}}],label:"Z.AI Coding Plan",env:["ZHIPU_API_KEY"],npm:"@ai-sdk/openai-compatible",api:"https://api.z.ai/api/coding/paas/v4",doc:"https://docs.z.ai/devpack/overview"},moonshot:{id:"moonshot",models:[{id:"kimi-k2-0711-preview",label:"Kimi K2 0711",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-07-14",lastUpdated:"2025-07-14",openWeights:!0,cost:{input:.6,output:2.5,cacheRead:.15},limit:{context:131072,output:16384}},{id:"kimi-k2-0905-preview",label:"Kimi K2 0905",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-09-05",lastUpdated:"2025-09-05",openWeights:!0,cost:{input:.6,output:2.5,cacheRead:.15},limit:{context:262144,output:262144}},{id:"kimi-k2-thinking",label:"Kimi K2 Thinking",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-08",releaseDate:"2025-11-06",lastUpdated:"2025-11-06",openWeights:!0,cost:{input:.6,output:2.5,cacheRead:.15},limit:{context:262144,output:262144}},{id:"kimi-k2-thinking-turbo",label:"Kimi K2 Thinking Turbo",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-08",releaseDate:"2025-11-06",lastUpdated:"2025-11-06",openWeights:!0,cost:{input:1.15,output:8,cacheRead:.15},limit:{context:262144,output:262144}},{id:"kimi-k2-turbo-preview",label:"Kimi K2 Turbo",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-09-05",lastUpdated:"2025-09-05",openWeights:!0,cost:{input:2.4,output:10,cacheRead:.6},limit:{context:262144,output:262144}},{id:"kimi-k2.5",label:"Kimi K2.5",modalities:{input:["text","image","video"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-01",releaseDate:"2026-01",lastUpdated:"2026-01",openWeights:!0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0},limit:{context:262144,output:262144}}],label:"Moonshot AI",env:["MOONSHOT_API_KEY"],npm:"@ai-sdk/openai-compatible",api:"https://api.moonshot.ai/v1",doc:"https://platform.moonshot.ai/docs/api/chat"}},qT="setu",_AA=A=>!!(A==="codex-mini-latest"||A.startsWith("gpt-5")||A.includes("codex")),JAA=A=>!!(A.includes("-3-5-")||A.includes("-3.5-")||A.match(/claude-(haiku|sonnet|opus)-3/)||A.includes("-4-")||A.includes("-4.")||A.match(/claude-(haiku|sonnet|opus)-4/)),HAA=[{id:"openai",npm:"@ai-sdk/openai"},{id:"anthropic",npm:"@ai-sdk/anthropic"},{id:"moonshot",npm:"@ai-sdk/openai-compatible"}];function jAA(A){return{...A,modalities:A.modalities?{input:A.modalities.input?[...A.modalities.input]:void 0,output:A.modalities.output?[...A.modalities.output]:void 0}:void 0,cost:A.cost?{...A.cost}:void 0,limit:A.limit?{...A.limit}:void 0,provider:A.provider?{...A.provider}:void 0}}function YAA(A){const e=HAA.flatMap(({id:r,npm:o})=>(A[r]?.models??[]).filter(u=>r==="openai"?_AA(u.id):r==="anthropic"?JAA(u.id):!0).map(u=>{const E=jAA(u);return E.provider={...E.provider??{},npm:o},E}));if(!e.length)return null;e.sort((r,o)=>{const s=r.provider?.npm??"",g=o.provider?.npm??"";return s===g?r.id.localeCompare(o.id):s==="@ai-sdk/openai"?-1:g==="@ai-sdk/openai"?1:s.localeCompare(g)});const t="codex-mini-latest",n=e.findIndex(r=>r.id===t);if(n>0){const[r]=e.splice(n,1);e.unshift(r)}return{id:qT,label:"Setu",env:["SETU_PRIVATE_KEY"],api:"https://setu.agi.nitish.sh/v1",doc:"https://setu.agi.nitish.sh/docs",models:e}}function PAA(A){const e=YAA(A),t={...A};return e&&(t[qT]=e),t}const zAA=PAA(KAA),VAA={openai:[{match:A=>A.includes("gpt-4o-mini"),inputPerMillion:.15,outputPerMillion:.6},{match:A=>A.includes("gpt-4o"),inputPerMillion:5,outputPerMillion:15},{match:A=>A.includes("gpt-4.1-mini"),inputPerMillion:1,outputPerMillion:4},{match:A=>A.includes("gpt-4.1"),inputPerMillion:5,outputPerMillion:15}],anthropic:[{match:A=>A.includes("claude-3-haiku"),inputPerMillion:.25,outputPerMillion:1.25},{match:A=>A.includes("claude-3-sonnet"),inputPerMillion:3,outputPerMillion:15},{match:A=>A.includes("claude-3-opus"),inputPerMillion:15,outputPerMillion:75}],google:[{match:A=>A.includes("gemini-1.5-flash"),inputPerMillion:.35,outputPerMillion:1.05},{match:A=>A.includes("gemini-1.5-pro"),inputPerMillion:3.5,outputPerMillion:10.5}],openrouter:[],opencode:[],setu:[],zai:[],"zai-coding":[],moonshot:[]};function WAA(A,e){const t=VAA[A];if(t)return t.find(n=>{try{return n.match(e)}catch{return!1}})}function ZAA(A,e){const t=zAA[A];if(!t)return;const n=e.toLowerCase();return t.models.find(r=>r.id?.toLowerCase()===n)}function KT(A,e,t){const n=typeof t.inputTokens=="number"?t.inputTokens:0,r=typeof t.outputTokens=="number"?t.outputTokens:0,o=typeof t.cachedInputTokens=="number"?t.cachedInputTokens:0,s=typeof t.cacheCreationInputTokens=="number"?t.cacheCreationInputTokens:0;if(!n&&!r&&!o&&!s)return;const g=ZAA(A,e);if(g?.cost?.input!=null||g?.cost?.output!=null){const I=typeof g.cost?.input=="number"?g.cost.input:0,h=typeof g.cost?.output=="number"?g.cost.output:0,m=typeof g.cost?.cacheRead=="number"?g.cost.cacheRead:0,D=typeof g.cost?.cacheWrite=="number"?g.cost.cacheWrite:0,b=Math.max(0,n-o-s)*I/1e6,y=r*h/1e6,M=o*m/1e6,F=s*D/1e6,x=b+y+M+F;return Number.isFinite(x)?Number(x.toFixed(6)):void 0}const u=WAA(A,e.toLowerCase());if(!u)return;const Q=Math.max(0,n-o-s)*u.inputPerMillion/1e6,C=r*u.outputPerMillion/1e6,d=Q+C;return Number.isFinite(d)?Number(d.toFixed(6)):void 0}function XAA({session:A,onNavigateToSession:e}){const{data:t}=LT(A.sessionType==="branch"?A.id:void 0),{data:n}=mf(A.id),r=S.useMemo(()=>{const d=A.totalInputTokens||0,I=A.totalOutputTokens||0,h=A.totalCachedTokens||0,m=A.totalCacheCreationTokens||0;return KT(A.provider,A.model,{inputTokens:d,outputTokens:I,cachedInputTokens:h,cacheCreationInputTokens:m})??0},[A.provider,A.model,A.totalInputTokens,A.totalOutputTokens,A.totalCachedTokens,A.totalCacheCreationTokens]),o=d=>{if(!d)return"0s";const I=Math.floor(d/1e3),h=Math.floor(I/60),m=Math.floor(h/60);return m>0?`${m}h ${h%60}m`:h>0?`${h}m ${I%60}s`:`${I}s`},s=d=>d.toLocaleString("en-US"),g=d=>d>=1e6?`${(d/1e6).toFixed(1)}M`:d>=1e3?`${(d/1e3).toFixed(1)}K`:d.toString(),u=A.currentContextTokens||0,E=A.totalOutputTokens||0,Q=A.sessionType==="branch",C=t?.parent;return c.jsx("div",{className:"border-b border-border bg-background/95 backdrop-blur-sm",children:c.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-6",children:[Q&&c.jsxs("div",{className:"flex items-center gap-2 mb-3 text-sm",children:[c.jsx(Pt,{className:"h-4 w-4 text-violet-500"}),c.jsx("span",{className:"text-violet-600 dark:text-violet-400 font-medium",children:"Branch"}),C&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-muted-foreground",children:"from"}),c.jsxs("button",{type:"button",onClick:()=>e?.(C.id),className:"text-primary hover:underline flex items-center gap-1",children:[C.title||`Session ${C.id.slice(0,8)}`,c.jsx($1,{className:"h-3 w-3"})]})]}),!C&&A.parentSessionId&&c.jsx("span",{className:"text-muted-foreground italic text-xs",children:"(parent deleted)"})]}),c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("h1",{className:"text-2xl font-semibold text-foreground leading-tight truncate",children:A.title||"Untitled Session"}),n?.shared&&c.jsxs("button",{type:"button",onClick:()=>pf(n.url),className:"flex items-center gap-1.5 px-2 py-1 rounded-md bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 hover:bg-emerald-500/20 transition-colors text-xs font-medium flex-shrink-0",children:[c.jsx(of,{className:"h-3 w-3"}),c.jsx("span",{children:"Shared"}),n.pendingMessages&&n.pendingMessages>0?c.jsxs("span",{className:"flex items-center gap-0.5 text-amber-600 dark:text-amber-400",children:[c.jsx(Rn,{className:"h-2.5 w-2.5"}),n.pendingMessages]}):c.jsx(Yt,{className:"h-2.5 w-2.5 opacity-60"})]})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-x-5 gap-y-2 mt-4 text-sm text-muted-foreground",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsxs("div",{className:"flex items-center gap-1.5",title:`Current context window: ${s(u)} tokens`,children:[c.jsx("span",{className:"text-xs opacity-70",children:"ctx"}),c.jsx("span",{className:"font-medium text-foreground",children:g(u)})]}),c.jsxs("div",{className:"flex items-center gap-1.5",title:`Total output: ${s(E)} tokens`,children:[c.jsx("span",{className:"text-xs opacity-70",children:"out"}),c.jsx("span",{className:"font-medium text-foreground",children:g(E)})]})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(nR,{className:"w-4 h-4"}),c.jsx("span",{className:"font-medium text-foreground",children:o(A.totalToolTimeMs)})]}),r>0&&c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx(aR,{className:"w-4 h-4"}),c.jsx("span",{className:"font-medium text-foreground",children:r.toFixed(4)})]}),c.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[c.jsx(dn,{provider:A.provider,size:18}),c.jsx("span",{className:"font-medium text-foreground truncate max-w-48",children:A.model})]})]})]})})}function $AA({session:A,isVisible:e,isGenerating:t,onNavigateToSession:n}){const{data:r}=LT(A.sessionType==="branch"?A.id:void 0),{data:o}=mf(A.id),s=S.useMemo(()=>{const C=A.totalInputTokens||0,d=A.totalOutputTokens||0,I=A.totalCachedTokens||0,h=A.totalCacheCreationTokens||0;return KT(A.provider,A.model,{inputTokens:C,outputTokens:d,cachedInputTokens:I,cacheCreationInputTokens:h})??0},[A.provider,A.model,A.totalInputTokens,A.totalOutputTokens,A.totalCachedTokens,A.totalCacheCreationTokens]),g=C=>C>=1e6?`${(C/1e6).toFixed(1)}M`:C>=1e3?`${(C/1e3).toFixed(1)}K`:C.toString(),u=A.currentContextTokens||0,E=A.sessionType==="branch",Q=r?.parent;return c.jsx("div",{className:`absolute top-0 left-0 right-0 h-14 border-b border-border bg-background/95 backdrop-blur-sm z-10 transition-transform duration-200 ${e?"translate-y-0":"-translate-y-full"}`,children:c.jsxs("div",{className:"h-full px-6 flex items-center justify-between gap-4 text-sm",children:[c.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2 text-muted-foreground",children:[E?c.jsx(Pt,{className:"w-4 h-4 flex-shrink-0 text-violet-500"}):c.jsx(gR,{className:"w-4 h-4 flex-shrink-0"}),c.jsx("span",{className:"text-foreground font-medium truncate",children:A.title||"Untitled Session"}),o?.shared&&c.jsxs("button",{type:"button",onClick:()=>pf(o.url),className:"flex items-center gap-1 px-1.5 py-0.5 rounded bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 hover:bg-emerald-500/20 transition-colors text-xs font-medium flex-shrink-0",children:[c.jsx(of,{className:"h-3 w-3"}),o.pendingMessages&&o.pendingMessages>0?c.jsxs("span",{className:"flex items-center gap-0.5 text-amber-600 dark:text-amber-400",children:[c.jsx(Rn,{className:"h-2.5 w-2.5"}),o.pendingMessages]}):c.jsx(Yt,{className:"h-2.5 w-2.5 opacity-60"})]}),E&&Q&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-muted-foreground hidden sm:inline",children:"from"}),c.jsxs("button",{type:"button",onClick:()=>n?.(Q.id),className:"text-primary hover:underline flex items-center gap-0.5 truncate max-w-32",title:Q.title||`Session ${Q.id.slice(0,8)}`,children:[c.jsx("span",{className:"truncate",children:Q.title||`Session ${Q.id.slice(0,8)}`}),c.jsx($1,{className:"h-3 w-3 flex-shrink-0"})]})]})]}),c.jsxs("div",{className:"flex-shrink-0 flex items-center gap-5 text-muted-foreground",children:[t&&c.jsx(P8,{sessionId:A.id}),c.jsx("div",{className:"flex items-center gap-3",children:c.jsxs("div",{className:"flex items-center gap-1",title:`Current context window: ${u.toLocaleString()} tokens`,children:[c.jsx("span",{className:"text-xs opacity-70",children:"ctx"}),c.jsx("span",{className:"text-foreground font-medium",children:g(u)})]})}),s>0&&c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx(aR,{className:"w-4 h-4"}),c.jsx("span",{className:"text-foreground font-medium",children:s.toFixed(4)})]}),c.jsxs("div",{className:"hidden sm:flex items-center gap-2",children:[c.jsx(dn,{provider:A.provider,size:16}),c.jsx("span",{className:"font-medium text-foreground truncate max-w-40",children:A.model})]})]})]})})}const AeA=S.memo(function({pendingTopup:e,onMethodSelected:t,onCancel:n}){const[r,o]=S.useState(!1),[s,g]=S.useState(null),u=Qe(d=>d.openTopupModal),E=async()=>{g("crypto"),o(!0);try{await mA.selectTopupMethod(e.sessionId,"crypto"),t("crypto")}catch(d){$A.error(d instanceof Error?d.message:"Failed to process payment"),o(!1),g(null)}},Q=async()=>{g("fiat"),u(),mA.selectTopupMethod(e.sessionId,"fiat").catch(()=>{}),t("fiat")},C=async()=>{o(!0);try{await mA.cancelTopup(e.sessionId),n()}catch(d){$A.error(d instanceof Error?d.message:"Failed to cancel"),o(!1)}};return c.jsxs("div",{className:"flex flex-col gap-3 py-2",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Fn,{className:"h-4 w-4 text-amber-500 flex-shrink-0"}),c.jsx("span",{className:"font-medium text-foreground text-sm",children:"Insufficient Balance"}),c.jsx("span",{className:"text-amber-600 dark:text-amber-400 font-medium text-sm",children:"payment required"})]}),c.jsxs("div",{className:"ml-6 bg-muted/30 rounded-lg p-3 space-y-2 text-sm",children:[c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-muted-foreground",children:"Request cost"}),c.jsxs("span",{className:"font-mono",children:["~$",e.amountUsd.toFixed(4)]})]}),c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-muted-foreground",children:"Current balance"}),c.jsxs("span",{className:"font-mono",children:["$",e.currentBalance.toFixed(4)]})]})]}),c.jsxs("div",{className:"ml-6 flex flex-wrap items-center gap-2",children:[c.jsxs("button",{type:"button",onClick:C,disabled:r,title:"Cancel request",className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded border border-border bg-background hover:bg-muted transition-colors disabled:opacity-50",children:[c.jsx(gt,{className:"w-3 h-3"}),"Cancel"]}),c.jsxs("button",{type:"button",onClick:E,disabled:r,title:"Pay with USDC from your wallet",className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded bg-violet-600 text-white hover:bg-violet-700 transition-colors disabled:opacity-50",children:[s==="crypto"&&r?c.jsx(Xe,{className:"w-3 h-3 animate-spin"}):c.jsx(gf,{className:"w-3 h-3"}),"Pay with USDC"]}),c.jsxs("button",{type:"button",onClick:Q,disabled:r,title:"Top up balance with card (min $5)",className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded border border-violet-500 text-violet-600 dark:text-violet-400 hover:bg-violet-500/10 transition-colors disabled:opacity-50",children:[s==="fiat"&&r?c.jsx(Xe,{className:"w-3 h-3 animate-spin"}):c.jsx(cs,{className:"w-3 h-3"}),"Top up with Card",c.jsx("span",{className:"text-[10px] opacity-70",children:"(min $5)"})]})]}),c.jsx("p",{className:"ml-6 text-xs text-muted-foreground",children:s==="crypto"?"Processing USDC payment from your wallet...":s==="fiat"?"Opening Polar checkout...":"Select a payment method to continue your request."})]})}),Tg=dt(A=>({pendingTopup:null,isProcessing:!1,selectedMethod:null,setPendingTopup:e=>A({pendingTopup:e,isProcessing:!1,selectedMethod:null}),setProcessing:e=>A({isProcessing:e}),setSelectedMethod:e=>A({selectedMethod:e}),clearPendingTopup:()=>A({pendingTopup:null,isProcessing:!1,selectedMethod:null})})),eeA=S.memo(function({messages:e,session:t,sessionId:n,isGenerating:r,disableAutoScroll:o=!1,onSelectSession:s}){const g=xe(),u=S.useRef(null),E=S.useRef(null),Q=S.useRef(null),[C,d]=S.useState(!0),I=S.useRef(!0),[h,m]=S.useState(!1),D=S.useRef(!1),w=S.useRef(void 0),b=S.useRef(0),y=S.useRef(void 0),M=S.useRef(!1),F=S.useRef(t?.id),x=S.useRef(e.length),k=S.useRef(r),v=S.useRef(0),R=S.useRef(0),O=Tg(j=>j.pendingTopup),T=Tg(j=>j.clearPendingTopup),K=O&&O.sessionId===n,q=S.useCallback(()=>{const j=E.current;if(!j)return;const{scrollTop:W,scrollHeight:Z,clientHeight:U}=j,_=Z-W-U,V=Z>v.current,L=W<R.current-5;v.current=Z,R.current=W,_<100?(I.current=!0,d(!0)):L?(I.current=!1,d(!1),D.current=!0):!V&&I.current&&(I.current=!1,d(!1)),(L||!I.current&&_>=100)&&(w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{D.current=!1},150));const nA=Q.current;if(nA){const EA=nA.getBoundingClientRect(),CA=j.getBoundingClientRect();m(EA.bottom<CA.top)}},[]);S.useEffect(()=>{if(o)return;const j=t?.id!==F.current;if(F.current=t?.id,j&&(M.current=!1),!M.current&&e.length>0){M.current=!0;const W=E.current;W&&(W.scrollTop=W.scrollHeight)}},[e.length,t?.id,o]),S.useEffect(()=>{if(o)return;const j=r&&!k.current,W=e.length>x.current;k.current=r,x.current=e.length,j?(D.current=!1,I.current=!0,d(!0),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const Z=E.current;Z&&(Z.scrollTop=Z.scrollHeight)})})):W&&!D.current&&!r&&(I.current=!0,d(!0))},[e.length,r,o]),S.useEffect(()=>{if(o)return;const j=E.current;if(!j||!C||D.current)return;b.current=j.scrollHeight-j.clientHeight;const W=()=>{const Z=E.current;if(!Z||D.current)return;const U=Z.scrollTop,V=Z.scrollHeight-Z.clientHeight-U;if(Math.abs(V)<1){Z.scrollTop=Z.scrollHeight-Z.clientHeight;return}if(Math.abs(V)<10){Z.scrollTop=Z.scrollHeight-Z.clientHeight;return}Z.scrollTop=U+V*.15,y.current=requestAnimationFrame(W)};y.current&&cancelAnimationFrame(y.current),y.current=requestAnimationFrame(W)},[e,C]),S.useEffect(()=>()=>{w.current&&clearTimeout(w.current),y.current&&cancelAnimationFrame(y.current)},[]);const Y=()=>{D.current=!1,I.current=!0,d(!0);const j=E.current;j&&(j.scrollTop=j.scrollHeight)},P=S.useMemo(()=>e.filter(j=>j.role!=="system"),[e]),J=S.useCallback(j=>async()=>{if(n&&j){g.setQueryData(["messages",n],W=>W&&W.map(Z=>{if(Z.id!==j)return Z;const U=Z.parts?.filter(_=>!(_.type==="error"||_.type==="tool_call"&&_.toolName==="finish"))??[];return{...Z,status:"pending",parts:U,error:null}}));try{await mA.retryMessage(n,j)}catch(W){$A.error(W instanceof Error?W.message:"Failed to retry")}}},[n,g]);return e.length===0?c.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground text-sm",children:"No messages yet. Start a conversation below."}):c.jsxs("div",{className:"absolute inset-0 flex flex-col",children:[t&&c.jsx($AA,{session:t,isVisible:h,isGenerating:r,onNavigateToSession:s}),c.jsxs("div",{ref:E,className:"flex-1 overflow-y-auto",onScroll:q,children:[c.jsx("div",{ref:Q,children:t&&c.jsx(XAA,{session:t,onNavigateToSession:s})}),c.jsx("div",{className:"p-6 pb-64",children:c.jsxs("div",{className:"max-w-3xl mx-auto space-y-6",children:[P.map((j,W)=>{const Z=P[W-1],U=P[W+1],_=W===P.length-1;if(j.role==="user"){const V=U&&U.role==="assistant"?U:void 0;return c.jsx(UT,{sessionId:n,message:j,isFirst:W===0,nextAssistantMessageId:V?.id},j.id)}if(j.role==="assistant"){const V=!Z||Z.role!=="assistant",L=U&&U.role==="assistant";return c.jsx(GT,{sessionId:n,message:j,showHeader:V,hasNextAssistantMessage:L,isLastMessage:_,onBranchCreated:s,onRetry:J(j.id)},j.id)}return null}),K&&O&&c.jsx("div",{className:"py-4",children:c.jsx(AeA,{pendingTopup:O,onMethodSelected:()=>T(),onCancel:()=>T()})}),c.jsx("div",{ref:u})]})})]}),!C&&c.jsxs("button",{type:"button",onClick:Y,className:"absolute bottom-36 left-1/2 -translate-x-1/2 flex items-center gap-2 px-4 py-2 bg-background border border-border rounded-full shadow-lg hover:bg-muted/50 transition-all text-sm text-foreground z-10",children:[c.jsx(g4,{className:"w-4 h-4"}),c.jsx("span",{children:"Scroll to bottom"})]})]})});class _T{abortController=null;handlers=new Map;running=!1;async connect(e){this.abortController&&this.abortController.abort(),this.abortController=new AbortController,this.running=!0;try{const t=await fetch(e,{headers:{Accept:"text/event-stream"},signal:this.abortController.signal});if(!t.ok){console.error("[SSE] Connection failed:",t.status);return}const n=t.body?.getReader();if(!n){console.error("[SSE] No response body");return}const r=new TextDecoder;let o="";for(;this.running;){const{done:s,value:g}=await n.read();if(s)break;o+=r.decode(g,{stream:!0});let u=o.indexOf(`
|
|
133
|
+
`);navigator.clipboard.writeText(Z),D(!0),setTimeout(()=>D(!1),2e3)},[k]),W=S.useCallback(()=>{h(!0)},[]);return Q?null:c.jsxs("div",{className:"relative group",onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:[n&&c.jsxs("div",{className:"pb-2 flex items-center justify-between",children:[c.jsxs("div",{className:"inline-flex items-center bg-violet-500/10 border border-violet-500/30 dark:bg-violet-500/5 dark:border-violet-500/20 rounded-full pr-3 md:pr-4 flex-shrink min-w-0",children:[c.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-violet-500/50 bg-violet-500/20 dark:bg-violet-500/10",children:c.jsx(Mi,{className:"h-3.5 w-3.5 text-violet-700 dark:text-violet-300"})}),c.jsxs("div",{className:"flex items-center gap-x-1.5 md:gap-x-2 text-xs md:text-sm text-muted-foreground pl-2 md:pl-3 min-w-0",children:[t.agent&&!s&&c.jsx("span",{className:"font-medium text-violet-700 dark:text-violet-300 whitespace-nowrap",children:t.agent}),t.provider&&c.jsxs(c.Fragment,{children:[!s&&t.agent&&c.jsx("span",{className:"text-muted-foreground/50",children:"·"}),c.jsx(dn,{provider:t.provider,size:14,className:"opacity-70"})]}),t.model&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hidden md:inline text-muted-foreground/50",children:"·"}),c.jsx("span",{className:`hidden md:inline text-muted-foreground ${s?"truncate max-w-[120px]":""}`,title:t.model,children:t.model})]}),t.createdAt&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-muted-foreground/50",children:"·"}),c.jsx("span",{className:"text-muted-foreground whitespace-nowrap",children:P(t.createdAt)})]})]})]}),C&&J&&e&&g&&c.jsx("button",{type:"button",onClick:W,className:"ml-4 p-1.5 text-muted-foreground hover:text-primary transition-colors flex-shrink-0",title:"Branch from this message",children:c.jsx(Pt,{className:"h-4 w-4"})})]}),c.jsxs("div",{className:"relative ml-1",children:[k.map((Z,U)=>{const _=U===k.length-1,V=Z.type==="tool_call"&&Z.toolCallId?w.find(oA=>oA.callId===Z.toolCallId)??null:null,L=Z.type==="tool_result"&&Z.toolName==="finish",nA=(!_||r)&&!L,EA=Z.type==="tool_call"&&_;return Z.type==="tool_result"&&Z.toolName==="progress_update"?null:c.jsx(o1,{part:Z,showLine:nA,isFirstPart:U===K&&!n,isLastToolCall:EA,onNavigateToSession:u,compact:s,pendingApproval:V,onApprove:y,onReject:M,sessionId:e,onRetry:E},Z.id)}),F.length>1&&c.jsxs("div",{className:"flex items-center gap-3 py-2 px-3 my-2 bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 rounded-lg",children:[c.jsx(ER,{className:"h-4 w-4 text-amber-600 dark:text-amber-400 flex-shrink-0"}),c.jsxs("span",{className:"text-sm text-amber-800 dark:text-amber-200 flex-1",children:[F.length," tools waiting for approval"]}),c.jsxs("button",{type:"button",onClick:x,title:"Approve All (A)",className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded bg-amber-600 text-white hover:bg-amber-700 transition-colors",children:[c.jsx(f4,{className:"w-3.5 h-3.5"}),"Approve All",c.jsx("kbd",{className:"ml-1 text-[10px] opacity-70",children:"A"})]})]}),q&&O&&c.jsx(o1,{part:O,showLine:r,isFirstPart:!T&&!n,isLastProgressUpdate:!0,compact:s},O.id),Y&&c.jsxs("div",{className:"flex gap-3 pb-2 relative",children:[c.jsx("div",{className:"flex-shrink-0 w-6 flex items-start justify-center relative pt-0.5",children:c.jsx("div",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full relative bg-card text-violet-700 dark:bg-background dark:text-violet-300",children:c.jsx(Mi,{className:"h-4 w-4"})})}),c.jsx("div",{className:"flex-1 pt-0.5",children:c.jsx("div",{className:"text-base text-foreground animate-pulse",children:qAA(t.id)})})]})]}),J&&e&&c.jsx("div",{className:"grid ml-7 transition-[grid-template-rows] duration-200 ease-out",style:{gridTemplateRows:C?"1fr":"0fr"},children:c.jsx("div",{className:"overflow-hidden",children:c.jsxs("div",{className:"flex gap-2 mt-2",children:[g&&c.jsxs("button",{type:"button",onClick:W,className:"flex items-center gap-1.5 px-2 py-1 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/50 rounded transition-colors",children:[c.jsx(Pt,{className:"h-3 w-3"}),"Branch"]}),c.jsx("button",{type:"button",onClick:j,className:"flex items-center gap-1.5 px-2 py-1 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/50 rounded transition-colors",children:m?c.jsxs(c.Fragment,{children:[c.jsx(ia,{className:"h-3 w-3 text-green-500"}),"Copied"]}):c.jsxs(c.Fragment,{children:[c.jsx(rf,{className:"h-3 w-3"}),"Copy"]})})]})})}),I&&e&&c.jsx(UAA,{isOpen:I,onClose:()=>h(!1),sessionId:e,message:t,onBranchCreated:o})]})},(A,e)=>{const t=A.message.parts||[],n=e.message.parts||[];if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++){const o=t[r],s=n[r];if(o.id!==s.id||o.content!==s.content||o.contentJson!==s.contentJson||o.ephemeral!==s.ephemeral||o.completedAt!==s.completedAt)return!1}return A.message.id===e.message.id&&A.message.status===e.message.status&&A.message.completedAt===e.message.completedAt&&A.showHeader===e.showHeader&&A.hasNextAssistantMessage===e.hasNextAssistantMessage&&A.isLastMessage===e.isLastMessage&&A.sessionId===e.sessionId&&A.compact===e.compact&&A.onNavigateToSession===e.onNavigateToSession}),UT=S.memo(function({sessionId:e,message:t,nextAssistantMessageId:n}){const[r,o]=S.useState(null),s=t.parts||[],g=xe(),{isQueued:u,position:E}=OT(e,n??""),Q=Dh(T=>T.setPendingRestoreText),C=s.filter(T=>T.type==="text"),d=s.filter(T=>T.type==="image"),I=s.filter(T=>T.type==="file"),h=C[0];let m="";if(h){const T=h.contentJson||h.content;T&&typeof T=="object"&&"text"in T?m=String(T.text):typeof T=="string"?m=T:T&&(m=JSON.stringify(T,null,2))}const{researchContexts:D,cleanContent:w}=_8(m),b=[];for(const T of d)try{const K=T.contentJson||JSON.parse(T.content||"{}");if(K&&typeof K=="object"&&"data"in K){const q=K,Y=`data:${q.mediaType};base64,${q.data}`;b.push({id:T.id,src:Y})}}catch{}const y=[];for(const T of I)try{const K=T.contentJson||JSON.parse(T.content||"{}");if(K&&typeof K=="object"&&"type"in K){const q=K;if(q.type==="image"&&q.data){const Y=`data:${q.mediaType};base64,${q.data}`;b.push({id:T.id,src:Y})}else y.push({id:T.id,type:q.type,name:q.name})}}catch{}const M=T=>T?new Date(T).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"",F=w.trim().length>0,x=b.length>0,k=y.length>0,v=D.length>0;if(!F&&!x&&!k&&!v)return null;const R=async()=>{if(!(!e||!n)){Q(w);try{await mA.removeFromQueue(e,n),g.invalidateQueries({queryKey:["messages",e]})}catch(T){console.error("Failed to cancel queued message:",T)}}},O=async()=>{if(!(!e||!n))try{await mA.removeFromQueue(e,n),g.invalidateQueries({queryKey:["messages",e]})}catch(T){console.error("Failed to delete queued message:",T)}};return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"relative pb-8 pt-6",children:c.jsxs("div",{className:"flex gap-3 md:gap-4 justify-end",children:[c.jsxs("div",{className:"flex flex-col items-end min-w-0 flex-1 max-w-[calc(100%-3rem)] md:max-w-2xl",children:[c.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground pb-2 justify-end",children:[c.jsx("span",{className:"font-medium text-emerald-700 dark:text-emerald-300",children:"You"}),t.createdAt&&c.jsx("span",{children:"·"}),t.createdAt&&c.jsx("span",{children:M(t.createdAt)}),u&&c.jsxs(c.Fragment,{children:[c.jsx("span",{children:"·"}),c.jsxs("span",{className:"inline-flex items-center gap-1 text-amber-600 dark:text-amber-400",children:[c.jsx(nR,{className:"h-3 w-3"}),"Queued",E!==null&&E>0?` #${E+1}`:""]})]})]}),c.jsxs("div",{className:"inline-block max-w-full text-sm text-foreground leading-relaxed bg-emerald-500/5 border border-emerald-500/20 rounded-xl px-4 py-3 [word-break:break-word] overflow-hidden",children:[x&&c.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:b.map(T=>c.jsx("button",{type:"button",onClick:()=>o(T.src),className:"w-16 h-16 rounded-lg overflow-hidden bg-muted hover:ring-2 hover:ring-primary/50 transition-all",children:c.jsx("img",{src:T.src,alt:"Attachment",className:"w-full h-full object-cover"})},T.id))}),k&&c.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:y.map(T=>c.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-muted/50 border border-border",children:[T.type==="pdf"?c.jsx(Ha,{className:"w-4 h-4 text-red-500 flex-shrink-0"}):c.jsx(Kg,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}),c.jsx("span",{className:"text-xs truncate max-w-[150px]",children:T.name})]},T.id))}),v&&c.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:D.map(T=>c.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-teal-500/10 border border-teal-500/30",children:[c.jsx(is,{className:"w-4 h-4 text-teal-500 flex-shrink-0"}),c.jsx("span",{className:"text-xs text-teal-600 dark:text-teal-400",children:T.label})]},T.id))}),F&&c.jsx("div",{className:"prose prose-invert prose-sm [&>*:first-child]:mt-0 [&>*:last-child]:mb-0 [&_*]:[word-break:break-word] [&_*]:overflow-wrap-anywhere",children:c.jsx(Y2,{remarkPlugins:[CT],components:{a:({href:T,children:K,...q})=>c.jsx("a",{href:T,target:"_blank",rel:"noopener noreferrer",onClick:Y=>{window.self!==window.top&&T&&(Y.preventDefault(),window.parent.postMessage({type:"agi-open-url",url:T},"*"))},...q,children:K})},children:w})})]}),u&&c.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[c.jsxs("button",{type:"button",onClick:R,className:"inline-flex items-center gap-1.5 px-2.5 py-1 text-xs rounded-md bg-muted hover:bg-muted/80 text-muted-foreground hover:text-foreground transition-colors",title:"Cancel and restore to input",children:[c.jsx(cR,{className:"h-3 w-3"}),"Cancel"]}),c.jsxs("button",{type:"button",onClick:O,className:"inline-flex items-center gap-1.5 px-2.5 py-1 text-xs rounded-md bg-destructive/10 hover:bg-destructive/20 text-destructive transition-colors",title:"Delete from queue",children:[c.jsx(sf,{className:"h-3 w-3"}),"Delete"]})]})]}),c.jsx("div",{className:"flex-shrink-0 w-8 flex items-start justify-center",children:c.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full border-2 border-emerald-500/50 bg-emerald-500/20 dark:bg-emerald-500/10 relative bg-background",children:c.jsx(lf,{className:"h-4 w-4 text-emerald-700 dark:text-emerald-300"})})})]})}),r&&c.jsxs("div",{role:"dialog","aria-modal":"true",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4",onClick:()=>o(null),onKeyDown:T=>T.key==="Escape"&&o(null),tabIndex:-1,children:[c.jsx("button",{type:"button",onClick:()=>o(null),className:"absolute top-4 right-4 p-2 rounded-full bg-white/10 hover:bg-white/20 transition-colors",children:c.jsx(gt,{className:"w-6 h-6 text-white"})}),c.jsx("img",{src:r,alt:"Expanded attachment",className:"max-w-full max-h-full object-contain rounded-lg",onClick:T=>T.stopPropagation(),onKeyDown:T=>T.key==="Enter"&&T.stopPropagation()})]})]})},(A,e)=>{const t=A.message.parts?.[0],n=e.message.parts?.[0];return A.message.id===e.message.id&&t?.content===n?.content&&t?.contentJson===n?.contentJson&&A.message.createdAt===e.message.createdAt&&A.message.parts?.length===e.message.parts?.length&&A.sessionId===e.sessionId&&A.nextAssistantMessageId===e.nextAssistantMessageId}),KAA={openai:{id:"openai",models:[{id:"codex-mini-latest",label:"Codex Mini",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-04",releaseDate:"2025-05-16",lastUpdated:"2025-05-16",openWeights:!1,cost:{input:1.5,output:6,cacheRead:.375},limit:{context:2e5,output:1e5}},{id:"gpt-3.5-turbo",label:"GPT-3.5-turbo",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2021-09-01",releaseDate:"2023-03-01",lastUpdated:"2023-11-06",openWeights:!1,cost:{input:.5,output:1.5,cacheRead:1.25},limit:{context:16385,output:4096}},{id:"gpt-4",label:"GPT-4",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2023-11",releaseDate:"2023-11-06",lastUpdated:"2024-04-09",openWeights:!1,cost:{input:30,output:60},limit:{context:8192,output:8192}},{id:"gpt-4-turbo",label:"GPT-4 Turbo",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2023-12",releaseDate:"2023-11-06",lastUpdated:"2024-04-09",openWeights:!1,cost:{input:10,output:30},limit:{context:128e3,output:4096}},{id:"gpt-4.1",label:"GPT-4.1",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-04",releaseDate:"2025-04-14",lastUpdated:"2025-04-14",openWeights:!1,cost:{input:2,output:8,cacheRead:.5},limit:{context:1047576,output:32768}},{id:"gpt-4.1-mini",label:"GPT-4.1 mini",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-04",releaseDate:"2025-04-14",lastUpdated:"2025-04-14",openWeights:!1,cost:{input:.4,output:1.6,cacheRead:.1},limit:{context:1047576,output:32768}},{id:"gpt-4.1-nano",label:"GPT-4.1 nano",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-04",releaseDate:"2025-04-14",lastUpdated:"2025-04-14",openWeights:!1,cost:{input:.1,output:.4,cacheRead:.03},limit:{context:1047576,output:32768}},{id:"gpt-4o",label:"GPT-4o",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2023-09",releaseDate:"2024-05-13",lastUpdated:"2024-08-06",openWeights:!1,cost:{input:2.5,output:10,cacheRead:1.25},limit:{context:128e3,output:16384}},{id:"gpt-4o-2024-05-13",label:"GPT-4o (2024-05-13)",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2023-09",releaseDate:"2024-05-13",lastUpdated:"2024-05-13",openWeights:!1,cost:{input:5,output:15},limit:{context:128e3,output:4096}},{id:"gpt-4o-2024-08-06",label:"GPT-4o (2024-08-06)",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2023-09",releaseDate:"2024-08-06",lastUpdated:"2024-08-06",openWeights:!1,cost:{input:2.5,output:10,cacheRead:1.25},limit:{context:128e3,output:16384}},{id:"gpt-4o-2024-11-20",label:"GPT-4o (2024-11-20)",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2023-09",releaseDate:"2024-11-20",lastUpdated:"2024-11-20",openWeights:!1,cost:{input:2.5,output:10,cacheRead:1.25},limit:{context:128e3,output:16384}},{id:"gpt-4o-mini",label:"GPT-4o mini",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2023-09",releaseDate:"2024-07-18",lastUpdated:"2024-07-18",openWeights:!1,cost:{input:.15,output:.6,cacheRead:.08},limit:{context:128e3,output:16384}},{id:"gpt-5",label:"GPT-5",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-08-07",lastUpdated:"2025-08-07",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.125},limit:{context:4e5,output:128e3}},{id:"gpt-5-chat-latest",label:"GPT-5 Chat (latest)",modalities:{input:["text","image"],output:["text"]},toolCall:!1,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-09-30",releaseDate:"2025-08-07",lastUpdated:"2025-08-07",openWeights:!1,cost:{input:1.25,output:10},limit:{context:4e5,output:128e3}},{id:"gpt-5-codex",label:"GPT-5-Codex",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-09-15",lastUpdated:"2025-09-15",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.125},limit:{context:4e5,output:128e3}},{id:"gpt-5-mini",label:"GPT-5 Mini",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-05-30",releaseDate:"2025-08-07",lastUpdated:"2025-08-07",openWeights:!1,cost:{input:.25,output:2,cacheRead:.025},limit:{context:4e5,output:128e3}},{id:"gpt-5-nano",label:"GPT-5 Nano",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-05-30",releaseDate:"2025-08-07",lastUpdated:"2025-08-07",openWeights:!1,cost:{input:.05,output:.4,cacheRead:.005},limit:{context:4e5,output:128e3}},{id:"gpt-5-pro",label:"GPT-5 Pro",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-10-06",lastUpdated:"2025-10-06",openWeights:!1,cost:{input:15,output:120},limit:{context:4e5,output:272e3}},{id:"gpt-5.1",label:"GPT-5.1",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-11-13",lastUpdated:"2025-11-13",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.13},limit:{context:4e5,output:128e3}},{id:"gpt-5.1-chat-latest",label:"GPT-5.1 Chat",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-11-13",lastUpdated:"2025-11-13",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.125},limit:{context:128e3,output:16384}},{id:"gpt-5.1-codex",label:"GPT-5.1 Codex",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-11-13",lastUpdated:"2025-11-13",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.125},limit:{context:4e5,output:128e3}},{id:"gpt-5.1-codex-max",label:"GPT-5.1 Codex Max",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-11-13",lastUpdated:"2025-11-13",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.125},limit:{context:4e5,output:128e3}},{id:"gpt-5.1-codex-mini",label:"GPT-5.1 Codex mini",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-11-13",lastUpdated:"2025-11-13",openWeights:!1,cost:{input:.25,output:2,cacheRead:.025},limit:{context:4e5,output:128e3}},{id:"gpt-5.2",label:"GPT-5.2",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2025-08-31",releaseDate:"2025-12-11",lastUpdated:"2025-12-11",openWeights:!1,cost:{input:1.75,output:14,cacheRead:.175},limit:{context:4e5,output:128e3}},{id:"gpt-5.2-chat-latest",label:"GPT-5.2 Chat",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2025-08-31",releaseDate:"2025-12-11",lastUpdated:"2025-12-11",openWeights:!1,cost:{input:1.75,output:14,cacheRead:.175},limit:{context:128e3,output:16384}},{id:"gpt-5.2-codex",label:"GPT-5.2 Codex",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2025-08-31",releaseDate:"2025-12-11",lastUpdated:"2025-12-11",openWeights:!1,cost:{input:1.75,output:14,cacheRead:.175},limit:{context:4e5,output:128e3}},{id:"gpt-5.2-pro",label:"GPT-5.2 Pro",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2025-08-31",releaseDate:"2025-12-11",lastUpdated:"2025-12-11",openWeights:!1,cost:{input:21,output:168},limit:{context:4e5,output:128e3}},{id:"o1",label:"o1",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2023-09",releaseDate:"2024-12-05",lastUpdated:"2024-12-05",openWeights:!1,cost:{input:15,output:60,cacheRead:7.5},limit:{context:2e5,output:1e5}},{id:"o1-mini",label:"o1-mini",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!0,attachment:!1,temperature:!1,knowledge:"2023-09",releaseDate:"2024-09-12",lastUpdated:"2024-09-12",openWeights:!1,cost:{input:1.1,output:4.4,cacheRead:.55},limit:{context:128e3,output:65536}},{id:"o1-preview",label:"o1-preview",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2023-09",releaseDate:"2024-09-12",lastUpdated:"2024-09-12",openWeights:!1,cost:{input:15,output:60,cacheRead:7.5},limit:{context:128e3,output:32768}},{id:"o1-pro",label:"o1-pro",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2023-09",releaseDate:"2025-03-19",lastUpdated:"2025-03-19",openWeights:!1,cost:{input:150,output:600},limit:{context:2e5,output:1e5}},{id:"o3",label:"o3",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-05",releaseDate:"2025-04-16",lastUpdated:"2025-04-16",openWeights:!1,cost:{input:2,output:8,cacheRead:.5},limit:{context:2e5,output:1e5}},{id:"o3-deep-research",label:"o3-deep-research",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-05",releaseDate:"2024-06-26",lastUpdated:"2024-06-26",openWeights:!1,cost:{input:10,output:40,cacheRead:2.5},limit:{context:2e5,output:1e5}},{id:"o3-mini",label:"o3-mini",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!1,knowledge:"2024-05",releaseDate:"2024-12-20",lastUpdated:"2025-01-29",openWeights:!1,cost:{input:1.1,output:4.4,cacheRead:.55},limit:{context:2e5,output:1e5}},{id:"o3-pro",label:"o3-pro",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-05",releaseDate:"2025-06-10",lastUpdated:"2025-06-10",openWeights:!1,cost:{input:20,output:80},limit:{context:2e5,output:1e5}},{id:"o4-mini",label:"o4-mini",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-05",releaseDate:"2025-04-16",lastUpdated:"2025-04-16",openWeights:!1,cost:{input:1.1,output:4.4,cacheRead:.28},limit:{context:2e5,output:1e5}},{id:"o4-mini-deep-research",label:"o4-mini-deep-research",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-05",releaseDate:"2024-06-26",lastUpdated:"2024-06-26",openWeights:!1,cost:{input:2,output:8,cacheRead:.5},limit:{context:2e5,output:1e5}},{id:"text-embedding-3-large",label:"text-embedding-3-large",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!1,attachment:!1,temperature:!1,knowledge:"2024-01",releaseDate:"2024-01-25",lastUpdated:"2024-01-25",openWeights:!1,cost:{input:.13,output:0},limit:{context:8191,output:3072}},{id:"text-embedding-3-small",label:"text-embedding-3-small",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!1,attachment:!1,temperature:!1,knowledge:"2024-01",releaseDate:"2024-01-25",lastUpdated:"2024-01-25",openWeights:!1,cost:{input:.02,output:0},limit:{context:8191,output:1536}},{id:"text-embedding-ada-002",label:"text-embedding-ada-002",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!1,attachment:!1,temperature:!1,knowledge:"2022-12",releaseDate:"2022-12-15",lastUpdated:"2022-12-15",openWeights:!1,cost:{input:.1,output:0},limit:{context:8192,output:1536}}],label:"OpenAI",env:["OPENAI_API_KEY"],npm:"@ai-sdk/openai",doc:"https://platform.openai.com/docs/models"},anthropic:{id:"anthropic",models:[{id:"claude-3-5-haiku-20241022",label:"Claude Haiku 3.5",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-07-31",releaseDate:"2024-10-22",lastUpdated:"2024-10-22",openWeights:!1,cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},limit:{context:2e5,output:8192}},{id:"claude-3-5-haiku-latest",label:"Claude Haiku 3.5 (latest)",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-07-31",releaseDate:"2024-10-22",lastUpdated:"2024-10-22",openWeights:!1,cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},limit:{context:2e5,output:8192}},{id:"claude-3-5-sonnet-20240620",label:"Claude Sonnet 3.5",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-04-30",releaseDate:"2024-06-20",lastUpdated:"2024-06-20",openWeights:!1,cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},limit:{context:2e5,output:8192}},{id:"claude-3-5-sonnet-20241022",label:"Claude Sonnet 3.5 v2",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-04-30",releaseDate:"2024-10-22",lastUpdated:"2024-10-22",openWeights:!1,cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},limit:{context:2e5,output:8192}},{id:"claude-3-7-sonnet-20250219",label:"Claude Sonnet 3.7",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-10-31",releaseDate:"2025-02-19",lastUpdated:"2025-02-19",openWeights:!1,cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},limit:{context:2e5,output:64e3}},{id:"claude-3-7-sonnet-latest",label:"Claude Sonnet 3.7 (latest)",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-10-31",releaseDate:"2025-02-19",lastUpdated:"2025-02-19",openWeights:!1,cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},limit:{context:2e5,output:64e3}},{id:"claude-3-haiku-20240307",label:"Claude Haiku 3",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2023-08-31",releaseDate:"2024-03-13",lastUpdated:"2024-03-13",openWeights:!1,cost:{input:.25,output:1.25,cacheRead:.03,cacheWrite:.3},limit:{context:2e5,output:4096}},{id:"claude-3-opus-20240229",label:"Claude Opus 3",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2023-08-31",releaseDate:"2024-02-29",lastUpdated:"2024-02-29",openWeights:!1,cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},limit:{context:2e5,output:4096}},{id:"claude-3-sonnet-20240229",label:"Claude Sonnet 3",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2023-08-31",releaseDate:"2024-03-04",lastUpdated:"2024-03-04",openWeights:!1,cost:{input:3,output:15,cacheRead:.3,cacheWrite:.3},limit:{context:2e5,output:4096}},{id:"claude-haiku-4-5",label:"Claude Haiku 4.5 (latest)",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-02-28",releaseDate:"2025-10-15",lastUpdated:"2025-10-15",openWeights:!1,cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},limit:{context:2e5,output:64e3}},{id:"claude-haiku-4-5-20251001",label:"Claude Haiku 4.5",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-02-28",releaseDate:"2025-10-15",lastUpdated:"2025-10-15",openWeights:!1,cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},limit:{context:2e5,output:64e3}},{id:"claude-opus-4-0",label:"Claude Opus 4 (latest)",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-03-31",releaseDate:"2025-05-22",lastUpdated:"2025-05-22",openWeights:!1,cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},limit:{context:2e5,output:32e3}},{id:"claude-opus-4-1",label:"Claude Opus 4.1 (latest)",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-03-31",releaseDate:"2025-08-05",lastUpdated:"2025-08-05",openWeights:!1,cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},limit:{context:2e5,output:32e3}},{id:"claude-opus-4-1-20250805",label:"Claude Opus 4.1",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-03-31",releaseDate:"2025-08-05",lastUpdated:"2025-08-05",openWeights:!1,cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},limit:{context:2e5,output:32e3}},{id:"claude-opus-4-20250514",label:"Claude Opus 4",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-03-31",releaseDate:"2025-05-22",lastUpdated:"2025-05-22",openWeights:!1,cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},limit:{context:2e5,output:32e3}},{id:"claude-opus-4-5",label:"Claude Opus 4.5 (latest)",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-03-31",releaseDate:"2025-11-24",lastUpdated:"2025-11-24",openWeights:!1,cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},limit:{context:2e5,output:64e3}},{id:"claude-opus-4-5-20251101",label:"Claude Opus 4.5",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-03-31",releaseDate:"2025-11-01",lastUpdated:"2025-11-01",openWeights:!1,cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},limit:{context:2e5,output:64e3}},{id:"claude-sonnet-4-0",label:"Claude Sonnet 4 (latest)",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-03-31",releaseDate:"2025-05-22",lastUpdated:"2025-05-22",openWeights:!1,cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},limit:{context:2e5,output:64e3}},{id:"claude-sonnet-4-20250514",label:"Claude Sonnet 4",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-03-31",releaseDate:"2025-05-22",lastUpdated:"2025-05-22",openWeights:!1,cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},limit:{context:2e5,output:64e3}},{id:"claude-sonnet-4-5",label:"Claude Sonnet 4.5 (latest)",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-07-31",releaseDate:"2025-09-29",lastUpdated:"2025-09-29",openWeights:!1,cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},limit:{context:2e5,output:64e3}},{id:"claude-sonnet-4-5-20250929",label:"Claude Sonnet 4.5",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-07-31",releaseDate:"2025-09-29",lastUpdated:"2025-09-29",openWeights:!1,cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},limit:{context:2e5,output:64e3}}],label:"Anthropic",env:["ANTHROPIC_API_KEY"],npm:"@ai-sdk/anthropic",doc:"https://docs.anthropic.com/en/docs/about-claude/models"},google:{id:"google",models:[{id:"gemini-1.5-flash",label:"Gemini 1.5 Flash",modalities:{input:["text","image","audio","video"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-04",releaseDate:"2024-05-14",lastUpdated:"2024-05-14",openWeights:!1,cost:{input:.075,output:.3,cacheRead:.01875},limit:{context:1e6,output:8192}},{id:"gemini-1.5-flash-8b",label:"Gemini 1.5 Flash-8B",modalities:{input:["text","image","audio","video"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-04",releaseDate:"2024-10-03",lastUpdated:"2024-10-03",openWeights:!1,cost:{input:.0375,output:.15,cacheRead:.01},limit:{context:1e6,output:8192}},{id:"gemini-1.5-pro",label:"Gemini 1.5 Pro",modalities:{input:["text","image","audio","video"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-04",releaseDate:"2024-02-15",lastUpdated:"2024-02-15",openWeights:!1,cost:{input:1.25,output:5,cacheRead:.3125},limit:{context:1e6,output:8192}},{id:"gemini-2.0-flash",label:"Gemini 2.0 Flash",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-06",releaseDate:"2024-12-11",lastUpdated:"2024-12-11",openWeights:!1,cost:{input:.1,output:.4,cacheRead:.025},limit:{context:1048576,output:8192}},{id:"gemini-2.0-flash-lite",label:"Gemini 2.0 Flash Lite",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-06",releaseDate:"2024-12-11",lastUpdated:"2024-12-11",openWeights:!1,cost:{input:.075,output:.3},limit:{context:1048576,output:8192}},{id:"gemini-2.5-flash",label:"Gemini 2.5 Flash",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-03-20",lastUpdated:"2025-06-05",openWeights:!1,cost:{input:.3,output:2.5,cacheRead:.075},limit:{context:1048576,output:65536}},{id:"gemini-2.5-flash-image",label:"Gemini 2.5 Flash Image",modalities:{input:["text","image"],output:["text","image"]},toolCall:!1,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-06",releaseDate:"2025-08-26",lastUpdated:"2025-08-26",openWeights:!1,cost:{input:.3,output:30,cacheRead:.075},limit:{context:32768,output:32768}},{id:"gemini-2.5-flash-image-preview",label:"Gemini 2.5 Flash Image (Preview)",modalities:{input:["text","image"],output:["text","image"]},toolCall:!1,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-06",releaseDate:"2025-08-26",lastUpdated:"2025-08-26",openWeights:!1,cost:{input:.3,output:30,cacheRead:.075},limit:{context:32768,output:32768}},{id:"gemini-2.5-flash-lite",label:"Gemini 2.5 Flash Lite",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-06-17",lastUpdated:"2025-06-17",openWeights:!1,cost:{input:.1,output:.4,cacheRead:.025},limit:{context:1048576,output:65536}},{id:"gemini-2.5-flash-lite-preview-06-17",label:"Gemini 2.5 Flash Lite Preview 06-17",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-06-17",lastUpdated:"2025-06-17",openWeights:!1,cost:{input:.1,output:.4,cacheRead:.025},limit:{context:1048576,output:65536}},{id:"gemini-2.5-flash-lite-preview-09-2025",label:"Gemini 2.5 Flash Lite Preview 09-25",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-09-25",lastUpdated:"2025-09-25",openWeights:!1,cost:{input:.1,output:.4,cacheRead:.025},limit:{context:1048576,output:65536}},{id:"gemini-2.5-flash-preview-04-17",label:"Gemini 2.5 Flash Preview 04-17",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-04-17",lastUpdated:"2025-04-17",openWeights:!1,cost:{input:.15,output:.6,cacheRead:.0375},limit:{context:1048576,output:65536}},{id:"gemini-2.5-flash-preview-05-20",label:"Gemini 2.5 Flash Preview 05-20",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-05-20",lastUpdated:"2025-05-20",openWeights:!1,cost:{input:.15,output:.6,cacheRead:.0375},limit:{context:1048576,output:65536}},{id:"gemini-2.5-flash-preview-09-2025",label:"Gemini 2.5 Flash Preview 09-25",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-09-25",lastUpdated:"2025-09-25",openWeights:!1,cost:{input:.3,output:2.5,cacheRead:.075},limit:{context:1048576,output:65536}},{id:"gemini-2.5-flash-preview-tts",label:"Gemini 2.5 Flash Preview TTS",modalities:{input:["text"],output:["audio"]},toolCall:!1,reasoningText:!1,attachment:!1,temperature:!1,knowledge:"2025-01",releaseDate:"2025-05-01",lastUpdated:"2025-05-01",openWeights:!1,cost:{input:.5,output:10},limit:{context:8e3,output:16e3}},{id:"gemini-2.5-pro",label:"Gemini 2.5 Pro",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-03-20",lastUpdated:"2025-06-05",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.31},limit:{context:1048576,output:65536}},{id:"gemini-2.5-pro-preview-05-06",label:"Gemini 2.5 Pro Preview 05-06",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-05-06",lastUpdated:"2025-05-06",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.31},limit:{context:1048576,output:65536}},{id:"gemini-2.5-pro-preview-06-05",label:"Gemini 2.5 Pro Preview 06-05",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-06-05",lastUpdated:"2025-06-05",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.31},limit:{context:1048576,output:65536}},{id:"gemini-2.5-pro-preview-tts",label:"Gemini 2.5 Pro Preview TTS",modalities:{input:["text"],output:["audio"]},toolCall:!1,reasoningText:!1,attachment:!1,temperature:!1,knowledge:"2025-01",releaseDate:"2025-05-01",lastUpdated:"2025-05-01",openWeights:!1,cost:{input:1,output:20},limit:{context:8e3,output:16e3}},{id:"gemini-3-flash-preview",label:"Gemini 3 Flash Preview",modalities:{input:["text","image","video","audio","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-12-17",lastUpdated:"2025-12-17",openWeights:!1,cost:{input:.5,output:3,cacheRead:.05},limit:{context:1048576,output:65536}},{id:"gemini-3-pro-preview",label:"Gemini 3 Pro Preview",modalities:{input:["text","image","video","audio","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-11-18",lastUpdated:"2025-11-18",openWeights:!1,cost:{input:2,output:12,cacheRead:.2},limit:{context:1e6,output:64e3}},{id:"gemini-embedding-001",label:"Gemini Embedding 001",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!1,attachment:!1,temperature:!1,knowledge:"2025-05",releaseDate:"2025-05-20",lastUpdated:"2025-05-20",openWeights:!1,cost:{input:.15,output:0},limit:{context:2048,output:3072}},{id:"gemini-flash-latest",label:"Gemini Flash Latest",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-09-25",lastUpdated:"2025-09-25",openWeights:!1,cost:{input:.3,output:2.5,cacheRead:.075},limit:{context:1048576,output:65536}},{id:"gemini-flash-lite-latest",label:"Gemini Flash-Lite Latest",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-09-25",lastUpdated:"2025-09-25",openWeights:!1,cost:{input:.1,output:.4,cacheRead:.025},limit:{context:1048576,output:65536}},{id:"gemini-live-2.5-flash",label:"Gemini Live 2.5 Flash",modalities:{input:["text","image","audio","video"],output:["text","audio"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-09-01",lastUpdated:"2025-09-01",openWeights:!1,cost:{input:.5,output:2},limit:{context:128e3,output:8e3}},{id:"gemini-live-2.5-flash-preview-native-audio",label:"Gemini Live 2.5 Flash Preview Native Audio",modalities:{input:["text","audio","video"],output:["text","audio"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!1,knowledge:"2025-01",releaseDate:"2025-06-17",lastUpdated:"2025-09-18",openWeights:!1,cost:{input:.5,output:2},limit:{context:131072,output:65536}}],label:"Google",env:["GOOGLE_GENERATIVE_AI_API_KEY","GEMINI_API_KEY"],npm:"@ai-sdk/google",doc:"https://ai.google.dev/gemini-api/docs/pricing"},openrouter:{id:"openrouter",models:[{id:"anthropic/claude-3.5-haiku",label:"Claude Haiku 3.5",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-07-31",releaseDate:"2024-10-22",lastUpdated:"2024-10-22",openWeights:!1,cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},limit:{context:2e5,output:8192}},{id:"anthropic/claude-3.7-sonnet",label:"Claude Sonnet 3.7",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-01",releaseDate:"2025-02-19",lastUpdated:"2025-02-19",openWeights:!1,cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},limit:{context:2e5,output:128e3}},{id:"anthropic/claude-haiku-4.5",label:"Claude Haiku 4.5",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-02-28",releaseDate:"2025-10-15",lastUpdated:"2025-10-15",openWeights:!1,cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},limit:{context:2e5,output:64e3}},{id:"anthropic/claude-opus-4",label:"Claude Opus 4",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-03-31",releaseDate:"2025-05-22",lastUpdated:"2025-05-22",openWeights:!1,cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},limit:{context:2e5,output:32e3}},{id:"anthropic/claude-opus-4.1",label:"Claude Opus 4.1",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-03-31",releaseDate:"2025-08-05",lastUpdated:"2025-08-05",openWeights:!1,cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},limit:{context:2e5,output:32e3}},{id:"anthropic/claude-opus-4.5",label:"Claude Opus 4.5",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-05-30",releaseDate:"2025-11-24",lastUpdated:"2025-11-24",openWeights:!1,cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},limit:{context:2e5,output:32e3}},{id:"anthropic/claude-sonnet-4",label:"Claude Sonnet 4",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-03-31",releaseDate:"2025-05-22",lastUpdated:"2025-05-22",openWeights:!1,cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},limit:{context:2e5,output:64e3}},{id:"anthropic/claude-sonnet-4.5",label:"Claude Sonnet 4.5",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-07-31",releaseDate:"2025-09-29",lastUpdated:"2025-09-29",openWeights:!1,cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},limit:{context:1e6,output:64e3}},{id:"cognitivecomputations/dolphin3.0-mistral-24b",label:"Dolphin3.0 Mistral 24B",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-02-13",lastUpdated:"2025-02-13",openWeights:!0,cost:{input:0,output:0},limit:{context:32768,output:8192}},{id:"cognitivecomputations/dolphin3.0-r1-mistral-24b",label:"Dolphin3.0 R1 Mistral 24B",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-02-13",lastUpdated:"2025-02-13",openWeights:!0,cost:{input:0,output:0},limit:{context:32768,output:8192}},{id:"deepseek/deepseek-chat-v3-0324",label:"DeepSeek V3 0324",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-03-24",lastUpdated:"2025-03-24",openWeights:!0,cost:{input:0,output:0},limit:{context:16384,output:8192}},{id:"deepseek/deepseek-chat-v3.1",label:"DeepSeek-V3.1",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-07",releaseDate:"2025-08-21",lastUpdated:"2025-08-21",openWeights:!0,cost:{input:.2,output:.8},limit:{context:163840,output:163840}},{id:"deepseek/deepseek-r1-0528-qwen3-8b:free",label:"Deepseek R1 0528 Qwen3 8B (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-05",releaseDate:"2025-05-29",lastUpdated:"2025-05-29",openWeights:!0,cost:{input:0,output:0},limit:{context:131072,output:131072}},{id:"deepseek/deepseek-r1-0528:free",label:"R1 0528 (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-05",releaseDate:"2025-05-28",lastUpdated:"2025-05-28",openWeights:!0,cost:{input:0,output:0},limit:{context:163840,output:163840}},{id:"deepseek/deepseek-r1-distill-llama-70b",label:"DeepSeek R1 Distill Llama 70B",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-01-23",lastUpdated:"2025-01-23",openWeights:!0,cost:{input:0,output:0},limit:{context:8192,output:8192}},{id:"deepseek/deepseek-r1-distill-qwen-14b",label:"DeepSeek R1 Distill Qwen 14B",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-01-29",lastUpdated:"2025-01-29",openWeights:!0,cost:{input:0,output:0},limit:{context:64e3,output:8192}},{id:"deepseek/deepseek-r1:free",label:"R1 (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-01",releaseDate:"2025-01-20",lastUpdated:"2025-01-20",openWeights:!0,cost:{input:0,output:0},limit:{context:163840,output:163840}},{id:"deepseek/deepseek-v3-base:free",label:"DeepSeek V3 Base (free)",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-03",releaseDate:"2025-03-29",lastUpdated:"2025-03-29",openWeights:!0,cost:{input:0,output:0},limit:{context:163840,output:163840}},{id:"deepseek/deepseek-v3.1-terminus",label:"DeepSeek V3.1 Terminus",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-07",releaseDate:"2025-09-22",lastUpdated:"2025-09-22",openWeights:!0,cost:{input:.27,output:1},limit:{context:131072,output:65536}},{id:"deepseek/deepseek-v3.1-terminus:exacto",label:"DeepSeek V3.1 Terminus (exacto)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-07",releaseDate:"2025-09-22",lastUpdated:"2025-09-22",openWeights:!0,cost:{input:.27,output:1},limit:{context:131072,output:65536}},{id:"deepseek/deepseek-v3.2",label:"DeepSeek V3.2",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-07",releaseDate:"2025-12-01",lastUpdated:"2025-12-01",openWeights:!0,cost:{input:.28,output:.4},limit:{context:163840,output:65536},provider:{npm:"@openrouter/ai-sdk-provider"}},{id:"deepseek/deepseek-v3.2-speciale",label:"DeepSeek V3.2 Speciale",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-07",releaseDate:"2025-12-01",lastUpdated:"2025-12-01",openWeights:!0,cost:{input:.27,output:.41},limit:{context:163840,output:65536},provider:{npm:"@openrouter/ai-sdk-provider"}},{id:"featherless/qwerky-72b",label:"Qwerky 72B",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-03-20",lastUpdated:"2025-03-20",openWeights:!0,cost:{input:0,output:0},limit:{context:32768,output:8192}},{id:"google/gemini-2.0-flash-001",label:"Gemini 2.0 Flash",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-06",releaseDate:"2024-12-11",lastUpdated:"2024-12-11",openWeights:!1,cost:{input:.1,output:.4,cacheRead:.025},limit:{context:1048576,output:8192}},{id:"google/gemini-2.0-flash-exp:free",label:"Gemini 2.0 Flash Experimental (free)",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-12",releaseDate:"2024-12-11",lastUpdated:"2024-12-11",openWeights:!1,cost:{input:0,output:0},limit:{context:1048576,output:1048576}},{id:"google/gemini-2.5-flash",label:"Gemini 2.5 Flash",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-07-17",lastUpdated:"2025-07-17",openWeights:!1,cost:{input:.3,output:2.5,cacheRead:.0375},limit:{context:1048576,output:65536}},{id:"google/gemini-2.5-flash-lite",label:"Gemini 2.5 Flash Lite",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-06-17",lastUpdated:"2025-06-17",openWeights:!1,cost:{input:.1,output:.4,cacheRead:.025},limit:{context:1048576,output:65536}},{id:"google/gemini-2.5-flash-lite-preview-09-2025",label:"Gemini 2.5 Flash Lite Preview 09-25",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-09-25",lastUpdated:"2025-09-25",openWeights:!1,cost:{input:.1,output:.4,cacheRead:.025},limit:{context:1048576,output:65536}},{id:"google/gemini-2.5-flash-preview-09-2025",label:"Gemini 2.5 Flash Preview 09-25",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-09-25",lastUpdated:"2025-09-25",openWeights:!1,cost:{input:.3,output:2.5,cacheRead:.031},limit:{context:1048576,output:65536}},{id:"google/gemini-2.5-pro",label:"Gemini 2.5 Pro",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-03-20",lastUpdated:"2025-06-05",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.31},limit:{context:1048576,output:65536}},{id:"google/gemini-2.5-pro-preview-05-06",label:"Gemini 2.5 Pro Preview 05-06",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-05-06",lastUpdated:"2025-05-06",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.31},limit:{context:1048576,output:65536}},{id:"google/gemini-2.5-pro-preview-06-05",label:"Gemini 2.5 Pro Preview 06-05",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-06-05",lastUpdated:"2025-06-05",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.31},limit:{context:1048576,output:65536}},{id:"google/gemini-3-flash-preview",label:"Gemini 3 Flash Preview",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-12-17",lastUpdated:"2025-12-17",openWeights:!1,cost:{input:.5,output:3,cacheRead:.05},limit:{context:1048576,output:65536},provider:{npm:"@openrouter/ai-sdk-provider"}},{id:"google/gemini-3-pro-preview",label:"Gemini 3 Pro Preview",modalities:{input:["text","image","audio","video","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-11-18",lastUpdated:"2025-11",openWeights:!1,cost:{input:2,output:12},limit:{context:105e4,output:66e3},provider:{npm:"@openrouter/ai-sdk-provider"}},{id:"google/gemma-2-9b-it:free",label:"Gemma 2 9B (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-06",releaseDate:"2024-06-28",lastUpdated:"2024-06-28",openWeights:!0,cost:{input:0,output:0},limit:{context:8192,output:8192}},{id:"google/gemma-3-12b-it",label:"Gemma 3 12B IT",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-10",releaseDate:"2025-03-13",lastUpdated:"2025-03-13",openWeights:!0,cost:{input:0,output:0},limit:{context:96e3,output:8192}},{id:"google/gemma-3-27b-it",label:"Gemma 3 27B IT",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-10",releaseDate:"2025-03-12",lastUpdated:"2025-03-12",openWeights:!0,cost:{input:0,output:0},limit:{context:96e3,output:8192}},{id:"google/gemma-3n-e4b-it",label:"Gemma 3n E4B IT",modalities:{input:["text","image","audio"],output:["text"]},toolCall:!1,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-10",releaseDate:"2025-05-20",lastUpdated:"2025-05-20",openWeights:!0,cost:{input:0,output:0},limit:{context:8192,output:8192}},{id:"google/gemma-3n-e4b-it:free",label:"Gemma 3n 4B (free)",modalities:{input:["text","image","audio"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2025-05",releaseDate:"2025-05-20",lastUpdated:"2025-05-20",openWeights:!0,cost:{input:0,output:0},limit:{context:8192,output:8192}},{id:"kwaipilot/kat-coder-pro:free",label:"Kat Coder Pro (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-11",releaseDate:"2025-11-10",lastUpdated:"2025-11-10",openWeights:!1,cost:{input:0,output:0},limit:{context:256e3,output:65536}},{id:"meta-llama/llama-3.2-11b-vision-instruct",label:"Llama 3.2 11B Vision Instruct",modalities:{input:["text","image"],output:["text"]},toolCall:!1,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2023-12",releaseDate:"2024-09-25",lastUpdated:"2024-09-25",openWeights:!0,cost:{input:0,output:0},limit:{context:131072,output:8192}},{id:"meta-llama/llama-3.3-70b-instruct:free",label:"Llama 3.3 70B Instruct (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-12",releaseDate:"2024-12-06",lastUpdated:"2024-12-06",openWeights:!0,cost:{input:0,output:0},limit:{context:65536,output:65536}},{id:"meta-llama/llama-4-scout:free",label:"Llama 4 Scout (free)",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-08",releaseDate:"2025-04-05",lastUpdated:"2025-04-05",openWeights:!0,cost:{input:0,output:0},limit:{context:64e3,output:64e3}},{id:"microsoft/mai-ds-r1:free",label:"MAI DS R1 (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-04-21",lastUpdated:"2025-04-21",openWeights:!0,cost:{input:0,output:0},limit:{context:163840,output:163840}},{id:"minimax/minimax-01",label:"MiniMax-01",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,releaseDate:"2025-01-15",lastUpdated:"2025-01-15",openWeights:!0,cost:{input:.2,output:1.1},limit:{context:1e6,output:1e6}},{id:"minimax/minimax-m1",label:"MiniMax M1",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,releaseDate:"2025-06-17",lastUpdated:"2025-06-17",openWeights:!0,cost:{input:.4,output:2.2},limit:{context:1e6,output:4e4}},{id:"minimax/minimax-m2",label:"MiniMax M2",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,releaseDate:"2025-10-23",lastUpdated:"2025-10-23",openWeights:!0,cost:{input:.28,output:1.15,cacheRead:.28,cacheWrite:1.15},limit:{context:196600,output:118e3},provider:{npm:"@openrouter/ai-sdk-provider"}},{id:"minimax/minimax-m2.1",label:"MiniMax M2.1",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,releaseDate:"2025-12-23",lastUpdated:"2025-12-23",openWeights:!0,cost:{input:.3,output:1.2},limit:{context:204800,output:131072},provider:{npm:"@openrouter/ai-sdk-provider"}},{id:"mistralai/codestral-2508",label:"Codestral 2508",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-05",releaseDate:"2025-08-01",lastUpdated:"2025-08-01",openWeights:!0,cost:{input:.3,output:.9},limit:{context:256e3,output:256e3}},{id:"mistralai/devstral-2512",label:"Devstral 2 2512",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-12",releaseDate:"2025-09-12",lastUpdated:"2025-09-12",openWeights:!0,cost:{input:.15,output:.6},limit:{context:262144,output:262144}},{id:"mistralai/devstral-2512:free",label:"Devstral 2 2512 (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-12",releaseDate:"2025-09-12",lastUpdated:"2025-09-12",openWeights:!0,cost:{input:0,output:0},limit:{context:262144,output:262144}},{id:"mistralai/devstral-medium-2507",label:"Devstral Medium",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-05",releaseDate:"2025-07-10",lastUpdated:"2025-07-10",openWeights:!0,cost:{input:.4,output:2},limit:{context:131072,output:131072}},{id:"mistralai/devstral-small-2505",label:"Devstral Small",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-05",releaseDate:"2025-05-07",lastUpdated:"2025-05-07",openWeights:!0,cost:{input:.06,output:.12},limit:{context:128e3,output:128e3}},{id:"mistralai/devstral-small-2505:free",label:"Devstral Small 2505 (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-05",releaseDate:"2025-05-21",lastUpdated:"2025-05-21",openWeights:!0,cost:{input:0,output:0},limit:{context:32768,output:32768}},{id:"mistralai/devstral-small-2507",label:"Devstral Small 1.1",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-05",releaseDate:"2025-07-10",lastUpdated:"2025-07-10",openWeights:!0,cost:{input:.1,output:.3},limit:{context:131072,output:131072}},{id:"mistralai/mistral-7b-instruct:free",label:"Mistral 7B Instruct (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-05",releaseDate:"2024-05-27",lastUpdated:"2024-05-27",openWeights:!0,cost:{input:0,output:0},limit:{context:32768,output:32768}},{id:"mistralai/mistral-medium-3",label:"Mistral Medium 3",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2025-05",releaseDate:"2025-05-07",lastUpdated:"2025-05-07",openWeights:!1,cost:{input:.4,output:2},limit:{context:131072,output:131072}},{id:"mistralai/mistral-medium-3.1",label:"Mistral Medium 3.1",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2025-05",releaseDate:"2025-08-12",lastUpdated:"2025-08-12",openWeights:!1,cost:{input:.4,output:2},limit:{context:262144,output:262144}},{id:"mistralai/mistral-nemo:free",label:"Mistral Nemo (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-07",releaseDate:"2024-07-19",lastUpdated:"2024-07-19",openWeights:!0,cost:{input:0,output:0},limit:{context:131072,output:131072}},{id:"mistralai/mistral-small-3.1-24b-instruct",label:"Mistral Small 3.1 24B Instruct",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-10",releaseDate:"2025-03-17",lastUpdated:"2025-03-17",openWeights:!0,cost:{input:0,output:0},limit:{context:128e3,output:8192}},{id:"mistralai/mistral-small-3.2-24b-instruct",label:"Mistral Small 3.2 24B Instruct",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-10",releaseDate:"2025-06-20",lastUpdated:"2025-06-20",openWeights:!0,cost:{input:0,output:0},limit:{context:96e3,output:8192}},{id:"mistralai/mistral-small-3.2-24b-instruct:free",label:"Mistral Small 3.2 24B (free)",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2025-06",releaseDate:"2025-06-20",lastUpdated:"2025-06-20",openWeights:!0,cost:{input:0,output:0},limit:{context:96e3,output:96e3}},{id:"moonshotai/kimi-dev-72b:free",label:"Kimi Dev 72b (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-06",releaseDate:"2025-06-16",lastUpdated:"2025-06-16",openWeights:!0,cost:{input:0,output:0},limit:{context:131072,output:131072}},{id:"moonshotai/kimi-k2",label:"Kimi K2",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-07-11",lastUpdated:"2025-07-11",openWeights:!0,cost:{input:.55,output:2.2},limit:{context:131072,output:32768}},{id:"moonshotai/kimi-k2-0905",label:"Kimi K2 Instruct 0905",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-09-05",lastUpdated:"2025-09-05",openWeights:!0,cost:{input:.6,output:2.5},limit:{context:262144,output:16384}},{id:"moonshotai/kimi-k2-0905:exacto",label:"Kimi K2 Instruct 0905 (exacto)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-09-05",lastUpdated:"2025-09-05",openWeights:!0,cost:{input:.6,output:2.5},limit:{context:262144,output:16384}},{id:"moonshotai/kimi-k2-thinking",label:"Kimi K2 Thinking",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-08",releaseDate:"2025-11-06",lastUpdated:"2025-11-06",openWeights:!0,cost:{input:.6,output:2.5,cacheRead:.15},limit:{context:262144,output:262144},provider:{npm:"@openrouter/ai-sdk-provider"}},{id:"moonshotai/kimi-k2:free",label:"Kimi K2 (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-11",lastUpdated:"2025-07-11",openWeights:!0,cost:{input:0,output:0},limit:{context:32800,output:32800}},{id:"moonshotai/kimi-k2.5",label:"Kimi K2.5",modalities:{input:["text","image","video"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2026-01-27",lastUpdated:"2026-01-27",openWeights:!0,cost:{input:.6,output:3,cacheRead:.1},limit:{context:262144,output:262144},provider:{npm:"@openrouter/ai-sdk-provider"}},{id:"nousresearch/deephermes-3-llama-3-8b-preview",label:"DeepHermes 3 Llama 3 8B Preview",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-04",releaseDate:"2025-02-28",lastUpdated:"2025-02-28",openWeights:!0,cost:{input:0,output:0},limit:{context:131072,output:8192}},{id:"nousresearch/hermes-4-405b",label:"Hermes 4 405B",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2023-12",releaseDate:"2025-08-25",lastUpdated:"2025-08-25",openWeights:!0,cost:{input:1,output:3},limit:{context:131072,output:131072}},{id:"nousresearch/hermes-4-70b",label:"Hermes 4 70B",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2023-12",releaseDate:"2025-08-25",lastUpdated:"2025-08-25",openWeights:!0,cost:{input:.13,output:.4},limit:{context:131072,output:131072}},{id:"nvidia/nemotron-nano-9b-v2",label:"nvidia-nemotron-nano-9b-v2",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-09",releaseDate:"2025-08-18",lastUpdated:"2025-08-18",openWeights:!0,cost:{input:.04,output:.16},limit:{context:131072,output:131072}},{id:"openai/gpt-4.1",label:"GPT-4.1",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-04",releaseDate:"2025-04-14",lastUpdated:"2025-04-14",openWeights:!1,cost:{input:2,output:8,cacheRead:.5},limit:{context:1047576,output:32768}},{id:"openai/gpt-4.1-mini",label:"GPT-4.1 Mini",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-04",releaseDate:"2025-04-14",lastUpdated:"2025-04-14",openWeights:!1,cost:{input:.4,output:1.6,cacheRead:.1},limit:{context:1047576,output:32768}},{id:"openai/gpt-4o-mini",label:"GPT-4o-mini",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-10",releaseDate:"2024-07-18",lastUpdated:"2024-07-18",openWeights:!1,cost:{input:.15,output:.6,cacheRead:.08},limit:{context:128e3,output:16384}},{id:"openai/gpt-5",label:"GPT-5",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-10-01",releaseDate:"2025-08-07",lastUpdated:"2025-08-07",openWeights:!1,cost:{input:1.25,output:10},limit:{context:4e5,output:128e3}},{id:"openai/gpt-5-chat",label:"GPT-5 Chat (latest)",modalities:{input:["text","image"],output:["text"]},toolCall:!1,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-09-30",releaseDate:"2025-08-07",lastUpdated:"2025-08-07",openWeights:!1,cost:{input:1.25,output:10},limit:{context:4e5,output:128e3}},{id:"openai/gpt-5-codex",label:"GPT-5 Codex",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-10-01",releaseDate:"2025-09-15",lastUpdated:"2025-09-15",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.125},limit:{context:4e5,output:128e3}},{id:"openai/gpt-5-image",label:"GPT-5 Image",modalities:{input:["text","image","pdf"],output:["text","image"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-10-01",releaseDate:"2025-10-14",lastUpdated:"2025-10-14",openWeights:!1,cost:{input:5,output:10,cacheRead:1.25},limit:{context:4e5,output:128e3}},{id:"openai/gpt-5-mini",label:"GPT-5 Mini",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-10-01",releaseDate:"2025-08-07",lastUpdated:"2025-08-07",openWeights:!1,cost:{input:.25,output:2},limit:{context:4e5,output:128e3}},{id:"openai/gpt-5-nano",label:"GPT-5 Nano",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-10-01",releaseDate:"2025-08-07",lastUpdated:"2025-08-07",openWeights:!1,cost:{input:.05,output:.4},limit:{context:4e5,output:128e3}},{id:"openai/gpt-5-pro",label:"GPT-5 Pro",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-10-06",lastUpdated:"2025-10-06",openWeights:!1,cost:{input:15,output:120},limit:{context:4e5,output:272e3}},{id:"openai/gpt-5.1",label:"GPT-5.1",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-09-30",releaseDate:"2025-11-13",lastUpdated:"2025-11-13",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.125},limit:{context:4e5,output:128e3}},{id:"openai/gpt-5.1-chat",label:"GPT-5.1 Chat",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-09-30",releaseDate:"2025-11-13",lastUpdated:"2025-11-13",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.125},limit:{context:128e3,output:16384}},{id:"openai/gpt-5.1-codex",label:"GPT-5.1-Codex",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-09-30",releaseDate:"2025-11-13",lastUpdated:"2025-11-13",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.125},limit:{context:4e5,output:128e3}},{id:"openai/gpt-5.1-codex-max",label:"GPT-5.1-Codex-Max",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-09-30",releaseDate:"2025-11-13",lastUpdated:"2025-11-13",openWeights:!1,cost:{input:1.1,output:9,cacheRead:.11},limit:{context:4e5,output:128e3}},{id:"openai/gpt-5.1-codex-mini",label:"GPT-5.1-Codex-Mini",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-09-30",releaseDate:"2025-11-13",lastUpdated:"2025-11-13",openWeights:!1,cost:{input:.25,output:2,cacheRead:.025},limit:{context:4e5,output:1e5}},{id:"openai/gpt-5.2",label:"GPT-5.2",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2025-08-31",releaseDate:"2025-12-11",lastUpdated:"2025-12-11",openWeights:!1,cost:{input:1.75,output:14,cacheRead:.175},limit:{context:4e5,output:128e3}},{id:"openai/gpt-5.2-chat-latest",label:"GPT-5.2 Chat",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2025-08-31",releaseDate:"2025-12-11",lastUpdated:"2025-12-11",openWeights:!1,cost:{input:1.75,output:14,cacheRead:.175},limit:{context:128e3,output:16384}},{id:"openai/gpt-5.2-codex",label:"GPT-5.2-Codex",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-08-31",releaseDate:"2026-01-14",lastUpdated:"2026-01-14",openWeights:!1,cost:{input:1.75,output:14,cacheRead:.175},limit:{context:4e5,output:128e3}},{id:"openai/gpt-5.2-pro",label:"GPT-5.2 Pro",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2025-08-31",releaseDate:"2025-12-11",lastUpdated:"2025-12-11",openWeights:!1,cost:{input:21,output:168},limit:{context:4e5,output:128e3}},{id:"openai/gpt-oss-120b",label:"GPT OSS 120B",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,releaseDate:"2025-08-05",lastUpdated:"2025-08-05",openWeights:!0,cost:{input:.072,output:.28},limit:{context:131072,output:32768}},{id:"openai/gpt-oss-120b:exacto",label:"GPT OSS 120B (exacto)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,releaseDate:"2025-08-05",lastUpdated:"2025-08-05",openWeights:!0,cost:{input:.05,output:.24},limit:{context:131072,output:32768}},{id:"openai/gpt-oss-20b",label:"GPT OSS 20B",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,releaseDate:"2025-08-05",lastUpdated:"2025-08-05",openWeights:!0,cost:{input:.05,output:.2},limit:{context:131072,output:32768}},{id:"openai/gpt-oss-safeguard-20b",label:"GPT OSS Safeguard 20B",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,releaseDate:"2025-10-29",lastUpdated:"2025-10-29",openWeights:!1,cost:{input:.075,output:.3},limit:{context:131072,output:65536}},{id:"openai/o4-mini",label:"o4 Mini",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2024-06",releaseDate:"2025-04-16",lastUpdated:"2025-04-16",openWeights:!1,cost:{input:1.1,output:4.4,cacheRead:.28},limit:{context:2e5,output:1e5}},{id:"openrouter/sherlock-dash-alpha",label:"Sherlock Dash Alpha",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2025-11",releaseDate:"2025-11-15",lastUpdated:"2025-12-14",openWeights:!1,cost:{input:0,output:0},limit:{context:184e4,output:0}},{id:"openrouter/sherlock-think-alpha",label:"Sherlock Think Alpha",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-11",releaseDate:"2025-11-15",lastUpdated:"2025-12-14",openWeights:!1,cost:{input:0,output:0},limit:{context:184e4,output:0}},{id:"qwen/qwen-2.5-coder-32b-instruct",label:"Qwen2.5 Coder 32B Instruct",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2024-11-11",lastUpdated:"2024-11-11",openWeights:!0,cost:{input:0,output:0},limit:{context:32768,output:8192}},{id:"qwen/qwen2.5-vl-32b-instruct:free",label:"Qwen2.5 VL 32B Instruct (free)",modalities:{input:["text","image","video"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2025-03",releaseDate:"2025-03-24",lastUpdated:"2025-03-24",openWeights:!0,cost:{input:0,output:0},limit:{context:8192,output:8192}},{id:"qwen/qwen2.5-vl-72b-instruct",label:"Qwen2.5 VL 72B Instruct",modalities:{input:["text","image"],output:["text"]},toolCall:!1,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-10",releaseDate:"2025-02-01",lastUpdated:"2025-02-01",openWeights:!0,cost:{input:0,output:0},limit:{context:32768,output:8192}},{id:"qwen/qwen2.5-vl-72b-instruct:free",label:"Qwen2.5 VL 72B Instruct (free)",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2025-02",releaseDate:"2025-02-01",lastUpdated:"2025-02-01",openWeights:!0,cost:{input:0,output:0},limit:{context:32768,output:32768}},{id:"qwen/qwen3-14b:free",label:"Qwen3 14B (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-04-28",lastUpdated:"2025-04-28",openWeights:!0,cost:{input:0,output:0},limit:{context:40960,output:40960}},{id:"qwen/qwen3-235b-a22b-07-25",label:"Qwen3 235B A22B Instruct 2507",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-04-28",lastUpdated:"2025-07-21",openWeights:!0,cost:{input:.15,output:.85},limit:{context:262144,output:131072}},{id:"qwen/qwen3-235b-a22b-07-25:free",label:"Qwen3 235B A22B Instruct 2507 (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-04-28",lastUpdated:"2025-07-21",openWeights:!0,cost:{input:0,output:0},limit:{context:262144,output:131072}},{id:"qwen/qwen3-235b-a22b-thinking-2507",label:"Qwen3 235B A22B Thinking 2507",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-25",lastUpdated:"2025-07-25",openWeights:!0,cost:{input:.078,output:.312},limit:{context:262144,output:81920}},{id:"qwen/qwen3-235b-a22b:free",label:"Qwen3 235B A22B (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-04-28",lastUpdated:"2025-04-28",openWeights:!0,cost:{input:0,output:0},limit:{context:131072,output:131072}},{id:"qwen/qwen3-30b-a3b-instruct-2507",label:"Qwen3 30B A3B Instruct 2507",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-29",lastUpdated:"2025-07-29",openWeights:!0,cost:{input:.2,output:.8},limit:{context:262e3,output:262e3}},{id:"qwen/qwen3-30b-a3b-thinking-2507",label:"Qwen3 30B A3B Thinking 2507",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-29",lastUpdated:"2025-07-29",openWeights:!0,cost:{input:.2,output:.8},limit:{context:262e3,output:262e3}},{id:"qwen/qwen3-30b-a3b:free",label:"Qwen3 30B A3B (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-04-28",lastUpdated:"2025-04-28",openWeights:!0,cost:{input:0,output:0},limit:{context:40960,output:40960}},{id:"qwen/qwen3-32b:free",label:"Qwen3 32B (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-04-28",lastUpdated:"2025-04-28",openWeights:!0,cost:{input:0,output:0},limit:{context:40960,output:40960}},{id:"qwen/qwen3-8b:free",label:"Qwen3 8B (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-04-28",lastUpdated:"2025-04-28",openWeights:!0,cost:{input:0,output:0},limit:{context:40960,output:40960}},{id:"qwen/qwen3-coder",label:"Qwen3 Coder",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-23",lastUpdated:"2025-07-23",openWeights:!0,cost:{input:.3,output:1.2},limit:{context:262144,output:66536}},{id:"qwen/qwen3-coder-30b-a3b-instruct",label:"Qwen3 Coder 30B A3B Instruct",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-31",lastUpdated:"2025-07-31",openWeights:!0,cost:{input:.07,output:.27},limit:{context:16e4,output:65536}},{id:"qwen/qwen3-coder-flash",label:"Qwen3 Coder Flash",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-23",lastUpdated:"2025-07-23",openWeights:!1,cost:{input:.3,output:1.5},limit:{context:128e3,output:66536}},{id:"qwen/qwen3-coder:exacto",label:"Qwen3 Coder (exacto)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-23",lastUpdated:"2025-07-23",openWeights:!0,cost:{input:.38,output:1.53},limit:{context:131072,output:32768}},{id:"qwen/qwen3-coder:free",label:"Qwen3 Coder 480B A35B Instruct (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-23",lastUpdated:"2025-07-23",openWeights:!0,cost:{input:0,output:0},limit:{context:262144,output:66536}},{id:"qwen/qwen3-max",label:"Qwen3 Max",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,releaseDate:"2025-09-05",lastUpdated:"2025-09-05",openWeights:!1,cost:{input:1.2,output:6},limit:{context:262144,output:32768}},{id:"qwen/qwen3-next-80b-a3b-instruct",label:"Qwen3 Next 80B A3B Instruct",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-09-11",lastUpdated:"2025-09-11",openWeights:!0,cost:{input:.14,output:1.4},limit:{context:262144,output:262144}},{id:"qwen/qwen3-next-80b-a3b-thinking",label:"Qwen3 Next 80B A3B Thinking",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-09-11",lastUpdated:"2025-09-11",openWeights:!0,cost:{input:.14,output:1.4},limit:{context:262144,output:262144}},{id:"qwen/qwq-32b:free",label:"QwQ 32B (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-03",releaseDate:"2025-03-05",lastUpdated:"2025-03-05",openWeights:!0,cost:{input:0,output:0},limit:{context:32768,output:32768}},{id:"rekaai/reka-flash-3",label:"Reka Flash 3",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-03-12",lastUpdated:"2025-03-12",openWeights:!0,cost:{input:0,output:0},limit:{context:32768,output:8192}},{id:"sarvamai/sarvam-m:free",label:"Sarvam-M (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-05",releaseDate:"2025-05-25",lastUpdated:"2025-05-25",openWeights:!0,cost:{input:0,output:0},limit:{context:32768,output:32768}},{id:"thudm/glm-z1-32b:free",label:"GLM Z1 32B (free)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-04-17",lastUpdated:"2025-04-17",openWeights:!0,cost:{input:0,output:0},limit:{context:32768,output:32768}},{id:"tngtech/deepseek-r1t2-chimera:free",label:"DeepSeek R1T2 Chimera (free)",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-07",releaseDate:"2025-07-08",lastUpdated:"2025-07-08",openWeights:!0,cost:{input:0,output:0},limit:{context:163840,output:163840}},{id:"x-ai/grok-3",label:"Grok 3",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-11",releaseDate:"2025-02-17",lastUpdated:"2025-02-17",openWeights:!1,cost:{input:3,output:15,cacheRead:.75,cacheWrite:15},limit:{context:131072,output:8192}},{id:"x-ai/grok-3-beta",label:"Grok 3 Beta",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-11",releaseDate:"2025-02-17",lastUpdated:"2025-02-17",openWeights:!1,cost:{input:3,output:15,cacheRead:.75,cacheWrite:15},limit:{context:131072,output:8192}},{id:"x-ai/grok-3-mini",label:"Grok 3 Mini",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-11",releaseDate:"2025-02-17",lastUpdated:"2025-02-17",openWeights:!1,cost:{input:.3,output:.5,cacheRead:.075,cacheWrite:.5},limit:{context:131072,output:8192}},{id:"x-ai/grok-3-mini-beta",label:"Grok 3 Mini Beta",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-11",releaseDate:"2025-02-17",lastUpdated:"2025-02-17",openWeights:!1,cost:{input:.3,output:.5,cacheRead:.075,cacheWrite:.5},limit:{context:131072,output:8192}},{id:"x-ai/grok-4",label:"Grok 4",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-07",releaseDate:"2025-07-09",lastUpdated:"2025-07-09",openWeights:!1,cost:{input:3,output:15,cacheRead:.75,cacheWrite:15},limit:{context:256e3,output:64e3}},{id:"x-ai/grok-4-fast",label:"Grok 4 Fast",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-11",releaseDate:"2025-08-19",lastUpdated:"2025-08-19",openWeights:!1,cost:{input:.2,output:.5,cacheRead:.05,cacheWrite:.05},limit:{context:2e6,output:3e4}},{id:"x-ai/grok-4.1-fast",label:"Grok 4.1 Fast",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-11",releaseDate:"2025-11-19",lastUpdated:"2025-11-19",openWeights:!1,cost:{input:.2,output:.5,cacheRead:.05,cacheWrite:.05},limit:{context:2e6,output:3e4}},{id:"x-ai/grok-code-fast-1",label:"Grok Code Fast 1",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-08",releaseDate:"2025-08-26",lastUpdated:"2025-08-26",openWeights:!1,cost:{input:.2,output:1.5,cacheRead:.02},limit:{context:256e3,output:1e4}},{id:"z-ai/glm-4.5",label:"GLM 4.5",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-28",lastUpdated:"2025-07-28",openWeights:!0,cost:{input:.6,output:2.2},limit:{context:128e3,output:96e3}},{id:"z-ai/glm-4.5-air",label:"GLM 4.5 Air",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-28",lastUpdated:"2025-07-28",openWeights:!0,cost:{input:.2,output:1.1},limit:{context:128e3,output:96e3}},{id:"z-ai/glm-4.5-air:free",label:"GLM 4.5 Air (free)",modalities:{input:["text"],output:["text"]},toolCall:!1,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-28",lastUpdated:"2025-07-28",openWeights:!0,cost:{input:0,output:0},limit:{context:128e3,output:96e3}},{id:"z-ai/glm-4.5v",label:"GLM 4.5V",modalities:{input:["text","image","video"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-04",releaseDate:"2025-08-11",lastUpdated:"2025-08-11",openWeights:!0,cost:{input:.6,output:1.8},limit:{context:64e3,output:16384}},{id:"z-ai/glm-4.6",label:"GLM 4.6",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-09",releaseDate:"2025-09-30",lastUpdated:"2025-09-30",openWeights:!0,cost:{input:.6,output:2.2,cacheRead:.11},limit:{context:2e5,output:128e3}},{id:"z-ai/glm-4.6:exacto",label:"GLM 4.6 (exacto)",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-09",releaseDate:"2025-09-30",lastUpdated:"2025-09-30",openWeights:!0,cost:{input:.6,output:1.9,cacheRead:.11},limit:{context:2e5,output:128e3}},{id:"z-ai/glm-4.7",label:"GLM-4.7",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-12-22",lastUpdated:"2025-12-22",openWeights:!0,cost:{input:.6,output:2.2,cacheRead:.11},limit:{context:204800,output:131072},provider:{npm:"@openrouter/ai-sdk-provider"}}],label:"OpenRouter",env:["OPENROUTER_API_KEY"],npm:"@ai-sdk/openai-compatible",api:"https://openrouter.ai/api/v1",doc:"https://openrouter.ai/models"},opencode:{id:"opencode",models:[{id:"big-pickle",label:"Big Pickle",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-01",releaseDate:"2025-10-17",lastUpdated:"2025-10-17",openWeights:!1,cost:{input:0,output:0,cacheRead:0,cacheWrite:0},limit:{context:2e5,output:128e3}},{id:"claude-3-5-haiku",label:"Claude Haiku 3.5",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!0,temperature:!0,knowledge:"2024-07-31",releaseDate:"2024-10-22",lastUpdated:"2024-10-22",openWeights:!1,cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},limit:{context:2e5,output:8192},provider:{npm:"@ai-sdk/anthropic"}},{id:"claude-haiku-4-5",label:"Claude Haiku 4.5",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-02-28",releaseDate:"2025-10-15",lastUpdated:"2025-10-15",openWeights:!1,cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},limit:{context:2e5,output:64e3},provider:{npm:"@ai-sdk/anthropic"}},{id:"claude-opus-4-1",label:"Claude Opus 4.1",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-03-31",releaseDate:"2025-08-05",lastUpdated:"2025-08-05",openWeights:!1,cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},limit:{context:2e5,output:32e3},provider:{npm:"@ai-sdk/anthropic"}},{id:"claude-opus-4-5",label:"Claude Opus 4.5",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-03-31",releaseDate:"2025-11-24",lastUpdated:"2025-11-24",openWeights:!1,cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},limit:{context:2e5,output:64e3},provider:{npm:"@ai-sdk/anthropic"}},{id:"claude-sonnet-4",label:"Claude Sonnet 4",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-03-31",releaseDate:"2025-05-22",lastUpdated:"2025-05-22",openWeights:!1,cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},limit:{context:1e6,output:64e3},provider:{npm:"@ai-sdk/anthropic"}},{id:"claude-sonnet-4-5",label:"Claude Sonnet 4.5",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-07-31",releaseDate:"2025-09-29",lastUpdated:"2025-09-29",openWeights:!1,cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},limit:{context:1e6,output:64e3},provider:{npm:"@ai-sdk/anthropic"}},{id:"gemini-3-flash",label:"Gemini 3 Flash",modalities:{input:["text","image","video","audio","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-12-17",lastUpdated:"2025-12-17",openWeights:!1,cost:{input:.5,output:3,cacheRead:.05},limit:{context:1048576,output:65536},provider:{npm:"@ai-sdk/google"}},{id:"gemini-3-pro",label:"Gemini 3 Pro",modalities:{input:["text","image","video","audio","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-01",releaseDate:"2025-11-18",lastUpdated:"2025-11-18",openWeights:!1,cost:{input:2,output:12,cacheRead:.2},limit:{context:1048576,output:65536},provider:{npm:"@ai-sdk/google"}},{id:"glm-4.6",label:"GLM-4.6",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-09-30",lastUpdated:"2025-09-30",openWeights:!0,cost:{input:.6,output:2.2,cacheRead:.1},limit:{context:204800,output:131072}},{id:"glm-4.7",label:"GLM-4.7",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-12-22",lastUpdated:"2025-12-22",openWeights:!0,cost:{input:.6,output:2.2,cacheRead:.1},limit:{context:204800,output:131072}},{id:"glm-4.7-free",label:"GLM-4.7",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-12-22",lastUpdated:"2025-12-22",openWeights:!0,cost:{input:0,output:0,cacheRead:0},limit:{context:204800,output:131072}},{id:"gpt-5",label:"GPT-5",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-08-07",lastUpdated:"2025-08-07",openWeights:!1,cost:{input:1.07,output:8.5,cacheRead:.107},limit:{context:4e5,output:128e3},provider:{npm:"@ai-sdk/openai"}},{id:"gpt-5-codex",label:"GPT-5 Codex",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-09-15",lastUpdated:"2025-09-15",openWeights:!1,cost:{input:1.07,output:8.5,cacheRead:.107},limit:{context:4e5,output:128e3},provider:{npm:"@ai-sdk/openai"}},{id:"gpt-5-nano",label:"GPT-5 Nano",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-05-30",releaseDate:"2025-08-07",lastUpdated:"2025-08-07",openWeights:!1,cost:{input:0,output:0,cacheRead:0},limit:{context:4e5,output:128e3},provider:{npm:"@ai-sdk/openai"}},{id:"gpt-5.1",label:"GPT-5.1",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-11-13",lastUpdated:"2025-11-13",openWeights:!1,cost:{input:1.07,output:8.5,cacheRead:.107},limit:{context:4e5,output:128e3},provider:{npm:"@ai-sdk/openai"}},{id:"gpt-5.1-codex",label:"GPT-5.1 Codex",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-11-13",lastUpdated:"2025-11-13",openWeights:!1,cost:{input:1.07,output:8.5,cacheRead:.107},limit:{context:4e5,output:128e3},provider:{npm:"@ai-sdk/openai"}},{id:"gpt-5.1-codex-max",label:"GPT-5.1 Codex Max",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-11-13",lastUpdated:"2025-11-13",openWeights:!1,cost:{input:1.25,output:10,cacheRead:.125},limit:{context:4e5,output:128e3},provider:{npm:"@ai-sdk/openai"}},{id:"gpt-5.1-codex-mini",label:"GPT-5.1 Codex Mini",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2024-09-30",releaseDate:"2025-11-13",lastUpdated:"2025-11-13",openWeights:!1,cost:{input:.25,output:2,cacheRead:.025},limit:{context:4e5,output:128e3},provider:{npm:"@ai-sdk/openai"}},{id:"gpt-5.2",label:"GPT-5.2",modalities:{input:["text","image"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2025-08-31",releaseDate:"2025-12-11",lastUpdated:"2025-12-11",openWeights:!1,cost:{input:1.75,output:14,cacheRead:.175},limit:{context:4e5,output:128e3},provider:{npm:"@ai-sdk/openai"}},{id:"gpt-5.2-codex",label:"GPT-5.2 Codex",modalities:{input:["text","image","pdf"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!1,knowledge:"2025-08-31",releaseDate:"2026-01-14",lastUpdated:"2026-01-14",openWeights:!1,cost:{input:1.75,output:14,cacheRead:.175},limit:{context:4e5,output:128e3},provider:{npm:"@ai-sdk/openai"}},{id:"grok-code",label:"Grok Code Fast 1",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,releaseDate:"2025-08-20",lastUpdated:"2025-08-20",openWeights:!1,cost:{input:0,output:0,cacheRead:0,cacheWrite:0},limit:{context:256e3,output:256e3}},{id:"kimi-k2",label:"Kimi K2",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-09-05",lastUpdated:"2025-09-05",openWeights:!0,cost:{input:.4,output:2.5,cacheRead:.4},limit:{context:262144,output:262144}},{id:"kimi-k2-thinking",label:"Kimi K2 Thinking",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-09-05",lastUpdated:"2025-09-05",openWeights:!0,cost:{input:.4,output:2.5,cacheRead:.4},limit:{context:262144,output:262144}},{id:"kimi-k2.5",label:"Kimi K2.5",modalities:{input:["text","image","video"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2026-01-27",lastUpdated:"2026-01-27",openWeights:!0,cost:{input:1.2,output:1.2,cacheRead:.6},limit:{context:262144,output:262144}},{id:"minimax-m2.1",label:"MiniMax M2.1",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-01",releaseDate:"2025-12-23",lastUpdated:"2025-12-23",openWeights:!0,cost:{input:.3,output:1.2,cacheRead:.1},limit:{context:204800,output:131072}},{id:"minimax-m2.1-free",label:"MiniMax M2.1",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-01",releaseDate:"2025-12-23",lastUpdated:"2025-12-23",openWeights:!0,cost:{input:0,output:0,cacheRead:0},limit:{context:204800,output:131072},provider:{npm:"@ai-sdk/anthropic"}},{id:"qwen3-coder",label:"Qwen3 Coder",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-23",lastUpdated:"2025-07-23",openWeights:!0,cost:{input:.45,output:1.8},limit:{context:262144,output:65536}}],label:"OpenCode Zen",env:["OPENCODE_API_KEY"],npm:"@ai-sdk/openai-compatible",api:"https://opencode.ai/zen/v1",doc:"https://opencode.ai/docs/zen"},zai:{id:"zai",models:[{id:"glm-4.5",label:"GLM-4.5",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-28",lastUpdated:"2025-07-28",openWeights:!0,cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},limit:{context:131072,output:98304}},{id:"glm-4.5-air",label:"GLM-4.5-Air",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-28",lastUpdated:"2025-07-28",openWeights:!0,cost:{input:.2,output:1.1,cacheRead:.03,cacheWrite:0},limit:{context:131072,output:98304}},{id:"glm-4.5-flash",label:"GLM-4.5-Flash",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-28",lastUpdated:"2025-07-28",openWeights:!0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0},limit:{context:131072,output:98304}},{id:"glm-4.5v",label:"GLM-4.5V",modalities:{input:["text","image","video"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-04",releaseDate:"2025-08-11",lastUpdated:"2025-08-11",openWeights:!0,cost:{input:.6,output:1.8},limit:{context:64e3,output:16384}},{id:"glm-4.6",label:"GLM-4.6",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-09-30",lastUpdated:"2025-09-30",openWeights:!0,cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},limit:{context:204800,output:131072}},{id:"glm-4.6v",label:"GLM-4.6V",modalities:{input:["text","image","video"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-04",releaseDate:"2025-12-08",lastUpdated:"2025-12-08",openWeights:!0,cost:{input:.3,output:.9},limit:{context:128e3,output:32768}},{id:"glm-4.7",label:"GLM-4.7",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-12-22",lastUpdated:"2025-12-22",openWeights:!0,cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},limit:{context:204800,output:131072}}],label:"Z.AI",env:["ZHIPU_API_KEY"],npm:"@ai-sdk/openai-compatible",api:"https://api.z.ai/api/paas/v4",doc:"https://docs.z.ai/guides/overview/pricing"},"zai-coding":{id:"zai-coding",models:[{id:"glm-4.5",label:"GLM-4.5",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-28",lastUpdated:"2025-07-28",openWeights:!0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0},limit:{context:131072,output:98304}},{id:"glm-4.5-air",label:"GLM-4.5-Air",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-28",lastUpdated:"2025-07-28",openWeights:!0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0},limit:{context:131072,output:98304}},{id:"glm-4.5-flash",label:"GLM-4.5-Flash",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-07-28",lastUpdated:"2025-07-28",openWeights:!0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0},limit:{context:131072,output:98304}},{id:"glm-4.5v",label:"GLM-4.5V",modalities:{input:["text","image","video"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-04",releaseDate:"2025-08-11",lastUpdated:"2025-08-11",openWeights:!0,cost:{input:0,output:0},limit:{context:64e3,output:16384}},{id:"glm-4.6",label:"GLM-4.6",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-09-30",lastUpdated:"2025-09-30",openWeights:!0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0},limit:{context:204800,output:131072}},{id:"glm-4.6v",label:"GLM-4.6V",modalities:{input:["text","image","video"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!0,temperature:!0,knowledge:"2025-04",releaseDate:"2025-12-08",lastUpdated:"2025-12-08",openWeights:!0,cost:{input:0,output:0},limit:{context:128e3,output:32768}},{id:"glm-4.7",label:"GLM-4.7",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2025-12-22",lastUpdated:"2025-12-22",openWeights:!0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0},limit:{context:204800,output:131072}},{id:"glm-4.7-flash",label:"GLM-4.7-Flash",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-04",releaseDate:"2026-01-19",lastUpdated:"2026-01-19",openWeights:!0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0},limit:{context:2e5,output:131072}}],label:"Z.AI Coding Plan",env:["ZHIPU_API_KEY"],npm:"@ai-sdk/openai-compatible",api:"https://api.z.ai/api/coding/paas/v4",doc:"https://docs.z.ai/devpack/overview"},moonshot:{id:"moonshot",models:[{id:"kimi-k2-0711-preview",label:"Kimi K2 0711",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-07-14",lastUpdated:"2025-07-14",openWeights:!0,cost:{input:.6,output:2.5,cacheRead:.15},limit:{context:131072,output:16384}},{id:"kimi-k2-0905-preview",label:"Kimi K2 0905",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-09-05",lastUpdated:"2025-09-05",openWeights:!0,cost:{input:.6,output:2.5,cacheRead:.15},limit:{context:262144,output:262144}},{id:"kimi-k2-thinking",label:"Kimi K2 Thinking",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-08",releaseDate:"2025-11-06",lastUpdated:"2025-11-06",openWeights:!0,cost:{input:.6,output:2.5,cacheRead:.15},limit:{context:262144,output:262144}},{id:"kimi-k2-thinking-turbo",label:"Kimi K2 Thinking Turbo",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2024-08",releaseDate:"2025-11-06",lastUpdated:"2025-11-06",openWeights:!0,cost:{input:1.15,output:8,cacheRead:.15},limit:{context:262144,output:262144}},{id:"kimi-k2-turbo-preview",label:"Kimi K2 Turbo",modalities:{input:["text"],output:["text"]},toolCall:!0,reasoningText:!1,attachment:!1,temperature:!0,knowledge:"2024-10",releaseDate:"2025-09-05",lastUpdated:"2025-09-05",openWeights:!0,cost:{input:2.4,output:10,cacheRead:.6},limit:{context:262144,output:262144}},{id:"kimi-k2.5",label:"Kimi K2.5",modalities:{input:["text","image","video"],output:["text"]},toolCall:!0,reasoningText:!0,attachment:!1,temperature:!0,knowledge:"2025-01",releaseDate:"2026-01",lastUpdated:"2026-01",openWeights:!0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0},limit:{context:262144,output:262144}}],label:"Moonshot AI",env:["MOONSHOT_API_KEY"],npm:"@ai-sdk/openai-compatible",api:"https://api.moonshot.ai/v1",doc:"https://platform.moonshot.ai/docs/api/chat"}},qT="setu",_AA=A=>!!(A==="codex-mini-latest"||A.startsWith("gpt-5")||A.includes("codex")),JAA=A=>!!(A.includes("-3-5-")||A.includes("-3.5-")||A.match(/claude-(haiku|sonnet|opus)-3/)||A.includes("-4-")||A.includes("-4.")||A.match(/claude-(haiku|sonnet|opus)-4/)),HAA=[{id:"openai",npm:"@ai-sdk/openai",family:"openai"},{id:"anthropic",npm:"@ai-sdk/anthropic",family:"anthropic"},{id:"moonshot",npm:"@ai-sdk/openai-compatible",family:"moonshot"}];function jAA(A){return{...A,modalities:A.modalities?{input:A.modalities.input?[...A.modalities.input]:void 0,output:A.modalities.output?[...A.modalities.output]:void 0}:void 0,cost:A.cost?{...A.cost}:void 0,limit:A.limit?{...A.limit}:void 0,provider:A.provider?{...A.provider}:void 0}}function YAA(A){const e=HAA.flatMap(({id:r,npm:o,family:s})=>(A[r]?.models??[]).filter(E=>r==="openai"?_AA(E.id):r==="anthropic"?JAA(E.id):!0).map(E=>{const Q=jAA(E);return Q.provider={...Q.provider??{},npm:o,family:s},Q}));if(!e.length)return null;e.sort((r,o)=>{const s=r.provider?.npm??"",g=o.provider?.npm??"";return s===g?r.id.localeCompare(o.id):s==="@ai-sdk/openai"?-1:g==="@ai-sdk/openai"?1:s.localeCompare(g)});const t="codex-mini-latest",n=e.findIndex(r=>r.id===t);if(n>0){const[r]=e.splice(n,1);e.unshift(r)}return{id:qT,label:"Setu",env:["SETU_PRIVATE_KEY"],api:"https://setu.agi.nitish.sh/v1",doc:"https://setu.agi.nitish.sh/docs",models:e}}function PAA(A){const e=YAA(A),t={...A};return e&&(t[qT]=e),t}const zAA=PAA(KAA),VAA={openai:[{match:A=>A.includes("gpt-4o-mini"),inputPerMillion:.15,outputPerMillion:.6},{match:A=>A.includes("gpt-4o"),inputPerMillion:5,outputPerMillion:15},{match:A=>A.includes("gpt-4.1-mini"),inputPerMillion:1,outputPerMillion:4},{match:A=>A.includes("gpt-4.1"),inputPerMillion:5,outputPerMillion:15}],anthropic:[{match:A=>A.includes("claude-3-haiku"),inputPerMillion:.25,outputPerMillion:1.25},{match:A=>A.includes("claude-3-sonnet"),inputPerMillion:3,outputPerMillion:15},{match:A=>A.includes("claude-3-opus"),inputPerMillion:15,outputPerMillion:75}],google:[{match:A=>A.includes("gemini-1.5-flash"),inputPerMillion:.35,outputPerMillion:1.05},{match:A=>A.includes("gemini-1.5-pro"),inputPerMillion:3.5,outputPerMillion:10.5}],openrouter:[],opencode:[],setu:[],zai:[],"zai-coding":[],moonshot:[]};function WAA(A,e){const t=VAA[A];if(t)return t.find(n=>{try{return n.match(e)}catch{return!1}})}function ZAA(A,e){const t=zAA[A];if(!t)return;const n=e.toLowerCase();return t.models.find(r=>r.id?.toLowerCase()===n)}function KT(A,e,t){const n=typeof t.inputTokens=="number"?t.inputTokens:0,r=typeof t.outputTokens=="number"?t.outputTokens:0,o=typeof t.cachedInputTokens=="number"?t.cachedInputTokens:0,s=typeof t.cacheCreationInputTokens=="number"?t.cacheCreationInputTokens:0;if(!n&&!r&&!o&&!s)return;const g=ZAA(A,e);if(g?.cost?.input!=null||g?.cost?.output!=null){const I=typeof g.cost?.input=="number"?g.cost.input:0,h=typeof g.cost?.output=="number"?g.cost.output:0,m=typeof g.cost?.cacheRead=="number"?g.cost.cacheRead:0,D=typeof g.cost?.cacheWrite=="number"?g.cost.cacheWrite:0,b=Math.max(0,n-o-s)*I/1e6,y=r*h/1e6,M=o*m/1e6,F=s*D/1e6,x=b+y+M+F;return Number.isFinite(x)?Number(x.toFixed(6)):void 0}const u=WAA(A,e.toLowerCase());if(!u)return;const Q=Math.max(0,n-o-s)*u.inputPerMillion/1e6,C=r*u.outputPerMillion/1e6,d=Q+C;return Number.isFinite(d)?Number(d.toFixed(6)):void 0}function XAA({session:A,onNavigateToSession:e}){const{data:t}=LT(A.sessionType==="branch"?A.id:void 0),{data:n}=mf(A.id),r=S.useMemo(()=>{const d=A.totalInputTokens||0,I=A.totalOutputTokens||0,h=A.totalCachedTokens||0,m=A.totalCacheCreationTokens||0;return KT(A.provider,A.model,{inputTokens:d,outputTokens:I,cachedInputTokens:h,cacheCreationInputTokens:m})??0},[A.provider,A.model,A.totalInputTokens,A.totalOutputTokens,A.totalCachedTokens,A.totalCacheCreationTokens]),o=d=>{if(!d)return"0s";const I=Math.floor(d/1e3),h=Math.floor(I/60),m=Math.floor(h/60);return m>0?`${m}h ${h%60}m`:h>0?`${h}m ${I%60}s`:`${I}s`},s=d=>d.toLocaleString("en-US"),g=d=>d>=1e6?`${(d/1e6).toFixed(1)}M`:d>=1e3?`${(d/1e3).toFixed(1)}K`:d.toString(),u=A.currentContextTokens||0,E=A.totalOutputTokens||0,Q=A.sessionType==="branch",C=t?.parent;return c.jsx("div",{className:"border-b border-border bg-background/95 backdrop-blur-sm",children:c.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-6",children:[Q&&c.jsxs("div",{className:"flex items-center gap-2 mb-3 text-sm",children:[c.jsx(Pt,{className:"h-4 w-4 text-violet-500"}),c.jsx("span",{className:"text-violet-600 dark:text-violet-400 font-medium",children:"Branch"}),C&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-muted-foreground",children:"from"}),c.jsxs("button",{type:"button",onClick:()=>e?.(C.id),className:"text-primary hover:underline flex items-center gap-1",children:[C.title||`Session ${C.id.slice(0,8)}`,c.jsx($1,{className:"h-3 w-3"})]})]}),!C&&A.parentSessionId&&c.jsx("span",{className:"text-muted-foreground italic text-xs",children:"(parent deleted)"})]}),c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("h1",{className:"text-2xl font-semibold text-foreground leading-tight truncate",children:A.title||"Untitled Session"}),n?.shared&&c.jsxs("button",{type:"button",onClick:()=>pf(n.url),className:"flex items-center gap-1.5 px-2 py-1 rounded-md bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 hover:bg-emerald-500/20 transition-colors text-xs font-medium flex-shrink-0",children:[c.jsx(of,{className:"h-3 w-3"}),c.jsx("span",{children:"Shared"}),n.pendingMessages&&n.pendingMessages>0?c.jsxs("span",{className:"flex items-center gap-0.5 text-amber-600 dark:text-amber-400",children:[c.jsx(Rn,{className:"h-2.5 w-2.5"}),n.pendingMessages]}):c.jsx(Yt,{className:"h-2.5 w-2.5 opacity-60"})]})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-x-5 gap-y-2 mt-4 text-sm text-muted-foreground",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsxs("div",{className:"flex items-center gap-1.5",title:`Current context window: ${s(u)} tokens`,children:[c.jsx("span",{className:"text-xs opacity-70",children:"ctx"}),c.jsx("span",{className:"font-medium text-foreground",children:g(u)})]}),c.jsxs("div",{className:"flex items-center gap-1.5",title:`Total output: ${s(E)} tokens`,children:[c.jsx("span",{className:"text-xs opacity-70",children:"out"}),c.jsx("span",{className:"font-medium text-foreground",children:g(E)})]})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(nR,{className:"w-4 h-4"}),c.jsx("span",{className:"font-medium text-foreground",children:o(A.totalToolTimeMs)})]}),r>0&&c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx(aR,{className:"w-4 h-4"}),c.jsx("span",{className:"font-medium text-foreground",children:r.toFixed(4)})]}),c.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[c.jsx(dn,{provider:A.provider,size:18}),c.jsx("span",{className:"font-medium text-foreground truncate max-w-48",children:A.model})]})]})]})})}function $AA({session:A,isVisible:e,isGenerating:t,onNavigateToSession:n}){const{data:r}=LT(A.sessionType==="branch"?A.id:void 0),{data:o}=mf(A.id),s=S.useMemo(()=>{const C=A.totalInputTokens||0,d=A.totalOutputTokens||0,I=A.totalCachedTokens||0,h=A.totalCacheCreationTokens||0;return KT(A.provider,A.model,{inputTokens:C,outputTokens:d,cachedInputTokens:I,cacheCreationInputTokens:h})??0},[A.provider,A.model,A.totalInputTokens,A.totalOutputTokens,A.totalCachedTokens,A.totalCacheCreationTokens]),g=C=>C>=1e6?`${(C/1e6).toFixed(1)}M`:C>=1e3?`${(C/1e3).toFixed(1)}K`:C.toString(),u=A.currentContextTokens||0,E=A.sessionType==="branch",Q=r?.parent;return c.jsx("div",{className:`absolute top-0 left-0 right-0 h-14 border-b border-border bg-background/95 backdrop-blur-sm z-10 transition-transform duration-200 ${e?"translate-y-0":"-translate-y-full"}`,children:c.jsxs("div",{className:"h-full px-6 flex items-center justify-between gap-4 text-sm",children:[c.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2 text-muted-foreground",children:[E?c.jsx(Pt,{className:"w-4 h-4 flex-shrink-0 text-violet-500"}):c.jsx(gR,{className:"w-4 h-4 flex-shrink-0"}),c.jsx("span",{className:"text-foreground font-medium truncate",children:A.title||"Untitled Session"}),o?.shared&&c.jsxs("button",{type:"button",onClick:()=>pf(o.url),className:"flex items-center gap-1 px-1.5 py-0.5 rounded bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 hover:bg-emerald-500/20 transition-colors text-xs font-medium flex-shrink-0",children:[c.jsx(of,{className:"h-3 w-3"}),o.pendingMessages&&o.pendingMessages>0?c.jsxs("span",{className:"flex items-center gap-0.5 text-amber-600 dark:text-amber-400",children:[c.jsx(Rn,{className:"h-2.5 w-2.5"}),o.pendingMessages]}):c.jsx(Yt,{className:"h-2.5 w-2.5 opacity-60"})]}),E&&Q&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-muted-foreground hidden sm:inline",children:"from"}),c.jsxs("button",{type:"button",onClick:()=>n?.(Q.id),className:"text-primary hover:underline flex items-center gap-0.5 truncate max-w-32",title:Q.title||`Session ${Q.id.slice(0,8)}`,children:[c.jsx("span",{className:"truncate",children:Q.title||`Session ${Q.id.slice(0,8)}`}),c.jsx($1,{className:"h-3 w-3 flex-shrink-0"})]})]})]}),c.jsxs("div",{className:"flex-shrink-0 flex items-center gap-5 text-muted-foreground",children:[t&&c.jsx(P8,{sessionId:A.id}),c.jsx("div",{className:"flex items-center gap-3",children:c.jsxs("div",{className:"flex items-center gap-1",title:`Current context window: ${u.toLocaleString()} tokens`,children:[c.jsx("span",{className:"text-xs opacity-70",children:"ctx"}),c.jsx("span",{className:"text-foreground font-medium",children:g(u)})]})}),s>0&&c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx(aR,{className:"w-4 h-4"}),c.jsx("span",{className:"text-foreground font-medium",children:s.toFixed(4)})]}),c.jsxs("div",{className:"hidden sm:flex items-center gap-2",children:[c.jsx(dn,{provider:A.provider,size:16}),c.jsx("span",{className:"font-medium text-foreground truncate max-w-40",children:A.model})]})]})]})})}const AeA=S.memo(function({pendingTopup:e,onMethodSelected:t,onCancel:n}){const[r,o]=S.useState(!1),[s,g]=S.useState(null),u=Qe(d=>d.openTopupModal),E=async()=>{g("crypto"),o(!0);try{await mA.selectTopupMethod(e.sessionId,"crypto"),t("crypto")}catch(d){$A.error(d instanceof Error?d.message:"Failed to process payment"),o(!1),g(null)}},Q=async()=>{g("fiat"),u(),mA.selectTopupMethod(e.sessionId,"fiat").catch(()=>{}),t("fiat")},C=async()=>{o(!0);try{await mA.cancelTopup(e.sessionId),n()}catch(d){$A.error(d instanceof Error?d.message:"Failed to cancel"),o(!1)}};return c.jsxs("div",{className:"flex flex-col gap-3 py-2",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Fn,{className:"h-4 w-4 text-amber-500 flex-shrink-0"}),c.jsx("span",{className:"font-medium text-foreground text-sm",children:"Insufficient Balance"}),c.jsx("span",{className:"text-amber-600 dark:text-amber-400 font-medium text-sm",children:"payment required"})]}),c.jsxs("div",{className:"ml-6 bg-muted/30 rounded-lg p-3 space-y-2 text-sm",children:[c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-muted-foreground",children:"Request cost"}),c.jsxs("span",{className:"font-mono",children:["~$",e.amountUsd.toFixed(4)]})]}),c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-muted-foreground",children:"Current balance"}),c.jsxs("span",{className:"font-mono",children:["$",e.currentBalance.toFixed(4)]})]})]}),c.jsxs("div",{className:"ml-6 flex flex-wrap items-center gap-2",children:[c.jsxs("button",{type:"button",onClick:C,disabled:r,title:"Cancel request",className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded border border-border bg-background hover:bg-muted transition-colors disabled:opacity-50",children:[c.jsx(gt,{className:"w-3 h-3"}),"Cancel"]}),c.jsxs("button",{type:"button",onClick:E,disabled:r,title:"Pay with USDC from your wallet",className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded bg-violet-600 text-white hover:bg-violet-700 transition-colors disabled:opacity-50",children:[s==="crypto"&&r?c.jsx(Xe,{className:"w-3 h-3 animate-spin"}):c.jsx(gf,{className:"w-3 h-3"}),"Pay with USDC"]}),c.jsxs("button",{type:"button",onClick:Q,disabled:r,title:"Top up balance with card (min $5)",className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded border border-violet-500 text-violet-600 dark:text-violet-400 hover:bg-violet-500/10 transition-colors disabled:opacity-50",children:[s==="fiat"&&r?c.jsx(Xe,{className:"w-3 h-3 animate-spin"}):c.jsx(cs,{className:"w-3 h-3"}),"Top up with Card",c.jsx("span",{className:"text-[10px] opacity-70",children:"(min $5)"})]})]}),c.jsx("p",{className:"ml-6 text-xs text-muted-foreground",children:s==="crypto"?"Processing USDC payment from your wallet...":s==="fiat"?"Opening Polar checkout...":"Select a payment method to continue your request."})]})}),Tg=dt(A=>({pendingTopup:null,isProcessing:!1,selectedMethod:null,setPendingTopup:e=>A({pendingTopup:e,isProcessing:!1,selectedMethod:null}),setProcessing:e=>A({isProcessing:e}),setSelectedMethod:e=>A({selectedMethod:e}),clearPendingTopup:()=>A({pendingTopup:null,isProcessing:!1,selectedMethod:null})})),eeA=S.memo(function({messages:e,session:t,sessionId:n,isGenerating:r,disableAutoScroll:o=!1,onSelectSession:s}){const g=xe(),u=S.useRef(null),E=S.useRef(null),Q=S.useRef(null),[C,d]=S.useState(!0),I=S.useRef(!0),[h,m]=S.useState(!1),D=S.useRef(!1),w=S.useRef(void 0),b=S.useRef(0),y=S.useRef(void 0),M=S.useRef(!1),F=S.useRef(t?.id),x=S.useRef(e.length),k=S.useRef(r),v=S.useRef(0),R=S.useRef(0),O=Tg(j=>j.pendingTopup),T=Tg(j=>j.clearPendingTopup),K=O&&O.sessionId===n,q=S.useCallback(()=>{const j=E.current;if(!j)return;const{scrollTop:W,scrollHeight:Z,clientHeight:U}=j,_=Z-W-U,V=Z>v.current,L=W<R.current-5;v.current=Z,R.current=W,_<100?(I.current=!0,d(!0)):L?(I.current=!1,d(!1),D.current=!0):!V&&I.current&&(I.current=!1,d(!1)),(L||!I.current&&_>=100)&&(w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{D.current=!1},150));const nA=Q.current;if(nA){const EA=nA.getBoundingClientRect(),CA=j.getBoundingClientRect();m(EA.bottom<CA.top)}},[]);S.useEffect(()=>{if(o)return;const j=t?.id!==F.current;if(F.current=t?.id,j&&(M.current=!1),!M.current&&e.length>0){M.current=!0;const W=E.current;W&&(W.scrollTop=W.scrollHeight)}},[e.length,t?.id,o]),S.useEffect(()=>{if(o)return;const j=r&&!k.current,W=e.length>x.current;k.current=r,x.current=e.length,j?(D.current=!1,I.current=!0,d(!0),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const Z=E.current;Z&&(Z.scrollTop=Z.scrollHeight)})})):W&&!D.current&&!r&&(I.current=!0,d(!0))},[e.length,r,o]),S.useEffect(()=>{if(o)return;const j=E.current;if(!j||!C||D.current)return;b.current=j.scrollHeight-j.clientHeight;const W=()=>{const Z=E.current;if(!Z||D.current)return;const U=Z.scrollTop,V=Z.scrollHeight-Z.clientHeight-U;if(Math.abs(V)<1){Z.scrollTop=Z.scrollHeight-Z.clientHeight;return}if(Math.abs(V)<10){Z.scrollTop=Z.scrollHeight-Z.clientHeight;return}Z.scrollTop=U+V*.15,y.current=requestAnimationFrame(W)};y.current&&cancelAnimationFrame(y.current),y.current=requestAnimationFrame(W)},[e,C]),S.useEffect(()=>()=>{w.current&&clearTimeout(w.current),y.current&&cancelAnimationFrame(y.current)},[]);const Y=()=>{D.current=!1,I.current=!0,d(!0);const j=E.current;j&&(j.scrollTop=j.scrollHeight)},P=S.useMemo(()=>e.filter(j=>j.role!=="system"),[e]),J=S.useCallback(j=>async()=>{if(n&&j){g.setQueryData(["messages",n],W=>W&&W.map(Z=>{if(Z.id!==j)return Z;const U=Z.parts?.filter(_=>!(_.type==="error"||_.type==="tool_call"&&_.toolName==="finish"))??[];return{...Z,status:"pending",parts:U,error:null}}));try{await mA.retryMessage(n,j)}catch(W){$A.error(W instanceof Error?W.message:"Failed to retry")}}},[n,g]);return e.length===0?c.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground text-sm",children:"No messages yet. Start a conversation below."}):c.jsxs("div",{className:"absolute inset-0 flex flex-col",children:[t&&c.jsx($AA,{session:t,isVisible:h,isGenerating:r,onNavigateToSession:s}),c.jsxs("div",{ref:E,className:"flex-1 overflow-y-auto",onScroll:q,children:[c.jsx("div",{ref:Q,children:t&&c.jsx(XAA,{session:t,onNavigateToSession:s})}),c.jsx("div",{className:"p-6 pb-64",children:c.jsxs("div",{className:"max-w-3xl mx-auto space-y-6",children:[P.map((j,W)=>{const Z=P[W-1],U=P[W+1],_=W===P.length-1;if(j.role==="user"){const V=U&&U.role==="assistant"?U:void 0;return c.jsx(UT,{sessionId:n,message:j,isFirst:W===0,nextAssistantMessageId:V?.id},j.id)}if(j.role==="assistant"){const V=!Z||Z.role!=="assistant",L=U&&U.role==="assistant";return c.jsx(GT,{sessionId:n,message:j,showHeader:V,hasNextAssistantMessage:L,isLastMessage:_,onBranchCreated:s,onRetry:J(j.id)},j.id)}return null}),K&&O&&c.jsx("div",{className:"py-4",children:c.jsx(AeA,{pendingTopup:O,onMethodSelected:()=>T(),onCancel:()=>T()})}),c.jsx("div",{ref:u})]})})]}),!C&&c.jsxs("button",{type:"button",onClick:Y,className:"absolute bottom-36 left-1/2 -translate-x-1/2 flex items-center gap-2 px-4 py-2 bg-background border border-border rounded-full shadow-lg hover:bg-muted/50 transition-all text-sm text-foreground z-10",children:[c.jsx(g4,{className:"w-4 h-4"}),c.jsx("span",{children:"Scroll to bottom"})]})]})});class _T{abortController=null;handlers=new Map;running=!1;async connect(e){this.abortController&&this.abortController.abort(),this.abortController=new AbortController,this.running=!0;try{const t=await fetch(e,{headers:{Accept:"text/event-stream"},signal:this.abortController.signal});if(!t.ok){console.error("[SSE] Connection failed:",t.status);return}const n=t.body?.getReader();if(!n){console.error("[SSE] No response body");return}const r=new TextDecoder;let o="";for(;this.running;){const{done:s,value:g}=await n.read();if(s)break;o+=r.decode(g,{stream:!0});let u=o.indexOf(`
|
|
134
134
|
|
|
135
135
|
`);for(;u!==-1;){const E=o.slice(0,u);o=o.slice(u+2);const Q=E.split(`
|
|
136
136
|
`);let C="message",d="";for(const I of Q)I.startsWith("event: ")?C=I.slice(7).trim():I.startsWith("data: ")?d+=(d?`
|
|
@@ -140,7 +140,7 @@ ${D.url}`).join(`
|
|
|
140
140
|
<path d="M55.0151 11H45.7732C42.9871 11 41.594 11 40.5458 11.7564C39.4977 12.5128 39.0587 13.8349 38.1807 16.479L28.4934 45.6545C26.899 50.4561 26.1019 52.8569 27.2993 54.5162C28.4967 56.1754 31.0264 56.1754 36.0858 56.1754H38.1307C41.9554 56.1754 43.8677 56.1754 45.0206 57.2527C45.2855 57.5002 45.5155 57.7825 45.7043 58.092C46.5262 59.4389 46.1395 61.3117 45.3662 65.0574C42.291 79.9519 40.7534 87.3991 43.0079 88.8933C43.4871 89.2109 44.0292 89.4215 44.5971 89.5107C47.2691 89.9303 51.1621 83.398 58.9481 70.3336L70.7118 50.5949C72.8831 46.9517 73.9687 45.13 73.6853 43.639C73.5201 42.7697 73.0712 41.9797 72.4091 41.3927C71.2734 40.386 69.1528 40.386 64.9115 40.386C61.2258 40.386 59.3829 40.386 58.2863 39.5068C57.6438 38.9916 57.176 38.2907 56.9467 37.4998C56.5553 36.1498 57.2621 34.4479 58.6757 31.044L62.4033 22.0683C64.4825 17.0618 65.5221 14.5585 64.3345 12.7793C63.1468 11 60.4362 11 55.0151 11Z" fill="currentColor"/>
|
|
141
141
|
</svg>`}}),aeA={sm:{ring:48,icon:20,iconSize:16},md:{ring:72,icon:32,iconSize:24},lg:{ring:96,icon:40,iconSize:32}},g1=S.memo(function({status:e,label:t,sublabel:n,size:r="md"}){const{ring:o,icon:s,iconSize:g}=aeA[r],u={position:"relative",display:"flex",alignItems:"center",justifyContent:"center",width:o,height:o},E={content:'""',position:"absolute",inset:0,borderRadius:"50%"},Q=()=>e==="success"?"rgb(34, 197, 94)":e==="error"?"rgb(239, 68, 68)":"currentColor";return c.jsxs("div",{className:"flex flex-col items-center justify-center gap-5",children:[c.jsxs("div",{style:u,children:[c.jsx("div",{style:{...E,border:"2px solid hsl(var(--muted))"}}),e==="loading"&&c.jsx("div",{className:"animate-spin",style:{...E,border:"2px solid transparent",borderTopColor:"hsl(var(--foreground))",animation:"spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite"}}),e==="success"&&c.jsx("div",{style:{...E,border:`2px solid ${Q()}`,opacity:.3}}),e==="error"&&c.jsx("div",{style:{...E,border:`2px solid ${Q()}`,opacity:.3}}),c.jsxs("div",{style:{position:"relative",zIndex:1},children:[e==="loading"&&c.jsx(neA,{size:s}),e==="success"&&c.jsx(eR,{className:"text-green-500",style:{width:g,height:g}}),e==="error"&&c.jsx(af,{className:"text-red-500",style:{width:g,height:g}})]})]}),t&&c.jsxs("div",{className:"flex flex-col items-center gap-1",children:[c.jsx("span",{className:"text-sm font-medium text-foreground",children:t}),n&&c.jsx("span",{className:"text-xs text-muted-foreground",children:n})]})]})}),reA=[10,25,50,100],hi=5,Yo=500,ieA=5e3,oeA="https://share.agi.nitish.sh/checkout/success",em=S.memo(function(){const e=Qe(oA=>oA.isTopupModalOpen),t=Qe(oA=>oA.closeTopupModal),n=Qe(oA=>oA.balance),r=Qe(oA=>oA.setBalance),o=Qe(oA=>oA.usdcBalance),[s,g]=S.useState("amount"),[u,E]=S.useState(25),[Q,C]=S.useState(""),[d,I]=S.useState(!1),[h,m]=S.useState(null),[D,w]=S.useState(!1),[b,y]=S.useState(!1),[M,F]=S.useState(null),[x,k]=S.useState(!1),[v,R]=S.useState(null),[O,T]=S.useState(0),[K,q]=S.useState(!1),Y=S.useRef(null),P=d?parseFloat(Q)||0:u,J=S.useCallback(async oA=>{if(oA<hi||oA>Yo){m(null);return}w(!0);try{const sA=await mA.getPolarTopupEstimate(oA);m(sA)}catch{m(null)}finally{w(!1)}},[]);S.useEffect(()=>{if(e&&P>=hi&&s==="amount"){const oA=setTimeout(()=>J(P),300);return()=>clearTimeout(oA)}},[e,P,J,s]);const j=S.useCallback(()=>{Y.current&&(clearInterval(Y.current),Y.current=null),k(!1)},[]);S.useEffect(()=>{e||(j(),g("amount"),F(null),R(null),T(0))},[e,j]),S.useEffect(()=>()=>j(),[j]);const W=S.useCallback(oA=>{if(Y.current)return;k(!0),T(0);const sA=async()=>{try{const dA=await mA.getPolarTopupStatus(oA);if(console.log("[SetuTopupModal] Poll status:",dA),T(MA=>MA+1),dA?.confirmed){j(),R(dA.amountUsd),localStorage.removeItem("pendingPolarCheckout");const MA=await mA.getSetuBalance();MA?.balance!==void 0&&r(MA.balance),g("confirmed")}}catch{T(dA=>dA+1)}};sA(),Y.current=setInterval(sA,ieA)},[j,r]),Z=oA=>{E(oA),I(!1),C("")},U=oA=>{C(oA),I(!0)},_=S.useCallback(oA=>{window.self!==window.top?window.parent.postMessage({type:"agi-open-url",url:oA},"*"):window.open(oA,"_blank")},[]),V=async()=>{if(P<hi||P>Yo){$A.error(`Amount must be between $${hi} and $${Yo}`);return}y(!0);try{const oA=await mA.createPolarCheckout(P,oeA);if(oA.checkoutUrl&&oA.checkoutId){const sA={url:oA.checkoutUrl,checkoutId:oA.checkoutId,creditAmount:oA.creditAmount,chargeAmount:oA.chargeAmount};F(sA),localStorage.setItem("pendingPolarCheckout",oA.checkoutId),g("checkout"),_(oA.checkoutUrl),W(oA.checkoutId)}}catch(oA){$A.error(oA instanceof Error?oA.message:"Failed to create checkout")}finally{y(!1)}},L=async()=>{if(M){q(!0);try{const oA=await mA.getPolarTopupStatus(M.checkoutId);if(console.log("[SetuTopupModal] Manual check status:",oA),oA?.confirmed){j(),R(oA.amountUsd),localStorage.removeItem("pendingPolarCheckout");const sA=await mA.getSetuBalance();sA?.balance!==void 0&&r(sA.balance),g("confirmed")}else $A.error("Payment not confirmed yet. Keep waiting or try again.")}catch(oA){console.error("[SetuTopupModal] Check failed:",oA),$A.error("Failed to check payment status")}finally{q(!1)}}},nA=()=>{t()},EA=P>=hi&&P<=Yo,CA=s==="confirmed"?"Payment Confirmed":s==="checkout"?"Waiting for Payment":"Add Credits";return c.jsx(Li,{isOpen:e,onClose:t,title:CA,maxWidth:"md",children:c.jsxs("div",{className:"space-y-6",children:[s==="confirmed"&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"py-4",children:c.jsx(g1,{status:"success",label:`+$${v?.toFixed(2)??M?.creditAmount.toFixed(2)}`,sublabel:"Credits added to your balance"})}),c.jsx("button",{type:"button",onClick:nA,className:"w-full h-12 bg-foreground text-background rounded-lg font-medium hover:bg-foreground/90 transition-colors flex items-center justify-center gap-2",children:"Done"})]}),s==="checkout"&&M&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"py-4",children:[c.jsx(g1,{status:"loading",label:"Complete your payment",sublabel:"A checkout window has been opened"}),c.jsxs("div",{className:"flex items-center justify-center gap-2 mt-4 px-3 py-1.5 bg-muted/40 rounded-full w-fit mx-auto",children:[c.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-blue-500 animate-pulse"}),c.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:x?`Checking... (${O})`:"Paused"})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsxs("button",{type:"button",onClick:L,disabled:K,className:"w-full h-12 bg-foreground text-background rounded-lg font-medium hover:bg-foreground/90 transition-colors disabled:opacity-50 flex items-center justify-center gap-2",children:[K?c.jsx(Xe,{className:"w-4 h-4 animate-spin"}):c.jsx(Rn,{className:"w-4 h-4"}),K?"Checking...":"Check Now"]}),c.jsxs("button",{type:"button",onClick:()=>_(M.url),className:"w-full h-11 bg-transparent border border-border text-foreground rounded-lg font-medium hover:bg-muted/50 transition-colors flex items-center justify-center gap-2",children:[c.jsx(Yt,{className:"w-4 h-4"}),"Open Checkout Again"]})]}),c.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Status checks automatically every 5 seconds. You can close this and it will keep checking."})]}),s==="amount"&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex items-center justify-between py-3 px-4 bg-muted/40 rounded-lg",children:[c.jsx("span",{className:"text-sm text-muted-foreground",children:"Current Balance"}),c.jsxs("span",{className:"text-lg font-mono font-semibold",children:["$",n?.toFixed(2)??"0.00"]})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsx("div",{className:"grid grid-cols-4 gap-2",children:reA.map(oA=>c.jsxs("button",{type:"button",onClick:()=>Z(oA),className:`h-12 text-base font-mono rounded-lg border-2 transition-all ${!d&&u===oA?"bg-foreground text-background border-foreground":"bg-transparent border-border text-foreground hover:border-foreground/40"}`,children:["$",oA]},oA))}),c.jsxs("div",{className:"relative",children:[c.jsx("span",{className:"absolute left-4 top-1/2 -translate-y-1/2 text-muted-foreground text-lg",children:"$"}),c.jsx("input",{type:"number",placeholder:"Custom",value:Q,onChange:oA=>U(oA.target.value),onFocus:()=>I(!0),min:hi,max:Yo,step:"1",className:`w-full h-12 pl-8 pr-4 text-base font-mono bg-transparent border-2 rounded-lg outline-none transition-all ${d?"border-foreground":"border-border focus:border-foreground/40"}`})]})]}),c.jsx("div",{className:`grid transition-all duration-200 ease-out ${EA?"grid-rows-[1fr] opacity-100":"grid-rows-[0fr] opacity-0"}`,children:c.jsx("div",{className:"overflow-hidden",children:c.jsx("div",{className:"space-y-3 py-4 border-t border-border",children:D?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex justify-between items-center",children:[c.jsx("span",{className:"text-sm text-muted-foreground",children:"Credits"}),c.jsx("div",{className:"h-6 w-16 bg-muted/60 rounded animate-pulse"})]}),c.jsxs("div",{className:"flex justify-between items-center",children:[c.jsx("span",{className:"text-sm text-muted-foreground",children:"Fee"}),c.jsx("div",{className:"h-4 w-12 bg-muted/60 rounded animate-pulse"})]}),c.jsxs("div",{className:"flex justify-between items-center pt-3 border-t border-border",children:[c.jsx("span",{className:"font-medium",children:"Total"}),c.jsx("div",{className:"h-7 w-20 bg-muted/60 rounded animate-pulse"})]})]}):h?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex justify-between items-center",children:[c.jsx("span",{className:"text-sm text-muted-foreground",children:"Credits"}),c.jsxs("span",{className:"font-mono text-lg",children:["$",h.creditAmount.toFixed(2)]})]}),c.jsxs("div",{className:"flex justify-between items-center",children:[c.jsx("span",{className:"text-sm text-muted-foreground",children:"Fee"}),c.jsxs("span",{className:"font-mono text-sm text-muted-foreground",children:["+$",h.feeAmount.toFixed(2)]})]}),c.jsxs("div",{className:"flex justify-between items-center pt-3 border-t border-border",children:[c.jsx("span",{className:"font-medium",children:"Total"}),c.jsxs("span",{className:"font-mono text-xl font-semibold",children:["$",h.chargeAmount.toFixed(2)]})]})]}):null})})}),c.jsxs("button",{type:"button",onClick:V,disabled:!EA||b,className:"w-full h-12 bg-foreground text-background rounded-lg font-medium hover:bg-foreground/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2",children:[b?c.jsx(Xe,{className:"w-4 h-4 animate-spin"}):c.jsx(cs,{className:"w-4 h-4"}),"Pay with Card"]}),c.jsxs("div",{className:"relative pt-6",children:[c.jsxs("div",{className:"absolute inset-x-0 top-0 flex items-center",children:[c.jsx("div",{className:"flex-1 h-px bg-border"}),c.jsx("span",{className:"px-3 text-xs text-muted-foreground",children:"OR"}),c.jsx("div",{className:"flex-1 h-px bg-border"})]}),c.jsxs("div",{className:"flex items-start gap-3 p-4 bg-muted/30 rounded-lg",children:[c.jsx(gf,{className:"w-5 h-5 text-muted-foreground mt-0.5"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("span",{className:"font-medium text-sm",children:"Pay with USDC"}),o!==null&&c.jsxs("span",{className:"text-xs font-mono text-muted-foreground",children:[o.toFixed(2)," USDC"]})]}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Send USDC to your Setu wallet. Auto top-up when balance is low."})]})]})]})]})]})})}),seA=S.memo(function({sessionId:e,onSelectSession:t}){const{data:n=[],isLoading:r}=Ng(e),{data:o=[]}=Zg();JT(e),teA(e);const s=S.useMemo(()=>o.find(u=>u.id===e),[o,e]),g=S.useMemo(()=>n.some(u=>u.role==="assistant"&&u.status==="pending"),[n]);return r?c.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Loading messages..."}):c.jsxs(c.Fragment,{children:[c.jsx(eeA,{messages:n,sessionId:e,session:s,isGenerating:g,onSelectSession:t}),c.jsx(em,{})]})}),leA=S.memo(function({session:e,isActive:t,onClick:n}){const r=E=>{const Q=new Date(E),d=new Date().getTime()-Q.getTime(),I=Math.floor(d/6e4),h=Math.floor(I/60),m=Math.floor(h/24);return I<1?"just now":I<60?`${I}m ago`:h<24?`${h}h ago`:m<7?`${m}d ago`:Q.toLocaleDateString()},o=e.sessionType==="branch";return c.jsx("button",{type:"button",onClick:n,className:`group w-full rounded-lg px-3 py-3 text-left transition-colors duration-150 ${t?"bg-primary/10":"hover:bg-muted/20"}`,children:c.jsxs("div",{className:"flex items-start gap-3",children:[o?c.jsx(Pt,{className:`h-4 w-4 shrink-0 mt-1 text-muted-foreground ${t?"text-primary":""}`}):c.jsx(gR,{className:`h-4 w-4 shrink-0 mt-1 text-muted-foreground ${t?"text-primary":""}`}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("h3",{className:"truncate text-sm font-semibold text-foreground",children:e.title||`Session ${e.id.slice(0,8)}`}),o&&c.jsx("span",{className:"text-[10px] px-1.5 py-0.5 bg-violet-500/10 text-violet-600 dark:text-violet-400 rounded-full shrink-0",children:"branch"})]}),c.jsxs("div",{className:"mt-1 flex items-center gap-2 text-xs text-muted-foreground/80",children:[e.agent&&c.jsx("span",{className:"uppercase",children:e.agent}),e.agent&&c.jsx("span",{children:"•"}),c.jsx("span",{children:r(e.lastActiveAt||e.createdAt)})]})]})]})})}),tm=dt(A=>({currentFocus:null,sessionIndex:0,gitFileIndex:0,setFocus:e=>A({currentFocus:e}),setSessionIndex:e=>A({sessionIndex:e}),setGitFileIndex:e=>A({gitFileIndex:e}),resetGitFileIndex:()=>A({gitFileIndex:0}),resetSessionIndex:()=>A({sessionIndex:0})})),geA=S.memo(function({activeSessionId:e,onSelectSession:t}){const{data:n=[],isLoading:r}=Zg(),{currentFocus:o,sessionIndex:s}=tm(),g=S.useRef(new Map),u=S.useCallback(Q=>{t(Q)},[t]),E=S.useMemo(()=>n.map(Q=>({id:Q.id,title:Q.title,agent:Q.agent,createdAt:Q.createdAt})),[n]);return S.useEffect(()=>{o==="sessions"&&g.current.get(s)?.scrollIntoView({block:"nearest",behavior:"smooth"})},[o,s]),r?c.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground/80",children:"Loading sessions..."}):E.length===0?c.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground/80",children:"No sessions yet. Create one to get started."}):c.jsx("div",{className:"flex flex-col gap-1 px-2 py-2 overflow-y-auto scrollbar-hide",children:E.map((Q,C)=>{const d=n.find(h=>h.id===Q.id);if(!d)return null;const I=o==="sessions"&&s===C;return c.jsx("div",{ref:h=>{h?g.current.set(C,h):g.current.delete(C)},className:I?"ring-1 ring-primary/40 rounded-md":"",children:c.jsx(leA,{session:d,isActive:Q.id===e,onClick:()=>u(Q.id)})},Q.id)})})}),ceA={js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",php:"php",sh:"bash",bash:"bash",zsh:"bash",sql:"sql",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",html:"html",css:"css",scss:"scss",md:"markdown",txt:"plaintext",svelte:"svelte"};function ueA(A){const e=A.split(".").pop()?.toLowerCase()??"";return e?ceA[e]??"plaintext":"plaintext"}function EeA(A){const e=A.split("/");return e[e.length-1]}function BeA({diff:A}){const e=document?.documentElement.classList.contains("dark")?ga:Ln,t=A.language&&A.language.trim().length>0?A.language:ueA(A.file),n=EeA(A.file);if(A.isNewFile&&A.content)return c.jsxs("div",{className:"flex flex-col h-full bg-background",children:[c.jsxs("div",{className:"px-4 py-2 bg-muted/50 flex items-center justify-between min-h-10",children:[c.jsx("span",{className:"font-mono text-sm text-foreground truncate",title:A.file,children:n}),c.jsxs("div",{className:"flex items-center gap-3 text-xs flex-shrink-0",children:[c.jsxs("span",{className:"text-green-600 dark:text-green-500",children:["+",A.insertions]}),c.jsx("span",{className:"text-muted-foreground",children:t})]})]}),c.jsx("div",{className:"px-4 py-3 bg-green-500/10 border-b border-green-500/20",children:c.jsxs("p",{className:"text-sm text-green-600 dark:text-green-400 font-medium",children:["New file: ",A.insertions," lines"]})}),c.jsx("div",{className:"flex-1 overflow-auto",children:c.jsx(St,{language:t,style:e,showLineNumbers:!0,customStyle:{margin:0,padding:"1rem",background:"transparent"},lineNumberStyle:{minWidth:"3em",paddingRight:"1em",color:"var(--color-muted-foreground)",userSelect:"none"},children:A.content})})]});if(A.isBinary)return c.jsxs("div",{className:"flex flex-col h-full bg-background",children:[c.jsxs("div",{className:"px-4 py-2 bg-muted/50 flex items-center justify-between min-h-10",children:[c.jsx("span",{className:"font-mono text-sm text-foreground truncate",title:A.file,children:n}),c.jsx("div",{className:"flex items-center gap-3 text-xs flex-shrink-0",children:c.jsx("span",{className:"text-muted-foreground",children:"Binary file"})})]}),c.jsx("div",{className:"flex-1 flex items-center justify-center",children:c.jsx("div",{className:"p-4 text-center",children:c.jsx("p",{className:"text-sm text-muted-foreground",children:"Binary file - cannot display diff"})})})]});const r=A.diff.split(`
|
|
142
142
|
`),o=[];let s=0,g=0;for(const E of r)if(E.startsWith("@@")){const Q=E.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);Q&&(s=parseInt(Q[1],10),g=parseInt(Q[2],10)),o.push({oldLineNumber:null,newLineNumber:null,content:E,codeContent:E,type:"hunk"})}else E.startsWith("diff")||E.startsWith("index")||E.startsWith("---")||E.startsWith("+++")?o.push({oldLineNumber:null,newLineNumber:null,content:E,codeContent:E,type:"meta"}):E.startsWith("+")?(o.push({oldLineNumber:null,newLineNumber:g,content:E,codeContent:E.slice(1),type:"add"}),g++):E.startsWith("-")?(o.push({oldLineNumber:s,newLineNumber:null,content:E,codeContent:E.slice(1),type:"delete"}),s++):(o.push({oldLineNumber:s,newLineNumber:g,content:E,codeContent:E,type:"context"}),s++,g++);const u=(E,Q)=>{let C="flex hover:bg-muted/20",d="flex-shrink-0 w-20 px-2 py-0.5 text-xs font-mono select-none border-r border-border",I="flex-1 px-4 py-0.5 font-mono text-xs overflow-x-auto";E.type==="hunk"?(C+=" bg-blue-500/10",d+=" text-blue-600 dark:text-blue-400",I+=" text-blue-600 dark:text-blue-400 font-semibold"):E.type==="add"?(C+=" bg-green-500/10",d+=" text-green-700 dark:text-green-400",I+=" text-green-700 dark:text-green-400"):E.type==="delete"?(C+=" bg-red-500/10",d+=" text-red-600 dark:text-red-400",I+=" text-red-600 dark:text-red-400"):E.type==="meta"?(I+=" text-muted-foreground",d+=" text-muted-foreground"):(I+=" text-foreground/80",d+=" text-muted-foreground");const h=E.oldLineNumber!==null?E.oldLineNumber.toString():"",m=E.newLineNumber!==null?E.newLineNumber.toString():"";let D=E.content||" ";return E.type!=="meta"&&E.type!=="hunk"&&t!=="plaintext"&&E.codeContent.trim()&&(D=c.jsx(St,{language:t,style:e,customStyle:{margin:0,padding:0,background:"transparent",display:"inline",fontSize:"inherit",lineHeight:"inherit"},codeTagProps:{style:{fontFamily:"inherit",background:"transparent"}},PreTag:"span",children:E.codeContent}),E.type==="add"?D=c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"select-none",children:"+"}),D]}):E.type==="delete"&&(D=c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"select-none",children:"-"}),D]}))),c.jsxs("div",{className:C,children:[c.jsx("div",{className:d,children:c.jsxs("div",{className:"flex justify-between gap-2",children:[c.jsx("span",{className:"text-right w-8",children:h}),c.jsx("span",{className:"text-right w-8",children:m})]})}),c.jsx("div",{className:I,children:D})]},Q)};return c.jsxs("div",{className:"flex flex-col h-full bg-background",children:[c.jsxs("div",{className:"px-4 py-2 bg-muted/50 flex items-center justify-between min-h-10",children:[c.jsx("span",{className:"font-mono text-sm text-foreground truncate",title:A.file,children:n}),c.jsxs("div",{className:"flex items-center gap-3 text-xs flex-shrink-0",children:[A.insertions>0&&c.jsxs("span",{className:"text-green-600 dark:text-green-500",children:["+",A.insertions]}),A.deletions>0&&c.jsxs("span",{className:"text-red-600 dark:text-red-500",children:["-",A.deletions]}),c.jsx("span",{className:"text-muted-foreground",children:t})]})]}),c.jsx("div",{className:"flex-1 overflow-auto",children:A.diff.trim()===""?c.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"No changes to display"}):c.jsx("div",{className:"min-w-max",children:o.map(u)})})]})}function QeA(A,e=2){const t=A.split("/");return t.length<=e+1?A:`../${t.slice(-e).join("/")}`}function Wl({file:A,staged:e,showModifiedIndicator:t=!1}){const{openDiff:n}=me(),r=Ac(),o=wf(),s=a2(),g=r2(),u=If(y=>y.openConfirmation),[E,Q]=S.useState(e),C=async y=>{y.stopPropagation();const M=y.target.checked;Q(M);try{M?await r.mutateAsync([A.path]):await o.mutateAsync([A.path])}catch(F){Q(!M),console.error("Failed to stage/unstage file:",F)}},d=async y=>{y.stopPropagation(),u({title:"Restore File",message:`Restore ${A.path} to HEAD state? This will discard all changes.`,confirmLabel:"Restore",variant:"destructive",onConfirm:async()=>{try{await s.mutateAsync([A.path])}catch(M){throw console.error("Failed to restore file:",M),M}}})},I=async y=>{y.stopPropagation(),u({title:"Delete File",message:`Delete ${A.path}? This will permanently remove the untracked file.`,confirmLabel:"Delete",variant:"destructive",onConfirm:async()=>{try{await g.mutateAsync([A.path])}catch(M){throw console.error("Failed to delete file:",M),M}}})},h=()=>{n(A.path,e)},D=(()=>{switch(A.status){case"added":case"untracked":return{icon:iR,color:"text-green-500",label:"A",labelColor:"text-green-500"};case"deleted":return{icon:rq,color:"text-red-500",label:"D",labelColor:"text-red-500"};case"modified":return{icon:Ha,color:"text-blue-500",label:"M",labelColor:"text-blue-500"};case"renamed":return{icon:Ha,color:"text-purple-500",label:"R",labelColor:"text-purple-500"};case"conflicted":return{icon:BR,color:"text-red-500",label:"C",labelColor:"text-red-500"};default:return{icon:Ha,color:"text-muted-foreground",label:"?",labelColor:"text-muted-foreground"}}})(),w=D.icon,b=QeA(A.path,2);return c.jsxs("button",{type:"button",className:"flex items-center gap-2 px-3 py-2 hover:bg-muted/50 cursor-pointer group transition-colors w-full text-left",onClick:h,children:[c.jsx("input",{type:"checkbox",checked:E,onChange:C,onClick:y=>y.stopPropagation(),className:"w-4 h-4 rounded border-border","aria-label":`${E?"Unstage":"Stage"} ${A.path}`}),c.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[c.jsx(w,{className:`w-4 h-4 flex-shrink-0 ${D.color}`}),c.jsx("div",{className:"flex-1 min-w-0",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-sm text-foreground font-mono truncate",title:`${A.path}
|
|
143
|
-
${A.absPath}`,children:b}),c.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[c.jsx("span",{className:`text-xs font-semibold ${D.labelColor}`,children:D.label}),t&&c.jsx("div",{title:"Also modified in working directory",children:c.jsx(Fn,{className:"w-3.5 h-3.5 text-orange-500"})})]})]})})]}),A.insertions!==void 0||A.deletions!==void 0?c.jsxs("div",{className:"flex items-center gap-2 text-xs flex-shrink-0",children:[A.insertions!==void 0&&A.insertions>0&&c.jsxs("span",{className:"text-green-500",children:["+",A.insertions]}),A.deletions!==void 0&&A.deletions>0&&c.jsxs("span",{className:"text-red-500",children:["-",A.deletions]})]}):null,!e&&A.status==="untracked"&&c.jsx("button",{type:"button",onClick:I,className:"p-1.5 hover:bg-destructive/10 rounded opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",title:"Delete untracked file","aria-label":`Delete ${A.path}`,children:c.jsx(sf,{className:"w-3.5 h-3.5 text-destructive"})}),!e&&A.status!=="untracked"&&A.status!=="added"&&c.jsx("button",{type:"button",onClick:d,className:"p-1.5 hover:bg-destructive/10 rounded opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",title:"Restore file to HEAD (Shift+R)","aria-label":`Restore ${A.path}`,children:c.jsx(cR,{className:"w-3.5 h-3.5 text-destructive"})}),e&&!t&&c.jsx(ia,{className:"w-4 h-4 text-green-500 opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0"})]})}function CeA({status:A}){const{openCommitModal:e,openDiff:t}=me(),n=Ac();wf();const{currentFocus:r,gitFileIndex:o}=tm(),s=S.useRef(new Map),g=(A.conflicted?.length??0)>0,u=A.staged.length>0,E=A.unstaged.length>0||A.untracked.length>0,Q=[...A.unstaged,...A.untracked],C=Q.length>0;S.useMemo(()=>[...A.conflicted??[],...A.staged,...A.unstaged,...A.untracked],[A]);const d=new Set(A.unstaged.map(m=>m.path)),I=()=>{const m=Q.map(D=>D.path);m.length>0&&n.mutate(m)},h=A.conflicted?.length??0;return S.useEffect(()=>{if(r==="git"&&o>=0){s.current.get(o)?.scrollIntoView({block:"nearest",behavior:"smooth"});const w=[...A.conflicted??[],...A.staged,...A.unstaged,...A.untracked][o];if(w){const b=A.staged.includes(w);t(w.path,b)}}},[r,o,A.conflicted,A.staged,A.unstaged,A.untracked,t]),c.jsxs("div",{className:"flex flex-col",children:[g&&c.jsxs("div",{className:"border-b border-border",children:[c.jsx("div",{className:"px-4 py-2 bg-red-500/10 flex items-center justify-between",children:c.jsxs("span",{className:"text-xs font-semibold text-red-500 uppercase flex items-center gap-1.5",children:[c.jsx(BR,{className:"w-3.5 h-3.5"}),"Conflicts (",h,")"]})}),c.jsx("div",{className:"divide-y divide-border",children:A.conflicted?.map((m,D)=>{const w=D,b=r==="git"&&o===w;return c.jsx("div",{ref:y=>{y?s.current.set(w,y):s.current.delete(w)},className:b?"ring-1 ring-inset ring-primary/40":"",children:c.jsx(Wl,{file:m,staged:!1})},m.path)})})]}),u&&c.jsxs("div",{className:"border-b border-border",children:[c.jsxs("div",{className:"px-4 py-2 bg-muted/50 flex items-center justify-between",children:[c.jsxs("span",{className:"text-xs font-semibold text-foreground uppercase",children:["Staged Changes (",A.staged.length,")"]}),c.jsxs("div",{className:"flex items-center gap-1",children:[A.staged.length>0&&!g&&c.jsxs(te,{variant:"primary",size:"sm",onClick:e,className:"h-6 text-xs",children:[c.jsx(wg,{className:"w-3 h-3 mr-1"}),"Commit"]}),A.staged.length>0&&g&&c.jsx("span",{className:"text-xs text-muted-foreground",children:"Resolve conflicts first"})]})]}),c.jsx("div",{className:"divide-y divide-border",children:A.staged.map((m,D)=>{const w=h+D,b=r==="git"&&o===w;return c.jsx("div",{ref:y=>{y?s.current.set(w,y):s.current.delete(w)},className:b?"ring-1 ring-inset ring-primary/40":"",children:c.jsx(Wl,{file:m,staged:!0,showModifiedIndicator:d.has(m.path)})},m.path)})})]}),E&&c.jsxs("div",{children:[c.jsxs("div",{className:"px-4 py-2 bg-muted/50 flex items-center justify-between",children:[c.jsxs("span",{className:"text-xs font-semibold text-foreground uppercase",children:["Changes (",A.unstaged.length+A.untracked.length,")"]}),C&&c.jsxs(te,{variant:"ghost",size:"sm",onClick:I,title:"Stage all changes",className:"h-6 text-xs",children:[c.jsx(Vq,{className:"w-3 h-3 mr-1"}),"Stage All"]})]}),c.jsxs("div",{className:"divide-y divide-border",children:[A.unstaged.map((m,D)=>{const w=h+A.staged.length+D,b=r==="git"&&o===w;return c.jsx("div",{ref:y=>{y?s.current.set(w,y):s.current.delete(w)},className:b?"ring-1 ring-inset ring-primary/40":"",children:c.jsx(Wl,{file:m,staged:!1})},m.path)}),A.untracked.map((m,D)=>{const w=h+A.staged.length+A.unstaged.length+D,b=r==="git"&&o===w;return c.jsx("div",{ref:y=>{y?s.current.set(w,y):s.current.delete(w)},className:b?"ring-1 ring-inset ring-primary/40":"",children:c.jsx(Wl,{file:m,staged:!1})},m.path)})]})]}),!g&&!u&&!E&&c.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:"No changes"})]})}const deA=S.memo(function(){const e=me(D=>D.isExpanded),t=me(D=>D.collapseSidebar),{data:n,isLoading:r,error:o,refetch:s}=$g(),g=xe(),u=T8(),[E,Q]=S.useState(null);S.useEffect(()=>{e&&g.invalidateQueries({queryKey:["git","status"]})},[e,g]);const C=()=>{s()},d=async()=>{Q(null);try{await u.mutateAsync()}catch(D){Q(D instanceof Error?D.message:"Failed to push")}};if(!e)return null;const h=[...n?.conflicted||[],...n?.staged||[],...n?.unstaged||[],...n?.untracked||[]].length,m=n&&n.ahead>0;return c.jsxs("div",{className:"w-80 border-l border-border bg-background flex flex-col h-full",children:[c.jsxs("div",{className:"h-14 border-b border-border px-4 flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[c.jsx(Pt,{className:"w-4 h-4 text-muted-foreground"}),c.jsxs("span",{className:"font-medium text-foreground",children:["Git Changes",h>0&&c.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",h,")"]})]})]}),c.jsx(te,{variant:"ghost",size:"icon",onClick:t,title:"Close sidebar",children:c.jsx(it,{className:"w-4 h-4"})})]}),c.jsx("div",{className:"flex-1 overflow-y-auto",children:r?c.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading git status..."}):o?c.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("span",{className:"text-orange-500",children:o instanceof Error?o.message:"Failed to load git status"}),c.jsx(te,{variant:"secondary",size:"sm",onClick:C,children:"Retry"})]})}):!n||h===0?c.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"No changes detected"}):c.jsx(CeA,{status:n})}),E&&c.jsx("div",{className:"px-4 py-2 text-xs text-orange-500 border-t border-border bg-orange-50 dark:bg-orange-950/20",children:E}),c.jsxs("div",{className:"h-12 px-4 border-t border-border text-xs text-muted-foreground flex items-center justify-between gap-2",children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[c.jsx(Pt,{className:"w-3 h-3 flex-shrink-0"}),n?.branch&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"truncate",children:n.branch}),n.ahead>0&&c.jsxs("span",{className:"text-green-500 flex-shrink-0",children:["↑",n.ahead]}),n.behind>0&&c.jsxs("span",{className:"text-orange-500 flex-shrink-0",children:["↓",n.behind]})]})]}),c.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[m&&c.jsx(te,{variant:"ghost",size:"icon",onClick:d,title:"Push commits to remote",className:"h-6 w-6 transition-transform duration-200 hover:scale-110",disabled:u.isPending,children:c.jsx(A3,{className:`w-3 h-3 ${u.isPending?"animate-pulse":""}`})}),c.jsx(te,{variant:"ghost",size:"icon",onClick:C,title:"Refresh git status",className:"h-6 w-6 transition-transform duration-200 hover:scale-110",disabled:r,children:c.jsx(Rn,{className:`w-3 h-3 ${r?"animate-spin":""}`})})]})]})]})}),IeA=S.memo(function(){const e=me(o=>o.isExpanded),t=me(o=>o.toggleSidebar),{data:n}=$g(),r=(n?.staged?.length??0)+(n?.unstaged?.length??0)+(n?.untracked?.length??0);return c.jsxs("button",{type:"button",onClick:t,className:`relative h-14 w-full transition-colors touch-manipulation flex items-center justify-center ${e?"bg-muted border-r-2 border-primary":"hover:bg-muted/50"}`,title:"Git",children:[c.jsx(Pt,{className:"w-5 h-5 text-muted-foreground mx-auto"}),r>0&&c.jsx("span",{className:"absolute top-1 right-1 w-5 h-5 bg-primary text-primary-foreground text-xs rounded-full flex items-center justify-center font-semibold",children:r>9?"9+":r})]})});function peA(A,e){let t;try{t=A()}catch{return}return{getItem:r=>{var o;const s=u=>u===null?null:JSON.parse(u,void 0),g=(o=t.getItem(r))!=null?o:null;return g instanceof Promise?g.then(s):s(g)},setItem:(r,o)=>t.setItem(r,JSON.stringify(o,void 0)),removeItem:r=>t.removeItem(r)}}const Uh=A=>e=>{try{const t=A(e);return t instanceof Promise?t:{then(n){return Uh(n)(t)},catch(n){return this}}}catch(t){return{then(n){return this},catch(n){return Uh(n)(t)}}}},heA=(A,e)=>(t,n,r)=>{let o={storage:peA(()=>localStorage),partialize:D=>D,version:0,merge:(D,w)=>({...w,...D}),...e},s=!1,g=0;const u=new Set,E=new Set;let Q=o.storage;if(!Q)return A((...D)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),t(...D)},n,r);const C=()=>{const D=o.partialize({...n()});return Q.setItem(o.name,{state:D,version:o.version})},d=r.setState;r.setState=(D,w)=>(d(D,w),C());const I=A((...D)=>(t(...D),C()),n,r);r.getInitialState=()=>I;let h;const m=()=>{var D,w;if(!Q)return;const b=++g;s=!1,u.forEach(M=>{var F;return M((F=n())!=null?F:I)});const y=((w=o.onRehydrateStorage)==null?void 0:w.call(o,(D=n())!=null?D:I))||void 0;return Uh(Q.getItem.bind(Q))(o.name).then(M=>{if(M)if(typeof M.version=="number"&&M.version!==o.version){if(o.migrate){const F=o.migrate(M.state,M.version);return F instanceof Promise?F.then(x=>[!0,x]):[!0,F]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,M.state];return[!1,void 0]}).then(M=>{var F;if(b!==g)return;const[x,k]=M;if(h=o.merge(k,(F=n())!=null?F:I),t(h,!0),x)return C()}).then(()=>{b===g&&(y?.(h,void 0),h=n(),s=!0,E.forEach(M=>M(h)))}).catch(M=>{b===g&&y?.(void 0,M)})};return r.persist={setOptions:D=>{o={...o,...D},D.storage&&(Q=D.storage)},clearStorage:()=>{Q?.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>m(),hasHydrated:()=>s,onHydrate:D=>(u.add(D),()=>{u.delete(D)}),onFinishHydration:D=>(E.add(D),()=>{E.delete(D)})},o.skipHydration||m(),h||I},feA=heA,Nr=dt()(feA(A=>({isCollapsed:!1,toggleCollapse:()=>A(e=>({isCollapsed:!e.isCollapsed})),setCollapsed:e=>A({isCollapsed:e})}),{name:"sidebar-storage"})),meA=S.memo(function(){const e=me(Q=>Q.isDiffOpen),t=me(Q=>Q.selectedFile),n=me(Q=>Q.selectedFileStaged),r=me(Q=>Q.closeDiff),o=Nr(Q=>Q.setCollapsed),s=S.useRef(null),g=S.useRef(!1),{data:u,isLoading:E}=M8(t,n);return S.useEffect(()=>{if(e&&!g.current){const{isCollapsed:Q}=Nr.getState();s.current=Q,o(!0)}else!e&&g.current&&s.current!==null&&(o(s.current),s.current=null);g.current=e},[e,o]),S.useEffect(()=>{const Q=C=>{const d=C.target,I=d.tagName==="INPUT"||d.tagName==="TEXTAREA"||d.isContentEditable;(C.key==="Escape"||C.key==="q"&&!I)&&e&&r()};return document.addEventListener("keydown",Q),()=>document.removeEventListener("keydown",Q)},[e,r]),!e||!t?null:c.jsxs("div",{className:"absolute inset-0 bg-background z-50 flex flex-col animate-in slide-in-from-left duration-300",children:[c.jsxs("div",{className:"h-14 border-b border-border px-4 flex items-center gap-3",children:[c.jsx(te,{variant:"ghost",size:"icon",onClick:r,title:"Close diff viewer (ESC)",children:c.jsx(gt,{className:"w-4 h-4"})}),c.jsxs("div",{className:"flex-1 flex items-center gap-2 min-w-0",children:[c.jsx("span",{className:"text-sm font-medium text-foreground font-mono truncate",title:`${t}
|
|
143
|
+
${A.absPath}`,children:b}),c.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[c.jsx("span",{className:`text-xs font-semibold ${D.labelColor}`,children:D.label}),t&&c.jsx("div",{title:"Also modified in working directory",children:c.jsx(Fn,{className:"w-3.5 h-3.5 text-orange-500"})})]})]})})]}),A.insertions!==void 0||A.deletions!==void 0?c.jsxs("div",{className:"flex items-center gap-2 text-xs flex-shrink-0",children:[A.insertions!==void 0&&A.insertions>0&&c.jsxs("span",{className:"text-green-500",children:["+",A.insertions]}),A.deletions!==void 0&&A.deletions>0&&c.jsxs("span",{className:"text-red-500",children:["-",A.deletions]})]}):null,!e&&A.status==="untracked"&&c.jsx("button",{type:"button",onClick:I,className:"p-1.5 hover:bg-destructive/10 rounded opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",title:"Delete untracked file","aria-label":`Delete ${A.path}`,children:c.jsx(sf,{className:"w-3.5 h-3.5 text-destructive"})}),!e&&A.status!=="untracked"&&A.status!=="added"&&c.jsx("button",{type:"button",onClick:d,className:"p-1.5 hover:bg-destructive/10 rounded opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",title:"Restore file to HEAD (Shift+R)","aria-label":`Restore ${A.path}`,children:c.jsx(cR,{className:"w-3.5 h-3.5 text-destructive"})}),e&&!t&&c.jsx(ia,{className:"w-4 h-4 text-green-500 opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0"})]})}function CeA({status:A}){const{openCommitModal:e,openDiff:t}=me(),n=Ac();wf();const{currentFocus:r,gitFileIndex:o}=tm(),s=S.useRef(new Map),g=(A.conflicted?.length??0)>0,u=A.staged.length>0,E=A.unstaged.length>0||A.untracked.length>0,Q=[...A.unstaged,...A.untracked],C=Q.length>0;S.useMemo(()=>[...A.conflicted??[],...A.staged,...A.unstaged,...A.untracked],[A]);const d=new Set(A.unstaged.map(m=>m.path)),I=()=>{const m=Q.map(D=>D.path);m.length>0&&n.mutate(m)},h=A.conflicted?.length??0;return S.useEffect(()=>{if(r==="git"&&o>=0){s.current.get(o)?.scrollIntoView({block:"nearest",behavior:"smooth"});const w=[...A.conflicted??[],...A.staged,...A.unstaged,...A.untracked][o];if(w){const b=A.staged.includes(w);t(w.path,b)}}},[r,o,A.conflicted,A.staged,A.unstaged,A.untracked,t]),c.jsxs("div",{className:"flex flex-col",children:[g&&c.jsxs("div",{className:"border-b border-border",children:[c.jsx("div",{className:"px-4 py-2 bg-red-500/10 flex items-center justify-between",children:c.jsxs("span",{className:"text-xs font-semibold text-red-500 uppercase flex items-center gap-1.5",children:[c.jsx(BR,{className:"w-3.5 h-3.5"}),"Conflicts (",h,")"]})}),c.jsx("div",{className:"divide-y divide-border",children:A.conflicted?.map((m,D)=>{const w=D,b=r==="git"&&o===w;return c.jsx("div",{ref:y=>{y?s.current.set(w,y):s.current.delete(w)},className:b?"ring-1 ring-inset ring-primary/40":"",children:c.jsx(Wl,{file:m,staged:!1})},m.path)})})]}),u&&c.jsxs("div",{className:"border-b border-border",children:[c.jsxs("div",{className:"px-4 py-2 bg-muted/50 flex items-center justify-between",children:[c.jsxs("span",{className:"text-xs font-semibold text-foreground uppercase",children:["Staged Changes (",A.staged.length,")"]}),c.jsxs("div",{className:"flex items-center gap-1",children:[A.staged.length>0&&!g&&c.jsxs(te,{variant:"primary",size:"sm",onClick:e,className:"h-6 text-xs",children:[c.jsx(wg,{className:"w-3 h-3 mr-1"}),"Commit"]}),A.staged.length>0&&g&&c.jsx("span",{className:"text-xs text-muted-foreground",children:"Resolve conflicts first"})]})]}),c.jsx("div",{className:"divide-y divide-border",children:A.staged.map((m,D)=>{const w=h+D,b=r==="git"&&o===w;return c.jsx("div",{ref:y=>{y?s.current.set(w,y):s.current.delete(w)},className:b?"ring-1 ring-inset ring-primary/40":"",children:c.jsx(Wl,{file:m,staged:!0,showModifiedIndicator:d.has(m.path)})},m.path)})})]}),E&&c.jsxs("div",{children:[c.jsxs("div",{className:"px-4 py-2 bg-muted/50 flex items-center justify-between",children:[c.jsxs("span",{className:"text-xs font-semibold text-foreground uppercase",children:["Changes (",A.unstaged.length+A.untracked.length,")"]}),C&&c.jsxs(te,{variant:"ghost",size:"sm",onClick:I,title:"Stage all changes",className:"h-6 text-xs",children:[c.jsx(Vq,{className:"w-3 h-3 mr-1"}),"Stage All"]})]}),c.jsxs("div",{className:"divide-y divide-border",children:[A.unstaged.map((m,D)=>{const w=h+A.staged.length+D,b=r==="git"&&o===w;return c.jsx("div",{ref:y=>{y?s.current.set(w,y):s.current.delete(w)},className:b?"ring-1 ring-inset ring-primary/40":"",children:c.jsx(Wl,{file:m,staged:!1})},m.path)}),A.untracked.map((m,D)=>{const w=h+A.staged.length+A.unstaged.length+D,b=r==="git"&&o===w;return c.jsx("div",{ref:y=>{y?s.current.set(w,y):s.current.delete(w)},className:b?"ring-1 ring-inset ring-primary/40":"",children:c.jsx(Wl,{file:m,staged:!1})},m.path)})]})]}),!g&&!u&&!E&&c.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:"No changes"})]})}const deA=S.memo(function(){const e=me(D=>D.isExpanded),t=me(D=>D.collapseSidebar),{data:n,isLoading:r,error:o,refetch:s}=$g(),g=xe(),u=T8(),[E,Q]=S.useState(null);S.useEffect(()=>{e&&g.invalidateQueries({queryKey:["git","status"]})},[e,g]);const C=()=>{s()},d=async()=>{Q(null);try{await u.mutateAsync()}catch(D){Q(D instanceof Error?D.message:"Failed to push")}};if(!e)return null;const h=[...n?.conflicted||[],...n?.staged||[],...n?.unstaged||[],...n?.untracked||[]].length,m=n&&n.ahead>0;return c.jsxs("div",{className:"w-80 border-l border-border bg-background flex flex-col h-full",children:[c.jsxs("div",{className:"h-14 border-b border-border px-4 flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[c.jsx(Pt,{className:"w-4 h-4 text-muted-foreground"}),c.jsxs("span",{className:"font-medium text-foreground",children:["Git Changes",h>0&&c.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",h,")"]})]})]}),c.jsx(te,{variant:"ghost",size:"icon",onClick:t,title:"Close sidebar",children:c.jsx(it,{className:"w-4 h-4"})})]}),c.jsx("div",{className:"flex-1 overflow-y-auto",children:r?c.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading git status..."}):o?c.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("span",{className:"text-orange-500",children:o instanceof Error?o.message:"Failed to load git status"}),c.jsx(te,{variant:"secondary",size:"sm",onClick:C,children:"Retry"})]})}):!n||h===0?c.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"No changes detected"}):c.jsx(CeA,{status:n})}),E&&c.jsx("div",{className:"px-4 py-2 text-xs text-orange-500 border-t border-border bg-orange-50 dark:bg-orange-950/20",children:E}),c.jsxs("div",{className:"h-12 px-4 border-t border-border text-xs text-muted-foreground flex items-center justify-between gap-2",children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[c.jsx(Pt,{className:"w-3 h-3 flex-shrink-0"}),n?.branch&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"truncate",children:n.branch}),n.ahead>0&&c.jsxs("span",{className:"text-green-500 flex-shrink-0",children:["↑",n.ahead]}),n.behind>0&&c.jsxs("span",{className:"text-orange-500 flex-shrink-0",children:["↓",n.behind]})]})]}),c.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[m&&c.jsx(te,{variant:"ghost",size:"icon",onClick:d,title:"Push commits to remote",className:"h-6 w-6 transition-transform duration-200 hover:scale-110",disabled:u.isPending,children:c.jsx(A3,{className:`w-3 h-3 ${u.isPending?"animate-pulse":""}`})}),c.jsx(te,{variant:"ghost",size:"icon",onClick:C,title:"Refresh git status",className:"h-6 w-6 transition-transform duration-200 hover:scale-110",disabled:r,children:c.jsx(Rn,{className:`w-3 h-3 ${r?"animate-spin":""}`})})]})]})]})}),IeA=S.memo(function(){const e=me(o=>o.isExpanded),t=me(o=>o.toggleSidebar),{data:n}=$g(),r=(n?.staged?.length??0)+(n?.unstaged?.length??0)+(n?.untracked?.length??0);return c.jsxs("button",{type:"button",onClick:t,className:`relative h-14 w-full transition-colors touch-manipulation flex items-center justify-center ${e?"bg-muted border-r-2 border-primary":"hover:bg-muted/50"}`,title:"Git",children:[c.jsx(Pt,{className:"w-5 h-5 text-muted-foreground mx-auto"}),r>0&&c.jsx("span",{className:"absolute top-1 right-1 w-5 h-5 bg-primary text-primary-foreground text-xs rounded-full flex items-center justify-center font-semibold",children:r>9?"9+":r})]})});function peA(A,e){let t;try{t=A()}catch{return}return{getItem:r=>{var o;const s=u=>u===null?null:JSON.parse(u,void 0),g=(o=t.getItem(r))!=null?o:null;return g instanceof Promise?g.then(s):s(g)},setItem:(r,o)=>t.setItem(r,JSON.stringify(o,void 0)),removeItem:r=>t.removeItem(r)}}const Uh=A=>e=>{try{const t=A(e);return t instanceof Promise?t:{then(n){return Uh(n)(t)},catch(n){return this}}}catch(t){return{then(n){return this},catch(n){return Uh(n)(t)}}}},heA=(A,e)=>(t,n,r)=>{let o={storage:peA(()=>window.localStorage),partialize:D=>D,version:0,merge:(D,w)=>({...w,...D}),...e},s=!1,g=0;const u=new Set,E=new Set;let Q=o.storage;if(!Q)return A((...D)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),t(...D)},n,r);const C=()=>{const D=o.partialize({...n()});return Q.setItem(o.name,{state:D,version:o.version})},d=r.setState;r.setState=(D,w)=>(d(D,w),C());const I=A((...D)=>(t(...D),C()),n,r);r.getInitialState=()=>I;let h;const m=()=>{var D,w;if(!Q)return;const b=++g;s=!1,u.forEach(M=>{var F;return M((F=n())!=null?F:I)});const y=((w=o.onRehydrateStorage)==null?void 0:w.call(o,(D=n())!=null?D:I))||void 0;return Uh(Q.getItem.bind(Q))(o.name).then(M=>{if(M)if(typeof M.version=="number"&&M.version!==o.version){if(o.migrate){const F=o.migrate(M.state,M.version);return F instanceof Promise?F.then(x=>[!0,x]):[!0,F]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,M.state];return[!1,void 0]}).then(M=>{var F;if(b!==g)return;const[x,k]=M;if(h=o.merge(k,(F=n())!=null?F:I),t(h,!0),x)return C()}).then(()=>{b===g&&(y?.(h,void 0),h=n(),s=!0,E.forEach(M=>M(h)))}).catch(M=>{b===g&&y?.(void 0,M)})};return r.persist={setOptions:D=>{o={...o,...D},D.storage&&(Q=D.storage)},clearStorage:()=>{Q?.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>m(),hasHydrated:()=>s,onHydrate:D=>(u.add(D),()=>{u.delete(D)}),onFinishHydration:D=>(E.add(D),()=>{E.delete(D)})},o.skipHydration||m(),h||I},feA=heA,Nr=dt()(feA(A=>({isCollapsed:!1,toggleCollapse:()=>A(e=>({isCollapsed:!e.isCollapsed})),setCollapsed:e=>A({isCollapsed:e})}),{name:"sidebar-storage"})),meA=S.memo(function(){const e=me(Q=>Q.isDiffOpen),t=me(Q=>Q.selectedFile),n=me(Q=>Q.selectedFileStaged),r=me(Q=>Q.closeDiff),o=Nr(Q=>Q.setCollapsed),s=S.useRef(null),g=S.useRef(!1),{data:u,isLoading:E}=M8(t,n);return S.useEffect(()=>{if(e&&!g.current){const{isCollapsed:Q}=Nr.getState();s.current=Q,o(!0)}else!e&&g.current&&s.current!==null&&(o(s.current),s.current=null);g.current=e},[e,o]),S.useEffect(()=>{const Q=C=>{const d=C.target,I=d.tagName==="INPUT"||d.tagName==="TEXTAREA"||d.isContentEditable;(C.key==="Escape"||C.key==="q"&&!I)&&e&&r()};return document.addEventListener("keydown",Q),()=>document.removeEventListener("keydown",Q)},[e,r]),!e||!t?null:c.jsxs("div",{className:"absolute inset-0 bg-background z-50 flex flex-col animate-in slide-in-from-left duration-300",children:[c.jsxs("div",{className:"h-14 border-b border-border px-4 flex items-center gap-3",children:[c.jsx(te,{variant:"ghost",size:"icon",onClick:r,title:"Close diff viewer (ESC)",children:c.jsx(gt,{className:"w-4 h-4"})}),c.jsxs("div",{className:"flex-1 flex items-center gap-2 min-w-0",children:[c.jsx("span",{className:"text-sm font-medium text-foreground font-mono truncate",title:`${t}
|
|
144
144
|
${u?.absPath||""}`,children:t}),n&&c.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-primary/10 text-primary flex-shrink-0",children:"Staged"})]})]}),c.jsx("div",{className:"flex-1 overflow-auto",children:E?c.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:"Loading diff..."}):u?c.jsx(BeA,{diff:u}):c.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:"No diff available"})})]})});function DeA(){const{isCommitModalOpen:A,closeCommitModal:e}=me(),t=me(C=>C.commitSessionId),n=R8(),r=v8(t),[o,s]=S.useState(""),g=S.useId(),u=S.useCallback(async()=>{if(o.trim())try{await n.mutateAsync(o),s(""),e()}catch(C){console.error("Failed to commit:",C)}},[o,n,e]),E=()=>{s(""),e()},Q=S.useCallback(async()=>{try{const C=await r.mutateAsync();s(C.message)}catch(C){console.error("Failed to generate commit message:",C)}},[r]);return S.useEffect(()=>{if(!A)return;const C=d=>{(d.metaKey||d.ctrlKey)&&d.key==="Enter"&&(d.preventDefault(),d.stopPropagation(),o.trim()&&!n.isPending&&u()),(d.metaKey||d.ctrlKey)&&d.key==="g"&&(d.preventDefault(),d.stopPropagation(),Q())};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[A,o,n.isPending,u,Q]),c.jsx(Li,{isOpen:A,onClose:E,title:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(wg,{className:"w-5 h-5"}),c.jsx("span",{children:"Commit Changes"})]}),maxWidth:"2xl",children:c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{htmlFor:g,className:"text-sm font-medium text-foreground",children:"Commit Message"}),c.jsx(Wg,{id:g,value:o,onChange:C=>s(C.target.value),placeholder:"Enter commit message...",rows:6,className:"w-full resize-none",autoFocus:!0,disabled:r.isPending})]}),c.jsx(te,{variant:"secondary",onClick:Q,className:"w-full",disabled:r.isPending,children:r.isPending?c.jsxs(c.Fragment,{children:[c.jsx(Xe,{className:"w-4 h-4 mr-2 animate-spin"}),"Generating..."]}):c.jsxs(c.Fragment,{children:[c.jsx(Mi,{className:"w-4 h-4 mr-2"}),"Generate commit message"," ",c.jsx("span",{className:"text-muted-foreground ml-1",children:"(⌘G)"})]})}),r.isError&&c.jsx("div",{className:"text-sm text-red-600 dark:text-red-400 bg-red-500/10 border border-red-500/20 rounded px-3 py-2",children:r.error?.message||"Failed to generate commit message"}),c.jsxs("div",{className:"flex items-center justify-end gap-2 pt-4 border-t border-border",children:[c.jsxs(te,{variant:"ghost",onClick:E,children:["Cancel ",c.jsx("span",{className:"text-muted-foreground ml-1",children:"(Esc)"})]}),c.jsx(te,{variant:"primary",onClick:u,disabled:!o.trim()||n.isPending,children:n.isPending?c.jsx("span",{children:"Committing..."}):c.jsxs(c.Fragment,{children:[c.jsx(wg,{className:"w-4 h-4 mr-2"}),"Commit ",c.jsx("span",{className:"text-muted-foreground ml-1",children:"(⌘↵)"})]})})]}),n.isError&&c.jsx("div",{className:"text-sm text-red-600 dark:text-red-400 bg-red-500/10 border border-red-500/20 rounded px-3 py-2",children:n.error?.message||"Failed to commit changes"})]})})}function HT(A){const e=Ze(t=>t.isExpanded);return zt({queryKey:["session",A,"files"],queryFn:()=>A?mA.getSessionFiles(A):null,enabled:!!A,refetchInterval:e?5e3:!1,retry:1,staleTime:3e3})}function weA(A){switch(A){case"write":return c.jsx(iR,{className:"w-3 h-3 text-green-500"});case"patch":return c.jsx(yr,{className:"w-3 h-3 text-blue-500"});case"edit":return c.jsx(rR,{className:"w-3 h-3 text-yellow-500"});default:return c.jsx(yr,{className:"w-3 h-3 text-muted-foreground"})}}function yeA(A){return A.split("/").pop()||A}function beA(A){if(A.artifact?.summary)return{additions:A.artifact.summary.additions,deletions:A.artifact.summary.deletions};const e=A.artifact?.patch||A.patch;if(e){let t=0,n=0;const r=e.split(`
|
|
145
145
|
`);for(const o of r)o.startsWith("+")&&!o.startsWith("+++")?t++:o.startsWith("-")&&!o.startsWith("---")&&n++;return{additions:t,deletions:n}}return A.content?{additions:A.content.split(`
|
|
146
146
|
`).length,deletions:0}:{additions:0,deletions:0}}function xeA({file:A}){const e=Ze(u=>u.openDiff),n=Ze(u=>u.selectedFile)===A.path,r=A.operations[A.operations.length-1],{totalAdditions:o,totalDeletions:s}=S.useMemo(()=>{let u=0,E=0;for(const Q of A.operations){const C=beA(Q);u+=C.additions,E+=C.deletions}return{totalAdditions:u,totalDeletions:E}},[A.operations]),g=()=>{A.operations.length>0&&e(A.path,A.operations)};return c.jsx("button",{type:"button",onClick:g,className:`w-full text-left px-3 py-2 hover:bg-muted/50 transition-colors ${n?"bg-muted":""}`,children:c.jsxs("div",{className:"flex items-center gap-2",children:[weA(r?.operation||"write"),c.jsx("div",{className:"flex-1 min-w-0",children:c.jsx("div",{className:"text-sm font-medium truncate",children:yeA(A.path)})}),c.jsxs("div",{className:"flex items-center gap-1 text-xs shrink-0",children:[A.operationCount>1&&c.jsxs("span",{className:"bg-muted text-muted-foreground px-1 rounded mr-1",children:[A.operationCount,"x"]}),c.jsxs("span",{className:"text-green-500",children:["+",o]}),c.jsxs("span",{className:"text-red-500",children:["-",s]})]})]})})}const keA=S.memo(function({sessionId:e}){const t=Ze(u=>u.isExpanded),n=Ze(u=>u.collapseSidebar),{data:r,isLoading:o,error:s,refetch:g}=HT(e);return t?c.jsxs("div",{className:"w-80 border-l border-border bg-background flex flex-col h-full",children:[c.jsxs("div",{className:"h-14 border-b border-border px-4 flex items-center justify-between shrink-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(yr,{className:"w-4 h-4 text-muted-foreground"}),c.jsx("span",{className:"font-medium",children:"Session Files"}),r&&r.totalFiles>0&&c.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",r.totalFiles,")"]})]}),c.jsx(te,{variant:"ghost",size:"icon",onClick:n,children:c.jsx(it,{className:"w-4 h-4"})})]}),c.jsx("div",{className:"flex-1 overflow-y-auto",children:o?c.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading session files..."}):s?c.jsx("div",{className:"p-4 text-sm text-orange-500",children:s instanceof Error?s.message:"Failed to load files"}):!r||r.totalFiles===0?c.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"No files modified in this session"}):c.jsx("div",{className:"divide-y divide-border",children:r.files.map(u=>c.jsx(xeA,{file:u},u.path))})}),c.jsxs("div",{className:"h-12 px-4 border-t border-border text-xs text-muted-foreground flex items-center justify-between gap-2",children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[c.jsx(yr,{className:"w-3 h-3 flex-shrink-0"}),r&&r.totalOperations>0?c.jsxs("span",{className:"truncate",children:[r.totalFiles," file",r.totalFiles!==1?"s":""," •"," ",r.totalOperations," op",r.totalOperations!==1?"s":""]}):c.jsx("span",{className:"truncate",children:"No changes"})]}),c.jsx("div",{className:"flex items-center gap-1 flex-shrink-0",children:c.jsx(te,{variant:"ghost",size:"icon",onClick:()=>g(),title:"Refresh session files",className:"h-6 w-6 transition-transform duration-200 hover:scale-110",disabled:o,children:c.jsx(Rn,{className:`w-3 h-3 ${o?"animate-spin":""}`})})})]})]}):null}),NeA=S.memo(function({sessionId:e}){const t=Ze(s=>s.isExpanded),n=Ze(s=>s.toggleSidebar),{data:r}=HT(e),o=r?.totalFiles??0;return c.jsxs("button",{type:"button",onClick:n,className:`relative p-3 w-full transition-colors touch-manipulation ${t?"bg-muted border-r-2 border-primary":"hover:bg-muted/50"}`,title:"Session Files",children:[c.jsx(yr,{className:"w-5 h-5 text-muted-foreground mx-auto"}),o>0&&c.jsx("span",{className:"absolute top-1 right-1 w-5 h-5 bg-primary text-primary-foreground text-xs rounded-full flex items-center justify-center font-semibold",children:o>9?"9+":o})]})});function SeA(A){const e=A.split(`
|