@psnext/slingcli 2.5.20260615-2 → 2.5.20260617-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node_modules/@aws-sdk/core/dist-cjs/index.js +45 -50
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/account-id-endpoint/index.js +2 -4
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.browser.js +21 -22
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.js +51 -51
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.native.js +21 -22
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js +19 -21
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +107 -109
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/util/index.js +2 -4
- package/node_modules/@aws-sdk/core/package.json +8 -8
- package/node_modules/@aws-sdk/credential-provider-env/dist-cjs/index.js +4 -6
- package/node_modules/@aws-sdk/credential-provider-env/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/checkUrl.js +3 -7
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/fromHttp.browser.js +12 -16
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/fromHttp.js +16 -21
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/requestHelpers.js +14 -18
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/retry-wrapper.js +1 -5
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/index.browser.js +2 -5
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/index.js +2 -7
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-cjs/index.js +11 -13
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-http/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-ini/dist-cjs/index.js +47 -41
- package/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveProcessCredentials.js +8 -4
- package/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveWebIdentityCredentials.js +14 -10
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +13 -13
- package/node_modules/@aws-sdk/credential-provider-login/dist-cjs/index.js +31 -33
- package/node_modules/@aws-sdk/credential-provider-login/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js +16 -18
- package/node_modules/@aws-sdk/credential-provider-node/package.json +11 -11
- package/node_modules/@aws-sdk/credential-provider-process/dist-cjs/index.js +11 -13
- package/node_modules/@aws-sdk/credential-provider-process/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/index.js +22 -24
- package/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/loadSso-BGYXHf8s.js +3 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-cjs/index.js +26 -28
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +8 -8
- package/node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromTokenFile.js +10 -14
- package/node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromWebToken.js +2 -6
- package/node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/index.js +3 -27
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +7 -7
- package/node_modules/@aws-sdk/eventstream-handler-node/dist-cjs/index.js +7 -9
- package/node_modules/@aws-sdk/eventstream-handler-node/package.json +5 -5
- package/node_modules/@aws-sdk/middleware-eventstream/dist-cjs/index.js +3 -5
- package/node_modules/@aws-sdk/middleware-eventstream/package.json +5 -5
- package/node_modules/@aws-sdk/middleware-websocket/dist-cjs/index.js +16 -18
- package/node_modules/@aws-sdk/middleware-websocket/package.json +6 -6
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/index.js +0 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +82 -84
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +158 -119
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +80 -82
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +80 -82
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +99 -101
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/commands/CreateOAuth2TokenCommand.js +4 -1
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/endpoint/bdd.js +70 -35
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/endpoint/endpointResolver.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/models/enums.js +3 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/endpoint/EndpointParameters.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/models/enums.d.ts +12 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/endpoint/EndpointParameters.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/models/enums.d.ts +3 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-cjs/index.js +11 -13
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/package.json +7 -7
- package/node_modules/@aws-sdk/nested-clients/package.json +9 -8
- package/node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/index.js +4 -6
- package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +5 -5
- package/node_modules/@aws-sdk/types/dist-cjs/index.js +7 -8
- package/node_modules/@aws-sdk/types/package.json +4 -4
- package/node_modules/@aws-sdk/util-locate-window/dist-cjs/index.js +0 -2
- package/node_modules/@aws-sdk/util-locate-window/package.json +4 -4
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/index.js +2 -4
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-external/nodable_entities.js +4 -7
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-parser.browser.js +2 -5
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-parser.js +7 -10
- package/node_modules/@aws-sdk/xml-builder/package.json +4 -4
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +162 -21
- package/node_modules/@smithy/core/dist-cjs/index.js +13 -15
- package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +29 -31
- package/node_modules/@smithy/core/dist-cjs/submodules/checksum/index.browser.js +2 -4
- package/node_modules/@smithy/core/dist-cjs/submodules/checksum/index.js +7 -9
- package/node_modules/@smithy/core/dist-cjs/submodules/checksum/index.native.js +3 -5
- package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +22 -23
- package/node_modules/@smithy/core/dist-cjs/submodules/config/index.browser.js +10 -11
- package/node_modules/@smithy/core/dist-cjs/submodules/config/index.js +38 -39
- package/node_modules/@smithy/core/dist-cjs/submodules/config/index.native.js +10 -11
- package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.browser.js +14 -17
- package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.js +20 -23
- package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.browser.js +9 -11
- package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +11 -13
- package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +59 -60
- package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.browser.js +23 -24
- package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.js +25 -26
- package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +5 -7
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.browser.js +4 -6
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +23 -25
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.native.js +4 -6
- package/node_modules/@smithy/core/dist-cjs/submodules/transport/index.js +2 -4
- package/node_modules/@smithy/core/dist-es/legacy-root-exports/middleware-http-auth-scheme/httpAuthSchemeMiddleware.js +1 -1
- package/node_modules/@smithy/core/dist-es/legacy-root-exports/middleware-http-signing/httpSigningMiddleware.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/cbor/SmithyRpcV2CborProtocol.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/endpointMiddleware.js +1 -1
- package/node_modules/@smithy/core/dist-types/submodules/schema/TypeRegistry.d.ts +1 -1
- package/node_modules/@smithy/core/package.json +7 -6
- package/node_modules/@smithy/credential-provider-imds/dist-cjs/index.js +23 -24
- package/node_modules/@smithy/credential-provider-imds/package.json +6 -6
- package/node_modules/@smithy/fetch-http-handler/dist-cjs/index.js +6 -8
- package/node_modules/@smithy/fetch-http-handler/package.json +7 -7
- package/node_modules/@smithy/signature-v4/dist-cjs/index.js +27 -29
- package/node_modules/@smithy/signature-v4/package.json +6 -6
- package/node_modules/@smithy/types/dist-cjs/index.js +23 -18
- package/node_modules/@smithy/types/package.json +4 -4
- package/node_modules/undici/docs/docs/api/Client.md +3 -0
- package/node_modules/undici/docs/docs/api/Cookies.md +27 -0
- package/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +1 -0
- package/node_modules/undici/lib/core/socks5-client.js +14 -4
- package/node_modules/undici/lib/core/socks5-utils.js +18 -4
- package/node_modules/undici/lib/dispatcher/agent.js +1 -1
- package/node_modules/undici/lib/dispatcher/balanced-pool.js +1 -1
- package/node_modules/undici/lib/dispatcher/client-h1.js +69 -1
- package/node_modules/undici/lib/dispatcher/client.js +3 -2
- package/node_modules/undici/lib/dispatcher/dispatcher-base.js +19 -0
- package/node_modules/undici/lib/dispatcher/pool.js +1 -1
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +2 -1
- package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +45 -34
- package/node_modules/undici/lib/util/cache.js +8 -2
- package/node_modules/undici/lib/web/cookies/parse.js +17 -25
- package/node_modules/undici/lib/web/websocket/permessage-deflate.js +13 -31
- package/node_modules/undici/lib/web/websocket/receiver.js +80 -23
- package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +8 -1
- package/node_modules/undici/lib/web/websocket/websocket.js +8 -1
- package/node_modules/undici/package.json +1 -1
- package/node_modules/undici/types/client.d.ts +16 -0
- package/package.json +2 -2
- package/slingshot/index.js +31 -31
- package/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/loadSso-BKDNrsal.js +0 -8
package/slingshot/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var B2=Object.create;var Tg=Object.defineProperty;var N2=Object.getOwnPropertyDescriptor;var j2=Object.getOwnPropertyNames;var q2=Object.getPrototypeOf,G2=Object.prototype.hasOwnProperty;var od=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var qe=(t,e)=>()=>(t&&(e=t(t=0)),e);var M=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ei=(t,e)=>{for(var n in e)Tg(t,n,{get:e[n],enumerable:!0})},K2=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of j2(e))!G2.call(t,s)&&s!==n&&Tg(t,s,{get:()=>e[s],enumerable:!(i=N2(e,s))||i.enumerable});return t};var H2=(t,e,n)=>(n=t!=null?B2(q2(t)):{},K2(e||!t||!t.__esModule?Tg(n,"default",{value:t,enumerable:!0}):n,t));function gn(t){let e={};for(let[n,i]of t.entries())e[n]=i;return e}var or=qe(()=>{"use strict"});function he(t){return t.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"")}var Oi=qe(()=>{"use strict"});var yS={};Ei(yS,{generateImagesOpenRouter:()=>wL});import yL from"openai";function SL(t,e,n){return new yL({apiKey:e,baseURL:t.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:{...t.headers,...n}})}function TL(t,e){let n=e.input.map(i=>i.type==="text"?{type:"text",text:he(i.text)}:{type:"image_url",image_url:{url:`data:${i.mimeType};base64,${i.data}`}});return{model:t.id,messages:[{role:"user",content:n}],stream:!1,modalities:t.output.includes("text")?["image","text"]:["image"]}}function CL(t,e){let n=t.prompt_tokens||0,i=t.prompt_tokens_details?.cached_tokens||0,s=t.prompt_tokens_details?.cache_write_tokens||0,r=s>0?Math.max(0,i-s):i,o=Math.max(0,n-r-s),a=t.completion_tokens||0,c={input:o,output:a,cacheRead:r,cacheWrite:s,totalTokens:o+a+r+s,cost:{input:e.cost.input/1e6*o,output:e.cost.output/1e6*a,cacheRead:e.cost.cacheRead/1e6*r,cacheWrite:e.cost.cacheWrite/1e6*s,total:0}};return c.cost.total=c.cost.input+c.cost.output+c.cost.cacheRead+c.cost.cacheWrite,c}var wL,wS=qe(()=>{"use strict";or();Oi();wL=async(t,e,n)=>{let i={api:t.api,provider:t.provider,model:t.id,output:[],stopReason:"stop",timestamp:Date.now()};try{let s=n?.apiKey;if(!s)throw new Error(`No API key for provider: ${t.provider}`);let r=SL(t,s,n?.headers),o=TL(t,e),a=await n?.onPayload?.(o,t);a!==void 0&&(o=a);let c={...n?.signal?{signal:n.signal}:{},...n?.timeoutMs!==void 0?{timeout:n.timeoutMs}:{},maxRetries:n?.maxRetries??0},{data:l,response:u}=await r.chat.completions.create(o,c).withResponse();await n?.onResponse?.({status:u.status,headers:gn(u.headers)},t);let d=l;i.responseId=d.id,d.usage&&(i.usage=CL(d.usage,t));let p=d.choices[0];if(p){let m=p.message.content;typeof m=="string"&&m.length>0&&i.output.push({type:"text",text:m});for(let g of p.message.images??[]){let h=typeof g.image_url=="string"?g.image_url:g.image_url?.url;if(!h?.startsWith("data:"))continue;let f=h.match(/^data:([^;]+);base64,(.+)$/);f&&i.output.push({type:"image",mimeType:f[1],data:f[2]})}}return i}catch(s){return i.stopReason=n?.signal?.aborted?"aborted":"error",i.errorMessage=s instanceof Error?s.message:JSON.stringify(s),i}}});var TS,CS=qe(()=>{"use strict";TS={"amazon-bedrock":{"amazon.nova-2-lite-v1:0":{id:"amazon.nova-2-lite-v1:0",name:"Nova 2 Lite",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:.33,output:2.75,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"amazon.nova-lite-v1:0":{id:"amazon.nova-lite-v1:0",name:"Nova Lite",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.06,output:.24,cacheRead:.015,cacheWrite:0},contextWindow:3e5,maxTokens:8192},"amazon.nova-micro-v1:0":{id:"amazon.nova-micro-v1:0",name:"Nova Micro",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.035,output:.14,cacheRead:.00875,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"amazon.nova-pro-v1:0":{id:"amazon.nova-pro-v1:0",name:"Nova Pro",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.8,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:3e5,maxTokens:8192},"anthropic.claude-haiku-4-5-20251001-v1:0":{id:"anthropic.claude-haiku-4-5-20251001-v1:0",name:"Claude Haiku 4.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"anthropic.claude-opus-4-1-20250805-v1:0":{id:"anthropic.claude-opus-4-1-20250805-v1:0",name:"Claude Opus 4.1",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic.claude-opus-4-5-20251101-v1:0":{id:"anthropic.claude-opus-4-5-20251101-v1:0",name:"Claude Opus 4.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"anthropic.claude-opus-4-6-v1":{id:"anthropic.claude-opus-4-6-v1",name:"Claude Opus 4.6",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic.claude-opus-4-7":{id:"anthropic.claude-opus-4-7",name:"Claude Opus 4.7",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic.claude-opus-4-8":{id:"anthropic.claude-opus-4-8",name:"Claude Opus 4.8",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"anthropic.claude-sonnet-4-6":{id:"anthropic.claude-sonnet-4-6",name:"Claude Sonnet 4.6",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"au.anthropic.claude-haiku-4-5-20251001-v1:0":{id:"au.anthropic.claude-haiku-4-5-20251001-v1:0",name:"Claude Haiku 4.5 (AU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"au.anthropic.claude-opus-4-6-v1":{id:"au.anthropic.claude-opus-4-6-v1",name:"AU Anthropic Claude Opus 4.6",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:16.5,output:82.5,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"au.anthropic.claude-opus-4-8":{id:"au.anthropic.claude-opus-4-8",name:"Claude Opus 4.8 (AU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"au.anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"au.anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5 (AU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"au.anthropic.claude-sonnet-4-6":{id:"au.anthropic.claude-sonnet-4-6",name:"AU Anthropic Claude Sonnet 4.6",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3.3,output:16.5,cacheRead:.33,cacheWrite:4.125},contextWindow:1e6,maxTokens:128e3},"deepseek.r1-v1:0":{id:"deepseek.r1-v1:0",name:"DeepSeek-R1",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:1.35,output:5.4,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:32768},"deepseek.v3-v1:0":{id:"deepseek.v3-v1:0",name:"DeepSeek-V3.1",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.58,output:1.68,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:81920},"deepseek.v3.2":{id:"deepseek.v3.2",name:"DeepSeek-V3.2",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.62,output:1.85,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:81920},"eu.anthropic.claude-fable-5":{id:"eu.anthropic.claude-fable-5",name:"Claude Fable 5 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:11,output:55,cacheRead:1.1,cacheWrite:13.75},contextWindow:1e6,maxTokens:128e3},"eu.anthropic.claude-haiku-4-5-20251001-v1:0":{id:"eu.anthropic.claude-haiku-4-5-20251001-v1:0",name:"Claude Haiku 4.5 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"eu.anthropic.claude-opus-4-5-20251101-v1:0":{id:"eu.anthropic.claude-opus-4-5-20251101-v1:0",name:"Claude Opus 4.5 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"eu.anthropic.claude-opus-4-6-v1":{id:"eu.anthropic.claude-opus-4-6-v1",name:"Claude Opus 4.6 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5.5,output:27.5,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"eu.anthropic.claude-opus-4-7":{id:"eu.anthropic.claude-opus-4-7",name:"Claude Opus 4.7 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5.5,output:27.5,cacheRead:.55,cacheWrite:6.875},contextWindow:1e6,maxTokens:128e3},"eu.anthropic.claude-opus-4-8":{id:"eu.anthropic.claude-opus-4-8",name:"Claude Opus 4.8 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5.5,output:27.5,cacheRead:.55,cacheWrite:6.875},contextWindow:1e6,maxTokens:128e3},"eu.anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"eu.anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3.3,output:16.5,cacheRead:.33,cacheWrite:4.125},contextWindow:2e5,maxTokens:64e3},"eu.anthropic.claude-sonnet-4-6":{id:"eu.anthropic.claude-sonnet-4-6",name:"Claude Sonnet 4.6 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3.3,output:16.5,cacheRead:.33,cacheWrite:4.125},contextWindow:1e6,maxTokens:64e3},"global.anthropic.claude-fable-5":{id:"global.anthropic.claude-fable-5",name:"Claude Fable 5 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:10,output:50,cacheRead:1,cacheWrite:12.5},contextWindow:1e6,maxTokens:128e3},"global.anthropic.claude-haiku-4-5-20251001-v1:0":{id:"global.anthropic.claude-haiku-4-5-20251001-v1:0",name:"Claude Haiku 4.5 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"global.anthropic.claude-opus-4-5-20251101-v1:0":{id:"global.anthropic.claude-opus-4-5-20251101-v1:0",name:"Claude Opus 4.5 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"global.anthropic.claude-opus-4-6-v1":{id:"global.anthropic.claude-opus-4-6-v1",name:"Claude Opus 4.6 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"global.anthropic.claude-opus-4-7":{id:"global.anthropic.claude-opus-4-7",name:"Claude Opus 4.7 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"global.anthropic.claude-opus-4-8":{id:"global.anthropic.claude-opus-4-8",name:"Claude Opus 4.8 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"global.anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"global.anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"global.anthropic.claude-sonnet-4-6":{id:"global.anthropic.claude-sonnet-4-6",name:"Claude Sonnet 4.6 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"google.gemma-3-27b-it":{id:"google.gemma-3-27b-it",name:"Google Gemma 3 27B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.12,output:.2,cacheRead:0,cacheWrite:0},contextWindow:202752,maxTokens:8192},"google.gemma-3-4b-it":{id:"google.gemma-3-4b-it",name:"Gemma 3 4B IT",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.04,output:.08,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"jp.anthropic.claude-opus-4-7":{id:"jp.anthropic.claude-opus-4-7",name:"Claude Opus 4.7 (JP)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"jp.anthropic.claude-opus-4-8":{id:"jp.anthropic.claude-opus-4-8",name:"Claude Opus 4.8 (JP)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"jp.anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"jp.anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5 (JP)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"jp.anthropic.claude-sonnet-4-6":{id:"jp.anthropic.claude-sonnet-4-6",name:"Claude Sonnet 4.6 (JP)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"meta.llama3-1-70b-instruct-v1:0":{id:"meta.llama3-1-70b-instruct-v1:0",name:"Llama 3.1 70B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta.llama3-1-8b-instruct-v1:0":{id:"meta.llama3-1-8b-instruct-v1:0",name:"Llama 3.1 8B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.22,output:.22,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta.llama3-3-70b-instruct-v1:0":{id:"meta.llama3-3-70b-instruct-v1:0",name:"Llama 3.3 70B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta.llama4-maverick-17b-instruct-v1:0":{id:"meta.llama4-maverick-17b-instruct-v1:0",name:"Llama 4 Maverick 17B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.24,output:.97,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:16384},"meta.llama4-scout-17b-instruct-v1:0":{id:"meta.llama4-scout-17b-instruct-v1:0",name:"Llama 4 Scout 17B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.17,output:.66,cacheRead:0,cacheWrite:0},contextWindow:35e5,maxTokens:16384},"minimax.minimax-m2":{id:"minimax.minimax-m2",name:"MiniMax M2",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:204608,maxTokens:128e3},"minimax.minimax-m2.1":{id:"minimax.minimax-m2.1",name:"MiniMax M2.1",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"minimax.minimax-m2.5":{id:"minimax.minimax-m2.5",name:"MiniMax M2.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:196608,maxTokens:98304},"mistral.devstral-2-123b":{id:"mistral.devstral-2-123b",name:"Devstral 2 123B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:8192},"mistral.magistral-small-2509":{id:"mistral.magistral-small-2509",name:"Magistral Small 1.2",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e4},"mistral.ministral-3-14b-instruct":{id:"mistral.ministral-3-14b-instruct",name:"Ministral 14B 3.0",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.2,output:.2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistral.ministral-3-3b-instruct":{id:"mistral.ministral-3-3b-instruct",name:"Ministral 3 3B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.1,output:.1,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:8192},"mistral.ministral-3-8b-instruct":{id:"mistral.ministral-3-8b-instruct",name:"Ministral 3 8B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistral.mistral-large-3-675b-instruct":{id:"mistral.mistral-large-3-675b-instruct",name:"Mistral Large 3",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:8192},"mistral.pixtral-large-2502-v1:0":{id:"mistral.pixtral-large-2502-v1:0",name:"Pixtral Large (25.02)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"mistral.voxtral-mini-3b-2507":{id:"mistral.voxtral-mini-3b-2507",name:"Voxtral Mini 3B 2507",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.04,output:.04,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistral.voxtral-small-24b-2507":{id:"mistral.voxtral-small-24b-2507",name:"Voxtral Small 24B 2507",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.35,cacheRead:0,cacheWrite:0},contextWindow:32e3,maxTokens:8192},"moonshot.kimi-k2-thinking":{id:"moonshot.kimi-k2-thinking",name:"Kimi K2 Thinking",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:0,cacheWrite:0},contextWindow:262143,maxTokens:16e3},"moonshotai.kimi-k2.5":{id:"moonshotai.kimi-k2.5",name:"Kimi K2.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:0,cacheWrite:0},contextWindow:262143,maxTokens:16e3},"nvidia.nemotron-nano-12b-v2":{id:"nvidia.nemotron-nano-12b-v2",name:"NVIDIA Nemotron Nano 12B v2 VL BF16",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.2,output:.6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"nvidia.nemotron-nano-3-30b":{id:"nvidia.nemotron-nano-3-30b",name:"NVIDIA Nemotron Nano 3 30B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.06,output:.24,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"nvidia.nemotron-nano-9b-v2":{id:"nvidia.nemotron-nano-9b-v2",name:"NVIDIA Nemotron Nano 9B v2",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.06,output:.23,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"nvidia.nemotron-super-3-120b":{id:"nvidia.nemotron-super-3-120b",name:"NVIDIA Nemotron 3 Super 120B A12B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.15,output:.65,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"openai.gpt-5.4":{id:"openai.gpt-5.4",name:"GPT-5.4",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:2.75,output:16.5,cacheRead:.275,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"openai.gpt-5.5":{id:"openai.gpt-5.5",name:"GPT-5.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5.5,output:33,cacheRead:.55,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"openai.gpt-oss-120b":{id:"openai.gpt-oss-120b",name:"gpt-oss-120b",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai.gpt-oss-120b-1:0":{id:"openai.gpt-oss-120b-1:0",name:"gpt-oss-120b",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai.gpt-oss-20b":{id:"openai.gpt-oss-20b",name:"gpt-oss-20b",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.07,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai.gpt-oss-20b-1:0":{id:"openai.gpt-oss-20b-1:0",name:"gpt-oss-20b",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.07,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai.gpt-oss-safeguard-120b":{id:"openai.gpt-oss-safeguard-120b",name:"GPT OSS Safeguard 120B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai.gpt-oss-safeguard-20b":{id:"openai.gpt-oss-safeguard-20b",name:"GPT OSS Safeguard 20B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.07,output:.2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"qwen.qwen3-235b-a22b-2507-v1:0":{id:"qwen.qwen3-235b-a22b-2507-v1:0",name:"Qwen3 235B A22B 2507",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.22,output:.88,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"qwen.qwen3-32b-v1:0":{id:"qwen.qwen3-32b-v1:0",name:"Qwen3 32B (dense)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:16384,maxTokens:16384},"qwen.qwen3-coder-30b-a3b-v1:0":{id:"qwen.qwen3-coder-30b-a3b-v1:0",name:"Qwen3 Coder 30B A3B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"qwen.qwen3-coder-480b-a35b-v1:0":{id:"qwen.qwen3-coder-480b-a35b-v1:0",name:"Qwen3 Coder 480B A35B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.22,output:1.8,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:65536},"qwen.qwen3-coder-next":{id:"qwen.qwen3-coder-next",name:"Qwen3 Coder Next",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.22,output:1.8,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:65536},"qwen.qwen3-next-80b-a3b":{id:"qwen.qwen3-next-80b-a3b",name:"Qwen/Qwen3-Next-80B-A3B-Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.14,output:1.4,cacheRead:0,cacheWrite:0},contextWindow:262e3,maxTokens:262e3},"qwen.qwen3-vl-235b-a22b":{id:"qwen.qwen3-vl-235b-a22b",name:"Qwen/Qwen3-VL-235B-A22B-Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.3,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:262e3,maxTokens:262e3},"us.anthropic.claude-fable-5":{id:"us.anthropic.claude-fable-5",name:"Claude Fable 5 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:10,output:50,cacheRead:1,cacheWrite:12.5},contextWindow:1e6,maxTokens:128e3},"us.anthropic.claude-haiku-4-5-20251001-v1:0":{id:"us.anthropic.claude-haiku-4-5-20251001-v1:0",name:"Claude Haiku 4.5 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"us.anthropic.claude-opus-4-1-20250805-v1:0":{id:"us.anthropic.claude-opus-4-1-20250805-v1:0",name:"Claude Opus 4.1 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"us.anthropic.claude-opus-4-5-20251101-v1:0":{id:"us.anthropic.claude-opus-4-5-20251101-v1:0",name:"Claude Opus 4.5 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"us.anthropic.claude-opus-4-6-v1":{id:"us.anthropic.claude-opus-4-6-v1",name:"Claude Opus 4.6 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"us.anthropic.claude-opus-4-7":{id:"us.anthropic.claude-opus-4-7",name:"Claude Opus 4.7 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"us.anthropic.claude-opus-4-8":{id:"us.anthropic.claude-opus-4-8",name:"Claude Opus 4.8 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"us.anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"us.anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"us.anthropic.claude-sonnet-4-6":{id:"us.anthropic.claude-sonnet-4-6",name:"Claude Sonnet 4.6 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"us.deepseek.r1-v1:0":{id:"us.deepseek.r1-v1:0",name:"DeepSeek-R1 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:1.35,output:5.4,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:32768},"us.meta.llama4-maverick-17b-instruct-v1:0":{id:"us.meta.llama4-maverick-17b-instruct-v1:0",name:"Llama 4 Maverick 17B Instruct (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.24,output:.97,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:16384},"us.meta.llama4-scout-17b-instruct-v1:0":{id:"us.meta.llama4-scout-17b-instruct-v1:0",name:"Llama 4 Scout 17B Instruct (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.17,output:.66,cacheRead:0,cacheWrite:0},contextWindow:35e5,maxTokens:16384},"writer.palmyra-x4-v1:0":{id:"writer.palmyra-x4-v1:0",name:"Palmyra X4",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:122880,maxTokens:8192},"writer.palmyra-x5-v1:0":{id:"writer.palmyra-x5-v1:0",name:"Palmyra X5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.6,output:6,cacheRead:0,cacheWrite:0},contextWindow:104e4,maxTokens:8192},"zai.glm-4.7":{id:"zai.glm-4.7",name:"GLM-4.7",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"zai.glm-4.7-flash":{id:"zai.glm-4.7-flash",name:"GLM-4.7-Flash",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.07,output:.4,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131072},"zai.glm-5":{id:"zai.glm-5",name:"GLM-5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:0,cacheWrite:0},contextWindow:202752,maxTokens:101376}},"ant-ling":{"Ling-2.6-1T":{id:"Ling-2.6-1T",name:"Ling 2.6 1T",api:"openai-completions",provider:"ant-ling",baseUrl:"https://api.ant-ling.com/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsLongCacheRetention:!1},reasoning:!1,input:["text"],cost:{input:.06,output:.25,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"Ling-2.6-flash":{id:"Ling-2.6-flash",name:"Ling 2.6 Flash",api:"openai-completions",provider:"ant-ling",baseUrl:"https://api.ant-ling.com/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsLongCacheRetention:!1},reasoning:!1,input:["text"],cost:{input:.01,output:.02,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"Ring-2.6-1T":{id:"Ring-2.6-1T",name:"Ring 2.6 1T",api:"openai-completions",provider:"ant-ling",baseUrl:"https://api.ant-ling.com/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsLongCacheRetention:!1,thinkingFormat:"ant-ling"},reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:null,medium:null,high:"high",xhigh:"xhigh"},input:["text"],cost:{input:.06,output:.25,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536}},anthropic:{"claude-3-5-haiku-20241022":{id:"claude-3-5-haiku-20241022",name:"Claude Haiku 3.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"claude-3-5-haiku-latest":{id:"claude-3-5-haiku-latest",name:"Claude Haiku 3.5 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"claude-3-5-sonnet-20240620":{id:"claude-3-5-sonnet-20240620",name:"Claude Sonnet 3.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:8192},"claude-3-5-sonnet-20241022":{id:"claude-3-5-sonnet-20241022",name:"Claude Sonnet 3.5 v2",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:8192},"claude-3-7-sonnet-20250219":{id:"claude-3-7-sonnet-20250219",name:"Claude Sonnet 3.7",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-3-haiku-20240307":{id:"claude-3-haiku-20240307",name:"Claude Haiku 3",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:.25,output:1.25,cacheRead:.03,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"claude-3-opus-20240229":{id:"claude-3-opus-20240229",name:"Claude Opus 3",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:4096},"claude-3-sonnet-20240229":{id:"claude-3-sonnet-20240229",name:"Claude Sonnet 3",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"claude-fable-5":{id:"claude-fable-5",name:"Claude Fable 5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",compat:{forceAdaptiveThinking:!0},reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:10,output:50,cacheRead:1,cacheWrite:12.5},contextWindow:1e6,maxTokens:128e3},"claude-haiku-4-5":{id:"claude-haiku-4-5",name:"Claude Haiku 4.5 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"claude-haiku-4-5-20251001":{id:"claude-haiku-4-5-20251001",name:"Claude Haiku 4.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-0":{id:"claude-opus-4-0",name:"Claude Opus 4 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-1":{id:"claude-opus-4-1",name:"Claude Opus 4.1 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-1-20250805":{id:"claude-opus-4-1-20250805",name:"Claude Opus 4.1",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-20250514":{id:"claude-opus-4-20250514",name:"Claude Opus 4",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-5":{id:"claude-opus-4-5",name:"Claude Opus 4.5 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-5-20251101":{id:"claude-opus-4-5-20251101",name:"Claude Opus 4.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-6":{id:"claude-opus-4-6",name:"Claude Opus 4.6",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",compat:{forceAdaptiveThinking:!0},reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-opus-4-7":{id:"claude-opus-4-7",name:"Claude Opus 4.7",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",compat:{forceAdaptiveThinking:!0,supportsTemperature:!1},reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-opus-4-8":{id:"claude-opus-4-8",name:"Claude Opus 4.8",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",compat:{forceAdaptiveThinking:!0,supportsTemperature:!1},reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-sonnet-4-0":{id:"claude-sonnet-4-0",name:"Claude Sonnet 4 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-20250514":{id:"claude-sonnet-4-20250514",name:"Claude Sonnet 4",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-5":{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-5-20250929":{id:"claude-sonnet-4-5-20250929",name:"Claude Sonnet 4.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-6":{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",compat:{forceAdaptiveThinking:!0},reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3}},"azure-openai-responses":{"gpt-4":{id:"gpt-4",name:"GPT-4",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text"],cost:{input:30,output:60,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"gpt-4-turbo":{id:"gpt-4-turbo",name:"GPT-4 Turbo",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-4.1":{id:"gpt-4.1",name:"GPT-4.1",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4.1-mini":{id:"gpt-4.1-mini",name:"GPT-4.1 mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:.4,output:1.6,cacheRead:.1,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4.1-nano":{id:"gpt-4.1-nano",name:"GPT-4.1 nano",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.025,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4o":{id:"gpt-4o",name:"GPT-4o",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-2024-05-13":{id:"gpt-4o-2024-05-13",name:"GPT-4o (2024-05-13)",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:5,output:15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-4o-2024-08-06":{id:"gpt-4o-2024-08-06",name:"GPT-4o (2024-08-06)",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-2024-11-20":{id:"gpt-4o-2024-11-20",name:"GPT-4o (2024-11-20)",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-mini":{id:"gpt-4o-mini",name:"GPT-4o mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.075,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5":{id:"gpt-5",name:"GPT-5",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-chat-latest":{id:"gpt-5-chat-latest",name:"GPT-5 Chat Latest",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5-codex":{id:"gpt-5-codex",name:"GPT-5-Codex",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-mini":{id:"gpt-5-mini",name:"GPT-5 Mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-nano":{id:"gpt-5-nano",name:"GPT-5 Nano",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.05,output:.4,cacheRead:.005,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-pro":{id:"gpt-5-pro",name:"GPT-5 Pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:15,output:120,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1":{id:"gpt-5.1",name:"GPT-5.1",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-chat-latest":{id:"gpt-5.1-chat-latest",name:"GPT-5.1 Chat",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.1-codex":{id:"gpt-5.1-codex",name:"GPT-5.1 Codex",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-max":{id:"gpt-5.1-codex-max",name:"GPT-5.1 Codex Max",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-mini":{id:"gpt-5.1-codex-mini",name:"GPT-5.1 Codex mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-chat-latest":{id:"gpt-5.2-chat-latest",name:"GPT-5.2 Chat",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-pro":{id:"gpt-5.2-pro",name:"GPT-5.2 Pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:21,output:168,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-chat-latest":{id:"gpt-5.3-chat-latest",name:"GPT-5.3 Chat (latest)",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex-spark":{id:"gpt-5.3-codex-spark",name:"GPT-5.3 Codex Spark",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:32e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-nano":{id:"gpt-5.4-nano",name:"GPT-5.4 nano",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-pro":{id:"gpt-5.4-pro",name:"GPT-5.4 Pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"gpt-5.5-pro":{id:"gpt-5.5-pro",name:"GPT-5.5 Pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh",minimal:null,low:null},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},o1:{id:"o1",name:"o1",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o1-pro":{id:"o1-pro",name:"o1-pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:150,output:600,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},o3:{id:"o3",name:"o3",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-deep-research":{id:"o3-deep-research",name:"o3-deep-research",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:10,output:40,cacheRead:2.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-mini":{id:"o3-mini",name:"o3-mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-pro":{id:"o3-pro",name:"o3-pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o4-mini":{id:"o4-mini",name:"o4-mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o4-mini-deep-research":{id:"o4-mini-deep-research",name:"o4-mini-deep-research",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5}},cerebras:{"gpt-oss-120b":{id:"gpt-oss-120b",name:"GPT OSS 120B",api:"openai-completions",provider:"cerebras",baseUrl:"https://api.cerebras.ai/v1",reasoning:!0,input:["text"],cost:{input:.35,output:.75,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:40960},"zai-glm-4.7":{id:"zai-glm-4.7",name:"Z.AI GLM-4.7",api:"openai-completions",provider:"cerebras",baseUrl:"https://api.cerebras.ai/v1",reasoning:!0,input:["text"],cost:{input:2.25,output:2.75,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:40960}},"cloudflare-ai-gateway":{"claude-3-5-haiku":{id:"claude-3-5-haiku",name:"Claude Haiku 3.5 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!1,input:["text","image"],cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"claude-3-haiku":{id:"claude-3-haiku",name:"Claude Haiku 3",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!1,input:["text","image"],cost:{input:.25,output:1.25,cacheRead:.03,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"claude-3-opus":{id:"claude-3-opus",name:"Claude Opus 3",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!1,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:4096},"claude-3-sonnet":{id:"claude-3-sonnet",name:"Claude Sonnet 3",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"claude-3.5-haiku":{id:"claude-3.5-haiku",name:"Claude Haiku 3.5 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!1,input:["text","image"],cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"claude-3.5-sonnet":{id:"claude-3.5-sonnet",name:"Claude Sonnet 3.5 v2",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:8192},"claude-fable-5":{id:"claude-fable-5",name:"Claude Fable 5",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",compat:{forceAdaptiveThinking:!0},reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:10,output:50,cacheRead:1,cacheWrite:12.5},contextWindow:1e6,maxTokens:128e3},"claude-haiku-4-5":{id:"claude-haiku-4-5",name:"Claude Haiku 4.5 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4":{id:"claude-opus-4",name:"Claude Opus 4 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-1":{id:"claude-opus-4-1",name:"Claude Opus 4.1 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-5":{id:"claude-opus-4-5",name:"Claude Opus 4.5 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-6":{id:"claude-opus-4-6",name:"Claude Opus 4.6 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",compat:{forceAdaptiveThinking:!0},reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-opus-4-7":{id:"claude-opus-4-7",name:"Claude Opus 4.7",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",compat:{forceAdaptiveThinking:!0,supportsTemperature:!1},reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-opus-4-8":{id:"claude-opus-4-8",name:"Claude Opus 4.8",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",compat:{forceAdaptiveThinking:!0,supportsTemperature:!1},reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-sonnet-4":{id:"claude-sonnet-4",name:"Claude Sonnet 4 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-5":{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-6":{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",compat:{forceAdaptiveThinking:!0},reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"gpt-4":{id:"gpt-4",name:"GPT-4",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!1,input:["text"],cost:{input:30,output:60,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"gpt-4-turbo":{id:"gpt-4-turbo",name:"GPT-4 Turbo",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-4o":{id:"gpt-4o",name:"GPT-4o",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-mini":{id:"gpt-4o-mini",name:"GPT-4o mini",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.08,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.1":{id:"gpt-5.1",name:"GPT-5.1",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.13,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex":{id:"gpt-5.1-codex",name:"GPT-5.1 Codex",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},o1:{id:"o1",name:"o1",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},o3:{id:"o3",name:"o3",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-mini":{id:"o3-mini",name:"o3-mini",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-pro":{id:"o3-pro",name:"o3-pro",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o4-mini":{id:"o4-mini",name:"o4-mini",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.28,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"workers-ai/@cf/moonshotai/kimi-k2.5":{id:"workers-ai/@cf/moonshotai/kimi-k2.5",name:"Kimi K2.5",api:"openai-completions",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/compat",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.1,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"workers-ai/@cf/moonshotai/kimi-k2.6":{id:"workers-ai/@cf/moonshotai/kimi-k2.6",name:"Kimi K2.6",api:"openai-completions",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/compat",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"workers-ai/@cf/nvidia/nemotron-3-120b-a12b":{id:"workers-ai/@cf/nvidia/nemotron-3-120b-a12b",name:"Nemotron 3 Super 120B",api:"openai-completions",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/compat",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"workers-ai/@cf/zai-org/glm-4.7-flash":{id:"workers-ai/@cf/zai-org/glm-4.7-flash",name:"GLM-4.7-Flash",api:"openai-completions",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/compat",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text"],cost:{input:.06,output:.4,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072}},"cloudflare-workers-ai":{"@cf/google/gemma-4-26b-a4b-it":{id:"@cf/google/gemma-4-26b-a4b-it",name:"Gemma 4 26B A4B IT",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text","image"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:16384},"@cf/ibm-granite/granite-4.0-h-micro":{id:"@cf/ibm-granite/granite-4.0-h-micro",name:"Granite 4.0 H Micro",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!1,input:["text"],cost:{input:.017,output:.112,cacheRead:0,cacheWrite:0},contextWindow:131e3,maxTokens:131e3},"@cf/meta/llama-3.3-70b-instruct-fp8-fast":{id:"@cf/meta/llama-3.3-70b-instruct-fp8-fast",name:"Llama 3.3 70B Instruct fp8 Fast",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!1,input:["text"],cost:{input:.293,output:2.253,cacheRead:0,cacheWrite:0},contextWindow:24e3,maxTokens:24e3},"@cf/meta/llama-4-scout-17b-16e-instruct":{id:"@cf/meta/llama-4-scout-17b-16e-instruct",name:"Llama 4 Scout 17B 16E Instruct",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!1,input:["text","image"],cost:{input:.27,output:.85,cacheRead:0,cacheWrite:0},contextWindow:131e3,maxTokens:16384},"@cf/mistralai/mistral-small-3.1-24b-instruct":{id:"@cf/mistralai/mistral-small-3.1-24b-instruct",name:"Mistral Small 3.1 24B Instruct",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!1,input:["text"],cost:{input:.351,output:.555,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"@cf/moonshotai/kimi-k2.6":{id:"@cf/moonshotai/kimi-k2.6",name:"Kimi K2.6",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262144,maxTokens:256e3},"@cf/moonshotai/kimi-k2.7-code":{id:"@cf/moonshotai/kimi-k2.7-code",name:"Kimi K2.7 Code",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.19,cacheWrite:0},contextWindow:262144,maxTokens:262144},"@cf/nvidia/nemotron-3-120b-a12b":{id:"@cf/nvidia/nemotron-3-120b-a12b",name:"Nemotron 3 Super 120B",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"@cf/openai/gpt-oss-120b":{id:"@cf/openai/gpt-oss-120b",name:"GPT OSS 120B",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text"],cost:{input:.35,output:.75,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"@cf/openai/gpt-oss-20b":{id:"@cf/openai/gpt-oss-20b",name:"GPT OSS 20B",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text"],cost:{input:.2,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"@cf/qwen/qwen3-30b-a3b-fp8":{id:"@cf/qwen/qwen3-30b-a3b-fp8",name:"Qwen3 30B A3b fp8",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text"],cost:{input:.0509,output:.335,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:32768},"@cf/zai-org/glm-4.7-flash":{id:"@cf/zai-org/glm-4.7-flash",name:"GLM-4.7-Flash",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text"],cost:{input:.0605,output:.4,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072}},deepseek:{"deepseek-v4-flash":{id:"deepseek-v4-flash",name:"DeepSeek V4 Flash",api:"openai-completions",provider:"deepseek",baseUrl:"https://api.deepseek.com",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:.14,output:.28,cacheRead:.0028,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"deepseek-v4-pro":{id:"deepseek-v4-pro",name:"DeepSeek V4 Pro",api:"openai-completions",provider:"deepseek",baseUrl:"https://api.deepseek.com",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:.435,output:.87,cacheRead:.003625,cacheWrite:0},contextWindow:1e6,maxTokens:384e3}},fireworks:{"accounts/fireworks/models/deepseek-v4-flash":{id:"accounts/fireworks/models/deepseek-v4-flash",name:"DeepSeek V4 Flash",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.14,output:.28,cacheRead:.03,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"accounts/fireworks/models/deepseek-v4-pro":{id:"accounts/fireworks/models/deepseek-v4-pro",name:"DeepSeek V4 Pro",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:1.74,output:3.48,cacheRead:.145,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"accounts/fireworks/models/glm-5p1":{id:"accounts/fireworks/models/glm-5p1",name:"GLM 5.1",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:1.4,output:4.4,cacheRead:.26,cacheWrite:0},contextWindow:202800,maxTokens:131072},"accounts/fireworks/models/gpt-oss-120b":{id:"accounts/fireworks/models/gpt-oss-120b",name:"GPT OSS 120B",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:.015,cacheWrite:0},contextWindow:131072,maxTokens:32768},"accounts/fireworks/models/gpt-oss-20b":{id:"accounts/fireworks/models/gpt-oss-20b",name:"GPT OSS 20B",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.07,output:.3,cacheRead:.035,cacheWrite:0},contextWindow:131072,maxTokens:32768},"accounts/fireworks/models/kimi-k2p6":{id:"accounts/fireworks/models/kimi-k2p6",name:"Kimi K2.6",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262e3,maxTokens:262e3},"accounts/fireworks/models/kimi-k2p7-code":{id:"accounts/fireworks/models/kimi-k2p7-code",name:"Kimi K2.7 Code",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.19,cacheWrite:0},contextWindow:262e3,maxTokens:262e3},"accounts/fireworks/models/minimax-m2p7":{id:"accounts/fireworks/models/minimax-m2p7",name:"MiniMax-M2.7",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:196608,maxTokens:196608},"accounts/fireworks/models/minimax-m3":{id:"accounts/fireworks/models/minimax-m3",name:"MiniMax-M3",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:512e3,maxTokens:512e3},"accounts/fireworks/models/qwen3p7-plus":{id:"accounts/fireworks/models/qwen3p7-plus",name:"Qwen 3.7 Plus",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:.4,output:1.6,cacheRead:.08,cacheWrite:0},contextWindow:262144,maxTokens:65536},"accounts/fireworks/routers/glm-5p1-fast":{id:"accounts/fireworks/routers/glm-5p1-fast",name:"GLM 5.1 Fast",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:2.8,output:8.8,cacheRead:.52,cacheWrite:0},contextWindow:202800,maxTokens:131072},"accounts/fireworks/routers/kimi-k2p6-fast":{id:"accounts/fireworks/routers/kimi-k2p6-fast",name:"Kimi K2.6 Fast",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.3,cacheWrite:0},contextWindow:262e3,maxTokens:262e3},"accounts/fireworks/routers/kimi-k2p6-turbo":{id:"accounts/fireworks/routers/kimi-k2p6-turbo",name:"Kimi K2.6 Turbo",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.3,cacheWrite:0},contextWindow:262e3,maxTokens:262e3},"accounts/fireworks/routers/kimi-k2p7-code-fast":{id:"accounts/fireworks/routers/kimi-k2p7-code-fast",name:"Kimi K2.7 Code Fast",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.38,cacheWrite:0},contextWindow:262e3,maxTokens:262e3}},"github-copilot":{"claude-fable-5":{id:"claude-fable-5",name:"Claude Fable 5",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!0,input:["text","image"],cost:{input:10,output:50,cacheRead:1,cacheWrite:12.5},contextWindow:1e6,maxTokens:128e3},"claude-haiku-4.5":{id:"claude-haiku-4.5",name:"Claude Haiku 4.5 (latest)",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsEagerToolInputStreaming:!1},reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4.5":{id:"claude-opus-4.5",name:"Claude Opus 4.5 (latest)",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:32e3},"claude-opus-4.6":{id:"claude-opus-4.6",name:"Claude Opus 4.6",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{forceAdaptiveThinking:!0},reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:32e3},"claude-opus-4.7":{id:"claude-opus-4.7",name:"Claude Opus 4.7",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{forceAdaptiveThinking:!0,supportsTemperature:!1},reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:32e3},"claude-opus-4.8":{id:"claude-opus-4.8",name:"Claude Opus 4.8",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{forceAdaptiveThinking:!0,supportsTemperature:!1},reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4":{id:"claude-sonnet-4",name:"Claude Sonnet 4 (latest)",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsEagerToolInputStreaming:!1},reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:216e3,maxTokens:16e3},"claude-sonnet-4.5":{id:"claude-sonnet-4.5",name:"Claude Sonnet 4.5 (latest)",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsEagerToolInputStreaming:!1},reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:32e3},"claude-sonnet-4.6":{id:"claude-sonnet-4.6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{forceAdaptiveThinking:!0},reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:32e3},"gemini-2.5-pro":{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"gemini-3-flash-preview":{id:"gemini-3-flash-preview",name:"Gemini 3 Flash Preview",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"gemini-3.1-pro-preview":{id:"gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:2e5,maxTokens:64e3},"gemini-3.5-flash":{id:"gemini-3.5-flash",name:"Gemini 3.5 Flash",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!0,input:["text","image"],cost:{input:1.5,output:9,cacheRead:.15,cacheWrite:0},contextWindow:2e5,maxTokens:64e3},"gpt-4.1":{id:"gpt-4.1",name:"GPT-4.1",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5-mini":{id:"gpt-5-mini",name:"GPT-5 Mini",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low"},input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:264e3,maxTokens:64e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 mini",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-nano":{id:"gpt-5.4-nano",name:"GPT-5.4 nano",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"raptor-mini":{id:"raptor-mini",name:"Raptor mini",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3}},google:{"gemini-2.0-flash":{id:"gemini-2.0-flash",name:"Gemini 2.0 Flash",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!1,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.025,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"gemini-2.0-flash-lite":{id:"gemini-2.0-flash-lite",name:"Gemini 2.0 Flash-Lite",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!1,input:["text","image"],cost:{input:.075,output:.3,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"gemini-2.5-flash":{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.03,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash-lite":{id:"gemini-2.5-flash-lite",name:"Gemini 2.5 Flash-Lite",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.01,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-pro":{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3-flash-preview":{id:"gemini-3-flash-preview",name:"Gemini 3 Flash Preview",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3-pro-preview":{id:"gemini-3-pro-preview",name:"Gemini 3 Pro Preview",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:"LOW",medium:null,high:"HIGH"},input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.1-flash-lite":{id:"gemini-3.1-flash-lite",name:"Gemini 3.1 Flash Lite",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.25,output:1.5,cacheRead:.025,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.1-flash-lite-preview":{id:"gemini-3.1-flash-lite-preview",name:"Gemini 3.1 Flash Lite Preview",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.25,output:1.5,cacheRead:.025,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.1-pro-preview":{id:"gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:"LOW",medium:null,high:"HIGH"},input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.1-pro-preview-customtools":{id:"gemini-3.1-pro-preview-customtools",name:"Gemini 3.1 Pro Preview Custom Tools",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:"LOW",medium:null,high:"HIGH"},input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.5-flash":{id:"gemini-3.5-flash",name:"Gemini 3.5 Flash",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.5,output:9,cacheRead:.15,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-flash-latest":{id:"gemini-flash-latest",name:"Gemini Flash Latest",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.075,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-flash-lite-latest":{id:"gemini-flash-lite-latest",name:"Gemini Flash-Lite Latest",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.025,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemma-4-26b-a4b-it":{id:"gemma-4-26b-a4b-it",name:"Gemma 4 26B A4B IT",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null,minimal:"MINIMAL",low:null,medium:null,high:"HIGH"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"gemma-4-31b-it":{id:"gemma-4-31b-it",name:"Gemma 4 31B IT",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null,minimal:"MINIMAL",low:null,medium:null,high:"HIGH"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"gemma-4-E2B-it":{id:"gemma-4-E2B-it",name:"Gemma 4 E2B IT",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null,minimal:"MINIMAL",low:null,medium:null,high:"HIGH"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"gemma-4-E4B-it":{id:"gemma-4-E4B-it",name:"Gemma 4 E4B IT",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null,minimal:"MINIMAL",low:null,medium:null,high:"HIGH"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192}},"google-vertex":{"gemini-1.5-flash":{id:"gemini-1.5-flash",name:"Gemini 1.5 Flash (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!1,input:["text","image"],cost:{input:.075,output:.3,cacheRead:.01875,cacheWrite:0},contextWindow:1e6,maxTokens:8192},"gemini-1.5-flash-8b":{id:"gemini-1.5-flash-8b",name:"Gemini 1.5 Flash-8B (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!1,input:["text","image"],cost:{input:.0375,output:.15,cacheRead:.01,cacheWrite:0},contextWindow:1e6,maxTokens:8192},"gemini-1.5-pro":{id:"gemini-1.5-pro",name:"Gemini 1.5 Pro (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!1,input:["text","image"],cost:{input:1.25,output:5,cacheRead:.3125,cacheWrite:0},contextWindow:1e6,maxTokens:8192},"gemini-2.0-flash":{id:"gemini-2.0-flash",name:"Gemini 2.0 Flash (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.0375,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"gemini-2.0-flash-lite":{id:"gemini-2.0-flash-lite",name:"Gemini 2.0 Flash Lite (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:.075,output:.3,cacheRead:.01875,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash":{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.03,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash-lite":{id:"gemini-2.5-flash-lite",name:"Gemini 2.5 Flash Lite (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.01,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash-lite-preview-09-2025":{id:"gemini-2.5-flash-lite-preview-09-2025",name:"Gemini 2.5 Flash Lite Preview 09-25 (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.01,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-pro":{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3-flash-preview":{id:"gemini-3-flash-preview",name:"Gemini 3 Flash Preview (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3-pro-preview":{id:"gemini-3-pro-preview",name:"Gemini 3 Pro Preview (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:"LOW",medium:null,high:"HIGH"},input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1e6,maxTokens:64e3},"gemini-3.1-pro-preview":{id:"gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:"LOW",medium:null,high:"HIGH"},input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.1-pro-preview-customtools":{id:"gemini-3.1-pro-preview-customtools",name:"Gemini 3.1 Pro Preview Custom Tools (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:"LOW",medium:null,high:"HIGH"},input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536}},groq:{"llama-3.1-8b-instant":{id:"llama-3.1-8b-instant",name:"Llama 3.1 8B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:.05,output:.08,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"llama-3.3-70b-versatile":{id:"llama-3.3-70b-versatile",name:"Llama 3.3 70B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:.59,output:.79,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"meta-llama/llama-4-scout-17b-16e-instruct":{id:"meta-llama/llama-4-scout-17b-16e-instruct",name:"Llama 4 Scout 17B 16E",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text","image"],cost:{input:.11,output:.34,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"openai/gpt-oss-120b":{id:"openai/gpt-oss-120b",name:"GPT OSS 120B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:.075,cacheWrite:0},contextWindow:131072,maxTokens:65536},"openai/gpt-oss-20b":{id:"openai/gpt-oss-20b",name:"GPT OSS 20B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:.075,output:.3,cacheRead:.0375,cacheWrite:0},contextWindow:131072,maxTokens:65536},"openai/gpt-oss-safeguard-20b":{id:"openai/gpt-oss-safeguard-20b",name:"Safety GPT OSS 20B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:.075,output:.3,cacheRead:.037,cacheWrite:0},contextWindow:131072,maxTokens:65536},"qwen/qwen3-32b":{id:"qwen/qwen3-32b",name:"Qwen3-32B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"default"},input:["text"],cost:{input:.29,output:.59,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:40960}},huggingface:{"MiniMaxAI/MiniMax-M2.1":{id:"MiniMaxAI/MiniMax-M2.1",name:"MiniMax-M2.1",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"MiniMaxAI/MiniMax-M2.5":{id:"MiniMaxAI/MiniMax-M2.5",name:"MiniMax-M2.5",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:0},contextWindow:204800,maxTokens:131072},"MiniMaxAI/MiniMax-M2.7":{id:"MiniMaxAI/MiniMax-M2.7",name:"MiniMax-M2.7",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:204800,maxTokens:131072},"Qwen/Qwen3-235B-A22B-Thinking-2507":{id:"Qwen/Qwen3-235B-A22B-Thinking-2507",name:"Qwen3-235B-A22B-Thinking-2507",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.3,output:3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"Qwen/Qwen3-Coder-480B-A35B-Instruct":{id:"Qwen/Qwen3-Coder-480B-A35B-Instruct",name:"Qwen3-Coder-480B-A35B-Instruct",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:2,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:66536},"Qwen/Qwen3-Coder-Next":{id:"Qwen/Qwen3-Coder-Next",name:"Qwen3-Coder-Next",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:.2,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"Qwen/Qwen3-Next-80B-A3B-Instruct":{id:"Qwen/Qwen3-Next-80B-A3B-Instruct",name:"Qwen3-Next-80B-A3B-Instruct",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:.25,output:1,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:66536},"Qwen/Qwen3-Next-80B-A3B-Thinking":{id:"Qwen/Qwen3-Next-80B-A3B-Thinking",name:"Qwen3-Next-80B-A3B-Thinking",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:.3,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"Qwen/Qwen3.5-397B-A17B":{id:"Qwen/Qwen3.5-397B-A17B",name:"Qwen3.5-397B-A17B",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text","image"],cost:{input:.6,output:3.6,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"XiaomiMiMo/MiMo-V2-Flash":{id:"XiaomiMiMo/MiMo-V2-Flash",name:"MiMo-V2-Flash",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"deepseek-ai/DeepSeek-R1-0528":{id:"deepseek-ai/DeepSeek-R1-0528",name:"DeepSeek-R1-0528",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:3,output:5,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:163840},"deepseek-ai/DeepSeek-V3.2":{id:"deepseek-ai/DeepSeek-V3.2",name:"DeepSeek-V3.2",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.28,output:.4,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:65536},"deepseek-ai/DeepSeek-V4-Pro":{id:"deepseek-ai/DeepSeek-V4-Pro",name:"DeepSeek V4 Pro",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.435,output:.87,cacheRead:.003625,cacheWrite:0},contextWindow:1048576,maxTokens:393216},"moonshotai/Kimi-K2-Instruct":{id:"moonshotai/Kimi-K2-Instruct",name:"Kimi-K2-Instruct",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:1,output:3,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"moonshotai/Kimi-K2-Instruct-0905":{id:"moonshotai/Kimi-K2-Instruct-0905",name:"Kimi-K2-Instruct-0905",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:1,output:3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:16384},"moonshotai/Kimi-K2-Thinking":{id:"moonshotai/Kimi-K2-Thinking",name:"Kimi-K2-Thinking",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"moonshotai/Kimi-K2.5":{id:"moonshotai/Kimi-K2.5",name:"Kimi-K2.5",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.1,cacheWrite:0},contextWindow:262144,maxTokens:262144},"moonshotai/Kimi-K2.6":{id:"moonshotai/Kimi-K2.6",name:"Kimi-K2.6",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262144,maxTokens:262144},"zai-org/GLM-4.7":{id:"zai-org/GLM-4.7",name:"GLM-4.7",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:204800,maxTokens:131072},"zai-org/GLM-4.7-Flash":{id:"zai-org/GLM-4.7-Flash",name:"GLM-4.7-Flash",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:128e3},"zai-org/GLM-5":{id:"zai-org/GLM-5",name:"GLM-5",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:202752,maxTokens:131072},"zai-org/GLM-5.1":{id:"zai-org/GLM-5.1",name:"GLM-5.1",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:202752,maxTokens:131072}},"kimi-coding":{k2p7:{id:"k2p7",name:"Kimi K2.7 Code",api:"anthropic-messages",provider:"kimi-coding",baseUrl:"https://api.kimi.com/coding",headers:{"User-Agent":"KimiCLI/1.5"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"kimi-for-coding":{id:"kimi-for-coding",name:"Kimi For Coding",api:"anthropic-messages",provider:"kimi-coding",baseUrl:"https://api.kimi.com/coding",headers:{"User-Agent":"KimiCLI/1.5"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"kimi-k2-thinking":{id:"kimi-k2-thinking",name:"Kimi K2 Thinking",api:"anthropic-messages",provider:"kimi-coding",baseUrl:"https://api.kimi.com/coding",headers:{"User-Agent":"KimiCLI/1.5"},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768}},minimax:{"MiniMax-M2.7":{id:"MiniMax-M2.7",name:"MiniMax-M2.7",api:"anthropic-messages",provider:"minimax",baseUrl:"https://api.minimax.io/anthropic",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"MiniMax-M2.7-highspeed":{id:"MiniMax-M2.7-highspeed",name:"MiniMax-M2.7-highspeed",api:"anthropic-messages",provider:"minimax",baseUrl:"https://api.minimax.io/anthropic",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"MiniMax-M3":{id:"MiniMax-M3",name:"MiniMax-M3",api:"anthropic-messages",provider:"minimax",baseUrl:"https://api.minimax.io/anthropic",reasoning:!0,input:["text","image"],cost:{input:.6,output:2.4,cacheRead:.12,cacheWrite:0},contextWindow:512e3,maxTokens:128e3}},"minimax-cn":{"MiniMax-M2.7":{id:"MiniMax-M2.7",name:"MiniMax-M2.7",api:"anthropic-messages",provider:"minimax-cn",baseUrl:"https://api.minimaxi.com/anthropic",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"MiniMax-M2.7-highspeed":{id:"MiniMax-M2.7-highspeed",name:"MiniMax-M2.7-highspeed",api:"anthropic-messages",provider:"minimax-cn",baseUrl:"https://api.minimaxi.com/anthropic",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"MiniMax-M3":{id:"MiniMax-M3",name:"MiniMax-M3",api:"anthropic-messages",provider:"minimax-cn",baseUrl:"https://api.minimaxi.com/anthropic",reasoning:!0,input:["text","image"],cost:{input:.6,output:2.4,cacheRead:.12,cacheWrite:0},contextWindow:512e3,maxTokens:128e3}},mistral:{"codestral-latest":{id:"codestral-latest",name:"Codestral (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.3,output:.9,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"devstral-2512":{id:"devstral-2512",name:"Devstral 2",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"devstral-latest":{id:"devstral-latest",name:"Devstral 2",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"devstral-medium-2507":{id:"devstral-medium-2507",name:"Devstral Medium",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"devstral-medium-latest":{id:"devstral-medium-latest",name:"Devstral 2 (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"devstral-small-2505":{id:"devstral-small-2505",name:"Devstral Small 2505",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"devstral-small-2507":{id:"devstral-small-2507",name:"Devstral Small",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"labs-devstral-small-2512":{id:"labs-devstral-small-2512",name:"Devstral Small 2",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"magistral-medium-latest":{id:"magistral-medium-latest",name:"Magistral Medium (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text"],cost:{input:2,output:5,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"magistral-small":{id:"magistral-small",name:"Magistral Small",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"ministral-3b-latest":{id:"ministral-3b-latest",name:"Ministral 3B (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.04,output:.04,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"ministral-8b-latest":{id:"ministral-8b-latest",name:"Ministral 8B (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.1,output:.1,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"mistral-large-2411":{id:"mistral-large-2411",name:"Mistral Large 2.1",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"mistral-large-2512":{id:"mistral-large-2512",name:"Mistral Large 3",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-large-latest":{id:"mistral-large-latest",name:"Mistral Large (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-medium-2505":{id:"mistral-medium-2505",name:"Mistral Medium 3",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"mistral-medium-2508":{id:"mistral-medium-2508",name:"Mistral Medium 3.1",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-medium-2604":{id:"mistral-medium-2604",name:"Mistral Medium 3.5",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text","image"],cost:{input:1.5,output:7.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-medium-3.5":{id:"mistral-medium-3.5",name:"Mistral Medium 3.5",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text","image"],cost:{input:1.5,output:7.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-medium-latest":{id:"mistral-medium-latest",name:"Mistral Medium (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-nemo":{id:"mistral-nemo",name:"Mistral Nemo",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"mistral-small-2506":{id:"mistral-small-2506",name:"Mistral Small 3.2",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"mistral-small-2603":{id:"mistral-small-2603",name:"Mistral Small 4",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text","image"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"mistral-small-latest":{id:"mistral-small-latest",name:"Mistral Small (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text","image"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"open-mistral-7b":{id:"open-mistral-7b",name:"Mistral 7B",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.25,output:.25,cacheRead:0,cacheWrite:0},contextWindow:8e3,maxTokens:8e3},"open-mistral-nemo":{id:"open-mistral-nemo",name:"Open Mistral Nemo",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"open-mixtral-8x22b":{id:"open-mixtral-8x22b",name:"Mixtral 8x22B",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:64e3,maxTokens:64e3},"open-mixtral-8x7b":{id:"open-mixtral-8x7b",name:"Mixtral 8x7B",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.7,output:.7,cacheRead:0,cacheWrite:0},contextWindow:32e3,maxTokens:32e3},"pixtral-12b":{id:"pixtral-12b",name:"Pixtral 12B",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"pixtral-large-latest":{id:"pixtral-large-latest",name:"Pixtral Large (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3}},moonshotai:{"kimi-k2-0711-preview":{id:"kimi-k2-0711-preview",name:"Kimi K2 0711",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!1,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:131072,maxTokens:16384},"kimi-k2-0905-preview":{id:"kimi-k2-0905-preview",name:"Kimi K2 0905",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!1,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2-thinking":{id:"kimi-k2-thinking",name:"Kimi K2 Thinking",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2-thinking-turbo":{id:"kimi-k2-thinking-turbo",name:"Kimi K2 Thinking Turbo",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1.15,output:8,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2-turbo-preview":{id:"kimi-k2-turbo-preview",name:"Kimi K2 Turbo",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!1,input:["text"],cost:{input:2.4,output:10,cacheRead:.6,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2.5":{id:"kimi-k2.5",name:"Kimi K2.5",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.1,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2.6":{id:"kimi-k2.6",name:"Kimi K2.6",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2.7-code":{id:"kimi-k2.7-code",name:"Kimi K2.7 Code",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.19,cacheWrite:0},contextWindow:262144,maxTokens:262144}},"moonshotai-cn":{"kimi-k2-0711-preview":{id:"kimi-k2-0711-preview",name:"Kimi K2 0711",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!1,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:131072,maxTokens:16384},"kimi-k2-0905-preview":{id:"kimi-k2-0905-preview",name:"Kimi K2 0905",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!1,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2-thinking":{id:"kimi-k2-thinking",name:"Kimi K2 Thinking",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2-thinking-turbo":{id:"kimi-k2-thinking-turbo",name:"Kimi K2 Thinking Turbo",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1.15,output:8,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2-turbo-preview":{id:"kimi-k2-turbo-preview",name:"Kimi K2 Turbo",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!1,input:["text"],cost:{input:2.4,output:10,cacheRead:.6,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2.5":{id:"kimi-k2.5",name:"Kimi K2.5",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.1,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2.6":{id:"kimi-k2.6",name:"Kimi K2.6",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262144,maxTokens:262144}},nvidia:{"meta/llama-3.1-70b-instruct":{id:"meta/llama-3.1-70b-instruct",name:"Llama 3.1 70b Instruct",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta/llama-3.1-8b-instruct":{id:"meta/llama-3.1-8b-instruct",name:"Llama 3.1 8B Instruct",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:16e3,maxTokens:4096},"meta/llama-3.2-11b-vision-instruct":{id:"meta/llama-3.2-11b-vision-instruct",name:"Llama 3.2 11b Vision Instruct",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta/llama-3.2-90b-vision-instruct":{id:"meta/llama-3.2-90b-vision-instruct",name:"Llama-3.2-90B-Vision-Instruct",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-3.3-70b-instruct":{id:"meta/llama-3.3-70b-instruct",name:"Llama 3.3 70b Instruct",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistralai/mistral-large-3-675b-instruct-2512":{id:"mistralai/mistral-large-3-675b-instruct-2512",name:"Mistral Large 3 675B Instruct 2512",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistralai/mistral-small-4-119b-2603":{id:"mistralai/mistral-small-4-119b-2603",name:"mistral-small-4-119b-2603",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"moonshotai/kimi-k2.6":{id:"moonshotai/kimi-k2.6",name:"Kimi K2.6",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"nvidia/nemotron-3-nano-30b-a3b":{id:"nvidia/nemotron-3-nano-30b-a3b",name:"nemotron-3-nano-30b-a3b",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"nvidia/nemotron-3-nano-omni-30b-a3b-reasoning":{id:"nvidia/nemotron-3-nano-omni-30b-a3b-reasoning",name:"Nemotron 3 Nano Omni",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:65536},"nvidia/nemotron-3-super-120b-a12b":{id:"nvidia/nemotron-3-super-120b-a12b",name:"Nemotron 3 Super",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.2,output:.8,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"nvidia/nemotron-3-ultra-550b-a55b":{id:"nvidia/nemotron-3-ultra-550b-a55b",name:"Nemotron 3 Ultra 550B A55B",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.5,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"nvidia/nvidia-nemotron-nano-9b-v2":{id:"nvidia/nvidia-nemotron-nano-9b-v2",name:"nvidia-nemotron-nano-9b-v2",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"openai/gpt-oss-120b":{id:"openai/gpt-oss-120b",name:"GPT-OSS-120B",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"openai/gpt-oss-20b":{id:"openai/gpt-oss-20b",name:"GPT OSS 20B",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"qwen/qwen3.5-122b-a10b":{id:"qwen/qwen3.5-122b-a10b",name:"Qwen3.5 122B-A10B",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"stepfun-ai/step-3.5-flash":{id:"stepfun-ai/step-3.5-flash",name:"Step 3.5 Flash",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:16384},"stepfun-ai/step-3.7-flash":{id:"stepfun-ai/step-3.7-flash",name:"Step 3.7 Flash",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:16384},"z-ai/glm-5.1":{id:"z-ai/glm-5.1",name:"GLM-5.1",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072}},openai:{"gpt-4":{id:"gpt-4",name:"GPT-4",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text"],cost:{input:30,output:60,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"gpt-4-turbo":{id:"gpt-4-turbo",name:"GPT-4 Turbo",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-4.1":{id:"gpt-4.1",name:"GPT-4.1",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4.1-mini":{id:"gpt-4.1-mini",name:"GPT-4.1 mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:.4,output:1.6,cacheRead:.1,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4.1-nano":{id:"gpt-4.1-nano",name:"GPT-4.1 nano",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.025,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4o":{id:"gpt-4o",name:"GPT-4o",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-2024-05-13":{id:"gpt-4o-2024-05-13",name:"GPT-4o (2024-05-13)",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:5,output:15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-4o-2024-08-06":{id:"gpt-4o-2024-08-06",name:"GPT-4o (2024-08-06)",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-2024-11-20":{id:"gpt-4o-2024-11-20",name:"GPT-4o (2024-11-20)",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-mini":{id:"gpt-4o-mini",name:"GPT-4o mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.075,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5":{id:"gpt-5",name:"GPT-5",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-chat-latest":{id:"gpt-5-chat-latest",name:"GPT-5 Chat Latest",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5-codex":{id:"gpt-5-codex",name:"GPT-5-Codex",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-mini":{id:"gpt-5-mini",name:"GPT-5 Mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-nano":{id:"gpt-5-nano",name:"GPT-5 Nano",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.05,output:.4,cacheRead:.005,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-pro":{id:"gpt-5-pro",name:"GPT-5 Pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:15,output:120,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1":{id:"gpt-5.1",name:"GPT-5.1",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:"none"},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-chat-latest":{id:"gpt-5.1-chat-latest",name:"GPT-5.1 Chat",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.1-codex":{id:"gpt-5.1-codex",name:"GPT-5.1 Codex",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-max":{id:"gpt-5.1-codex-max",name:"GPT-5.1 Codex Max",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-mini":{id:"gpt-5.1-codex-mini",name:"GPT-5.1 Codex mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:"none",xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-chat-latest":{id:"gpt-5.2-chat-latest",name:"GPT-5.2 Chat",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-pro":{id:"gpt-5.2-pro",name:"GPT-5.2 Pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:21,output:168,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-chat-latest":{id:"gpt-5.3-chat-latest",name:"GPT-5.3 Chat (latest)",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:"none",xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex-spark":{id:"gpt-5.3-codex-spark",name:"GPT-5.3 Codex Spark",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:32e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:"none",xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:"none",xhigh:"xhigh"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-nano":{id:"gpt-5.4-nano",name:"GPT-5.4 nano",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:"none",xhigh:"xhigh"},input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-pro":{id:"gpt-5.4-pro",name:"GPT-5.4 Pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:"none",xhigh:"xhigh",minimal:null},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.5-pro":{id:"gpt-5.5-pro",name:"GPT-5.5 Pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh",minimal:null,low:null},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},o1:{id:"o1",name:"o1",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o1-pro":{id:"o1-pro",name:"o1-pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:150,output:600,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},o3:{id:"o3",name:"o3",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-deep-research":{id:"o3-deep-research",name:"o3-deep-research",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:10,output:40,cacheRead:2.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-mini":{id:"o3-mini",name:"o3-mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-pro":{id:"o3-pro",name:"o3-pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o4-mini":{id:"o4-mini",name:"o4-mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o4-mini-deep-research":{id:"o4-mini-deep-research",name:"o4-mini-deep-research",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5}},"openai-codex":{"gpt-5.3-codex-spark":{id:"gpt-5.3-codex-spark",name:"GPT-5.3 Codex Spark",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh",minimal:"low"},input:["text"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh",minimal:"low"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 mini",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh",minimal:"low"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh",minimal:"low"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:272e3,maxTokens:128e3}},opencode:{"big-pickle":{id:"big-pickle",name:"Big Pickle",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{maxTokensField:"max_tokens"},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:32e3},"claude-haiku-4-5":{id:"claude-haiku-4-5",name:"Claude Haiku 4.5",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-1":{id:"claude-opus-4-1",name:"Claude Opus 4.1",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-5":{id:"claude-opus-4-5",name:"Claude Opus 4.5",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-6":{id:"claude-opus-4-6",name:"Claude Opus 4.6",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",compat:{forceAdaptiveThinking:!0},reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-opus-4-7":{id:"claude-opus-4-7",name:"Claude Opus 4.7",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",compat:{forceAdaptiveThinking:!0,supportsTemperature:!1},reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-opus-4-8":{id:"claude-opus-4-8",name:"Claude Opus 4.8",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",compat:{forceAdaptiveThinking:!0,supportsTemperature:!1},reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-sonnet-4":{id:"claude-sonnet-4",name:"Claude Sonnet 4",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-5":{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-6":{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",compat:{forceAdaptiveThinking:!0},reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"deepseek-v4-flash":{id:"deepseek-v4-flash",name:"DeepSeek V4 Flash",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{maxTokensField:"max_tokens",supportsLongCacheRetention:!1,requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:.14,output:.28,cacheRead:.028,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"deepseek-v4-flash-free":{id:"deepseek-v4-flash-free",name:"DeepSeek V4 Flash Free",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{maxTokensField:"max_tokens",requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:128e3},"deepseek-v4-pro":{id:"deepseek-v4-pro",name:"DeepSeek V4 Pro",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{maxTokensField:"max_tokens",supportsLongCacheRetention:!1,requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:1.74,output:3.84,cacheRead:.145,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"gemini-3-flash":{id:"gemini-3-flash",name:"Gemini 3 Flash",api:"google-generative-ai",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.1-pro":{id:"gemini-3.1-pro",name:"Gemini 3.1 Pro Preview",api:"google-generative-ai",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:"LOW",medium:null,high:"HIGH"},input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.5-flash":{id:"gemini-3.5-flash",name:"Gemini 3.5 Flash",api:"google-generative-ai",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.5,output:9,cacheRead:.15,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"glm-5":{id:"glm-5",name:"GLM-5",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{maxTokensField:"max_tokens"},reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:204800,maxTokens:131072},"glm-5.1":{id:"glm-5.1",name:"GLM-5.1",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{maxTokensField:"max_tokens"},reasoning:!0,input:["text"],cost:{input:1.4,output:4.4,cacheRead:.26,cacheWrite:0},contextWindow:204800,maxTokens:131072},"gpt-5":{id:"gpt-5",name:"GPT-5",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.07,output:8.5,cacheRead:.107,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-codex":{id:"gpt-5-codex",name:"GPT-5 Codex",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.07,output:8.5,cacheRead:.107,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-nano":{id:"gpt-5-nano",name:"GPT-5 Nano",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.05,output:.4,cacheRead:.005,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1":{id:"gpt-5.1",name:"GPT-5.1",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.07,output:8.5,cacheRead:.107,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex":{id:"gpt-5.1-codex",name:"GPT-5.1 Codex",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.07,output:8.5,cacheRead:.107,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-max":{id:"gpt-5.1-codex-max",name:"GPT-5.1 Codex Max",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-mini":{id:"gpt-5.1-codex-mini",name:"GPT-5.1 Codex Mini",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 Mini",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-nano":{id:"gpt-5.4-nano",name:"GPT-5.4 Nano",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-pro":{id:"gpt-5.4-pro",name:"GPT-5.4 Pro",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:30,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"gpt-5.5-pro":{id:"gpt-5.5-pro",name:"GPT-5.5 Pro",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh",minimal:null,low:null},input:["text","image"],cost:{input:30,output:180,cacheRead:30,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"grok-build-0.1":{id:"grok-build-0.1",name:"Grok Build 0.1",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{supportsReasoningEffort:!1,maxTokensField:"max_tokens"},reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:null,medium:null},input:["text","image"],cost:{input:1,output:2,cacheRead:.2,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"kimi-k2.5":{id:"kimi-k2.5",name:"Kimi K2.5",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{maxTokensField:"max_tokens",supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.08,cacheWrite:0},contextWindow:262144,maxTokens:65536},"kimi-k2.6":{id:"kimi-k2.6",name:"Kimi K2.6",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{thinkingFormat:"deepseek",supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262144,maxTokens:65536},"mimo-v2.5-free":{id:"mimo-v2.5-free",name:"MiMo V2.5 Free",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{maxTokensField:"max_tokens"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:32e3},"minimax-m2.5":{id:"minimax-m2.5",name:"MiniMax M2.5",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{maxTokensField:"max_tokens"},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:204800,maxTokens:131072},"minimax-m2.7":{id:"minimax-m2.7",name:"MiniMax M2.7",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{maxTokensField:"max_tokens",supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:204800,maxTokens:131072},"nemotron-3-ultra-free":{id:"nemotron-3-ultra-free",name:"Nemotron 3 Ultra Free",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{maxTokensField:"max_tokens"},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:128e3},"north-mini-code-free":{id:"north-mini-code-free",name:"North Mini Code Free",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{maxTokensField:"max_tokens"},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:64e3},"qwen3.5-plus":{id:"qwen3.5-plus",name:"Qwen3.5 Plus",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:.2,output:1.2,cacheRead:.02,cacheWrite:.25},contextWindow:262144,maxTokens:65536},"qwen3.6-plus":{id:"qwen3.6-plus",name:"Qwen3.6 Plus",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:.625},contextWindow:262144,maxTokens:65536}},"opencode-go":{"deepseek-v4-flash":{id:"deepseek-v4-flash",name:"DeepSeek V4 Flash",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",compat:{maxTokensField:"max_tokens",requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:.14,output:.28,cacheRead:.0028,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"deepseek-v4-pro":{id:"deepseek-v4-pro",name:"DeepSeek V4 Pro",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",compat:{maxTokensField:"max_tokens",requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:1.74,output:3.48,cacheRead:.0145,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"glm-5":{id:"glm-5",name:"GLM-5",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",compat:{maxTokensField:"max_tokens"},reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:202752,maxTokens:32768},"glm-5.1":{id:"glm-5.1",name:"GLM-5.1",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",compat:{maxTokensField:"max_tokens"},reasoning:!0,input:["text"],cost:{input:1.4,output:4.4,cacheRead:.26,cacheWrite:0},contextWindow:202752,maxTokens:32768},"kimi-k2.6":{id:"kimi-k2.6",name:"Kimi K2.6",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",compat:{thinkingFormat:"deepseek",supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsLongCacheRetention:!1},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262144,maxTokens:65536},"kimi-k2.7-code":{id:"kimi-k2.7-code",name:"Kimi K2.7 Code",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",compat:{maxTokensField:"max_tokens"},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.19,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mimo-v2.5":{id:"mimo-v2.5",name:"MiMo V2.5",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",compat:{maxTokensField:"max_tokens"},reasoning:!0,input:["text","image"],cost:{input:.14,output:.28,cacheRead:.0028,cacheWrite:0},contextWindow:1e6,maxTokens:128e3},"mimo-v2.5-pro":{id:"mimo-v2.5-pro",name:"MiMo V2.5 Pro",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",compat:{maxTokensField:"max_tokens"},reasoning:!0,input:["text"],cost:{input:1.74,output:3.48,cacheRead:.0145,cacheWrite:0},contextWindow:1048576,maxTokens:128e3},"minimax-m2.7":{id:"minimax-m2.7",name:"MiniMax M2.7",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",compat:{maxTokensField:"max_tokens"},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:204800,maxTokens:131072},"minimax-m3":{id:"minimax-m3",name:"MiniMax M3 (3x usage)",api:"anthropic-messages",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.02,cacheWrite:0},contextWindow:512e3,maxTokens:131072},"qwen3.6-plus":{id:"qwen3.6-plus",name:"Qwen3.6 Plus",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",compat:{thinkingFormat:"qwen",maxTokensField:"max_tokens"},reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:.625},contextWindow:1e6,maxTokens:65536},"qwen3.7-max":{id:"qwen3.7-max",name:"Qwen3.7 Max",api:"anthropic-messages",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go",reasoning:!0,input:["text"],cost:{input:2.5,output:7.5,cacheRead:.5,cacheWrite:3.125},contextWindow:1e6,maxTokens:65536},"qwen3.7-plus":{id:"qwen3.7-plus",name:"Qwen3.7 Plus",api:"anthropic-messages",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go",reasoning:!0,input:["text","image"],cost:{input:.4,output:1.6,cacheRead:.04,cacheWrite:.5},contextWindow:1e6,maxTokens:65536}},openrouter:{"ai21/jamba-large-1.7":{id:"ai21/jamba-large-1.7",name:"AI21: Jamba Large 1.7",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2,output:8,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"amazon/nova-2-lite-v1":{id:"amazon/nova-2-lite-v1",name:"Amazon: Nova 2 Lite",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:65535},"amazon/nova-lite-v1":{id:"amazon/nova-lite-v1",name:"Amazon: Nova Lite 1.0",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.06,output:.24,cacheRead:0,cacheWrite:0},contextWindow:3e5,maxTokens:5120},"amazon/nova-micro-v1":{id:"amazon/nova-micro-v1",name:"Amazon: Nova Micro 1.0",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.035,output:.14,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:5120},"amazon/nova-premier-v1":{id:"amazon/nova-premier-v1",name:"Amazon: Nova Premier 1.0",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:12.5,cacheRead:.625,cacheWrite:0},contextWindow:1e6,maxTokens:32e3},"amazon/nova-pro-v1":{id:"amazon/nova-pro-v1",name:"Amazon: Nova Pro 1.0",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.8,output:3.2,cacheRead:0,cacheWrite:0},contextWindow:3e5,maxTokens:5120},"anthropic/claude-3-haiku":{id:"anthropic/claude-3-haiku",name:"Anthropic: Claude 3 Haiku",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.25,output:1.25,cacheRead:.03,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"anthropic/claude-3.5-haiku":{id:"anthropic/claude-3.5-haiku",name:"Anthropic: Claude 3.5 Haiku",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"anthropic/claude-fable-5":{id:"anthropic/claude-fable-5",name:"Anthropic: Claude Fable 5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:10,output:50,cacheRead:1,cacheWrite:12.5},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-haiku-4.5":{id:"anthropic/claude-haiku-4.5",name:"Anthropic: Claude Haiku 4.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-opus-4":{id:"anthropic/claude-opus-4",name:"Anthropic: Claude Opus 4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic/claude-opus-4.1":{id:"anthropic/claude-opus-4.1",name:"Anthropic: Claude Opus 4.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic/claude-opus-4.5":{id:"anthropic/claude-opus-4.5",name:"Anthropic: Claude Opus 4.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-opus-4.6":{id:"anthropic/claude-opus-4.6",name:"Anthropic: Claude Opus 4.6",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-opus-4.6-fast":{id:"anthropic/claude-opus-4.6-fast",name:"Anthropic: Claude Opus 4.6 (Fast)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:30,output:150,cacheRead:3,cacheWrite:37.5},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-opus-4.7":{id:"anthropic/claude-opus-4.7",name:"Anthropic: Claude Opus 4.7",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-opus-4.7-fast":{id:"anthropic/claude-opus-4.7-fast",name:"Anthropic: Claude Opus 4.7 (Fast)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:150,cacheRead:3,cacheWrite:37.5},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-opus-4.8":{id:"anthropic/claude-opus-4.8",name:"Anthropic: Claude Opus 4.8",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-opus-4.8-fast":{id:"anthropic/claude-opus-4.8-fast",name:"Anthropic: Claude Opus 4.8 (Fast)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:10,output:50,cacheRead:1,cacheWrite:12.5},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-sonnet-4":{id:"anthropic/claude-sonnet-4",name:"Anthropic: Claude Sonnet 4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"anthropic/claude-sonnet-4.5":{id:"anthropic/claude-sonnet-4.5",name:"Anthropic: Claude Sonnet 4.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"anthropic/claude-sonnet-4.6":{id:"anthropic/claude-sonnet-4.6",name:"Anthropic: Claude Sonnet 4.6",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:128e3},"arcee-ai/trinity-large-thinking":{id:"arcee-ai/trinity-large-thinking",name:"Arcee AI: Trinity Large Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.22,output:.85,cacheRead:.06,cacheWrite:0},contextWindow:262144,maxTokens:262144},"arcee-ai/trinity-mini":{id:"arcee-ai/trinity-mini",name:"Arcee AI: Trinity Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.045,output:.15,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"arcee-ai/virtuoso-large":{id:"arcee-ai/virtuoso-large",name:"Arcee AI: Virtuoso Large",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.75,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:64e3},auto:{id:"auto",name:"Auto",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"bytedance-seed/seed-1.6":{id:"bytedance-seed/seed-1.6",name:"ByteDance Seed: Seed 1.6",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"bytedance-seed/seed-1.6-flash":{id:"bytedance-seed/seed-1.6-flash",name:"ByteDance Seed: Seed 1.6 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.075,output:.3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"bytedance-seed/seed-2.0-lite":{id:"bytedance-seed/seed-2.0-lite",name:"ByteDance Seed: Seed-2.0-Lite",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"bytedance-seed/seed-2.0-mini":{id:"bytedance-seed/seed-2.0-mini",name:"ByteDance Seed: Seed-2.0-Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"cohere/command-r-08-2024":{id:"cohere/command-r-08-2024",name:"Cohere: Command R (08-2024)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"cohere/command-r-plus-08-2024":{id:"cohere/command-r-plus-08-2024",name:"Cohere: Command R+ (08-2024)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"deepseek/deepseek-chat":{id:"deepseek/deepseek-chat",name:"DeepSeek: DeepSeek V3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.2002,output:.8001,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16e3},"deepseek/deepseek-chat-v3-0324":{id:"deepseek/deepseek-chat-v3-0324",name:"DeepSeek: DeepSeek V3 0324",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.2,output:.77,cacheRead:.135,cacheWrite:0},contextWindow:163840,maxTokens:16384},"deepseek/deepseek-chat-v3.1":{id:"deepseek/deepseek-chat-v3.1",name:"DeepSeek: DeepSeek V3.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.21,output:.79,cacheRead:.13,cacheWrite:0},contextWindow:163840,maxTokens:32768},"deepseek/deepseek-r1":{id:"deepseek/deepseek-r1",name:"DeepSeek: R1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.7,output:2.5,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:16e3},"deepseek/deepseek-r1-0528":{id:"deepseek/deepseek-r1-0528",name:"DeepSeek: R1 0528",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.5,output:2.15,cacheRead:.35,cacheWrite:0},contextWindow:163840,maxTokens:32768},"deepseek/deepseek-v3.1-terminus":{id:"deepseek/deepseek-v3.1-terminus",name:"DeepSeek: DeepSeek V3.1 Terminus",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.27,output:.95,cacheRead:.13,cacheWrite:0},contextWindow:163840,maxTokens:32768},"deepseek/deepseek-v3.2":{id:"deepseek/deepseek-v3.2",name:"DeepSeek: DeepSeek V3.2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.2288,output:.3432,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:64e3},"deepseek/deepseek-v3.2-exp":{id:"deepseek/deepseek-v3.2-exp",name:"DeepSeek: DeepSeek V3.2 Exp",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.27,output:.41,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:65536},"deepseek/deepseek-v4-flash":{id:"deepseek/deepseek-v4-flash",name:"DeepSeek: DeepSeek V4 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",compat:{requiresReasoningContentOnAssistantMessages:!0},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"xhigh"},input:["text"],cost:{input:.09,output:.18,cacheRead:.02,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"deepseek/deepseek-v4-pro":{id:"deepseek/deepseek-v4-pro",name:"DeepSeek: DeepSeek V4 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",compat:{requiresReasoningContentOnAssistantMessages:!0},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"xhigh"},input:["text"],cost:{input:.435,output:.87,cacheRead:.003625,cacheWrite:0},contextWindow:1048576,maxTokens:384e3},"essentialai/rnj-1-instruct":{id:"essentialai/rnj-1-instruct",name:"EssentialAI: Rnj 1 Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:4096},"google/gemini-2.5-flash":{id:"google/gemini-2.5-flash",name:"Google: Gemini 2.5 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.03,cacheWrite:.083333},contextWindow:1048576,maxTokens:65535},"google/gemini-2.5-flash-lite":{id:"google/gemini-2.5-flash-lite",name:"Google: Gemini 2.5 Flash Lite",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.01,cacheWrite:.083333},contextWindow:1048576,maxTokens:65535},"google/gemini-2.5-flash-lite-preview-09-2025":{id:"google/gemini-2.5-flash-lite-preview-09-2025",name:"Google: Gemini 2.5 Flash Lite Preview 09-2025",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.01,cacheWrite:.083333},contextWindow:1048576,maxTokens:65535},"google/gemini-2.5-pro":{id:"google/gemini-2.5-pro",name:"Google: Gemini 2.5 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:.375},contextWindow:1048576,maxTokens:65536},"google/gemini-2.5-pro-preview":{id:"google/gemini-2.5-pro-preview",name:"Google: Gemini 2.5 Pro Preview 06-05",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:.375},contextWindow:1048576,maxTokens:65536},"google/gemini-2.5-pro-preview-05-06":{id:"google/gemini-2.5-pro-preview-05-06",name:"Google: Gemini 2.5 Pro Preview 05-06",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:.375},contextWindow:1048576,maxTokens:65535},"google/gemini-3-flash-preview":{id:"google/gemini-3-flash-preview",name:"Google: Gemini 3 Flash Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:.083333},contextWindow:1048576,maxTokens:65536},"google/gemini-3.1-flash-lite":{id:"google/gemini-3.1-flash-lite",name:"Google: Gemini 3.1 Flash Lite",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:1.5,cacheRead:.025,cacheWrite:.083333},contextWindow:1048576,maxTokens:65536},"google/gemini-3.1-flash-lite-preview":{id:"google/gemini-3.1-flash-lite-preview",name:"Google: Gemini 3.1 Flash Lite Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:1.5,cacheRead:.025,cacheWrite:.083333},contextWindow:1048576,maxTokens:65536},"google/gemini-3.1-pro-preview":{id:"google/gemini-3.1-pro-preview",name:"Google: Gemini 3.1 Pro Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:.375},contextWindow:1048576,maxTokens:65536},"google/gemini-3.1-pro-preview-customtools":{id:"google/gemini-3.1-pro-preview-customtools",name:"Google: Gemini 3.1 Pro Preview Custom Tools",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:.375},contextWindow:1048756,maxTokens:65536},"google/gemini-3.5-flash":{id:"google/gemini-3.5-flash",name:"Google: Gemini 3.5 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.5,output:9,cacheRead:.15,cacheWrite:.083333},contextWindow:1048576,maxTokens:65536},"google/gemma-3-12b-it":{id:"google/gemma-3-12b-it",name:"Google: Gemma 3 12B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.05,output:.15,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"google/gemma-3-27b-it":{id:"google/gemma-3-27b-it",name:"Google: Gemma 3 27B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.08,output:.16,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"google/gemma-4-26b-a4b-it":{id:"google/gemma-4-26b-a4b-it",name:"Google: Gemma 4 26B A4B ",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.06,output:.33,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"google/gemma-4-26b-a4b-it:free":{id:"google/gemma-4-26b-a4b-it:free",name:"Google: Gemma 4 26B A4B (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"google/gemma-4-31b-it":{id:"google/gemma-4-31b-it",name:"Google: Gemma 4 31B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.12,output:.35,cacheRead:.09,cacheWrite:0},contextWindow:262144,maxTokens:262144},"google/gemma-4-31b-it:free":{id:"google/gemma-4-31b-it:free",name:"Google: Gemma 4 31B (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"ibm-granite/granite-4.1-8b":{id:"ibm-granite/granite-4.1-8b",name:"IBM: Granite 4.1 8B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.05,output:.1,cacheRead:.05,cacheWrite:0},contextWindow:131072,maxTokens:131072},"inception/mercury-2":{id:"inception/mercury-2",name:"Inception: Mercury 2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text"],cost:{input:.25,output:.75,cacheRead:.025,cacheWrite:0},contextWindow:128e3,maxTokens:5e4},"inclusionai/ling-2.6-1t":{id:"inclusionai/ling-2.6-1t",name:"inclusionAI: Ling-2.6-1T",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.075,output:.625,cacheRead:.015,cacheWrite:0},contextWindow:262144,maxTokens:32768},"inclusionai/ling-2.6-flash":{id:"inclusionai/ling-2.6-flash",name:"inclusionAI: Ling-2.6-flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.01,output:.03,cacheRead:.002,cacheWrite:0},contextWindow:262144,maxTokens:32768},"inclusionai/ring-2.6-1t":{id:"inclusionai/ring-2.6-1t",name:"inclusionAI: Ring-2.6-1T",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.075,output:.625,cacheRead:.015,cacheWrite:0},contextWindow:262144,maxTokens:65536},"kwaipilot/kat-coder-pro-v2":{id:"kwaipilot/kat-coder-pro-v2",name:"Kwaipilot: KAT-Coder-Pro V2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:256e3,maxTokens:8e4},"meta-llama/llama-3.1-70b-instruct":{id:"meta-llama/llama-3.1-70b-instruct",name:"Meta: Llama 3.1 70B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.4,output:.4,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"meta-llama/llama-3.1-8b-instruct":{id:"meta-llama/llama-3.1-8b-instruct",name:"Meta: Llama 3.1 8B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.02,output:.03,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"meta-llama/llama-3.3-70b-instruct":{id:"meta-llama/llama-3.3-70b-instruct",name:"Meta: Llama 3.3 70B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.1,output:.32,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"meta-llama/llama-3.3-70b-instruct:free":{id:"meta-llama/llama-3.3-70b-instruct:free",name:"Meta: Llama 3.3 70B Instruct (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4096},"meta-llama/llama-4-maverick":{id:"meta-llama/llama-4-maverick",name:"Meta: Llama 4 Maverick",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:16384},"meta-llama/llama-4-scout":{id:"meta-llama/llama-4-scout",name:"Meta: Llama 4 Scout",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:1e7,maxTokens:16384},"minimax/minimax-m1":{id:"minimax/minimax-m1",name:"MiniMax: MiniMax M1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.4,output:2.2,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:4e4},"minimax/minimax-m2":{id:"minimax/minimax-m2",name:"MiniMax: MiniMax M2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.255,output:1,cacheRead:.03,cacheWrite:0},contextWindow:204800,maxTokens:196608},"minimax/minimax-m2.1":{id:"minimax/minimax-m2.1",name:"MiniMax: MiniMax M2.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.29,output:.95,cacheRead:.03,cacheWrite:0},contextWindow:204800,maxTokens:196608},"minimax/minimax-m2.5":{id:"minimax/minimax-m2.5",name:"MiniMax: MiniMax M2.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.15,output:.9,cacheRead:.05,cacheWrite:0},contextWindow:204800,maxTokens:196608},"minimax/minimax-m2.7":{id:"minimax/minimax-m2.7",name:"MiniMax: MiniMax M2.7",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.25,output:1,cacheRead:.05,cacheWrite:0},contextWindow:204800,maxTokens:131072},"minimax/minimax-m3":{id:"minimax/minimax-m3",name:"MiniMax: MiniMax M3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:1048576,maxTokens:512e3},"mistralai/codestral-2508":{id:"mistralai/codestral-2508",name:"Mistral: Codestral 2508",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.3,output:.9,cacheRead:.03,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"mistralai/devstral-2512":{id:"mistralai/devstral-2512",name:"Mistral: Devstral 2 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:.04,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/ministral-14b-2512":{id:"mistralai/ministral-14b-2512",name:"Mistral: Ministral 3 14B 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.2,output:.2,cacheRead:.02,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/ministral-3b-2512":{id:"mistralai/ministral-3b-2512",name:"Mistral: Ministral 3 3B 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.1,output:.1,cacheRead:.01,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/ministral-8b-2512":{id:"mistralai/ministral-8b-2512",name:"Mistral: Ministral 3 8B 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.15,output:.15,cacheRead:.015,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/mistral-large":{id:"mistralai/mistral-large",name:"Mistral Large",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:.2,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistralai/mistral-large-2407":{id:"mistralai/mistral-large-2407",name:"Mistral Large 2407",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:.2,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/mistral-large-2512":{id:"mistralai/mistral-large-2512",name:"Mistral: Mistral Large 3 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:.05,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/mistral-medium-3":{id:"mistralai/mistral-medium-3",name:"Mistral: Mistral Medium 3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.4,output:2,cacheRead:.04,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/mistral-medium-3-5":{id:"mistralai/mistral-medium-3-5",name:"Mistral: Mistral Medium 3.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.5,output:7.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/mistral-medium-3.1":{id:"mistralai/mistral-medium-3.1",name:"Mistral: Mistral Medium 3.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.4,output:2,cacheRead:.04,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/mistral-nemo":{id:"mistralai/mistral-nemo",name:"Mistral: Mistral Nemo",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.02,output:.03,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/mistral-saba":{id:"mistralai/mistral-saba",name:"Mistral: Saba",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.2,output:.6,cacheRead:.02,cacheWrite:0},contextWindow:32768,maxTokens:4096},"mistralai/mistral-small-2603":{id:"mistralai/mistral-small-2603",name:"Mistral: Mistral Small 4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.015,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/mistral-small-3.2-24b-instruct":{id:"mistralai/mistral-small-3.2-24b-instruct",name:"Mistral: Mistral Small 3.2 24B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.075,output:.2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"mistralai/mixtral-8x22b-instruct":{id:"mistralai/mixtral-8x22b-instruct",name:"Mistral: Mixtral 8x22B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:.2,cacheWrite:0},contextWindow:65536,maxTokens:4096},"mistralai/voxtral-small-24b-2507":{id:"mistralai/voxtral-small-24b-2507",name:"Mistral: Voxtral Small 24B 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.1,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:32e3,maxTokens:4096},"moonshotai/kimi-k2":{id:"moonshotai/kimi-k2",name:"MoonshotAI: Kimi K2 0711",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.57,output:2.3,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"moonshotai/kimi-k2-0905":{id:"moonshotai/kimi-k2-0905",name:"MoonshotAI: Kimi K2 0905",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.6,output:2.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"moonshotai/kimi-k2-thinking":{id:"moonshotai/kimi-k2-thinking",name:"MoonshotAI: Kimi K2 Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"moonshotai/kimi-k2.5":{id:"moonshotai/kimi-k2.5",name:"MoonshotAI: Kimi K2.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.41,output:2.06,cacheRead:.07,cacheWrite:0},contextWindow:262144,maxTokens:4096},"moonshotai/kimi-k2.6":{id:"moonshotai/kimi-k2.6",name:"MoonshotAI: Kimi K2.6",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",compat:{supportsDeveloperRole:!1,requiresReasoningContentOnAssistantMessages:!0},reasoning:!0,input:["text","image"],cost:{input:.68,output:3.41,cacheRead:.34,cacheWrite:0},contextWindow:262144,maxTokens:262142},"moonshotai/kimi-k2.7-code":{id:"moonshotai/kimi-k2.7-code",name:"MoonshotAI: Kimi K2.7 Code",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.75,output:3.5,cacheRead:.16,cacheWrite:0},contextWindow:262144,maxTokens:262144},"nex-agi/nex-n2-pro:free":{id:"nex-agi/nex-n2-pro:free",name:"Nex AGI: Nex-N2-Pro (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"nvidia/llama-3.3-nemotron-super-49b-v1.5":{id:"nvidia/llama-3.3-nemotron-super-49b-v1.5",name:"NVIDIA: Llama 3.3 Nemotron Super 49B V1.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.4,output:.4,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"nvidia/nemotron-3-nano-30b-a3b":{id:"nvidia/nemotron-3-nano-30b-a3b",name:"NVIDIA: Nemotron 3 Nano 30B A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.05,output:.2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:228e3},"nvidia/nemotron-3-nano-30b-a3b:free":{id:"nvidia/nemotron-3-nano-30b-a3b:free",name:"NVIDIA: Nemotron 3 Nano 30B A3B (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"nvidia/nemotron-3-nano-omni-30b-a3b-reasoning:free":{id:"nvidia/nemotron-3-nano-omni-30b-a3b-reasoning:free",name:"NVIDIA: Nemotron 3 Nano Omni (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:65536},"nvidia/nemotron-3-super-120b-a12b":{id:"nvidia/nemotron-3-super-120b-a12b",name:"NVIDIA: Nemotron 3 Super",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.09,output:.45,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:4096},"nvidia/nemotron-3-super-120b-a12b:free":{id:"nvidia/nemotron-3-super-120b-a12b:free",name:"NVIDIA: Nemotron 3 Super (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:262144},"nvidia/nemotron-3-ultra-550b-a55b":{id:"nvidia/nemotron-3-ultra-550b-a55b",name:"NVIDIA: Nemotron 3 Ultra",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.5,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:1e6,maxTokens:16384},"nvidia/nemotron-3-ultra-550b-a55b:free":{id:"nvidia/nemotron-3-ultra-550b-a55b:free",name:"NVIDIA: Nemotron 3 Ultra (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"nvidia/nemotron-nano-12b-v2-vl:free":{id:"nvidia/nemotron-nano-12b-v2-vl:free",name:"NVIDIA: Nemotron Nano 12B 2 VL (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"nvidia/nemotron-nano-9b-v2:free":{id:"nvidia/nemotron-nano-9b-v2:free",name:"NVIDIA: Nemotron Nano 9B V2 (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-3.5-turbo":{id:"openai/gpt-3.5-turbo",name:"OpenAI: GPT-3.5 Turbo",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:16385,maxTokens:4096},"openai/gpt-3.5-turbo-0613":{id:"openai/gpt-3.5-turbo-0613",name:"OpenAI: GPT-3.5 Turbo (older v0613)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:1,output:2,cacheRead:0,cacheWrite:0},contextWindow:4095,maxTokens:4096},"openai/gpt-3.5-turbo-16k":{id:"openai/gpt-3.5-turbo-16k",name:"OpenAI: GPT-3.5 Turbo 16k",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:3,output:4,cacheRead:0,cacheWrite:0},contextWindow:16385,maxTokens:4096},"openai/gpt-4":{id:"openai/gpt-4",name:"OpenAI: GPT-4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:30,output:60,cacheRead:0,cacheWrite:0},contextWindow:8191,maxTokens:4096},"openai/gpt-4-turbo":{id:"openai/gpt-4-turbo",name:"OpenAI: GPT-4 Turbo",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-4-turbo-preview":{id:"openai/gpt-4-turbo-preview",name:"OpenAI: GPT-4 Turbo Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-4.1":{id:"openai/gpt-4.1",name:"OpenAI: GPT-4.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:1047576,maxTokens:4096},"openai/gpt-4.1-mini":{id:"openai/gpt-4.1-mini",name:"OpenAI: GPT-4.1 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.4,output:1.6,cacheRead:.1,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4.1-nano":{id:"openai/gpt-4.1-nano",name:"OpenAI: GPT-4.1 Nano",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.025,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4o":{id:"openai/gpt-4o",name:"OpenAI: GPT-4o",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-2024-05-13":{id:"openai/gpt-4o-2024-05-13",name:"OpenAI: GPT-4o (2024-05-13)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:5,output:15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-4o-2024-08-06":{id:"openai/gpt-4o-2024-08-06",name:"OpenAI: GPT-4o (2024-08-06)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-2024-11-20":{id:"openai/gpt-4o-2024-11-20",name:"OpenAI: GPT-4o (2024-11-20)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-mini":{id:"openai/gpt-4o-mini",name:"OpenAI: GPT-4o-mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.075,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-mini-2024-07-18":{id:"openai/gpt-4o-mini-2024-07-18",name:"OpenAI: GPT-4o-mini (2024-07-18)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.075,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5":{id:"openai/gpt-5",name:"OpenAI: GPT-5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-codex":{id:"openai/gpt-5-codex",name:"OpenAI: GPT-5 Codex",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-mini":{id:"openai/gpt-5-mini",name:"OpenAI: GPT-5 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-nano":{id:"openai/gpt-5-nano",name:"OpenAI: GPT-5 Nano",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.05,output:.4,cacheRead:.01,cacheWrite:0},contextWindow:4e5,maxTokens:4096},"openai/gpt-5-pro":{id:"openai/gpt-5-pro",name:"OpenAI: GPT-5 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:120,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1":{id:"openai/gpt-5.1",name:"OpenAI: GPT-5.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.13,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-chat":{id:"openai/gpt-5.1-chat",name:"OpenAI: GPT-5.1 Chat",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.13,cacheWrite:0},contextWindow:128e3,maxTokens:32e3},"openai/gpt-5.1-codex":{id:"openai/gpt-5.1-codex",name:"OpenAI: GPT-5.1-Codex",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.13,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-codex-max":{id:"openai/gpt-5.1-codex-max",name:"OpenAI: GPT-5.1-Codex-Max",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-codex-mini":{id:"openai/gpt-5.1-codex-mini",name:"OpenAI: GPT-5.1-Codex-Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:1e5},"openai/gpt-5.2":{id:"openai/gpt-5.2",name:"OpenAI: GPT-5.2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2-chat":{id:"openai/gpt-5.2-chat",name:"OpenAI: GPT-5.2 Chat",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.2-codex":{id:"openai/gpt-5.2-codex",name:"OpenAI: GPT-5.2-Codex",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2-pro":{id:"openai/gpt-5.2-pro",name:"OpenAI: GPT-5.2 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:21,output:168,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.3-chat":{id:"openai/gpt-5.3-chat",name:"OpenAI: GPT-5.3 Chat",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.3-codex":{id:"openai/gpt-5.3-codex",name:"OpenAI: GPT-5.3-Codex",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4":{id:"openai/gpt-5.4",name:"OpenAI: GPT-5.4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-5.4-mini":{id:"openai/gpt-5.4-mini",name:"OpenAI: GPT-5.4 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4-nano":{id:"openai/gpt-5.4-nano",name:"OpenAI: GPT-5.4 Nano",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4-pro":{id:"openai/gpt-5.4-pro",name:"OpenAI: GPT-5.4 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-5.5":{id:"openai/gpt-5.5",name:"OpenAI: GPT-5.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-5.5-pro":{id:"openai/gpt-5.5-pro",name:"OpenAI: GPT-5.5 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh",off:null,minimal:null,low:null},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-audio":{id:"openai/gpt-audio",name:"OpenAI: GPT Audio",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-audio-mini":{id:"openai/gpt-audio-mini",name:"OpenAI: GPT Audio Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.6,output:2.4,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-chat-latest":{id:"openai/gpt-chat-latest",name:"OpenAI: GPT Chat Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-oss-120b":{id:"openai/gpt-oss-120b",name:"OpenAI: gpt-oss-120b",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.039,output:.18,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4096},"openai/gpt-oss-120b:free":{id:"openai/gpt-oss-120b:free",name:"OpenAI: gpt-oss-120b (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"openai/gpt-oss-20b":{id:"openai/gpt-oss-20b",name:"OpenAI: gpt-oss-20b",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.029,output:.14,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4096},"openai/gpt-oss-20b:free":{id:"openai/gpt-oss-20b:free",name:"OpenAI: gpt-oss-20b (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"openai/gpt-oss-safeguard-20b":{id:"openai/gpt-oss-safeguard-20b",name:"OpenAI: gpt-oss-safeguard-20b",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.075,output:.3,cacheRead:.037,cacheWrite:0},contextWindow:131072,maxTokens:65536},"openai/o1":{id:"openai/o1",name:"OpenAI: o1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3":{id:"openai/o3",name:"OpenAI: o3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-deep-research":{id:"openai/o3-deep-research",name:"OpenAI: o3 Deep Research",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:10,output:40,cacheRead:2.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-mini":{id:"openai/o3-mini",name:"OpenAI: o3 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-mini-high":{id:"openai/o3-mini-high",name:"OpenAI: o3 Mini High",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-pro":{id:"openai/o3-pro",name:"OpenAI: o3 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o4-mini":{id:"openai/o4-mini",name:"OpenAI: o4 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o4-mini-deep-research":{id:"openai/o4-mini-deep-research",name:"OpenAI: o4 Mini Deep Research",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o4-mini-high":{id:"openai/o4-mini-high",name:"OpenAI: o4 Mini High",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openrouter/auto":{id:"openrouter/auto",name:"Auto Router",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:-1e6,output:-1e6,cacheRead:0,cacheWrite:0},contextWindow:2e6,maxTokens:4096},"openrouter/free":{id:"openrouter/free",name:"Free Models Router",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:4096},"openrouter/owl-alpha":{id:"openrouter/owl-alpha",name:"Owl Alpha",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1048756,maxTokens:262144},"poolside/laguna-m.1:free":{id:"poolside/laguna-m.1:free",name:"Poolside: Laguna M.1 (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"poolside/laguna-xs.2:free":{id:"poolside/laguna-xs.2:free",name:"Poolside: Laguna XS.2 (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"prime-intellect/intellect-3":{id:"prime-intellect/intellect-3",name:"Prime Intellect: INTELLECT-3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.2,output:1.1,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"qwen/qwen-2.5-72b-instruct":{id:"qwen/qwen-2.5-72b-instruct",name:"Qwen2.5 72B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.36,output:.4,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"qwen/qwen-plus":{id:"qwen/qwen-plus",name:"Qwen: Qwen-Plus",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.26,output:.78,cacheRead:.052,cacheWrite:.325},contextWindow:1e6,maxTokens:32768},"qwen/qwen-plus-2025-07-28":{id:"qwen/qwen-plus-2025-07-28",name:"Qwen: Qwen Plus 0728",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.26,output:.78,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:32768},"qwen/qwen-plus-2025-07-28:thinking":{id:"qwen/qwen-plus-2025-07-28:thinking",name:"Qwen: Qwen Plus 0728 (thinking)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.26,output:.78,cacheRead:0,cacheWrite:.325},contextWindow:1e6,maxTokens:32768},"qwen/qwen3-14b":{id:"qwen/qwen3-14b",name:"Qwen: Qwen3 14B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.1,output:.24,cacheRead:0,cacheWrite:0},contextWindow:131702,maxTokens:40960},"qwen/qwen3-235b-a22b":{id:"qwen/qwen3-235b-a22b",name:"Qwen: Qwen3 235B A22B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.455,output:1.82,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"qwen/qwen3-235b-a22b-2507":{id:"qwen/qwen3-235b-a22b-2507",name:"Qwen: Qwen3 235B A22B Instruct 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09,output:.1,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:16384},"qwen/qwen3-235b-a22b-thinking-2507":{id:"qwen/qwen3-235b-a22b-thinking-2507",name:"Qwen: Qwen3 235B A22B Thinking 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.1,output:.1,cacheRead:.1,cacheWrite:0},contextWindow:262144,maxTokens:262144},"qwen/qwen3-30b-a3b":{id:"qwen/qwen3-30b-a3b",name:"Qwen: Qwen3 30B A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.12,output:.5,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"qwen/qwen3-30b-a3b-instruct-2507":{id:"qwen/qwen3-30b-a3b-instruct-2507",name:"Qwen: Qwen3 30B A3B Instruct 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.04815,output:.19305,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32e3},"qwen/qwen3-30b-a3b-thinking-2507":{id:"qwen/qwen3-30b-a3b-thinking-2507",name:"Qwen: Qwen3 30B A3B Thinking 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.08,output:.4,cacheRead:.08,cacheWrite:0},contextWindow:131072,maxTokens:131072},"qwen/qwen3-32b":{id:"qwen/qwen3-32b",name:"Qwen: Qwen3 32B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.08,output:.28,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"qwen/qwen3-8b":{id:"qwen/qwen3-8b",name:"Qwen: Qwen3 8B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.05,output:.4,cacheRead:.05,cacheWrite:0},contextWindow:131072,maxTokens:8192},"qwen/qwen3-coder":{id:"qwen/qwen3-coder",name:"Qwen: Qwen3 Coder 480B A35B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.22,output:1.8,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"qwen/qwen3-coder-30b-a3b-instruct":{id:"qwen/qwen3-coder-30b-a3b-instruct",name:"Qwen: Qwen3 Coder 30B A3B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.07,output:.27,cacheRead:0,cacheWrite:0},contextWindow:16e4,maxTokens:32768},"qwen/qwen3-coder-flash":{id:"qwen/qwen3-coder-flash",name:"Qwen: Qwen3 Coder Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.195,output:.975,cacheRead:.039,cacheWrite:.24375},contextWindow:1e6,maxTokens:65536},"qwen/qwen3-coder-next":{id:"qwen/qwen3-coder-next",name:"Qwen: Qwen3 Coder Next",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.11,output:.8,cacheRead:.07,cacheWrite:0},contextWindow:262144,maxTokens:262144},"qwen/qwen3-coder-plus":{id:"qwen/qwen3-coder-plus",name:"Qwen: Qwen3 Coder Plus",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.65,output:3.25,cacheRead:.13,cacheWrite:.8125},contextWindow:1e6,maxTokens:65536},"qwen/qwen3-coder:free":{id:"qwen/qwen3-coder:free",name:"Qwen: Qwen3 Coder 480B A35B (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:262e3},"qwen/qwen3-max":{id:"qwen/qwen3-max",name:"Qwen: Qwen3 Max",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.78,output:3.9,cacheRead:.156,cacheWrite:.975},contextWindow:262144,maxTokens:32768},"qwen/qwen3-max-thinking":{id:"qwen/qwen3-max-thinking",name:"Qwen: Qwen3 Max Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.78,output:3.9,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"qwen/qwen3-next-80b-a3b-instruct":{id:"qwen/qwen3-next-80b-a3b-instruct",name:"Qwen: Qwen3 Next 80B A3B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09,output:1.1,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:16384},"qwen/qwen3-next-80b-a3b-instruct:free":{id:"qwen/qwen3-next-80b-a3b-instruct:free",name:"Qwen: Qwen3 Next 80B A3B Instruct (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"qwen/qwen3-next-80b-a3b-thinking":{id:"qwen/qwen3-next-80b-a3b-thinking",name:"Qwen: Qwen3 Next 80B A3B Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.0975,output:.78,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"qwen/qwen3-vl-235b-a22b-instruct":{id:"qwen/qwen3-vl-235b-a22b-instruct",name:"Qwen: Qwen3 VL 235B A22B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.2,output:.88,cacheRead:.11,cacheWrite:0},contextWindow:262144,maxTokens:16384},"qwen/qwen3-vl-235b-a22b-thinking":{id:"qwen/qwen3-vl-235b-a22b-thinking",name:"Qwen: Qwen3 VL 235B A22B Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.26,output:2.6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"qwen/qwen3-vl-30b-a3b-instruct":{id:"qwen/qwen3-vl-30b-a3b-instruct",name:"Qwen: Qwen3 VL 30B A3B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.13,output:.52,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"qwen/qwen3-vl-30b-a3b-thinking":{id:"qwen/qwen3-vl-30b-a3b-thinking",name:"Qwen: Qwen3 VL 30B A3B Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.13,output:1.56,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"qwen/qwen3-vl-32b-instruct":{id:"qwen/qwen3-vl-32b-instruct",name:"Qwen: Qwen3 VL 32B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.104,output:.416,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"qwen/qwen3-vl-8b-instruct":{id:"qwen/qwen3-vl-8b-instruct",name:"Qwen: Qwen3 VL 8B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.08,output:.5,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:32768},"qwen/qwen3-vl-8b-thinking":{id:"qwen/qwen3-vl-8b-thinking",name:"Qwen: Qwen3 VL 8B Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.117,output:1.365,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:32768},"qwen/qwen3.5-122b-a10b":{id:"qwen/qwen3.5-122b-a10b",name:"Qwen: Qwen3.5-122B-A10B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.26,output:2.08,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"qwen/qwen3.5-27b":{id:"qwen/qwen3.5-27b",name:"Qwen: Qwen3.5-27B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.195,output:1.56,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"qwen/qwen3.5-35b-a3b":{id:"qwen/qwen3.5-35b-a3b",name:"Qwen: Qwen3.5-35B-A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.14,output:1,cacheRead:.05,cacheWrite:0},contextWindow:262144,maxTokens:262144},"qwen/qwen3.5-397b-a17b":{id:"qwen/qwen3.5-397b-a17b",name:"Qwen: Qwen3.5 397B A17B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.39,output:2.34,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"qwen/qwen3.5-9b":{id:"qwen/qwen3.5-9b",name:"Qwen: Qwen3.5-9B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.1,output:.15,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"qwen/qwen3.5-flash-02-23":{id:"qwen/qwen3.5-flash-02-23",name:"Qwen: Qwen3.5-Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.065,output:.26,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"qwen/qwen3.5-plus-02-15":{id:"qwen/qwen3.5-plus-02-15",name:"Qwen: Qwen3.5 Plus 2026-02-15",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.26,output:1.56,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"qwen/qwen3.5-plus-20260420":{id:"qwen/qwen3.5-plus-20260420",name:"Qwen: Qwen3.5 Plus 2026-04-20",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.3,output:1.8,cacheRead:0,cacheWrite:.375},contextWindow:1e6,maxTokens:65536},"qwen/qwen3.6-27b":{id:"qwen/qwen3.6-27b",name:"Qwen: Qwen3.6 27B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.2885,output:3.17,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262140},"qwen/qwen3.6-35b-a3b":{id:"qwen/qwen3.6-35b-a3b",name:"Qwen: Qwen3.6 35B A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.15,output:1,cacheRead:.05,cacheWrite:0},contextWindow:262144,maxTokens:262144},"qwen/qwen3.6-flash":{id:"qwen/qwen3.6-flash",name:"Qwen: Qwen3.6 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.1875,output:1.125,cacheRead:0,cacheWrite:.234375},contextWindow:1e6,maxTokens:65536},"qwen/qwen3.6-max-preview":{id:"qwen/qwen3.6-max-preview",name:"Qwen: Qwen3.6 Max Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1.04,output:6.24,cacheRead:0,cacheWrite:1.3},contextWindow:262144,maxTokens:65536},"qwen/qwen3.6-plus":{id:"qwen/qwen3.6-plus",name:"Qwen: Qwen3.6 Plus",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.325,output:1.95,cacheRead:0,cacheWrite:.40625},contextWindow:1e6,maxTokens:65536},"qwen/qwen3.7-max":{id:"qwen/qwen3.7-max",name:"Qwen: Qwen3.7 Max",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1.25,output:3.75,cacheRead:.25,cacheWrite:1.5625},contextWindow:1e6,maxTokens:65536},"qwen/qwen3.7-plus":{id:"qwen/qwen3.7-plus",name:"Qwen: Qwen3.7 Plus",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.32,output:1.28,cacheRead:.064,cacheWrite:.4},contextWindow:1e6,maxTokens:65536},"rekaai/reka-edge":{id:"rekaai/reka-edge",name:"Reka Edge",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.1,output:.1,cacheRead:0,cacheWrite:0},contextWindow:16384,maxTokens:16384},"relace/relace-search":{id:"relace/relace-search",name:"Relace: Relace Search",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:1,output:3,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:128e3},"sao10k/l3.1-euryale-70b":{id:"sao10k/l3.1-euryale-70b",name:"Sao10K: Llama 3.1 Euryale 70B v2.2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.85,output:.85,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"stepfun/step-3.5-flash":{id:"stepfun/step-3.5-flash",name:"StepFun: Step 3.5 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.09,output:.3,cacheRead:.02,cacheWrite:0},contextWindow:262144,maxTokens:16384},"stepfun/step-3.7-flash":{id:"stepfun/step-3.7-flash",name:"StepFun: Step 3.7 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.2,output:1.15,cacheRead:.04,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"tencent/hy3-preview":{id:"tencent/hy3-preview",name:"Tencent: Hy3 preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.063,output:.21,cacheRead:.021,cacheWrite:0},contextWindow:262144,maxTokens:4096},"thedrummer/rocinante-12b":{id:"thedrummer/rocinante-12b",name:"TheDrummer: Rocinante 12B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.17,output:.43,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:32768},"thedrummer/unslopnemo-12b":{id:"thedrummer/unslopnemo-12b",name:"TheDrummer: UnslopNemo 12B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.4,output:.4,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:32768},"upstage/solar-pro-3":{id:"upstage/solar-pro-3",name:"Upstage: Solar Pro 3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:.015,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"x-ai/grok-4.20":{id:"x-ai/grok-4.20",name:"xAI: Grok 4.20",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.2,cacheWrite:0},contextWindow:2e6,maxTokens:4096},"x-ai/grok-4.3":{id:"x-ai/grok-4.3",name:"xAI: Grok 4.3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.2,cacheWrite:0},contextWindow:1e6,maxTokens:4096},"x-ai/grok-build-0.1":{id:"x-ai/grok-build-0.1",name:"xAI: Grok Build 0.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1,output:2,cacheRead:.2,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"xiaomi/mimo-v2-flash":{id:"xiaomi/mimo-v2-flash",name:"Xiaomi: MiMo-V2-Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.1,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:262144,maxTokens:65536},"xiaomi/mimo-v2.5":{id:"xiaomi/mimo-v2.5",name:"Xiaomi: MiMo-V2.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.14,output:.28,cacheRead:.0028,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"xiaomi/mimo-v2.5-pro":{id:"xiaomi/mimo-v2.5-pro",name:"Xiaomi: MiMo-V2.5-Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.435,output:.87,cacheRead:.0036,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"z-ai/glm-4.5":{id:"z-ai/glm-4.5",name:"Z.ai: GLM 4.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:131072,maxTokens:98304},"z-ai/glm-4.5-air":{id:"z-ai/glm-4.5-air",name:"Z.ai: GLM 4.5 Air",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.125,output:.85,cacheRead:.06,cacheWrite:0},contextWindow:131072,maxTokens:131070},"z-ai/glm-4.5v":{id:"z-ai/glm-4.5v",name:"Z.ai: GLM 4.5V",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.6,output:1.8,cacheRead:.11,cacheWrite:0},contextWindow:65536,maxTokens:16384},"z-ai/glm-4.6":{id:"z-ai/glm-4.6",name:"Z.ai: GLM 4.6",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.43,output:1.74,cacheRead:.08,cacheWrite:0},contextWindow:202752,maxTokens:131072},"z-ai/glm-4.6v":{id:"z-ai/glm-4.6v",name:"Z.ai: GLM 4.6V",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.3,output:.9,cacheRead:.055,cacheWrite:0},contextWindow:131072,maxTokens:32768},"z-ai/glm-4.7":{id:"z-ai/glm-4.7",name:"Z.ai: GLM 4.7",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.4,output:1.75,cacheRead:.08,cacheWrite:0},contextWindow:202752,maxTokens:131072},"z-ai/glm-4.7-flash":{id:"z-ai/glm-4.7-flash",name:"Z.ai: GLM 4.7 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.06,output:.4,cacheRead:.01,cacheWrite:0},contextWindow:202752,maxTokens:16384},"z-ai/glm-5":{id:"z-ai/glm-5",name:"Z.ai: GLM 5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.6,output:1.9,cacheRead:.119,cacheWrite:0},contextWindow:202752,maxTokens:4096},"z-ai/glm-5-turbo":{id:"z-ai/glm-5-turbo",name:"Z.ai: GLM 5 Turbo",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1.2,output:4,cacheRead:.24,cacheWrite:0},contextWindow:262144,maxTokens:131072},"z-ai/glm-5.1":{id:"z-ai/glm-5.1",name:"Z.ai: GLM 5.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.98,output:3.08,cacheRead:.182,cacheWrite:0},contextWindow:202752,maxTokens:4096},"~anthropic/claude-fable-latest":{id:"~anthropic/claude-fable-latest",name:"Anthropic: Claude Fable Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:10,output:50,cacheRead:1,cacheWrite:12.5},contextWindow:1e6,maxTokens:128e3},"~anthropic/claude-haiku-latest":{id:"~anthropic/claude-haiku-latest",name:"Anthropic Claude Haiku Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"~anthropic/claude-opus-latest":{id:"~anthropic/claude-opus-latest",name:"Anthropic: Claude Opus Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"~anthropic/claude-sonnet-latest":{id:"~anthropic/claude-sonnet-latest",name:"Anthropic Claude Sonnet Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:128e3},"~google/gemini-flash-latest":{id:"~google/gemini-flash-latest",name:"Google Gemini Flash Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.5,output:9,cacheRead:.15,cacheWrite:.083333},contextWindow:1048576,maxTokens:65536},"~google/gemini-pro-latest":{id:"~google/gemini-pro-latest",name:"Google Gemini Pro Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:.375},contextWindow:1048576,maxTokens:65536},"~moonshotai/kimi-latest":{id:"~moonshotai/kimi-latest",name:"MoonshotAI Kimi Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.68,output:3.41,cacheRead:.34,cacheWrite:0},contextWindow:262144,maxTokens:262142},"~openai/gpt-latest":{id:"~openai/gpt-latest",name:"OpenAI GPT Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"~openai/gpt-mini-latest":{id:"~openai/gpt-mini-latest",name:"OpenAI GPT Mini Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3}},together:{"MiniMaxAI/MiniMax-M2.7":{id:"MiniMaxAI/MiniMax-M2.7",name:"MiniMax-M2.7",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:null,medium:null},input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:202752,maxTokens:131072},"MiniMaxAI/MiniMax-M3":{id:"MiniMaxAI/MiniMax-M3",name:"MiniMax-M3",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text","image"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:524288,maxTokens:25e4},"Qwen/Qwen2.5-7B-Instruct-Turbo":{id:"Qwen/Qwen2.5-7B-Instruct-Turbo",name:"Qwen 2.5 7B Instruct Turbo",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text"],cost:{input:.3,output:.3,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:32768},"Qwen/Qwen3-235B-A22B-Instruct-2507-tput":{id:"Qwen/Qwen3-235B-A22B-Instruct-2507-tput",name:"Qwen3 235B A22B Instruct 2507 FP8",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text"],cost:{input:.2,output:.6,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"Qwen/Qwen3.5-397B-A17B":{id:"Qwen/Qwen3.5-397B-A17B",name:"Qwen3.5 397B A17B",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text","image"],cost:{input:.6,output:3.6,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:13e4},"Qwen/Qwen3.5-9B":{id:"Qwen/Qwen3.5-9B",name:"Qwen3.5 9B",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text","image"],cost:{input:.17,output:.25,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"Qwen/Qwen3.6-Plus":{id:"Qwen/Qwen3.6-Plus",name:"Qwen3.6 Plus",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text"],cost:{input:.5,output:3,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:5e5},"Qwen/Qwen3.7-Max":{id:"Qwen/Qwen3.7-Max",name:"Qwen3.7 Max",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text"],cost:{input:2.5,output:7.5,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:5e5},"deepseek-ai/DeepSeek-V4-Pro":{id:"deepseek-ai/DeepSeek-V4-Pro",name:"DeepSeek V4 Pro",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!0,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:null},input:["text"],cost:{input:1.74,output:3.48,cacheRead:.2,cacheWrite:0},contextWindow:512e3,maxTokens:384e3},"essentialai/Rnj-1-Instruct":{id:"essentialai/Rnj-1-Instruct",name:"Rnj-1 Instruct",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:32768},"google/gemma-4-31B-it":{id:"google/gemma-4-31B-it",name:"Gemma 4 31B Instruct",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text","image"],cost:{input:.39,output:.97,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"meta-llama/Llama-3.3-70B-Instruct-Turbo":{id:"meta-llama/Llama-3.3-70B-Instruct-Turbo",name:"Llama 3.3 70B",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text"],cost:{input:.88,output:.88,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"moonshotai/Kimi-K2.6":{id:"moonshotai/Kimi-K2.6",name:"Kimi K2.6",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text","image"],cost:{input:1.2,output:4.5,cacheRead:.2,cacheWrite:0},contextWindow:262144,maxTokens:131e3},"moonshotai/Kimi-K2.7-Code":{id:"moonshotai/Kimi-K2.7-Code",name:"Kimi K2.7 Code",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text"],cost:{input:.95,output:4,cacheRead:.19,cacheWrite:0},contextWindow:262144,maxTokens:131072},"nvidia/nemotron-3-ultra-550b-a55b":{id:"nvidia/nemotron-3-ultra-550b-a55b",name:"Nemotron 3 Ultra 550B A55B",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text"],cost:{input:.6,output:3.6,cacheRead:.2,cacheWrite:0},contextWindow:512300,maxTokens:512300},"openai/gpt-oss-120b":{id:"openai/gpt-oss-120b",name:"GPT OSS 120B",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!0,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"openai"},reasoning:!0,thinkingLevelMap:{off:null,minimal:null},input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"openai/gpt-oss-20b":{id:"openai/gpt-oss-20b",name:"GPT OSS 20B",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!0,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"openai"},reasoning:!0,thinkingLevelMap:{off:null,minimal:null},input:["text"],cost:{input:.05,output:.2,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"zai-org/GLM-5":{id:"zai-org/GLM-5",name:"GLM-5",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text"],cost:{input:1,output:3.2,cacheRead:0,cacheWrite:0},contextWindow:202752,maxTokens:131072},"zai-org/GLM-5.1":{id:"zai-org/GLM-5.1",name:"GLM-5.1",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text"],cost:{input:1.4,output:4.4,cacheRead:0,cacheWrite:0},contextWindow:202752,maxTokens:131072}},"vercel-ai-gateway":{"alibaba/qwen-3-14b":{id:"alibaba/qwen-3-14b",name:"Qwen3-14B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.12,output:.24,cacheRead:0,cacheWrite:0},contextWindow:40960,maxTokens:16384},"alibaba/qwen-3-235b":{id:"alibaba/qwen-3-235b",name:"Qwen3 235B A22B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.22,output:.88,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:16384},"alibaba/qwen-3-30b":{id:"alibaba/qwen-3-30b",name:"Qwen3-30B-A3B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.12,output:.5,cacheRead:0,cacheWrite:0},contextWindow:40960,maxTokens:16384},"alibaba/qwen-3-32b":{id:"alibaba/qwen-3-32b",name:"Qwen 3 32B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.16,output:.64,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"alibaba/qwen-3.6-max-preview":{id:"alibaba/qwen-3.6-max-preview",name:"Qwen 3.6 Max Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.3,output:7.8,cacheRead:.26,cacheWrite:1.625},contextWindow:24e4,maxTokens:64e3},"alibaba/qwen3-235b-a22b-thinking":{id:"alibaba/qwen3-235b-a22b-thinking",name:"Qwen3 VL 235B A22B Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.4,output:4,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"alibaba/qwen3-coder":{id:"alibaba/qwen3-coder",name:"Qwen3 Coder 480B A35B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.5,output:7.5,cacheRead:.3,cacheWrite:0},contextWindow:262144,maxTokens:65536},"alibaba/qwen3-coder-30b-a3b":{id:"alibaba/qwen3-coder-30b-a3b",name:"Qwen 3 Coder 30B A3B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:8192},"alibaba/qwen3-coder-next":{id:"alibaba/qwen3-coder-next",name:"Qwen3 Coder Next",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.5,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"alibaba/qwen3-coder-plus":{id:"alibaba/qwen3-coder-plus",name:"Qwen3 Coder Plus",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:1,output:5,cacheRead:.2,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"alibaba/qwen3-max":{id:"alibaba/qwen3-max",name:"Qwen3 Max",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:1.2,output:6,cacheRead:.24,cacheWrite:0},contextWindow:262144,maxTokens:32768},"alibaba/qwen3-max-preview":{id:"alibaba/qwen3-max-preview",name:"Qwen3 Max Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:1.2,output:6,cacheRead:.24,cacheWrite:0},contextWindow:262144,maxTokens:32768},"alibaba/qwen3-max-thinking":{id:"alibaba/qwen3-max-thinking",name:"Qwen 3 Max Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.2,output:6,cacheRead:.24,cacheWrite:0},contextWindow:256e3,maxTokens:65536},"alibaba/qwen3-next-80b-a3b-instruct":{id:"alibaba/qwen3-next-80b-a3b-instruct",name:"Qwen3 Next 80B A3B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.15,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"alibaba/qwen3-next-80b-a3b-thinking":{id:"alibaba/qwen3-next-80b-a3b-thinking",name:"Qwen3 Next 80B A3B Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.15,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"alibaba/qwen3-vl-thinking":{id:"alibaba/qwen3-vl-thinking",name:"Qwen3 VL 235B A22B Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.4,output:4,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"alibaba/qwen3.5-flash":{id:"alibaba/qwen3.5-flash",name:"Qwen 3.5 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.001,cacheWrite:.125},contextWindow:1e6,maxTokens:64e3},"alibaba/qwen3.5-plus":{id:"alibaba/qwen3.5-plus",name:"Qwen 3.5 Plus",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.4,output:2.4,cacheRead:.04,cacheWrite:.5},contextWindow:1e6,maxTokens:64e3},"alibaba/qwen3.6-27b":{id:"alibaba/qwen3.6-27b",name:"Qwen 3.6 27B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.6,output:3.6,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"alibaba/qwen3.6-plus":{id:"alibaba/qwen3.6-plus",name:"Qwen 3.6 Plus",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.1,cacheWrite:.625},contextWindow:1e6,maxTokens:64e3},"alibaba/qwen3.7-max":{id:"alibaba/qwen3.7-max",name:"Qwen 3.7 Max",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.25,output:3.75,cacheRead:.25,cacheWrite:1.5625},contextWindow:991e3,maxTokens:64e3},"alibaba/qwen3.7-plus":{id:"alibaba/qwen3.7-plus",name:"Qwen 3.7 Plus",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.4,output:1.6,cacheRead:.08,cacheWrite:.5},contextWindow:1e6,maxTokens:64e3},"anthropic/claude-3-haiku":{id:"anthropic/claude-3-haiku",name:"Claude 3 Haiku",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.25,output:1.25,cacheRead:.03,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"anthropic/claude-3.5-haiku":{id:"anthropic/claude-3.5-haiku",name:"Claude 3.5 Haiku",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"anthropic/claude-haiku-4.5":{id:"anthropic/claude-haiku-4.5",name:"Claude Haiku 4.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-opus-4":{id:"anthropic/claude-opus-4",name:"Claude Opus 4",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic/claude-opus-4.1":{id:"anthropic/claude-opus-4.1",name:"Claude Opus 4.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic/claude-opus-4.5":{id:"anthropic/claude-opus-4.5",name:"Claude Opus 4.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-opus-4.6":{id:"anthropic/claude-opus-4.6",name:"Claude Opus 4.6",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",compat:{forceAdaptiveThinking:!0},reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-opus-4.7":{id:"anthropic/claude-opus-4.7",name:"Claude Opus 4.7",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",compat:{forceAdaptiveThinking:!0,supportsTemperature:!1},reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-opus-4.8":{id:"anthropic/claude-opus-4.8",name:"Claude Opus 4.8",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",compat:{forceAdaptiveThinking:!0,supportsTemperature:!1},reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-sonnet-4":{id:"anthropic/claude-sonnet-4",name:"Claude Sonnet 4",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"anthropic/claude-sonnet-4.5":{id:"anthropic/claude-sonnet-4.5",name:"Claude Sonnet 4.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"anthropic/claude-sonnet-4.6":{id:"anthropic/claude-sonnet-4.6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",compat:{forceAdaptiveThinking:!0},reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:128e3},"arcee-ai/trinity-large-preview":{id:"arcee-ai/trinity-large-preview",name:"Trinity Large Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.25,output:1,cacheRead:0,cacheWrite:0},contextWindow:131e3,maxTokens:131e3},"arcee-ai/trinity-large-thinking":{id:"arcee-ai/trinity-large-thinking",name:"Trinity Large Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.25,output:.9,cacheRead:0,cacheWrite:0},contextWindow:262100,maxTokens:8e4},"bytedance/seed-1.6":{id:"bytedance/seed-1.6",name:"Seed 1.6",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.25,output:2,cacheRead:.05,cacheWrite:0},contextWindow:256e3,maxTokens:32e3},"cohere/command-a":{id:"cohere/command-a",name:"Command A",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:8e3},"deepseek/deepseek-r1":{id:"deepseek/deepseek-r1",name:"DeepSeek-R1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.35,output:5.4,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"deepseek/deepseek-v3":{id:"deepseek/deepseek-v3",name:"DeepSeek V3 0324",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.27,output:1.12,cacheRead:.135,cacheWrite:0},contextWindow:163840,maxTokens:163840},"deepseek/deepseek-v3.1":{id:"deepseek/deepseek-v3.1",name:"DeepSeek V3.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.56,output:1.68,cacheRead:.28,cacheWrite:0},contextWindow:163840,maxTokens:8192},"deepseek/deepseek-v3.1-terminus":{id:"deepseek/deepseek-v3.1-terminus",name:"DeepSeek V3.1 Terminus",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.27,output:1,cacheRead:.135,cacheWrite:0},contextWindow:131072,maxTokens:65536},"deepseek/deepseek-v3.2":{id:"deepseek/deepseek-v3.2",name:"DeepSeek V3.2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.28,output:.42,cacheRead:.028,cacheWrite:0},contextWindow:128e3,maxTokens:8e3},"deepseek/deepseek-v3.2-thinking":{id:"deepseek/deepseek-v3.2-thinking",name:"DeepSeek V3.2 Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.62,output:1.85,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8e3},"deepseek/deepseek-v4-flash":{id:"deepseek/deepseek-v4-flash",name:"DeepSeek V4 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.14,output:.28,cacheRead:.0028,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"deepseek/deepseek-v4-pro":{id:"deepseek/deepseek-v4-pro",name:"DeepSeek V4 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.435,output:.87,cacheRead:.0036,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"google/gemini-2.5-flash":{id:"google/gemini-2.5-flash",name:"Gemini 2.5 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.03,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"google/gemini-2.5-flash-lite":{id:"google/gemini-2.5-flash-lite",name:"Gemini 2.5 Flash Lite",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.01,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"google/gemini-2.5-pro":{id:"google/gemini-2.5-pro",name:"Gemini 2.5 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"google/gemini-3-flash":{id:"google/gemini-3-flash",name:"Gemini 3 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:0},contextWindow:1e6,maxTokens:65e3},"google/gemini-3-pro-preview":{id:"google/gemini-3-pro-preview",name:"Gemini 3 Pro Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1e6,maxTokens:64e3},"google/gemini-3.1-flash-lite":{id:"google/gemini-3.1-flash-lite",name:"Gemini 3.1 Flash Lite",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.25,output:1.5,cacheRead:.03,cacheWrite:0},contextWindow:1e6,maxTokens:65e3},"google/gemini-3.1-flash-lite-preview":{id:"google/gemini-3.1-flash-lite-preview",name:"Gemini 3.1 Flash Lite Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.25,output:1.5,cacheRead:.03,cacheWrite:0},contextWindow:1e6,maxTokens:65e3},"google/gemini-3.1-pro-preview":{id:"google/gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1e6,maxTokens:64e3},"google/gemini-3.5-flash":{id:"google/gemini-3.5-flash",name:"Gemini 3.5 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.5,output:9,cacheRead:.15,cacheWrite:0},contextWindow:1e6,maxTokens:64e3},"google/gemma-4-26b-a4b-it":{id:"google/gemma-4-26b-a4b-it",name:"Gemma 4 26B A4B IT",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.015,cacheWrite:0},contextWindow:262144,maxTokens:131072},"google/gemma-4-31b-it":{id:"google/gemma-4-31b-it",name:"Gemma 4 31B IT",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.14,output:.4,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"inception/mercury-2":{id:"inception/mercury-2",name:"Mercury 2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.25,output:.75,cacheRead:.025,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"inception/mercury-coder-small":{id:"inception/mercury-coder-small",name:"Mercury Coder Small Beta",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.25,output:1,cacheRead:0,cacheWrite:0},contextWindow:32e3,maxTokens:16384},"kwaipilot/kat-coder-pro-v2":{id:"kwaipilot/kat-coder-pro-v2",name:"Kat Coder Pro V2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"meituan/longcat-flash-chat":{id:"meituan/longcat-flash-chat",name:"LongCat Flash Chat",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:1e5},"meta/llama-3.1-70b":{id:"meta/llama-3.1-70b",name:"Llama 3.1 70B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-3.1-8b":{id:"meta/llama-3.1-8b",name:"Llama 3.1 8B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.22,output:.22,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-3.2-11b":{id:"meta/llama-3.2-11b",name:"Llama 3.2 11B Vision Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.16,output:.16,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-3.2-90b":{id:"meta/llama-3.2-90b",name:"Llama 3.2 90B Vision Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-3.3-70b":{id:"meta/llama-3.3-70b",name:"Llama 3.3 70B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-4-maverick":{id:"meta/llama-4-maverick",name:"Llama 4 Maverick 17B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.24,output:.97,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-4-scout":{id:"meta/llama-4-scout",name:"Llama 4 Scout 17B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.17,output:.66,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"minimax/minimax-m2":{id:"minimax/minimax-m2",name:"MiniMax M2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:.375},contextWindow:205e3,maxTokens:205e3},"minimax/minimax-m2.1":{id:"minimax/minimax-m2.1",name:"MiniMax M2.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"minimax/minimax-m2.1-lightning":{id:"minimax/minimax-m2.1-lightning",name:"MiniMax M2.1 Lightning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:2.4,cacheRead:.03,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"minimax/minimax-m2.5":{id:"minimax/minimax-m2.5",name:"MiniMax M2.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:.375},contextWindow:204800,maxTokens:131e3},"minimax/minimax-m2.5-highspeed":{id:"minimax/minimax-m2.5-highspeed",name:"MiniMax M2.5 High Speed",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:.03,cacheWrite:.375},contextWindow:204800,maxTokens:131e3},"minimax/minimax-m2.7":{id:"minimax/minimax-m2.7",name:"MiniMax M2.7",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131e3},"minimax/minimax-m2.7-highspeed":{id:"minimax/minimax-m2.7-highspeed",name:"MiniMax M2.7 High Speed",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131100},"minimax/minimax-m3":{id:"minimax/minimax-m3",name:"MiniMax M3",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:1e6,maxTokens:1e6},"mistral/codestral":{id:"mistral/codestral",name:"Mistral Codestral",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.3,output:.9,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"mistral/devstral-2":{id:"mistral/devstral-2",name:"Devstral 2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"mistral/devstral-small":{id:"mistral/devstral-small",name:"Devstral Small 1.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"mistral/devstral-small-2":{id:"mistral/devstral-small-2",name:"Devstral Small 2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"mistral/ministral-3b":{id:"mistral/ministral-3b",name:"Ministral 3B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.1,output:.1,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"mistral/ministral-8b":{id:"mistral/ministral-8b",name:"Ministral 8B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"mistral/mistral-medium":{id:"mistral/mistral-medium",name:"Mistral Medium 3.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"mistral/mistral-medium-3.5":{id:"mistral/mistral-medium-3.5",name:"Mistral Medium Latest",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.5,output:7.5,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"mistral/mistral-nemo":{id:"mistral/mistral-nemo",name:"Mistral Nemo 12B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.02,output:.04,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"mistral/mistral-small":{id:"mistral/mistral-small",name:"Mistral Small",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:32e3,maxTokens:4e3},"mistral/pixtral-12b":{id:"mistral/pixtral-12b",name:"Pixtral 12B 2409",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"mistral/pixtral-large":{id:"mistral/pixtral-large",name:"Pixtral Large",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"moonshotai/kimi-k2":{id:"moonshotai/kimi-k2",name:"Kimi K2 Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.57,output:2.3,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"moonshotai/kimi-k2-thinking":{id:"moonshotai/kimi-k2-thinking",name:"Kimi K2 Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:262114,maxTokens:262114},"moonshotai/kimi-k2.5":{id:"moonshotai/kimi-k2.5",name:"Kimi K2.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.1,cacheWrite:0},contextWindow:262114,maxTokens:262114},"moonshotai/kimi-k2.6":{id:"moonshotai/kimi-k2.6",name:"Kimi K2.6",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262e3,maxTokens:262e3},"moonshotai/kimi-k2.7-code":{id:"moonshotai/kimi-k2.7-code",name:"Kimi K2.7 Code",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.19,cacheWrite:0},contextWindow:256e3,maxTokens:32768},"nvidia/nemotron-3-super-120b-a12b":{id:"nvidia/nemotron-3-super-120b-a12b",name:"NVIDIA Nemotron 3 Super 120B A12B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.15,output:.65,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:32e3},"nvidia/nemotron-3-ultra-550b-a55b":{id:"nvidia/nemotron-3-ultra-550b-a55b",name:"Nemotron 3 Ultra",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:.12,cacheWrite:0},contextWindow:1e6,maxTokens:65e3},"nvidia/nemotron-nano-12b-v2-vl":{id:"nvidia/nemotron-nano-12b-v2-vl",name:"Nvidia Nemotron Nano 12B V2 VL",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.2,output:.6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"nvidia/nemotron-nano-9b-v2":{id:"nvidia/nemotron-nano-9b-v2",name:"Nvidia Nemotron Nano 9B V2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.06,output:.23,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"openai/gpt-4-turbo":{id:"openai/gpt-4-turbo",name:"GPT-4 Turbo",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-4.1":{id:"openai/gpt-4.1",name:"GPT-4.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4.1-mini":{id:"openai/gpt-4.1-mini",name:"GPT-4.1 mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.4,output:1.6,cacheRead:.1,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4.1-nano":{id:"openai/gpt-4.1-nano",name:"GPT-4.1 nano",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.025,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4o":{id:"openai/gpt-4o",name:"GPT-4o",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-mini":{id:"openai/gpt-4o-mini",name:"GPT-4o mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.075,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5":{id:"openai/gpt-5",name:"GPT-5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-chat":{id:"openai/gpt-5-chat",name:"GPT 5 Chat",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5-codex":{id:"openai/gpt-5-codex",name:"GPT-5-Codex",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-mini":{id:"openai/gpt-5-mini",name:"GPT-5 mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-nano":{id:"openai/gpt-5-nano",name:"GPT-5 nano",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.05,output:.4,cacheRead:.005,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-pro":{id:"openai/gpt-5-pro",name:"GPT-5 pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:15,output:120,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:272e3},"openai/gpt-5.1-codex":{id:"openai/gpt-5.1-codex",name:"GPT-5.1-Codex",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-codex-max":{id:"openai/gpt-5.1-codex-max",name:"GPT 5.1 Codex Max",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-codex-mini":{id:"openai/gpt-5.1-codex-mini",name:"GPT 5.1 Codex Mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-instant":{id:"openai/gpt-5.1-instant",name:"GPT-5.1 Instant",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.1-thinking":{id:"openai/gpt-5.1-thinking",name:"GPT 5.1 Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2":{id:"openai/gpt-5.2",name:"GPT 5.2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2-chat":{id:"openai/gpt-5.2-chat",name:"GPT 5.2 Chat",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.2-codex":{id:"openai/gpt-5.2-codex",name:"GPT 5.2 Codex",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2-pro":{id:"openai/gpt-5.2-pro",name:"GPT 5.2 ",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:21,output:168,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.3-chat":{id:"openai/gpt-5.3-chat",name:"GPT-5.3 Chat",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.3-codex":{id:"openai/gpt-5.3-codex",name:"GPT 5.3 Codex",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4":{id:"openai/gpt-5.4",name:"GPT 5.4",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-5.4-mini":{id:"openai/gpt-5.4-mini",name:"GPT 5.4 Mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4-nano":{id:"openai/gpt-5.4-nano",name:"GPT 5.4 Nano",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4-pro":{id:"openai/gpt-5.4-pro",name:"GPT 5.4 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-5.5":{id:"openai/gpt-5.5",name:"GPT 5.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:1e6,maxTokens:128e3},"openai/gpt-5.5-pro":{id:"openai/gpt-5.5-pro",name:"GPT 5.5 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh",off:null,minimal:null,low:null},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:128e3},"openai/gpt-oss-120b":{id:"openai/gpt-oss-120b",name:"GPT OSS 120B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.35,output:.75,cacheRead:.25,cacheWrite:0},contextWindow:131072,maxTokens:131e3},"openai/gpt-oss-20b":{id:"openai/gpt-oss-20b",name:"GPT OSS 20B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.05,output:.2,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"openai/gpt-oss-safeguard-20b":{id:"openai/gpt-oss-safeguard-20b",name:"GPT OSS Safeguard 20B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.075,output:.3,cacheRead:.037,cacheWrite:0},contextWindow:131072,maxTokens:65536},"openai/o1":{id:"openai/o1",name:"o1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3":{id:"openai/o3",name:"o3",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-deep-research":{id:"openai/o3-deep-research",name:"o3-deep-research",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:10,output:40,cacheRead:2.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-mini":{id:"openai/o3-mini",name:"o3-mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-pro":{id:"openai/o3-pro",name:"o3 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o4-mini":{id:"openai/o4-mini",name:"o4-mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"perplexity/sonar":{id:"perplexity/sonar",name:"Sonar",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:127e3,maxTokens:8e3},"perplexity/sonar-pro":{id:"perplexity/sonar-pro",name:"Sonar Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:8e3},"stepfun/step-3.5-flash":{id:"stepfun/step-3.5-flash",name:"StepFun 3.5 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.09,output:.3,cacheRead:0,cacheWrite:.02},contextWindow:262114,maxTokens:262114},"stepfun/step-3.7-flash":{id:"stepfun/step-3.7-flash",name:"Step 3.7 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.2,output:1.15,cacheRead:.04,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"xai/grok-4.1-fast-non-reasoning":{id:"xai/grok-4.1-fast-non-reasoning",name:"Grok 4.1 Fast Non-Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.2,output:.5,cacheRead:.05,cacheWrite:0},contextWindow:1e6,maxTokens:1e6},"xai/grok-4.1-fast-reasoning":{id:"xai/grok-4.1-fast-reasoning",name:"Grok 4.1 Fast Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.2,output:.5,cacheRead:.05,cacheWrite:0},contextWindow:1e6,maxTokens:1e6},"xai/grok-4.20-multi-agent":{id:"xai/grok-4.20-multi-agent",name:"Grok 4.20 Multi-Agent",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.2,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-4.20-multi-agent-beta":{id:"xai/grok-4.20-multi-agent-beta",name:"Grok 4.20 Multi Agent Beta",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.2,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-4.20-non-reasoning":{id:"xai/grok-4.20-non-reasoning",name:"Grok 4.20 Non-Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.2,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-4.20-non-reasoning-beta":{id:"xai/grok-4.20-non-reasoning-beta",name:"Grok 4.20 Beta Non-Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.2,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-4.20-reasoning":{id:"xai/grok-4.20-reasoning",name:"Grok 4.20 Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.2,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-4.20-reasoning-beta":{id:"xai/grok-4.20-reasoning-beta",name:"Grok 4.20 Beta Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.2,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-4.3":{id:"xai/grok-4.3",name:"Grok 4.3",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.2,cacheWrite:0},contextWindow:1e6,maxTokens:1e6},"xai/grok-build-0.1":{id:"xai/grok-build-0.1",name:"Grok Build 0.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1,output:2,cacheRead:.2,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"xiaomi/mimo-v2-flash":{id:"xiaomi/mimo-v2-flash",name:"MiMo V2 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.1,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:262144,maxTokens:32e3},"xiaomi/mimo-v2-pro":{id:"xiaomi/mimo-v2-pro",name:"MiMo V2 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1e6,maxTokens:128e3},"xiaomi/mimo-v2.5":{id:"xiaomi/mimo-v2.5",name:"MiMo M2.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.14,output:.28,cacheRead:.0028,cacheWrite:0},contextWindow:105e4,maxTokens:131100},"xiaomi/mimo-v2.5-pro":{id:"xiaomi/mimo-v2.5-pro",name:"MiMo V2.5 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.435,output:.87,cacheRead:.0036,cacheWrite:0},contextWindow:105e4,maxTokens:131e3},"zai/glm-4.5":{id:"zai/glm-4.5",name:"GLM-4.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:128e3,maxTokens:96e3},"zai/glm-4.5-air":{id:"zai/glm-4.5-air",name:"GLM 4.5 Air",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.2,output:1.1,cacheRead:.03,cacheWrite:0},contextWindow:128e3,maxTokens:96e3},"zai/glm-4.5v":{id:"zai/glm-4.5v",name:"GLM 4.5V",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.6,output:1.8,cacheRead:.11,cacheWrite:0},contextWindow:66e3,maxTokens:16e3},"zai/glm-4.6":{id:"zai/glm-4.6",name:"GLM 4.6",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:2e5,maxTokens:96e3},"zai/glm-4.6v":{id:"zai/glm-4.6v",name:"GLM-4.6V",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.3,output:.9,cacheRead:.05,cacheWrite:0},contextWindow:128e3,maxTokens:24e3},"zai/glm-4.6v-flash":{id:"zai/glm-4.6v-flash",name:"GLM-4.6V-Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:24e3},"zai/glm-4.7":{id:"zai/glm-4.7",name:"GLM 4.7",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:2.25,output:2.75,cacheRead:2.25,cacheWrite:0},contextWindow:131e3,maxTokens:4e4},"zai/glm-4.7-flash":{id:"zai/glm-4.7-flash",name:"GLM 4.7 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.07,output:.4,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131e3},"zai/glm-4.7-flashx":{id:"zai/glm-4.7-flashx",name:"GLM 4.7 FlashX",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.06,output:.4,cacheRead:.01,cacheWrite:0},contextWindow:2e5,maxTokens:128e3},"zai/glm-5":{id:"zai/glm-5",name:"GLM 5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:202800,maxTokens:131100},"zai/glm-5-turbo":{id:"zai/glm-5-turbo",name:"GLM 5 Turbo",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.2,output:4,cacheRead:.24,cacheWrite:0},contextWindow:202800,maxTokens:131100},"zai/glm-5.1":{id:"zai/glm-5.1",name:"GLM 5.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.4,output:4.4,cacheRead:.26,cacheWrite:0},contextWindow:202800,maxTokens:64e3},"zai/glm-5v-turbo":{id:"zai/glm-5v-turbo",name:"GLM 5V Turbo",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.2,output:4,cacheRead:.24,cacheWrite:0},contextWindow:2e5,maxTokens:128e3}},xai:{"grok-3":{id:"grok-3",name:"Grok 3",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:3,output:15,cacheRead:.75,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-3-fast":{id:"grok-3-fast",name:"Grok 3 Fast",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:5,output:25,cacheRead:1.25,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-4.20-0309-non-reasoning":{id:"grok-4.20-0309-non-reasoning",name:"Grok 4.20 (Non-Reasoning)",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.2,cacheWrite:0},contextWindow:1e6,maxTokens:3e4},"grok-4.20-0309-reasoning":{id:"grok-4.20-0309-reasoning",name:"Grok 4.20 (Reasoning)",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.2,cacheWrite:0},contextWindow:1e6,maxTokens:3e4},"grok-4.3":{id:"grok-4.3",name:"Grok 4.3",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.2,cacheWrite:0},contextWindow:1e6,maxTokens:3e4},"grok-build-0.1":{id:"grok-build-0.1",name:"Grok Build 0.1",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!0,input:["text","image"],cost:{input:1,output:2,cacheRead:.2,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"grok-code-fast-1":{id:"grok-code-fast-1",name:"Grok Code Fast 1",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:.2,output:1.5,cacheRead:.02,cacheWrite:0},contextWindow:32768,maxTokens:8192}},xiaomi:{"mimo-v2-flash":{id:"mimo-v2-flash",name:"MiMo-V2-Flash",api:"openai-completions",provider:"xiaomi",baseUrl:"https://api.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:.1,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:262144,maxTokens:65536},"mimo-v2-omni":{id:"mimo-v2-omni",name:"MiMo-V2-Omni",api:"openai-completions",provider:"xiaomi",baseUrl:"https://api.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:262144,maxTokens:131072},"mimo-v2-pro":{id:"mimo-v2-pro",name:"MiMo-V2-Pro",api:"openai-completions",provider:"xiaomi",baseUrl:"https://api.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5":{id:"mimo-v2.5",name:"MiMo-V2.5",api:"openai-completions",provider:"xiaomi",baseUrl:"https://api.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5-pro":{id:"mimo-v2.5-pro",name:"MiMo-V2.5-Pro",api:"openai-completions",provider:"xiaomi",baseUrl:"https://api.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5-pro-ultraspeed":{id:"mimo-v2.5-pro-ultraspeed",name:"MiMo-V2.5-Pro-UltraSpeed",api:"openai-completions",provider:"xiaomi",baseUrl:"https://api.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1.305,output:2.61,cacheRead:.0108,cacheWrite:0},contextWindow:1048576,maxTokens:131072}},"xiaomi-token-plan-ams":{"mimo-v2-omni":{id:"mimo-v2-omni",name:"MiMo-V2-Omni",api:"openai-completions",provider:"xiaomi-token-plan-ams",baseUrl:"https://token-plan-ams.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:262144,maxTokens:131072},"mimo-v2-pro":{id:"mimo-v2-pro",name:"MiMo-V2-Pro",api:"openai-completions",provider:"xiaomi-token-plan-ams",baseUrl:"https://token-plan-ams.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5":{id:"mimo-v2.5",name:"MiMo-V2.5",api:"openai-completions",provider:"xiaomi-token-plan-ams",baseUrl:"https://token-plan-ams.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5-pro":{id:"mimo-v2.5-pro",name:"MiMo-V2.5-Pro",api:"openai-completions",provider:"xiaomi-token-plan-ams",baseUrl:"https://token-plan-ams.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5-pro-ultraspeed":{id:"mimo-v2.5-pro-ultraspeed",name:"MiMo-V2.5-Pro-UltraSpeed",api:"openai-completions",provider:"xiaomi-token-plan-ams",baseUrl:"https://token-plan-ams.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1.305,output:2.61,cacheRead:.0108,cacheWrite:0},contextWindow:1048576,maxTokens:131072}},"xiaomi-token-plan-cn":{"mimo-v2-omni":{id:"mimo-v2-omni",name:"MiMo-V2-Omni",api:"openai-completions",provider:"xiaomi-token-plan-cn",baseUrl:"https://token-plan-cn.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:262144,maxTokens:131072},"mimo-v2-pro":{id:"mimo-v2-pro",name:"MiMo-V2-Pro",api:"openai-completions",provider:"xiaomi-token-plan-cn",baseUrl:"https://token-plan-cn.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5":{id:"mimo-v2.5",name:"MiMo-V2.5",api:"openai-completions",provider:"xiaomi-token-plan-cn",baseUrl:"https://token-plan-cn.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5-pro":{id:"mimo-v2.5-pro",name:"MiMo-V2.5-Pro",api:"openai-completions",provider:"xiaomi-token-plan-cn",baseUrl:"https://token-plan-cn.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5-pro-ultraspeed":{id:"mimo-v2.5-pro-ultraspeed",name:"MiMo-V2.5-Pro-UltraSpeed",api:"openai-completions",provider:"xiaomi-token-plan-cn",baseUrl:"https://token-plan-cn.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1.305,output:2.61,cacheRead:.0108,cacheWrite:0},contextWindow:1048576,maxTokens:131072}},"xiaomi-token-plan-sgp":{"mimo-v2-omni":{id:"mimo-v2-omni",name:"MiMo-V2-Omni",api:"openai-completions",provider:"xiaomi-token-plan-sgp",baseUrl:"https://token-plan-sgp.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:262144,maxTokens:131072},"mimo-v2-pro":{id:"mimo-v2-pro",name:"MiMo-V2-Pro",api:"openai-completions",provider:"xiaomi-token-plan-sgp",baseUrl:"https://token-plan-sgp.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5":{id:"mimo-v2.5",name:"MiMo-V2.5",api:"openai-completions",provider:"xiaomi-token-plan-sgp",baseUrl:"https://token-plan-sgp.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5-pro":{id:"mimo-v2.5-pro",name:"MiMo-V2.5-Pro",api:"openai-completions",provider:"xiaomi-token-plan-sgp",baseUrl:"https://token-plan-sgp.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5-pro-ultraspeed":{id:"mimo-v2.5-pro-ultraspeed",name:"MiMo-V2.5-Pro-UltraSpeed",api:"openai-completions",provider:"xiaomi-token-plan-sgp",baseUrl:"https://token-plan-sgp.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1.305,output:2.61,cacheRead:.0108,cacheWrite:0},contextWindow:1048576,maxTokens:131072}},zai:{"glm-4.5-air":{id:"glm-4.5-air",name:"GLM-4.5-Air",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai"},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:98304},"glm-4.7":{id:"glm-4.7",name:"GLM-4.7",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai",zaiToolStream:!0},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"glm-5-turbo":{id:"glm-5-turbo",name:"GLM-5-Turbo",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai",zaiToolStream:!0},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131072},"glm-5.1":{id:"glm-5.1",name:"GLM-5.1",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai",zaiToolStream:!0},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131072},"glm-5.2":{id:"glm-5.2",name:"GLM-5.2",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai",zaiToolStream:!0},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:131072},"glm-5v-turbo":{id:"glm-5v-turbo",name:"GLM-5V-Turbo",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai",zaiToolStream:!0},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131072}},"zai-coding-cn":{"glm-4.5-air":{id:"glm-4.5-air",name:"GLM-4.5-Air",api:"openai-completions",provider:"zai-coding-cn",baseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai"},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:98304},"glm-4.7":{id:"glm-4.7",name:"GLM-4.7",api:"openai-completions",provider:"zai-coding-cn",baseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai",zaiToolStream:!0},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"glm-5-turbo":{id:"glm-5-turbo",name:"GLM-5-Turbo",api:"openai-completions",provider:"zai-coding-cn",baseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai",zaiToolStream:!0},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131072},"glm-5.1":{id:"glm-5.1",name:"GLM-5.1",api:"openai-completions",provider:"zai-coding-cn",baseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai",zaiToolStream:!0},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131072},"glm-5.2":{id:"glm-5.2",name:"GLM-5.2",api:"openai-completions",provider:"zai-coding-cn",baseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai",zaiToolStream:!0},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:131072},"glm-5v-turbo":{id:"glm-5v-turbo",name:"GLM-5V-Turbo",api:"openai-completions",provider:"zai-coding-cn",baseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai",zaiToolStream:!0},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131072}}}});function Fg(){return Array.from(Wg.keys())}function Ug(t){let e=Wg.get(t);return e?Array.from(e.values()):[]}function fn(t,e){return e.cost.input=t.cost.input/1e6*e.input,e.cost.output=t.cost.output/1e6*e.output,e.cost.cacheRead=t.cost.cacheRead/1e6*e.cacheRead,e.cost.cacheWrite=t.cost.cacheWrite/1e6*e.cacheWrite,e.cost.total=e.cost.input+e.cost.output+e.cost.cacheRead+e.cost.cacheWrite,e.cost}function kS(t){return t.reasoning?el.filter(e=>{let n=t.thinkingLevelMap?.[e];return n===null?!1:e==="xhigh"?n!==void 0:!0}):["off"]}function _t(t,e){let n=kS(t);if(n.includes(e))return e;let i=el.indexOf(e);if(i===-1)return n[0]??"off";for(let s=i;s<el.length;s++){let r=el[s];if(n.includes(r))return r}for(let s=i-1;s>=0;s--){let r=el[s];if(n.includes(r))return r}return n[0]??"off"}function zn(t,e){return!t||!e?!1:t.id===e.id&&t.provider===e.provider}var Wg,el,In=qe(()=>{"use strict";CS();Wg=new Map;for(let[t,e]of Object.entries(TS)){let n=new Map;for(let[i,s]of Object.entries(e))n.set(i,s);Wg.set(t,n)}el=["off","minimal","low","medium","high","xhigh"]});var Dg,rt,Pn=qe(()=>{"use strict";Dg=class{constructor(e,n){this.queue=[];this.waiting=[];this.done=!1;this.isComplete=e,this.extractResult=n,this.finalResultPromise=new Promise(i=>{this.resolveFinalResult=i})}push(e){if(this.done)return;this.isComplete(e)&&(this.done=!0,this.resolveFinalResult(this.extractResult(e)));let n=this.waiting.shift();n?n({value:e,done:!1}):this.queue.push(e)}end(e){for(this.done=!0,e!==void 0&&this.resolveFinalResult(e);this.waiting.length>0;)this.waiting.shift()({value:void 0,done:!0})}async*[Symbol.asyncIterator](){for(;;)if(this.queue.length>0)yield this.queue.shift();else{if(this.done)return;{let e=await new Promise(n=>this.waiting.push(n));if(e.done)return;yield e.value}}}result(){return this.finalResultPromise}},rt=class extends Dg{constructor(){super(e=>e.type==="done"||e.type==="error",e=>{if(e.type==="done")return e.message;if(e.type==="error")return e.error;throw new Error("Unexpected event type for final result")})}}});import{parse as MS}from"partial-json";function _L(t){let e=t.codePointAt(0);return e!==void 0&&e>=0&&e<=31}function EL(t){switch(t){case"\b":return"\\b";case"\f":return"\\f";case`
|
|
1
|
+
var B2=Object.create;var Tg=Object.defineProperty;var N2=Object.getOwnPropertyDescriptor;var j2=Object.getOwnPropertyNames;var q2=Object.getPrototypeOf,G2=Object.prototype.hasOwnProperty;var od=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var qe=(t,e)=>()=>(t&&(e=t(t=0)),e);var M=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ei=(t,e)=>{for(var n in e)Tg(t,n,{get:e[n],enumerable:!0})},K2=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of j2(e))!G2.call(t,s)&&s!==n&&Tg(t,s,{get:()=>e[s],enumerable:!(i=N2(e,s))||i.enumerable});return t};var H2=(t,e,n)=>(n=t!=null?B2(q2(t)):{},K2(e||!t||!t.__esModule?Tg(n,"default",{value:t,enumerable:!0}):n,t));function gn(t){let e={};for(let[n,i]of t.entries())e[n]=i;return e}var or=qe(()=>{"use strict"});function he(t){return t.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"")}var Oi=qe(()=>{"use strict"});var yS={};Ei(yS,{generateImagesOpenRouter:()=>wL});import yL from"openai";function SL(t,e,n){return new yL({apiKey:e,baseURL:t.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:{...t.headers,...n}})}function TL(t,e){let n=e.input.map(i=>i.type==="text"?{type:"text",text:he(i.text)}:{type:"image_url",image_url:{url:`data:${i.mimeType};base64,${i.data}`}});return{model:t.id,messages:[{role:"user",content:n}],stream:!1,modalities:t.output.includes("text")?["image","text"]:["image"]}}function CL(t,e){let n=t.prompt_tokens||0,i=t.prompt_tokens_details?.cached_tokens||0,s=t.prompt_tokens_details?.cache_write_tokens||0,r=s>0?Math.max(0,i-s):i,o=Math.max(0,n-r-s),a=t.completion_tokens||0,c={input:o,output:a,cacheRead:r,cacheWrite:s,totalTokens:o+a+r+s,cost:{input:e.cost.input/1e6*o,output:e.cost.output/1e6*a,cacheRead:e.cost.cacheRead/1e6*r,cacheWrite:e.cost.cacheWrite/1e6*s,total:0}};return c.cost.total=c.cost.input+c.cost.output+c.cost.cacheRead+c.cost.cacheWrite,c}var wL,wS=qe(()=>{"use strict";or();Oi();wL=async(t,e,n)=>{let i={api:t.api,provider:t.provider,model:t.id,output:[],stopReason:"stop",timestamp:Date.now()};try{let s=n?.apiKey;if(!s)throw new Error(`No API key for provider: ${t.provider}`);let r=SL(t,s,n?.headers),o=TL(t,e),a=await n?.onPayload?.(o,t);a!==void 0&&(o=a);let c={...n?.signal?{signal:n.signal}:{},...n?.timeoutMs!==void 0?{timeout:n.timeoutMs}:{},maxRetries:n?.maxRetries??0},{data:l,response:u}=await r.chat.completions.create(o,c).withResponse();await n?.onResponse?.({status:u.status,headers:gn(u.headers)},t);let d=l;i.responseId=d.id,d.usage&&(i.usage=CL(d.usage,t));let p=d.choices[0];if(p){let m=p.message.content;typeof m=="string"&&m.length>0&&i.output.push({type:"text",text:m});for(let g of p.message.images??[]){let h=typeof g.image_url=="string"?g.image_url:g.image_url?.url;if(!h?.startsWith("data:"))continue;let f=h.match(/^data:([^;]+);base64,(.+)$/);f&&i.output.push({type:"image",mimeType:f[1],data:f[2]})}}return i}catch(s){return i.stopReason=n?.signal?.aborted?"aborted":"error",i.errorMessage=s instanceof Error?s.message:JSON.stringify(s),i}}});var TS,CS=qe(()=>{"use strict";TS={"amazon-bedrock":{"amazon.nova-2-lite-v1:0":{id:"amazon.nova-2-lite-v1:0",name:"Nova 2 Lite",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:.33,output:2.75,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"amazon.nova-lite-v1:0":{id:"amazon.nova-lite-v1:0",name:"Nova Lite",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.06,output:.24,cacheRead:.015,cacheWrite:0},contextWindow:3e5,maxTokens:8192},"amazon.nova-micro-v1:0":{id:"amazon.nova-micro-v1:0",name:"Nova Micro",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.035,output:.14,cacheRead:.00875,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"amazon.nova-pro-v1:0":{id:"amazon.nova-pro-v1:0",name:"Nova Pro",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.8,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:3e5,maxTokens:8192},"anthropic.claude-haiku-4-5-20251001-v1:0":{id:"anthropic.claude-haiku-4-5-20251001-v1:0",name:"Claude Haiku 4.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"anthropic.claude-opus-4-1-20250805-v1:0":{id:"anthropic.claude-opus-4-1-20250805-v1:0",name:"Claude Opus 4.1",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic.claude-opus-4-5-20251101-v1:0":{id:"anthropic.claude-opus-4-5-20251101-v1:0",name:"Claude Opus 4.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"anthropic.claude-opus-4-6-v1":{id:"anthropic.claude-opus-4-6-v1",name:"Claude Opus 4.6",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic.claude-opus-4-7":{id:"anthropic.claude-opus-4-7",name:"Claude Opus 4.7",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic.claude-opus-4-8":{id:"anthropic.claude-opus-4-8",name:"Claude Opus 4.8",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"anthropic.claude-sonnet-4-6":{id:"anthropic.claude-sonnet-4-6",name:"Claude Sonnet 4.6",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"au.anthropic.claude-haiku-4-5-20251001-v1:0":{id:"au.anthropic.claude-haiku-4-5-20251001-v1:0",name:"Claude Haiku 4.5 (AU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"au.anthropic.claude-opus-4-6-v1":{id:"au.anthropic.claude-opus-4-6-v1",name:"AU Anthropic Claude Opus 4.6",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:16.5,output:82.5,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"au.anthropic.claude-opus-4-8":{id:"au.anthropic.claude-opus-4-8",name:"Claude Opus 4.8 (AU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"au.anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"au.anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5 (AU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"au.anthropic.claude-sonnet-4-6":{id:"au.anthropic.claude-sonnet-4-6",name:"AU Anthropic Claude Sonnet 4.6",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3.3,output:16.5,cacheRead:.33,cacheWrite:4.125},contextWindow:1e6,maxTokens:128e3},"deepseek.r1-v1:0":{id:"deepseek.r1-v1:0",name:"DeepSeek-R1",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:1.35,output:5.4,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:32768},"deepseek.v3-v1:0":{id:"deepseek.v3-v1:0",name:"DeepSeek-V3.1",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.58,output:1.68,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:81920},"deepseek.v3.2":{id:"deepseek.v3.2",name:"DeepSeek-V3.2",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.62,output:1.85,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:81920},"eu.anthropic.claude-fable-5":{id:"eu.anthropic.claude-fable-5",name:"Claude Fable 5 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:11,output:55,cacheRead:1.1,cacheWrite:13.75},contextWindow:1e6,maxTokens:128e3},"eu.anthropic.claude-haiku-4-5-20251001-v1:0":{id:"eu.anthropic.claude-haiku-4-5-20251001-v1:0",name:"Claude Haiku 4.5 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"eu.anthropic.claude-opus-4-5-20251101-v1:0":{id:"eu.anthropic.claude-opus-4-5-20251101-v1:0",name:"Claude Opus 4.5 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"eu.anthropic.claude-opus-4-6-v1":{id:"eu.anthropic.claude-opus-4-6-v1",name:"Claude Opus 4.6 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5.5,output:27.5,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"eu.anthropic.claude-opus-4-7":{id:"eu.anthropic.claude-opus-4-7",name:"Claude Opus 4.7 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5.5,output:27.5,cacheRead:.55,cacheWrite:6.875},contextWindow:1e6,maxTokens:128e3},"eu.anthropic.claude-opus-4-8":{id:"eu.anthropic.claude-opus-4-8",name:"Claude Opus 4.8 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5.5,output:27.5,cacheRead:.55,cacheWrite:6.875},contextWindow:1e6,maxTokens:128e3},"eu.anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"eu.anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3.3,output:16.5,cacheRead:.33,cacheWrite:4.125},contextWindow:2e5,maxTokens:64e3},"eu.anthropic.claude-sonnet-4-6":{id:"eu.anthropic.claude-sonnet-4-6",name:"Claude Sonnet 4.6 (EU)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.eu-central-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3.3,output:16.5,cacheRead:.33,cacheWrite:4.125},contextWindow:1e6,maxTokens:64e3},"global.anthropic.claude-fable-5":{id:"global.anthropic.claude-fable-5",name:"Claude Fable 5 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:10,output:50,cacheRead:1,cacheWrite:12.5},contextWindow:1e6,maxTokens:128e3},"global.anthropic.claude-haiku-4-5-20251001-v1:0":{id:"global.anthropic.claude-haiku-4-5-20251001-v1:0",name:"Claude Haiku 4.5 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"global.anthropic.claude-opus-4-5-20251101-v1:0":{id:"global.anthropic.claude-opus-4-5-20251101-v1:0",name:"Claude Opus 4.5 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"global.anthropic.claude-opus-4-6-v1":{id:"global.anthropic.claude-opus-4-6-v1",name:"Claude Opus 4.6 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"global.anthropic.claude-opus-4-7":{id:"global.anthropic.claude-opus-4-7",name:"Claude Opus 4.7 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"global.anthropic.claude-opus-4-8":{id:"global.anthropic.claude-opus-4-8",name:"Claude Opus 4.8 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"global.anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"global.anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"global.anthropic.claude-sonnet-4-6":{id:"global.anthropic.claude-sonnet-4-6",name:"Claude Sonnet 4.6 (Global)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"google.gemma-3-27b-it":{id:"google.gemma-3-27b-it",name:"Google Gemma 3 27B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.12,output:.2,cacheRead:0,cacheWrite:0},contextWindow:202752,maxTokens:8192},"google.gemma-3-4b-it":{id:"google.gemma-3-4b-it",name:"Gemma 3 4B IT",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.04,output:.08,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"jp.anthropic.claude-opus-4-7":{id:"jp.anthropic.claude-opus-4-7",name:"Claude Opus 4.7 (JP)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"jp.anthropic.claude-opus-4-8":{id:"jp.anthropic.claude-opus-4-8",name:"Claude Opus 4.8 (JP)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"jp.anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"jp.anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5 (JP)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"jp.anthropic.claude-sonnet-4-6":{id:"jp.anthropic.claude-sonnet-4-6",name:"Claude Sonnet 4.6 (JP)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"meta.llama3-1-70b-instruct-v1:0":{id:"meta.llama3-1-70b-instruct-v1:0",name:"Llama 3.1 70B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta.llama3-1-8b-instruct-v1:0":{id:"meta.llama3-1-8b-instruct-v1:0",name:"Llama 3.1 8B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.22,output:.22,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta.llama3-3-70b-instruct-v1:0":{id:"meta.llama3-3-70b-instruct-v1:0",name:"Llama 3.3 70B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta.llama4-maverick-17b-instruct-v1:0":{id:"meta.llama4-maverick-17b-instruct-v1:0",name:"Llama 4 Maverick 17B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.24,output:.97,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:16384},"meta.llama4-scout-17b-instruct-v1:0":{id:"meta.llama4-scout-17b-instruct-v1:0",name:"Llama 4 Scout 17B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.17,output:.66,cacheRead:0,cacheWrite:0},contextWindow:35e5,maxTokens:16384},"minimax.minimax-m2":{id:"minimax.minimax-m2",name:"MiniMax M2",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:204608,maxTokens:128e3},"minimax.minimax-m2.1":{id:"minimax.minimax-m2.1",name:"MiniMax M2.1",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"minimax.minimax-m2.5":{id:"minimax.minimax-m2.5",name:"MiniMax M2.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:196608,maxTokens:98304},"mistral.devstral-2-123b":{id:"mistral.devstral-2-123b",name:"Devstral 2 123B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:8192},"mistral.magistral-small-2509":{id:"mistral.magistral-small-2509",name:"Magistral Small 1.2",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e4},"mistral.ministral-3-14b-instruct":{id:"mistral.ministral-3-14b-instruct",name:"Ministral 14B 3.0",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.2,output:.2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistral.ministral-3-3b-instruct":{id:"mistral.ministral-3-3b-instruct",name:"Ministral 3 3B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.1,output:.1,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:8192},"mistral.ministral-3-8b-instruct":{id:"mistral.ministral-3-8b-instruct",name:"Ministral 3 8B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistral.mistral-large-3-675b-instruct":{id:"mistral.mistral-large-3-675b-instruct",name:"Mistral Large 3",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:8192},"mistral.pixtral-large-2502-v1:0":{id:"mistral.pixtral-large-2502-v1:0",name:"Pixtral Large (25.02)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"mistral.voxtral-mini-3b-2507":{id:"mistral.voxtral-mini-3b-2507",name:"Voxtral Mini 3B 2507",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.04,output:.04,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistral.voxtral-small-24b-2507":{id:"mistral.voxtral-small-24b-2507",name:"Voxtral Small 24B 2507",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.35,cacheRead:0,cacheWrite:0},contextWindow:32e3,maxTokens:8192},"moonshot.kimi-k2-thinking":{id:"moonshot.kimi-k2-thinking",name:"Kimi K2 Thinking",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:0,cacheWrite:0},contextWindow:262143,maxTokens:16e3},"moonshotai.kimi-k2.5":{id:"moonshotai.kimi-k2.5",name:"Kimi K2.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:0,cacheWrite:0},contextWindow:262143,maxTokens:16e3},"nvidia.nemotron-nano-12b-v2":{id:"nvidia.nemotron-nano-12b-v2",name:"NVIDIA Nemotron Nano 12B v2 VL BF16",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.2,output:.6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"nvidia.nemotron-nano-3-30b":{id:"nvidia.nemotron-nano-3-30b",name:"NVIDIA Nemotron Nano 3 30B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.06,output:.24,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"nvidia.nemotron-nano-9b-v2":{id:"nvidia.nemotron-nano-9b-v2",name:"NVIDIA Nemotron Nano 9B v2",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.06,output:.23,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"nvidia.nemotron-super-3-120b":{id:"nvidia.nemotron-super-3-120b",name:"NVIDIA Nemotron 3 Super 120B A12B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.15,output:.65,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"openai.gpt-5.4":{id:"openai.gpt-5.4",name:"GPT-5.4",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:2.75,output:16.5,cacheRead:.275,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"openai.gpt-5.5":{id:"openai.gpt-5.5",name:"GPT-5.5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5.5,output:33,cacheRead:.55,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"openai.gpt-oss-120b":{id:"openai.gpt-oss-120b",name:"gpt-oss-120b",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai.gpt-oss-120b-1:0":{id:"openai.gpt-oss-120b-1:0",name:"gpt-oss-120b",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai.gpt-oss-20b":{id:"openai.gpt-oss-20b",name:"gpt-oss-20b",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.07,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai.gpt-oss-20b-1:0":{id:"openai.gpt-oss-20b-1:0",name:"gpt-oss-20b",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.07,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai.gpt-oss-safeguard-120b":{id:"openai.gpt-oss-safeguard-120b",name:"GPT OSS Safeguard 120B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai.gpt-oss-safeguard-20b":{id:"openai.gpt-oss-safeguard-20b",name:"GPT OSS Safeguard 20B",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.07,output:.2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"qwen.qwen3-235b-a22b-2507-v1:0":{id:"qwen.qwen3-235b-a22b-2507-v1:0",name:"Qwen3 235B A22B 2507",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.22,output:.88,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"qwen.qwen3-32b-v1:0":{id:"qwen.qwen3-32b-v1:0",name:"Qwen3 32B (dense)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:16384,maxTokens:16384},"qwen.qwen3-coder-30b-a3b-v1:0":{id:"qwen.qwen3-coder-30b-a3b-v1:0",name:"Qwen3 Coder 30B A3B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"qwen.qwen3-coder-480b-a35b-v1:0":{id:"qwen.qwen3-coder-480b-a35b-v1:0",name:"Qwen3 Coder 480B A35B Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.22,output:1.8,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:65536},"qwen.qwen3-coder-next":{id:"qwen.qwen3-coder-next",name:"Qwen3 Coder Next",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.22,output:1.8,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:65536},"qwen.qwen3-next-80b-a3b":{id:"qwen.qwen3-next-80b-a3b",name:"Qwen/Qwen3-Next-80B-A3B-Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text"],cost:{input:.14,output:1.4,cacheRead:0,cacheWrite:0},contextWindow:262e3,maxTokens:262e3},"qwen.qwen3-vl-235b-a22b":{id:"qwen.qwen3-vl-235b-a22b",name:"Qwen/Qwen3-VL-235B-A22B-Instruct",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.3,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:262e3,maxTokens:262e3},"us.anthropic.claude-fable-5":{id:"us.anthropic.claude-fable-5",name:"Claude Fable 5 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:10,output:50,cacheRead:1,cacheWrite:12.5},contextWindow:1e6,maxTokens:128e3},"us.anthropic.claude-haiku-4-5-20251001-v1:0":{id:"us.anthropic.claude-haiku-4-5-20251001-v1:0",name:"Claude Haiku 4.5 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"us.anthropic.claude-opus-4-1-20250805-v1:0":{id:"us.anthropic.claude-opus-4-1-20250805-v1:0",name:"Claude Opus 4.1 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"us.anthropic.claude-opus-4-5-20251101-v1:0":{id:"us.anthropic.claude-opus-4-5-20251101-v1:0",name:"Claude Opus 4.5 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"us.anthropic.claude-opus-4-6-v1":{id:"us.anthropic.claude-opus-4-6-v1",name:"Claude Opus 4.6 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"us.anthropic.claude-opus-4-7":{id:"us.anthropic.claude-opus-4-7",name:"Claude Opus 4.7 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"us.anthropic.claude-opus-4-8":{id:"us.anthropic.claude-opus-4-8",name:"Claude Opus 4.8 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"us.anthropic.claude-sonnet-4-5-20250929-v1:0":{id:"us.anthropic.claude-sonnet-4-5-20250929-v1:0",name:"Claude Sonnet 4.5 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"us.anthropic.claude-sonnet-4-6":{id:"us.anthropic.claude-sonnet-4-6",name:"Claude Sonnet 4.6 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"us.deepseek.r1-v1:0":{id:"us.deepseek.r1-v1:0",name:"DeepSeek-R1 (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:1.35,output:5.4,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:32768},"us.meta.llama4-maverick-17b-instruct-v1:0":{id:"us.meta.llama4-maverick-17b-instruct-v1:0",name:"Llama 4 Maverick 17B Instruct (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.24,output:.97,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:16384},"us.meta.llama4-scout-17b-instruct-v1:0":{id:"us.meta.llama4-scout-17b-instruct-v1:0",name:"Llama 4 Scout 17B Instruct (US)",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!1,input:["text","image"],cost:{input:.17,output:.66,cacheRead:0,cacheWrite:0},contextWindow:35e5,maxTokens:16384},"writer.palmyra-x4-v1:0":{id:"writer.palmyra-x4-v1:0",name:"Palmyra X4",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:122880,maxTokens:8192},"writer.palmyra-x5-v1:0":{id:"writer.palmyra-x5-v1:0",name:"Palmyra X5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.6,output:6,cacheRead:0,cacheWrite:0},contextWindow:104e4,maxTokens:8192},"zai.glm-4.7":{id:"zai.glm-4.7",name:"GLM-4.7",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"zai.glm-4.7-flash":{id:"zai.glm-4.7-flash",name:"GLM-4.7-Flash",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:.07,output:.4,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131072},"zai.glm-5":{id:"zai.glm-5",name:"GLM-5",api:"bedrock-converse-stream",provider:"amazon-bedrock",baseUrl:"https://bedrock-runtime.us-east-1.amazonaws.com",reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:0,cacheWrite:0},contextWindow:202752,maxTokens:101376}},"ant-ling":{"Ling-2.6-1T":{id:"Ling-2.6-1T",name:"Ling 2.6 1T",api:"openai-completions",provider:"ant-ling",baseUrl:"https://api.ant-ling.com/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsLongCacheRetention:!1},reasoning:!1,input:["text"],cost:{input:.06,output:.25,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"Ling-2.6-flash":{id:"Ling-2.6-flash",name:"Ling 2.6 Flash",api:"openai-completions",provider:"ant-ling",baseUrl:"https://api.ant-ling.com/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsLongCacheRetention:!1},reasoning:!1,input:["text"],cost:{input:.01,output:.02,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"Ring-2.6-1T":{id:"Ring-2.6-1T",name:"Ring 2.6 1T",api:"openai-completions",provider:"ant-ling",baseUrl:"https://api.ant-ling.com/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsLongCacheRetention:!1,thinkingFormat:"ant-ling"},reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:null,medium:null,high:"high",xhigh:"xhigh"},input:["text"],cost:{input:.06,output:.25,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536}},anthropic:{"claude-3-5-haiku-20241022":{id:"claude-3-5-haiku-20241022",name:"Claude Haiku 3.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"claude-3-5-haiku-latest":{id:"claude-3-5-haiku-latest",name:"Claude Haiku 3.5 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"claude-3-5-sonnet-20240620":{id:"claude-3-5-sonnet-20240620",name:"Claude Sonnet 3.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:8192},"claude-3-5-sonnet-20241022":{id:"claude-3-5-sonnet-20241022",name:"Claude Sonnet 3.5 v2",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:8192},"claude-3-7-sonnet-20250219":{id:"claude-3-7-sonnet-20250219",name:"Claude Sonnet 3.7",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-3-haiku-20240307":{id:"claude-3-haiku-20240307",name:"Claude Haiku 3",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:.25,output:1.25,cacheRead:.03,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"claude-3-opus-20240229":{id:"claude-3-opus-20240229",name:"Claude Opus 3",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:4096},"claude-3-sonnet-20240229":{id:"claude-3-sonnet-20240229",name:"Claude Sonnet 3",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"claude-fable-5":{id:"claude-fable-5",name:"Claude Fable 5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",compat:{forceAdaptiveThinking:!0},reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:10,output:50,cacheRead:1,cacheWrite:12.5},contextWindow:1e6,maxTokens:128e3},"claude-haiku-4-5":{id:"claude-haiku-4-5",name:"Claude Haiku 4.5 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"claude-haiku-4-5-20251001":{id:"claude-haiku-4-5-20251001",name:"Claude Haiku 4.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-0":{id:"claude-opus-4-0",name:"Claude Opus 4 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-1":{id:"claude-opus-4-1",name:"Claude Opus 4.1 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-1-20250805":{id:"claude-opus-4-1-20250805",name:"Claude Opus 4.1",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-20250514":{id:"claude-opus-4-20250514",name:"Claude Opus 4",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-5":{id:"claude-opus-4-5",name:"Claude Opus 4.5 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-5-20251101":{id:"claude-opus-4-5-20251101",name:"Claude Opus 4.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-6":{id:"claude-opus-4-6",name:"Claude Opus 4.6",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",compat:{forceAdaptiveThinking:!0},reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-opus-4-7":{id:"claude-opus-4-7",name:"Claude Opus 4.7",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",compat:{forceAdaptiveThinking:!0,supportsTemperature:!1},reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-opus-4-8":{id:"claude-opus-4-8",name:"Claude Opus 4.8",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",compat:{forceAdaptiveThinking:!0,supportsTemperature:!1},reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-sonnet-4-0":{id:"claude-sonnet-4-0",name:"Claude Sonnet 4 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-20250514":{id:"claude-sonnet-4-20250514",name:"Claude Sonnet 4",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-5":{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5 (latest)",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-5-20250929":{id:"claude-sonnet-4-5-20250929",name:"Claude Sonnet 4.5",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-6":{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"anthropic",baseUrl:"https://api.anthropic.com",compat:{forceAdaptiveThinking:!0},reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3}},"azure-openai-responses":{"gpt-4":{id:"gpt-4",name:"GPT-4",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text"],cost:{input:30,output:60,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"gpt-4-turbo":{id:"gpt-4-turbo",name:"GPT-4 Turbo",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-4.1":{id:"gpt-4.1",name:"GPT-4.1",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4.1-mini":{id:"gpt-4.1-mini",name:"GPT-4.1 mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:.4,output:1.6,cacheRead:.1,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4.1-nano":{id:"gpt-4.1-nano",name:"GPT-4.1 nano",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.025,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4o":{id:"gpt-4o",name:"GPT-4o",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-2024-05-13":{id:"gpt-4o-2024-05-13",name:"GPT-4o (2024-05-13)",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:5,output:15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-4o-2024-08-06":{id:"gpt-4o-2024-08-06",name:"GPT-4o (2024-08-06)",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-2024-11-20":{id:"gpt-4o-2024-11-20",name:"GPT-4o (2024-11-20)",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-mini":{id:"gpt-4o-mini",name:"GPT-4o mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.075,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5":{id:"gpt-5",name:"GPT-5",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-chat-latest":{id:"gpt-5-chat-latest",name:"GPT-5 Chat Latest",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5-codex":{id:"gpt-5-codex",name:"GPT-5-Codex",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-mini":{id:"gpt-5-mini",name:"GPT-5 Mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-nano":{id:"gpt-5-nano",name:"GPT-5 Nano",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.05,output:.4,cacheRead:.005,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-pro":{id:"gpt-5-pro",name:"GPT-5 Pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:15,output:120,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1":{id:"gpt-5.1",name:"GPT-5.1",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-chat-latest":{id:"gpt-5.1-chat-latest",name:"GPT-5.1 Chat",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.1-codex":{id:"gpt-5.1-codex",name:"GPT-5.1 Codex",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-max":{id:"gpt-5.1-codex-max",name:"GPT-5.1 Codex Max",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-mini":{id:"gpt-5.1-codex-mini",name:"GPT-5.1 Codex mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-chat-latest":{id:"gpt-5.2-chat-latest",name:"GPT-5.2 Chat",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-pro":{id:"gpt-5.2-pro",name:"GPT-5.2 Pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:21,output:168,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-chat-latest":{id:"gpt-5.3-chat-latest",name:"GPT-5.3 Chat (latest)",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!1,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex-spark":{id:"gpt-5.3-codex-spark",name:"GPT-5.3 Codex Spark",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:32e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-nano":{id:"gpt-5.4-nano",name:"GPT-5.4 nano",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-pro":{id:"gpt-5.4-pro",name:"GPT-5.4 Pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"gpt-5.5-pro":{id:"gpt-5.5-pro",name:"GPT-5.5 Pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh",minimal:null,low:null},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},o1:{id:"o1",name:"o1",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o1-pro":{id:"o1-pro",name:"o1-pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:150,output:600,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},o3:{id:"o3",name:"o3",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-deep-research":{id:"o3-deep-research",name:"o3-deep-research",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:10,output:40,cacheRead:2.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-mini":{id:"o3-mini",name:"o3-mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-pro":{id:"o3-pro",name:"o3-pro",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o4-mini":{id:"o4-mini",name:"o4-mini",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o4-mini-deep-research":{id:"o4-mini-deep-research",name:"o4-mini-deep-research",api:"azure-openai-responses",provider:"azure-openai-responses",baseUrl:"",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5}},cerebras:{"gpt-oss-120b":{id:"gpt-oss-120b",name:"GPT OSS 120B",api:"openai-completions",provider:"cerebras",baseUrl:"https://api.cerebras.ai/v1",reasoning:!0,input:["text"],cost:{input:.35,output:.75,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:40960},"zai-glm-4.7":{id:"zai-glm-4.7",name:"Z.AI GLM-4.7",api:"openai-completions",provider:"cerebras",baseUrl:"https://api.cerebras.ai/v1",reasoning:!0,input:["text"],cost:{input:2.25,output:2.75,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:40960}},"cloudflare-ai-gateway":{"claude-3-5-haiku":{id:"claude-3-5-haiku",name:"Claude Haiku 3.5 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!1,input:["text","image"],cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"claude-3-haiku":{id:"claude-3-haiku",name:"Claude Haiku 3",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!1,input:["text","image"],cost:{input:.25,output:1.25,cacheRead:.03,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"claude-3-opus":{id:"claude-3-opus",name:"Claude Opus 3",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!1,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:4096},"claude-3-sonnet":{id:"claude-3-sonnet",name:"Claude Sonnet 3",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"claude-3.5-haiku":{id:"claude-3.5-haiku",name:"Claude Haiku 3.5 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!1,input:["text","image"],cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"claude-3.5-sonnet":{id:"claude-3.5-sonnet",name:"Claude Sonnet 3.5 v2",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!1,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:8192},"claude-fable-5":{id:"claude-fable-5",name:"Claude Fable 5",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",compat:{forceAdaptiveThinking:!0},reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:10,output:50,cacheRead:1,cacheWrite:12.5},contextWindow:1e6,maxTokens:128e3},"claude-haiku-4-5":{id:"claude-haiku-4-5",name:"Claude Haiku 4.5 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4":{id:"claude-opus-4",name:"Claude Opus 4 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-1":{id:"claude-opus-4-1",name:"Claude Opus 4.1 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-5":{id:"claude-opus-4-5",name:"Claude Opus 4.5 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-6":{id:"claude-opus-4-6",name:"Claude Opus 4.6 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",compat:{forceAdaptiveThinking:!0},reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-opus-4-7":{id:"claude-opus-4-7",name:"Claude Opus 4.7",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",compat:{forceAdaptiveThinking:!0,supportsTemperature:!1},reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-opus-4-8":{id:"claude-opus-4-8",name:"Claude Opus 4.8",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",compat:{forceAdaptiveThinking:!0,supportsTemperature:!1},reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-sonnet-4":{id:"claude-sonnet-4",name:"Claude Sonnet 4 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-5":{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5 (latest)",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-6":{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/anthropic",compat:{forceAdaptiveThinking:!0},reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"gpt-4":{id:"gpt-4",name:"GPT-4",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!1,input:["text"],cost:{input:30,output:60,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"gpt-4-turbo":{id:"gpt-4-turbo",name:"GPT-4 Turbo",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-4o":{id:"gpt-4o",name:"GPT-4o",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-mini":{id:"gpt-4o-mini",name:"GPT-4o mini",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.08,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.1":{id:"gpt-5.1",name:"GPT-5.1",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.13,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex":{id:"gpt-5.1-codex",name:"GPT-5.1 Codex",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},o1:{id:"o1",name:"o1",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},o3:{id:"o3",name:"o3",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-mini":{id:"o3-mini",name:"o3-mini",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-pro":{id:"o3-pro",name:"o3-pro",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o4-mini":{id:"o4-mini",name:"o4-mini",api:"openai-responses",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/openai",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.28,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"workers-ai/@cf/moonshotai/kimi-k2.5":{id:"workers-ai/@cf/moonshotai/kimi-k2.5",name:"Kimi K2.5",api:"openai-completions",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/compat",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.1,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"workers-ai/@cf/moonshotai/kimi-k2.6":{id:"workers-ai/@cf/moonshotai/kimi-k2.6",name:"Kimi K2.6",api:"openai-completions",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/compat",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"workers-ai/@cf/nvidia/nemotron-3-120b-a12b":{id:"workers-ai/@cf/nvidia/nemotron-3-120b-a12b",name:"Nemotron 3 Super 120B",api:"openai-completions",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/compat",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"workers-ai/@cf/zai-org/glm-4.7-flash":{id:"workers-ai/@cf/zai-org/glm-4.7-flash",name:"GLM-4.7-Flash",api:"openai-completions",provider:"cloudflare-ai-gateway",baseUrl:"https://gateway.ai.cloudflare.com/v1/{CLOUDFLARE_ACCOUNT_ID}/{CLOUDFLARE_GATEWAY_ID}/compat",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text"],cost:{input:.06,output:.4,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072}},"cloudflare-workers-ai":{"@cf/google/gemma-4-26b-a4b-it":{id:"@cf/google/gemma-4-26b-a4b-it",name:"Gemma 4 26B A4B IT",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text","image"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:16384},"@cf/ibm-granite/granite-4.0-h-micro":{id:"@cf/ibm-granite/granite-4.0-h-micro",name:"Granite 4.0 H Micro",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!1,input:["text"],cost:{input:.017,output:.112,cacheRead:0,cacheWrite:0},contextWindow:131e3,maxTokens:131e3},"@cf/meta/llama-3.3-70b-instruct-fp8-fast":{id:"@cf/meta/llama-3.3-70b-instruct-fp8-fast",name:"Llama 3.3 70B Instruct fp8 Fast",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!1,input:["text"],cost:{input:.293,output:2.253,cacheRead:0,cacheWrite:0},contextWindow:24e3,maxTokens:24e3},"@cf/meta/llama-4-scout-17b-16e-instruct":{id:"@cf/meta/llama-4-scout-17b-16e-instruct",name:"Llama 4 Scout 17B 16E Instruct",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!1,input:["text","image"],cost:{input:.27,output:.85,cacheRead:0,cacheWrite:0},contextWindow:131e3,maxTokens:16384},"@cf/mistralai/mistral-small-3.1-24b-instruct":{id:"@cf/mistralai/mistral-small-3.1-24b-instruct",name:"Mistral Small 3.1 24B Instruct",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!1,input:["text"],cost:{input:.351,output:.555,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"@cf/moonshotai/kimi-k2.6":{id:"@cf/moonshotai/kimi-k2.6",name:"Kimi K2.6",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262144,maxTokens:256e3},"@cf/moonshotai/kimi-k2.7-code":{id:"@cf/moonshotai/kimi-k2.7-code",name:"Kimi K2.7 Code",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.19,cacheWrite:0},contextWindow:262144,maxTokens:262144},"@cf/nvidia/nemotron-3-120b-a12b":{id:"@cf/nvidia/nemotron-3-120b-a12b",name:"Nemotron 3 Super 120B",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"@cf/openai/gpt-oss-120b":{id:"@cf/openai/gpt-oss-120b",name:"GPT OSS 120B",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text"],cost:{input:.35,output:.75,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"@cf/openai/gpt-oss-20b":{id:"@cf/openai/gpt-oss-20b",name:"GPT OSS 20B",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text"],cost:{input:.2,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"@cf/qwen/qwen3-30b-a3b-fp8":{id:"@cf/qwen/qwen3-30b-a3b-fp8",name:"Qwen3 30B A3b fp8",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text"],cost:{input:.0509,output:.335,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:32768},"@cf/zai-org/glm-4.7-flash":{id:"@cf/zai-org/glm-4.7-flash",name:"GLM-4.7-Flash",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text"],cost:{input:.0605,output:.4,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"@cf/zai-org/glm-5.2":{id:"@cf/zai-org/glm-5.2",name:"Glm 5.2",api:"openai-completions",provider:"cloudflare-workers-ai",baseUrl:"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1",compat:{sendSessionAffinityHeaders:!0},reasoning:!0,input:["text"],cost:{input:1.4,output:4.4,cacheRead:.26,cacheWrite:0},contextWindow:262144,maxTokens:262144}},deepseek:{"deepseek-v4-flash":{id:"deepseek-v4-flash",name:"DeepSeek V4 Flash",api:"openai-completions",provider:"deepseek",baseUrl:"https://api.deepseek.com",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:.14,output:.28,cacheRead:.0028,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"deepseek-v4-pro":{id:"deepseek-v4-pro",name:"DeepSeek V4 Pro",api:"openai-completions",provider:"deepseek",baseUrl:"https://api.deepseek.com",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:.435,output:.87,cacheRead:.003625,cacheWrite:0},contextWindow:1e6,maxTokens:384e3}},fireworks:{"accounts/fireworks/models/deepseek-v4-flash":{id:"accounts/fireworks/models/deepseek-v4-flash",name:"DeepSeek V4 Flash",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.14,output:.28,cacheRead:.028,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"accounts/fireworks/models/deepseek-v4-pro":{id:"accounts/fireworks/models/deepseek-v4-pro",name:"DeepSeek V4 Pro",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:1.74,output:3.48,cacheRead:.145,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"accounts/fireworks/models/glm-5p1":{id:"accounts/fireworks/models/glm-5p1",name:"GLM 5.1",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:1.4,output:4.4,cacheRead:.26,cacheWrite:0},contextWindow:202800,maxTokens:131072},"accounts/fireworks/models/glm-5p2":{id:"accounts/fireworks/models/glm-5p2",name:"GLM 5.2",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:1.4,output:4.4,cacheRead:.26,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"accounts/fireworks/models/gpt-oss-120b":{id:"accounts/fireworks/models/gpt-oss-120b",name:"GPT OSS 120B",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:.015,cacheWrite:0},contextWindow:131072,maxTokens:32768},"accounts/fireworks/models/gpt-oss-20b":{id:"accounts/fireworks/models/gpt-oss-20b",name:"GPT OSS 20B",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.07,output:.3,cacheRead:.035,cacheWrite:0},contextWindow:131072,maxTokens:32768},"accounts/fireworks/models/kimi-k2p6":{id:"accounts/fireworks/models/kimi-k2p6",name:"Kimi K2.6",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262e3,maxTokens:262e3},"accounts/fireworks/models/kimi-k2p7-code":{id:"accounts/fireworks/models/kimi-k2p7-code",name:"Kimi K2.7 Code",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.19,cacheWrite:0},contextWindow:262e3,maxTokens:262e3},"accounts/fireworks/models/minimax-m2p7":{id:"accounts/fireworks/models/minimax-m2p7",name:"MiniMax-M2.7",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:196608,maxTokens:196608},"accounts/fireworks/models/minimax-m3":{id:"accounts/fireworks/models/minimax-m3",name:"MiniMax-M3",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:512e3,maxTokens:512e3},"accounts/fireworks/models/qwen3p7-plus":{id:"accounts/fireworks/models/qwen3p7-plus",name:"Qwen 3.7 Plus",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:.4,output:1.6,cacheRead:.08,cacheWrite:0},contextWindow:262144,maxTokens:65536},"accounts/fireworks/routers/glm-5p1-fast":{id:"accounts/fireworks/routers/glm-5p1-fast",name:"GLM 5.1 Fast",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:2.8,output:8.8,cacheRead:.52,cacheWrite:0},contextWindow:202800,maxTokens:131072},"accounts/fireworks/routers/kimi-k2p6-fast":{id:"accounts/fireworks/routers/kimi-k2p6-fast",name:"Kimi K2.6 Fast",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.3,cacheWrite:0},contextWindow:262e3,maxTokens:262e3},"accounts/fireworks/routers/kimi-k2p6-turbo":{id:"accounts/fireworks/routers/kimi-k2p6-turbo",name:"Kimi K2.6 Turbo",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.3,cacheWrite:0},contextWindow:262e3,maxTokens:262e3},"accounts/fireworks/routers/kimi-k2p7-code-fast":{id:"accounts/fireworks/routers/kimi-k2p7-code-fast",name:"Kimi K2.7 Code Fast",api:"anthropic-messages",provider:"fireworks",baseUrl:"https://api.fireworks.ai/inference",compat:{sendSessionAffinityHeaders:!0,supportsEagerToolInputStreaming:!1,supportsCacheControlOnTools:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:1.9,output:8,cacheRead:.38,cacheWrite:0},contextWindow:262e3,maxTokens:262e3}},"github-copilot":{"claude-fable-5":{id:"claude-fable-5",name:"Claude Fable 5",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!0,input:["text","image"],cost:{input:10,output:50,cacheRead:1,cacheWrite:12.5},contextWindow:1e6,maxTokens:128e3},"claude-haiku-4.5":{id:"claude-haiku-4.5",name:"Claude Haiku 4.5 (latest)",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsEagerToolInputStreaming:!1},reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4.5":{id:"claude-opus-4.5",name:"Claude Opus 4.5 (latest)",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:32e3},"claude-opus-4.6":{id:"claude-opus-4.6",name:"Claude Opus 4.6",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{forceAdaptiveThinking:!0},reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:32e3},"claude-opus-4.7":{id:"claude-opus-4.7",name:"Claude Opus 4.7",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{forceAdaptiveThinking:!0,supportsTemperature:!1},reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:32e3},"claude-opus-4.8":{id:"claude-opus-4.8",name:"Claude Opus 4.8",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{forceAdaptiveThinking:!0,supportsTemperature:!1},reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4":{id:"claude-sonnet-4",name:"Claude Sonnet 4 (latest)",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsEagerToolInputStreaming:!1},reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:216e3,maxTokens:16e3},"claude-sonnet-4.5":{id:"claude-sonnet-4.5",name:"Claude Sonnet 4.5 (latest)",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsEagerToolInputStreaming:!1},reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:32e3},"claude-sonnet-4.6":{id:"claude-sonnet-4.6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{forceAdaptiveThinking:!0},reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:32e3},"gemini-2.5-pro":{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"gemini-3-flash-preview":{id:"gemini-3-flash-preview",name:"Gemini 3 Flash Preview",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"gemini-3.1-pro-preview":{id:"gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:2e5,maxTokens:64e3},"gemini-3.5-flash":{id:"gemini-3.5-flash",name:"Gemini 3.5 Flash",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!0,input:["text","image"],cost:{input:1.5,output:9,cacheRead:.15,cacheWrite:0},contextWindow:2e5,maxTokens:64e3},"gpt-4.1":{id:"gpt-4.1",name:"GPT-4.1",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5-mini":{id:"gpt-5-mini",name:"GPT-5 Mini",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low"},input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:264e3,maxTokens:64e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 mini",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-nano":{id:"gpt-5.4-nano",name:"GPT-5.4 nano",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},reasoning:!0,thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"raptor-mini":{id:"raptor-mini",name:"Raptor mini",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3}},google:{"gemini-2.0-flash":{id:"gemini-2.0-flash",name:"Gemini 2.0 Flash",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!1,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.025,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"gemini-2.0-flash-lite":{id:"gemini-2.0-flash-lite",name:"Gemini 2.0 Flash-Lite",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!1,input:["text","image"],cost:{input:.075,output:.3,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"gemini-2.5-flash":{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.03,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash-lite":{id:"gemini-2.5-flash-lite",name:"Gemini 2.5 Flash-Lite",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.01,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-pro":{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3-flash-preview":{id:"gemini-3-flash-preview",name:"Gemini 3 Flash Preview",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3-pro-preview":{id:"gemini-3-pro-preview",name:"Gemini 3 Pro Preview",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:"LOW",medium:null,high:"HIGH"},input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.1-flash-lite":{id:"gemini-3.1-flash-lite",name:"Gemini 3.1 Flash Lite",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.25,output:1.5,cacheRead:.025,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.1-flash-lite-preview":{id:"gemini-3.1-flash-lite-preview",name:"Gemini 3.1 Flash Lite Preview",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.25,output:1.5,cacheRead:.025,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.1-pro-preview":{id:"gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:"LOW",medium:null,high:"HIGH"},input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.1-pro-preview-customtools":{id:"gemini-3.1-pro-preview-customtools",name:"Gemini 3.1 Pro Preview Custom Tools",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:"LOW",medium:null,high:"HIGH"},input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.5-flash":{id:"gemini-3.5-flash",name:"Gemini 3.5 Flash",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.5,output:9,cacheRead:.15,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-flash-latest":{id:"gemini-flash-latest",name:"Gemini Flash Latest",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.075,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-flash-lite-latest":{id:"gemini-flash-lite-latest",name:"Gemini Flash-Lite Latest",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.025,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemma-4-26b-a4b-it":{id:"gemma-4-26b-a4b-it",name:"Gemma 4 26B A4B IT",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null,minimal:"MINIMAL",low:null,medium:null,high:"HIGH"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"gemma-4-31b-it":{id:"gemma-4-31b-it",name:"Gemma 4 31B IT",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null,minimal:"MINIMAL",low:null,medium:null,high:"HIGH"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"gemma-4-E2B-it":{id:"gemma-4-E2B-it",name:"Gemma 4 E2B IT",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null,minimal:"MINIMAL",low:null,medium:null,high:"HIGH"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"gemma-4-E4B-it":{id:"gemma-4-E4B-it",name:"Gemma 4 E4B IT",api:"google-generative-ai",provider:"google",baseUrl:"https://generativelanguage.googleapis.com/v1beta",reasoning:!0,thinkingLevelMap:{off:null,minimal:"MINIMAL",low:null,medium:null,high:"HIGH"},input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192}},"google-vertex":{"gemini-1.5-flash":{id:"gemini-1.5-flash",name:"Gemini 1.5 Flash (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!1,input:["text","image"],cost:{input:.075,output:.3,cacheRead:.01875,cacheWrite:0},contextWindow:1e6,maxTokens:8192},"gemini-1.5-flash-8b":{id:"gemini-1.5-flash-8b",name:"Gemini 1.5 Flash-8B (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!1,input:["text","image"],cost:{input:.0375,output:.15,cacheRead:.01,cacheWrite:0},contextWindow:1e6,maxTokens:8192},"gemini-1.5-pro":{id:"gemini-1.5-pro",name:"Gemini 1.5 Pro (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!1,input:["text","image"],cost:{input:1.25,output:5,cacheRead:.3125,cacheWrite:0},contextWindow:1e6,maxTokens:8192},"gemini-2.0-flash":{id:"gemini-2.0-flash",name:"Gemini 2.0 Flash (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.0375,cacheWrite:0},contextWindow:1048576,maxTokens:8192},"gemini-2.0-flash-lite":{id:"gemini-2.0-flash-lite",name:"Gemini 2.0 Flash Lite (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:.075,output:.3,cacheRead:.01875,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash":{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.03,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash-lite":{id:"gemini-2.5-flash-lite",name:"Gemini 2.5 Flash Lite (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.01,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-flash-lite-preview-09-2025":{id:"gemini-2.5-flash-lite-preview-09-2025",name:"Gemini 2.5 Flash Lite Preview 09-25 (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.01,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-2.5-pro":{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3-flash-preview":{id:"gemini-3-flash-preview",name:"Gemini 3 Flash Preview (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3-pro-preview":{id:"gemini-3-pro-preview",name:"Gemini 3 Pro Preview (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:"LOW",medium:null,high:"HIGH"},input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1e6,maxTokens:64e3},"gemini-3.1-pro-preview":{id:"gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:"LOW",medium:null,high:"HIGH"},input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.1-pro-preview-customtools":{id:"gemini-3.1-pro-preview-customtools",name:"Gemini 3.1 Pro Preview Custom Tools (Vertex)",api:"google-vertex",provider:"google-vertex",baseUrl:"https://{location}-aiplatform.googleapis.com",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:"LOW",medium:null,high:"HIGH"},input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536}},groq:{"llama-3.1-8b-instant":{id:"llama-3.1-8b-instant",name:"Llama 3.1 8B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:.05,output:.08,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"llama-3.3-70b-versatile":{id:"llama-3.3-70b-versatile",name:"Llama 3.3 70B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text"],cost:{input:.59,output:.79,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"meta-llama/llama-4-scout-17b-16e-instruct":{id:"meta-llama/llama-4-scout-17b-16e-instruct",name:"Llama 4 Scout 17B 16E",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!1,input:["text","image"],cost:{input:.11,output:.34,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"openai/gpt-oss-120b":{id:"openai/gpt-oss-120b",name:"GPT OSS 120B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:.075,cacheWrite:0},contextWindow:131072,maxTokens:65536},"openai/gpt-oss-20b":{id:"openai/gpt-oss-20b",name:"GPT OSS 20B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:.075,output:.3,cacheRead:.0375,cacheWrite:0},contextWindow:131072,maxTokens:65536},"openai/gpt-oss-safeguard-20b":{id:"openai/gpt-oss-safeguard-20b",name:"Safety GPT OSS 20B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,input:["text"],cost:{input:.075,output:.3,cacheRead:.037,cacheWrite:0},contextWindow:131072,maxTokens:65536},"qwen/qwen3-32b":{id:"qwen/qwen3-32b",name:"Qwen3-32B",api:"openai-completions",provider:"groq",baseUrl:"https://api.groq.com/openai/v1",reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"default"},input:["text"],cost:{input:.29,output:.59,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:40960}},huggingface:{"MiniMaxAI/MiniMax-M2.1":{id:"MiniMaxAI/MiniMax-M2.1",name:"MiniMax-M2.1",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"MiniMaxAI/MiniMax-M2.5":{id:"MiniMaxAI/MiniMax-M2.5",name:"MiniMax-M2.5",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:0},contextWindow:204800,maxTokens:131072},"MiniMaxAI/MiniMax-M2.7":{id:"MiniMaxAI/MiniMax-M2.7",name:"MiniMax-M2.7",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:204800,maxTokens:131072},"Qwen/Qwen3-235B-A22B-Thinking-2507":{id:"Qwen/Qwen3-235B-A22B-Thinking-2507",name:"Qwen3-235B-A22B-Thinking-2507",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.3,output:3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"Qwen/Qwen3-Coder-480B-A35B-Instruct":{id:"Qwen/Qwen3-Coder-480B-A35B-Instruct",name:"Qwen3-Coder-480B-A35B-Instruct",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:2,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:66536},"Qwen/Qwen3-Coder-Next":{id:"Qwen/Qwen3-Coder-Next",name:"Qwen3-Coder-Next",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:.2,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"Qwen/Qwen3-Next-80B-A3B-Instruct":{id:"Qwen/Qwen3-Next-80B-A3B-Instruct",name:"Qwen3-Next-80B-A3B-Instruct",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:.25,output:1,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:66536},"Qwen/Qwen3-Next-80B-A3B-Thinking":{id:"Qwen/Qwen3-Next-80B-A3B-Thinking",name:"Qwen3-Next-80B-A3B-Thinking",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:.3,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"Qwen/Qwen3.5-397B-A17B":{id:"Qwen/Qwen3.5-397B-A17B",name:"Qwen3.5-397B-A17B",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text","image"],cost:{input:.6,output:3.6,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"XiaomiMiMo/MiMo-V2-Flash":{id:"XiaomiMiMo/MiMo-V2-Flash",name:"MiMo-V2-Flash",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"deepseek-ai/DeepSeek-R1-0528":{id:"deepseek-ai/DeepSeek-R1-0528",name:"DeepSeek-R1-0528",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:3,output:5,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:163840},"deepseek-ai/DeepSeek-V3.2":{id:"deepseek-ai/DeepSeek-V3.2",name:"DeepSeek-V3.2",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.28,output:.4,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:65536},"deepseek-ai/DeepSeek-V4-Pro":{id:"deepseek-ai/DeepSeek-V4-Pro",name:"DeepSeek V4 Pro",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.435,output:.87,cacheRead:.003625,cacheWrite:0},contextWindow:1048576,maxTokens:393216},"moonshotai/Kimi-K2-Instruct":{id:"moonshotai/Kimi-K2-Instruct",name:"Kimi-K2-Instruct",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:1,output:3,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"moonshotai/Kimi-K2-Instruct-0905":{id:"moonshotai/Kimi-K2-Instruct-0905",name:"Kimi-K2-Instruct-0905",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!1,input:["text"],cost:{input:1,output:3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:16384},"moonshotai/Kimi-K2-Thinking":{id:"moonshotai/Kimi-K2-Thinking",name:"Kimi-K2-Thinking",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"moonshotai/Kimi-K2.5":{id:"moonshotai/Kimi-K2.5",name:"Kimi-K2.5",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.1,cacheWrite:0},contextWindow:262144,maxTokens:262144},"moonshotai/Kimi-K2.6":{id:"moonshotai/Kimi-K2.6",name:"Kimi-K2.6",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262144,maxTokens:262144},"zai-org/GLM-4.7":{id:"zai-org/GLM-4.7",name:"GLM-4.7",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:204800,maxTokens:131072},"zai-org/GLM-4.7-Flash":{id:"zai-org/GLM-4.7-Flash",name:"GLM-4.7-Flash",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:128e3},"zai-org/GLM-5":{id:"zai-org/GLM-5",name:"GLM-5",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:202752,maxTokens:131072},"zai-org/GLM-5.1":{id:"zai-org/GLM-5.1",name:"GLM-5.1",api:"openai-completions",provider:"huggingface",baseUrl:"https://router.huggingface.co/v1",compat:{supportsDeveloperRole:!1},reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:202752,maxTokens:131072}},"kimi-coding":{k2p7:{id:"k2p7",name:"Kimi K2.7 Code",api:"anthropic-messages",provider:"kimi-coding",baseUrl:"https://api.kimi.com/coding",headers:{"User-Agent":"KimiCLI/1.5"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"kimi-for-coding":{id:"kimi-for-coding",name:"Kimi For Coding",api:"anthropic-messages",provider:"kimi-coding",baseUrl:"https://api.kimi.com/coding",headers:{"User-Agent":"KimiCLI/1.5"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"kimi-k2-thinking":{id:"kimi-k2-thinking",name:"Kimi K2 Thinking",api:"anthropic-messages",provider:"kimi-coding",baseUrl:"https://api.kimi.com/coding",headers:{"User-Agent":"KimiCLI/1.5"},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768}},minimax:{"MiniMax-M2.7":{id:"MiniMax-M2.7",name:"MiniMax-M2.7",api:"anthropic-messages",provider:"minimax",baseUrl:"https://api.minimax.io/anthropic",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"MiniMax-M2.7-highspeed":{id:"MiniMax-M2.7-highspeed",name:"MiniMax-M2.7-highspeed",api:"anthropic-messages",provider:"minimax",baseUrl:"https://api.minimax.io/anthropic",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"MiniMax-M3":{id:"MiniMax-M3",name:"MiniMax-M3",api:"anthropic-messages",provider:"minimax",baseUrl:"https://api.minimax.io/anthropic",reasoning:!0,input:["text","image"],cost:{input:.6,output:2.4,cacheRead:.12,cacheWrite:0},contextWindow:512e3,maxTokens:128e3}},"minimax-cn":{"MiniMax-M2.7":{id:"MiniMax-M2.7",name:"MiniMax-M2.7",api:"anthropic-messages",provider:"minimax-cn",baseUrl:"https://api.minimaxi.com/anthropic",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"MiniMax-M2.7-highspeed":{id:"MiniMax-M2.7-highspeed",name:"MiniMax-M2.7-highspeed",api:"anthropic-messages",provider:"minimax-cn",baseUrl:"https://api.minimaxi.com/anthropic",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"MiniMax-M3":{id:"MiniMax-M3",name:"MiniMax-M3",api:"anthropic-messages",provider:"minimax-cn",baseUrl:"https://api.minimaxi.com/anthropic",reasoning:!0,input:["text","image"],cost:{input:.6,output:2.4,cacheRead:.12,cacheWrite:0},contextWindow:512e3,maxTokens:128e3}},mistral:{"codestral-latest":{id:"codestral-latest",name:"Codestral (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.3,output:.9,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"devstral-2512":{id:"devstral-2512",name:"Devstral 2",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"devstral-latest":{id:"devstral-latest",name:"Devstral 2",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"devstral-medium-2507":{id:"devstral-medium-2507",name:"Devstral Medium",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"devstral-medium-latest":{id:"devstral-medium-latest",name:"Devstral 2 (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"devstral-small-2505":{id:"devstral-small-2505",name:"Devstral Small 2505",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"devstral-small-2507":{id:"devstral-small-2507",name:"Devstral Small",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"labs-devstral-small-2512":{id:"labs-devstral-small-2512",name:"Devstral Small 2",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"magistral-medium-latest":{id:"magistral-medium-latest",name:"Magistral Medium (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text"],cost:{input:2,output:5,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"magistral-small":{id:"magistral-small",name:"Magistral Small",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"ministral-3b-latest":{id:"ministral-3b-latest",name:"Ministral 3B (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.04,output:.04,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"ministral-8b-latest":{id:"ministral-8b-latest",name:"Ministral 8B (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.1,output:.1,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"mistral-large-2411":{id:"mistral-large-2411",name:"Mistral Large 2.1",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"mistral-large-2512":{id:"mistral-large-2512",name:"Mistral Large 3",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-large-latest":{id:"mistral-large-latest",name:"Mistral Large (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-medium-2505":{id:"mistral-medium-2505",name:"Mistral Medium 3",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"mistral-medium-2508":{id:"mistral-medium-2508",name:"Mistral Medium 3.1",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-medium-2604":{id:"mistral-medium-2604",name:"Mistral Medium 3.5",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text","image"],cost:{input:1.5,output:7.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-medium-3.5":{id:"mistral-medium-3.5",name:"Mistral Medium 3.5",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text","image"],cost:{input:1.5,output:7.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-medium-latest":{id:"mistral-medium-latest",name:"Mistral Medium (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistral-nemo":{id:"mistral-nemo",name:"Mistral Nemo",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"mistral-small-2506":{id:"mistral-small-2506",name:"Mistral Small 3.2",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"mistral-small-2603":{id:"mistral-small-2603",name:"Mistral Small 4",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text","image"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"mistral-small-latest":{id:"mistral-small-latest",name:"Mistral Small (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!0,input:["text","image"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"open-mistral-7b":{id:"open-mistral-7b",name:"Mistral 7B",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.25,output:.25,cacheRead:0,cacheWrite:0},contextWindow:8e3,maxTokens:8e3},"open-mistral-nemo":{id:"open-mistral-nemo",name:"Open Mistral Nemo",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"open-mixtral-8x22b":{id:"open-mixtral-8x22b",name:"Mixtral 8x22B",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:64e3,maxTokens:64e3},"open-mixtral-8x7b":{id:"open-mixtral-8x7b",name:"Mixtral 8x7B",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text"],cost:{input:.7,output:.7,cacheRead:0,cacheWrite:0},contextWindow:32e3,maxTokens:32e3},"pixtral-12b":{id:"pixtral-12b",name:"Pixtral 12B",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"pixtral-large-latest":{id:"pixtral-large-latest",name:"Pixtral Large (latest)",api:"mistral-conversations",provider:"mistral",baseUrl:"https://api.mistral.ai",reasoning:!1,input:["text","image"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3}},moonshotai:{"kimi-k2-0711-preview":{id:"kimi-k2-0711-preview",name:"Kimi K2 0711",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!1,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:131072,maxTokens:16384},"kimi-k2-0905-preview":{id:"kimi-k2-0905-preview",name:"Kimi K2 0905",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!1,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2-thinking":{id:"kimi-k2-thinking",name:"Kimi K2 Thinking",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2-thinking-turbo":{id:"kimi-k2-thinking-turbo",name:"Kimi K2 Thinking Turbo",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1.15,output:8,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2-turbo-preview":{id:"kimi-k2-turbo-preview",name:"Kimi K2 Turbo",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!1,input:["text"],cost:{input:2.4,output:10,cacheRead:.6,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2.5":{id:"kimi-k2.5",name:"Kimi K2.5",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.1,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2.6":{id:"kimi-k2.6",name:"Kimi K2.6",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2.7-code":{id:"kimi-k2.7-code",name:"Kimi K2.7 Code",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.19,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2.7-code-highspeed":{id:"kimi-k2.7-code-highspeed",name:"Kimi K2.7 Code HighSpeed",api:"openai-completions",provider:"moonshotai",baseUrl:"https://api.moonshot.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:1.9,output:8,cacheRead:.38,cacheWrite:0},contextWindow:262144,maxTokens:262144}},"moonshotai-cn":{"kimi-k2-0711-preview":{id:"kimi-k2-0711-preview",name:"Kimi K2 0711",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!1,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:131072,maxTokens:16384},"kimi-k2-0905-preview":{id:"kimi-k2-0905-preview",name:"Kimi K2 0905",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!1,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2-thinking":{id:"kimi-k2-thinking",name:"Kimi K2 Thinking",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2-thinking-turbo":{id:"kimi-k2-thinking-turbo",name:"Kimi K2 Thinking Turbo",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1.15,output:8,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2-turbo-preview":{id:"kimi-k2-turbo-preview",name:"Kimi K2 Turbo",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!1,input:["text"],cost:{input:2.4,output:10,cacheRead:.6,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2.5":{id:"kimi-k2.5",name:"Kimi K2.5",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.1,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2.6":{id:"kimi-k2.6",name:"Kimi K2.6",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2.7-code":{id:"kimi-k2.7-code",name:"Kimi K2.7 Code",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.19,cacheWrite:0},contextWindow:262144,maxTokens:262144},"kimi-k2.7-code-highspeed":{id:"kimi-k2.7-code-highspeed",name:"Kimi K2.7 Code HighSpeed",api:"openai-completions",provider:"moonshotai-cn",baseUrl:"https://api.moonshot.cn/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:1.9,output:8,cacheRead:.38,cacheWrite:0},contextWindow:262144,maxTokens:262144}},nvidia:{"meta/llama-3.1-70b-instruct":{id:"meta/llama-3.1-70b-instruct",name:"Llama 3.1 70b Instruct",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta/llama-3.1-8b-instruct":{id:"meta/llama-3.1-8b-instruct",name:"Llama 3.1 8B Instruct",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:16e3,maxTokens:4096},"meta/llama-3.2-11b-vision-instruct":{id:"meta/llama-3.2-11b-vision-instruct",name:"Llama 3.2 11b Vision Instruct",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"meta/llama-3.2-90b-vision-instruct":{id:"meta/llama-3.2-90b-vision-instruct",name:"Llama-3.2-90B-Vision-Instruct",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-3.3-70b-instruct":{id:"meta/llama-3.3-70b-instruct",name:"Llama 3.3 70b Instruct",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistralai/mistral-large-3-675b-instruct-2512":{id:"mistralai/mistral-large-3-675b-instruct-2512",name:"Mistral Large 3 675B Instruct 2512",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mistralai/mistral-small-4-119b-2603":{id:"mistralai/mistral-small-4-119b-2603",name:"mistral-small-4-119b-2603",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"moonshotai/kimi-k2.6":{id:"moonshotai/kimi-k2.6",name:"Kimi K2.6",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"nvidia/nemotron-3-nano-30b-a3b":{id:"nvidia/nemotron-3-nano-30b-a3b",name:"nemotron-3-nano-30b-a3b",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"nvidia/nemotron-3-nano-omni-30b-a3b-reasoning":{id:"nvidia/nemotron-3-nano-omni-30b-a3b-reasoning",name:"Nemotron 3 Nano Omni",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:65536},"nvidia/nemotron-3-super-120b-a12b":{id:"nvidia/nemotron-3-super-120b-a12b",name:"Nemotron 3 Super",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.2,output:.8,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"nvidia/nemotron-3-ultra-550b-a55b":{id:"nvidia/nemotron-3-ultra-550b-a55b",name:"Nemotron 3 Ultra 550B A55B",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.5,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"nvidia/nvidia-nemotron-nano-9b-v2":{id:"nvidia/nvidia-nemotron-nano-9b-v2",name:"nvidia-nemotron-nano-9b-v2",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"openai/gpt-oss-120b":{id:"openai/gpt-oss-120b",name:"GPT-OSS-120B",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"openai/gpt-oss-20b":{id:"openai/gpt-oss-20b",name:"GPT OSS 20B",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"qwen/qwen3.5-122b-a10b":{id:"qwen/qwen3.5-122b-a10b",name:"Qwen3.5 122B-A10B",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"stepfun-ai/step-3.5-flash":{id:"stepfun-ai/step-3.5-flash",name:"Step 3.5 Flash",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:16384},"stepfun-ai/step-3.7-flash":{id:"stepfun-ai/step-3.7-flash",name:"Step 3.7 Flash",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:16384},"z-ai/glm-5.1":{id:"z-ai/glm-5.1",name:"GLM-5.1",api:"openai-completions",provider:"nvidia",baseUrl:"https://integrate.api.nvidia.com/v1",headers:{"NVCF-POLL-SECONDS":"3600"},compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072}},openai:{"gpt-4":{id:"gpt-4",name:"GPT-4",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text"],cost:{input:30,output:60,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192},"gpt-4-turbo":{id:"gpt-4-turbo",name:"GPT-4 Turbo",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-4.1":{id:"gpt-4.1",name:"GPT-4.1",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4.1-mini":{id:"gpt-4.1-mini",name:"GPT-4.1 mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:.4,output:1.6,cacheRead:.1,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4.1-nano":{id:"gpt-4.1-nano",name:"GPT-4.1 nano",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.025,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"gpt-4o":{id:"gpt-4o",name:"GPT-4o",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-2024-05-13":{id:"gpt-4o-2024-05-13",name:"GPT-4o (2024-05-13)",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:5,output:15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"gpt-4o-2024-08-06":{id:"gpt-4o-2024-08-06",name:"GPT-4o (2024-08-06)",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-2024-11-20":{id:"gpt-4o-2024-11-20",name:"GPT-4o (2024-11-20)",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-4o-mini":{id:"gpt-4o-mini",name:"GPT-4o mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.075,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5":{id:"gpt-5",name:"GPT-5",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-chat-latest":{id:"gpt-5-chat-latest",name:"GPT-5 Chat Latest",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5-codex":{id:"gpt-5-codex",name:"GPT-5-Codex",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-mini":{id:"gpt-5-mini",name:"GPT-5 Mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-nano":{id:"gpt-5-nano",name:"GPT-5 Nano",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.05,output:.4,cacheRead:.005,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-pro":{id:"gpt-5-pro",name:"GPT-5 Pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:15,output:120,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1":{id:"gpt-5.1",name:"GPT-5.1",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:"none"},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-chat-latest":{id:"gpt-5.1-chat-latest",name:"GPT-5.1 Chat",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.1-codex":{id:"gpt-5.1-codex",name:"GPT-5.1 Codex",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-max":{id:"gpt-5.1-codex-max",name:"GPT-5.1 Codex Max",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-mini":{id:"gpt-5.1-codex-mini",name:"GPT-5.1 Codex mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:"none",xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-chat-latest":{id:"gpt-5.2-chat-latest",name:"GPT-5.2 Chat",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-pro":{id:"gpt-5.2-pro",name:"GPT-5.2 Pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:21,output:168,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-chat-latest":{id:"gpt-5.3-chat-latest",name:"GPT-5.3 Chat (latest)",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:"none",xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex-spark":{id:"gpt-5.3-codex-spark",name:"GPT-5.3 Codex Spark",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:32e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:"none",xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:"none",xhigh:"xhigh"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-nano":{id:"gpt-5.4-nano",name:"GPT-5.4 nano",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:"none",xhigh:"xhigh"},input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-pro":{id:"gpt-5.4-pro",name:"GPT-5.4 Pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:"none",xhigh:"xhigh",minimal:null},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.5-pro":{id:"gpt-5.5-pro",name:"GPT-5.5 Pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh",minimal:null,low:null},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},o1:{id:"o1",name:"o1",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o1-pro":{id:"o1-pro",name:"o1-pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:150,output:600,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},o3:{id:"o3",name:"o3",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-deep-research":{id:"o3-deep-research",name:"o3-deep-research",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:10,output:40,cacheRead:2.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-mini":{id:"o3-mini",name:"o3-mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o3-pro":{id:"o3-pro",name:"o3-pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o4-mini":{id:"o4-mini",name:"o4-mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"o4-mini-deep-research":{id:"o4-mini-deep-research",name:"o4-mini-deep-research",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5}},"openai-codex":{"gpt-5.3-codex-spark":{id:"gpt-5.3-codex-spark",name:"GPT-5.3 Codex Spark",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh",minimal:"low"},input:["text"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh",minimal:"low"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 mini",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh",minimal:"low"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",api:"openai-codex-responses",provider:"openai-codex",baseUrl:"https://chatgpt.com/backend-api",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh",minimal:"low"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:272e3,maxTokens:128e3}},opencode:{"big-pickle":{id:"big-pickle",name:"Big Pickle",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{maxTokensField:"max_tokens"},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:32e3},"claude-haiku-4-5":{id:"claude-haiku-4-5",name:"Claude Haiku 4.5",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-1":{id:"claude-opus-4-1",name:"Claude Opus 4.1",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"claude-opus-4-5":{id:"claude-opus-4-5",name:"Claude Opus 4.5",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"claude-opus-4-6":{id:"claude-opus-4-6",name:"Claude Opus 4.6",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",compat:{forceAdaptiveThinking:!0},reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-opus-4-7":{id:"claude-opus-4-7",name:"Claude Opus 4.7",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",compat:{forceAdaptiveThinking:!0,supportsTemperature:!1},reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-opus-4-8":{id:"claude-opus-4-8",name:"Claude Opus 4.8",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",compat:{forceAdaptiveThinking:!0,supportsTemperature:!1},reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"claude-sonnet-4":{id:"claude-sonnet-4",name:"Claude Sonnet 4",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-5":{id:"claude-sonnet-4-5",name:"Claude Sonnet 4.5",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3},"claude-sonnet-4-6":{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",compat:{forceAdaptiveThinking:!0},reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"deepseek-v4-flash":{id:"deepseek-v4-flash",name:"DeepSeek V4 Flash",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{maxTokensField:"max_tokens",supportsLongCacheRetention:!1,requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:.14,output:.28,cacheRead:.028,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"deepseek-v4-flash-free":{id:"deepseek-v4-flash-free",name:"DeepSeek V4 Flash Free",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{maxTokensField:"max_tokens",requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:128e3},"deepseek-v4-pro":{id:"deepseek-v4-pro",name:"DeepSeek V4 Pro",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{maxTokensField:"max_tokens",supportsLongCacheRetention:!1,requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:1.74,output:3.84,cacheRead:.145,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"gemini-3-flash":{id:"gemini-3-flash",name:"Gemini 3 Flash",api:"google-generative-ai",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.1-pro":{id:"gemini-3.1-pro",name:"Gemini 3.1 Pro Preview",api:"google-generative-ai",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:"LOW",medium:null,high:"HIGH"},input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"gemini-3.5-flash":{id:"gemini-3.5-flash",name:"Gemini 3.5 Flash",api:"google-generative-ai",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.5,output:9,cacheRead:.15,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"glm-5":{id:"glm-5",name:"GLM-5",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{maxTokensField:"max_tokens"},reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:204800,maxTokens:131072},"glm-5.1":{id:"glm-5.1",name:"GLM-5.1",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{maxTokensField:"max_tokens"},reasoning:!0,input:["text"],cost:{input:1.4,output:4.4,cacheRead:.26,cacheWrite:0},contextWindow:204800,maxTokens:131072},"gpt-5":{id:"gpt-5",name:"GPT-5",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.07,output:8.5,cacheRead:.107,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-codex":{id:"gpt-5-codex",name:"GPT-5 Codex",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.07,output:8.5,cacheRead:.107,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5-nano":{id:"gpt-5-nano",name:"GPT-5 Nano",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.05,output:.4,cacheRead:.005,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1":{id:"gpt-5.1",name:"GPT-5.1",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.07,output:8.5,cacheRead:.107,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex":{id:"gpt-5.1-codex",name:"GPT-5.1 Codex",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.07,output:8.5,cacheRead:.107,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-max":{id:"gpt-5.1-codex-max",name:"GPT-5.1 Codex Max",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.1-codex-mini":{id:"gpt-5.1-codex-mini",name:"GPT-5.1 Codex Mini",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:272e3,maxTokens:128e3},"gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 Mini",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-nano":{id:"gpt-5.4-nano",name:"GPT-5.4 Nano",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"gpt-5.4-pro":{id:"gpt-5.4-pro",name:"GPT-5.4 Pro",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:30,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"gpt-5.5-pro":{id:"gpt-5.5-pro",name:"GPT-5.5 Pro",api:"openai-responses",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",reasoning:!0,thinkingLevelMap:{off:null,xhigh:"xhigh",minimal:null,low:null},input:["text","image"],cost:{input:30,output:180,cacheRead:30,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"grok-build-0.1":{id:"grok-build-0.1",name:"Grok Build 0.1",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{supportsReasoningEffort:!1,maxTokensField:"max_tokens"},reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:null,medium:null},input:["text","image"],cost:{input:1,output:2,cacheRead:.2,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"kimi-k2.5":{id:"kimi-k2.5",name:"Kimi K2.5",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{maxTokensField:"max_tokens",supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.08,cacheWrite:0},contextWindow:262144,maxTokens:65536},"kimi-k2.6":{id:"kimi-k2.6",name:"Kimi K2.6",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{thinkingFormat:"deepseek",supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsLongCacheRetention:!1},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262144,maxTokens:65536},"mimo-v2.5-free":{id:"mimo-v2.5-free",name:"MiMo V2.5 Free",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{maxTokensField:"max_tokens"},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:32e3},"minimax-m2.5":{id:"minimax-m2.5",name:"MiniMax M2.5",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{maxTokensField:"max_tokens"},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:204800,maxTokens:131072},"minimax-m2.7":{id:"minimax-m2.7",name:"MiniMax M2.7",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{maxTokensField:"max_tokens",supportsLongCacheRetention:!1},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:204800,maxTokens:131072},"nemotron-3-ultra-free":{id:"nemotron-3-ultra-free",name:"Nemotron 3 Ultra Free",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{maxTokensField:"max_tokens"},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:128e3},"north-mini-code-free":{id:"north-mini-code-free",name:"North Mini Code Free",api:"openai-completions",provider:"opencode",baseUrl:"https://opencode.ai/zen/v1",compat:{maxTokensField:"max_tokens"},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:64e3},"qwen3.5-plus":{id:"qwen3.5-plus",name:"Qwen3.5 Plus",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:.2,output:1.2,cacheRead:.02,cacheWrite:.25},contextWindow:262144,maxTokens:65536},"qwen3.6-plus":{id:"qwen3.6-plus",name:"Qwen3.6 Plus",api:"anthropic-messages",provider:"opencode",baseUrl:"https://opencode.ai/zen",reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:.625},contextWindow:262144,maxTokens:65536}},"opencode-go":{"deepseek-v4-flash":{id:"deepseek-v4-flash",name:"DeepSeek V4 Flash",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",compat:{maxTokensField:"max_tokens",requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:.14,output:.28,cacheRead:.0028,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"deepseek-v4-pro":{id:"deepseek-v4-pro",name:"DeepSeek V4 Pro",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",compat:{maxTokensField:"max_tokens",requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"max"},input:["text"],cost:{input:1.74,output:3.48,cacheRead:.0145,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"glm-5":{id:"glm-5",name:"GLM-5",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",compat:{maxTokensField:"max_tokens"},reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:202752,maxTokens:32768},"glm-5.1":{id:"glm-5.1",name:"GLM-5.1",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",compat:{maxTokensField:"max_tokens"},reasoning:!0,input:["text"],cost:{input:1.4,output:4.4,cacheRead:.26,cacheWrite:0},contextWindow:202752,maxTokens:32768},"kimi-k2.6":{id:"kimi-k2.6",name:"Kimi K2.6",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",compat:{thinkingFormat:"deepseek",supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsLongCacheRetention:!1},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262144,maxTokens:65536},"kimi-k2.7-code":{id:"kimi-k2.7-code",name:"Kimi K2.7 Code",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",compat:{maxTokensField:"max_tokens"},reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.19,cacheWrite:0},contextWindow:262144,maxTokens:262144},"mimo-v2.5":{id:"mimo-v2.5",name:"MiMo V2.5",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",compat:{maxTokensField:"max_tokens"},reasoning:!0,input:["text","image"],cost:{input:.14,output:.28,cacheRead:.0028,cacheWrite:0},contextWindow:1e6,maxTokens:128e3},"mimo-v2.5-pro":{id:"mimo-v2.5-pro",name:"MiMo V2.5 Pro",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",compat:{maxTokensField:"max_tokens"},reasoning:!0,input:["text"],cost:{input:1.74,output:3.48,cacheRead:.0145,cacheWrite:0},contextWindow:1048576,maxTokens:128e3},"minimax-m2.7":{id:"minimax-m2.7",name:"MiniMax M2.7",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",compat:{maxTokensField:"max_tokens"},reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:204800,maxTokens:131072},"minimax-m3":{id:"minimax-m3",name:"MiniMax M3 (3x usage)",api:"anthropic-messages",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.02,cacheWrite:0},contextWindow:512e3,maxTokens:131072},"qwen3.6-plus":{id:"qwen3.6-plus",name:"Qwen3.6 Plus",api:"openai-completions",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go/v1",compat:{thinkingFormat:"qwen",maxTokensField:"max_tokens"},reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:.625},contextWindow:1e6,maxTokens:65536},"qwen3.7-max":{id:"qwen3.7-max",name:"Qwen3.7 Max",api:"anthropic-messages",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go",reasoning:!0,input:["text"],cost:{input:2.5,output:7.5,cacheRead:.5,cacheWrite:3.125},contextWindow:1e6,maxTokens:65536},"qwen3.7-plus":{id:"qwen3.7-plus",name:"Qwen3.7 Plus",api:"anthropic-messages",provider:"opencode-go",baseUrl:"https://opencode.ai/zen/go",reasoning:!0,input:["text","image"],cost:{input:.4,output:1.6,cacheRead:.04,cacheWrite:.5},contextWindow:1e6,maxTokens:65536}},openrouter:{"ai21/jamba-large-1.7":{id:"ai21/jamba-large-1.7",name:"AI21: Jamba Large 1.7",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2,output:8,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"amazon/nova-2-lite-v1":{id:"amazon/nova-2-lite-v1",name:"Amazon: Nova 2 Lite",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:65535},"amazon/nova-lite-v1":{id:"amazon/nova-lite-v1",name:"Amazon: Nova Lite 1.0",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.06,output:.24,cacheRead:0,cacheWrite:0},contextWindow:3e5,maxTokens:5120},"amazon/nova-micro-v1":{id:"amazon/nova-micro-v1",name:"Amazon: Nova Micro 1.0",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.035,output:.14,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:5120},"amazon/nova-premier-v1":{id:"amazon/nova-premier-v1",name:"Amazon: Nova Premier 1.0",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:12.5,cacheRead:.625,cacheWrite:0},contextWindow:1e6,maxTokens:32e3},"amazon/nova-pro-v1":{id:"amazon/nova-pro-v1",name:"Amazon: Nova Pro 1.0",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.8,output:3.2,cacheRead:0,cacheWrite:0},contextWindow:3e5,maxTokens:5120},"anthropic/claude-3-haiku":{id:"anthropic/claude-3-haiku",name:"Anthropic: Claude 3 Haiku",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.25,output:1.25,cacheRead:.03,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"anthropic/claude-3.5-haiku":{id:"anthropic/claude-3.5-haiku",name:"Anthropic: Claude 3.5 Haiku",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"anthropic/claude-fable-5":{id:"anthropic/claude-fable-5",name:"Anthropic: Claude Fable 5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:10,output:50,cacheRead:1,cacheWrite:12.5},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-haiku-4.5":{id:"anthropic/claude-haiku-4.5",name:"Anthropic: Claude Haiku 4.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-opus-4":{id:"anthropic/claude-opus-4",name:"Anthropic: Claude Opus 4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic/claude-opus-4.1":{id:"anthropic/claude-opus-4.1",name:"Anthropic: Claude Opus 4.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic/claude-opus-4.5":{id:"anthropic/claude-opus-4.5",name:"Anthropic: Claude Opus 4.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-opus-4.6":{id:"anthropic/claude-opus-4.6",name:"Anthropic: Claude Opus 4.6",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-opus-4.6-fast":{id:"anthropic/claude-opus-4.6-fast",name:"Anthropic: Claude Opus 4.6 (Fast)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:30,output:150,cacheRead:3,cacheWrite:37.5},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-opus-4.7":{id:"anthropic/claude-opus-4.7",name:"Anthropic: Claude Opus 4.7",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-opus-4.7-fast":{id:"anthropic/claude-opus-4.7-fast",name:"Anthropic: Claude Opus 4.7 (Fast)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:150,cacheRead:3,cacheWrite:37.5},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-opus-4.8":{id:"anthropic/claude-opus-4.8",name:"Anthropic: Claude Opus 4.8",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-opus-4.8-fast":{id:"anthropic/claude-opus-4.8-fast",name:"Anthropic: Claude Opus 4.8 (Fast)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:10,output:50,cacheRead:1,cacheWrite:12.5},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-sonnet-4":{id:"anthropic/claude-sonnet-4",name:"Anthropic: Claude Sonnet 4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"anthropic/claude-sonnet-4.5":{id:"anthropic/claude-sonnet-4.5",name:"Anthropic: Claude Sonnet 4.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"anthropic/claude-sonnet-4.6":{id:"anthropic/claude-sonnet-4.6",name:"Anthropic: Claude Sonnet 4.6",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:128e3},"arcee-ai/trinity-large-thinking":{id:"arcee-ai/trinity-large-thinking",name:"Arcee AI: Trinity Large Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.22,output:.85,cacheRead:.06,cacheWrite:0},contextWindow:262144,maxTokens:262144},"arcee-ai/trinity-mini":{id:"arcee-ai/trinity-mini",name:"Arcee AI: Trinity Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.045,output:.15,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"arcee-ai/virtuoso-large":{id:"arcee-ai/virtuoso-large",name:"Arcee AI: Virtuoso Large",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.75,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:64e3},auto:{id:"auto",name:"Auto",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e6,maxTokens:3e4},"bytedance-seed/seed-1.6":{id:"bytedance-seed/seed-1.6",name:"ByteDance Seed: Seed 1.6",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"bytedance-seed/seed-1.6-flash":{id:"bytedance-seed/seed-1.6-flash",name:"ByteDance Seed: Seed 1.6 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.075,output:.3,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"bytedance-seed/seed-2.0-lite":{id:"bytedance-seed/seed-2.0-lite",name:"ByteDance Seed: Seed-2.0-Lite",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"bytedance-seed/seed-2.0-mini":{id:"bytedance-seed/seed-2.0-mini",name:"ByteDance Seed: Seed-2.0-Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"cohere/command-r-08-2024":{id:"cohere/command-r-08-2024",name:"Cohere: Command R (08-2024)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"cohere/command-r-plus-08-2024":{id:"cohere/command-r-plus-08-2024",name:"Cohere: Command R+ (08-2024)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"deepseek/deepseek-chat":{id:"deepseek/deepseek-chat",name:"DeepSeek: DeepSeek V3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.2002,output:.8001,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16e3},"deepseek/deepseek-chat-v3-0324":{id:"deepseek/deepseek-chat-v3-0324",name:"DeepSeek: DeepSeek V3 0324",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.2,output:.77,cacheRead:.135,cacheWrite:0},contextWindow:163840,maxTokens:16384},"deepseek/deepseek-chat-v3.1":{id:"deepseek/deepseek-chat-v3.1",name:"DeepSeek: DeepSeek V3.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.21,output:.79,cacheRead:.13,cacheWrite:0},contextWindow:163840,maxTokens:32768},"deepseek/deepseek-r1":{id:"deepseek/deepseek-r1",name:"DeepSeek: R1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.7,output:2.5,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:16e3},"deepseek/deepseek-r1-0528":{id:"deepseek/deepseek-r1-0528",name:"DeepSeek: R1 0528",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.5,output:2.15,cacheRead:.35,cacheWrite:0},contextWindow:163840,maxTokens:32768},"deepseek/deepseek-v3.1-terminus":{id:"deepseek/deepseek-v3.1-terminus",name:"DeepSeek: DeepSeek V3.1 Terminus",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.27,output:.95,cacheRead:.13,cacheWrite:0},contextWindow:163840,maxTokens:32768},"deepseek/deepseek-v3.2":{id:"deepseek/deepseek-v3.2",name:"DeepSeek: DeepSeek V3.2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.2288,output:.3432,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:64e3},"deepseek/deepseek-v3.2-exp":{id:"deepseek/deepseek-v3.2-exp",name:"DeepSeek: DeepSeek V3.2 Exp",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.27,output:.41,cacheRead:0,cacheWrite:0},contextWindow:163840,maxTokens:65536},"deepseek/deepseek-v4-flash":{id:"deepseek/deepseek-v4-flash",name:"DeepSeek: DeepSeek V4 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",compat:{requiresReasoningContentOnAssistantMessages:!0},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"xhigh"},input:["text"],cost:{input:.09,output:.18,cacheRead:.02,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"deepseek/deepseek-v4-pro":{id:"deepseek/deepseek-v4-pro",name:"DeepSeek: DeepSeek V4 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",compat:{requiresReasoningContentOnAssistantMessages:!0},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:"xhigh"},input:["text"],cost:{input:.435,output:.87,cacheRead:.003625,cacheWrite:0},contextWindow:1048576,maxTokens:384e3},"essentialai/rnj-1-instruct":{id:"essentialai/rnj-1-instruct",name:"EssentialAI: Rnj 1 Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:4096},"google/gemini-2.5-flash":{id:"google/gemini-2.5-flash",name:"Google: Gemini 2.5 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.03,cacheWrite:.083333},contextWindow:1048576,maxTokens:65535},"google/gemini-2.5-flash-lite":{id:"google/gemini-2.5-flash-lite",name:"Google: Gemini 2.5 Flash Lite",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.01,cacheWrite:.083333},contextWindow:1048576,maxTokens:65535},"google/gemini-2.5-flash-lite-preview-09-2025":{id:"google/gemini-2.5-flash-lite-preview-09-2025",name:"Google: Gemini 2.5 Flash Lite Preview 09-2025",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.01,cacheWrite:.083333},contextWindow:1048576,maxTokens:65535},"google/gemini-2.5-pro":{id:"google/gemini-2.5-pro",name:"Google: Gemini 2.5 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:.375},contextWindow:1048576,maxTokens:65536},"google/gemini-2.5-pro-preview":{id:"google/gemini-2.5-pro-preview",name:"Google: Gemini 2.5 Pro Preview 06-05",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:.375},contextWindow:1048576,maxTokens:65536},"google/gemini-2.5-pro-preview-05-06":{id:"google/gemini-2.5-pro-preview-05-06",name:"Google: Gemini 2.5 Pro Preview 05-06",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:.375},contextWindow:1048576,maxTokens:65535},"google/gemini-3-flash-preview":{id:"google/gemini-3-flash-preview",name:"Google: Gemini 3 Flash Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:.083333},contextWindow:1048576,maxTokens:65536},"google/gemini-3.1-flash-lite":{id:"google/gemini-3.1-flash-lite",name:"Google: Gemini 3.1 Flash Lite",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:1.5,cacheRead:.025,cacheWrite:.083333},contextWindow:1048576,maxTokens:65536},"google/gemini-3.1-flash-lite-preview":{id:"google/gemini-3.1-flash-lite-preview",name:"Google: Gemini 3.1 Flash Lite Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:1.5,cacheRead:.025,cacheWrite:.083333},contextWindow:1048576,maxTokens:65536},"google/gemini-3.1-pro-preview":{id:"google/gemini-3.1-pro-preview",name:"Google: Gemini 3.1 Pro Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:.375},contextWindow:1048576,maxTokens:65536},"google/gemini-3.1-pro-preview-customtools":{id:"google/gemini-3.1-pro-preview-customtools",name:"Google: Gemini 3.1 Pro Preview Custom Tools",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:.375},contextWindow:1048756,maxTokens:65536},"google/gemini-3.5-flash":{id:"google/gemini-3.5-flash",name:"Google: Gemini 3.5 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.5,output:9,cacheRead:.15,cacheWrite:.083333},contextWindow:1048576,maxTokens:65536},"google/gemma-3-12b-it":{id:"google/gemma-3-12b-it",name:"Google: Gemma 3 12B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.05,output:.15,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"google/gemma-3-27b-it":{id:"google/gemma-3-27b-it",name:"Google: Gemma 3 27B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.08,output:.16,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"google/gemma-4-26b-a4b-it":{id:"google/gemma-4-26b-a4b-it",name:"Google: Gemma 4 26B A4B ",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.06,output:.33,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"google/gemma-4-26b-a4b-it:free":{id:"google/gemma-4-26b-a4b-it:free",name:"Google: Gemma 4 26B A4B (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"google/gemma-4-31b-it":{id:"google/gemma-4-31b-it",name:"Google: Gemma 4 31B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.12,output:.35,cacheRead:.09,cacheWrite:0},contextWindow:262144,maxTokens:262144},"google/gemma-4-31b-it:free":{id:"google/gemma-4-31b-it:free",name:"Google: Gemma 4 31B (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"ibm-granite/granite-4.1-8b":{id:"ibm-granite/granite-4.1-8b",name:"IBM: Granite 4.1 8B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.05,output:.1,cacheRead:.05,cacheWrite:0},contextWindow:131072,maxTokens:131072},"inception/mercury-2":{id:"inception/mercury-2",name:"Inception: Mercury 2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{off:null},input:["text"],cost:{input:.25,output:.75,cacheRead:.025,cacheWrite:0},contextWindow:128e3,maxTokens:5e4},"inclusionai/ling-2.6-1t":{id:"inclusionai/ling-2.6-1t",name:"inclusionAI: Ling-2.6-1T",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.075,output:.625,cacheRead:.015,cacheWrite:0},contextWindow:262144,maxTokens:32768},"inclusionai/ling-2.6-flash":{id:"inclusionai/ling-2.6-flash",name:"inclusionAI: Ling-2.6-flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.01,output:.03,cacheRead:.002,cacheWrite:0},contextWindow:262144,maxTokens:32768},"inclusionai/ring-2.6-1t":{id:"inclusionai/ring-2.6-1t",name:"inclusionAI: Ring-2.6-1T",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.075,output:.625,cacheRead:.015,cacheWrite:0},contextWindow:262144,maxTokens:65536},"kwaipilot/kat-coder-pro-v2":{id:"kwaipilot/kat-coder-pro-v2",name:"Kwaipilot: KAT-Coder-Pro V2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:256e3,maxTokens:8e4},"meta-llama/llama-3.1-70b-instruct":{id:"meta-llama/llama-3.1-70b-instruct",name:"Meta: Llama 3.1 70B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.4,output:.4,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"meta-llama/llama-3.1-8b-instruct":{id:"meta-llama/llama-3.1-8b-instruct",name:"Meta: Llama 3.1 8B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.02,output:.03,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"meta-llama/llama-3.3-70b-instruct":{id:"meta-llama/llama-3.3-70b-instruct",name:"Meta: Llama 3.3 70B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.1,output:.32,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"meta-llama/llama-3.3-70b-instruct:free":{id:"meta-llama/llama-3.3-70b-instruct:free",name:"Meta: Llama 3.3 70B Instruct (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4096},"meta-llama/llama-4-maverick":{id:"meta-llama/llama-4-maverick",name:"Meta: Llama 4 Maverick",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:16384},"meta-llama/llama-4-scout":{id:"meta-llama/llama-4-scout",name:"Meta: Llama 4 Scout",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:1e7,maxTokens:16384},"minimax/minimax-m1":{id:"minimax/minimax-m1",name:"MiniMax: MiniMax M1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.4,output:2.2,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:4e4},"minimax/minimax-m2":{id:"minimax/minimax-m2",name:"MiniMax: MiniMax M2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.255,output:1,cacheRead:.03,cacheWrite:0},contextWindow:204800,maxTokens:196608},"minimax/minimax-m2.1":{id:"minimax/minimax-m2.1",name:"MiniMax: MiniMax M2.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.29,output:.95,cacheRead:.03,cacheWrite:0},contextWindow:204800,maxTokens:196608},"minimax/minimax-m2.5":{id:"minimax/minimax-m2.5",name:"MiniMax: MiniMax M2.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.15,output:.9,cacheRead:.05,cacheWrite:0},contextWindow:204800,maxTokens:196608},"minimax/minimax-m2.7":{id:"minimax/minimax-m2.7",name:"MiniMax: MiniMax M2.7",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.25,output:1,cacheRead:.05,cacheWrite:0},contextWindow:204800,maxTokens:131072},"minimax/minimax-m3":{id:"minimax/minimax-m3",name:"MiniMax: MiniMax M3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:1048576,maxTokens:512e3},"mistralai/codestral-2508":{id:"mistralai/codestral-2508",name:"Mistral: Codestral 2508",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.3,output:.9,cacheRead:.03,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"mistralai/devstral-2512":{id:"mistralai/devstral-2512",name:"Mistral: Devstral 2 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:.04,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/ministral-14b-2512":{id:"mistralai/ministral-14b-2512",name:"Mistral: Ministral 3 14B 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.2,output:.2,cacheRead:.02,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/ministral-3b-2512":{id:"mistralai/ministral-3b-2512",name:"Mistral: Ministral 3 3B 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.1,output:.1,cacheRead:.01,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/ministral-8b-2512":{id:"mistralai/ministral-8b-2512",name:"Mistral: Ministral 3 8B 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.15,output:.15,cacheRead:.015,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/mistral-large":{id:"mistralai/mistral-large",name:"Mistral Large",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:.2,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"mistralai/mistral-large-2407":{id:"mistralai/mistral-large-2407",name:"Mistral Large 2407",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:.2,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/mistral-large-2512":{id:"mistralai/mistral-large-2512",name:"Mistral: Mistral Large 3 2512",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.5,output:1.5,cacheRead:.05,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/mistral-medium-3":{id:"mistralai/mistral-medium-3",name:"Mistral: Mistral Medium 3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.4,output:2,cacheRead:.04,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/mistral-medium-3-5":{id:"mistralai/mistral-medium-3-5",name:"Mistral: Mistral Medium 3.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.5,output:7.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/mistral-medium-3.1":{id:"mistralai/mistral-medium-3.1",name:"Mistral: Mistral Medium 3.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.4,output:2,cacheRead:.04,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/mistral-nemo":{id:"mistralai/mistral-nemo",name:"Mistral: Mistral Nemo",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.02,output:.03,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4096},"mistralai/mistral-saba":{id:"mistralai/mistral-saba",name:"Mistral: Saba",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.2,output:.6,cacheRead:.02,cacheWrite:0},contextWindow:32768,maxTokens:4096},"mistralai/mistral-small-2603":{id:"mistralai/mistral-small-2603",name:"Mistral: Mistral Small 4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.015,cacheWrite:0},contextWindow:262144,maxTokens:4096},"mistralai/mistral-small-3.2-24b-instruct":{id:"mistralai/mistral-small-3.2-24b-instruct",name:"Mistral: Mistral Small 3.2 24B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.075,output:.2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"mistralai/mixtral-8x22b-instruct":{id:"mistralai/mixtral-8x22b-instruct",name:"Mistral: Mixtral 8x22B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2,output:6,cacheRead:.2,cacheWrite:0},contextWindow:65536,maxTokens:4096},"mistralai/voxtral-small-24b-2507":{id:"mistralai/voxtral-small-24b-2507",name:"Mistral: Voxtral Small 24B 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.1,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:32e3,maxTokens:4096},"moonshotai/kimi-k2":{id:"moonshotai/kimi-k2",name:"MoonshotAI: Kimi K2 0711",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.57,output:2.3,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"moonshotai/kimi-k2-0905":{id:"moonshotai/kimi-k2-0905",name:"MoonshotAI: Kimi K2 0905",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.6,output:2.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"moonshotai/kimi-k2-thinking":{id:"moonshotai/kimi-k2-thinking",name:"MoonshotAI: Kimi K2 Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"moonshotai/kimi-k2.5":{id:"moonshotai/kimi-k2.5",name:"MoonshotAI: Kimi K2.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.41,output:2.06,cacheRead:.07,cacheWrite:0},contextWindow:262144,maxTokens:4096},"moonshotai/kimi-k2.6":{id:"moonshotai/kimi-k2.6",name:"MoonshotAI: Kimi K2.6",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",compat:{supportsDeveloperRole:!1,requiresReasoningContentOnAssistantMessages:!0},reasoning:!0,input:["text","image"],cost:{input:.68,output:3.41,cacheRead:.34,cacheWrite:0},contextWindow:262144,maxTokens:262142},"moonshotai/kimi-k2.7-code":{id:"moonshotai/kimi-k2.7-code",name:"MoonshotAI: Kimi K2.7 Code",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.74,output:3.5,cacheRead:.15,cacheWrite:0},contextWindow:262144,maxTokens:16384},"nex-agi/nex-n2-pro:free":{id:"nex-agi/nex-n2-pro:free",name:"Nex AGI: Nex-N2-Pro (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"nvidia/llama-3.3-nemotron-super-49b-v1.5":{id:"nvidia/llama-3.3-nemotron-super-49b-v1.5",name:"NVIDIA: Llama 3.3 Nemotron Super 49B V1.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.4,output:.4,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"nvidia/nemotron-3-nano-30b-a3b":{id:"nvidia/nemotron-3-nano-30b-a3b",name:"NVIDIA: Nemotron 3 Nano 30B A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.05,output:.2,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:228e3},"nvidia/nemotron-3-nano-30b-a3b:free":{id:"nvidia/nemotron-3-nano-30b-a3b:free",name:"NVIDIA: Nemotron 3 Nano 30B A3B (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"nvidia/nemotron-3-nano-omni-30b-a3b-reasoning:free":{id:"nvidia/nemotron-3-nano-omni-30b-a3b-reasoning:free",name:"NVIDIA: Nemotron 3 Nano Omni (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:65536},"nvidia/nemotron-3-super-120b-a12b":{id:"nvidia/nemotron-3-super-120b-a12b",name:"NVIDIA: Nemotron 3 Super",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.09,output:.45,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:4096},"nvidia/nemotron-3-super-120b-a12b:free":{id:"nvidia/nemotron-3-super-120b-a12b:free",name:"NVIDIA: Nemotron 3 Super (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:262144},"nvidia/nemotron-3-ultra-550b-a55b":{id:"nvidia/nemotron-3-ultra-550b-a55b",name:"NVIDIA: Nemotron 3 Ultra",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.5,output:2.2,cacheRead:.1,cacheWrite:0},contextWindow:1e6,maxTokens:16384},"nvidia/nemotron-3-ultra-550b-a55b:free":{id:"nvidia/nemotron-3-ultra-550b-a55b:free",name:"NVIDIA: Nemotron 3 Ultra (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"nvidia/nemotron-nano-12b-v2-vl:free":{id:"nvidia/nemotron-nano-12b-v2-vl:free",name:"NVIDIA: Nemotron Nano 12B 2 VL (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"nvidia/nemotron-nano-9b-v2:free":{id:"nvidia/nemotron-nano-9b-v2:free",name:"NVIDIA: Nemotron Nano 9B V2 (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-3.5-turbo":{id:"openai/gpt-3.5-turbo",name:"OpenAI: GPT-3.5 Turbo",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.5,output:1.5,cacheRead:0,cacheWrite:0},contextWindow:16385,maxTokens:4096},"openai/gpt-3.5-turbo-0613":{id:"openai/gpt-3.5-turbo-0613",name:"OpenAI: GPT-3.5 Turbo (older v0613)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:1,output:2,cacheRead:0,cacheWrite:0},contextWindow:4095,maxTokens:4096},"openai/gpt-3.5-turbo-16k":{id:"openai/gpt-3.5-turbo-16k",name:"OpenAI: GPT-3.5 Turbo 16k",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:3,output:4,cacheRead:0,cacheWrite:0},contextWindow:16385,maxTokens:4096},"openai/gpt-4":{id:"openai/gpt-4",name:"OpenAI: GPT-4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:30,output:60,cacheRead:0,cacheWrite:0},contextWindow:8191,maxTokens:4096},"openai/gpt-4-turbo":{id:"openai/gpt-4-turbo",name:"OpenAI: GPT-4 Turbo",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-4-turbo-preview":{id:"openai/gpt-4-turbo-preview",name:"OpenAI: GPT-4 Turbo Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-4.1":{id:"openai/gpt-4.1",name:"OpenAI: GPT-4.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:1047576,maxTokens:4096},"openai/gpt-4.1-mini":{id:"openai/gpt-4.1-mini",name:"OpenAI: GPT-4.1 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.4,output:1.6,cacheRead:.1,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4.1-nano":{id:"openai/gpt-4.1-nano",name:"OpenAI: GPT-4.1 Nano",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.025,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4o":{id:"openai/gpt-4o",name:"OpenAI: GPT-4o",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-2024-05-13":{id:"openai/gpt-4o-2024-05-13",name:"OpenAI: GPT-4o (2024-05-13)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:5,output:15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-4o-2024-08-06":{id:"openai/gpt-4o-2024-08-06",name:"OpenAI: GPT-4o (2024-08-06)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-2024-11-20":{id:"openai/gpt-4o-2024-11-20",name:"OpenAI: GPT-4o (2024-11-20)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-mini":{id:"openai/gpt-4o-mini",name:"OpenAI: GPT-4o-mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.075,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-mini-2024-07-18":{id:"openai/gpt-4o-mini-2024-07-18",name:"OpenAI: GPT-4o-mini (2024-07-18)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.075,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5":{id:"openai/gpt-5",name:"OpenAI: GPT-5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-codex":{id:"openai/gpt-5-codex",name:"OpenAI: GPT-5 Codex",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-mini":{id:"openai/gpt-5-mini",name:"OpenAI: GPT-5 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-nano":{id:"openai/gpt-5-nano",name:"OpenAI: GPT-5 Nano",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.05,output:.4,cacheRead:.01,cacheWrite:0},contextWindow:4e5,maxTokens:4096},"openai/gpt-5-pro":{id:"openai/gpt-5-pro",name:"OpenAI: GPT-5 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:120,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1":{id:"openai/gpt-5.1",name:"OpenAI: GPT-5.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.13,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-chat":{id:"openai/gpt-5.1-chat",name:"OpenAI: GPT-5.1 Chat",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.13,cacheWrite:0},contextWindow:128e3,maxTokens:32e3},"openai/gpt-5.1-codex":{id:"openai/gpt-5.1-codex",name:"OpenAI: GPT-5.1-Codex",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.13,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-codex-max":{id:"openai/gpt-5.1-codex-max",name:"OpenAI: GPT-5.1-Codex-Max",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-codex-mini":{id:"openai/gpt-5.1-codex-mini",name:"OpenAI: GPT-5.1-Codex-Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:1e5},"openai/gpt-5.2":{id:"openai/gpt-5.2",name:"OpenAI: GPT-5.2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2-chat":{id:"openai/gpt-5.2-chat",name:"OpenAI: GPT-5.2 Chat",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.2-codex":{id:"openai/gpt-5.2-codex",name:"OpenAI: GPT-5.2-Codex",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2-pro":{id:"openai/gpt-5.2-pro",name:"OpenAI: GPT-5.2 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:21,output:168,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.3-chat":{id:"openai/gpt-5.3-chat",name:"OpenAI: GPT-5.3 Chat",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.3-codex":{id:"openai/gpt-5.3-codex",name:"OpenAI: GPT-5.3-Codex",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4":{id:"openai/gpt-5.4",name:"OpenAI: GPT-5.4",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-5.4-mini":{id:"openai/gpt-5.4-mini",name:"OpenAI: GPT-5.4 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4-nano":{id:"openai/gpt-5.4-nano",name:"OpenAI: GPT-5.4 Nano",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4-pro":{id:"openai/gpt-5.4-pro",name:"OpenAI: GPT-5.4 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-5.5":{id:"openai/gpt-5.5",name:"OpenAI: GPT-5.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-5.5-pro":{id:"openai/gpt-5.5-pro",name:"OpenAI: GPT-5.5 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh",off:null,minimal:null,low:null},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-audio":{id:"openai/gpt-audio",name:"OpenAI: GPT Audio",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-audio-mini":{id:"openai/gpt-audio-mini",name:"OpenAI: GPT Audio Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.6,output:2.4,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-chat-latest":{id:"openai/gpt-chat-latest",name:"OpenAI: GPT Chat Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-oss-120b":{id:"openai/gpt-oss-120b",name:"OpenAI: gpt-oss-120b",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.039,output:.18,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4096},"openai/gpt-oss-120b:free":{id:"openai/gpt-oss-120b:free",name:"OpenAI: gpt-oss-120b (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"openai/gpt-oss-20b":{id:"openai/gpt-oss-20b",name:"OpenAI: gpt-oss-20b",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.029,output:.14,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:4096},"openai/gpt-oss-20b:free":{id:"openai/gpt-oss-20b:free",name:"OpenAI: gpt-oss-20b (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"openai/gpt-oss-safeguard-20b":{id:"openai/gpt-oss-safeguard-20b",name:"OpenAI: gpt-oss-safeguard-20b",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.075,output:.3,cacheRead:.037,cacheWrite:0},contextWindow:131072,maxTokens:65536},"openai/o1":{id:"openai/o1",name:"OpenAI: o1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3":{id:"openai/o3",name:"OpenAI: o3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-deep-research":{id:"openai/o3-deep-research",name:"OpenAI: o3 Deep Research",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:10,output:40,cacheRead:2.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-mini":{id:"openai/o3-mini",name:"OpenAI: o3 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-mini-high":{id:"openai/o3-mini-high",name:"OpenAI: o3 Mini High",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-pro":{id:"openai/o3-pro",name:"OpenAI: o3 Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o4-mini":{id:"openai/o4-mini",name:"OpenAI: o4 Mini",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o4-mini-deep-research":{id:"openai/o4-mini-deep-research",name:"OpenAI: o4 Mini Deep Research",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o4-mini-high":{id:"openai/o4-mini-high",name:"OpenAI: o4 Mini High",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openrouter/auto":{id:"openrouter/auto",name:"Auto Router",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:-1e6,output:-1e6,cacheRead:0,cacheWrite:0},contextWindow:2e6,maxTokens:4096},"openrouter/free":{id:"openrouter/free",name:"Free Models Router",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:4096},"openrouter/owl-alpha":{id:"openrouter/owl-alpha",name:"Owl Alpha",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1048756,maxTokens:262144},"poolside/laguna-m.1:free":{id:"poolside/laguna-m.1:free",name:"Poolside: Laguna M.1 (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"poolside/laguna-xs.2:free":{id:"poolside/laguna-xs.2:free",name:"Poolside: Laguna XS.2 (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"prime-intellect/intellect-3":{id:"prime-intellect/intellect-3",name:"Prime Intellect: INTELLECT-3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.2,output:1.1,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"qwen/qwen-2.5-72b-instruct":{id:"qwen/qwen-2.5-72b-instruct",name:"Qwen2.5 72B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.36,output:.4,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"qwen/qwen-plus":{id:"qwen/qwen-plus",name:"Qwen: Qwen-Plus",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.26,output:.78,cacheRead:.052,cacheWrite:.325},contextWindow:1e6,maxTokens:32768},"qwen/qwen-plus-2025-07-28":{id:"qwen/qwen-plus-2025-07-28",name:"Qwen: Qwen Plus 0728",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.26,output:.78,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:32768},"qwen/qwen-plus-2025-07-28:thinking":{id:"qwen/qwen-plus-2025-07-28:thinking",name:"Qwen: Qwen Plus 0728 (thinking)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.26,output:.78,cacheRead:0,cacheWrite:.325},contextWindow:1e6,maxTokens:32768},"qwen/qwen3-14b":{id:"qwen/qwen3-14b",name:"Qwen: Qwen3 14B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.1,output:.24,cacheRead:0,cacheWrite:0},contextWindow:131702,maxTokens:40960},"qwen/qwen3-235b-a22b":{id:"qwen/qwen3-235b-a22b",name:"Qwen: Qwen3 235B A22B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.455,output:1.82,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"qwen/qwen3-235b-a22b-2507":{id:"qwen/qwen3-235b-a22b-2507",name:"Qwen: Qwen3 235B A22B Instruct 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09,output:.1,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:16384},"qwen/qwen3-235b-a22b-thinking-2507":{id:"qwen/qwen3-235b-a22b-thinking-2507",name:"Qwen: Qwen3 235B A22B Thinking 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.1,output:.1,cacheRead:.1,cacheWrite:0},contextWindow:262144,maxTokens:262144},"qwen/qwen3-30b-a3b":{id:"qwen/qwen3-30b-a3b",name:"Qwen: Qwen3 30B A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.12,output:.5,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"qwen/qwen3-30b-a3b-instruct-2507":{id:"qwen/qwen3-30b-a3b-instruct-2507",name:"Qwen: Qwen3 30B A3B Instruct 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.04815,output:.19305,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32e3},"qwen/qwen3-30b-a3b-thinking-2507":{id:"qwen/qwen3-30b-a3b-thinking-2507",name:"Qwen: Qwen3 30B A3B Thinking 2507",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.08,output:.4,cacheRead:.08,cacheWrite:0},contextWindow:131072,maxTokens:131072},"qwen/qwen3-32b":{id:"qwen/qwen3-32b",name:"Qwen: Qwen3 32B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.08,output:.28,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"qwen/qwen3-8b":{id:"qwen/qwen3-8b",name:"Qwen: Qwen3 8B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.05,output:.4,cacheRead:.05,cacheWrite:0},contextWindow:131072,maxTokens:8192},"qwen/qwen3-coder":{id:"qwen/qwen3-coder",name:"Qwen: Qwen3 Coder 480B A35B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.22,output:1.8,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"qwen/qwen3-coder-30b-a3b-instruct":{id:"qwen/qwen3-coder-30b-a3b-instruct",name:"Qwen: Qwen3 Coder 30B A3B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.07,output:.27,cacheRead:0,cacheWrite:0},contextWindow:16e4,maxTokens:32768},"qwen/qwen3-coder-flash":{id:"qwen/qwen3-coder-flash",name:"Qwen: Qwen3 Coder Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.195,output:.975,cacheRead:.039,cacheWrite:.24375},contextWindow:1e6,maxTokens:65536},"qwen/qwen3-coder-next":{id:"qwen/qwen3-coder-next",name:"Qwen: Qwen3 Coder Next",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.11,output:.8,cacheRead:.07,cacheWrite:0},contextWindow:262144,maxTokens:262144},"qwen/qwen3-coder-plus":{id:"qwen/qwen3-coder-plus",name:"Qwen: Qwen3 Coder Plus",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.65,output:3.25,cacheRead:.13,cacheWrite:.8125},contextWindow:1e6,maxTokens:65536},"qwen/qwen3-coder:free":{id:"qwen/qwen3-coder:free",name:"Qwen: Qwen3 Coder 480B A35B (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1048576,maxTokens:262e3},"qwen/qwen3-max":{id:"qwen/qwen3-max",name:"Qwen: Qwen3 Max",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.78,output:3.9,cacheRead:.156,cacheWrite:.975},contextWindow:262144,maxTokens:32768},"qwen/qwen3-max-thinking":{id:"qwen/qwen3-max-thinking",name:"Qwen: Qwen3 Max Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.78,output:3.9,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"qwen/qwen3-next-80b-a3b-instruct":{id:"qwen/qwen3-next-80b-a3b-instruct",name:"Qwen: Qwen3 Next 80B A3B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.09,output:1.1,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:16384},"qwen/qwen3-next-80b-a3b-instruct:free":{id:"qwen/qwen3-next-80b-a3b-instruct:free",name:"Qwen: Qwen3 Next 80B A3B Instruct (free)",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:4096},"qwen/qwen3-next-80b-a3b-thinking":{id:"qwen/qwen3-next-80b-a3b-thinking",name:"Qwen: Qwen3 Next 80B A3B Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.0975,output:.78,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"qwen/qwen3-vl-235b-a22b-instruct":{id:"qwen/qwen3-vl-235b-a22b-instruct",name:"Qwen: Qwen3 VL 235B A22B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.2,output:.88,cacheRead:.11,cacheWrite:0},contextWindow:262144,maxTokens:16384},"qwen/qwen3-vl-235b-a22b-thinking":{id:"qwen/qwen3-vl-235b-a22b-thinking",name:"Qwen: Qwen3 VL 235B A22B Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.26,output:2.6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"qwen/qwen3-vl-30b-a3b-instruct":{id:"qwen/qwen3-vl-30b-a3b-instruct",name:"Qwen: Qwen3 VL 30B A3B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.13,output:.52,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"qwen/qwen3-vl-30b-a3b-thinking":{id:"qwen/qwen3-vl-30b-a3b-thinking",name:"Qwen: Qwen3 VL 30B A3B Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.13,output:1.56,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"qwen/qwen3-vl-32b-instruct":{id:"qwen/qwen3-vl-32b-instruct",name:"Qwen: Qwen3 VL 32B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.104,output:.416,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:32768},"qwen/qwen3-vl-8b-instruct":{id:"qwen/qwen3-vl-8b-instruct",name:"Qwen: Qwen3 VL 8B Instruct",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.08,output:.5,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:32768},"qwen/qwen3-vl-8b-thinking":{id:"qwen/qwen3-vl-8b-thinking",name:"Qwen: Qwen3 VL 8B Thinking",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.117,output:1.365,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:32768},"qwen/qwen3.5-122b-a10b":{id:"qwen/qwen3.5-122b-a10b",name:"Qwen: Qwen3.5-122B-A10B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.26,output:2.08,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"qwen/qwen3.5-27b":{id:"qwen/qwen3.5-27b",name:"Qwen: Qwen3.5-27B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.195,output:1.56,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"qwen/qwen3.5-35b-a3b":{id:"qwen/qwen3.5-35b-a3b",name:"Qwen: Qwen3.5-35B-A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.14,output:1,cacheRead:.05,cacheWrite:0},contextWindow:262144,maxTokens:81920},"qwen/qwen3.5-397b-a17b":{id:"qwen/qwen3.5-397b-a17b",name:"Qwen: Qwen3.5 397B A17B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.385,output:2.45,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"qwen/qwen3.5-9b":{id:"qwen/qwen3.5-9b",name:"Qwen: Qwen3.5-9B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.1,output:.15,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"qwen/qwen3.5-flash-02-23":{id:"qwen/qwen3.5-flash-02-23",name:"Qwen: Qwen3.5-Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.065,output:.26,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"qwen/qwen3.5-plus-02-15":{id:"qwen/qwen3.5-plus-02-15",name:"Qwen: Qwen3.5 Plus 2026-02-15",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.26,output:1.56,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"qwen/qwen3.5-plus-20260420":{id:"qwen/qwen3.5-plus-20260420",name:"Qwen: Qwen3.5 Plus 2026-04-20",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.3,output:1.8,cacheRead:0,cacheWrite:.375},contextWindow:1e6,maxTokens:65536},"qwen/qwen3.6-27b":{id:"qwen/qwen3.6-27b",name:"Qwen: Qwen3.6 27B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.2885,output:3.17,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262140},"qwen/qwen3.6-35b-a3b":{id:"qwen/qwen3.6-35b-a3b",name:"Qwen: Qwen3.6 35B A3B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.15,output:1,cacheRead:.05,cacheWrite:0},contextWindow:262144,maxTokens:262144},"qwen/qwen3.6-flash":{id:"qwen/qwen3.6-flash",name:"Qwen: Qwen3.6 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.1875,output:1.125,cacheRead:0,cacheWrite:.234375},contextWindow:1e6,maxTokens:65536},"qwen/qwen3.6-max-preview":{id:"qwen/qwen3.6-max-preview",name:"Qwen: Qwen3.6 Max Preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1.04,output:6.24,cacheRead:0,cacheWrite:1.3},contextWindow:262144,maxTokens:65536},"qwen/qwen3.6-plus":{id:"qwen/qwen3.6-plus",name:"Qwen: Qwen3.6 Plus",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.325,output:1.95,cacheRead:0,cacheWrite:.40625},contextWindow:1e6,maxTokens:65536},"qwen/qwen3.7-max":{id:"qwen/qwen3.7-max",name:"Qwen: Qwen3.7 Max",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1.25,output:3.75,cacheRead:.25,cacheWrite:1.5625},contextWindow:1e6,maxTokens:65536},"qwen/qwen3.7-plus":{id:"qwen/qwen3.7-plus",name:"Qwen: Qwen3.7 Plus",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.32,output:1.28,cacheRead:.064,cacheWrite:.4},contextWindow:1e6,maxTokens:65536},"rekaai/reka-edge":{id:"rekaai/reka-edge",name:"Reka Edge",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text","image"],cost:{input:.1,output:.1,cacheRead:0,cacheWrite:0},contextWindow:16384,maxTokens:16384},"relace/relace-search":{id:"relace/relace-search",name:"Relace: Relace Search",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:1,output:3,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:128e3},"sao10k/l3.1-euryale-70b":{id:"sao10k/l3.1-euryale-70b",name:"Sao10K: Llama 3.1 Euryale 70B v2.2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.85,output:.85,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:16384},"stepfun/step-3.5-flash":{id:"stepfun/step-3.5-flash",name:"StepFun: Step 3.5 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.09,output:.3,cacheRead:.02,cacheWrite:0},contextWindow:262144,maxTokens:16384},"stepfun/step-3.7-flash":{id:"stepfun/step-3.7-flash",name:"StepFun: Step 3.7 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.2,output:1.15,cacheRead:.04,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"tencent/hy3-preview":{id:"tencent/hy3-preview",name:"Tencent: Hy3 preview",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.066,output:.26,cacheRead:.029,cacheWrite:0},contextWindow:262144,maxTokens:262144},"thedrummer/rocinante-12b":{id:"thedrummer/rocinante-12b",name:"TheDrummer: Rocinante 12B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.17,output:.43,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:32768},"thedrummer/unslopnemo-12b":{id:"thedrummer/unslopnemo-12b",name:"TheDrummer: UnslopNemo 12B",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!1,input:["text"],cost:{input:.4,output:.4,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:32768},"upstage/solar-pro-3":{id:"upstage/solar-pro-3",name:"Upstage: Solar Pro 3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:.015,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"x-ai/grok-4.20":{id:"x-ai/grok-4.20",name:"xAI: Grok 4.20",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.2,cacheWrite:0},contextWindow:2e6,maxTokens:4096},"x-ai/grok-4.3":{id:"x-ai/grok-4.3",name:"xAI: Grok 4.3",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.2,cacheWrite:0},contextWindow:1e6,maxTokens:4096},"x-ai/grok-build-0.1":{id:"x-ai/grok-build-0.1",name:"xAI: Grok Build 0.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1,output:2,cacheRead:.2,cacheWrite:0},contextWindow:256e3,maxTokens:4096},"xiaomi/mimo-v2-flash":{id:"xiaomi/mimo-v2-flash",name:"Xiaomi: MiMo-V2-Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.1,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:262144,maxTokens:65536},"xiaomi/mimo-v2.5":{id:"xiaomi/mimo-v2.5",name:"Xiaomi: MiMo-V2.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.14,output:.28,cacheRead:.0028,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"xiaomi/mimo-v2.5-pro":{id:"xiaomi/mimo-v2.5-pro",name:"Xiaomi: MiMo-V2.5-Pro",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.435,output:.87,cacheRead:.0036,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"z-ai/glm-4.5":{id:"z-ai/glm-4.5",name:"Z.ai: GLM 4.5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:131072,maxTokens:98304},"z-ai/glm-4.5-air":{id:"z-ai/glm-4.5-air",name:"Z.ai: GLM 4.5 Air",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.13,output:.85,cacheRead:.025,cacheWrite:0},contextWindow:131072,maxTokens:98304},"z-ai/glm-4.5v":{id:"z-ai/glm-4.5v",name:"Z.ai: GLM 4.5V",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.6,output:1.8,cacheRead:.11,cacheWrite:0},contextWindow:65536,maxTokens:16384},"z-ai/glm-4.6":{id:"z-ai/glm-4.6",name:"Z.ai: GLM 4.6",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.43,output:1.74,cacheRead:.08,cacheWrite:0},contextWindow:202752,maxTokens:131072},"z-ai/glm-4.6v":{id:"z-ai/glm-4.6v",name:"Z.ai: GLM 4.6V",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.3,output:.9,cacheRead:.055,cacheWrite:0},contextWindow:131072,maxTokens:32768},"z-ai/glm-4.7":{id:"z-ai/glm-4.7",name:"Z.ai: GLM 4.7",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.4,output:1.75,cacheRead:.08,cacheWrite:0},contextWindow:202752,maxTokens:131072},"z-ai/glm-4.7-flash":{id:"z-ai/glm-4.7-flash",name:"Z.ai: GLM 4.7 Flash",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.06,output:.4,cacheRead:.01,cacheWrite:0},contextWindow:202752,maxTokens:16384},"z-ai/glm-5":{id:"z-ai/glm-5",name:"Z.ai: GLM 5",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.6,output:1.9,cacheRead:.119,cacheWrite:0},contextWindow:202752,maxTokens:4096},"z-ai/glm-5-turbo":{id:"z-ai/glm-5-turbo",name:"Z.ai: GLM 5 Turbo",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1.2,output:4,cacheRead:.24,cacheWrite:0},contextWindow:262144,maxTokens:131072},"z-ai/glm-5.1":{id:"z-ai/glm-5.1",name:"Z.ai: GLM 5.1",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:.98,output:3.08,cacheRead:.182,cacheWrite:0},contextWindow:202752,maxTokens:4096},"z-ai/glm-5.2":{id:"z-ai/glm-5.2",name:"Z.ai: GLM 5.2",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text"],cost:{input:1.4,output:4.4,cacheRead:.26,cacheWrite:0},contextWindow:1048576,maxTokens:262144},"~anthropic/claude-fable-latest":{id:"~anthropic/claude-fable-latest",name:"Anthropic: Claude Fable Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:10,output:50,cacheRead:1,cacheWrite:12.5},contextWindow:1e6,maxTokens:128e3},"~anthropic/claude-haiku-latest":{id:"~anthropic/claude-haiku-latest",name:"Anthropic Claude Haiku Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"~anthropic/claude-opus-latest":{id:"~anthropic/claude-opus-latest",name:"Anthropic: Claude Opus Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"~anthropic/claude-sonnet-latest":{id:"~anthropic/claude-sonnet-latest",name:"Anthropic Claude Sonnet Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:128e3},"~google/gemini-flash-latest":{id:"~google/gemini-flash-latest",name:"Google Gemini Flash Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:1.5,output:9,cacheRead:.15,cacheWrite:.083333},contextWindow:1048576,maxTokens:65536},"~google/gemini-pro-latest":{id:"~google/gemini-pro-latest",name:"Google Gemini Pro Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:.375},contextWindow:1048576,maxTokens:65536},"~moonshotai/kimi-latest":{id:"~moonshotai/kimi-latest",name:"MoonshotAI Kimi Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.68,output:3.41,cacheRead:.34,cacheWrite:0},contextWindow:262144,maxTokens:262142},"~openai/gpt-latest":{id:"~openai/gpt-latest",name:"OpenAI GPT Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"~openai/gpt-mini-latest":{id:"~openai/gpt-mini-latest",name:"OpenAI GPT Mini Latest",api:"openai-completions",provider:"openrouter",baseUrl:"https://openrouter.ai/api/v1",reasoning:!0,input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3}},together:{"MiniMaxAI/MiniMax-M2.7":{id:"MiniMaxAI/MiniMax-M2.7",name:"MiniMax-M2.7",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:null,medium:null},input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:202752,maxTokens:131072},"MiniMaxAI/MiniMax-M3":{id:"MiniMaxAI/MiniMax-M3",name:"MiniMax-M3",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text","image"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:524288,maxTokens:25e4},"Qwen/Qwen2.5-7B-Instruct-Turbo":{id:"Qwen/Qwen2.5-7B-Instruct-Turbo",name:"Qwen 2.5 7B Instruct Turbo",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text"],cost:{input:.3,output:.3,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:32768},"Qwen/Qwen3-235B-A22B-Instruct-2507-tput":{id:"Qwen/Qwen3-235B-A22B-Instruct-2507-tput",name:"Qwen3 235B A22B Instruct 2507 FP8",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text"],cost:{input:.2,output:.6,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:262144},"Qwen/Qwen3.5-397B-A17B":{id:"Qwen/Qwen3.5-397B-A17B",name:"Qwen3.5 397B A17B",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text","image"],cost:{input:.6,output:3.6,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:13e4},"Qwen/Qwen3.5-9B":{id:"Qwen/Qwen3.5-9B",name:"Qwen3.5 9B",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text","image"],cost:{input:.17,output:.25,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:65536},"Qwen/Qwen3.6-Plus":{id:"Qwen/Qwen3.6-Plus",name:"Qwen3.6 Plus",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text"],cost:{input:.5,output:3,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:5e5},"Qwen/Qwen3.7-Max":{id:"Qwen/Qwen3.7-Max",name:"Qwen3.7 Max",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text"],cost:{input:1.25,output:3.75,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:5e5},"deepseek-ai/DeepSeek-V4-Pro":{id:"deepseek-ai/DeepSeek-V4-Pro",name:"DeepSeek V4 Pro",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!0,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null,high:"high",xhigh:null},input:["text"],cost:{input:1.74,output:3.48,cacheRead:.2,cacheWrite:0},contextWindow:512e3,maxTokens:384e3},"essentialai/Rnj-1-Instruct":{id:"essentialai/Rnj-1-Instruct",name:"Rnj-1 Instruct",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:32768,maxTokens:32768},"google/gemma-4-31B-it":{id:"google/gemma-4-31B-it",name:"Gemma 4 31B Instruct",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text","image"],cost:{input:.39,output:.97,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"meta-llama/Llama-3.3-70B-Instruct-Turbo":{id:"meta-llama/Llama-3.3-70B-Instruct-Turbo",name:"Llama 3.3 70B",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1},reasoning:!1,input:["text"],cost:{input:.88,output:.88,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"moonshotai/Kimi-K2.6":{id:"moonshotai/Kimi-K2.6",name:"Kimi K2.6",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text","image"],cost:{input:1.2,output:4.5,cacheRead:.2,cacheWrite:0},contextWindow:262144,maxTokens:131e3},"moonshotai/Kimi-K2.7-Code":{id:"moonshotai/Kimi-K2.7-Code",name:"Kimi K2.7 Code",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text"],cost:{input:.95,output:4,cacheRead:.19,cacheWrite:0},contextWindow:262144,maxTokens:131072},"nvidia/nemotron-3-ultra-550b-a55b":{id:"nvidia/nemotron-3-ultra-550b-a55b",name:"Nemotron 3 Ultra 550B A55B",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text"],cost:{input:.6,output:3.6,cacheRead:.2,cacheWrite:0},contextWindow:512300,maxTokens:512300},"openai/gpt-oss-120b":{id:"openai/gpt-oss-120b",name:"GPT OSS 120B",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!0,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"openai"},reasoning:!0,thinkingLevelMap:{off:null,minimal:null},input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"openai/gpt-oss-20b":{id:"openai/gpt-oss-20b",name:"GPT OSS 20B",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!0,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"openai"},reasoning:!0,thinkingLevelMap:{off:null,minimal:null},input:["text"],cost:{input:.05,output:.2,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"zai-org/GLM-5":{id:"zai-org/GLM-5",name:"GLM-5",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text"],cost:{input:1,output:3.2,cacheRead:0,cacheWrite:0},contextWindow:202752,maxTokens:131072},"zai-org/GLM-5.1":{id:"zai-org/GLM-5.1",name:"GLM-5.1",api:"openai-completions",provider:"together",baseUrl:"https://api.together.ai/v1",compat:{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1,thinkingFormat:"together"},reasoning:!0,thinkingLevelMap:{minimal:null,low:null,medium:null},input:["text"],cost:{input:1.4,output:4.4,cacheRead:0,cacheWrite:0},contextWindow:202752,maxTokens:131072}},"vercel-ai-gateway":{"alibaba/qwen-3-14b":{id:"alibaba/qwen-3-14b",name:"Qwen3-14B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.12,output:.24,cacheRead:0,cacheWrite:0},contextWindow:40960,maxTokens:16384},"alibaba/qwen-3-235b":{id:"alibaba/qwen-3-235b",name:"Qwen3 235B A22B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.22,output:.88,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:16384},"alibaba/qwen-3-30b":{id:"alibaba/qwen-3-30b",name:"Qwen3-30B-A3B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.12,output:.5,cacheRead:0,cacheWrite:0},contextWindow:40960,maxTokens:16384},"alibaba/qwen-3-32b":{id:"alibaba/qwen-3-32b",name:"Qwen 3 32B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.16,output:.64,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"alibaba/qwen-3.6-max-preview":{id:"alibaba/qwen-3.6-max-preview",name:"Qwen 3.6 Max Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.3,output:7.8,cacheRead:.26,cacheWrite:1.625},contextWindow:24e4,maxTokens:64e3},"alibaba/qwen3-235b-a22b-thinking":{id:"alibaba/qwen3-235b-a22b-thinking",name:"Qwen3 VL 235B A22B Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.4,output:4,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"alibaba/qwen3-coder":{id:"alibaba/qwen3-coder",name:"Qwen3 Coder 480B A35B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.5,output:7.5,cacheRead:.3,cacheWrite:0},contextWindow:262144,maxTokens:65536},"alibaba/qwen3-coder-30b-a3b":{id:"alibaba/qwen3-coder-30b-a3b",name:"Qwen 3 Coder 30B A3B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.15,output:.6,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:8192},"alibaba/qwen3-coder-next":{id:"alibaba/qwen3-coder-next",name:"Qwen3 Coder Next",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.5,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"alibaba/qwen3-coder-plus":{id:"alibaba/qwen3-coder-plus",name:"Qwen3 Coder Plus",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:1,output:5,cacheRead:.2,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"alibaba/qwen3-max":{id:"alibaba/qwen3-max",name:"Qwen3 Max",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:1.2,output:6,cacheRead:.24,cacheWrite:0},contextWindow:262144,maxTokens:32768},"alibaba/qwen3-max-preview":{id:"alibaba/qwen3-max-preview",name:"Qwen3 Max Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:1.2,output:6,cacheRead:.24,cacheWrite:0},contextWindow:262144,maxTokens:32768},"alibaba/qwen3-max-thinking":{id:"alibaba/qwen3-max-thinking",name:"Qwen 3 Max Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.2,output:6,cacheRead:.24,cacheWrite:0},contextWindow:256e3,maxTokens:65536},"alibaba/qwen3-next-80b-a3b-instruct":{id:"alibaba/qwen3-next-80b-a3b-instruct",name:"Qwen3 Next 80B A3B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.15,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"alibaba/qwen3-next-80b-a3b-thinking":{id:"alibaba/qwen3-next-80b-a3b-thinking",name:"Qwen3 Next 80B A3B Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.15,output:1.2,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"alibaba/qwen3-vl-thinking":{id:"alibaba/qwen3-vl-thinking",name:"Qwen3 VL 235B A22B Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.4,output:4,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:32768},"alibaba/qwen3.5-flash":{id:"alibaba/qwen3.5-flash",name:"Qwen 3.5 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.001,cacheWrite:.125},contextWindow:1e6,maxTokens:64e3},"alibaba/qwen3.5-plus":{id:"alibaba/qwen3.5-plus",name:"Qwen 3.5 Plus",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.4,output:2.4,cacheRead:.04,cacheWrite:.5},contextWindow:1e6,maxTokens:64e3},"alibaba/qwen3.6-27b":{id:"alibaba/qwen3.6-27b",name:"Qwen 3.6 27B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.6,output:3.6,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"alibaba/qwen3.6-plus":{id:"alibaba/qwen3.6-plus",name:"Qwen 3.6 Plus",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.1,cacheWrite:.625},contextWindow:1e6,maxTokens:64e3},"alibaba/qwen3.7-max":{id:"alibaba/qwen3.7-max",name:"Qwen 3.7 Max",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.25,output:3.75,cacheRead:.25,cacheWrite:1.5625},contextWindow:991e3,maxTokens:64e3},"alibaba/qwen3.7-plus":{id:"alibaba/qwen3.7-plus",name:"Qwen 3.7 Plus",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.4,output:1.6,cacheRead:.08,cacheWrite:.5},contextWindow:1e6,maxTokens:64e3},"anthropic/claude-3-haiku":{id:"anthropic/claude-3-haiku",name:"Claude 3 Haiku",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.25,output:1.25,cacheRead:.03,cacheWrite:.3},contextWindow:2e5,maxTokens:4096},"anthropic/claude-3.5-haiku":{id:"anthropic/claude-3.5-haiku",name:"Claude 3.5 Haiku",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.8,output:4,cacheRead:.08,cacheWrite:1},contextWindow:2e5,maxTokens:8192},"anthropic/claude-haiku-4.5":{id:"anthropic/claude-haiku-4.5",name:"Claude Haiku 4.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:.1,cacheWrite:1.25},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-opus-4":{id:"anthropic/claude-opus-4",name:"Claude Opus 4",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic/claude-opus-4.1":{id:"anthropic/claude-opus-4.1",name:"Claude Opus 4.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3},"anthropic/claude-opus-4.5":{id:"anthropic/claude-opus-4.5",name:"Claude Opus 4.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:2e5,maxTokens:64e3},"anthropic/claude-opus-4.6":{id:"anthropic/claude-opus-4.6",name:"Claude Opus 4.6",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",compat:{forceAdaptiveThinking:!0},reasoning:!0,thinkingLevelMap:{xhigh:"max"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-opus-4.7":{id:"anthropic/claude-opus-4.7",name:"Claude Opus 4.7",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",compat:{forceAdaptiveThinking:!0,supportsTemperature:!1},reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-opus-4.8":{id:"anthropic/claude-opus-4.8",name:"Claude Opus 4.8",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",compat:{forceAdaptiveThinking:!0,supportsTemperature:!1},reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3},"anthropic/claude-sonnet-4":{id:"anthropic/claude-sonnet-4",name:"Claude Sonnet 4",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"anthropic/claude-sonnet-4.5":{id:"anthropic/claude-sonnet-4.5",name:"Claude Sonnet 4.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3},"anthropic/claude-sonnet-4.6":{id:"anthropic/claude-sonnet-4.6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",compat:{forceAdaptiveThinking:!0},reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:128e3},"arcee-ai/trinity-large-preview":{id:"arcee-ai/trinity-large-preview",name:"Trinity Large Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.25,output:1,cacheRead:0,cacheWrite:0},contextWindow:131e3,maxTokens:131e3},"arcee-ai/trinity-large-thinking":{id:"arcee-ai/trinity-large-thinking",name:"Trinity Large Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.25,output:.9,cacheRead:0,cacheWrite:0},contextWindow:262100,maxTokens:8e4},"bytedance/seed-1.6":{id:"bytedance/seed-1.6",name:"Seed 1.6",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.25,output:2,cacheRead:.05,cacheWrite:0},contextWindow:256e3,maxTokens:32e3},"cohere/command-a":{id:"cohere/command-a",name:"Command A",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:2.5,output:10,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:8e3},"deepseek/deepseek-r1":{id:"deepseek/deepseek-r1",name:"DeepSeek-R1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.35,output:5.4,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"deepseek/deepseek-v3":{id:"deepseek/deepseek-v3",name:"DeepSeek V3 0324",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.27,output:1.12,cacheRead:.135,cacheWrite:0},contextWindow:163840,maxTokens:163840},"deepseek/deepseek-v3.1":{id:"deepseek/deepseek-v3.1",name:"DeepSeek V3.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.56,output:1.68,cacheRead:.28,cacheWrite:0},contextWindow:163840,maxTokens:8192},"deepseek/deepseek-v3.1-terminus":{id:"deepseek/deepseek-v3.1-terminus",name:"DeepSeek V3.1 Terminus",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.27,output:1,cacheRead:.135,cacheWrite:0},contextWindow:131072,maxTokens:65536},"deepseek/deepseek-v3.2":{id:"deepseek/deepseek-v3.2",name:"DeepSeek V3.2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.28,output:.42,cacheRead:.028,cacheWrite:0},contextWindow:128e3,maxTokens:8e3},"deepseek/deepseek-v3.2-thinking":{id:"deepseek/deepseek-v3.2-thinking",name:"DeepSeek V3.2 Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.62,output:1.85,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8e3},"deepseek/deepseek-v4-flash":{id:"deepseek/deepseek-v4-flash",name:"DeepSeek V4 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.14,output:.28,cacheRead:.0028,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"deepseek/deepseek-v4-pro":{id:"deepseek/deepseek-v4-pro",name:"DeepSeek V4 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.435,output:.87,cacheRead:.0036,cacheWrite:0},contextWindow:1e6,maxTokens:384e3},"google/gemini-2.5-flash":{id:"google/gemini-2.5-flash",name:"Gemini 2.5 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.03,cacheWrite:0},contextWindow:1e6,maxTokens:65536},"google/gemini-2.5-flash-lite":{id:"google/gemini-2.5-flash-lite",name:"Gemini 2.5 Flash Lite",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.01,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"google/gemini-2.5-pro":{id:"google/gemini-2.5-pro",name:"Gemini 2.5 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:1048576,maxTokens:65536},"google/gemini-3-flash":{id:"google/gemini-3-flash",name:"Gemini 3 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.5,output:3,cacheRead:.05,cacheWrite:0},contextWindow:1e6,maxTokens:65e3},"google/gemini-3-pro-preview":{id:"google/gemini-3-pro-preview",name:"Gemini 3 Pro Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1e6,maxTokens:64e3},"google/gemini-3.1-flash-lite":{id:"google/gemini-3.1-flash-lite",name:"Gemini 3.1 Flash Lite",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.25,output:1.5,cacheRead:.03,cacheWrite:0},contextWindow:1e6,maxTokens:65e3},"google/gemini-3.1-flash-lite-preview":{id:"google/gemini-3.1-flash-lite-preview",name:"Gemini 3.1 Flash Lite Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.25,output:1.5,cacheRead:.03,cacheWrite:0},contextWindow:1e6,maxTokens:65e3},"google/gemini-3.1-pro-preview":{id:"google/gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:.2,cacheWrite:0},contextWindow:1e6,maxTokens:64e3},"google/gemini-3.5-flash":{id:"google/gemini-3.5-flash",name:"Gemini 3.5 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.5,output:9,cacheRead:.15,cacheWrite:0},contextWindow:1e6,maxTokens:64e3},"google/gemma-4-26b-a4b-it":{id:"google/gemma-4-26b-a4b-it",name:"Gemma 4 26B A4B IT",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.015,cacheWrite:0},contextWindow:262144,maxTokens:131072},"google/gemma-4-31b-it":{id:"google/gemma-4-31b-it",name:"Gemma 4 31B IT",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.14,output:.4,cacheRead:0,cacheWrite:0},contextWindow:262144,maxTokens:131072},"inception/mercury-2":{id:"inception/mercury-2",name:"Mercury 2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.25,output:.75,cacheRead:.025,cacheWrite:0},contextWindow:128e3,maxTokens:128e3},"inception/mercury-coder-small":{id:"inception/mercury-coder-small",name:"Mercury Coder Small Beta",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.25,output:1,cacheRead:0,cacheWrite:0},contextWindow:32e3,maxTokens:16384},"kwaipilot/kat-coder-pro-v2":{id:"kwaipilot/kat-coder-pro-v2",name:"Kat Coder Pro V2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"meituan/longcat-flash-chat":{id:"meituan/longcat-flash-chat",name:"LongCat Flash Chat",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:1e5},"meta/llama-3.1-70b":{id:"meta/llama-3.1-70b",name:"Llama 3.1 70B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-3.1-8b":{id:"meta/llama-3.1-8b",name:"Llama 3.1 8B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.22,output:.22,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-3.2-11b":{id:"meta/llama-3.2-11b",name:"Llama 3.2 11B Vision Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.16,output:.16,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-3.2-90b":{id:"meta/llama-3.2-90b",name:"Llama 3.2 90B Vision Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-3.3-70b":{id:"meta/llama-3.3-70b",name:"Llama 3.3 70B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.72,output:.72,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-4-maverick":{id:"meta/llama-4-maverick",name:"Llama 4 Maverick 17B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.24,output:.97,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"meta/llama-4-scout":{id:"meta/llama-4-scout",name:"Llama 4 Scout 17B Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.17,output:.66,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192},"minimax/minimax-m2":{id:"minimax/minimax-m2",name:"MiniMax M2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:.375},contextWindow:205e3,maxTokens:205e3},"minimax/minimax-m2.1":{id:"minimax/minimax-m2.1",name:"MiniMax M2.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"minimax/minimax-m2.1-lightning":{id:"minimax/minimax-m2.1-lightning",name:"MiniMax M2.1 Lightning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:2.4,cacheRead:.03,cacheWrite:.375},contextWindow:204800,maxTokens:131072},"minimax/minimax-m2.5":{id:"minimax/minimax-m2.5",name:"MiniMax M2.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.03,cacheWrite:.375},contextWindow:204800,maxTokens:131e3},"minimax/minimax-m2.5-highspeed":{id:"minimax/minimax-m2.5-highspeed",name:"MiniMax M2.5 High Speed",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:.03,cacheWrite:.375},contextWindow:204800,maxTokens:131e3},"minimax/minimax-m2.7":{id:"minimax/minimax-m2.7",name:"MiniMax M2.7",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131e3},"minimax/minimax-m2.7-highspeed":{id:"minimax/minimax-m2.7-highspeed",name:"MiniMax M2.7 High Speed",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:.06,cacheWrite:.375},contextWindow:204800,maxTokens:131100},"minimax/minimax-m3":{id:"minimax/minimax-m3",name:"MiniMax M3",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.3,output:1.2,cacheRead:.06,cacheWrite:0},contextWindow:1e6,maxTokens:1e6},"mistral/codestral":{id:"mistral/codestral",name:"Mistral Codestral",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.3,output:.9,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"mistral/devstral-2":{id:"mistral/devstral-2",name:"Devstral 2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"mistral/devstral-small":{id:"mistral/devstral-small",name:"Devstral Small 1.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"mistral/devstral-small-2":{id:"mistral/devstral-small-2",name:"Devstral Small 2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"mistral/ministral-3b":{id:"mistral/ministral-3b",name:"Ministral 3B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.1,output:.1,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"mistral/ministral-8b":{id:"mistral/ministral-8b",name:"Ministral 8B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"mistral/mistral-medium":{id:"mistral/mistral-medium",name:"Mistral Medium 3.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.4,output:2,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:64e3},"mistral/mistral-medium-3.5":{id:"mistral/mistral-medium-3.5",name:"Mistral Medium Latest",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.5,output:7.5,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"mistral/mistral-nemo":{id:"mistral/mistral-nemo",name:"Mistral Nemo 12B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.02,output:.04,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"mistral/mistral-small":{id:"mistral/mistral-small",name:"Mistral Small",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.1,output:.3,cacheRead:0,cacheWrite:0},contextWindow:32e3,maxTokens:4e3},"mistral/pixtral-12b":{id:"mistral/pixtral-12b",name:"Pixtral 12B 2409",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.15,output:.15,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"mistral/pixtral-large":{id:"mistral/pixtral-large",name:"Pixtral Large",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:2,output:6,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4e3},"moonshotai/kimi-k2":{id:"moonshotai/kimi-k2",name:"Kimi K2 Instruct",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text"],cost:{input:.57,output:2.3,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"moonshotai/kimi-k2-thinking":{id:"moonshotai/kimi-k2-thinking",name:"Kimi K2 Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.5,cacheRead:.15,cacheWrite:0},contextWindow:262114,maxTokens:262114},"moonshotai/kimi-k2.5":{id:"moonshotai/kimi-k2.5",name:"Kimi K2.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.6,output:3,cacheRead:.1,cacheWrite:0},contextWindow:262114,maxTokens:262114},"moonshotai/kimi-k2.6":{id:"moonshotai/kimi-k2.6",name:"Kimi K2.6",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.16,cacheWrite:0},contextWindow:262e3,maxTokens:262e3},"moonshotai/kimi-k2.7-code":{id:"moonshotai/kimi-k2.7-code",name:"Kimi K2.7 Code",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.95,output:4,cacheRead:.19,cacheWrite:0},contextWindow:256e3,maxTokens:32768},"moonshotai/kimi-k2.7-code-highspeed":{id:"moonshotai/kimi-k2.7-code-highspeed",name:"Kimi K2.7 Code High Speed",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.9,output:8,cacheRead:.38,cacheWrite:0},contextWindow:262144,maxTokens:262144},"nvidia/nemotron-3-super-120b-a12b":{id:"nvidia/nemotron-3-super-120b-a12b",name:"NVIDIA Nemotron 3 Super 120B A12B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.15,output:.65,cacheRead:0,cacheWrite:0},contextWindow:256e3,maxTokens:32e3},"nvidia/nemotron-3-ultra-550b-a55b":{id:"nvidia/nemotron-3-ultra-550b-a55b",name:"Nemotron 3 Ultra",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.4,cacheRead:.12,cacheWrite:0},contextWindow:1e6,maxTokens:65e3},"nvidia/nemotron-nano-12b-v2-vl":{id:"nvidia/nemotron-nano-12b-v2-vl",name:"Nvidia Nemotron Nano 12B V2 VL",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.2,output:.6,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"nvidia/nemotron-nano-9b-v2":{id:"nvidia/nemotron-nano-9b-v2",name:"Nvidia Nemotron Nano 9B V2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.06,output:.23,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:131072},"openai/gpt-4-turbo":{id:"openai/gpt-4-turbo",name:"GPT-4 Turbo",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:4096},"openai/gpt-4.1":{id:"openai/gpt-4.1",name:"GPT-4.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4.1-mini":{id:"openai/gpt-4.1-mini",name:"GPT-4.1 mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.4,output:1.6,cacheRead:.1,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4.1-nano":{id:"openai/gpt-4.1-nano",name:"GPT-4.1 nano",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.1,output:.4,cacheRead:.025,cacheWrite:0},contextWindow:1047576,maxTokens:32768},"openai/gpt-4o":{id:"openai/gpt-4o",name:"GPT-4o",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-4o-mini":{id:"openai/gpt-4o-mini",name:"GPT-4o mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.15,output:.6,cacheRead:.075,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5":{id:"openai/gpt-5",name:"GPT-5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-chat":{id:"openai/gpt-5-chat",name:"GPT 5 Chat",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5-codex":{id:"openai/gpt-5-codex",name:"GPT-5-Codex",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-mini":{id:"openai/gpt-5-mini",name:"GPT-5 mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-nano":{id:"openai/gpt-5-nano",name:"GPT-5 nano",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.05,output:.4,cacheRead:.005,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5-pro":{id:"openai/gpt-5-pro",name:"GPT-5 pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:15,output:120,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:272e3},"openai/gpt-5.1-codex":{id:"openai/gpt-5.1-codex",name:"GPT-5.1-Codex",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-codex-max":{id:"openai/gpt-5.1-codex-max",name:"GPT 5.1 Codex Max",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-codex-mini":{id:"openai/gpt-5.1-codex-mini",name:"GPT 5.1 Codex Mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.1-instant":{id:"openai/gpt-5.1-instant",name:"GPT-5.1 Instant",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.1-thinking":{id:"openai/gpt-5.1-thinking",name:"GPT 5.1 Thinking",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2":{id:"openai/gpt-5.2",name:"GPT 5.2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2-chat":{id:"openai/gpt-5.2-chat",name:"GPT 5.2 Chat",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.2-codex":{id:"openai/gpt-5.2-codex",name:"GPT 5.2 Codex",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.2-pro":{id:"openai/gpt-5.2-pro",name:"GPT 5.2 ",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:21,output:168,cacheRead:0,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.3-chat":{id:"openai/gpt-5.3-chat",name:"GPT-5.3 Chat",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:128e3,maxTokens:16384},"openai/gpt-5.3-codex":{id:"openai/gpt-5.3-codex",name:"GPT 5.3 Codex",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4":{id:"openai/gpt-5.4",name:"GPT 5.4",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-5.4-mini":{id:"openai/gpt-5.4-mini",name:"GPT 5.4 Mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4-nano":{id:"openai/gpt-5.4-nano",name:"GPT 5.4 Nano",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3},"openai/gpt-5.4-pro":{id:"openai/gpt-5.4-pro",name:"GPT 5.4 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:105e4,maxTokens:128e3},"openai/gpt-5.5":{id:"openai/gpt-5.5",name:"GPT 5.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:1e6,maxTokens:128e3},"openai/gpt-5.5-pro":{id:"openai/gpt-5.5-pro",name:"GPT 5.5 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh",off:null,minimal:null,low:null},input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:128e3},"openai/gpt-oss-120b":{id:"openai/gpt-oss-120b",name:"GPT OSS 120B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.35,output:.75,cacheRead:.25,cacheWrite:0},contextWindow:131072,maxTokens:131e3},"openai/gpt-oss-20b":{id:"openai/gpt-oss-20b",name:"GPT OSS 20B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.05,output:.2,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:8192},"openai/gpt-oss-safeguard-20b":{id:"openai/gpt-oss-safeguard-20b",name:"GPT OSS Safeguard 20B",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.075,output:.3,cacheRead:.037,cacheWrite:0},contextWindow:131072,maxTokens:65536},"openai/o1":{id:"openai/o1",name:"o1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3":{id:"openai/o3",name:"o3",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-deep-research":{id:"openai/o3-deep-research",name:"o3-deep-research",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:10,output:40,cacheRead:2.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-mini":{id:"openai/o3-mini",name:"o3-mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o3-pro":{id:"openai/o3-pro",name:"o3 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"openai/o4-mini":{id:"openai/o4-mini",name:"o4-mini",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:.275,cacheWrite:0},contextWindow:2e5,maxTokens:1e5},"perplexity/sonar":{id:"perplexity/sonar",name:"Sonar",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:127e3,maxTokens:8e3},"perplexity/sonar-pro":{id:"perplexity/sonar-pro",name:"Sonar Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:8e3},"stepfun/step-3.5-flash":{id:"stepfun/step-3.5-flash",name:"StepFun 3.5 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.09,output:.3,cacheRead:0,cacheWrite:.02},contextWindow:262114,maxTokens:262114},"stepfun/step-3.7-flash":{id:"stepfun/step-3.7-flash",name:"Step 3.7 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.2,output:1.15,cacheRead:.04,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"xai/grok-4.1-fast-non-reasoning":{id:"xai/grok-4.1-fast-non-reasoning",name:"Grok 4.1 Fast Non-Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:.2,output:.5,cacheRead:.05,cacheWrite:0},contextWindow:1e6,maxTokens:1e6},"xai/grok-4.1-fast-reasoning":{id:"xai/grok-4.1-fast-reasoning",name:"Grok 4.1 Fast Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.2,output:.5,cacheRead:.05,cacheWrite:0},contextWindow:1e6,maxTokens:1e6},"xai/grok-4.20-multi-agent":{id:"xai/grok-4.20-multi-agent",name:"Grok 4.20 Multi-Agent",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.2,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-4.20-multi-agent-beta":{id:"xai/grok-4.20-multi-agent-beta",name:"Grok 4.20 Multi Agent Beta",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.2,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-4.20-non-reasoning":{id:"xai/grok-4.20-non-reasoning",name:"Grok 4.20 Non-Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.2,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-4.20-non-reasoning-beta":{id:"xai/grok-4.20-non-reasoning-beta",name:"Grok 4.20 Beta Non-Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!1,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.2,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-4.20-reasoning":{id:"xai/grok-4.20-reasoning",name:"Grok 4.20 Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.2,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-4.20-reasoning-beta":{id:"xai/grok-4.20-reasoning-beta",name:"Grok 4.20 Beta Reasoning",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.2,cacheWrite:0},contextWindow:2e6,maxTokens:2e6},"xai/grok-4.3":{id:"xai/grok-4.3",name:"Grok 4.3",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.2,cacheWrite:0},contextWindow:1e6,maxTokens:1e6},"xai/grok-build-0.1":{id:"xai/grok-build-0.1",name:"Grok Build 0.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1,output:2,cacheRead:.2,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"xiaomi/mimo-v2-flash":{id:"xiaomi/mimo-v2-flash",name:"MiMo V2 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.1,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:262144,maxTokens:32e3},"xiaomi/mimo-v2-pro":{id:"xiaomi/mimo-v2-pro",name:"MiMo V2 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1e6,maxTokens:128e3},"xiaomi/mimo-v2.5":{id:"xiaomi/mimo-v2.5",name:"MiMo M2.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.14,output:.28,cacheRead:.0028,cacheWrite:0},contextWindow:105e4,maxTokens:131100},"xiaomi/mimo-v2.5-pro":{id:"xiaomi/mimo-v2.5-pro",name:"MiMo V2.5 Pro",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.435,output:.87,cacheRead:.0036,cacheWrite:0},contextWindow:105e4,maxTokens:131e3},"zai/glm-4.5":{id:"zai/glm-4.5",name:"GLM-4.5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:128e3,maxTokens:96e3},"zai/glm-4.5-air":{id:"zai/glm-4.5-air",name:"GLM 4.5 Air",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.2,output:1.1,cacheRead:.03,cacheWrite:0},contextWindow:128e3,maxTokens:96e3},"zai/glm-4.5v":{id:"zai/glm-4.5v",name:"GLM 4.5V",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.6,output:1.8,cacheRead:.11,cacheWrite:0},contextWindow:66e3,maxTokens:16e3},"zai/glm-4.6":{id:"zai/glm-4.6",name:"GLM 4.6",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.6,output:2.2,cacheRead:.11,cacheWrite:0},contextWindow:2e5,maxTokens:96e3},"zai/glm-4.6v":{id:"zai/glm-4.6v",name:"GLM-4.6V",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:.3,output:.9,cacheRead:.05,cacheWrite:0},contextWindow:128e3,maxTokens:24e3},"zai/glm-4.6v-flash":{id:"zai/glm-4.6v-flash",name:"GLM-4.6V-Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:24e3},"zai/glm-4.7":{id:"zai/glm-4.7",name:"GLM 4.7",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:2.25,output:2.75,cacheRead:2.25,cacheWrite:0},contextWindow:131e3,maxTokens:4e4},"zai/glm-4.7-flash":{id:"zai/glm-4.7-flash",name:"GLM 4.7 Flash",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.07,output:.4,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131e3},"zai/glm-4.7-flashx":{id:"zai/glm-4.7-flashx",name:"GLM 4.7 FlashX",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:.06,output:.4,cacheRead:.01,cacheWrite:0},contextWindow:2e5,maxTokens:128e3},"zai/glm-5":{id:"zai/glm-5",name:"GLM 5",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1,output:3.2,cacheRead:.2,cacheWrite:0},contextWindow:202800,maxTokens:131100},"zai/glm-5-turbo":{id:"zai/glm-5-turbo",name:"GLM 5 Turbo",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.2,output:4,cacheRead:.24,cacheWrite:0},contextWindow:202800,maxTokens:131100},"zai/glm-5.1":{id:"zai/glm-5.1",name:"GLM 5.1",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.4,output:4.4,cacheRead:.26,cacheWrite:0},contextWindow:202800,maxTokens:64e3},"zai/glm-5.2":{id:"zai/glm-5.2",name:"GLM 5.2",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text"],cost:{input:1.4,output:4.4,cacheRead:.26,cacheWrite:0},contextWindow:1e6,maxTokens:128e3},"zai/glm-5v-turbo":{id:"zai/glm-5v-turbo",name:"GLM 5V Turbo",api:"anthropic-messages",provider:"vercel-ai-gateway",baseUrl:"https://ai-gateway.vercel.sh",reasoning:!0,input:["text","image"],cost:{input:1.2,output:4,cacheRead:.24,cacheWrite:0},contextWindow:2e5,maxTokens:128e3}},xai:{"grok-3":{id:"grok-3",name:"Grok 3",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:3,output:15,cacheRead:.75,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-3-fast":{id:"grok-3-fast",name:"Grok 3 Fast",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:5,output:25,cacheRead:1.25,cacheWrite:0},contextWindow:131072,maxTokens:8192},"grok-4.20-0309-non-reasoning":{id:"grok-4.20-0309-non-reasoning",name:"Grok 4.20 (Non-Reasoning)",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.2,cacheWrite:0},contextWindow:1e6,maxTokens:3e4},"grok-4.20-0309-reasoning":{id:"grok-4.20-0309-reasoning",name:"Grok 4.20 (Reasoning)",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.2,cacheWrite:0},contextWindow:1e6,maxTokens:3e4},"grok-4.3":{id:"grok-4.3",name:"Grok 4.3",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:2.5,cacheRead:.2,cacheWrite:0},contextWindow:1e6,maxTokens:3e4},"grok-build-0.1":{id:"grok-build-0.1",name:"Grok Build 0.1",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!0,input:["text","image"],cost:{input:1,output:2,cacheRead:.2,cacheWrite:0},contextWindow:256e3,maxTokens:256e3},"grok-code-fast-1":{id:"grok-code-fast-1",name:"Grok Code Fast 1",api:"openai-completions",provider:"xai",baseUrl:"https://api.x.ai/v1",reasoning:!1,input:["text"],cost:{input:.2,output:1.5,cacheRead:.02,cacheWrite:0},contextWindow:32768,maxTokens:8192}},xiaomi:{"mimo-v2-flash":{id:"mimo-v2-flash",name:"MiMo-V2-Flash",api:"openai-completions",provider:"xiaomi",baseUrl:"https://api.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:.1,output:.3,cacheRead:.01,cacheWrite:0},contextWindow:262144,maxTokens:65536},"mimo-v2-omni":{id:"mimo-v2-omni",name:"MiMo-V2-Omni",api:"openai-completions",provider:"xiaomi",baseUrl:"https://api.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:262144,maxTokens:131072},"mimo-v2-pro":{id:"mimo-v2-pro",name:"MiMo-V2-Pro",api:"openai-completions",provider:"xiaomi",baseUrl:"https://api.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5":{id:"mimo-v2.5",name:"MiMo-V2.5",api:"openai-completions",provider:"xiaomi",baseUrl:"https://api.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5-pro":{id:"mimo-v2.5-pro",name:"MiMo-V2.5-Pro",api:"openai-completions",provider:"xiaomi",baseUrl:"https://api.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5-pro-ultraspeed":{id:"mimo-v2.5-pro-ultraspeed",name:"MiMo-V2.5-Pro-UltraSpeed",api:"openai-completions",provider:"xiaomi",baseUrl:"https://api.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1.305,output:2.61,cacheRead:.0108,cacheWrite:0},contextWindow:1048576,maxTokens:131072}},"xiaomi-token-plan-ams":{"mimo-v2-omni":{id:"mimo-v2-omni",name:"MiMo-V2-Omni",api:"openai-completions",provider:"xiaomi-token-plan-ams",baseUrl:"https://token-plan-ams.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:262144,maxTokens:131072},"mimo-v2-pro":{id:"mimo-v2-pro",name:"MiMo-V2-Pro",api:"openai-completions",provider:"xiaomi-token-plan-ams",baseUrl:"https://token-plan-ams.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5":{id:"mimo-v2.5",name:"MiMo-V2.5",api:"openai-completions",provider:"xiaomi-token-plan-ams",baseUrl:"https://token-plan-ams.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5-pro":{id:"mimo-v2.5-pro",name:"MiMo-V2.5-Pro",api:"openai-completions",provider:"xiaomi-token-plan-ams",baseUrl:"https://token-plan-ams.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5-pro-ultraspeed":{id:"mimo-v2.5-pro-ultraspeed",name:"MiMo-V2.5-Pro-UltraSpeed",api:"openai-completions",provider:"xiaomi-token-plan-ams",baseUrl:"https://token-plan-ams.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1.305,output:2.61,cacheRead:.0108,cacheWrite:0},contextWindow:1048576,maxTokens:131072}},"xiaomi-token-plan-cn":{"mimo-v2-omni":{id:"mimo-v2-omni",name:"MiMo-V2-Omni",api:"openai-completions",provider:"xiaomi-token-plan-cn",baseUrl:"https://token-plan-cn.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:262144,maxTokens:131072},"mimo-v2-pro":{id:"mimo-v2-pro",name:"MiMo-V2-Pro",api:"openai-completions",provider:"xiaomi-token-plan-cn",baseUrl:"https://token-plan-cn.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5":{id:"mimo-v2.5",name:"MiMo-V2.5",api:"openai-completions",provider:"xiaomi-token-plan-cn",baseUrl:"https://token-plan-cn.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5-pro":{id:"mimo-v2.5-pro",name:"MiMo-V2.5-Pro",api:"openai-completions",provider:"xiaomi-token-plan-cn",baseUrl:"https://token-plan-cn.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5-pro-ultraspeed":{id:"mimo-v2.5-pro-ultraspeed",name:"MiMo-V2.5-Pro-UltraSpeed",api:"openai-completions",provider:"xiaomi-token-plan-cn",baseUrl:"https://token-plan-cn.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1.305,output:2.61,cacheRead:.0108,cacheWrite:0},contextWindow:1048576,maxTokens:131072}},"xiaomi-token-plan-sgp":{"mimo-v2-omni":{id:"mimo-v2-omni",name:"MiMo-V2-Omni",api:"openai-completions",provider:"xiaomi-token-plan-sgp",baseUrl:"https://token-plan-sgp.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:262144,maxTokens:131072},"mimo-v2-pro":{id:"mimo-v2-pro",name:"MiMo-V2-Pro",api:"openai-completions",provider:"xiaomi-token-plan-sgp",baseUrl:"https://token-plan-sgp.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5":{id:"mimo-v2.5",name:"MiMo-V2.5",api:"openai-completions",provider:"xiaomi-token-plan-sgp",baseUrl:"https://token-plan-sgp.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text","image"],cost:{input:.4,output:2,cacheRead:.08,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5-pro":{id:"mimo-v2.5-pro",name:"MiMo-V2.5-Pro",api:"openai-completions",provider:"xiaomi-token-plan-sgp",baseUrl:"https://token-plan-sgp.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1,output:3,cacheRead:.2,cacheWrite:0},contextWindow:1048576,maxTokens:131072},"mimo-v2.5-pro-ultraspeed":{id:"mimo-v2.5-pro-ultraspeed",name:"MiMo-V2.5-Pro-UltraSpeed",api:"openai-completions",provider:"xiaomi-token-plan-sgp",baseUrl:"https://token-plan-sgp.xiaomimimo.com/v1",compat:{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:"deepseek"},reasoning:!0,input:["text"],cost:{input:1.305,output:2.61,cacheRead:.0108,cacheWrite:0},contextWindow:1048576,maxTokens:131072}},zai:{"glm-4.5-air":{id:"glm-4.5-air",name:"GLM-4.5-Air",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai"},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:98304},"glm-4.7":{id:"glm-4.7",name:"GLM-4.7",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai",zaiToolStream:!0},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"glm-5-turbo":{id:"glm-5-turbo",name:"GLM-5-Turbo",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai",zaiToolStream:!0},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131072},"glm-5.1":{id:"glm-5.1",name:"GLM-5.1",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai",zaiToolStream:!0},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131072},"glm-5.2":{id:"glm-5.2",name:"GLM-5.2",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai",zaiToolStream:!0},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:131072},"glm-5v-turbo":{id:"glm-5v-turbo",name:"GLM-5V-Turbo",api:"openai-completions",provider:"zai",baseUrl:"https://api.z.ai/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai",zaiToolStream:!0},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131072}},"zai-coding-cn":{"glm-4.5-air":{id:"glm-4.5-air",name:"GLM-4.5-Air",api:"openai-completions",provider:"zai-coding-cn",baseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai"},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:131072,maxTokens:98304},"glm-4.7":{id:"glm-4.7",name:"GLM-4.7",api:"openai-completions",provider:"zai-coding-cn",baseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai",zaiToolStream:!0},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:204800,maxTokens:131072},"glm-5-turbo":{id:"glm-5-turbo",name:"GLM-5-Turbo",api:"openai-completions",provider:"zai-coding-cn",baseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai",zaiToolStream:!0},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131072},"glm-5.1":{id:"glm-5.1",name:"GLM-5.1",api:"openai-completions",provider:"zai-coding-cn",baseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai",zaiToolStream:!0},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131072},"glm-5.2":{id:"glm-5.2",name:"GLM-5.2",api:"openai-completions",provider:"zai-coding-cn",baseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai",zaiToolStream:!0},reasoning:!0,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:1e6,maxTokens:131072},"glm-5v-turbo":{id:"glm-5v-turbo",name:"GLM-5V-Turbo",api:"openai-completions",provider:"zai-coding-cn",baseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",compat:{supportsDeveloperRole:!1,thinkingFormat:"zai",zaiToolStream:!0},reasoning:!0,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:2e5,maxTokens:131072}}}});function Fg(){return Array.from(Wg.keys())}function Ug(t){let e=Wg.get(t);return e?Array.from(e.values()):[]}function fn(t,e){return e.cost.input=t.cost.input/1e6*e.input,e.cost.output=t.cost.output/1e6*e.output,e.cost.cacheRead=t.cost.cacheRead/1e6*e.cacheRead,e.cost.cacheWrite=t.cost.cacheWrite/1e6*e.cacheWrite,e.cost.total=e.cost.input+e.cost.output+e.cost.cacheRead+e.cost.cacheWrite,e.cost}function kS(t){return t.reasoning?el.filter(e=>{let n=t.thinkingLevelMap?.[e];return n===null?!1:e==="xhigh"?n!==void 0:!0}):["off"]}function _t(t,e){let n=kS(t);if(n.includes(e))return e;let i=el.indexOf(e);if(i===-1)return n[0]??"off";for(let s=i;s<el.length;s++){let r=el[s];if(n.includes(r))return r}for(let s=i-1;s>=0;s--){let r=el[s];if(n.includes(r))return r}return n[0]??"off"}function zn(t,e){return!t||!e?!1:t.id===e.id&&t.provider===e.provider}var Wg,el,In=qe(()=>{"use strict";CS();Wg=new Map;for(let[t,e]of Object.entries(TS)){let n=new Map;for(let[i,s]of Object.entries(e))n.set(i,s);Wg.set(t,n)}el=["off","minimal","low","medium","high","xhigh"]});var Dg,rt,Pn=qe(()=>{"use strict";Dg=class{constructor(e,n){this.queue=[];this.waiting=[];this.done=!1;this.isComplete=e,this.extractResult=n,this.finalResultPromise=new Promise(i=>{this.resolveFinalResult=i})}push(e){if(this.done)return;this.isComplete(e)&&(this.done=!0,this.resolveFinalResult(this.extractResult(e)));let n=this.waiting.shift();n?n({value:e,done:!1}):this.queue.push(e)}end(e){for(this.done=!0,e!==void 0&&this.resolveFinalResult(e);this.waiting.length>0;)this.waiting.shift()({value:void 0,done:!0})}async*[Symbol.asyncIterator](){for(;;)if(this.queue.length>0)yield this.queue.shift();else{if(this.done)return;{let e=await new Promise(n=>this.waiting.push(n));if(e.done)return;yield e.value}}}result(){return this.finalResultPromise}},rt=class extends Dg{constructor(){super(e=>e.type==="done"||e.type==="error",e=>{if(e.type==="done")return e.message;if(e.type==="error")return e.error;throw new Error("Unexpected event type for final result")})}}});import{parse as MS}from"partial-json";function _L(t){let e=t.codePointAt(0);return e!==void 0&&e>=0&&e<=31}function EL(t){switch(t){case"\b":return"\\b";case"\f":return"\\f";case`
|
|
2
2
|
`:return"\\n";case"\r":return"\\r";case" ":return"\\t";default:return`\\u${t.codePointAt(0)?.toString(16).padStart(4,"0")??"0000"}`}}function RS(t){let e="",n=!1;for(let i=0;i<t.length;i++){let s=t[i];if(!n){e+=s,s==='"'&&(n=!0);continue}if(s==='"'){e+=s,n=!1;continue}if(s==="\\"){let r=t[i+1];if(r===void 0){e+="\\\\";continue}if(r==="u"){let o=t.slice(i+2,i+6);if(/^[0-9a-fA-F]{4}$/.test(o)){e+=`\\u${o}`,i+=5;continue}}if(PL.has(r)){e+=`\\${r}`,i+=1;continue}e+="\\\\";continue}e+=_L(s)?EL(s):s}return e}function $g(t){try{return JSON.parse(t)}catch(e){let n=RS(t);if(n!==t)return JSON.parse(n);throw e}}function Kt(t){if(!t||t.trim()==="")return{};try{return $g(t)}catch{try{return MS(t)??{}}catch{try{return MS(RS(t))??{}}catch{return{}}}}}var PL,na=qe(()=>{"use strict";PL=new Set(['"',"\\","/","b","f","n","r","t","u"])});function xd(t){return t==="cloudflare-workers-ai"||t==="cloudflare-ai-gateway"}function ia(t){let e=t.baseUrl;return e.includes("{")?e.replace(/\{([A-Z_][A-Z0-9_]*)\}/g,(i,s)=>{let r=process.env[s];if(!r)throw new Error(`${s} is required for provider ${t.provider} but is not set.`);return r}):e}var vd=qe(()=>{"use strict"});function AL(t){let e=t[t.length-1];return e&&e.role!=="user"?"agent":"user"}function sa(t){return t.some(e=>e.role==="user"&&Array.isArray(e.content)?e.content.some(n=>n.type==="image"):e.role==="toolResult"&&Array.isArray(e.content)?e.content.some(n=>n.type==="image"):!1)}function ra(t){let e={"X-Initiator":AL(t.messages),"Openai-Intent":"conversation-edits"};return t.hasImages&&(e["Copilot-Vision-Request"]="true"),e}var yd=qe(()=>{"use strict"});function Et(t,e,n){return{temperature:e?.temperature,maxTokens:e?.maxTokens,signal:e?.signal,apiKey:n||e?.apiKey,transport:e?.transport,cacheRetention:e?.cacheRetention,sessionId:e?.sessionId,headers:e?.headers,onPayload:e?.onPayload,onResponse:e?.onResponse,timeoutMs:e?.timeoutMs,websocketConnectTimeoutMs:e?.websocketConnectTimeoutMs,maxRetries:e?.maxRetries,maxRetryDelayMs:e?.maxRetryDelayMs,metadata:e?.metadata}}function OL(t){return t==="xhigh"?"high":t}function IS(t,e,n,i){let r={...{minimal:1024,low:2048,medium:8192,high:16384},...i},o=1024,a=OL(n),c=r[a],l=t===void 0?e:Math.min(t+c,e);return l<=c&&(c=Math.max(0,l-o)),{maxTokens:l,thinkingBudget:c}}var Li=qe(()=>{"use strict"});function PS(t,e){let n=[],i=!1;for(let s of t){if(s.type==="image"){i||n.push({type:"text",text:e}),i=!0;continue}n.push(s),i=s.text===e}return n}function FL(t,e){return e.input.includes("image")?t:t.map(n=>n.role==="user"&&Array.isArray(n.content)?{...n,content:PS(n.content,LL)}:n.role==="toolResult"?{...n,content:PS(n.content,WL)}:n)}function ai(t,e,n){let i=new Map,r=FL(t,e).map(u=>{if(u.role==="user")return u;if(u.role==="toolResult"){let d=i.get(u.toolCallId);return d&&d!==u.toolCallId?{...u,toolCallId:d}:u}if(u.role==="assistant"){let d=u,p=d.provider===e.provider&&d.api===e.api&&d.model===e.id,m=d.content.flatMap(g=>{if(g.type==="thinking")return g.redacted?p?g:[]:p&&g.thinkingSignature?g:!g.thinking||g.thinking.trim()===""?[]:p?g:{type:"text",text:g.thinking};if(g.type==="text")return p?g:{type:"text",text:g.text};if(g.type==="toolCall"){let h=g,f=h;if(!p&&h.thoughtSignature&&(f={...h},delete f.thoughtSignature),!p&&n){let x=n(h.id,e,d);x!==h.id&&(i.set(h.id,x),f={...f,id:x})}return f}return g});return{...d,content:m}}return u}),o=[],a=[],c=new Set,l=()=>{if(a.length>0){for(let u of a)c.has(u.id)||o.push({role:"toolResult",toolCallId:u.id,toolName:u.name,content:[{type:"text",text:"No result provided"}],isError:!0,timestamp:Date.now()});a=[],c=new Set}};for(let u=0;u<r.length;u++){let d=r[u];if(d.role==="assistant"){l();let p=d;if(p.stopReason==="error"||p.stopReason==="aborted")continue;let m=p.content.filter(g=>g.type==="toolCall");m.length>0&&(a=m,c=new Set),o.push(d)}else d.role==="toolResult"?(c.add(d.toolCallId),o.push(d)):(d.role==="user"&&l(),o.push(d))}return l(),o}var LL,WL,oa=qe(()=>{"use strict";LL="(image omitted: model does not support images)",WL="(tool image omitted: model does not support images)"});var LS={};Ei(LS,{streamAnthropic:()=>Cd,streamSimpleAnthropic:()=>JL});import wd from"@anthropic-ai/sdk";function ES(t){return t||(typeof process<"u"&&process.env.PI_CACHE_RETENTION==="long"?"long":"short")}function UL(t,e){let n=ES(e);if(n==="none")return{retention:n};let i=n==="long"&&kd(t).supportsLongCacheRetention?"1h":void 0;return{retention:n,cacheControl:{type:"ephemeral",...i&&{ttl:i}}}}function _S(t){if(!t.some(s=>s.type==="image"))return he(t.map(s=>s.text).join(`
|
|
3
3
|
`));let n=t.map(s=>s.type==="text"?{type:"text",text:he(s.text)}:{type:"image",source:{type:"base64",media_type:s.mimeType,data:s.data}});return n.some(s=>s.type==="text")||n.unshift({type:"text",text:"(see attached image)"}),n}function kd(t){let e=t.provider==="fireworks",n=t.provider==="cloudflare-ai-gateway"&&t.baseUrl.includes("anthropic");return{supportsEagerToolInputStreaming:t.compat?.supportsEagerToolInputStreaming??!e,supportsLongCacheRetention:t.compat?.supportsLongCacheRetention??!e,sendSessionAffinityHeaders:t.compat?.sendSessionAffinityHeaders??!!(e||n),supportsCacheControlOnTools:t.compat?.supportsCacheControlOnTools??!e,supportsTemperature:t.compat?.supportsTemperature??!0,allowEmptySignature:t.compat?.allowEmptySignature??!1}}function Sd(...t){let e={};for(let n of t)n&&Object.assign(e,n);return e}function OS(t){if(!t.event&&t.data.length===0)return null;let e={event:t.event,data:t.data.join(`
|
|
4
4
|
`),raw:[...t.raw]};return t.event=null,t.data=[],t.raw=[],e}function Bg(t,e){if(t==="")return OS(e);if(e.raw.push(t),t.startsWith(":"))return null;let n=t.indexOf(":"),i=n===-1?t:t.slice(0,n),s=n===-1?"":t.slice(n+1);return s.startsWith(" ")&&(s=s.slice(1)),i==="event"?e.event=s:i==="data"&&e.data.push(s),null}function KL(t){let e=t.indexOf("\r"),n=t.indexOf(`
|
|
@@ -177,10 +177,10 @@ ${n.map(o=>` ${o}`).join(`
|
|
|
177
177
|
${s?`<div class="details">${s}</div>`:""}
|
|
178
178
|
</main>
|
|
179
179
|
</body>
|
|
180
|
-
</html>`}function gp(t){return Wk({title:"Authentication successful",heading:"Authentication successful",message:t})}function ui(t,e){return Wk({title:"Authentication failed",heading:"Authentication failed",message:t,details:e})}function Fk(t){let e="";for(let n of t)e+=String.fromCharCode(n);return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}async function fp(){let t=new Uint8Array(32);crypto.getRandomValues(t);let e=Fk(t),i=new TextEncoder().encode(e),s=await crypto.subtle.digest("SHA-256",i),r=Fk(new Uint8Array(s));return{verifier:e,challenge:r}}var bp=null,Vf=null,v4=t=>atob(t),Qf=v4("OWQxYzI1MGEtZTYxYi00NGQ5LTg4ZWQtNTk0NGQxOTYyZjVl"),y4="https://claude.ai/oauth/authorize",_a="https://platform.claude.com/v1/oauth/token",w4=process.env.PI_OAUTH_CALLBACK_HOST||"127.0.0.1",Uk=53692,Dk="/callback",Pa=`http://localhost:${Uk}${Dk}`,S4="org:create_api_key user:profile user:inference user:sessions:claude_code user:mcp_servers user:file_upload";async function T4(){if(bp)return bp;if(!Vf){if(typeof process>"u"||!process.versions?.node&&!process.versions?.bun)throw new Error("Anthropic OAuth is only available in Node.js environments");Vf=import("node:http").then(t=>({createServer:t.createServer}))}return bp=await Vf,bp}function Jf(t){let e=t.trim();if(!e)return{};try{let n=new URL(e);return{code:n.searchParams.get("code")??void 0,state:n.searchParams.get("state")??void 0}}catch{}if(e.includes("#")){let[n,i]=e.split("#",2);return{code:n,state:i}}if(e.includes("code=")){let n=new URLSearchParams(e);return{code:n.get("code")??void 0,state:n.get("state")??void 0}}return{code:e}}function kl(t){if(t instanceof Error){let e=[`${t.name}: ${t.message}`],n=t;return n.code&&e.push(`code=${n.code}`),typeof n.errno<"u"&&e.push(`errno=${String(n.errno)}`),typeof t.cause<"u"&&e.push(`cause=${kl(t.cause)}`),t.stack&&e.push(`stack=${t.stack}`),e.join("; ")}return String(t)}async function C4(t){let{createServer:e}=await T4();return new Promise((n,i)=>{let s,r=new Promise(a=>{let c=!1;s=l=>{c||(c=!0,a(l))}}),o=e((a,c)=>{try{let l=new URL(a.url||"","http://localhost");if(l.pathname!==Dk){c.writeHead(404,{"Content-Type":"text/html; charset=utf-8"}),c.end(ui("Callback route not found."));return}let u=l.searchParams.get("code"),d=l.searchParams.get("state"),p=l.searchParams.get("error");if(p){c.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),c.end(ui("Anthropic authentication did not complete.",`Error: ${p}`));return}if(!u||!d){c.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),c.end(ui("Missing code or state parameter."));return}if(d!==t){c.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),c.end(ui("State mismatch."));return}c.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),c.end(gp("Anthropic authentication completed. You can close this window.")),s?.({code:u,state:d})}catch{c.writeHead(500,{"Content-Type":"text/plain; charset=utf-8"}),c.end("Internal error")}});o.on("error",a=>{i(a)}),o.listen(Uk,w4,()=>{n({server:o,redirectUri:Pa,cancelWait:()=>{s?.(null)},waitForCode:()=>r})})})}async function $k(t,e){let n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(e),signal:AbortSignal.timeout(3e4)}),i=await n.text();if(!n.ok)throw new Error(`HTTP request failed. status=${n.status}; url=${t}; body=${i}`);return i}async function k4(t,e,n,i){let s;try{s=await $k(_a,{grant_type:"authorization_code",client_id:Qf,code:t,state:e,redirect_uri:i,code_verifier:n})}catch(o){throw new Error(`Token exchange request failed. url=${_a}; redirect_uri=${i}; response_type=authorization_code; details=${kl(o)}`)}let r;try{r=JSON.parse(s)}catch(o){throw new Error(`Token exchange returned invalid JSON. url=${_a}; body=${s}; details=${kl(o)}`)}return{refresh:r.refresh_token,access:r.access_token,expires:Date.now()+r.expires_in*1e3-300*1e3}}async function Bk(t){let{verifier:e,challenge:n}=await fp(),i=await C4(e),s,r,o=Pa;try{let a=new URLSearchParams({code:"true",client_id:Qf,response_type:"code",redirect_uri:Pa,scope:S4,code_challenge:n,code_challenge_method:"S256",state:e});if(t.onAuth({url:`${y4}?${a.toString()}`,instructions:"Complete login in your browser. If the browser is on another machine, paste the final redirect URL here."}),t.onManualCodeInput){let c,l,u=t.onManualCodeInput().then(p=>{c=p,i.cancelWait()}).catch(p=>{l=p instanceof Error?p:new Error(String(p)),i.cancelWait()}),d=await i.waitForCode();if(l)throw l;if(d?.code)s=d.code,r=d.state,o=Pa;else if(c){let p=Jf(c);if(p.state&&p.state!==e)throw new Error("OAuth state mismatch");s=p.code,r=p.state??e}if(!s){if(await u,l)throw l;if(c){let p=Jf(c);if(p.state&&p.state!==e)throw new Error("OAuth state mismatch");s=p.code,r=p.state??e}}}else{let c=await i.waitForCode();c?.code&&(s=c.code,r=c.state,o=Pa)}if(!s){let c=await t.onPrompt({message:"Paste the authorization code or full redirect URL:",placeholder:Pa}),l=Jf(c);if(l.state&&l.state!==e)throw new Error("OAuth state mismatch");s=l.code,r=l.state??e}if(!s)throw new Error("Missing authorization code");if(!r)throw new Error("Missing OAuth state");return t.onProgress?.("Exchanging authorization code for tokens..."),k4(s,r,e,o)}finally{i.server.close()}}async function Nk(t){let e;try{e=await $k(_a,{grant_type:"refresh_token",client_id:Qf,refresh_token:t})}catch(i){throw new Error(`Anthropic token refresh request failed. url=${_a}; details=${kl(i)}`)}let n;try{n=JSON.parse(e)}catch(i){throw new Error(`Anthropic token refresh returned invalid JSON. url=${_a}; body=${e}; details=${kl(i)}`)}return{refresh:n.refresh_token,access:n.access_token,expires:Date.now()+n.expires_in*1e3-300*1e3}}var Yf={id:"anthropic",name:"Anthropic (Claude Pro/Max)",usesCallbackServer:!0,async login(t){return Bk({onAuth:t.onAuth,onPrompt:t.onPrompt,onProgress:t.onProgress,onManualCodeInput:t.onManualCodeInput})},async refreshToken(t){return Nk(t.refresh)},getApiKey(t){return t.access}};var jk="Login cancelled",M4="Device flow timed out",R4="Device flow timed out after one or more slow_down responses. This is often caused by clock drift in WSL or VM environments. Please sync or restart the VM clock and try again.";function I4(t,e,n){return new Promise((i,s)=>{if(e?.aborted){s(new Error(n));return}let r=()=>{clearTimeout(o),s(new Error(n))},o=setTimeout(()=>{e?.removeEventListener("abort",r),i()},t);e?.addEventListener("abort",r,{once:!0})})}async function xp(t){let e=typeof t.expiresInSeconds=="number"?Date.now()+t.expiresInSeconds*1e3:Number.POSITIVE_INFINITY,n=Math.max(1e3,Math.floor((t.intervalSeconds??5)*1e3)),i=0;for(;Date.now()<e;){if(t.signal?.aborted)throw new Error(jk);let s=await t.poll();if(s.status==="complete")return s.value;if(s.status==="failed")throw new Error(s.message);s.status==="slow_down"&&(i+=1,n=Math.max(1e3,n+5e3));let r=e-Date.now();if(r<=0)break;await I4(Math.min(n,r),t.signal,jk)}throw new Error(i>0?R4:M4)}In();var P4=t=>atob(t),qk=P4("SXYxLmI1MDdhMDhjODdlY2ZlOTg="),Gk={"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"};function Xf(t){let e=t.trim();if(!e)return null;try{return(e.includes("://")?new URL(e):new URL(`https://${e}`)).hostname}catch{return null}}function Zf(t){return{deviceCodeUrl:`https://${t}/login/device/code`,accessTokenUrl:`https://${t}/login/oauth/access_token`,copilotTokenUrl:`https://api.${t}/copilot_internal/v2/token`}}function _4(t){let e=t.match(/proxy-ep=([^;]+)/);return e?`https://${e[1].replace(/^proxy\./,"api.")}`:null}function e0(t,e){if(t){let n=_4(t);if(n)return n}return e?`https://copilot-api.${e}`:"https://api.individual.githubcopilot.com"}async function t0(t,e){let n=await fetch(t,e);if(!n.ok){let i=await n.text();throw new Error(`${n.status} ${n.statusText}: ${i}`)}return n.json()}async function E4(t){let e=Zf(t),n=await t0(e.deviceCodeUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","User-Agent":"GitHubCopilotChat/0.35.0"},body:new URLSearchParams({client_id:qk,scope:"read:user"})});if(!n||typeof n!="object")throw new Error("Invalid device code response");let i=n.device_code,s=n.user_code,r=n.verification_uri,o=n.interval,a=n.expires_in;if(typeof i!="string"||typeof s!="string"||typeof r!="string"||o!==void 0&&typeof o!="number"||typeof a!="number")throw new Error("Invalid device code response fields");let c;try{c=new URL(r)}catch{throw new Error("Untrusted verification_uri in device code response")}if(c.protocol!=="https:"&&c.protocol!=="http:")throw new Error("Untrusted verification_uri in device code response");return{device_code:i,user_code:s,verification_uri:c.href,interval:o,expires_in:a}}async function A4(t,e,n){let i=Zf(t);return xp({intervalSeconds:e.interval,expiresInSeconds:e.expires_in,signal:n,poll:async()=>{let s=await t0(i.accessTokenUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","User-Agent":"GitHubCopilotChat/0.35.0"},body:new URLSearchParams({client_id:qk,device_code:e.device_code,grant_type:"urn:ietf:params:oauth:grant-type:device_code"})});if(s&&typeof s=="object"&&typeof s.access_token=="string")return{status:"complete",value:s.access_token};if(s&&typeof s=="object"&&typeof s.error=="string"){let{error:r,error_description:o}=s;if(r==="authorization_pending")return{status:"pending"};if(r==="slow_down")return{status:"slow_down"};let a=o?`: ${o}`:"";return{status:"failed",message:`Device flow failed: ${r}${a}`}}return{status:"failed",message:"Invalid device token response"}}})}async function n0(t,e){let i=Zf(e||"github.com"),s=await t0(i.copilotTokenUrl,{headers:{Accept:"application/json",Authorization:`Bearer ${t}`,...Gk}});if(!s||typeof s!="object")throw new Error("Invalid Copilot token response");let r=s.token,o=s.expires_at;if(typeof r!="string"||typeof o!="number")throw new Error("Invalid Copilot token response fields");return{refresh:t,access:r,expires:o*1e3-300*1e3,enterpriseUrl:e}}async function O4(t,e,n){let s=`${e0(t,n)}/models/${e}/policy`;try{return(await fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`,...Gk,"openai-intent":"chat-policy","x-interaction-type":"chat-policy"},body:JSON.stringify({state:"enabled"})})).ok}catch{return!1}}async function L4(t,e,n){let i=Ug("github-copilot");await Promise.all(i.map(async s=>{let r=await O4(t,s.id,e);n?.(s.id,r)}))}async function Kk(t){let e=await t.onPrompt({message:"GitHub Enterprise URL/domain (blank for github.com)",placeholder:"company.ghe.com",allowEmpty:!0});if(t.signal?.aborted)throw new Error("Login cancelled");let n=e.trim(),i=Xf(e);if(n&&!i)throw new Error("Invalid GitHub Enterprise URL/domain");let s=i||"github.com",r=await E4(s);t.onDeviceCode({userCode:r.user_code,verificationUri:r.verification_uri,intervalSeconds:r.interval,expiresInSeconds:r.expires_in});let o=await A4(s,r,t.signal),a=await n0(o,i??void 0);return t.onProgress?.("Enabling models..."),await L4(a.access,i??void 0),a}var i0={id:"github-copilot",name:"GitHub Copilot",async login(t){return Kk({onDeviceCode:t.onDeviceCode,onPrompt:t.onPrompt,onProgress:t.onProgress,signal:t.signal})},async refreshToken(t){let e=t;return n0(e.refresh,e.enterpriseUrl)},getApiKey(t){return t.access},modifyModels(t,e){let n=e,i=n.enterpriseUrl?Xf(n.enterpriseUrl)??void 0:void 0,s=e0(n.access,i);return t.map(r=>r.provider==="github-copilot"?{...r,baseUrl:s}:r)}};var r0=null,o0=null;typeof process<"u"&&(process.versions?.node||process.versions?.bun)&&(import("node:crypto").then(t=>{r0=t.randomBytes}),import("node:http").then(t=>{o0=t}));var vp="app_EMoamEEZ73f0CkXaXp7hrann",Ea="https://auth.openai.com",W4=`${Ea}/oauth/authorize`,Hk=`${Ea}/oauth/token`,l0="http://localhost:1455/auth/callback",F4=`${Ea}/api/accounts/deviceauth/usercode`,U4=`${Ea}/api/accounts/deviceauth/token`,D4=`${Ea}/codex/device`,$4=`${Ea}/deviceauth/callback`,zk=900,a0="browser",c0="device_code",B4="openid profile email offline_access",N4="https://api.openai.com/auth";function j4(){return typeof process<"u"&&process.env.PI_OAUTH_CALLBACK_HOST||"127.0.0.1"}function q4(){if(!r0)throw new Error("OpenAI Codex OAuth is only available in Node.js environments");return r0(16).toString("hex")}function s0(t){let e=t.trim();if(!e)return{};try{let n=new URL(e);return{code:n.searchParams.get("code")??void 0,state:n.searchParams.get("state")??void 0}}catch{}if(e.includes("#")){let[n,i]=e.split("#",2);return{code:n,state:i}}if(e.includes("code=")){let n=new URLSearchParams(e);return{code:n.get("code")??void 0,state:n.get("state")??void 0}}return{code:e}}function G4(t){try{let e=t.split(".");if(e.length!==3)return null;let n=e[1]??"",i=atob(n);return JSON.parse(i)}catch{return null}}async function u0(t,e){try{return await fetch(t,e)}catch(n){throw e.signal?.aborted?new Error("Login cancelled"):n}}async function Vk(t,e){if(!t.ok){let s=await t.text().catch(()=>"");throw new Error(`OpenAI Codex token ${e} failed (${t.status}): ${s||t.statusText}`)}let i=await t.json();if(!i?.access_token||!i.refresh_token||typeof i.expires_in!="number")throw new Error(`OpenAI Codex token ${e} response missing fields: ${JSON.stringify(i)}`);return{access:i.access_token,refresh:i.refresh_token,expires:Date.now()+i.expires_in*1e3}}async function K4(t,e,n=l0,i){let s=await u0(Hk,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",client_id:vp,code:t,code_verifier:e,redirect_uri:n}),signal:i});return Vk(s,"exchange")}async function H4(t){let e;try{e=await fetch(Hk,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:t,client_id:vp})})}catch(n){throw new Error(`OpenAI Codex token refresh error: ${n instanceof Error?n.message:String(n)}`)}return Vk(e,"refresh")}async function z4(t){let e=await u0(F4,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:vp}),signal:t});if(!e.ok){if(e.status===404)throw new Error("OpenAI Codex device code login is not enabled for this server. Use browser login or verify the server URL.");let r=await e.text().catch(()=>"");throw new Error(`OpenAI Codex device code request failed with status ${e.status}${r?`: ${r}`:""}`)}let i=await e.json(),s=typeof i?.interval=="string"?Number(i.interval.trim()):i?.interval;if(!i?.device_auth_id||!i.user_code||typeof s!="number"||!Number.isFinite(s)||s<0)throw new Error(`Invalid OpenAI Codex device code response: ${JSON.stringify(i)}`);return{deviceAuthId:i.device_auth_id,userCode:i.user_code,intervalSeconds:s}}async function V4(t,e){return xp({intervalSeconds:t.intervalSeconds,expiresInSeconds:zk,signal:e,poll:async()=>{let n=await u0(U4,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_auth_id:t.deviceAuthId,user_code:t.userCode}),signal:e});if(n.ok){let o=await n.json();return!o?.authorization_code||!o.code_verifier?{status:"failed",message:`Invalid OpenAI Codex device auth token response: ${JSON.stringify(o)}`}:{status:"complete",value:{authorizationCode:o.authorization_code,codeVerifier:o.code_verifier}}}if(n.status===403||n.status===404)return{status:"pending"};let i=await n.text().catch(()=>""),s;try{let o=JSON.parse(i)?.error;s=typeof o=="object"?o?.code:o}catch{}return s==="deviceauth_authorization_pending"?{status:"pending"}:s==="slow_down"?{status:"slow_down"}:{status:"failed",message:`OpenAI Codex device auth failed with status ${n.status}${i?`: ${i}`:""}`}}})}async function J4(t="sling"){let{verifier:e,challenge:n}=await fp(),i=q4(),s=new URL(W4);return s.searchParams.set("response_type","code"),s.searchParams.set("client_id",vp),s.searchParams.set("redirect_uri",l0),s.searchParams.set("scope",B4),s.searchParams.set("code_challenge",n),s.searchParams.set("code_challenge_method","S256"),s.searchParams.set("state",i),s.searchParams.set("id_token_add_organizations","true"),s.searchParams.set("codex_cli_simplified_flow","true"),s.searchParams.set("originator",t),{verifier:e,state:i,url:s.toString()}}function Q4(t){if(!o0)throw new Error("OpenAI Codex OAuth is only available in Node.js environments");let e,n=new Promise(s=>{let r=!1;e=o=>{r||(r=!0,s(o))}}),i=o0.createServer((s,r)=>{try{let o=new URL(s.url||"","http://localhost");if(o.pathname!=="/auth/callback"){r.statusCode=404,r.setHeader("Content-Type","text/html; charset=utf-8"),r.end(ui("Callback route not found."));return}if(o.searchParams.get("state")!==t){r.statusCode=400,r.setHeader("Content-Type","text/html; charset=utf-8"),r.end(ui("State mismatch."));return}let a=o.searchParams.get("code");if(!a){r.statusCode=400,r.setHeader("Content-Type","text/html; charset=utf-8"),r.end(ui("Missing authorization code."));return}r.statusCode=200,r.setHeader("Content-Type","text/html; charset=utf-8"),r.end(gp("OpenAI authentication completed. You can close this window.")),e?.({code:a})}catch{r.statusCode=500,r.setHeader("Content-Type","text/html; charset=utf-8"),r.end(ui("Internal error while processing OAuth callback."))}});return new Promise(s=>{i.listen(1455,j4(),()=>{s({close:()=>i.close(),cancelWait:()=>{e?.(null)},waitForCode:()=>n})}).on("error",r=>{e?.(null),s({close:()=>{try{i.close()}catch{}},cancelWait:()=>{},waitForCode:async()=>null})})})}function Y4(t){let i=G4(t)?.[N4]?.chatgpt_account_id;return typeof i=="string"&&i.length>0?i:null}function Jk(t){let e=Y4(t.access);if(!e)throw new Error("Failed to extract accountId from token");return{access:t.access,refresh:t.refresh,expires:t.expires,accountId:e}}async function Qk(t,e,n,i){return Jk(await K4(t,e,n,i))}async function Yk(t){let e=await z4(t.signal);t.onDeviceCode({userCode:e.userCode,verificationUri:D4,intervalSeconds:e.intervalSeconds,expiresInSeconds:zk});let n=await V4(e,t.signal);return Qk(n.authorizationCode,n.codeVerifier,$4,t.signal)}async function Xk(t){let{verifier:e,state:n,url:i}=await J4(t.originator),s=await Q4(n);t.onAuth({url:i,instructions:"A browser window should open. Complete login to finish."});let r;try{if(t.onManualCodeInput){let o,a,c=t.onManualCodeInput().then(u=>{o=u,s.cancelWait()}).catch(u=>{a=u instanceof Error?u:new Error(String(u)),s.cancelWait()}),l=await s.waitForCode();if(a)throw a;if(l?.code)r=l.code;else if(o){let u=s0(o);if(u.state&&u.state!==n)throw new Error("State mismatch");r=u.code}if(!r){if(await c,a)throw a;if(o){let u=s0(o);if(u.state&&u.state!==n)throw new Error("State mismatch");r=u.code}}}else{let o=await s.waitForCode();o?.code&&(r=o.code)}if(!r){let o=await t.onPrompt({message:"Paste the authorization code (or full redirect URL):"}),a=s0(o);if(a.state&&a.state!==n)throw new Error("State mismatch");r=a.code}if(!r)throw new Error("Missing authorization code");return Qk(r,e,l0)}finally{s.close()}}async function Zk(t){return Jk(await H4(t))}var d0={id:"openai-codex",name:"ChatGPT Plus/Pro (Codex Subscription)",usesCallbackServer:!0,async login(t){let e=await t.onSelect({message:"Select OpenAI Codex login method:",options:[{id:a0,label:"Browser login (default)"},{id:c0,label:"Device code login (headless)"}]});if(!e)throw new Error("Login cancelled");if(e===c0)return Yk({onDeviceCode:t.onDeviceCode,signal:t.signal});if(e!==a0)throw new Error(`Unknown OpenAI Codex login method: ${e}`);return Xk({onAuth:t.onAuth,onPrompt:t.onPrompt,onProgress:t.onProgress,onManualCodeInput:t.onManualCodeInput})},async refreshToken(t){return Zk(t.refresh)},getApiKey(t){return t.access}};var X4=[Yf,i0,d0],Z4=new Map(X4.map(t=>[t.id,t]));function p0(){return Array.from(Z4.values())}import{createJiti as Lfe}from"jiti/static";import*as Wfe from"typebox";import*as Ffe from"typebox/compile";import*as Ufe from"typebox/value";var qfe=t3(import.meta.url);function wp(t){return t.toolName==="edit"}function Sp(t){return t.toolName==="write"}function Ml(t,e){return e.toolName===t}import l0e from"ignore";import{constants as T3}from"node:fs";import{access as C3}from"node:fs/promises";import{spawn as k3}from"child_process";import{Type as Cp}from"typebox";function g3(t,e){let n=process.platform==="darwin"&&t.toLowerCase()==="alt"?"option":t;return e.capitalize?n.charAt(0).toUpperCase()+n.slice(1):n}function Rr(t,e={}){return t.split("/").map(n=>n.split("+").map(i=>g3(i,e)).join("+")).join("/")}function rM(t,e={}){return t.length===0?"":Rr(t.join("/"),e)}function ke(t){return rM(fe().getKeys(t))}function Rl(t){return rM(fe().getKeys(t),{capitalize:!0})}function re(t,e){return b.fg("dim",ke(t))+b.fg("muted",` ${e}`)}function tt(t,e){return b.fg("dim",Rr(t))+b.fg("muted",` ${e}`)}function Aa(t,e,n,i=0){if(!t)return{visualLines:[],skippedCount:0};let r=new E(t,i,0).render(n);if(r.length<=e)return{visualLines:r,skippedCount:0};let o=r.slice(-e),a=r.length-e;return{visualLines:o,skippedCount:a}}import{randomBytes as f3}from"node:crypto";import{createWriteStream as b3}from"node:fs";import{tmpdir as x3}from"node:os";import{join as v3}from"node:path";function y3(t){let e=f3(8).toString("hex");return v3(x3(),`${t}-${e}.log`)}function m0(t){return Buffer.byteLength(t,"utf-8")}var Tp=class{constructor(e={}){this.decoder=new TextDecoder;this.rawChunks=[];this.tailText="";this.tailBytes=0;this.tailStartsAtLineBoundary=!0;this.totalRawBytes=0;this.totalDecodedBytes=0;this.completedLines=0;this.totalLines=0;this.currentLineBytes=0;this.hasOpenLine=!1;this.finished=!1;this.maxLines=e.maxLines??2e3,this.maxBytes=e.maxBytes??51200,this.maxRollingBytes=Math.max(this.maxBytes*2,1),this.tempFilePrefix=e.tempFilePrefix??"pi-output"}append(e){if(this.finished)throw new Error("Cannot append to a finished output accumulator");this.totalRawBytes+=e.length,this.appendDecodedText(this.decoder.decode(e,{stream:!0})),this.tempFileStream||this.shouldUseTempFile()?(this.ensureTempFile(),this.tempFileStream?.write(e)):e.length>0&&this.rawChunks.push(e)}finish(){this.finished||(this.finished=!0,this.appendDecodedText(this.decoder.decode()),this.shouldUseTempFile()&&this.ensureTempFile())}snapshot(e={}){let n=Cr(this.getSnapshotText(),{maxLines:this.maxLines,maxBytes:this.maxBytes}),i=this.totalLines>this.maxLines||this.totalDecodedBytes>this.maxBytes,s=i?n.truncatedBy??(this.totalDecodedBytes>this.maxBytes?"bytes":"lines"):null,r={...n,truncated:i,truncatedBy:s,totalLines:this.totalLines,totalBytes:this.totalDecodedBytes,maxLines:this.maxLines,maxBytes:this.maxBytes};return e.persistIfTruncated&&r.truncated&&this.ensureTempFile(),{content:r.content,truncation:r,fullOutputPath:this.tempFilePath}}async closeTempFile(){if(!this.tempFileStream)return;let e=this.tempFileStream;this.tempFileStream=void 0,await new Promise((n,i)=>{let s=o=>{e.off("finish",r),i(o)},r=()=>{e.off("error",s),n()};e.once("error",s),e.once("finish",r),e.end()})}getLastLineBytes(){return this.currentLineBytes}appendDecodedText(e){if(e.length===0)return;let n=m0(e);this.totalDecodedBytes+=n,this.tailText+=e,this.tailBytes+=n,this.tailBytes>this.maxRollingBytes*2&&this.trimTail();let i=0,s=-1;for(let r=e.indexOf(`
|
|
180
|
+
</html>`}function gp(t){return Wk({title:"Authentication successful",heading:"Authentication successful",message:t})}function ui(t,e){return Wk({title:"Authentication failed",heading:"Authentication failed",message:t,details:e})}function Fk(t){let e="";for(let n of t)e+=String.fromCharCode(n);return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}async function fp(){let t=new Uint8Array(32);crypto.getRandomValues(t);let e=Fk(t),i=new TextEncoder().encode(e),s=await crypto.subtle.digest("SHA-256",i),r=Fk(new Uint8Array(s));return{verifier:e,challenge:r}}var bp=null,Vf=null,v4=t=>atob(t),Qf=v4("OWQxYzI1MGEtZTYxYi00NGQ5LTg4ZWQtNTk0NGQxOTYyZjVl"),y4="https://claude.ai/oauth/authorize",_a="https://platform.claude.com/v1/oauth/token",w4=process.env.PI_OAUTH_CALLBACK_HOST||"127.0.0.1",Uk=53692,Dk="/callback",Pa=`http://localhost:${Uk}${Dk}`,S4="org:create_api_key user:profile user:inference user:sessions:claude_code user:mcp_servers user:file_upload";async function T4(){if(bp)return bp;if(!Vf){if(typeof process>"u"||!process.versions?.node&&!process.versions?.bun)throw new Error("Anthropic OAuth is only available in Node.js environments");Vf=import("node:http").then(t=>({createServer:t.createServer}))}return bp=await Vf,bp}function Jf(t){let e=t.trim();if(!e)return{};try{let n=new URL(e);return{code:n.searchParams.get("code")??void 0,state:n.searchParams.get("state")??void 0}}catch{}if(e.includes("#")){let[n,i]=e.split("#",2);return{code:n,state:i}}if(e.includes("code=")){let n=new URLSearchParams(e);return{code:n.get("code")??void 0,state:n.get("state")??void 0}}return{code:e}}function kl(t){if(t instanceof Error){let e=[`${t.name}: ${t.message}`],n=t;return n.code&&e.push(`code=${n.code}`),typeof n.errno<"u"&&e.push(`errno=${String(n.errno)}`),typeof t.cause<"u"&&e.push(`cause=${kl(t.cause)}`),t.stack&&e.push(`stack=${t.stack}`),e.join("; ")}return String(t)}async function C4(t){let{createServer:e}=await T4();return new Promise((n,i)=>{let s,r=new Promise(a=>{let c=!1;s=l=>{c||(c=!0,a(l))}}),o=e((a,c)=>{try{let l=new URL(a.url||"","http://localhost");if(l.pathname!==Dk){c.writeHead(404,{"Content-Type":"text/html; charset=utf-8"}),c.end(ui("Callback route not found."));return}let u=l.searchParams.get("code"),d=l.searchParams.get("state"),p=l.searchParams.get("error");if(p){c.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),c.end(ui("Anthropic authentication did not complete.",`Error: ${p}`));return}if(!u||!d){c.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),c.end(ui("Missing code or state parameter."));return}if(d!==t){c.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),c.end(ui("State mismatch."));return}c.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),c.end(gp("Anthropic authentication completed. You can close this window.")),s?.({code:u,state:d})}catch{c.writeHead(500,{"Content-Type":"text/plain; charset=utf-8"}),c.end("Internal error")}});o.on("error",a=>{i(a)}),o.listen(Uk,w4,()=>{n({server:o,redirectUri:Pa,cancelWait:()=>{s?.(null)},waitForCode:()=>r})})})}async function $k(t,e){let n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(e),signal:AbortSignal.timeout(3e4)}),i=await n.text();if(!n.ok)throw new Error(`HTTP request failed. status=${n.status}; url=${t}; body=${i}`);return i}async function k4(t,e,n,i){let s;try{s=await $k(_a,{grant_type:"authorization_code",client_id:Qf,code:t,state:e,redirect_uri:i,code_verifier:n})}catch(o){throw new Error(`Token exchange request failed. url=${_a}; redirect_uri=${i}; response_type=authorization_code; details=${kl(o)}`)}let r;try{r=JSON.parse(s)}catch(o){throw new Error(`Token exchange returned invalid JSON. url=${_a}; body=${s}; details=${kl(o)}`)}return{refresh:r.refresh_token,access:r.access_token,expires:Date.now()+r.expires_in*1e3-300*1e3}}async function Bk(t){let{verifier:e,challenge:n}=await fp(),i=await C4(e),s,r,o=Pa;try{let a=new URLSearchParams({code:"true",client_id:Qf,response_type:"code",redirect_uri:Pa,scope:S4,code_challenge:n,code_challenge_method:"S256",state:e});if(t.onAuth({url:`${y4}?${a.toString()}`,instructions:"Complete login in your browser. If the browser is on another machine, paste the final redirect URL here."}),t.onManualCodeInput){let c,l,u=t.onManualCodeInput().then(p=>{c=p,i.cancelWait()}).catch(p=>{l=p instanceof Error?p:new Error(String(p)),i.cancelWait()}),d=await i.waitForCode();if(l)throw l;if(d?.code)s=d.code,r=d.state,o=Pa;else if(c){let p=Jf(c);if(p.state&&p.state!==e)throw new Error("OAuth state mismatch");s=p.code,r=p.state??e}if(!s){if(await u,l)throw l;if(c){let p=Jf(c);if(p.state&&p.state!==e)throw new Error("OAuth state mismatch");s=p.code,r=p.state??e}}}else{let c=await i.waitForCode();c?.code&&(s=c.code,r=c.state,o=Pa)}if(!s){let c=await t.onPrompt({message:"Paste the authorization code or full redirect URL:",placeholder:Pa}),l=Jf(c);if(l.state&&l.state!==e)throw new Error("OAuth state mismatch");s=l.code,r=l.state??e}if(!s)throw new Error("Missing authorization code");if(!r)throw new Error("Missing OAuth state");return t.onProgress?.("Exchanging authorization code for tokens..."),k4(s,r,e,o)}finally{i.server.close()}}async function Nk(t){let e;try{e=await $k(_a,{grant_type:"refresh_token",client_id:Qf,refresh_token:t})}catch(i){throw new Error(`Anthropic token refresh request failed. url=${_a}; details=${kl(i)}`)}let n;try{n=JSON.parse(e)}catch(i){throw new Error(`Anthropic token refresh returned invalid JSON. url=${_a}; body=${e}; details=${kl(i)}`)}return{refresh:n.refresh_token,access:n.access_token,expires:Date.now()+n.expires_in*1e3-300*1e3}}var Yf={id:"anthropic",name:"Anthropic (Claude Pro/Max)",usesCallbackServer:!0,async login(t){return Bk({onAuth:t.onAuth,onPrompt:t.onPrompt,onProgress:t.onProgress,onManualCodeInput:t.onManualCodeInput})},async refreshToken(t){return Nk(t.refresh)},getApiKey(t){return t.access}};var jk="Login cancelled",M4="Device flow timed out",R4="Device flow timed out after one or more slow_down responses. This is often caused by clock drift in WSL or VM environments. Please sync or restart the VM clock and try again.";function I4(t,e,n){return new Promise((i,s)=>{if(e?.aborted){s(new Error(n));return}let r=()=>{clearTimeout(o),s(new Error(n))},o=setTimeout(()=>{e?.removeEventListener("abort",r),i()},t);e?.addEventListener("abort",r,{once:!0})})}async function xp(t){let e=typeof t.expiresInSeconds=="number"?Date.now()+t.expiresInSeconds*1e3:Number.POSITIVE_INFINITY,n=Math.max(1e3,Math.floor((t.intervalSeconds??5)*1e3)),i=0;for(;Date.now()<e;){if(t.signal?.aborted)throw new Error(jk);let s=await t.poll();if(s.status==="complete")return s.value;if(s.status==="failed")throw new Error(s.message);s.status==="slow_down"&&(i+=1,n=Math.max(1e3,n+5e3));let r=e-Date.now();if(r<=0)break;await I4(Math.min(n,r),t.signal,jk)}throw new Error(i>0?R4:M4)}In();var P4=t=>atob(t),qk=P4("SXYxLmI1MDdhMDhjODdlY2ZlOTg="),Gk={"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"};function Xf(t){let e=t.trim();if(!e)return null;try{return(e.includes("://")?new URL(e):new URL(`https://${e}`)).hostname}catch{return null}}function Zf(t){return{deviceCodeUrl:`https://${t}/login/device/code`,accessTokenUrl:`https://${t}/login/oauth/access_token`,copilotTokenUrl:`https://api.${t}/copilot_internal/v2/token`}}function _4(t){let e=t.match(/proxy-ep=([^;]+)/);return e?`https://${e[1].replace(/^proxy\./,"api.")}`:null}function e0(t,e){if(t){let n=_4(t);if(n)return n}return e?`https://copilot-api.${e}`:"https://api.individual.githubcopilot.com"}async function t0(t,e){let n=await fetch(t,e);if(!n.ok){let i=await n.text();throw new Error(`${n.status} ${n.statusText}: ${i}`)}return n.json()}async function E4(t){let e=Zf(t),n=await t0(e.deviceCodeUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","User-Agent":"GitHubCopilotChat/0.35.0"},body:new URLSearchParams({client_id:qk,scope:"read:user"})});if(!n||typeof n!="object")throw new Error("Invalid device code response");let i=n.device_code,s=n.user_code,r=n.verification_uri,o=n.interval,a=n.expires_in;if(typeof i!="string"||typeof s!="string"||typeof r!="string"||o!==void 0&&typeof o!="number"||typeof a!="number")throw new Error("Invalid device code response fields");let c;try{c=new URL(r)}catch{throw new Error("Untrusted verification_uri in device code response")}if(c.protocol!=="https:"&&c.protocol!=="http:")throw new Error("Untrusted verification_uri in device code response");return{device_code:i,user_code:s,verification_uri:c.href,interval:o,expires_in:a}}async function A4(t,e,n){let i=Zf(t);return xp({intervalSeconds:e.interval,expiresInSeconds:e.expires_in,signal:n,poll:async()=>{let s=await t0(i.accessTokenUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","User-Agent":"GitHubCopilotChat/0.35.0"},body:new URLSearchParams({client_id:qk,device_code:e.device_code,grant_type:"urn:ietf:params:oauth:grant-type:device_code"})});if(s&&typeof s=="object"&&typeof s.access_token=="string")return{status:"complete",value:s.access_token};if(s&&typeof s=="object"&&typeof s.error=="string"){let{error:r,error_description:o}=s;if(r==="authorization_pending")return{status:"pending"};if(r==="slow_down")return{status:"slow_down"};let a=o?`: ${o}`:"";return{status:"failed",message:`Device flow failed: ${r}${a}`}}return{status:"failed",message:"Invalid device token response"}}})}async function n0(t,e){let i=Zf(e||"github.com"),s=await t0(i.copilotTokenUrl,{headers:{Accept:"application/json",Authorization:`Bearer ${t}`,...Gk}});if(!s||typeof s!="object")throw new Error("Invalid Copilot token response");let r=s.token,o=s.expires_at;if(typeof r!="string"||typeof o!="number")throw new Error("Invalid Copilot token response fields");return{refresh:t,access:r,expires:o*1e3-300*1e3,enterpriseUrl:e}}async function O4(t,e,n){let s=`${e0(t,n)}/models/${e}/policy`;try{return(await fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`,...Gk,"openai-intent":"chat-policy","x-interaction-type":"chat-policy"},body:JSON.stringify({state:"enabled"})})).ok}catch{return!1}}async function L4(t,e,n){let i=Ug("github-copilot");await Promise.all(i.map(async s=>{let r=await O4(t,s.id,e);n?.(s.id,r)}))}async function Kk(t){let e=await t.onPrompt({message:"GitHub Enterprise URL/domain (blank for github.com)",placeholder:"company.ghe.com",allowEmpty:!0});if(t.signal?.aborted)throw new Error("Login cancelled");let n=e.trim(),i=Xf(e);if(n&&!i)throw new Error("Invalid GitHub Enterprise URL/domain");let s=i||"github.com",r=await E4(s);t.onDeviceCode({userCode:r.user_code,verificationUri:r.verification_uri,intervalSeconds:r.interval,expiresInSeconds:r.expires_in});let o=await A4(s,r,t.signal),a=await n0(o,i??void 0);return t.onProgress?.("Enabling models..."),await L4(a.access,i??void 0),a}var i0={id:"github-copilot",name:"GitHub Copilot",async login(t){return Kk({onDeviceCode:t.onDeviceCode,onPrompt:t.onPrompt,onProgress:t.onProgress,signal:t.signal})},async refreshToken(t){let e=t;return n0(e.refresh,e.enterpriseUrl)},getApiKey(t){return t.access},modifyModels(t,e){let n=e,i=n.enterpriseUrl?Xf(n.enterpriseUrl)??void 0:void 0,s=e0(n.access,i);return t.map(r=>r.provider==="github-copilot"?{...r,baseUrl:s}:r)}};var r0=null,o0=null;typeof process<"u"&&(process.versions?.node||process.versions?.bun)&&(import("node:crypto").then(t=>{r0=t.randomBytes}),import("node:http").then(t=>{o0=t}));var vp="app_EMoamEEZ73f0CkXaXp7hrann",Ea="https://auth.openai.com",W4=`${Ea}/oauth/authorize`,Hk=`${Ea}/oauth/token`,l0="http://localhost:1455/auth/callback",F4=`${Ea}/api/accounts/deviceauth/usercode`,U4=`${Ea}/api/accounts/deviceauth/token`,D4=`${Ea}/codex/device`,$4=`${Ea}/deviceauth/callback`,zk=900,a0="browser",c0="device_code",B4="openid profile email offline_access",N4="https://api.openai.com/auth";function j4(){return typeof process<"u"&&process.env.PI_OAUTH_CALLBACK_HOST||"127.0.0.1"}function q4(){if(!r0)throw new Error("OpenAI Codex OAuth is only available in Node.js environments");return r0(16).toString("hex")}function s0(t){let e=t.trim();if(!e)return{};try{let n=new URL(e);return{code:n.searchParams.get("code")??void 0,state:n.searchParams.get("state")??void 0}}catch{}if(e.includes("#")){let[n,i]=e.split("#",2);return{code:n,state:i}}if(e.includes("code=")){let n=new URLSearchParams(e);return{code:n.get("code")??void 0,state:n.get("state")??void 0}}return{code:e}}function G4(t){try{let e=t.split(".");if(e.length!==3)return null;let n=e[1]??"",i=atob(n);return JSON.parse(i)}catch{return null}}async function u0(t,e){try{return await fetch(t,e)}catch(n){throw e.signal?.aborted?new Error("Login cancelled"):n}}async function Vk(t,e){if(!t.ok){let s=await t.text().catch(()=>"");throw new Error(`OpenAI Codex token ${e} failed (${t.status}): ${s||t.statusText}`)}let i=await t.json();if(!i?.access_token||!i.refresh_token||typeof i.expires_in!="number")throw new Error(`OpenAI Codex token ${e} response missing fields: ${JSON.stringify(i)}`);return{access:i.access_token,refresh:i.refresh_token,expires:Date.now()+i.expires_in*1e3}}async function K4(t,e,n=l0,i){let s=await u0(Hk,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",client_id:vp,code:t,code_verifier:e,redirect_uri:n}),signal:i});return Vk(s,"exchange")}async function H4(t){let e;try{e=await fetch(Hk,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:t,client_id:vp})})}catch(n){throw new Error(`OpenAI Codex token refresh error: ${n instanceof Error?n.message:String(n)}`)}return Vk(e,"refresh")}async function z4(t){let e=await u0(F4,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:vp}),signal:t});if(!e.ok){if(e.status===404)throw new Error("OpenAI Codex device code login is not enabled for this server. Use browser login or verify the server URL.");let r=await e.text().catch(()=>"");throw new Error(`OpenAI Codex device code request failed with status ${e.status}${r?`: ${r}`:""}`)}let i=await e.json(),s=typeof i?.interval=="string"?Number(i.interval.trim()):i?.interval;if(!i?.device_auth_id||!i.user_code||typeof s!="number"||!Number.isFinite(s)||s<0)throw new Error(`Invalid OpenAI Codex device code response: ${JSON.stringify(i)}`);return{deviceAuthId:i.device_auth_id,userCode:i.user_code,intervalSeconds:s}}async function V4(t,e){return xp({intervalSeconds:t.intervalSeconds,expiresInSeconds:zk,signal:e,poll:async()=>{let n=await u0(U4,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_auth_id:t.deviceAuthId,user_code:t.userCode}),signal:e});if(n.ok){let o=await n.json();return!o?.authorization_code||!o.code_verifier?{status:"failed",message:`Invalid OpenAI Codex device auth token response: ${JSON.stringify(o)}`}:{status:"complete",value:{authorizationCode:o.authorization_code,codeVerifier:o.code_verifier}}}if(n.status===403||n.status===404)return{status:"pending"};let i=await n.text().catch(()=>""),s;try{let o=JSON.parse(i)?.error;s=typeof o=="object"?o?.code:o}catch{}return s==="deviceauth_authorization_pending"?{status:"pending"}:s==="slow_down"?{status:"slow_down"}:{status:"failed",message:`OpenAI Codex device auth failed with status ${n.status}${i?`: ${i}`:""}`}}})}async function J4(t="sling"){let{verifier:e,challenge:n}=await fp(),i=q4(),s=new URL(W4);return s.searchParams.set("response_type","code"),s.searchParams.set("client_id",vp),s.searchParams.set("redirect_uri",l0),s.searchParams.set("scope",B4),s.searchParams.set("code_challenge",n),s.searchParams.set("code_challenge_method","S256"),s.searchParams.set("state",i),s.searchParams.set("id_token_add_organizations","true"),s.searchParams.set("codex_cli_simplified_flow","true"),s.searchParams.set("originator",t),{verifier:e,state:i,url:s.toString()}}function Q4(t){if(!o0)throw new Error("OpenAI Codex OAuth is only available in Node.js environments");let e,n=new Promise(s=>{let r=!1;e=o=>{r||(r=!0,s(o))}}),i=o0.createServer((s,r)=>{try{let o=new URL(s.url||"","http://localhost");if(o.pathname!=="/auth/callback"){r.statusCode=404,r.setHeader("Content-Type","text/html; charset=utf-8"),r.end(ui("Callback route not found."));return}if(o.searchParams.get("state")!==t){r.statusCode=400,r.setHeader("Content-Type","text/html; charset=utf-8"),r.end(ui("State mismatch."));return}let a=o.searchParams.get("code");if(!a){r.statusCode=400,r.setHeader("Content-Type","text/html; charset=utf-8"),r.end(ui("Missing authorization code."));return}r.statusCode=200,r.setHeader("Content-Type","text/html; charset=utf-8"),r.end(gp("OpenAI authentication completed. You can close this window.")),e?.({code:a})}catch{r.statusCode=500,r.setHeader("Content-Type","text/html; charset=utf-8"),r.end(ui("Internal error while processing OAuth callback."))}});return new Promise(s=>{i.listen(1455,j4(),()=>{s({close:()=>i.close(),cancelWait:()=>{e?.(null)},waitForCode:()=>n})}).on("error",r=>{e?.(null),s({close:()=>{try{i.close()}catch{}},cancelWait:()=>{},waitForCode:async()=>null})})})}function Y4(t){let i=G4(t)?.[N4]?.chatgpt_account_id;return typeof i=="string"&&i.length>0?i:null}function Jk(t){let e=Y4(t.access);if(!e)throw new Error("Failed to extract accountId from token");return{access:t.access,refresh:t.refresh,expires:t.expires,accountId:e}}async function Qk(t,e,n,i){return Jk(await K4(t,e,n,i))}async function Yk(t){let e=await z4(t.signal);t.onDeviceCode({userCode:e.userCode,verificationUri:D4,intervalSeconds:e.intervalSeconds,expiresInSeconds:zk});let n=await V4(e,t.signal);return Qk(n.authorizationCode,n.codeVerifier,$4,t.signal)}async function Xk(t){let{verifier:e,state:n,url:i}=await J4(t.originator),s=await Q4(n);t.onAuth({url:i,instructions:"A browser window should open. Complete login to finish."});let r;try{if(t.onManualCodeInput){let o,a,c=t.onManualCodeInput().then(u=>{o=u,s.cancelWait()}).catch(u=>{a=u instanceof Error?u:new Error(String(u)),s.cancelWait()}),l=await s.waitForCode();if(a)throw a;if(l?.code)r=l.code;else if(o){let u=s0(o);if(u.state&&u.state!==n)throw new Error("State mismatch");r=u.code}if(!r){if(await c,a)throw a;if(o){let u=s0(o);if(u.state&&u.state!==n)throw new Error("State mismatch");r=u.code}}}else{let o=await s.waitForCode();o?.code&&(r=o.code)}if(!r){let o=await t.onPrompt({message:"Paste the authorization code (or full redirect URL):"}),a=s0(o);if(a.state&&a.state!==n)throw new Error("State mismatch");r=a.code}if(!r)throw new Error("Missing authorization code");return Qk(r,e,l0)}finally{s.close()}}async function Zk(t){return Jk(await H4(t))}var d0={id:"openai-codex",name:"ChatGPT Plus/Pro (Codex Subscription)",usesCallbackServer:!0,async login(t){let e=await t.onSelect({message:"Select OpenAI Codex login method:",options:[{id:a0,label:"Browser login (default)"},{id:c0,label:"Device code login (headless)"}]});if(!e)throw new Error("Login cancelled");if(e===c0)return Yk({onDeviceCode:t.onDeviceCode,signal:t.signal});if(e!==a0)throw new Error(`Unknown OpenAI Codex login method: ${e}`);return Xk({onAuth:t.onAuth,onPrompt:t.onPrompt,onProgress:t.onProgress,onManualCodeInput:t.onManualCodeInput})},async refreshToken(t){return Zk(t.refresh)},getApiKey(t){return t.access}};var X4=[Yf,i0,d0],Z4=new Map(X4.map(t=>[t.id,t]));function p0(){return Array.from(Z4.values())}import{createJiti as Lfe}from"jiti/static";import*as Wfe from"typebox";import*as Ffe from"typebox/compile";import*as Ufe from"typebox/value";var qfe=t3(import.meta.url);function wp(t){return t.toolName==="edit"}function Sp(t){return t.toolName==="write"}function Ml(t,e){return e.toolName===t}import l0e from"ignore";import{constants as T3}from"node:fs";import{access as C3}from"node:fs/promises";import{spawn as k3}from"child_process";import{Type as Cp}from"typebox";function g3(t,e){let n=process.platform==="darwin"&&t.toLowerCase()==="alt"?"option":t;return e.capitalize?n.charAt(0).toUpperCase()+n.slice(1):n}function Rr(t,e={}){return t.split("/").map(n=>n.split("+").map(i=>g3(i,e)).join("+")).join("/")}function r1(t,e={}){return t.length===0?"":Rr(t.join("/"),e)}function ke(t){return r1(fe().getKeys(t))}function Rl(t){return r1(fe().getKeys(t),{capitalize:!0})}function re(t,e){return b.fg("dim",ke(t))+b.fg("muted",` ${e}`)}function tt(t,e){return b.fg("dim",Rr(t))+b.fg("muted",` ${e}`)}function Aa(t,e,n,i=0){if(!t)return{visualLines:[],skippedCount:0};let r=new E(t,i,0).render(n);if(r.length<=e)return{visualLines:r,skippedCount:0};let o=r.slice(-e),a=r.length-e;return{visualLines:o,skippedCount:a}}import{randomBytes as f3}from"node:crypto";import{createWriteStream as b3}from"node:fs";import{tmpdir as x3}from"node:os";import{join as v3}from"node:path";function y3(t){let e=f3(8).toString("hex");return v3(x3(),`${t}-${e}.log`)}function m0(t){return Buffer.byteLength(t,"utf-8")}var Tp=class{constructor(e={}){this.decoder=new TextDecoder;this.rawChunks=[];this.tailText="";this.tailBytes=0;this.tailStartsAtLineBoundary=!0;this.totalRawBytes=0;this.totalDecodedBytes=0;this.completedLines=0;this.totalLines=0;this.currentLineBytes=0;this.hasOpenLine=!1;this.finished=!1;this.maxLines=e.maxLines??2e3,this.maxBytes=e.maxBytes??51200,this.maxRollingBytes=Math.max(this.maxBytes*2,1),this.tempFilePrefix=e.tempFilePrefix??"pi-output"}append(e){if(this.finished)throw new Error("Cannot append to a finished output accumulator");this.totalRawBytes+=e.length,this.appendDecodedText(this.decoder.decode(e,{stream:!0})),this.tempFileStream||this.shouldUseTempFile()?(this.ensureTempFile(),this.tempFileStream?.write(e)):e.length>0&&this.rawChunks.push(e)}finish(){this.finished||(this.finished=!0,this.appendDecodedText(this.decoder.decode()),this.shouldUseTempFile()&&this.ensureTempFile())}snapshot(e={}){let n=Cr(this.getSnapshotText(),{maxLines:this.maxLines,maxBytes:this.maxBytes}),i=this.totalLines>this.maxLines||this.totalDecodedBytes>this.maxBytes,s=i?n.truncatedBy??(this.totalDecodedBytes>this.maxBytes?"bytes":"lines"):null,r={...n,truncated:i,truncatedBy:s,totalLines:this.totalLines,totalBytes:this.totalDecodedBytes,maxLines:this.maxLines,maxBytes:this.maxBytes};return e.persistIfTruncated&&r.truncated&&this.ensureTempFile(),{content:r.content,truncation:r,fullOutputPath:this.tempFilePath}}async closeTempFile(){if(!this.tempFileStream)return;let e=this.tempFileStream;this.tempFileStream=void 0,await new Promise((n,i)=>{let s=o=>{e.off("finish",r),i(o)},r=()=>{e.off("error",s),n()};e.once("error",s),e.once("finish",r),e.end()})}getLastLineBytes(){return this.currentLineBytes}appendDecodedText(e){if(e.length===0)return;let n=m0(e);this.totalDecodedBytes+=n,this.tailText+=e,this.tailBytes+=n,this.tailBytes>this.maxRollingBytes*2&&this.trimTail();let i=0,s=-1;for(let r=e.indexOf(`
|
|
181
181
|
`);r!==-1;r=e.indexOf(`
|
|
182
182
|
`,r+1))i++,s=r;if(i===0)this.currentLineBytes+=n,this.hasOpenLine=!0;else{this.completedLines+=i;let r=e.slice(s+1);this.currentLineBytes=m0(r),this.hasOpenLine=r.length>0}this.totalLines=this.completedLines+(this.hasOpenLine?1:0)}trimTail(){let e=Buffer.from(this.tailText,"utf-8");if(e.length<=this.maxRollingBytes){this.tailBytes=e.length;return}let n=e.length-this.maxRollingBytes;for(;n<e.length&&(e[n]&192)===128;)n++;this.tailStartsAtLineBoundary=n===0?this.tailStartsAtLineBoundary:e[n-1]===10,this.tailText=e.subarray(n).toString("utf-8"),this.tailBytes=m0(this.tailText)}getSnapshotText(){if(this.tailStartsAtLineBoundary)return this.tailText;let e=this.tailText.indexOf(`
|
|
183
|
-
`);return e===-1?this.tailText:this.tailText.slice(e+1)}shouldUseTempFile(){return this.totalRawBytes>this.maxBytes||this.totalDecodedBytes>this.maxBytes||this.totalLines>this.maxLines}ensureTempFile(){if(!this.tempFilePath){this.tempFilePath=y3(this.tempFilePrefix),this.tempFileStream=b3(this.tempFilePath);for(let e of this.rawChunks)this.tempFileStream.write(e);this.rawChunks=[]}}};import*as
|
|
183
|
+
`);return e===-1?this.tailText:this.tailText.slice(e+1)}shouldUseTempFile(){return this.totalRawBytes>this.maxBytes||this.totalDecodedBytes>this.maxBytes||this.totalLines>this.maxLines}ensureTempFile(){if(!this.tempFilePath){this.tempFilePath=y3(this.tempFilePrefix),this.tempFileStream=b3(this.tempFilePath);for(let e of this.rawChunks)this.tempFileStream.write(e);this.rawChunks=[]}}};import*as o1 from"node:os";import{pathToFileURL as w3}from"node:url";function Il(t){if(typeof t!="string")return"";let e=o1.homedir();return t.startsWith(e)?`~${t.slice(e.length)}`:t}function S3(t,e,n){if(!ct().hyperlinks)return t;let i=xe(e,n);return mr(t,w3(i).href)}function Xe(t){return typeof t=="string"?t:t==null?"":null}function Ni(t){return t.replace(/\t/g," ")}function Pl(t){return t.replace(/\r/g,"")}function Wn(t,e){if(!t)return"";let n=t.content.filter(o=>o.type==="text"),i=t.content.filter(o=>o.type==="image"),s=n.map(o=>Df(Sl(o.text||"")).replace(/\r/g,"")).join(`
|
|
184
184
|
`),r=ct();if(i.length>0&&(!r.images||!e)){let o=i.map(a=>{let c=a.mimeType??"image/unknown",l=a.data&&a.mimeType?gl(a.data,a.mimeType)??void 0:void 0;return ha(c,l)}).join(`
|
|
185
185
|
`);s=s?`${s}
|
|
186
186
|
${o}`:o}return s}function Ir(t){return t.fg("error","[invalid arg]")}function _s(t,e,n,i){if(t===null)return Ir(e);let s=t||i?.emptyFallback;return s?S3(e.fg("accent",Il(s)),s,n):e.fg("toolOutput","...")}var M3=Cp.Object({command:Cp.String({description:"Bash command to execute"}),timeout:Cp.Optional(Cp.Number({description:"Timeout in seconds (optional, no default timeout)"}))});function kp(t){return{exec:async(e,n,{onData:i,signal:s,timeout:r,env:o})=>{let{shell:a,args:c}=op(t?.shellPath);try{await C3(n,T3.F_OK)}catch{throw new Error(`Working directory does not exist: ${n}
|
|
@@ -200,64 +200,64 @@ ${o}`:o,p=R3(d,t,s),m=new Tp({tempFilePrefix:"pi-bash"}),g,h=!1,f=0,x=()=>{if(!l
|
|
|
200
200
|
|
|
201
201
|
[Showing lines ${U}-${N} of ${R.totalLines} (${Ye(51200)} limit). Full output: ${A.fullOutputPath}]`}return{text:k,details:O}},F=(A,W)=>`${A?`${A}
|
|
202
202
|
|
|
203
|
-
`:""}${W}`;try{let A;try{A=(await n.exec(p.command,p.cwd,{onData:C,signal:c,timeout:a,env:p.env})).exitCode}catch(O){let U=await P(),{text:N}=_(U,"");if(O instanceof Error&&O.message==="aborted")throw new Error(F(N,"Command aborted"));if(O instanceof Error&&O.message.startsWith("timeout:")){let K=O.message.split(":")[1];throw new Error(F(N,`Command timed out after ${K} seconds`))}throw O}let W=await P(),{text:R,details:k}=_(W);if(A!==0&&A!==null)throw new Error(F(R,`Command exited with code ${A}`));return{content:[{type:"text",text:R}],details:k}}finally{v()}},renderCall(r,o,a){let c=a.state;a.executionStarted&&c.startedAt===void 0&&(c.startedAt=Date.now(),c.endedAt=void 0);let l=a.lastComponent??new E("",0,0);return l.setText(E3(r)),l},renderResult(r,o,a,c){let l=c.state;l.startedAt!==void 0&&o.isPartial&&!l.interval&&(l.interval=setInterval(()=>c.invalidate(),1e3)),(!o.isPartial||c.isError)&&(l.endedAt??=Date.now(),l.interval&&(clearInterval(l.interval),l.interval=void 0));let u=c.lastComponent??new h0;return A3(u,r,o,c.showImages,l.startedAt,l.endedAt),u.invalidate(),u}}}import{constants as
|
|
203
|
+
`:""}${W}`;try{let A;try{A=(await n.exec(p.command,p.cwd,{onData:C,signal:c,timeout:a,env:p.env})).exitCode}catch(O){let U=await P(),{text:N}=_(U,"");if(O instanceof Error&&O.message==="aborted")throw new Error(F(N,"Command aborted"));if(O instanceof Error&&O.message.startsWith("timeout:")){let K=O.message.split(":")[1];throw new Error(F(N,`Command timed out after ${K} seconds`))}throw O}let W=await P(),{text:R,details:k}=_(W);if(A!==0&&A!==null)throw new Error(F(R,`Command exited with code ${A}`));return{content:[{type:"text",text:R}],details:k}}finally{v()}},renderCall(r,o,a){let c=a.state;a.executionStarted&&c.startedAt===void 0&&(c.startedAt=Date.now(),c.endedAt=void 0);let l=a.lastComponent??new E("",0,0);return l.setText(E3(r)),l},renderResult(r,o,a,c){let l=c.state;l.startedAt!==void 0&&o.isPartial&&!l.interval&&(l.interval=setInterval(()=>c.invalidate(),1e3)),(!o.isPartial||c.isError)&&(l.endedAt??=Date.now(),l.interval&&(clearInterval(l.interval),l.interval=void 0));let u=c.lastComponent??new h0;return A3(u,r,o,c.showImages,l.startedAt,l.endedAt),u.invalidate(),u}}}import{constants as f1}from"fs";import{access as Y3,readFile as X3,writeFile as Z3}from"fs/promises";import{Type as Wa}from"typebox";import*as a1 from"diff";function g0(t){let e=t.match(/^([+-\s])(\s*\d*)\s(.*)$/);return e?{prefix:e[1],lineNum:e[2],content:e[3]}:null}function Oa(t){return t.replace(/\t/g," ")}function O3(t,e){let n=a1.diffWords(t,e),i="",s="",r=!0,o=!0;for(let a of n)if(a.removed){let c=a.value;if(r){let l=c.match(/^(\s*)/)?.[1]||"";c=c.slice(l.length),i+=l,r=!1}c&&(i+=b.inverse(c))}else if(a.added){let c=a.value;if(o){let l=c.match(/^(\s*)/)?.[1]||"";c=c.slice(l.length),s+=l,o=!1}c&&(s+=b.inverse(c))}else i+=a.value,s+=a.value;return{removedLine:i,addedLine:s}}function _l(t,e={}){let n=t.split(`
|
|
204
204
|
`),i=[],s=0;for(;s<n.length;){let r=n[s],o=g0(r);if(!o){i.push(b.fg("toolDiffContext",r)),s++;continue}if(o.prefix==="-"){let a=[];for(;s<n.length;){let l=g0(n[s]);if(!l||l.prefix!=="-")break;a.push({lineNum:l.lineNum,content:l.content}),s++}let c=[];for(;s<n.length;){let l=g0(n[s]);if(!l||l.prefix!=="+")break;c.push({lineNum:l.lineNum,content:l.content}),s++}if(a.length===1&&c.length===1){let l=a[0],u=c[0],{removedLine:d,addedLine:p}=O3(Oa(l.content),Oa(u.content));i.push(b.fg("toolDiffRemoved",`-${l.lineNum} ${d}`)),i.push(b.fg("toolDiffAdded",`+${u.lineNum} ${p}`))}else{for(let l of a)i.push(b.fg("toolDiffRemoved",`-${l.lineNum} ${Oa(l.content)}`));for(let l of c)i.push(b.fg("toolDiffAdded",`+${l.lineNum} ${Oa(l.content)}`))}}else o.prefix==="+"?(i.push(b.fg("toolDiffAdded",`+${o.lineNum} ${Oa(o.content)}`)),s++):(i.push(b.fg("toolDiffContext",` ${o.lineNum} ${Oa(o.content)}`)),s++)}return i.join(`
|
|
205
|
-
`)}import*as La from"diff";import{constants as $3}from"fs";import{access as B3,readFile as N3}from"fs/promises";import{accessSync as Z0e,constants as L3}from"node:fs";import{access as W3}from"node:fs/promises";var F3="\u202F";function U3(t){return t.replace(/ (AM|PM)\./gi,`${F3}$1.`)}function D3(t){return t.normalize("NFD")}function
|
|
205
|
+
`)}import*as La from"diff";import{constants as $3}from"fs";import{access as B3,readFile as N3}from"fs/promises";import{accessSync as Z0e,constants as L3}from"node:fs";import{access as W3}from"node:fs/promises";var F3="\u202F";function U3(t){return t.replace(/ (AM|PM)\./gi,`${F3}$1.`)}function D3(t){return t.normalize("NFD")}function c1(t){return t.replace(/'/g,"\u2019")}async function ji(t){try{return await W3(t,L3.F_OK),!0}catch{return!1}}function Wt(t,e){return xe(t,e,{normalizeUnicodeSpaces:!0,stripAtPrefix:!0})}async function l1(t,e){let n=Wt(t,e);if(await ji(n))return n;let i=U3(n);if(i!==n&&await ji(i))return i;let s=D3(n);if(s!==n&&await ji(s))return s;let r=c1(n);if(r!==n&&await ji(r))return r;let o=c1(s);return o!==n&&await ji(o)?o:n}function d1(t){let e=t.indexOf(`\r
|
|
206
206
|
`),n=t.indexOf(`
|
|
207
207
|
`);return n===-1||e===-1?`
|
|
208
208
|
`:e<n?`\r
|
|
209
209
|
`:`
|
|
210
210
|
`}function El(t){return t.replace(/\r\n/g,`
|
|
211
211
|
`).replace(/\r/g,`
|
|
212
|
-
`)}function
|
|
212
|
+
`)}function p1(t,e){return e===`\r
|
|
213
213
|
`?t.replace(/\n/g,`\r
|
|
214
214
|
`):t}function Al(t){return t.normalize("NFKC").split(`
|
|
215
215
|
`).map(e=>e.trimEnd()).join(`
|
|
216
|
-
`).replace(/[\u2018\u2019\u201A\u201B]/g,"'").replace(/[\u201C\u201D\u201E\u201F]/g,'"').replace(/[\u2010\u2011\u2012\u2013\u2014\u2015\u2212]/g,"-").replace(/[\u00A0\u2002-\u200A\u202F\u205F\u3000]/g," ")}function
|
|
216
|
+
`).replace(/[\u2018\u2019\u201A\u201B]/g,"'").replace(/[\u201C\u201D\u201E\u201F]/g,'"').replace(/[\u2010\u2011\u2012\u2013\u2014\u2015\u2212]/g,"-").replace(/[\u00A0\u2002-\u200A\u202F\u205F\u3000]/g," ")}function u1(t,e){let n=t.indexOf(e);if(n!==-1)return{found:!0,index:n,matchLength:e.length,usedFuzzyMatch:!1,contentForReplacement:t};let i=Al(t),s=Al(e),r=i.indexOf(s);return r===-1?{found:!1,index:-1,matchLength:0,usedFuzzyMatch:!1,contentForReplacement:t}:{found:!0,index:r,matchLength:s.length,usedFuzzyMatch:!0,contentForReplacement:i}}function f0(t){return t.startsWith("\uFEFF")?{bom:"\uFEFF",text:t.slice(1)}:{bom:"",text:t}}function j3(t,e){let n=Al(t),i=Al(e);return n.split(i).length-1}function q3(t,e,n){return n===1?new Error(`Could not find the exact text in ${t}. The old text must match exactly including all whitespace and newlines.`):new Error(`Could not find edits[${e}] in ${t}. The oldText must match exactly including all whitespace and newlines.`)}function G3(t,e,n,i){return n===1?new Error(`Found ${i} occurrences of the text in ${t}. The text must be unique. Please provide more context to make it unique.`):new Error(`Found ${i} occurrences of edits[${e}] in ${t}. Each oldText must be unique. Please provide more context to make it unique.`)}function K3(t,e,n){return n===1?new Error(`oldText must not be empty in ${t}.`):new Error(`edits[${e}].oldText must not be empty in ${t}.`)}function H3(t,e){return e===1?new Error(`No changes made to ${t}. The replacement produced identical content. This might indicate an issue with special characters or the text not existing as expected.`):new Error(`No changes made to ${t}. The replacements produced identical content.`)}function b0(t,e,n){let i=e.map(c=>({oldText:El(c.oldText),newText:El(c.newText)}));for(let c=0;c<i.length;c++)if(i[c].oldText.length===0)throw K3(n,c,i.length);let r=i.map(c=>u1(t,c.oldText)).some(c=>c.usedFuzzyMatch)?Al(t):t,o=[];for(let c=0;c<i.length;c++){let l=i[c],u=u1(r,l.oldText);if(!u.found)throw q3(n,c,i.length);let d=j3(r,l.oldText);if(d>1)throw G3(n,c,i.length,d);o.push({editIndex:c,matchIndex:u.index,matchLength:u.matchLength,newText:l.newText})}o.sort((c,l)=>c.matchIndex-l.matchIndex);for(let c=1;c<o.length;c++){let l=o[c-1],u=o[c];if(l.matchIndex+l.matchLength>u.matchIndex)throw new Error(`edits[${l.editIndex}] and edits[${u.editIndex}] overlap in ${n}. Merge them into one edit or target disjoint regions.`)}let a=r;for(let c=o.length-1;c>=0;c--){let l=o[c];a=a.substring(0,l.matchIndex)+l.newText+a.substring(l.matchIndex+l.matchLength)}if(r===a)throw H3(n,i.length);return{baseContent:r,newContent:a}}function m1(t,e,n,i=4){return La.createTwoFilesPatch(t,t,e,n,void 0,void 0,{context:i,headerOptions:La.FILE_HEADERS_ONLY})}function x0(t,e,n=4){let i=La.diffLines(t,e),s=[],r=t.split(`
|
|
217
217
|
`),o=e.split(`
|
|
218
218
|
`),a=Math.max(r.length,o.length),c=String(a).length,l=1,u=1,d=!1,p;for(let m=0;m<i.length;m++){let g=i[m],h=g.value.split(`
|
|
219
219
|
`);if(h[h.length-1]===""&&h.pop(),g.added||g.removed){p===void 0&&(p=u);for(let f of h)if(g.added){let x=String(u).padStart(c," ");s.push(`+${x} ${f}`),u++}else{let x=String(l).padStart(c," ");s.push(`-${x} ${f}`),l++}d=!0}else{let f=m<i.length-1&&(i[m+1].added||i[m+1].removed),x=d,v=f;if(x&&v)if(h.length<=n*2)for(let w of h){let C=String(l).padStart(c," ");s.push(` ${C} ${w}`),l++,u++}else{let w=h.slice(0,n),C=h.slice(h.length-n),P=h.length-w.length-C.length;for(let _ of w){let F=String(l).padStart(c," ");s.push(` ${F} ${_}`),l++,u++}s.push(` ${"".padStart(c," ")} ...`),l+=P,u+=P;for(let _ of C){let F=String(l).padStart(c," ");s.push(` ${F} ${_}`),l++,u++}}else if(x){let w=h.slice(0,n),C=h.length-w.length;for(let P of w){let _=String(l).padStart(c," ");s.push(` ${_} ${P}`),l++,u++}C>0&&(s.push(` ${"".padStart(c," ")} ...`),l+=C,u+=C)}else if(v){let w=Math.max(0,h.length-n);w>0&&(s.push(` ${"".padStart(c," ")} ...`),l+=w,u+=w);for(let C of h.slice(w)){let P=String(l).padStart(c," ");s.push(` ${P} ${C}`),l++,u++}}else l+=h.length,u+=h.length;d=!1}}return{diff:s.join(`
|
|
220
|
-
`),firstChangedLine:p}}async function
|
|
221
|
-
`);return!l||l===a?void 0:i.fg("error",l)}let c=n.details?.diff;if(c&&c!==o)return _l(c,{filePath:r??void 0})}function l$(t,e,n){return t?"error"in t?i=>n.bg("toolErrorBg",i):i=>n.bg("toolSuccessBg",i):e?i=>n.bg("toolErrorBg",i):i=>n.bg("toolPendingBg",i)}function
|
|
220
|
+
`),firstChangedLine:p}}async function h1(t,e,n){let i=Wt(t,n);try{try{await B3(i,$3.R_OK)}catch(l){let u=l instanceof Error&&"code"in l?`Error code: ${l.code}`:String(l);return{error:`Could not edit file: ${t}. ${u}.`}}let s=await N3(i,"utf-8"),{text:r}=f0(s),o=El(r),{baseContent:a,newContent:c}=b0(o,e,t);return x0(a,c)}catch(s){return{error:s instanceof Error?s.message:String(s)}}}import{realpath as z3}from"node:fs/promises";import{resolve as V3}from"node:path";var Rp=new Map,g1=Promise.resolve();function J3(t){return typeof t=="object"&&t!==null&&"code"in t&&(t.code==="ENOENT"||t.code==="ENOTDIR")}async function Q3(t){let e=V3(t);try{return await z3(e)}catch(n){if(J3(n))return e;throw n}}async function Pr(t,e){let n=g1.then(async()=>{let a=await Q3(t),c=Rp.get(a)??Promise.resolve(),l,u=new Promise(p=>{l=p}),d=c.then(()=>u);return Rp.set(a,d),{key:a,currentQueue:c,chainedQueue:d,releaseNext:l}});g1=n.then(()=>{},()=>{});let{key:i,currentQueue:s,chainedQueue:r,releaseNext:o}=await n;await s;try{return await e()}finally{o(),Rp.get(i)===r&&Rp.delete(i)}}var e$=Wa.Object({oldText:Wa.String({description:"Exact text for one targeted replacement. It must be unique in the original file and must not overlap with any other edits[].oldText in the same call."}),newText:Wa.String({description:"Replacement text for this targeted edit."})},{additionalProperties:!1}),t$=Wa.Object({path:Wa.String({description:"Path to the file to edit (relative or absolute)"}),edits:Wa.Array(e$,{description:"One or more targeted replacements. Each edit is matched against the original file, not incrementally. Do not include overlapping or nested edits. If two changes touch the same block or nearby lines, merge them into one edit instead."})},{additionalProperties:!1}),n$={readFile:t=>X3(t),writeFile:(t,e)=>Z3(t,e,"utf-8"),access:t=>Y3(t,f1.R_OK|f1.W_OK)};function i$(t){if(!t||typeof t!="object")return t;let e=t;if(typeof e.edits=="string")try{let a=JSON.parse(e.edits);Array.isArray(a)&&(e.edits=a)}catch{}let n=e;if(typeof n.oldText!="string"||typeof n.newText!="string")return e;let i=Array.isArray(n.edits)?[...n.edits]:[];i.push({oldText:n.oldText,newText:n.newText});let{oldText:s,newText:r,...o}=n;return{...o,edits:i}}function s$(t){if(!Array.isArray(t.edits)||t.edits.length===0)throw new Error("Edit tool input is invalid. edits must contain at least one replacement.");return{path:t.path,edits:t.edits}}function r$(){return Object.assign(new ht(1,1,t=>t),{preview:void 0,previewArgsKey:void 0,previewPending:!1,settledError:!1})}function o$(t,e){if(e instanceof ht){let i=e;return t.callComponent=i,i}if(t.callComponent)return t.callComponent;let n=r$();return t.callComponent=n,n}function b1(t){if(!t)return null;let e=typeof t.path=="string"?t.path:typeof t.file_path=="string"?t.file_path:null;return e?Array.isArray(t.edits)&&t.edits.length>0&&t.edits.every(n=>typeof n?.oldText=="string"&&typeof n?.newText=="string")?{path:e,edits:t.edits}:typeof t.oldText=="string"&&typeof t.newText=="string"?{path:e,edits:[{oldText:t.oldText,newText:t.newText}]}:null:null}function a$(t,e,n){let i=_s(Xe(t?.file_path??t?.path),e,n);return`${e.fg("toolTitle",e.bold("edit"))} ${i}`}function c$(t,e,n,i,s){let r=Xe(t?.file_path??t?.path),o=e&&!("error"in e)?e.diff:void 0,a=e&&"error"in e?e.error:void 0;if(s){let l=n.content.filter(u=>u.type==="text").map(u=>u.text||"").join(`
|
|
221
|
+
`);return!l||l===a?void 0:i.fg("error",l)}let c=n.details?.diff;if(c&&c!==o)return _l(c,{filePath:r??void 0})}function l$(t,e,n){return t?"error"in t?i=>n.bg("toolErrorBg",i):i=>n.bg("toolSuccessBg",i):e?i=>n.bg("toolErrorBg",i):i=>n.bg("toolPendingBg",i)}function x1(t,e,n,i){if(t.setBgFn(l$(t.preview,t.settledError,n)),t.clear(),t.addChild(new E(a$(e,n,i),0,0)),!t.preview)return t;let s="error"in t.preview?n.fg("error",t.preview.error):_l(t.preview.diff);return t.addChild(new L(1)),t.addChild(new E(s,0,0)),t}function v1(t,e,n){let i=t.preview,s=i===void 0||("error"in i&&"error"in e?i.error!==e.error:"error"in i!="error"in e)||!("error"in i)&&!("error"in e)&&(i.diff!==e.diff||i.firstChangedLine!==e.firstChangedLine);return t.preview=e,t.previewArgsKey=n,t.previewPending=!1,s}function Ip(t,e){let n=e?.operations??n$;return{name:"edit",label:"edit",description:"Edit a single file using exact text replacement. Every edits[].oldText must match a unique, non-overlapping region of the original file. If two changes affect the same block or nearby lines, merge them into one edit instead of emitting overlapping edits. Do not include large unchanged regions just to connect distant changes.",promptSnippet:"Make precise file edits with exact text replacement, including multiple disjoint edits in one call",promptGuidelines:["Use edit for precise changes (edits[].oldText must match exactly)","When changing multiple separate locations in one file, use one edit call with multiple entries in edits[] instead of multiple edit calls","Each edits[].oldText is matched against the original file, not after earlier edits are applied. Do not emit overlapping or nested edits. Merge nearby changes into one edit.","Keep edits[].oldText as small as possible while still being unique in the file. Do not pad with large unchanged regions."],parameters:t$,renderShell:"self",prepareArguments:i$,async execute(i,s,r,o,a){let{path:c,edits:l}=s$(s),u=Wt(c,t);return Pr(u,async()=>{let d=()=>{if(r?.aborted)throw new Error("Operation aborted")};d();try{await n.access(u)}catch(F){d();let A=F instanceof Error&&"code"in F?`Error code: ${F.code}`:String(F);throw new Error(`Could not edit file: ${c}. ${A}.`)}d();let m=(await n.readFile(u)).toString("utf-8");d();let{bom:g,text:h}=f0(m),f=d1(h),x=El(h),{baseContent:v,newContent:w}=b0(x,l,c);d();let C=g+p1(w,f);await n.writeFile(u,C),d();let P=x0(v,w),_=m1(c,v,w);return{content:[{type:"text",text:`Successfully replaced ${l.length} block(s) in ${c}.`}],details:{diff:P.diff,patch:_,firstChangedLine:P.firstChangedLine}}})},renderCall(i,s,r){let o=o$(r.state,r.lastComponent),a=b1(i),c=a?JSON.stringify({path:a.path,edits:a.edits}):void 0;if(o.previewArgsKey!==c&&(o.preview=void 0,o.previewArgsKey=c,o.previewPending=!1,o.settledError=!1),r.argsComplete&&a&&!o.preview&&!o.previewPending){o.previewPending=!0;let l=c;h1(a.path,a.edits,r.cwd).then(u=>{o.previewArgsKey===l&&(v1(o,u,l),r.invalidate())})}return x1(o,i,s,r.cwd)},renderResult(i,s,r,o){let a=o.state.callComponent,c=b1(o.args),l=c?JSON.stringify({path:c.path,edits:c.edits}):void 0,u=i,d=o.isError?void 0:u.details?.diff,p=!1;a&&(typeof d=="string"&&(p=v1(a,{diff:d,firstChangedLine:u.details?.firstChangedLine},l)||p),a.settledError!==o.isError&&(a.settledError=o.isError,p=!0),p&&x1(a,o.args,r,o.cwd));let m=c$(o.args,a?.preview,u,r,o.isError),g=o.lastComponent??new H;return g.clear(),m&&(g.addChild(new L(1)),g.addChild(new E(m,1,0))),g}}}import{createInterface as E$}from"node:readline";import{spawn as A$}from"child_process";import S0 from"path";import{Type as Fa}from"typebox";import Ol from"chalk";import{spawnSync as S1}from"child_process";import{chmodSync as u$,createWriteStream as d$,existsSync as v0,mkdirSync as y1,readdirSync as p$,renameSync as m$,rmSync as w1}from"fs";import{arch as h$,platform as Pp}from"os";import{join as qi}from"path";import{Readable as g$}from"stream";import{pipeline as f$}from"stream/promises";var Ll=Xc(),b$=1e4,x$=12e4;function v$(){let t=process.env.PI_OFFLINE;return t?t==="1"||t.toLowerCase()==="true"||t.toLowerCase()==="yes":!1}var y0={fd:{name:"fd",repo:"sharkdp/fd",binaryName:"fd",systemBinaryNames:["fd","fdfind"],tagPrefix:"v",getAssetName:(t,e,n)=>e==="darwin"?`fd-v${t}-${n==="arm64"?"aarch64":"x86_64"}-apple-darwin.tar.gz`:e==="linux"?`fd-v${t}-${n==="arm64"?"aarch64":"x86_64"}-unknown-linux-gnu.tar.gz`:e==="win32"?`fd-v${t}-${n==="arm64"?"aarch64":"x86_64"}-pc-windows-msvc.zip`:null},rg:{name:"ripgrep",repo:"BurntSushi/ripgrep",binaryName:"rg",tagPrefix:"",getAssetName:(t,e,n)=>e==="darwin"?`ripgrep-${t}-${n==="arm64"?"aarch64":"x86_64"}-apple-darwin.tar.gz`:e==="linux"?n==="arm64"?`ripgrep-${t}-aarch64-unknown-linux-gnu.tar.gz`:`ripgrep-${t}-x86_64-unknown-linux-musl.tar.gz`:e==="win32"?`ripgrep-${t}-${n==="arm64"?"aarch64":"x86_64"}-pc-windows-msvc.zip`:null}};function y$(t){try{let e=S1(t,["--version"],{stdio:"pipe"});return e.error===void 0||e.error===null}catch{return!1}}function w$(t){let e=y0[t];if(!e)return null;let n=qi(Ll,e.binaryName+(Pp()==="win32"?".exe":""));if(v0(n))return n;let i=e.systemBinaryNames??[e.binaryName];for(let s of i)if(y$(s))return s;return null}async function S$(t){let e=await fetch(`https://api.github.com/repos/${t}/releases/latest`,{headers:{"User-Agent":`${bt}-coding-agent`},signal:AbortSignal.timeout(b$)});if(!e.ok)throw new Error(`GitHub API error: ${e.status}`);return(await e.json()).tag_name.replace(/^v/,"")}async function T$(t,e){let n=await fetch(t,{signal:AbortSignal.timeout(x$)});if(!n.ok)throw new Error(`Failed to download: ${n.status}`);if(!n.body)throw new Error("No response body");let i=d$(e);await f$(g$.fromWeb(n.body),i)}function C$(t,e){let n=[t];for(;n.length>0;){let i=n.pop();if(!i)continue;let s=p$(i,{withFileTypes:!0});for(let r of s){let o=qi(i,r.name);if(r.isFile()&&r.name===e)return o;r.isDirectory()&&n.push(o)}}return null}function k$(t){if(t.error?.message)return t.error.message;let e=t.stderr?.toString().trim();if(e)return e;let n=t.stdout?.toString().trim();return n||`exit status ${t.status??"unknown"}`}function Wl(t,e){let n=S1(t,e,{stdio:"pipe"});return!n.error&&n.status===0?null:`${t}: ${k$(n)}`}function M$(t,e,n){let i=Wl("tar",["xzf",t,"-C",e]);if(i)throw new Error(`Failed to extract ${n}: ${i}`)}function R$(){let t=process.env.SystemRoot??process.env.WINDIR;if(t){let e=qi(t,"System32","tar.exe");if(v0(e))return e}return"tar.exe"}function I$(t,e,n){let i=[];if(Pp()==="win32"){let s=Wl(R$(),["xf",t,"-C",e]);if(!s)return;i.push(s);let o=Wl("powershell.exe",["-NoLogo","-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-Command","& { param($archive, $destination) $ErrorActionPreference = 'Stop'; Expand-Archive -LiteralPath $archive -DestinationPath $destination -Force }",t,e]);if(!o)return;i.push(o)}else{let s=Wl("unzip",["-q",t,"-d",e]);if(!s)return;i.push(s);let r=Wl("tar",["xf",t,"-C",e]);if(!r)return;i.push(r)}throw new Error(`Failed to extract ${n}: ${i.join("; ")}`)}async function P$(t){let e=y0[t];if(!e)throw new Error(`Unknown tool: ${t}`);let n=Pp(),i=h$(),s=await S$(e.repo);t==="fd"&&n==="darwin"&&i==="x64"&&(s="10.3.0");let r=e.getAssetName(s,n,i);if(!r)throw new Error(`Unsupported platform: ${n}/${i}`);y1(Ll,{recursive:!0});let o=`https://github.com/${e.repo}/releases/download/${e.tagPrefix}${s}/${r}`,a=qi(Ll,r),c=n==="win32"?".exe":"",l=qi(Ll,e.binaryName+c);await T$(o,a);let u=qi(Ll,`extract_tmp_${e.binaryName}_${process.pid}_${Date.now()}_${Math.random().toString(36).slice(2,10)}`);y1(u,{recursive:!0});try{if(r.endsWith(".tar.gz"))M$(a,u,r);else if(r.endsWith(".zip"))I$(a,u,r);else throw new Error(`Unsupported archive format: ${r}`);let d=e.binaryName+c,p=qi(u,r.replace(/\.(tar\.gz|zip)$/,"")),g=[qi(p,d),qi(u,d)].find(h=>v0(h));if(g||(g=C$(u,d)??void 0),g)m$(g,l);else throw new Error(`Binary not found in archive: expected ${d} under ${u}`);n!=="win32"&&u$(l,493)}finally{w1(a,{force:!0}),w1(u,{recursive:!0,force:!0})}return l}var _$={fd:"fd",rg:"ripgrep"};async function _r(t,e=!1){let n=w$(t);if(n)return n;let i=y0[t];if(i){if(v$()){e||console.log(Ol.yellow(`${i.name} not found. Offline mode enabled, skipping download.`));return}if(Pp()==="android"){let s=_$[t]??t;e||console.log(Ol.yellow(`${i.name} not found. Install with: pkg install ${s}`));return}e||console.log(Ol.dim(`${i.name} not found. Downloading...`));try{let s=await P$(t);return e||console.log(Ol.dim(`${i.name} installed to ${s}`)),s}catch(s){e||console.log(Ol.yellow(`Failed to download ${i.name}: ${s instanceof Error?s.message:s}`));return}}}function w0(t){return t.split(S0.sep).join("/")}var O$=Fa.Object({pattern:Fa.String({description:"Glob pattern to match files, e.g. '*.ts', '**/*.json', or 'src/**/*.spec.ts'"}),path:Fa.Optional(Fa.String({description:"Directory to search in (default: current directory)"})),limit:Fa.Optional(Fa.Number({description:"Maximum number of results (default: 1000)"}))}),T1=1e3,L$={exists:ji,glob:()=>[]};function W$(t,e){let n=Xe(t?.pattern),i=Xe(t?.path),s=i!==null?Il(i||"."):null,r=t?.limit,o=Ir(e),a=e.fg("toolTitle",e.bold("find"))+" "+(n===null?o:e.fg("accent",n||""))+e.fg("toolOutput",` in ${s===null?o:s}`);return r!==void 0&&(a+=e.fg("toolOutput",` (limit ${r})`)),a}function F$(t,e,n,i){let s=Wn(t,i).trim(),r="";if(s){let c=s.split(`
|
|
222
222
|
`),l=e.expanded?c.length:20,u=c.slice(0,l),d=c.length-l;r+=`
|
|
223
223
|
${u.map(p=>n.fg("toolOutput",p)).join(`
|
|
224
224
|
`)}`,d>0&&(r+=`${n.fg("muted",`
|
|
225
225
|
... (${d} more lines,`)} ${re("app.tools.expand","to expand")}${n.fg("muted",")")}`)}let o=t.details?.resultLimitReached,a=t.details?.truncation;if(o||a?.truncated){let c=[];o&&c.push(`${o} results limit`),a?.truncated&&c.push(`${Ye(a.maxBytes??51200)} limit`),r+=`
|
|
226
|
-
${n.fg("warning",`[Truncated: ${c.join(", ")}]`)}`}return r}function _p(t,e){let n=e?.operations;return{name:"find",label:"find",description:`Search for files by glob pattern. Returns matching file paths relative to the search directory. Respects .gitignore. Output is truncated to ${
|
|
226
|
+
${n.fg("warning",`[Truncated: ${c.join(", ")}]`)}`}return r}function _p(t,e){let n=e?.operations;return{name:"find",label:"find",description:`Search for files by glob pattern. Returns matching file paths relative to the search directory. Respects .gitignore. Output is truncated to ${T1} results or ${51200/1024}KB (whichever is hit first).`,promptSnippet:"Find files by glob pattern (respects .gitignore)",parameters:O$,async execute(i,{pattern:s,path:r,limit:o},a,c,l){return new Promise((u,d)=>{if(a?.aborted){d(new Error("Operation aborted"));return}let p=!1,m,g=f=>{p||(p=!0,a?.removeEventListener("abort",h),m=void 0,f())},h=()=>{m?.(),g(()=>d(new Error("Operation aborted")))};a?.addEventListener("abort",h,{once:!0}),(async()=>{try{let f=Wt(r||".",t),x=o??T1,v=n??L$;if(n?.glob){if(!await v.exists(f)){g(()=>d(new Error(`Path not found: ${f}`)));return}if(a?.aborted){g(()=>d(new Error("Operation aborted")));return}let k=await v.glob(s,f,{ignore:["**/node_modules/**","**/.git/**"],limit:x});if(a?.aborted){g(()=>d(new Error("Operation aborted")));return}if(k.length===0){g(()=>u({content:[{type:"text",text:"No files found matching pattern"}],details:void 0}));return}let O=k.map(ye=>ye.startsWith(f)?w0(ye.slice(f.length+1)):w0(S0.relative(f,ye))),U=O.length>=x,N=O.join(`
|
|
227
227
|
`),K=Yn(N,{maxLines:Number.MAX_SAFE_INTEGER}),G=K.content,J={},le=[];U&&(le.push(`${x} results limit reached`),J.resultLimitReached=x),K.truncated&&(le.push(`${Ye(51200)} limit reached`),J.truncation=K),le.length>0&&(G+=`
|
|
228
228
|
|
|
229
229
|
[${le.join(". ")}]`),g(()=>u({content:[{type:"text",text:G}],details:Object.keys(J).length>0?J:void 0}));return}let w=await _r("fd",!0);if(a?.aborted){g(()=>d(new Error("Operation aborted")));return}if(!w){g(()=>d(new Error("fd is not available and could not be downloaded")));return}let C=["--glob","--color=never","--hidden","--no-require-git","--max-results",String(x)],P=s;s.includes("/")&&(C.push("--full-path"),!s.startsWith("/")&&!s.startsWith("**/")&&s!=="**"&&(P=`**/${s}`)),C.push("--",P,f);let _=A$(w,C,{stdio:["ignore","pipe","pipe"]}),F=E$({input:_.stdout}),A="",W=[];m=()=>{_.killed||_.kill()};let R=()=>{F.close()};_.stderr?.on("data",k=>{A+=k.toString()}),F.on("line",k=>{W.push(k)}),_.on("error",k=>{R(),g(()=>d(new Error(`Failed to run fd: ${k.message}`)))}),_.on("close",k=>{if(R(),a?.aborted){g(()=>d(new Error("Operation aborted")));return}let O=W.join(`
|
|
230
230
|
`);if(k!==0){let ue=A.trim()||`fd exited with code ${k}`;if(!O){g(()=>d(new Error(ue)));return}}if(!O){g(()=>u({content:[{type:"text",text:"No files found matching pattern"}],details:void 0}));return}let U=[];for(let ue of W){let Me=ue.replace(/\r$/,"").trim();if(!Me)continue;let it=Me.endsWith("/")||Me.endsWith("\\"),$e=Me;Me.startsWith(f)?$e=Me.slice(f.length+1):$e=S0.relative(f,Me),it&&!$e.endsWith("/")&&($e+="/"),U.push(w0($e))}let N=U.length>=x,K=U.join(`
|
|
231
231
|
`),G=Yn(K,{maxLines:Number.MAX_SAFE_INTEGER}),J=G.content,le={},ye=[];N&&(ye.push(`${x} results limit reached. Use limit=${x*2} for more, or refine pattern`),le.resultLimitReached=x),G.truncated&&(ye.push(`${Ye(51200)} limit reached`),le.truncation=G),ye.length>0&&(J+=`
|
|
232
232
|
|
|
233
|
-
[${ye.join(". ")}]`),g(()=>u({content:[{type:"text",text:J}],details:Object.keys(le).length>0?le:void 0}))})}catch(f){if(a?.aborted){g(()=>d(new Error("Operation aborted")));return}let x=f instanceof Error?f:new Error(String(f));g(()=>d(x))}})()})},renderCall(i,s,r){let o=r.lastComponent??new E("",0,0);return o.setText(W$(i,s)),o},renderResult(i,s,r,o){let a=o.lastComponent??new E("",0,0);return a.setText(F$(i,s,r,o.showImages)),a}}}import{readFile as U$,stat as D$}from"node:fs/promises";import{createInterface as $$}from"node:readline";import{spawn as B$}from"child_process";import
|
|
233
|
+
[${ye.join(". ")}]`),g(()=>u({content:[{type:"text",text:J}],details:Object.keys(le).length>0?le:void 0}))})}catch(f){if(a?.aborted){g(()=>d(new Error("Operation aborted")));return}let x=f instanceof Error?f:new Error(String(f));g(()=>d(x))}})()})},renderCall(i,s,r){let o=r.lastComponent??new E("",0,0);return o.setText(W$(i,s)),o},renderResult(i,s,r,o){let a=o.lastComponent??new E("",0,0);return a.setText(F$(i,s,r,o.showImages)),a}}}import{readFile as U$,stat as D$}from"node:fs/promises";import{createInterface as $$}from"node:readline";import{spawn as B$}from"child_process";import k1 from"path";import{Type as Xt}from"typebox";var N$=Xt.Object({pattern:Xt.String({description:"Search pattern (regex or literal string)"}),path:Xt.Optional(Xt.String({description:"Directory or file to search (default: current directory)"})),glob:Xt.Optional(Xt.String({description:"Filter files by glob pattern, e.g. '*.ts' or '**/*.spec.ts'"})),ignoreCase:Xt.Optional(Xt.Boolean({description:"Case-insensitive search (default: false)"})),literal:Xt.Optional(Xt.Boolean({description:"Treat pattern as literal string instead of regex (default: false)"})),context:Xt.Optional(Xt.Number({description:"Number of lines to show before and after each match (default: 0)"})),limit:Xt.Optional(Xt.Number({description:"Maximum number of matches to return (default: 100)"}))}),M1=100,j$={isDirectory:async t=>(await D$(t)).isDirectory(),readFile:t=>U$(t,"utf-8")};function q$(t,e){let n=Xe(t?.pattern),i=Xe(t?.path),s=i!==null?Il(i||"."):null,r=Xe(t?.glob),o=t?.limit,a=Ir(e),c=e.fg("toolTitle",e.bold("grep"))+" "+(n===null?a:e.fg("accent",`/${n||""}/`))+e.fg("toolOutput",` in ${s===null?a:s}`);return r&&(c+=e.fg("toolOutput",` (${r})`)),o!==void 0&&(c+=e.fg("toolOutput",` limit ${o}`)),c}function G$(t,e,n,i){let s=Wn(t,i).trim(),r="";if(s){let l=s.split(`
|
|
234
234
|
`),u=e.expanded?l.length:15,d=l.slice(0,u),p=l.length-u;r+=`
|
|
235
235
|
${d.map(m=>n.fg("toolOutput",m)).join(`
|
|
236
236
|
`)}`,p>0&&(r+=`${n.fg("muted",`
|
|
237
237
|
... (${p} more lines,`)} ${re("app.tools.expand","to expand")}${n.fg("muted",")")}`)}let o=t.details?.matchLimitReached,a=t.details?.truncation,c=t.details?.linesTruncated;if(o||a?.truncated||c){let l=[];o&&l.push(`${o} matches limit`),a?.truncated&&l.push(`${Ye(a.maxBytes??51200)} limit`),c&&l.push("some lines truncated"),r+=`
|
|
238
|
-
${n.fg("warning",`[Truncated: ${l.join(", ")}]`)}`}return r}function Ep(t,e){let n=e?.operations;return{name:"grep",label:"grep",description:`Search file contents for a pattern. Returns matching lines with file paths and line numbers. Respects .gitignore. Output is truncated to ${
|
|
238
|
+
${n.fg("warning",`[Truncated: ${l.join(", ")}]`)}`}return r}function Ep(t,e){let n=e?.operations;return{name:"grep",label:"grep",description:`Search file contents for a pattern. Returns matching lines with file paths and line numbers. Respects .gitignore. Output is truncated to ${M1} matches or ${51200/1024}KB (whichever is hit first). Long lines are truncated to ${500} chars.`,promptSnippet:"Search file contents for patterns (respects .gitignore)",parameters:N$,async execute(i,{pattern:s,path:r,glob:o,ignoreCase:a,literal:c,context:l,limit:u},d,p,m){return new Promise((g,h)=>{if(d?.aborted){h(new Error("Operation aborted"));return}let f=!1,x=v=>{f||(f=!0,v())};(async()=>{try{let v=await _r("rg",!0);if(!v){x(()=>h(new Error("ripgrep (rg) is not available and could not be downloaded")));return}let w=Wt(r||".",t),C=n??j$,P;try{P=await C.isDirectory(w)}catch{x(()=>h(new Error(`Path not found: ${w}`)));return}let _=l&&l>0?l:0,F=Math.max(1,u??M1),A=ne=>{if(P){let ge=k1.relative(w,ne);if(ge&&!ge.startsWith(".."))return ge.replace(/\\/g,"/")}return k1.basename(ne)},W=new Map,R=async ne=>{let ge=W.get(ne);if(!ge){try{ge=(await C.readFile(ne)).replace(/\r\n/g,`
|
|
239
239
|
`).replace(/\r/g,`
|
|
240
240
|
`).split(`
|
|
241
241
|
`)}catch{ge=[]}W.set(ne,ge)}return ge},k=["--json","--line-number","--color=never","--hidden"];a&&k.push("--ignore-case"),c&&k.push("--fixed-strings"),o&&k.push("--glob",o),k.push("--",s,w);let O=B$(v,k,{stdio:["ignore","pipe","pipe"]}),U=$$({input:O.stdout}),N="",K=0,G=!1,J=!1,le=!1,ye=!1,ue=[],Me=()=>{U.close(),d?.removeEventListener("abort",$e)},it=(ne=!1)=>{O.killed||(ye=ne,O.kill())},$e=()=>{le=!0,it()};d?.addEventListener("abort",$e,{once:!0}),O.stderr?.on("data",ne=>{N+=ne.toString()});let si=async(ne,ge)=>{let we=A(ne),st=await R(ne);if(!st.length)return[`${we}:${ge}: (unable to read file)`];let Lt=[],Ri=_>0?Math.max(1,ge-_):ge,Gt=_>0?Math.min(st.length,ge+_):ge;for(let kn=Ri;kn<=Gt;kn++){let Hc=(st[kn-1]??"").replace(/\r/g,""),rr=kn===ge,{text:zc,wasTruncated:fg}=Tl(Hc);fg&&(J=!0),rr?Lt.push(`${we}:${kn}: ${zc}`):Lt.push(`${we}-${kn}- ${zc}`)}return Lt},qt=[];U.on("line",ne=>{if(!ne.trim()||K>=F)return;let ge;try{ge=JSON.parse(ne)}catch{return}if(ge.type==="match"){K++;let we=ge.data?.path?.text,st=ge.data?.line_number,Lt=ge.data?.lines?.text;we&&typeof st=="number"&&qt.push({filePath:we,lineNumber:st,lineText:Lt}),K>=F&&(G=!0,it(!0))}}),O.on("error",ne=>{Me(),x(()=>h(new Error(`Failed to run ripgrep: ${ne.message}`)))}),O.on("close",async ne=>{if(Me(),le){x(()=>h(new Error("Operation aborted")));return}if(!ye&&ne!==0&&ne!==1){let Gt=N.trim()||`ripgrep exited with code ${ne}`;x(()=>h(new Error(Gt)));return}if(K===0){x(()=>g({content:[{type:"text",text:"No matches found"}],details:void 0}));return}for(let Gt of qt)if(_===0&&Gt.lineText!==void 0){let kn=A(Gt.filePath),Ii=Gt.lineText.replace(/\r\n/g,`
|
|
242
242
|
`).replace(/\r/g,"").replace(/\n$/,""),{text:Hc,wasTruncated:rr}=Tl(Ii);rr&&(J=!0),ue.push(`${kn}:${Gt.lineNumber}: ${Hc}`)}else{let kn=await si(Gt.filePath,Gt.lineNumber);ue.push(...kn)}let ge=ue.join(`
|
|
243
243
|
`),we=Yn(ge,{maxLines:Number.MAX_SAFE_INTEGER}),st=we.content,Lt={},Ri=[];G&&(Ri.push(`${F} matches limit reached. Use limit=${F*2} for more, or refine pattern`),Lt.matchLimitReached=F),we.truncated&&(Ri.push(`${Ye(51200)} limit reached`),Lt.truncation=we),J&&(Ri.push(`Some lines truncated to ${500} chars. Use read tool to see full lines`),Lt.linesTruncated=!0),Ri.length>0&&(st+=`
|
|
244
244
|
|
|
245
|
-
[${Ri.join(". ")}]`),x(()=>g({content:[{type:"text",text:st}],details:Object.keys(Lt).length>0?Lt:void 0}))})}catch(v){x(()=>h(v))}})()})},renderCall(i,s,r){let o=r.lastComponent??new E("",0,0);return o.setText(q$(i,s)),o},renderResult(i,s,r,o){let a=o.lastComponent??new E("",0,0);return a.setText(G$(i,s,r,o.showImages)),a}}}import{readdir as K$,stat as H$}from"node:fs/promises";import z$ from"path";import{Type as Fl}from"typebox";var V$=Fl.Object({path:Fl.Optional(Fl.String({description:"Directory to list (default: current directory)"})),limit:Fl.Optional(Fl.Number({description:"Maximum number of entries to return (default: 500)"}))}),
|
|
245
|
+
[${Ri.join(". ")}]`),x(()=>g({content:[{type:"text",text:st}],details:Object.keys(Lt).length>0?Lt:void 0}))})}catch(v){x(()=>h(v))}})()})},renderCall(i,s,r){let o=r.lastComponent??new E("",0,0);return o.setText(q$(i,s)),o},renderResult(i,s,r,o){let a=o.lastComponent??new E("",0,0);return a.setText(G$(i,s,r,o.showImages)),a}}}import{readdir as K$,stat as H$}from"node:fs/promises";import z$ from"path";import{Type as Fl}from"typebox";var V$=Fl.Object({path:Fl.Optional(Fl.String({description:"Directory to list (default: current directory)"})),limit:Fl.Optional(Fl.Number({description:"Maximum number of entries to return (default: 500)"}))}),R1=500,J$={exists:ji,stat:H$,readdir:K$};function Q$(t,e,n){let i=t?.limit,s=_s(Xe(t?.path),e,n,{emptyFallback:"."}),r=`${e.fg("toolTitle",e.bold("ls"))} ${s}`;return i!==void 0&&(r+=e.fg("toolOutput",` (limit ${i})`)),r}function Y$(t,e,n,i){let s=Wn(t,i).trim(),r="";if(s){let c=s.split(`
|
|
246
246
|
`),l=e.expanded?c.length:20,u=c.slice(0,l),d=c.length-l;r+=`
|
|
247
247
|
${u.map(p=>n.fg("toolOutput",p)).join(`
|
|
248
248
|
`)}`,d>0&&(r+=`${n.fg("muted",`
|
|
249
249
|
... (${d} more lines,`)} ${re("app.tools.expand","to expand")}${n.fg("muted",")")}`)}let o=t.details?.entryLimitReached,a=t.details?.truncation;if(o||a?.truncated){let c=[];o&&c.push(`${o} entries limit`),a?.truncated&&c.push(`${Ye(a.maxBytes??51200)} limit`),r+=`
|
|
250
|
-
${n.fg("warning",`[Truncated: ${c.join(", ")}]`)}`}return r}function Ap(t,e){let n=e?.operations??J$;return{name:"ls",label:"ls",description:`List directory contents. Returns entries sorted alphabetically, with '/' suffix for directories. Includes dotfiles. Output is truncated to ${
|
|
250
|
+
${n.fg("warning",`[Truncated: ${c.join(", ")}]`)}`}return r}function Ap(t,e){let n=e?.operations??J$;return{name:"ls",label:"ls",description:`List directory contents. Returns entries sorted alphabetically, with '/' suffix for directories. Includes dotfiles. Output is truncated to ${R1} entries or ${51200/1024}KB (whichever is hit first).`,promptSnippet:"List directory contents",parameters:V$,async execute(i,{path:s,limit:r},o,a,c){return new Promise((l,u)=>{if(o?.aborted){u(new Error("Operation aborted"));return}let d=()=>u(new Error("Operation aborted"));o?.addEventListener("abort",d,{once:!0}),(async()=>{try{let p=Wt(s||".",t),m=r??R1;if(!await n.exists(p)){u(new Error(`Path not found: ${p}`));return}if(!(await n.stat(p)).isDirectory()){u(new Error(`Not a directory: ${p}`));return}let h;try{h=await n.readdir(p)}catch(F){u(new Error(`Cannot read directory: ${F.message}`));return}h.sort((F,A)=>F.toLowerCase().localeCompare(A.toLowerCase()));let f=[],x=!1;for(let F of h){if(f.length>=m){x=!0;break}let A=z$.join(p,F),W="";try{(await n.stat(A)).isDirectory()&&(W="/")}catch{continue}f.push(F+W)}if(o?.removeEventListener("abort",d),f.length===0){l({content:[{type:"text",text:"(empty directory)"}],details:void 0});return}let v=f.join(`
|
|
251
251
|
`),w=Yn(v,{maxLines:Number.MAX_SAFE_INTEGER}),C=w.content,P={},_=[];x&&(_.push(`${m} entries limit reached. Use limit=${m*2} for more`),P.entryLimitReached=m),w.truncated&&(_.push(`${Ye(51200)} limit reached`),P.truncation=w),_.length>0&&(C+=`
|
|
252
252
|
|
|
253
|
-
[${_.join(". ")}]`),l({content:[{type:"text",text:C}],details:Object.keys(P).length>0?P:void 0})}catch(p){o?.removeEventListener("abort",d),u(p)}})()})},renderCall(i,s,r){let o=r.lastComponent??new E("",0,0);return o.setText(Q$(i,s,r.cwd)),o},renderResult(i,s,r,o){let a=o.lastComponent??new E("",0,0);return a.setText(Y$(i,s,r,o.showImages)),a}}}import{basename as
|
|
253
|
+
[${_.join(". ")}]`),l({content:[{type:"text",text:C}],details:Object.keys(P).length>0?P:void 0})}catch(p){o?.removeEventListener("abort",d),u(p)}})()})},renderCall(i,s,r){let o=r.lastComponent??new E("",0,0);return o.setText(Q$(i,s,r.cwd)),o},renderResult(i,s,r,o){let a=o.lastComponent??new E("",0,0);return a.setText(Y$(i,s,r,o.showImages)),a}}}import{basename as W1,dirname as U1,isAbsolute as xB,relative as vB,resolve as F1,sep as D1}from"node:path";import{constants as yB}from"fs";import{access as wB,readFile as SB}from"fs/promises";import{Type as ja}from"typebox";import{Worker as uB}from"node:worker_threads";function X$(t,e){if(e+8>t.length)return 1;let i=(t[e]<<8|t[e+1])===18761,s=l=>i?t[l]|t[l+1]<<8:t[l]<<8|t[l+1],o=(l=>i?t[l]|t[l+1]<<8|t[l+2]<<16|t[l+3]<<24:(t[l]<<24|t[l+1]<<16|t[l+2]<<8|t[l+3])>>>0)(e+4),a=e+o;if(a+2>t.length)return 1;let c=s(a);for(let l=0;l<c;l++){let u=a+2+l*12;if(u+12>t.length)return 1;if(s(u)===274){let d=s(u+8);return d>=1&&d<=8?d:1}}return 1}function Z$(t){let e=2;for(;e<t.length-1;){if(t[e]!==255)return-1;let n=t[e+1];if(n===255){e++;continue}if(n===225){if(e+4>=t.length)return-1;let s=e+4;return s+6>t.length||!I1(t,s)?-1:s+6}if(e+4>t.length)return-1;let i=t[e+2]<<8|t[e+3];e+=2+i}return-1}function eB(t){let e=12;for(;e+8<=t.length;){let n=String.fromCharCode(t[e],t[e+1],t[e+2],t[e+3]),i=t[e+4]|t[e+5]<<8|t[e+6]<<16|t[e+7]<<24,s=e+8;if(n==="EXIF")return s+i>t.length?-1:i>=6&&I1(t,s)?s+6:s;e=s+i+i%2}return-1}function I1(t,e){return t[e]===69&&t[e+1]===120&&t[e+2]===105&&t[e+3]===102&&t[e+4]===0&&t[e+5]===0}function tB(t){let e=-1;return t.length>=2&&t[0]===255&&t[1]===216?e=Z$(t):t.length>=12&&t[0]===82&&t[1]===73&&t[2]===70&&t[3]===70&&t[8]===87&&t[9]===69&&t[10]===66&&t[11]===80&&(e=eB(t)),e===-1?1:X$(t,e)}function Op(t,e,n){let i=e.get_width(),s=e.get_height(),r=e.get_raw_pixels(),o=new Uint8Array(r.length);for(let a=0;a<s;a++)for(let c=0;c<i;c++){let l=(a*i+c)*4,u=n(c,a,i,s)*4;o[u]=r[l],o[u+1]=r[l+1],o[u+2]=r[l+2],o[u+3]=r[l+3]}return new t.PhotonImage(o,s,i)}function Lp(t,e,n){let i=tB(n);if(i===1)return e;switch(i){case 2:return t.fliph(e),e;case 3:return t.fliph(e),t.flipv(e),e;case 4:return t.flipv(e),e;case 5:{let s=Op(t,e,(r,o,a,c)=>r*c+(c-1-o));return t.fliph(s),s}case 6:return Op(t,e,(s,r,o,a)=>s*a+(a-1-r));case 7:{let s=Op(t,e,(r,o,a,c)=>(a-1-r)*c+o);return t.fliph(s),s}case 8:return Op(t,e,(s,r,o,a)=>(o-1-s)*a+r);default:return e}}import{createRequire as nB}from"module";import*as $a from"path";import{fileURLToPath as iB}from"url";var sB=nB(import.meta.url),Ua=sB("fs"),Fp="photon_rs_bg.wasm",Da=null,Wp=null;function rB(t){return typeof t=="string"?t:t instanceof URL?iB(t):null}function oB(){let t=$a.dirname(process.execPath);return[$a.join(t,Fp),$a.join(t,"photon",Fp),$a.join(process.cwd(),Fp)]}function aB(){let t=Ua.readFileSync.bind(Ua),e=oB(),n=Ua,i=((...s)=>{let[r,o]=s;if(rB(r)?.endsWith(Fp))try{return t(...s)}catch(c){let l=c;if(l?.code&&l.code!=="ENOENT")throw c;for(let u of e)if(Ua.existsSync(u))return o===void 0?t(u):t(u,o);throw c}return t(...s)});try{n.readFileSync=i}catch{Object.defineProperty(Ua,"readFileSync",{value:i,writable:!0,configurable:!0})}return()=>{try{n.readFileSync=t}catch{Object.defineProperty(Ua,"readFileSync",{value:t,writable:!0,configurable:!0})}}}async function Ba(){return Da||Wp||(Wp=(async()=>{let t=aB();try{return Da=await import("@silvia-odwyer/photon-node"),Da}catch{return Da=null,Da}finally{t()}})(),Wp)}var cB=4.5*1024*1024,lB={maxWidth:2e3,maxHeight:2e3,maxBytes:cB,jpegQuality:80};function P1(t,e){let n=Buffer.from(t).toString("base64");return{data:n,encodedSize:Buffer.byteLength(n,"utf-8"),mimeType:e}}async function _1(t,e,n){let i={...lB,...n},s=Math.ceil(t.byteLength/3)*4,r=await Ba();if(!r)return null;let o;try{let g=function(v,w,C){let P=r.resize(o,v,w,r.SamplingFilter.Lanczos3);try{let _=[P1(P.get_bytes(),"image/png")];for(let F of C)_.push(P1(P.get_bytes_jpeg(F),"image/jpeg"));return _}finally{P.free()}};var a=g;let c=r.PhotonImage.new_from_byteslice(t);o=Lp(r,c,t),o!==c&&c.free();let l=o.get_width(),u=o.get_height(),d=e.split("/")[1]??"png";if(l<=i.maxWidth&&u<=i.maxHeight&&s<i.maxBytes)return{data:Buffer.from(t).toString("base64"),mimeType:e||`image/${d}`,originalWidth:l,originalHeight:u,width:l,height:u,wasResized:!1};let p=l,m=u;p>i.maxWidth&&(m=Math.round(m*i.maxWidth/p),p=i.maxWidth),m>i.maxHeight&&(p=Math.round(p*i.maxHeight/m),m=i.maxHeight);let h=Array.from(new Set([i.jpegQuality,85,70,55,40])),f=p,x=m;for(;;){let v=g(f,x,h);for(let P of v)if(P.encodedSize<i.maxBytes)return{data:P.data,mimeType:P.mimeType,originalWidth:l,originalHeight:u,width:f,height:x,wasResized:!0};if(f===1&&x===1)break;let w=f===1?1:Math.max(1,Math.floor(f*.75)),C=x===1?1:Math.max(1,Math.floor(x*.75));if(w===f&&C===x)break;f=w,x=C}return null}catch{return null}finally{o&&o.free()}}function dB(t){return new Uint8Array(t)}function pB(t){return t!==null&&typeof t=="object"}function mB(t){return new uB(t)}async function E1(t,e,n,i){let s=mB(t);try{let r=dB(e);return await new Promise((o,a)=>{let c=!1,l=d=>{c||(c=!0,o(d))},u=d=>{c||(c=!0,a(d))};s.once("message",d=>{if(!pB(d)){u(new Error("Invalid image resize worker response"));return}if(d.error){u(new Error(d.error));return}l(d.result??null)}),s.once("error",u),s.once("exit",d=>{c||u(new Error(`Image resize worker exited with code ${d}`))}),s.postMessage({inputBytes:r,mimeType:n,options:i},[r.buffer])})}finally{s.terminate().catch(()=>{})}}async function Up(t,e,n){let i=import.meta.url.endsWith(".ts"),s=new URL(i?"./image-resize-worker.ts":"./image-resize-worker.js",import.meta.url);if(typeof process.versions.bun=="string")try{return await E1("./src/utils/image-resize-worker.ts",t,e,n)}catch{}try{return await E1(s,t,e,n)}catch{return _1(t,e,n)}}function Dp(t){if(!t.wasResized)return;let e=t.originalWidth/t.width;return`[Image: original ${t.originalWidth}x${t.originalHeight}, displayed at ${t.width}x${t.height}. Multiply coordinates by ${e.toFixed(2)} to map to original image.]`}import{open as hB}from"node:fs/promises";var A1=4100,T0=[137,80,78,71,13,10,26,10];function gB(t){return O1(t,[255,216,255])?t[3]===247?null:"image/jpeg":O1(t,T0)?fB(t)&&!bB(t)?"image/png":null:Na(t,0,"GIF")?"image/gif":Na(t,0,"RIFF")&&Na(t,8,"WEBP")?"image/webp":null}async function C0(t){let e=await hB(t,"r");try{let n=Buffer.alloc(A1),{bytesRead:i}=await e.read(n,0,A1,0);return gB(n.subarray(0,i))}finally{await e.close()}}function fB(t){return t.length>=16&&L1(t,T0.length)===13&&Na(t,12,"IHDR")}function bB(t){let e=T0.length;for(;e+8<=t.length;){let n=L1(t,e),i=e+4;if(Na(t,i,"acTL"))return!0;if(Na(t,i,"IDAT"))return!1;let s=e+8+n+4;if(s<=e||s>t.length)return!1;e=s}return!1}function L1(t,e){return(t[e]??0)*16777216+((t[e+1]??0)<<16)+((t[e+2]??0)<<8)+(t[e+3]??0)}function O1(t,e){return t.length<e.length?!1:e.every((n,i)=>t[i]===n)}function Na(t,e,n){if(t.length<e+n.length)return!1;for(let i=0;i<n.length;i++)if(t[e+i]!==n.charCodeAt(i))return!1;return!0}var TB=ja.Object({path:ja.String({description:"Path to the file to read (relative or absolute)"}),offset:ja.Optional(ja.Number({description:"Line number to start reading from (1-indexed)"})),limit:ja.Optional(ja.Number({description:"Maximum number of lines to read"}))}),CB=new Set(["AGENTS.md","AGENTS.MD","CLAUDE.md","CLAUDE.MD"]),kB={readFile:t=>SB(t),access:t=>wB(t,yB.R_OK),detectImageMimeType:C0};function k0(t,e){if(t?.offset===void 0&&t?.limit===void 0)return"";let n=t.offset??1,i=t.limit!==void 0?n+t.limit-1:"";return e.fg("warning",`:${n}${i?`-${i}`:""}`)}function MB(t,e,n){let i=_s(Xe(t?.file_path??t?.path),e,n);return`${e.fg("toolTitle",e.bold("read"))} ${i}${k0(t,e)}`}function RB(t){let e=t.length;for(;e>0&&t[e-1]==="";)e--;return t.slice(0,e)}function IB(t){if(!(!t||t.input.includes("image")))return"[Current model does not support images. The image will be omitted from this request.]"}function PB(t){return t.split(D1).join("/")}function _B(t){let e=U1(pd()),n=vB(F1(e),F1(t));if(n===""||n===".."||n.startsWith(`..${D1}`)||xB(n))return;let i=PB(n);if(i==="README.md"||i.startsWith("docs/")||i.startsWith("examples/"))return{kind:"docs",label:i}}function EB(t,e){let n=Xe(t?.file_path??t?.path);if(!n)return;let i=Wt(n,e),s=W1(i);if(s==="SKILL.md")return{kind:"skill",label:W1(U1(i))||s};let r=_B(i);if(r)return r;if(CB.has(s))return{kind:"resource",label:sS(i,e)}}function AB(t,e,n){let i=n.fg("dim",` (${ke("app.tools.expand")} to expand)`);return t.kind==="skill"?n.fg("customMessageLabel","\x1B[1m[skill]\x1B[22m ")+n.fg("customMessageText",t.label)+k0(e,n)+i:n.fg("toolTitle",n.bold(`read ${t.kind}`))+" "+n.fg("accent",t.label)+k0(e,n)+i}function OB(t,e,n,i,s,r,o){if(!n.expanded&&!o)return"";let a=Xe(t?.file_path??t?.path),c=Wn(e,s),l=a?Sr(a):void 0,u=l?Is(Ni(c),l):c.split(`
|
|
254
254
|
`),d=RB(u),p=n.expanded?d.length:10,m=d.slice(0,p),g=d.length-p,h=`
|
|
255
255
|
${m.map(x=>l?Ni(x):i.fg("toolOutput",Ni(x))).join(`
|
|
256
256
|
`)}`;g>0&&(h+=`${i.fg("muted",`
|
|
257
257
|
... (${g} more lines,`)} ${re("app.tools.expand","to expand")}${i.fg("muted",")")}`);let f=e.details?.truncation;return f?.truncated&&(f.firstLineExceedsLimit?h+=`
|
|
258
258
|
${i.fg("warning",`[First line exceeds ${Ye(f.maxBytes??51200)} limit]`)}`:f.truncatedBy==="lines"?h+=`
|
|
259
259
|
${i.fg("warning",`[Truncated: showing ${f.outputLines} of ${f.totalLines} lines (${f.maxLines??2e3} line limit)]`)}`:h+=`
|
|
260
|
-
${i.fg("warning",`[Truncated: ${f.outputLines} lines shown (${Ye(f.maxBytes??51200)} limit)]`)}`),h}function $p(t,e){let n=e?.autoResizeImages??!0,i=e?.operations??kB;return{name:"read",label:"read",description:`Read the contents of a file. Supports text files and images (jpg, png, gif, webp). Images are sent as attachments. For text files, output is truncated to ${2e3} lines or ${51200/1024}KB (whichever is hit first). Use offset/limit for large files. When you need the full file, continue with offset until complete.`,promptSnippet:"Read file contents",promptGuidelines:["Use read to examine files instead of cat or sed."],parameters:TB,async execute(s,{path:r,offset:o,limit:a},c,l,u){return new Promise((d,p)=>{if(c?.aborted){p(new Error("Operation aborted"));return}let m=!1,g=()=>{m=!0,p(new Error("Operation aborted"))};c?.addEventListener("abort",g,{once:!0}),(async()=>{try{let h=await
|
|
260
|
+
${i.fg("warning",`[Truncated: ${f.outputLines} lines shown (${Ye(f.maxBytes??51200)} limit)]`)}`),h}function $p(t,e){let n=e?.autoResizeImages??!0,i=e?.operations??kB;return{name:"read",label:"read",description:`Read the contents of a file. Supports text files and images (jpg, png, gif, webp). Images are sent as attachments. For text files, output is truncated to ${2e3} lines or ${51200/1024}KB (whichever is hit first). Use offset/limit for large files. When you need the full file, continue with offset until complete.`,promptSnippet:"Read file contents",promptGuidelines:["Use read to examine files instead of cat or sed."],parameters:TB,async execute(s,{path:r,offset:o,limit:a},c,l,u){return new Promise((d,p)=>{if(c?.aborted){p(new Error("Operation aborted"));return}let m=!1,g=()=>{m=!0,p(new Error("Operation aborted"))};c?.addEventListener("abort",g,{once:!0}),(async()=>{try{let h=await l1(r,t);if(m||(await i.access(h),m))return;let f=i.detectImageMimeType?await i.detectImageMimeType(h):void 0,x,v,w=IB(u?.model);if(f){let C=await i.readFile(h);if(n){let P=await Up(C,f);if(P){let _=Dp(P),F=`Read image file [${P.mimeType}]`;_&&(F+=`
|
|
261
261
|
${_}`),w&&(F+=`
|
|
262
262
|
${w}`),x=[{type:"text",text:F},{type:"image",data:P.data,mimeType:P.mimeType}]}else{let _=`Read image file [${f}]
|
|
263
263
|
[Image omitted: could not be resized below the inline image size limit.]`;w&&(_+=`
|
|
@@ -283,31 +283,31 @@ ${g.map(f=>l?f:n.fg("toolOutput",Ni(f))).join(`
|
|
|
283
283
|
`)}`,h>0&&(c+=`${n.fg("muted",`
|
|
284
284
|
... (${h} more lines, ${p} total,`)} ${re("app.tools.expand","to expand")}${n.fg("muted",")")}`)}return c}function GB(t,e){if(!t.isError)return;let n=t.content.filter(i=>i.type==="text").map(i=>i.text||"").join(`
|
|
285
285
|
`);if(n)return`
|
|
286
|
-
${e.fg("error",n)}`}function Np(t,e){let n=e?.operations??DB;return{name:"write",label:"write",description:"Write content to a file. Creates the file if it doesn't exist, overwrites if it does. Automatically creates parent directories.",promptSnippet:"Create or overwrite files",promptGuidelines:["Use write only for new files or complete rewrites."],parameters:UB,async execute(i,{path:s,content:r},o,a,c){let l=Wt(s,t),u=FB(l);return Pr(l,async()=>{let d=()=>{if(o?.aborted)throw new Error("Operation aborted")};return d(),await n.mkdir(u),d(),await n.writeFile(l,r),d(),{content:[{type:"text",text:`Successfully wrote ${r.length} bytes to ${s}`}],details:void 0}})},renderCall(i,s,r){let o=i,a=Xe(o?.file_path??o?.path),c=Xe(o?.content),l=r.lastComponent??new R0;return c!==null?l.cache=r.argsComplete?Bp(a,c):NB(l.cache,a,c):l.cache=void 0,l.setText(qB(o,{expanded:r.expanded,isPartial:r.isPartial},s,l.cache,r.cwd)),l},renderResult(i,s,r,o){let a=GB({...i,isError:o.isError},r);if(!a){let l=o.lastComponent??new H;return l.clear(),l}let c=o.lastComponent??new E("",0,0);return c.setText(a),c}}}function F0(t,e){return{read:$p(t,e?.read),bash:Mp(t,e?.bash),edit:Ip(t,e?.edit),write:Np(t,e?.write),grep:Ep(t,e?.grep),find:_p(t,e?.find),ls:Ap(t,e?.ls)}}function U0(t){let e=t.match(/^<skill name="([^"]+)" location="([^"]+)">\n([\s\S]*?)\n<\/skill>(?:\n\n([\s\S]+))?$/);return e?{name:e[1],location:e[2],content:e[3],userMessage:e[4]?.trim()||void 0}:null}import tye from"proper-lockfile";import{Type as T}from"typebox";import{Compile as tN}from"typebox/compile";var D0={anthropic:"Anthropic","amazon-bedrock":"Amazon Bedrock","ant-ling":"Ant Ling","azure-openai-responses":"Azure OpenAI Responses",cerebras:"Cerebras","cloudflare-ai-gateway":"Cloudflare AI Gateway","cloudflare-workers-ai":"Cloudflare Workers AI",deepseek:"DeepSeek",fireworks:"Fireworks",google:"Google Gemini","google-vertex":"Google Vertex AI",groq:"Groq",huggingface:"Hugging Face","kimi-coding":"Kimi For Coding",mistral:"Mistral",minimax:"MiniMax","minimax-cn":"MiniMax (China)",moonshotai:"Moonshot AI","moonshotai-cn":"Moonshot AI (China)",nvidia:"NVIDIA NIM",opencode:"OpenCode Zen","opencode-go":"OpenCode Go",openai:"OpenAI",openrouter:"OpenRouter",together:"Together AI","vercel-ai-gateway":"Vercel AI Gateway",xai:"xAI",zai:"ZAI","zai-coding-cn":"ZAI Coding Plan (China)",xiaomi:"Xiaomi MiMo","xiaomi-token-plan-cn":"Xiaomi MiMo Token Plan (China)","xiaomi-token-plan-ams":"Xiaomi MiMo Token Plan (Amsterdam)","xiaomi-token-plan-sgp":"Xiaomi MiMo Token Plan (Singapore)"};var BM=T.Object({p50:T.Optional(T.Number()),p75:T.Optional(T.Number()),p90:T.Optional(T.Number()),p99:T.Optional(T.Number())}),nN=T.Object({allow_fallbacks:T.Optional(T.Boolean()),require_parameters:T.Optional(T.Boolean()),data_collection:T.Optional(T.Union([T.Literal("deny"),T.Literal("allow")])),zdr:T.Optional(T.Boolean()),enforce_distillable_text:T.Optional(T.Boolean()),order:T.Optional(T.Array(T.String())),only:T.Optional(T.Array(T.String())),ignore:T.Optional(T.Array(T.String())),quantizations:T.Optional(T.Array(T.String())),sort:T.Optional(T.Union([T.String(),T.Object({by:T.Optional(T.String()),partition:T.Optional(T.Union([T.String(),T.Null()]))})])),max_price:T.Optional(T.Object({prompt:T.Optional(T.Union([T.Number(),T.String()])),completion:T.Optional(T.Union([T.Number(),T.String()])),image:T.Optional(T.Union([T.Number(),T.String()])),audio:T.Optional(T.Union([T.Number(),T.String()])),request:T.Optional(T.Union([T.Number(),T.String()]))})),preferred_min_throughput:T.Optional(T.Union([T.Number(),BM])),preferred_max_latency:T.Optional(T.Union([T.Number(),BM]))}),iN=T.Object({only:T.Optional(T.Array(T.String())),order:T.Optional(T.Array(T.String()))}),qa=T.Union([T.String(),T.Null()]),NM=T.Object({off:T.Optional(qa),minimal:T.Optional(qa),low:T.Optional(qa),medium:T.Optional(qa),high:T.Optional(qa),xhigh:T.Optional(qa)}),sN=T.Object({supportsStore:T.Optional(T.Boolean()),supportsDeveloperRole:T.Optional(T.Boolean()),supportsReasoningEffort:T.Optional(T.Boolean()),supportsUsageInStreaming:T.Optional(T.Boolean()),maxTokensField:T.Optional(T.Union([T.Literal("max_completion_tokens"),T.Literal("max_tokens")])),requiresToolResultName:T.Optional(T.Boolean()),requiresAssistantAfterToolResult:T.Optional(T.Boolean()),requiresThinkingAsText:T.Optional(T.Boolean()),requiresReasoningContentOnAssistantMessages:T.Optional(T.Boolean()),thinkingFormat:T.Optional(T.Union([T.Literal("openai"),T.Literal("openrouter"),T.Literal("together"),T.Literal("deepseek"),T.Literal("zai"),T.Literal("qwen"),T.Literal("qwen-chat-template")])),cacheControlFormat:T.Optional(T.Literal("anthropic")),openRouterRouting:T.Optional(nN),vercelGatewayRouting:T.Optional(iN),supportsStrictMode:T.Optional(T.Boolean()),supportsLongCacheRetention:T.Optional(T.Boolean())}),rN=T.Object({supportsDeveloperRole:T.Optional(T.Boolean()),sendSessionIdHeader:T.Optional(T.Boolean()),supportsLongCacheRetention:T.Optional(T.Boolean())}),oN=T.Object({supportsEagerToolInputStreaming:T.Optional(T.Boolean()),supportsLongCacheRetention:T.Optional(T.Boolean()),sendSessionAffinityHeaders:T.Optional(T.Boolean()),supportsCacheControlOnTools:T.Optional(T.Boolean()),forceAdaptiveThinking:T.Optional(T.Boolean())}),$0=T.Union([sN,rN,oN]),aN=T.Object({id:T.String({minLength:1}),name:T.Optional(T.String({minLength:1})),api:T.Optional(T.String({minLength:1})),baseUrl:T.Optional(T.String({minLength:1})),reasoning:T.Optional(T.Boolean()),thinkingLevelMap:T.Optional(NM),input:T.Optional(T.Array(T.Union([T.Literal("text"),T.Literal("image")]))),cost:T.Optional(T.Object({input:T.Number(),output:T.Number(),cacheRead:T.Number(),cacheWrite:T.Number()})),contextWindow:T.Optional(T.Number()),maxTokens:T.Optional(T.Number()),headers:T.Optional(T.Record(T.String(),T.String())),compat:T.Optional($0)}),cN=T.Object({name:T.Optional(T.String({minLength:1})),reasoning:T.Optional(T.Boolean()),thinkingLevelMap:T.Optional(NM),input:T.Optional(T.Array(T.Union([T.Literal("text"),T.Literal("image")]))),cost:T.Optional(T.Object({input:T.Optional(T.Number()),output:T.Optional(T.Number()),cacheRead:T.Optional(T.Number()),cacheWrite:T.Optional(T.Number())})),contextWindow:T.Optional(T.Number()),maxTokens:T.Optional(T.Number()),headers:T.Optional(T.Record(T.String(),T.String())),compat:T.Optional($0)}),lN=T.Object({name:T.Optional(T.String({minLength:1})),baseUrl:T.Optional(T.String({minLength:1})),apiKey:T.Optional(T.String({minLength:1})),api:T.Optional(T.String({minLength:1})),headers:T.Optional(T.Record(T.String(),T.String())),compat:T.Optional($0),authHeader:T.Optional(T.Boolean()),models:T.Optional(T.Array(aN)),modelOverrides:T.Optional(T.Record(T.String(),cN))}),uN=T.Object({providers:T.Record(T.String(),lN)}),Rye=tN(uN);import{createHash as hN}from"node:crypto";import{chmodSync as gN,existsSync as ve,mkdirSync as Hp,readdirSync as Ka,readFileSync as Dl,rmSync as HM,statSync as Es,writeFileSync as zM}from"node:fs";import{homedir as fN}from"node:os";import{basename as zp,dirname as Fn,join as be,relative as Un,resolve as mi,sep as ZM}from"node:path";import{globSync as bN}from"glob";import $l from"ignore";import{minimatch as Ga}from"minimatch";import{maxSatisfying as xN,rcompare as vN,satisfies as yN,valid as wN,validRange as SN}from"semver";import jM from"hosted-git-info";function GM(t){let e=t.match(/^git@([^:]+):(.+)$/);if(e){let c=e[2]??"",l=c.indexOf("@");if(l<0)return{repo:t};let u=c.slice(0,l),d=c.slice(l+1);return!u||!d?{repo:t}:{repo:`git@${e[1]??""}:${u}`,ref:d}}if(t.includes("://"))try{let c=new URL(t),l=c.pathname.replace(/^\/+/,""),u=l.indexOf("@");if(u<0)return{repo:t};let d=l.slice(0,u),p=l.slice(u+1);return!d||!p?{repo:t}:(c.pathname=`/${d}`,{repo:c.toString().replace(/\/$/,""),ref:p})}catch{return{repo:t}}let n=t.indexOf("/");if(n<0)return{repo:t};let i=t.slice(0,n),s=t.slice(n+1),r=s.indexOf("@");if(r<0)return{repo:t};let o=s.slice(0,r),a=s.slice(r+1);return!o||!a?{repo:t}:{repo:`${i}/${o}`,ref:a}}function dN(t){try{return decodeURIComponent(t)}catch{return null}}function qM(t,e){let n=dN(t);if(n===null)return!0;let i=[t,n];for(let s of i)if(s.includes("\0")||s.includes("\\")||s.startsWith("/")||!e&&s.includes("/")||s.split("/").includes(".."))return!0;return!1}function B0(t){if(t.path.startsWith("/"))return null;let e=t.path.replace(/\.git$/,"").replace(/^\/+/,"");return!t.host||!e||e.split("/").length<2||qM(t.host,!1)||qM(e,!0)?null:{type:"git",repo:t.repo,host:t.host,path:e,ref:t.ref,pinned:!!t.ref}}function pN(t){let{repo:e,ref:n}=GM(t),i=e,s="",r="",o=e.match(/^git@([^:]+):(.+)$/);if(o)s=o[1]??"",r=o[2]??"";else if(e.startsWith("https://")||e.startsWith("http://")||e.startsWith("ssh://")||e.startsWith("git://"))try{let a=new URL(e);s=a.hostname,r=a.pathname.replace(/^\/+/,"")}catch{return null}else{let a=e.indexOf("/");if(a<0||(s=e.slice(0,a),r=e.slice(a+1),!s.includes(".")&&s!=="localhost"))return null;i=`https://${e}`}return B0({repo:i,host:s,path:r,ref:n})}function Ul(t){let e=t.trim(),n=e.startsWith("git:"),i=n?e.slice(4).trim():e;if(!n&&!/^(https?|ssh|git):\/\//i.test(i))return null;let s=GM(i),r=[s.ref?`${s.repo}#${s.ref}`:void 0,i].filter(a=>!!a);for(let a of r){let c=jM.fromUrl(a);if(c){if(s.ref&&c.project?.includes("@"))continue;let l=!s.repo.startsWith("http://")&&!s.repo.startsWith("https://")&&!s.repo.startsWith("ssh://")&&!s.repo.startsWith("git://")&&!s.repo.startsWith("git@");return B0({repo:l?`https://${s.repo}`:s.repo,host:c.domain||"",path:`${c.user}/${c.project}`,ref:c.committish||s.ref||void 0})}}let o=[s.ref?`https://${s.repo}#${s.ref}`:void 0,`https://${i}`].filter(a=>!!a);for(let a of o){let c=jM.fromUrl(a);if(c){if(s.ref&&c.project?.includes("@"))continue;return B0({repo:`https://${s.repo}`,host:c.domain||"",path:`${c.user}/${c.project}`,ref:c.committish||s.ref||void 0})}}return pN(i)}var mN;var Eye=Promise.resolve();function KM(){return mN!==void 0}function N0(){if(process.platform!=="linux"||Object.keys(process.env).length>0)return process.env;try{let t=Dl("/proc/self/environ","utf-8"),e={};for(let n of t.split("\0")){let i=n.indexOf("=");i>0&&(e[n.slice(0,i)]=n.slice(i+1))}return e}catch{return process.env}}var pi=1e4,VM=4,TN=4;function Er(){let t=process.env.PI_OFFLINE;return t?t==="1"||t.toLowerCase()==="true"||t.toLowerCase()==="yes":!1}function CN(t){return wN(t??"")!==null}function kN(t){return t?SN(t)??void 0:void 0}function JM(t){return t.origin==="package"?4:(t.scope==="project"?0:2)+(t.source==="local"?0:1)}var jp=["extensions","skills","prompts","themes"],MN={extensions:/\.(ts|js)$/,skills:/\.md$/,prompts:/\.md$/,themes:/\.json$/},RN=[".gitignore",".ignore",".fdignore"];function Rt(t){return t.split(ZM).join("/")}function j0(){return process.env.HOME||fN()}function IN(t){let e=be(t,"tmp","extensions");return Hp(e,{recursive:!0,mode:448}),gN(e,448),e}function PN(t,e){let n=t.trim();if(!n||n.startsWith("#")&&!n.startsWith("\\#"))return null;let i=t,s=!1;i.startsWith("!")?(s=!0,i=i.slice(1)):i.startsWith("\\!")&&(i=i.slice(1)),i.startsWith("/")&&(i=i.slice(1));let r=e?`${e}${i}`:i;return s?`!${r}`:r}function Bl(t,e,n){let i=Un(n,e),s=i?`${Rt(i)}/`:"";for(let r of RN){let o=be(e,r);if(ve(o))try{let c=Dl(o,"utf-8").split(/\r?\n/).map(l=>PN(l,s)).filter(l=>!!l);c.length>0&&t.add(c)}catch{}}}function _N(t){return t.startsWith("!")||t.startsWith("+")||t.startsWith("-")||t.includes("*")||t.includes("?")}function q0(t){return t.startsWith("!")||t.startsWith("+")||t.startsWith("-")}function EN(t){return t.includes("*")||t.includes("?")}function AN(t){let e=[],n=[];for(let i of t)_N(i)?n.push(i):e.push(i);return{plain:e,patterns:n}}function e1(t,e,n=!0,i,s){let r=[];if(!ve(t))return r;let o=s??t,a=i??$l();Bl(a,t,o);try{let c=Ka(t,{withFileTypes:!0});for(let l of c){if(l.name.startsWith(".")||n&&l.name==="node_modules")continue;let u=be(t,l.name),d=l.isDirectory(),p=l.isFile();if(l.isSymbolicLink())try{let h=Es(u);d=h.isDirectory(),p=h.isFile()}catch{continue}let m=Rt(Un(o,u)),g=d?`${m}/`:m;a.ignores(g)||(d?r.push(...e1(u,e,n,a,o)):p&&e.test(l.name)&&r.push(u))}}catch{}return r}function H0(t,e,n,i){let s=[];if(!ve(t))return s;let r=i??t,o=n??$l();Bl(o,t,r);try{let a=Ka(t,{withFileTypes:!0});for(let c of a){if(c.name!=="SKILL.md")continue;let l=be(t,c.name),u=c.isFile();if(c.isSymbolicLink())try{u=Es(l).isFile()}catch{continue}let d=Rt(Un(r,l));if(u&&!o.ignores(d))return s.push(l),s}for(let c of a){if(c.name.startsWith(".")||c.name==="node_modules")continue;let l=be(t,c.name),u=c.isDirectory(),d=c.isFile();if(c.isSymbolicLink())try{let m=Es(l);u=m.isDirectory(),d=m.isFile()}catch{continue}let p=Rt(Un(r,l));if(e==="pi"&&t===r&&d&&c.name.endsWith(".md")&&!o.ignores(p)){s.push(l);continue}u&&(o.ignores(`${p}/`)||s.push(...H0(l,e,o,r)))}}catch{}return s}function qp(t,e){return H0(t,e)}function ON(t){let e=mi(t);for(;;){if(ve(be(e,".git")))return e;let n=Fn(e);if(n===e)return null;e=n}}function LN(t){let e=[],n=mi(t),i=ON(n),s=n;for(;e.push(be(s,".agents","skills")),!(i&&s===i);){let r=Fn(s);if(r===s)break;s=r}return e}function QM(t){let e=[];if(!ve(t))return e;let n=$l();Bl(n,t,t);try{let i=Ka(t,{withFileTypes:!0});for(let s of i){if(s.name.startsWith(".")||s.name==="node_modules")continue;let r=be(t,s.name),o=s.isFile();if(s.isSymbolicLink())try{o=Es(r).isFile()}catch{continue}let a=Rt(Un(t,r));n.ignores(a)||o&&s.name.endsWith(".md")&&e.push(r)}}catch{}return e}function YM(t){let e=[];if(!ve(t))return e;let n=$l();Bl(n,t,t);try{let i=Ka(t,{withFileTypes:!0});for(let s of i){if(s.name.startsWith(".")||s.name==="node_modules")continue;let r=be(t,s.name),o=s.isFile();if(s.isSymbolicLink())try{o=Es(r).isFile()}catch{continue}let a=Rt(Un(t,r));n.ignores(a)||o&&s.name.endsWith(".json")&&e.push(r)}}catch{}return e}function WN(t){try{let e=Dl(t,"utf-8");return JSON.parse(e).pi??null}catch{return null}}function XM(t){let e=be(t,"package.json");if(ve(e)){let s=WN(e);if(s?.extensions?.length){let r=[];for(let o of s.extensions){let a=mi(t,o);ve(a)&&r.push(a)}if(r.length>0)return r}}let n=be(t,"index.ts"),i=be(t,"index.js");return ve(n)?[n]:ve(i)?[i]:null}function G0(t){let e=[];if(!ve(t))return e;let n=XM(t);if(n)return n;let i=$l();Bl(i,t,t);try{let s=Ka(t,{withFileTypes:!0});for(let r of s){if(r.name.startsWith(".")||r.name==="node_modules")continue;let o=be(t,r.name),a=r.isDirectory(),c=r.isFile();if(r.isSymbolicLink())try{let d=Es(o);a=d.isDirectory(),c=d.isFile()}catch{continue}let l=Rt(Un(t,o)),u=a?`${l}/`:l;if(!i.ignores(u)){if(c&&(r.name.endsWith(".ts")||r.name.endsWith(".js")))e.push(o);else if(a){let d=XM(o);d&&e.push(...d)}}}}catch{}return e}function Gp(t,e){return e==="skills"?H0(t,"pi"):e==="extensions"?G0(t):e1(t,MN[e])}function K0(t,e,n){let i=Rt(Un(n,t)),s=zp(t),r=Rt(t),o=s==="SKILL.md",a=o?Fn(t):void 0,c=o?Rt(Un(n,a)):void 0,l=o?zp(a):void 0,u=o?Rt(a):void 0;return e.some(d=>{let p=Rt(d);return Ga(i,p)||Ga(s,p)||Ga(r,p)?!0:o?Ga(c,p)||Ga(l,p)||Ga(u,p):!1})}function FN(t){let e=t.startsWith("./")||t.startsWith(".\\")?t.slice(2):t;return Rt(e)}function Vp(t,e,n){if(e.length===0)return!1;let i=Rt(Un(n,t)),s=zp(t),r=Rt(t),o=s==="SKILL.md",a=o?Fn(t):void 0,c=o?Rt(Un(n,a)):void 0,l=o?Rt(a):void 0;return e.some(u=>{let d=FN(u);return d===i||d===r?!0:o?d===c||d===l:!1})}function UN(t){return t.filter(e=>e.startsWith("!")||e.startsWith("+")||e.startsWith("-"))}function DN(t,e,n){let i=UN(e),s=i.filter(c=>c.startsWith("!")).map(c=>c.slice(1)),r=i.filter(c=>c.startsWith("+")).map(c=>c.slice(1)),o=i.filter(c=>c.startsWith("-")).map(c=>c.slice(1)),a=!0;return s.length>0&&K0(t,s,n)&&(a=!1),r.length>0&&Vp(t,r,n)&&(a=!0),o.length>0&&Vp(t,o,n)&&(a=!1),a}function Kp(t,e,n){let i=[],s=[],r=[],o=[];for(let c of e)c.startsWith("+")?r.push(c.slice(1)):c.startsWith("-")?o.push(c.slice(1)):c.startsWith("!")?s.push(c.slice(1)):i.push(c);let a;if(i.length===0?a=[...t]:a=t.filter(c=>K0(c,i,n)),s.length>0&&(a=a.filter(c=>!K0(c,s,n))),r.length>0)for(let c of t)!a.includes(c)&&Vp(c,r,n)&&a.push(c);return o.length>0&&(a=a.filter(c=>!Vp(c,o,n))),new Set(a)}var Gi=class{constructor(e){this.cwd=xe(e.cwd),this.agentDir=xe(e.agentDir),this.settingsManager=e.settingsManager}setProgressCallback(e){this.progressCallback=e}addSourceToSettings(e,n){let i=n?.local?"project":"user",r=(i==="project"?this.settingsManager.getProjectSettings():this.settingsManager.getGlobalSettings()).packages??[],o=this.normalizePackageSourceForSettings(e,i),a=r.findIndex(l=>this.packageSourcesMatch(l,e,i));if(a!==-1){let l=r[a];if(this.getPackageSourceString(l)===o)return!1;let u=[...r];return u[a]=typeof l=="string"?o:{...l,source:o},i==="project"?this.settingsManager.setProjectPackages(u):this.settingsManager.setPackages(u),!0}let c=[...r,o];return i==="project"?this.settingsManager.setProjectPackages(c):this.settingsManager.setPackages(c),!0}removeSourceFromSettings(e,n){let i=n?.local?"project":"user",r=(i==="project"?this.settingsManager.getProjectSettings():this.settingsManager.getGlobalSettings()).packages??[],o=r.filter(c=>!this.packageSourcesMatch(c,e,i));return o.length!==r.length?(i==="project"?this.settingsManager.setProjectPackages(o):this.settingsManager.setPackages(o),!0):!1}getInstalledPath(e,n){let i=this.parseSource(e);if(i.type==="npm"){let s=this.getNpmInstallPath(i,n);return ve(s)?s:void 0}if(i.type==="git"){let s=this.getGitInstallPath(i,n);return ve(s)?s:void 0}if(i.type==="local"){let s=this.getBaseDirForScope(n),r=this.resolvePathFromBase(i.path,s);return ve(r)?r:void 0}}emitProgress(e){this.progressCallback?.(e)}async withProgress(e,n,i,s){this.emitProgress({type:"start",action:e,source:n,message:i});try{await s(),this.emitProgress({type:"complete",action:e,source:n})}catch(r){let o=r instanceof Error?r.message:String(r);throw this.emitProgress({type:"error",action:e,source:n,message:o}),r}}async resolve(e){let n=this.createAccumulator(),i=this.settingsManager.getGlobalSettings(),s=this.settingsManager.getProjectSettings(),r=[];for(let l of s.packages??[])r.push({pkg:l,scope:"project"});for(let l of i.packages??[])r.push({pkg:l,scope:"user"});let o=this.dedupePackages(r);await this.resolvePackageSources(o,n,e);let a=this.agentDir,c=be(this.cwd,mt);for(let l of jp){let u=this.getTargetMap(n,l),d=i[l]??[],p=s[l]??[];this.resolveLocalEntries(p,l,u,{source:"local",scope:"project",origin:"top-level"},c),this.resolveLocalEntries(d,l,u,{source:"local",scope:"user",origin:"top-level"},a)}return this.addAutoDiscoveredResources(n,i,s,a,c),this.toResolvedPaths(n)}async resolveExtensionSources(e,n){let i=this.createAccumulator(),s=n?.temporary?"temporary":n?.local?"project":"user",r=e.map(o=>({pkg:o,scope:s}));return await this.resolvePackageSources(r,i),this.toResolvedPaths(i)}listConfiguredPackages(){let e=this.settingsManager.getGlobalSettings(),n=this.settingsManager.getProjectSettings(),i=[];for(let s of e.packages??[]){let r=typeof s=="string"?s:s.source;i.push({source:r,scope:"user",filtered:typeof s=="object",installedPath:this.getInstalledPath(r,"user")})}for(let s of n.packages??[]){let r=typeof s=="string"?s:s.source;i.push({source:r,scope:"project",filtered:typeof s=="object",installedPath:this.getInstalledPath(r,"project")})}return i}async install(e,n){let i=this.parseSource(e),s=n?.local?"project":"user";this.assertProjectTrustedForScope(s),await this.withProgress("install",e,`Installing ${e}...`,async()=>{if(i.type==="npm"){await this.installNpm(i,s,!1);return}if(i.type==="git"){await this.installGit(i,s);return}if(i.type==="local"){let r=this.resolvePath(i.path);if(!ve(r))throw new Error(`Path does not exist: ${r}`);return}throw new Error(`Unsupported install source: ${e}`)})}async installAndPersist(e,n){await this.install(e,n),this.addSourceToSettings(e,n)}async remove(e,n){let i=this.parseSource(e),s=n?.local?"project":"user";this.assertProjectTrustedForScope(s),await this.withProgress("remove",e,`Removing ${e}...`,async()=>{if(i.type==="npm"){await this.uninstallNpm(i,s);return}if(i.type==="git"){await this.removeGit(i,s);return}if(i.type!=="local")throw new Error(`Unsupported remove source: ${e}`)})}async removeAndPersist(e,n){return await this.remove(e,n),this.removeSourceFromSettings(e,n)}async update(e){let n=this.settingsManager.getGlobalSettings(),i=this.settingsManager.getProjectSettings(),s=e?this.getPackageIdentity(e):void 0,r=!1,o=[];for(let a of n.packages??[]){let c=typeof a=="string"?a:a.source;s&&this.getPackageIdentity(c,"user")!==s||(r=!0,o.push({source:c,scope:"user"}))}for(let a of i.packages??[]){let c=typeof a=="string"?a:a.source;s&&this.getPackageIdentity(c,"project")!==s||(r=!0,o.push({source:c,scope:"project"}))}if(e&&!r)throw new Error(this.buildNoMatchingPackageMessage(e,[...n.packages??[],...i.packages??[]]));await this.updateConfiguredSources(o)}async updateConfiguredSources(e){if(Er()||e.length===0)return;let n=[],i=[];for(let l of e){let u=this.parseSource(l.source);u.type==="npm"?u.pinned||n.push({...l,parsed:u}):u.type==="git"&&i.push({...l,parsed:u})}let s=n.map(l=>async()=>({entry:l,shouldUpdate:await this.shouldUpdateNpmSource(l.parsed,l.scope)})),r=await this.runWithConcurrency(s,VM),o=[],a=[];for(let l of r)l.shouldUpdate&&(l.entry.scope==="user"?o.push(l.entry):a.push(l.entry));let c=[];if(o.length>0&&c.push(this.updateNpmBatch(o,"user")),a.length>0&&c.push(this.updateNpmBatch(a,"project")),i.length>0){let l=i.map(u=>async()=>this.withProgress("update",u.source,`Updating ${u.source}...`,async()=>{await this.updateGit(u.parsed,u.scope)}));c.push(this.runWithConcurrency(l,TN).then(()=>{}))}await Promise.all(c)}async shouldUpdateNpmSource(e,n){let i=this.getManagedNpmInstallPath(e,n),s=ve(i)?this.getInstalledNpmVersion(i):void 0;if(!s)return!0;try{return await this.getLatestNpmVersion(e.version?e.spec:e.name,e.range)!==s}catch{return!0}}async updateNpmBatch(e,n){if(e.length===0)return;let i=e.length===1?e[0].source:`${n} npm packages`,s=e.length===1?`Updating ${e[0].source}...`:`Updating ${n} npm packages...`,r=e.map(o=>o.parsed.version?o.parsed.spec:`${o.parsed.name}@latest`);await this.withProgress("update",i,s,async()=>{await this.installNpmBatch(r,n)})}async installNpmBatch(e,n){let i=this.getNpmInstallRoot(n,!1);this.ensureNpmProject(i),await this.runNpmCommand(this.getNpmInstallArgs(e,i))}async checkForAvailableUpdates(){if(Er())return[];let e=this.settingsManager.getGlobalSettings(),n=this.settingsManager.getProjectSettings(),i=[];for(let a of n.packages??[])i.push({pkg:a,scope:"project"});for(let a of e.packages??[])i.push({pkg:a,scope:"user"});let r=this.dedupePackages(i).filter(a=>a.scope!=="temporary").map(a=>async()=>{let c=typeof a.pkg=="string"?a.pkg:a.pkg.source,l=this.parseSource(c);if(l.type==="local"||l.pinned)return;if(l.type==="npm"){let p=this.getNpmInstallPath(l,a.scope);return!ve(p)||!await this.npmHasAvailableUpdate(l,p)?void 0:{source:c,displayName:l.name,type:"npm",scope:a.scope}}let u=this.getGitInstallPath(l,a.scope);if(!(!ve(u)||!await this.gitHasAvailableUpdate(u)))return{source:c,displayName:`${l.host}/${l.path}`,type:"git",scope:a.scope}});return(await this.runWithConcurrency(r,VM)).filter(a=>a!==void 0)}async resolvePackageSources(e,n,i){for(let{pkg:s,scope:r}of e){let o=typeof s=="string"?s:s.source,a=typeof s=="object"?s:void 0,c=this.parseSource(o),l={source:o,scope:r,origin:"package"};if(c.type==="local"){let d=this.getBaseDirForScope(r);this.resolveLocalExtensionSource(c,n,a,l,d);continue}let u=async()=>{if(Er())return!1;if(!i)return await this.installParsedSource(c,r),!0;let d=await i(o);if(d==="skip")return!1;if(d==="error")throw new Error(`Missing source: ${o}`);return await this.installParsedSource(c,r),!0};if(c.type==="npm"){let d=this.getNpmInstallPath(c,r);if(!ve(d)||!await this.installedNpmMatchesConfiguredVersion(c,d)){if(!await u())continue;d=this.getNpmInstallPath(c,r)}l.baseDir=d,this.collectPackageResources(d,n,a,l);continue}if(c.type==="git"){let d=this.getGitInstallPath(c,r);if(ve(d))r==="temporary"&&!c.pinned&&!Er()&&await this.refreshTemporaryGitSource(c,o);else if(!await u())continue;l.baseDir=d,this.collectPackageResources(d,n,a,l)}}}resolveLocalExtensionSource(e,n,i,s,r){let o=this.resolvePathFromBase(e.path,r);if(ve(o))try{let a=Es(o);if(a.isFile()){s.baseDir=Fn(o),this.addResource(n.extensions,o,s,!0);return}a.isDirectory()&&(s.baseDir=o,this.collectPackageResources(o,n,i,s)||this.addResource(n.extensions,o,s,!0))}catch{return}}async installParsedSource(e,n){if(e.type==="npm"){await this.installNpm(e,n,n==="temporary");return}if(e.type==="git"){await this.installGit(e,n);return}}getPackageSourceString(e){return typeof e=="string"?e:e.source}getSourceMatchKeyForInput(e){let n=this.parseSource(e);return n.type==="npm"?`npm:${n.name}`:n.type==="git"?`git:${n.host}/${n.path}`:`local:${this.resolvePath(n.path)}`}getSourceMatchKeyForSettings(e,n){let i=this.parseSource(e);if(i.type==="npm")return`npm:${i.name}`;if(i.type==="git")return`git:${i.host}/${i.path}`;let s=this.getBaseDirForScope(n);return`local:${this.resolvePathFromBase(i.path,s)}`}buildNoMatchingPackageMessage(e,n){let i=this.findSuggestedConfiguredSource(e,n);return i?`No matching package found for ${e}. Did you mean ${i}?`:`No matching package found for ${e}`}findSuggestedConfiguredSource(e,n){let i=e.trim(),s=new Set;for(let r of n){let o=this.getPackageSourceString(r),a=this.parseSource(o);if(a.type==="npm"){(i===a.name||i===a.spec)&&s.add(o);continue}if(a.type==="git"){let c=`${a.host}/${a.path}`,l=a.ref?`${c}@${a.ref}`:void 0;(i===c||l&&i===l)&&s.add(o)}}return s.values().next().value}packageSourcesMatch(e,n,i){let s=this.getSourceMatchKeyForSettings(this.getPackageSourceString(e),i),r=this.getSourceMatchKeyForInput(n);return s===r}normalizePackageSourceForSettings(e,n){let i=this.parseSource(e);if(i.type!=="local")return e;let s=this.getBaseDirForScope(n),r=this.resolvePath(i.path);return Un(s,r)||"."}parseSource(e){if(e.startsWith("npm:")){let i=e.slice(4).trim(),{name:s,version:r}=this.parseNpmSpec(i);return{type:"npm",spec:i,name:s,version:r,range:kN(r),pinned:CN(r)}}if(cd(e))return{type:"local",path:e};let n=Ul(e);return n||{type:"local",path:e}}async installedNpmMatchesConfiguredVersion(e,n){let i=this.getInstalledNpmVersion(n);return i?e.range?yN(i,e.range):!0:!1}async npmHasAvailableUpdate(e,n){if(Er())return!1;let i=this.getInstalledNpmVersion(n);if(!i)return!1;try{return await this.getLatestNpmVersion(e.version?e.spec:e.name,e.range)!==i}catch{return!1}}getInstalledNpmVersion(e){let n=be(e,"package.json");if(ve(n))try{let i=Dl(n,"utf-8");return JSON.parse(i).version}catch{return}}async getLatestNpmVersion(e,n){let i=this.getNpmCommand(),r=(await this.runCommandCapture(i.command,[...i.args,"view",e,"version","--json"],{cwd:this.cwd,timeoutMs:pi})).trim();if(!r)throw new Error("Empty response from npm view");let o=JSON.parse(r);if(typeof o=="string")return o;if(Array.isArray(o)){let a=o.filter(l=>typeof l=="string"&&l.length>0),c=n?xN(a,n):[...a].sort(vN)[0];if(c)return c}throw new Error("Unexpected response from npm view")}async gitHasAvailableUpdate(e){if(Er())return!1;try{let n=await this.runCommandCapture("git",["rev-parse","HEAD"],{cwd:e,timeoutMs:pi}),i=await this.getRemoteGitHead(e);return n.trim()!==i.trim()}catch{return!1}}async getRemoteGitHead(e){let n=await this.getGitUpstreamRef(e);if(n){let o=(await this.runGitRemoteCommand(e,["ls-remote","origin",n])).match(/^([0-9a-f]{40})\s+/m);if(o?.[1])return o[1]}let s=(await this.runGitRemoteCommand(e,["ls-remote","origin","HEAD"])).match(/^([0-9a-f]{40})\s+HEAD$/m);if(!s?.[1])throw new Error("Failed to determine remote HEAD");return s[1]}async getLocalGitUpdateTarget(e){try{let i=(await this.runCommandCapture("git",["rev-parse","--abbrev-ref","@{upstream}"],{cwd:e,timeoutMs:pi})).trim();if(!i.startsWith("origin/"))throw new Error(`Unsupported upstream remote: ${i}`);let s=i.slice(7);if(!s)throw new Error("Missing upstream branch name");return{ref:"@{upstream}",head:await this.runCommandCapture("git",["rev-parse","@{upstream}"],{cwd:e,timeoutMs:pi}),fetchArgs:["fetch","--prune","--no-tags","origin",`+refs/heads/${s}:refs/remotes/origin/${s}`]}}catch{await this.runCommand("git",["remote","set-head","origin","-a"],{cwd:e}).catch(()=>{});let n=await this.runCommandCapture("git",["rev-parse","origin/HEAD"],{cwd:e,timeoutMs:pi}),s=(await this.runCommandCapture("git",["symbolic-ref","refs/remotes/origin/HEAD"],{cwd:e,timeoutMs:pi}).catch(()=>"")).trim().replace(/^refs\/remotes\/origin\//,"");return s?{ref:"origin/HEAD",head:n,fetchArgs:["fetch","--prune","--no-tags","origin",`+refs/heads/${s}:refs/remotes/origin/${s}`]}:{ref:"origin/HEAD",head:n,fetchArgs:["fetch","--prune","--no-tags","origin","+HEAD:refs/remotes/origin/HEAD"]}}}async getGitUpstreamRef(e){try{let i=(await this.runCommandCapture("git",["rev-parse","--abbrev-ref","@{upstream}"],{cwd:e,timeoutMs:pi})).trim();if(!i.startsWith("origin/"))return;let s=i.slice(7);return s?`refs/heads/${s}`:void 0}catch{return}}runGitRemoteCommand(e,n){return this.runCommandCapture("git",n,{cwd:e,timeoutMs:pi,env:{GIT_TERMINAL_PROMPT:"0"}})}async runWithConcurrency(e,n){if(e.length===0)return[];let i=new Array(e.length),s=0,r=Math.max(1,Math.min(n,e.length)),o=async()=>{for(;;){let a=s;if(s+=1,a>=e.length)return;i[a]=await e[a]()}};return await Promise.all(Array.from({length:r},()=>o())),i}getPackageIdentity(e,n){let i=this.parseSource(e);if(i.type==="npm")return`npm:${i.name}`;if(i.type==="git")return`git:${i.host}/${i.path}`;if(n){let s=this.getBaseDirForScope(n);return`local:${this.resolvePathFromBase(i.path,s)}`}return`local:${this.resolvePath(i.path)}`}dedupePackages(e){let n=new Map;for(let i of e){let s=typeof i.pkg=="string"?i.pkg:i.pkg.source,r=this.getPackageIdentity(s,i.scope),o=n.get(r);o?i.scope==="project"&&o.scope==="user"&&n.set(r,i):n.set(r,i)}return Array.from(n.values())}parseNpmSpec(e){let n=e.match(/^(@?[^@]+(?:\/[^@]+)?)(?:@(.+))?$/);if(!n)return{name:e};let i=n[1]??e,s=n[2];return{name:i,version:s}}assertProjectTrustedForScope(e){if(e==="project"&&!this.settingsManager.isProjectTrusted())throw new Error("Project is not trusted; refusing to access project package storage")}getNpmCommand(){let e=this.settingsManager.getNpmCommand();if(!e||e.length===0)return{command:"npm",args:[]};let[n,...i]=e;if(!n)throw new Error("Invalid npmCommand: first array entry must be a non-empty command");return{command:n,args:i}}getPackageManagerName(){let e=this.getNpmCommand(),n=[e.command,...e.args],i=n.lastIndexOf("--"),s=i>=0?n[i+1]:e.command;return s?zp(s).replace(/\.(cmd|exe)$/i,""):""}async runNpmCommand(e,n){let i=this.getNpmCommand();await this.runCommand(i.command,[...i.args,...e],n)}getGitDependencyInstallArgs(){let e=this.settingsManager.getNpmCommand();return e&&e.length>0?["install"]:["install","--omit=dev"]}runNpmCommandSync(e){let n=this.getNpmCommand();return this.runCommandSync(n.command,[...n.args,...e])}getNpmInstallArgs(e,n){let i=this.getPackageManagerName();return i==="bun"?["install",...e,"--cwd",n,"--omit=peer"]:i==="pnpm"?["install",...e,"--prefix",n,"--config.auto-install-peers=false","--config.strict-peer-dependencies=false","--config.strict-dep-builds=false"]:["install",...e,"--prefix",n,"--legacy-peer-deps"]}async installNpm(e,n,i){let s=this.getNpmInstallRoot(n,i);this.ensureNpmProject(s),await this.runNpmCommand(this.getNpmInstallArgs([e.spec],s))}async uninstallNpm(e,n){let i=this.getNpmInstallRoot(n,!1);if(ve(i)){if(this.getPackageManagerName()==="bun"){await this.runNpmCommand(["uninstall",e.name,"--cwd",i]);return}await this.runNpmCommand(["uninstall",e.name,"--prefix",i])}}async installGit(e,n){let i=this.getGitInstallPath(e,n);if(ve(i)){if(e.ref){await this.ensureGitRef(i,["fetch","origin",e.ref],"FETCH_HEAD");return}let o=await this.getLocalGitUpdateTarget(i);await this.ensureGitRef(i,o.fetchArgs,o.ref);return}let s=this.getGitInstallRoot(n);s&&this.ensureGitIgnore(s),Hp(Fn(i),{recursive:!0}),await this.runCommand("git",["clone",e.repo,i]),e.ref&&await this.runCommand("git",["checkout",e.ref],{cwd:i});let r=be(i,"package.json");ve(r)&&await this.runNpmCommand(this.getGitDependencyInstallArgs(),{cwd:i})}async updateGit(e,n){let i=this.getGitInstallPath(e,n);if(!ve(i)){await this.installGit(e,n);return}if(e.ref){await this.ensureGitRef(i,["fetch","origin",e.ref],"FETCH_HEAD");return}let s=await this.getLocalGitUpdateTarget(i);await this.ensureGitRef(i,s.fetchArgs,s.ref)}async ensureGitRef(e,n,i){await this.runCommand("git",n,{cwd:e});let s=await this.runCommandCapture("git",["rev-parse","HEAD"],{cwd:e,timeoutMs:pi}),r=`${i}^{commit}`,o=await this.runCommandCapture("git",["rev-parse",r],{cwd:e,timeoutMs:pi});if(s.trim()===o.trim())return;await this.runCommand("git",["reset","--hard",r],{cwd:e}),await this.runCommand("git",["clean","-fdx"],{cwd:e});let a=be(e,"package.json");ve(a)&&await this.runNpmCommand(this.getGitDependencyInstallArgs(),{cwd:e})}async refreshTemporaryGitSource(e,n){if(!Er())try{await this.withProgress("pull",n,`Refreshing ${n}...`,async()=>{await this.updateGit(e,"temporary")})}catch{}}async removeGit(e,n){let i=this.getGitInstallPath(e,n);ve(i)&&(HM(i,{recursive:!0,force:!0}),this.pruneEmptyGitParents(i,this.getGitInstallRoot(n)))}pruneEmptyGitParents(e,n){if(!n)return;let i=mi(n),s=Fn(e);for(;s.startsWith(i)&&s!==i;){if(!ve(s)){s=Fn(s);continue}if(Ka(s).length>0)break;try{HM(s,{recursive:!0,force:!0})}catch{break}s=Fn(s)}}ensureNpmProject(e){ve(e)||Hp(e,{recursive:!0}),rS(e),this.ensureGitIgnore(e);let n=be(e,"package.json");ve(n)||zM(n,JSON.stringify({name:"pi-extensions",private:!0},null,2),"utf-8")}ensureGitIgnore(e){ve(e)||Hp(e,{recursive:!0});let n=be(e,".gitignore");ve(n)||zM(n,`*
|
|
286
|
+
${e.fg("error",n)}`}function Np(t,e){let n=e?.operations??DB;return{name:"write",label:"write",description:"Write content to a file. Creates the file if it doesn't exist, overwrites if it does. Automatically creates parent directories.",promptSnippet:"Create or overwrite files",promptGuidelines:["Use write only for new files or complete rewrites."],parameters:UB,async execute(i,{path:s,content:r},o,a,c){let l=Wt(s,t),u=FB(l);return Pr(l,async()=>{let d=()=>{if(o?.aborted)throw new Error("Operation aborted")};return d(),await n.mkdir(u),d(),await n.writeFile(l,r),d(),{content:[{type:"text",text:`Successfully wrote ${r.length} bytes to ${s}`}],details:void 0}})},renderCall(i,s,r){let o=i,a=Xe(o?.file_path??o?.path),c=Xe(o?.content),l=r.lastComponent??new R0;return c!==null?l.cache=r.argsComplete?Bp(a,c):NB(l.cache,a,c):l.cache=void 0,l.setText(qB(o,{expanded:r.expanded,isPartial:r.isPartial},s,l.cache,r.cwd)),l},renderResult(i,s,r,o){let a=GB({...i,isError:o.isError},r);if(!a){let l=o.lastComponent??new H;return l.clear(),l}let c=o.lastComponent??new E("",0,0);return c.setText(a),c}}}function F0(t,e){return{read:$p(t,e?.read),bash:Mp(t,e?.bash),edit:Ip(t,e?.edit),write:Np(t,e?.write),grep:Ep(t,e?.grep),find:_p(t,e?.find),ls:Ap(t,e?.ls)}}function U0(t){let e=t.match(/^<skill name="([^"]+)" location="([^"]+)">\n([\s\S]*?)\n<\/skill>(?:\n\n([\s\S]+))?$/);return e?{name:e[1],location:e[2],content:e[3],userMessage:e[4]?.trim()||void 0}:null}import tye from"proper-lockfile";import{Type as T}from"typebox";import{Compile as tN}from"typebox/compile";var D0={anthropic:"Anthropic","amazon-bedrock":"Amazon Bedrock","ant-ling":"Ant Ling","azure-openai-responses":"Azure OpenAI Responses",cerebras:"Cerebras","cloudflare-ai-gateway":"Cloudflare AI Gateway","cloudflare-workers-ai":"Cloudflare Workers AI",deepseek:"DeepSeek",fireworks:"Fireworks",google:"Google Gemini","google-vertex":"Google Vertex AI",groq:"Groq",huggingface:"Hugging Face","kimi-coding":"Kimi For Coding",mistral:"Mistral",minimax:"MiniMax","minimax-cn":"MiniMax (China)",moonshotai:"Moonshot AI","moonshotai-cn":"Moonshot AI (China)",nvidia:"NVIDIA NIM",opencode:"OpenCode Zen","opencode-go":"OpenCode Go",openai:"OpenAI",openrouter:"OpenRouter",together:"Together AI","vercel-ai-gateway":"Vercel AI Gateway",xai:"xAI",zai:"ZAI","zai-coding-cn":"ZAI Coding Plan (China)",xiaomi:"Xiaomi MiMo","xiaomi-token-plan-cn":"Xiaomi MiMo Token Plan (China)","xiaomi-token-plan-ams":"Xiaomi MiMo Token Plan (Amsterdam)","xiaomi-token-plan-sgp":"Xiaomi MiMo Token Plan (Singapore)"};var B1=T.Object({p50:T.Optional(T.Number()),p75:T.Optional(T.Number()),p90:T.Optional(T.Number()),p99:T.Optional(T.Number())}),nN=T.Object({allow_fallbacks:T.Optional(T.Boolean()),require_parameters:T.Optional(T.Boolean()),data_collection:T.Optional(T.Union([T.Literal("deny"),T.Literal("allow")])),zdr:T.Optional(T.Boolean()),enforce_distillable_text:T.Optional(T.Boolean()),order:T.Optional(T.Array(T.String())),only:T.Optional(T.Array(T.String())),ignore:T.Optional(T.Array(T.String())),quantizations:T.Optional(T.Array(T.String())),sort:T.Optional(T.Union([T.String(),T.Object({by:T.Optional(T.String()),partition:T.Optional(T.Union([T.String(),T.Null()]))})])),max_price:T.Optional(T.Object({prompt:T.Optional(T.Union([T.Number(),T.String()])),completion:T.Optional(T.Union([T.Number(),T.String()])),image:T.Optional(T.Union([T.Number(),T.String()])),audio:T.Optional(T.Union([T.Number(),T.String()])),request:T.Optional(T.Union([T.Number(),T.String()]))})),preferred_min_throughput:T.Optional(T.Union([T.Number(),B1])),preferred_max_latency:T.Optional(T.Union([T.Number(),B1]))}),iN=T.Object({only:T.Optional(T.Array(T.String())),order:T.Optional(T.Array(T.String()))}),qa=T.Union([T.String(),T.Null()]),N1=T.Object({off:T.Optional(qa),minimal:T.Optional(qa),low:T.Optional(qa),medium:T.Optional(qa),high:T.Optional(qa),xhigh:T.Optional(qa)}),sN=T.Object({supportsStore:T.Optional(T.Boolean()),supportsDeveloperRole:T.Optional(T.Boolean()),supportsReasoningEffort:T.Optional(T.Boolean()),supportsUsageInStreaming:T.Optional(T.Boolean()),maxTokensField:T.Optional(T.Union([T.Literal("max_completion_tokens"),T.Literal("max_tokens")])),requiresToolResultName:T.Optional(T.Boolean()),requiresAssistantAfterToolResult:T.Optional(T.Boolean()),requiresThinkingAsText:T.Optional(T.Boolean()),requiresReasoningContentOnAssistantMessages:T.Optional(T.Boolean()),thinkingFormat:T.Optional(T.Union([T.Literal("openai"),T.Literal("openrouter"),T.Literal("together"),T.Literal("deepseek"),T.Literal("zai"),T.Literal("qwen"),T.Literal("qwen-chat-template")])),cacheControlFormat:T.Optional(T.Literal("anthropic")),openRouterRouting:T.Optional(nN),vercelGatewayRouting:T.Optional(iN),supportsStrictMode:T.Optional(T.Boolean()),supportsLongCacheRetention:T.Optional(T.Boolean())}),rN=T.Object({supportsDeveloperRole:T.Optional(T.Boolean()),sendSessionIdHeader:T.Optional(T.Boolean()),supportsLongCacheRetention:T.Optional(T.Boolean())}),oN=T.Object({supportsEagerToolInputStreaming:T.Optional(T.Boolean()),supportsLongCacheRetention:T.Optional(T.Boolean()),sendSessionAffinityHeaders:T.Optional(T.Boolean()),supportsCacheControlOnTools:T.Optional(T.Boolean()),forceAdaptiveThinking:T.Optional(T.Boolean())}),$0=T.Union([sN,rN,oN]),aN=T.Object({id:T.String({minLength:1}),name:T.Optional(T.String({minLength:1})),api:T.Optional(T.String({minLength:1})),baseUrl:T.Optional(T.String({minLength:1})),reasoning:T.Optional(T.Boolean()),thinkingLevelMap:T.Optional(N1),input:T.Optional(T.Array(T.Union([T.Literal("text"),T.Literal("image")]))),cost:T.Optional(T.Object({input:T.Number(),output:T.Number(),cacheRead:T.Number(),cacheWrite:T.Number()})),contextWindow:T.Optional(T.Number()),maxTokens:T.Optional(T.Number()),headers:T.Optional(T.Record(T.String(),T.String())),compat:T.Optional($0)}),cN=T.Object({name:T.Optional(T.String({minLength:1})),reasoning:T.Optional(T.Boolean()),thinkingLevelMap:T.Optional(N1),input:T.Optional(T.Array(T.Union([T.Literal("text"),T.Literal("image")]))),cost:T.Optional(T.Object({input:T.Optional(T.Number()),output:T.Optional(T.Number()),cacheRead:T.Optional(T.Number()),cacheWrite:T.Optional(T.Number())})),contextWindow:T.Optional(T.Number()),maxTokens:T.Optional(T.Number()),headers:T.Optional(T.Record(T.String(),T.String())),compat:T.Optional($0)}),lN=T.Object({name:T.Optional(T.String({minLength:1})),baseUrl:T.Optional(T.String({minLength:1})),apiKey:T.Optional(T.String({minLength:1})),api:T.Optional(T.String({minLength:1})),headers:T.Optional(T.Record(T.String(),T.String())),compat:T.Optional($0),authHeader:T.Optional(T.Boolean()),models:T.Optional(T.Array(aN)),modelOverrides:T.Optional(T.Record(T.String(),cN))}),uN=T.Object({providers:T.Record(T.String(),lN)}),Rye=tN(uN);import{createHash as hN}from"node:crypto";import{chmodSync as gN,existsSync as ve,mkdirSync as Hp,readdirSync as Ka,readFileSync as Dl,rmSync as H1,statSync as Es,writeFileSync as z1}from"node:fs";import{homedir as fN}from"node:os";import{basename as zp,dirname as Fn,join as be,relative as Un,resolve as mi,sep as Z1}from"node:path";import{globSync as bN}from"glob";import $l from"ignore";import{minimatch as Ga}from"minimatch";import{maxSatisfying as xN,rcompare as vN,satisfies as yN,valid as wN,validRange as SN}from"semver";import j1 from"hosted-git-info";function G1(t){let e=t.match(/^git@([^:]+):(.+)$/);if(e){let c=e[2]??"",l=c.indexOf("@");if(l<0)return{repo:t};let u=c.slice(0,l),d=c.slice(l+1);return!u||!d?{repo:t}:{repo:`git@${e[1]??""}:${u}`,ref:d}}if(t.includes("://"))try{let c=new URL(t),l=c.pathname.replace(/^\/+/,""),u=l.indexOf("@");if(u<0)return{repo:t};let d=l.slice(0,u),p=l.slice(u+1);return!d||!p?{repo:t}:(c.pathname=`/${d}`,{repo:c.toString().replace(/\/$/,""),ref:p})}catch{return{repo:t}}let n=t.indexOf("/");if(n<0)return{repo:t};let i=t.slice(0,n),s=t.slice(n+1),r=s.indexOf("@");if(r<0)return{repo:t};let o=s.slice(0,r),a=s.slice(r+1);return!o||!a?{repo:t}:{repo:`${i}/${o}`,ref:a}}function dN(t){try{return decodeURIComponent(t)}catch{return null}}function q1(t,e){let n=dN(t);if(n===null)return!0;let i=[t,n];for(let s of i)if(s.includes("\0")||s.includes("\\")||s.startsWith("/")||!e&&s.includes("/")||s.split("/").includes(".."))return!0;return!1}function B0(t){if(t.path.startsWith("/"))return null;let e=t.path.replace(/\.git$/,"").replace(/^\/+/,"");return!t.host||!e||e.split("/").length<2||q1(t.host,!1)||q1(e,!0)?null:{type:"git",repo:t.repo,host:t.host,path:e,ref:t.ref,pinned:!!t.ref}}function pN(t){let{repo:e,ref:n}=G1(t),i=e,s="",r="",o=e.match(/^git@([^:]+):(.+)$/);if(o)s=o[1]??"",r=o[2]??"";else if(e.startsWith("https://")||e.startsWith("http://")||e.startsWith("ssh://")||e.startsWith("git://"))try{let a=new URL(e);s=a.hostname,r=a.pathname.replace(/^\/+/,"")}catch{return null}else{let a=e.indexOf("/");if(a<0||(s=e.slice(0,a),r=e.slice(a+1),!s.includes(".")&&s!=="localhost"))return null;i=`https://${e}`}return B0({repo:i,host:s,path:r,ref:n})}function Ul(t){let e=t.trim(),n=e.startsWith("git:"),i=n?e.slice(4).trim():e;if(!n&&!/^(https?|ssh|git):\/\//i.test(i))return null;let s=G1(i),r=[s.ref?`${s.repo}#${s.ref}`:void 0,i].filter(a=>!!a);for(let a of r){let c=j1.fromUrl(a);if(c){if(s.ref&&c.project?.includes("@"))continue;let l=!s.repo.startsWith("http://")&&!s.repo.startsWith("https://")&&!s.repo.startsWith("ssh://")&&!s.repo.startsWith("git://")&&!s.repo.startsWith("git@");return B0({repo:l?`https://${s.repo}`:s.repo,host:c.domain||"",path:`${c.user}/${c.project}`,ref:c.committish||s.ref||void 0})}}let o=[s.ref?`https://${s.repo}#${s.ref}`:void 0,`https://${i}`].filter(a=>!!a);for(let a of o){let c=j1.fromUrl(a);if(c){if(s.ref&&c.project?.includes("@"))continue;return B0({repo:`https://${s.repo}`,host:c.domain||"",path:`${c.user}/${c.project}`,ref:c.committish||s.ref||void 0})}}return pN(i)}var mN;var Eye=Promise.resolve();function K1(){return mN!==void 0}function N0(){if(process.platform!=="linux"||Object.keys(process.env).length>0)return process.env;try{let t=Dl("/proc/self/environ","utf-8"),e={};for(let n of t.split("\0")){let i=n.indexOf("=");i>0&&(e[n.slice(0,i)]=n.slice(i+1))}return e}catch{return process.env}}var pi=1e4,V1=4,TN=4;function Er(){let t=process.env.PI_OFFLINE;return t?t==="1"||t.toLowerCase()==="true"||t.toLowerCase()==="yes":!1}function CN(t){return wN(t??"")!==null}function kN(t){return t?SN(t)??void 0:void 0}function J1(t){return t.origin==="package"?4:(t.scope==="project"?0:2)+(t.source==="local"?0:1)}var jp=["extensions","skills","prompts","themes"],MN={extensions:/\.(ts|js)$/,skills:/\.md$/,prompts:/\.md$/,themes:/\.json$/},RN=[".gitignore",".ignore",".fdignore"];function Rt(t){return t.split(Z1).join("/")}function j0(){return process.env.HOME||fN()}function IN(t){let e=be(t,"tmp","extensions");return Hp(e,{recursive:!0,mode:448}),gN(e,448),e}function PN(t,e){let n=t.trim();if(!n||n.startsWith("#")&&!n.startsWith("\\#"))return null;let i=t,s=!1;i.startsWith("!")?(s=!0,i=i.slice(1)):i.startsWith("\\!")&&(i=i.slice(1)),i.startsWith("/")&&(i=i.slice(1));let r=e?`${e}${i}`:i;return s?`!${r}`:r}function Bl(t,e,n){let i=Un(n,e),s=i?`${Rt(i)}/`:"";for(let r of RN){let o=be(e,r);if(ve(o))try{let c=Dl(o,"utf-8").split(/\r?\n/).map(l=>PN(l,s)).filter(l=>!!l);c.length>0&&t.add(c)}catch{}}}function _N(t){return t.startsWith("!")||t.startsWith("+")||t.startsWith("-")||t.includes("*")||t.includes("?")}function q0(t){return t.startsWith("!")||t.startsWith("+")||t.startsWith("-")}function EN(t){return t.includes("*")||t.includes("?")}function AN(t){let e=[],n=[];for(let i of t)_N(i)?n.push(i):e.push(i);return{plain:e,patterns:n}}function eM(t,e,n=!0,i,s){let r=[];if(!ve(t))return r;let o=s??t,a=i??$l();Bl(a,t,o);try{let c=Ka(t,{withFileTypes:!0});for(let l of c){if(l.name.startsWith(".")||n&&l.name==="node_modules")continue;let u=be(t,l.name),d=l.isDirectory(),p=l.isFile();if(l.isSymbolicLink())try{let h=Es(u);d=h.isDirectory(),p=h.isFile()}catch{continue}let m=Rt(Un(o,u)),g=d?`${m}/`:m;a.ignores(g)||(d?r.push(...eM(u,e,n,a,o)):p&&e.test(l.name)&&r.push(u))}}catch{}return r}function H0(t,e,n,i){let s=[];if(!ve(t))return s;let r=i??t,o=n??$l();Bl(o,t,r);try{let a=Ka(t,{withFileTypes:!0});for(let c of a){if(c.name!=="SKILL.md")continue;let l=be(t,c.name),u=c.isFile();if(c.isSymbolicLink())try{u=Es(l).isFile()}catch{continue}let d=Rt(Un(r,l));if(u&&!o.ignores(d))return s.push(l),s}for(let c of a){if(c.name.startsWith(".")||c.name==="node_modules")continue;let l=be(t,c.name),u=c.isDirectory(),d=c.isFile();if(c.isSymbolicLink())try{let m=Es(l);u=m.isDirectory(),d=m.isFile()}catch{continue}let p=Rt(Un(r,l));if(e==="pi"&&t===r&&d&&c.name.endsWith(".md")&&!o.ignores(p)){s.push(l);continue}u&&(o.ignores(`${p}/`)||s.push(...H0(l,e,o,r)))}}catch{}return s}function qp(t,e){return H0(t,e)}function ON(t){let e=mi(t);for(;;){if(ve(be(e,".git")))return e;let n=Fn(e);if(n===e)return null;e=n}}function LN(t){let e=[],n=mi(t),i=ON(n),s=n;for(;e.push(be(s,".agents","skills")),!(i&&s===i);){let r=Fn(s);if(r===s)break;s=r}return e}function Q1(t){let e=[];if(!ve(t))return e;let n=$l();Bl(n,t,t);try{let i=Ka(t,{withFileTypes:!0});for(let s of i){if(s.name.startsWith(".")||s.name==="node_modules")continue;let r=be(t,s.name),o=s.isFile();if(s.isSymbolicLink())try{o=Es(r).isFile()}catch{continue}let a=Rt(Un(t,r));n.ignores(a)||o&&s.name.endsWith(".md")&&e.push(r)}}catch{}return e}function Y1(t){let e=[];if(!ve(t))return e;let n=$l();Bl(n,t,t);try{let i=Ka(t,{withFileTypes:!0});for(let s of i){if(s.name.startsWith(".")||s.name==="node_modules")continue;let r=be(t,s.name),o=s.isFile();if(s.isSymbolicLink())try{o=Es(r).isFile()}catch{continue}let a=Rt(Un(t,r));n.ignores(a)||o&&s.name.endsWith(".json")&&e.push(r)}}catch{}return e}function WN(t){try{let e=Dl(t,"utf-8");return JSON.parse(e).pi??null}catch{return null}}function X1(t){let e=be(t,"package.json");if(ve(e)){let s=WN(e);if(s?.extensions?.length){let r=[];for(let o of s.extensions){let a=mi(t,o);ve(a)&&r.push(a)}if(r.length>0)return r}}let n=be(t,"index.ts"),i=be(t,"index.js");return ve(n)?[n]:ve(i)?[i]:null}function G0(t){let e=[];if(!ve(t))return e;let n=X1(t);if(n)return n;let i=$l();Bl(i,t,t);try{let s=Ka(t,{withFileTypes:!0});for(let r of s){if(r.name.startsWith(".")||r.name==="node_modules")continue;let o=be(t,r.name),a=r.isDirectory(),c=r.isFile();if(r.isSymbolicLink())try{let d=Es(o);a=d.isDirectory(),c=d.isFile()}catch{continue}let l=Rt(Un(t,o)),u=a?`${l}/`:l;if(!i.ignores(u)){if(c&&(r.name.endsWith(".ts")||r.name.endsWith(".js")))e.push(o);else if(a){let d=X1(o);d&&e.push(...d)}}}}catch{}return e}function Gp(t,e){return e==="skills"?H0(t,"pi"):e==="extensions"?G0(t):eM(t,MN[e])}function K0(t,e,n){let i=Rt(Un(n,t)),s=zp(t),r=Rt(t),o=s==="SKILL.md",a=o?Fn(t):void 0,c=o?Rt(Un(n,a)):void 0,l=o?zp(a):void 0,u=o?Rt(a):void 0;return e.some(d=>{let p=Rt(d);return Ga(i,p)||Ga(s,p)||Ga(r,p)?!0:o?Ga(c,p)||Ga(l,p)||Ga(u,p):!1})}function FN(t){let e=t.startsWith("./")||t.startsWith(".\\")?t.slice(2):t;return Rt(e)}function Vp(t,e,n){if(e.length===0)return!1;let i=Rt(Un(n,t)),s=zp(t),r=Rt(t),o=s==="SKILL.md",a=o?Fn(t):void 0,c=o?Rt(Un(n,a)):void 0,l=o?Rt(a):void 0;return e.some(u=>{let d=FN(u);return d===i||d===r?!0:o?d===c||d===l:!1})}function UN(t){return t.filter(e=>e.startsWith("!")||e.startsWith("+")||e.startsWith("-"))}function DN(t,e,n){let i=UN(e),s=i.filter(c=>c.startsWith("!")).map(c=>c.slice(1)),r=i.filter(c=>c.startsWith("+")).map(c=>c.slice(1)),o=i.filter(c=>c.startsWith("-")).map(c=>c.slice(1)),a=!0;return s.length>0&&K0(t,s,n)&&(a=!1),r.length>0&&Vp(t,r,n)&&(a=!0),o.length>0&&Vp(t,o,n)&&(a=!1),a}function Kp(t,e,n){let i=[],s=[],r=[],o=[];for(let c of e)c.startsWith("+")?r.push(c.slice(1)):c.startsWith("-")?o.push(c.slice(1)):c.startsWith("!")?s.push(c.slice(1)):i.push(c);let a;if(i.length===0?a=[...t]:a=t.filter(c=>K0(c,i,n)),s.length>0&&(a=a.filter(c=>!K0(c,s,n))),r.length>0)for(let c of t)!a.includes(c)&&Vp(c,r,n)&&a.push(c);return o.length>0&&(a=a.filter(c=>!Vp(c,o,n))),new Set(a)}var Gi=class{constructor(e){this.cwd=xe(e.cwd),this.agentDir=xe(e.agentDir),this.settingsManager=e.settingsManager}setProgressCallback(e){this.progressCallback=e}addSourceToSettings(e,n){let i=n?.local?"project":"user",r=(i==="project"?this.settingsManager.getProjectSettings():this.settingsManager.getGlobalSettings()).packages??[],o=this.normalizePackageSourceForSettings(e,i),a=r.findIndex(l=>this.packageSourcesMatch(l,e,i));if(a!==-1){let l=r[a];if(this.getPackageSourceString(l)===o)return!1;let u=[...r];return u[a]=typeof l=="string"?o:{...l,source:o},i==="project"?this.settingsManager.setProjectPackages(u):this.settingsManager.setPackages(u),!0}let c=[...r,o];return i==="project"?this.settingsManager.setProjectPackages(c):this.settingsManager.setPackages(c),!0}removeSourceFromSettings(e,n){let i=n?.local?"project":"user",r=(i==="project"?this.settingsManager.getProjectSettings():this.settingsManager.getGlobalSettings()).packages??[],o=r.filter(c=>!this.packageSourcesMatch(c,e,i));return o.length!==r.length?(i==="project"?this.settingsManager.setProjectPackages(o):this.settingsManager.setPackages(o),!0):!1}getInstalledPath(e,n){let i=this.parseSource(e);if(i.type==="npm"){let s=this.getNpmInstallPath(i,n);return ve(s)?s:void 0}if(i.type==="git"){let s=this.getGitInstallPath(i,n);return ve(s)?s:void 0}if(i.type==="local"){let s=this.getBaseDirForScope(n),r=this.resolvePathFromBase(i.path,s);return ve(r)?r:void 0}}emitProgress(e){this.progressCallback?.(e)}async withProgress(e,n,i,s){this.emitProgress({type:"start",action:e,source:n,message:i});try{await s(),this.emitProgress({type:"complete",action:e,source:n})}catch(r){let o=r instanceof Error?r.message:String(r);throw this.emitProgress({type:"error",action:e,source:n,message:o}),r}}async resolve(e){let n=this.createAccumulator(),i=this.settingsManager.getGlobalSettings(),s=this.settingsManager.getProjectSettings(),r=[];for(let l of s.packages??[])r.push({pkg:l,scope:"project"});for(let l of i.packages??[])r.push({pkg:l,scope:"user"});let o=this.dedupePackages(r);await this.resolvePackageSources(o,n,e);let a=this.agentDir,c=be(this.cwd,mt);for(let l of jp){let u=this.getTargetMap(n,l),d=i[l]??[],p=s[l]??[];this.resolveLocalEntries(p,l,u,{source:"local",scope:"project",origin:"top-level"},c),this.resolveLocalEntries(d,l,u,{source:"local",scope:"user",origin:"top-level"},a)}return this.addAutoDiscoveredResources(n,i,s,a,c),this.toResolvedPaths(n)}async resolveExtensionSources(e,n){let i=this.createAccumulator(),s=n?.temporary?"temporary":n?.local?"project":"user",r=e.map(o=>({pkg:o,scope:s}));return await this.resolvePackageSources(r,i),this.toResolvedPaths(i)}listConfiguredPackages(){let e=this.settingsManager.getGlobalSettings(),n=this.settingsManager.getProjectSettings(),i=[];for(let s of e.packages??[]){let r=typeof s=="string"?s:s.source;i.push({source:r,scope:"user",filtered:typeof s=="object",installedPath:this.getInstalledPath(r,"user")})}for(let s of n.packages??[]){let r=typeof s=="string"?s:s.source;i.push({source:r,scope:"project",filtered:typeof s=="object",installedPath:this.getInstalledPath(r,"project")})}return i}async install(e,n){let i=this.parseSource(e),s=n?.local?"project":"user";this.assertProjectTrustedForScope(s),await this.withProgress("install",e,`Installing ${e}...`,async()=>{if(i.type==="npm"){await this.installNpm(i,s,!1);return}if(i.type==="git"){await this.installGit(i,s);return}if(i.type==="local"){let r=this.resolvePath(i.path);if(!ve(r))throw new Error(`Path does not exist: ${r}`);return}throw new Error(`Unsupported install source: ${e}`)})}async installAndPersist(e,n){await this.install(e,n),this.addSourceToSettings(e,n)}async remove(e,n){let i=this.parseSource(e),s=n?.local?"project":"user";this.assertProjectTrustedForScope(s),await this.withProgress("remove",e,`Removing ${e}...`,async()=>{if(i.type==="npm"){await this.uninstallNpm(i,s);return}if(i.type==="git"){await this.removeGit(i,s);return}if(i.type!=="local")throw new Error(`Unsupported remove source: ${e}`)})}async removeAndPersist(e,n){return await this.remove(e,n),this.removeSourceFromSettings(e,n)}async update(e){let n=this.settingsManager.getGlobalSettings(),i=this.settingsManager.getProjectSettings(),s=e?this.getPackageIdentity(e):void 0,r=!1,o=[];for(let a of n.packages??[]){let c=typeof a=="string"?a:a.source;s&&this.getPackageIdentity(c,"user")!==s||(r=!0,o.push({source:c,scope:"user"}))}for(let a of i.packages??[]){let c=typeof a=="string"?a:a.source;s&&this.getPackageIdentity(c,"project")!==s||(r=!0,o.push({source:c,scope:"project"}))}if(e&&!r)throw new Error(this.buildNoMatchingPackageMessage(e,[...n.packages??[],...i.packages??[]]));await this.updateConfiguredSources(o)}async updateConfiguredSources(e){if(Er()||e.length===0)return;let n=[],i=[];for(let l of e){let u=this.parseSource(l.source);u.type==="npm"?u.pinned||n.push({...l,parsed:u}):u.type==="git"&&i.push({...l,parsed:u})}let s=n.map(l=>async()=>({entry:l,shouldUpdate:await this.shouldUpdateNpmSource(l.parsed,l.scope)})),r=await this.runWithConcurrency(s,V1),o=[],a=[];for(let l of r)l.shouldUpdate&&(l.entry.scope==="user"?o.push(l.entry):a.push(l.entry));let c=[];if(o.length>0&&c.push(this.updateNpmBatch(o,"user")),a.length>0&&c.push(this.updateNpmBatch(a,"project")),i.length>0){let l=i.map(u=>async()=>this.withProgress("update",u.source,`Updating ${u.source}...`,async()=>{await this.updateGit(u.parsed,u.scope)}));c.push(this.runWithConcurrency(l,TN).then(()=>{}))}await Promise.all(c)}async shouldUpdateNpmSource(e,n){let i=this.getManagedNpmInstallPath(e,n),s=ve(i)?this.getInstalledNpmVersion(i):void 0;if(!s)return!0;try{return await this.getLatestNpmVersion(e.version?e.spec:e.name,e.range)!==s}catch{return!0}}async updateNpmBatch(e,n){if(e.length===0)return;let i=e.length===1?e[0].source:`${n} npm packages`,s=e.length===1?`Updating ${e[0].source}...`:`Updating ${n} npm packages...`,r=e.map(o=>o.parsed.version?o.parsed.spec:`${o.parsed.name}@latest`);await this.withProgress("update",i,s,async()=>{await this.installNpmBatch(r,n)})}async installNpmBatch(e,n){let i=this.getNpmInstallRoot(n,!1);this.ensureNpmProject(i),await this.runNpmCommand(this.getNpmInstallArgs(e,i))}async checkForAvailableUpdates(){if(Er())return[];let e=this.settingsManager.getGlobalSettings(),n=this.settingsManager.getProjectSettings(),i=[];for(let a of n.packages??[])i.push({pkg:a,scope:"project"});for(let a of e.packages??[])i.push({pkg:a,scope:"user"});let r=this.dedupePackages(i).filter(a=>a.scope!=="temporary").map(a=>async()=>{let c=typeof a.pkg=="string"?a.pkg:a.pkg.source,l=this.parseSource(c);if(l.type==="local"||l.pinned)return;if(l.type==="npm"){let p=this.getNpmInstallPath(l,a.scope);return!ve(p)||!await this.npmHasAvailableUpdate(l,p)?void 0:{source:c,displayName:l.name,type:"npm",scope:a.scope}}let u=this.getGitInstallPath(l,a.scope);if(!(!ve(u)||!await this.gitHasAvailableUpdate(u)))return{source:c,displayName:`${l.host}/${l.path}`,type:"git",scope:a.scope}});return(await this.runWithConcurrency(r,V1)).filter(a=>a!==void 0)}async resolvePackageSources(e,n,i){for(let{pkg:s,scope:r}of e){let o=typeof s=="string"?s:s.source,a=typeof s=="object"?s:void 0,c=this.parseSource(o),l={source:o,scope:r,origin:"package"};if(c.type==="local"){let d=this.getBaseDirForScope(r);this.resolveLocalExtensionSource(c,n,a,l,d);continue}let u=async()=>{if(Er())return!1;if(!i)return await this.installParsedSource(c,r),!0;let d=await i(o);if(d==="skip")return!1;if(d==="error")throw new Error(`Missing source: ${o}`);return await this.installParsedSource(c,r),!0};if(c.type==="npm"){let d=this.getNpmInstallPath(c,r);if(!ve(d)||!await this.installedNpmMatchesConfiguredVersion(c,d)){if(!await u())continue;d=this.getNpmInstallPath(c,r)}l.baseDir=d,this.collectPackageResources(d,n,a,l);continue}if(c.type==="git"){let d=this.getGitInstallPath(c,r);if(ve(d))r==="temporary"&&!c.pinned&&!Er()&&await this.refreshTemporaryGitSource(c,o);else if(!await u())continue;l.baseDir=d,this.collectPackageResources(d,n,a,l)}}}resolveLocalExtensionSource(e,n,i,s,r){let o=this.resolvePathFromBase(e.path,r);if(ve(o))try{let a=Es(o);if(a.isFile()){s.baseDir=Fn(o),this.addResource(n.extensions,o,s,!0);return}a.isDirectory()&&(s.baseDir=o,this.collectPackageResources(o,n,i,s)||this.addResource(n.extensions,o,s,!0))}catch{return}}async installParsedSource(e,n){if(e.type==="npm"){await this.installNpm(e,n,n==="temporary");return}if(e.type==="git"){await this.installGit(e,n);return}}getPackageSourceString(e){return typeof e=="string"?e:e.source}getSourceMatchKeyForInput(e){let n=this.parseSource(e);return n.type==="npm"?`npm:${n.name}`:n.type==="git"?`git:${n.host}/${n.path}`:`local:${this.resolvePath(n.path)}`}getSourceMatchKeyForSettings(e,n){let i=this.parseSource(e);if(i.type==="npm")return`npm:${i.name}`;if(i.type==="git")return`git:${i.host}/${i.path}`;let s=this.getBaseDirForScope(n);return`local:${this.resolvePathFromBase(i.path,s)}`}buildNoMatchingPackageMessage(e,n){let i=this.findSuggestedConfiguredSource(e,n);return i?`No matching package found for ${e}. Did you mean ${i}?`:`No matching package found for ${e}`}findSuggestedConfiguredSource(e,n){let i=e.trim(),s=new Set;for(let r of n){let o=this.getPackageSourceString(r),a=this.parseSource(o);if(a.type==="npm"){(i===a.name||i===a.spec)&&s.add(o);continue}if(a.type==="git"){let c=`${a.host}/${a.path}`,l=a.ref?`${c}@${a.ref}`:void 0;(i===c||l&&i===l)&&s.add(o)}}return s.values().next().value}packageSourcesMatch(e,n,i){let s=this.getSourceMatchKeyForSettings(this.getPackageSourceString(e),i),r=this.getSourceMatchKeyForInput(n);return s===r}normalizePackageSourceForSettings(e,n){let i=this.parseSource(e);if(i.type!=="local")return e;let s=this.getBaseDirForScope(n),r=this.resolvePath(i.path);return Un(s,r)||"."}parseSource(e){if(e.startsWith("npm:")){let i=e.slice(4).trim(),{name:s,version:r}=this.parseNpmSpec(i);return{type:"npm",spec:i,name:s,version:r,range:kN(r),pinned:CN(r)}}if(cd(e))return{type:"local",path:e};let n=Ul(e);return n||{type:"local",path:e}}async installedNpmMatchesConfiguredVersion(e,n){let i=this.getInstalledNpmVersion(n);return i?e.range?yN(i,e.range):!0:!1}async npmHasAvailableUpdate(e,n){if(Er())return!1;let i=this.getInstalledNpmVersion(n);if(!i)return!1;try{return await this.getLatestNpmVersion(e.version?e.spec:e.name,e.range)!==i}catch{return!1}}getInstalledNpmVersion(e){let n=be(e,"package.json");if(ve(n))try{let i=Dl(n,"utf-8");return JSON.parse(i).version}catch{return}}async getLatestNpmVersion(e,n){let i=this.getNpmCommand(),r=(await this.runCommandCapture(i.command,[...i.args,"view",e,"version","--json"],{cwd:this.cwd,timeoutMs:pi})).trim();if(!r)throw new Error("Empty response from npm view");let o=JSON.parse(r);if(typeof o=="string")return o;if(Array.isArray(o)){let a=o.filter(l=>typeof l=="string"&&l.length>0),c=n?xN(a,n):[...a].sort(vN)[0];if(c)return c}throw new Error("Unexpected response from npm view")}async gitHasAvailableUpdate(e){if(Er())return!1;try{let n=await this.runCommandCapture("git",["rev-parse","HEAD"],{cwd:e,timeoutMs:pi}),i=await this.getRemoteGitHead(e);return n.trim()!==i.trim()}catch{return!1}}async getRemoteGitHead(e){let n=await this.getGitUpstreamRef(e);if(n){let o=(await this.runGitRemoteCommand(e,["ls-remote","origin",n])).match(/^([0-9a-f]{40})\s+/m);if(o?.[1])return o[1]}let s=(await this.runGitRemoteCommand(e,["ls-remote","origin","HEAD"])).match(/^([0-9a-f]{40})\s+HEAD$/m);if(!s?.[1])throw new Error("Failed to determine remote HEAD");return s[1]}async getLocalGitUpdateTarget(e){try{let i=(await this.runCommandCapture("git",["rev-parse","--abbrev-ref","@{upstream}"],{cwd:e,timeoutMs:pi})).trim();if(!i.startsWith("origin/"))throw new Error(`Unsupported upstream remote: ${i}`);let s=i.slice(7);if(!s)throw new Error("Missing upstream branch name");return{ref:"@{upstream}",head:await this.runCommandCapture("git",["rev-parse","@{upstream}"],{cwd:e,timeoutMs:pi}),fetchArgs:["fetch","--prune","--no-tags","origin",`+refs/heads/${s}:refs/remotes/origin/${s}`]}}catch{await this.runCommand("git",["remote","set-head","origin","-a"],{cwd:e}).catch(()=>{});let n=await this.runCommandCapture("git",["rev-parse","origin/HEAD"],{cwd:e,timeoutMs:pi}),s=(await this.runCommandCapture("git",["symbolic-ref","refs/remotes/origin/HEAD"],{cwd:e,timeoutMs:pi}).catch(()=>"")).trim().replace(/^refs\/remotes\/origin\//,"");return s?{ref:"origin/HEAD",head:n,fetchArgs:["fetch","--prune","--no-tags","origin",`+refs/heads/${s}:refs/remotes/origin/${s}`]}:{ref:"origin/HEAD",head:n,fetchArgs:["fetch","--prune","--no-tags","origin","+HEAD:refs/remotes/origin/HEAD"]}}}async getGitUpstreamRef(e){try{let i=(await this.runCommandCapture("git",["rev-parse","--abbrev-ref","@{upstream}"],{cwd:e,timeoutMs:pi})).trim();if(!i.startsWith("origin/"))return;let s=i.slice(7);return s?`refs/heads/${s}`:void 0}catch{return}}runGitRemoteCommand(e,n){return this.runCommandCapture("git",n,{cwd:e,timeoutMs:pi,env:{GIT_TERMINAL_PROMPT:"0"}})}async runWithConcurrency(e,n){if(e.length===0)return[];let i=new Array(e.length),s=0,r=Math.max(1,Math.min(n,e.length)),o=async()=>{for(;;){let a=s;if(s+=1,a>=e.length)return;i[a]=await e[a]()}};return await Promise.all(Array.from({length:r},()=>o())),i}getPackageIdentity(e,n){let i=this.parseSource(e);if(i.type==="npm")return`npm:${i.name}`;if(i.type==="git")return`git:${i.host}/${i.path}`;if(n){let s=this.getBaseDirForScope(n);return`local:${this.resolvePathFromBase(i.path,s)}`}return`local:${this.resolvePath(i.path)}`}dedupePackages(e){let n=new Map;for(let i of e){let s=typeof i.pkg=="string"?i.pkg:i.pkg.source,r=this.getPackageIdentity(s,i.scope),o=n.get(r);o?i.scope==="project"&&o.scope==="user"&&n.set(r,i):n.set(r,i)}return Array.from(n.values())}parseNpmSpec(e){let n=e.match(/^(@?[^@]+(?:\/[^@]+)?)(?:@(.+))?$/);if(!n)return{name:e};let i=n[1]??e,s=n[2];return{name:i,version:s}}assertProjectTrustedForScope(e){if(e==="project"&&!this.settingsManager.isProjectTrusted())throw new Error("Project is not trusted; refusing to access project package storage")}getNpmCommand(){let e=this.settingsManager.getNpmCommand();if(!e||e.length===0)return{command:"npm",args:[]};let[n,...i]=e;if(!n)throw new Error("Invalid npmCommand: first array entry must be a non-empty command");return{command:n,args:i}}getPackageManagerName(){let e=this.getNpmCommand(),n=[e.command,...e.args],i=n.lastIndexOf("--"),s=i>=0?n[i+1]:e.command;return s?zp(s).replace(/\.(cmd|exe)$/i,""):""}async runNpmCommand(e,n){let i=this.getNpmCommand();await this.runCommand(i.command,[...i.args,...e],n)}getGitDependencyInstallArgs(){let e=this.settingsManager.getNpmCommand();return e&&e.length>0?["install"]:["install","--omit=dev"]}runNpmCommandSync(e){let n=this.getNpmCommand();return this.runCommandSync(n.command,[...n.args,...e])}getNpmInstallArgs(e,n){let i=this.getPackageManagerName();return i==="bun"?["install",...e,"--cwd",n,"--omit=peer"]:i==="pnpm"?["install",...e,"--prefix",n,"--config.auto-install-peers=false","--config.strict-peer-dependencies=false","--config.strict-dep-builds=false"]:["install",...e,"--prefix",n,"--legacy-peer-deps"]}async installNpm(e,n,i){let s=this.getNpmInstallRoot(n,i);this.ensureNpmProject(s),await this.runNpmCommand(this.getNpmInstallArgs([e.spec],s))}async uninstallNpm(e,n){let i=this.getNpmInstallRoot(n,!1);if(ve(i)){if(this.getPackageManagerName()==="bun"){await this.runNpmCommand(["uninstall",e.name,"--cwd",i]);return}await this.runNpmCommand(["uninstall",e.name,"--prefix",i])}}async installGit(e,n){let i=this.getGitInstallPath(e,n);if(ve(i)){if(e.ref){await this.ensureGitRef(i,["fetch","origin",e.ref],"FETCH_HEAD");return}let o=await this.getLocalGitUpdateTarget(i);await this.ensureGitRef(i,o.fetchArgs,o.ref);return}let s=this.getGitInstallRoot(n);s&&this.ensureGitIgnore(s),Hp(Fn(i),{recursive:!0}),await this.runCommand("git",["clone",e.repo,i]),e.ref&&await this.runCommand("git",["checkout",e.ref],{cwd:i});let r=be(i,"package.json");ve(r)&&await this.runNpmCommand(this.getGitDependencyInstallArgs(),{cwd:i})}async updateGit(e,n){let i=this.getGitInstallPath(e,n);if(!ve(i)){await this.installGit(e,n);return}if(e.ref){await this.ensureGitRef(i,["fetch","origin",e.ref],"FETCH_HEAD");return}let s=await this.getLocalGitUpdateTarget(i);await this.ensureGitRef(i,s.fetchArgs,s.ref)}async ensureGitRef(e,n,i){await this.runCommand("git",n,{cwd:e});let s=await this.runCommandCapture("git",["rev-parse","HEAD"],{cwd:e,timeoutMs:pi}),r=`${i}^{commit}`,o=await this.runCommandCapture("git",["rev-parse",r],{cwd:e,timeoutMs:pi});if(s.trim()===o.trim())return;await this.runCommand("git",["reset","--hard",r],{cwd:e}),await this.runCommand("git",["clean","-fdx"],{cwd:e});let a=be(e,"package.json");ve(a)&&await this.runNpmCommand(this.getGitDependencyInstallArgs(),{cwd:e})}async refreshTemporaryGitSource(e,n){if(!Er())try{await this.withProgress("pull",n,`Refreshing ${n}...`,async()=>{await this.updateGit(e,"temporary")})}catch{}}async removeGit(e,n){let i=this.getGitInstallPath(e,n);ve(i)&&(H1(i,{recursive:!0,force:!0}),this.pruneEmptyGitParents(i,this.getGitInstallRoot(n)))}pruneEmptyGitParents(e,n){if(!n)return;let i=mi(n),s=Fn(e);for(;s.startsWith(i)&&s!==i;){if(!ve(s)){s=Fn(s);continue}if(Ka(s).length>0)break;try{H1(s,{recursive:!0,force:!0})}catch{break}s=Fn(s)}}ensureNpmProject(e){ve(e)||Hp(e,{recursive:!0}),rS(e),this.ensureGitIgnore(e);let n=be(e,"package.json");ve(n)||z1(n,JSON.stringify({name:"pi-extensions",private:!0},null,2),"utf-8")}ensureGitIgnore(e){ve(e)||Hp(e,{recursive:!0});let n=be(e,".gitignore");ve(n)||z1(n,`*
|
|
287
287
|
!.gitignore
|
|
288
|
-
`,"utf-8")}getNpmInstallRoot(e,n){return n?this.getTemporaryDir("npm"):e==="project"?(this.assertProjectTrustedForScope(e),be(this.cwd,mt,"npm")):be(this.agentDir,"npm")}getGlobalNpmRoot(){let e=this.getNpmCommand(),n=[e.command,...e.args].join("\0");if(this.globalNpmRoot&&this.globalNpmRootCommandKey===n)return this.globalNpmRoot;if(this.getPackageManagerName()==="bun"){let i=this.runNpmCommandSync(["pm","bin","-g"]).trim();this.globalNpmRoot=be(Fn(i),"install","global","node_modules")}else this.globalNpmRoot=this.runNpmCommandSync(["root","-g"]).trim();return this.globalNpmRootCommandKey=n,this.globalNpmRoot}getPnpmGlobalPackagePath(e){if(this.getPackageManagerName()!=="pnpm")return;let n=this.runNpmCommandSync(["list","-g","--depth","0","--json"]),i=JSON.parse(n);for(let s of i){let r=s.dependencies?.[e]?.path;if(r)return r}}getManagedNpmInstallPath(e,n){return n==="temporary"?be(this.getTemporaryDir("npm"),"node_modules",e.name):n==="project"?(this.assertProjectTrustedForScope(n),be(this.cwd,mt,"npm","node_modules",e.name)):be(this.agentDir,"npm","node_modules",e.name)}getLegacyGlobalNpmInstallPath(e){try{return this.getPnpmGlobalPackagePath(e.name)??be(this.getGlobalNpmRoot(),e.name)}catch{return}}getNpmInstallPath(e,n){let i=this.getManagedNpmInstallPath(e,n);if(n!=="user"||ve(i))return i;let s=this.getLegacyGlobalNpmInstallPath(e);return s&&ve(s)?s:i}getGitInstallPath(e,n){if(n==="temporary")return this.getTemporaryDir(`git-${e.host}`,e.path);let i=this.getGitInstallRoot(n);if(!i)throw new Error("Missing git install root");return this.resolveManagedPath(i,e.host,e.path)}getGitInstallRoot(e){if(e!=="temporary")return e==="project"?(this.assertProjectTrustedForScope(e),be(this.cwd,mt,"git")):be(this.agentDir,"git")}getTemporaryDir(e,n){let i=this.resolveManagedPath(IN(this.agentDir),e),s=hN("sha256").update(`${e}-${n??""}`).digest("hex").slice(0,8);return this.resolveManagedPath(i,s,n??"")}resolveManagedPath(e,...n){let i=mi(e),s=mi(i,...n);if(s!==i&&!s.startsWith(`${i}${ZM}`))throw new Error(`Refusing to use path outside package install root: ${s}`);return s}getBaseDirForScope(e){return e==="project"?(this.assertProjectTrustedForScope(e),be(this.cwd,mt)):e==="user"?this.agentDir:this.cwd}resolvePath(e){return xe(e,this.cwd,{homeDir:j0(),trim:!0})}resolvePathFromBase(e,n){return xe(e,n,{homeDir:j0(),trim:!0})}collectPackageResources(e,n,i,s){if(i){for(let a of jp){let c=i[a],l=this.getTargetMap(n,a);c!==void 0?this.applyPackageFilter(e,c,a,l,s):this.collectDefaultResources(e,a,l,s)}return!0}let r=this.readPiManifest(e);if(r){for(let a of jp){let c=r[a];this.addManifestEntries(c,e,a,this.getTargetMap(n,a),s)}return!0}let o=!1;for(let a of jp){let c=be(e,a);if(ve(c)){let l=Gp(c,a);for(let u of l)this.addResource(this.getTargetMap(n,a),u,s,!0);o=!0}}return o}collectDefaultResources(e,n,i,s){let o=this.readPiManifest(e)?.[n];if(o){this.addManifestEntries(o,e,n,i,s);return}let a=be(e,n);if(ve(a)){let c=Gp(a,n);for(let l of c)this.addResource(i,l,s,!0)}}applyPackageFilter(e,n,i,s,r){let{allFiles:o}=this.collectManifestFiles(e,i);if(n.length===0){for(let c of o)this.addResource(s,c,r,!1);return}let a=Kp(o,n,e);for(let c of o){let l=a.has(c);this.addResource(s,c,r,l)}}collectManifestFiles(e,n){let s=this.readPiManifest(e)?.[n];if(s&&s.length>0){let a=this.collectFilesFromManifestEntries(s,e,n),c=s.filter(q0),l=c.length>0?Kp(a,c,e):new Set(a);return{allFiles:Array.from(l),enabledByManifest:l}}let r=be(e,n);if(!ve(r))return{allFiles:[],enabledByManifest:new Set};let o=Gp(r,n);return{allFiles:o,enabledByManifest:new Set(o)}}readPiManifest(e){let n=be(e,"package.json");if(!ve(n))return null;try{let i=Dl(n,"utf-8");return JSON.parse(i).pi??null}catch{return null}}addManifestEntries(e,n,i,s,r){if(!e)return;let o=this.collectFilesFromManifestEntries(e,n,i),a=e.filter(q0),c=Kp(o,a,n);for(let l of o)c.has(l)&&this.addResource(s,l,r,!0)}collectFilesFromManifestEntries(e,n,i){let r=e.filter(o=>!q0(o)).flatMap(o=>EN(o)?bN(o,{cwd:n,absolute:!0,dot:!1,nodir:!1}).map(a=>mi(a)):[mi(n,o)]);return this.collectFilesFromPaths(r,i)}resolveLocalEntries(e,n,i,s,r){if(e.length===0)return;let{plain:o,patterns:a}=AN(e),c=o.map(d=>this.resolvePathFromBase(d,r)),l=this.collectFilesFromPaths(c,n),u=Kp(l,a,r);for(let d of l)this.addResource(i,d,s,u.has(d))}addAutoDiscoveredResources(e,n,i,s,r){let o={source:"auto",scope:"user",origin:"top-level",baseDir:s},a={source:"auto",scope:"project",origin:"top-level",baseDir:r},c={extensions:n.extensions??[],skills:n.skills??[],prompts:n.prompts??[],themes:n.themes??[]},l={extensions:i.extensions??[],skills:i.skills??[],prompts:i.prompts??[],themes:i.themes??[]},u={extensions:be(s,"extensions"),skills:be(s,"skills"),prompts:be(s,"prompts"),themes:be(s,"themes")},d={extensions:be(r,"extensions"),skills:be(r,"skills"),prompts:be(r,"prompts"),themes:be(r,"themes")},p=be(j0(),".agents","skills"),m=this.settingsManager.isProjectTrusted(),g=m?LN(this.cwd).filter(v=>mi(v)!==mi(p)):[],h=(v,w,C,P,_)=>{let F=this.getTargetMap(e,v);for(let A of w){let W=DN(A,P,_);this.addResource(F,A,C,W)}};m&&(h("extensions",G0(d.extensions),a,l.extensions,r),h("skills",qp(d.skills,"pi"),a,l.skills,r));for(let v of g){let w=Fn(v),C={...a,baseDir:w};h("skills",qp(v,"agents"),C,l.skills,w)}m&&(h("prompts",QM(d.prompts),a,l.prompts,r),h("themes",YM(d.themes),a,l.themes,r)),h("extensions",G0(u.extensions),o,c.extensions,s),h("skills",qp(u.skills,"pi"),o,c.skills,s);let f=Fn(p),x={...o,baseDir:f};h("skills",qp(p,"agents"),x,c.skills,f),h("prompts",QM(u.prompts),o,c.prompts,s),h("themes",YM(u.themes),o,c.themes,s)}collectFilesFromPaths(e,n){let i=[];for(let s of e)if(ve(s))try{let r=Es(s);r.isFile()?i.push(s):r.isDirectory()&&i.push(...Gp(s,n))}catch{}return i}getTargetMap(e,n){switch(n){case"extensions":return e.extensions;case"skills":return e.skills;case"prompts":return e.prompts;case"themes":return e.themes;default:throw new Error(`Unknown resource type: ${n}`)}}addResource(e,n,i,s){n&&(e.has(n)||e.set(n,{metadata:i,enabled:s}))}createAccumulator(){return{extensions:new Map,skills:new Map,prompts:new Map,themes:new Map}}toResolvedPaths(e){let n=i=>{let s=Array.from(i.entries()).map(([o,{metadata:a,enabled:c}])=>({path:o,enabled:c,metadata:a}));s.sort((o,a)=>JM(o.metadata)-JM(a.metadata));let r=new Set;return s.filter(o=>{let a=oi(o.path);return r.has(a)?!1:(r.add(a),!0)})};return{extensions:n(e.extensions),skills:n(e.skills),prompts:n(e.prompts),themes:n(e.themes)}}spawnCommand(e,n,i){let s=N0();return ad(e,n,{cwd:i?.cwd,stdio:KM()?["ignore",2,2]:"inherit",env:s})}spawnCaptureCommand(e,n,i){let s=N0(),r=i?.env?{...s,...i.env}:s;return ad(e,n,{cwd:i?.cwd,stdio:["ignore","pipe","pipe"],env:r})}runCommandCapture(e,n,i){return new Promise((s,r)=>{let o=this.spawnCaptureCommand(e,n,i),a="",c="",l=!1,u=typeof i?.timeoutMs=="number"?setTimeout(()=>{l=!0,o.kill()},i.timeoutMs):void 0;o.stdout?.on("data",d=>{a+=d.toString()}),o.stderr?.on("data",d=>{c+=d.toString()}),o.once("error",d=>{u&&clearTimeout(u),r(d)}),o.once("close",(d,p)=>{if(u&&clearTimeout(u),l){r(new Error(`${e} ${n.join(" ")} timed out after ${i?.timeoutMs}ms`));return}if(d===0){s(a.trim());return}let m=d===null?`signal ${p??"unknown"}`:`code ${d}`;r(new Error(`${e} ${n.join(" ")} failed with ${m}: ${c||a}`))})})}runCommand(e,n,i){return new Promise((s,r)=>{let o=this.spawnCommand(e,n,i);o.on("error",r),o.on("exit",a=>{a===0?s():r(new Error(`${e} ${n.join(" ")} failed with code ${a}`))})})}runCommandSync(e,n){let i=N0(),s=ta(e,n,{stdio:["ignore","pipe","pipe"],encoding:"utf-8",env:i});if(s.error||s.status!==0)throw new Error(`Failed to run ${e} ${n.join(" ")}: ${s.error?.message||s.stderr||s.stdout}`);return(s.stdout||s.stderr||"").trim()}};import rwe from"chalk";import{randomUUID as $N}from"crypto";import{existsSync as t1,mkdirSync as BN,readFileSync as NN,writeFileSync as jN}from"fs";import{dirname as qN,join as n1}from"path";import GN from"proper-lockfile";import*as Ha from"undici";var z0=3e5,Jp=[{label:"30 sec",timeoutMs:3e4},{label:"1 min",timeoutMs:6e4},{label:"2 min",timeoutMs:12e4},{label:"5 min",timeoutMs:3e5},{label:"disabled",timeoutMs:0}];function Qp(t){if(typeof t=="string"){let e=t.trim();return e.toLowerCase()==="disabled"?0:e.length===0?void 0:Qp(Number(e))}if(!(typeof t!="number"||!Number.isFinite(t)||t<0))return Math.floor(t)}function Yp(t){let e=Jp.find(n=>n.timeoutMs===t);return e?e.label:`${t/1e3} sec`}function Nl(t=z0){let e=Qp(t);if(e===void 0)throw new Error(`Invalid HTTP idle timeout: ${String(t)}`);Ha.setGlobalDispatcher(new Ha.EnvHttpProxyAgent({allowH2:!1,bodyTimeout:e,headersTimeout:e})),Ha.install?.()}function Ar(t,e){let n={...t};for(let i of Object.keys(e)){let s=e[i],r=t[i];s!==void 0&&(typeof s=="object"&&s!==null&&!Array.isArray(s)&&typeof r=="object"&&r!==null&&!Array.isArray(r)?n[i]={...r,...s}:n[i]=s)}return n}function i1(t,e){let n=Qp(t);if(n!==void 0)return n;if(t!==void 0)throw new Error(`Invalid ${e} setting: ${String(t)}`)}var V0=class{constructor(e,n){let i=xe(e),s=xe(n);this.globalSettingsPath=n1(s,"settings.json"),this.projectSettingsPath=n1(i,mt,"settings.json")}acquireLockSyncWithRetry(e){let s;for(let r=1;r<=10;r++)try{return GN.lockSync(e,{realpath:!1})}catch(o){if((typeof o=="object"&&o!==null&&"code"in o?String(o.code):void 0)!=="ELOCKED"||r===10)throw o;s=o;let c=Date.now();for(;Date.now()-c<20;);}throw s??new Error("Failed to acquire settings lock")}withLock(e,n){let i=e==="global"?this.globalSettingsPath:this.projectSettingsPath,s=qN(i),r;try{let o=t1(i);o&&(r=this.acquireLockSyncWithRetry(i));let a=o?NN(i,"utf-8"):void 0,c=n(a);c!==void 0&&(t1(s)||BN(s,{recursive:!0}),r||(r=this.acquireLockSyncWithRetry(i)),jN(i,c,"utf-8"))}finally{r&&r()}}},J0=class{withLock(e,n){let i=e==="global"?this.global:this.project,s=n(i);s!==void 0&&(e==="global"?this.global=s:this.project=s)}},hi=class t{constructor(e,n,i,s=null,r=null,o=[],a=!0){this.modifiedFields=new Set;this.modifiedNestedFields=new Map;this.modifiedProjectFields=new Set;this.modifiedProjectNestedFields=new Map;this.globalSettingsLoadError=null;this.projectSettingsLoadError=null;this.writeQueue=Promise.resolve();this.storage=e,this.globalSettings=n,this.projectSettings=i,this.projectTrusted=a,this.globalSettingsLoadError=s,this.projectSettingsLoadError=r,this.errors=[...o],this.settings=Ar(this.globalSettings,this.projectSettings)}static create(e,n=Pe(),i={}){let s=new V0(e,n);return t.fromStorage(s,i)}static fromStorage(e,n={}){let i=n.projectTrusted??!0,s=t.tryLoadFromStorage(e,"global"),r=t.tryLoadFromStorage(e,"project",i),o=[];return s.error&&o.push({scope:"global",error:s.error}),r.error&&o.push({scope:"project",error:r.error}),new t(e,s.settings,r.settings,s.error,r.error,o,i)}static inMemory(e={}){let n=new J0,i=t.migrateSettings(structuredClone(e));return n.withLock("global",()=>JSON.stringify(i,null,2)),t.fromStorage(n)}static loadFromStorage(e,n,i=!0){if(n==="project"&&!i)return{};let s;if(e.withLock(n,o=>{s=o}),!s)return{};let r=JSON.parse(s);return t.migrateSettings(r)}static tryLoadFromStorage(e,n,i=!0){try{return{settings:t.loadFromStorage(e,n,i),error:null}}catch(s){return{settings:{},error:s}}}static migrateSettings(e){if("queueMode"in e&&!("steeringMode"in e)&&(e.steeringMode=e.queueMode,delete e.queueMode),!("transport"in e)&&typeof e.websockets=="boolean"&&(e.transport=e.websockets?"websocket":"sse",delete e.websockets),"skills"in e&&typeof e.skills=="object"&&e.skills!==null&&!Array.isArray(e.skills)){let n=e.skills;n.enableSkillCommands!==void 0&&e.enableSkillCommands===void 0&&(e.enableSkillCommands=n.enableSkillCommands),Array.isArray(n.customDirectories)&&n.customDirectories.length>0?e.skills=n.customDirectories:delete e.skills}if("retry"in e&&typeof e.retry=="object"&&e.retry!==null&&!Array.isArray(e.retry)){let n=e.retry,i=typeof n.provider=="object"&&n.provider!==null?n.provider:void 0;typeof n.maxDelayMs=="number"&&(i?.maxRetryDelayMs===void 0||i?.maxRetryDelayMs===null)&&(n.provider={...i??{},maxRetryDelayMs:n.maxDelayMs}),delete n.maxDelayMs}return e}getGlobalSettings(){return structuredClone(this.globalSettings)}getProjectSettings(){return structuredClone(this.projectSettings)}isProjectTrusted(){return this.projectTrusted}setProjectTrusted(e){if(this.projectTrusted===e)return;if(this.projectTrusted=e,this.modifiedProjectFields.clear(),this.modifiedProjectNestedFields.clear(),!e){this.projectSettings={},this.projectSettingsLoadError=null,this.settings=Ar(this.globalSettings,this.projectSettings);return}let n=t.tryLoadFromStorage(this.storage,"project",e);this.projectSettings=n.settings,this.projectSettingsLoadError=n.error,n.error&&this.recordError("project",n.error),this.settings=Ar(this.globalSettings,this.projectSettings)}async reload(){await this.writeQueue;let e=t.tryLoadFromStorage(this.storage,"global");e.error?(this.globalSettingsLoadError=e.error,this.recordError("global",e.error)):(this.globalSettings=e.settings,this.globalSettingsLoadError=null),this.modifiedFields.clear(),this.modifiedNestedFields.clear(),this.modifiedProjectFields.clear(),this.modifiedProjectNestedFields.clear();let n=t.tryLoadFromStorage(this.storage,"project",this.projectTrusted);n.error?(this.projectSettingsLoadError=n.error,this.recordError("project",n.error)):(this.projectSettings=n.settings,this.projectSettingsLoadError=null),this.settings=Ar(this.globalSettings,this.projectSettings)}applyOverrides(e){this.settings=Ar(this.settings,e)}markModified(e,n){this.modifiedFields.add(e),n&&(this.modifiedNestedFields.has(e)||this.modifiedNestedFields.set(e,new Set),this.modifiedNestedFields.get(e).add(n))}markProjectModified(e,n){this.modifiedProjectFields.add(e),n&&(this.modifiedProjectNestedFields.has(e)||this.modifiedProjectNestedFields.set(e,new Set),this.modifiedProjectNestedFields.get(e).add(n))}assertProjectTrustedForWrite(){if(!this.projectTrusted)throw new Error("Project is not trusted; refusing to write project settings")}recordError(e,n){let i=n instanceof Error?n:new Error(String(n));this.errors.push({scope:e,error:i})}clearModifiedScope(e){if(e==="global"){this.modifiedFields.clear(),this.modifiedNestedFields.clear();return}this.modifiedProjectFields.clear(),this.modifiedProjectNestedFields.clear()}enqueueWrite(e,n){this.writeQueue=this.writeQueue.then(()=>{e==="project"&&this.assertProjectTrustedForWrite(),n(),this.clearModifiedScope(e)}).catch(i=>{this.recordError(e,i)})}cloneModifiedNestedFields(e){let n=new Map;for(let[i,s]of e.entries())n.set(i,new Set(s));return n}persistScopedSettings(e,n,i,s){this.storage.withLock(e,r=>{let o=r?t.migrateSettings(JSON.parse(r)):{},a={...o};for(let c of i){let l=n[c];if(s.has(c)&&typeof l=="object"&&l!==null){let u=s.get(c),d=o[c]??{},p=l,m={...d};for(let g of u)m[g]=p[g];a[c]=m}else a[c]=l}return JSON.stringify(a,null,2)})}save(){if(this.settings=Ar(this.globalSettings,this.projectSettings),this.globalSettingsLoadError)return;let e=structuredClone(this.globalSettings),n=new Set(this.modifiedFields),i=this.cloneModifiedNestedFields(this.modifiedNestedFields);this.enqueueWrite("global",()=>{this.persistScopedSettings("global",e,n,i)})}saveProjectSettings(e){if(this.assertProjectTrustedForWrite(),this.projectSettings=structuredClone(e),this.settings=Ar(this.globalSettings,this.projectSettings),this.projectSettingsLoadError)return;let n=structuredClone(this.projectSettings),i=new Set(this.modifiedProjectFields),s=this.cloneModifiedNestedFields(this.modifiedProjectNestedFields);this.enqueueWrite("project",()=>{this.persistScopedSettings("project",n,i,s)})}updateProjectSettings(e,n){this.assertProjectTrustedForWrite();let i=structuredClone(this.projectSettings);n(i),this.markProjectModified(e),this.saveProjectSettings(i)}async flush(){await this.writeQueue}drainErrors(){let e=[...this.errors];return this.errors=[],e}getLastChangelogVersion(){return this.settings.lastChangelogVersion}setLastChangelogVersion(e){this.globalSettings.lastChangelogVersion=e,this.markModified("lastChangelogVersion"),this.save()}getSessionDir(){let e=this.settings.sessionDir;return e&&et(e)}getDefaultProvider(){return this.settings.defaultProvider}getDefaultModel(){return this.settings.defaultModel}setDefaultProvider(e){this.globalSettings.defaultProvider=e,this.markModified("defaultProvider"),this.save()}setDefaultModel(e){this.globalSettings.defaultModel=e,this.markModified("defaultModel"),this.save()}setDefaultModelAndProvider(e,n){this.globalSettings.defaultProvider=e,this.globalSettings.defaultModel=n,this.markModified("defaultProvider"),this.markModified("defaultModel"),this.save()}getSteeringMode(){return this.settings.steeringMode||"one-at-a-time"}setSteeringMode(e){this.globalSettings.steeringMode=e,this.markModified("steeringMode"),this.save()}getFollowUpMode(){return this.settings.followUpMode||"one-at-a-time"}setFollowUpMode(e){this.globalSettings.followUpMode=e,this.markModified("followUpMode"),this.save()}getTheme(){return this.settings.theme}setTheme(e){this.globalSettings.theme=e,this.markModified("theme"),this.save()}getDefaultThinkingLevel(){return this.settings.defaultThinkingLevel}setDefaultThinkingLevel(e){this.globalSettings.defaultThinkingLevel=e,this.markModified("defaultThinkingLevel"),this.save()}getTransport(){return this.settings.transport??"auto"}setTransport(e){this.globalSettings.transport=e,this.markModified("transport"),this.save()}getCompactionEnabled(){return this.settings.compaction?.enabled??!0}setCompactionEnabled(e){this.globalSettings.compaction||(this.globalSettings.compaction={}),this.globalSettings.compaction.enabled=e,this.markModified("compaction","enabled"),this.save()}getCompactionReserveTokens(){return this.settings.compaction?.reserveTokens??16384}getCompactionKeepRecentTokens(){return this.settings.compaction?.keepRecentTokens??2e4}getCompactionSettings(){return{enabled:this.getCompactionEnabled(),reserveTokens:this.getCompactionReserveTokens(),keepRecentTokens:this.getCompactionKeepRecentTokens()}}getBranchSummarySettings(){return{reserveTokens:this.settings.branchSummary?.reserveTokens??16384,skipPrompt:this.settings.branchSummary?.skipPrompt??!1}}getBranchSummarySkipPrompt(){return this.settings.branchSummary?.skipPrompt??!1}getRetryEnabled(){return this.settings.retry?.enabled??!0}setRetryEnabled(e){this.globalSettings.retry||(this.globalSettings.retry={}),this.globalSettings.retry.enabled=e,this.markModified("retry","enabled"),this.save()}getRetrySettings(){return{enabled:this.getRetryEnabled(),maxRetries:this.settings.retry?.maxRetries??3,baseDelayMs:this.settings.retry?.baseDelayMs??2e3}}getHttpIdleTimeoutMs(){return i1(this.settings.httpIdleTimeoutMs,"httpIdleTimeoutMs")??z0}setHttpIdleTimeoutMs(e){if(!Number.isFinite(e)||e<0)throw new Error(`Invalid httpIdleTimeoutMs setting: ${String(e)}`);this.globalSettings.httpIdleTimeoutMs=Math.floor(e),this.markModified("httpIdleTimeoutMs"),this.save()}getProviderRetrySettings(){return{timeoutMs:this.settings.retry?.provider?.timeoutMs,maxRetries:this.settings.retry?.provider?.maxRetries,maxRetryDelayMs:this.settings.retry?.provider?.maxRetryDelayMs??6e4}}getWebSocketConnectTimeoutMs(){return i1(this.settings.websocketConnectTimeoutMs,"websocketConnectTimeoutMs")}getHideThinkingBlock(){return this.settings.hideThinkingBlock??!1}setHideThinkingBlock(e){this.globalSettings.hideThinkingBlock=e,this.markModified("hideThinkingBlock"),this.save()}getShellPath(){return this.settings.shellPath}setShellPath(e){this.globalSettings.shellPath=e,this.markModified("shellPath"),this.save()}getQuietStartup(){return this.settings.quietStartup??!1}setQuietStartup(e){this.globalSettings.quietStartup=e,this.markModified("quietStartup"),this.save()}getDefaultProjectTrust(){let e=this.globalSettings.defaultProjectTrust;return e==="always"||e==="never"?e:"ask"}setDefaultProjectTrust(e){this.globalSettings.defaultProjectTrust=e,this.markModified("defaultProjectTrust"),this.save()}getShellCommandPrefix(){return this.settings.shellCommandPrefix}setShellCommandPrefix(e){this.globalSettings.shellCommandPrefix=e,this.markModified("shellCommandPrefix"),this.save()}getNpmCommand(){return this.settings.npmCommand?[...this.settings.npmCommand]:void 0}setNpmCommand(e){this.globalSettings.npmCommand=e?[...e]:void 0,this.markModified("npmCommand"),this.save()}getCollapseChangelog(){return this.settings.collapseChangelog??!1}setCollapseChangelog(e){this.globalSettings.collapseChangelog=e,this.markModified("collapseChangelog"),this.save()}getEnableInstallTelemetry(){return this.settings.enableInstallTelemetry??!0}setEnableInstallTelemetry(e){this.globalSettings.enableInstallTelemetry=e,this.markModified("enableInstallTelemetry"),this.save()}getEnableAnalytics(){return this.settings.enableAnalytics??!1}getTrackingId(){return this.settings.trackingId}setEnableAnalytics(e){this.globalSettings.enableAnalytics=e,this.markModified("enableAnalytics"),e&&!this.globalSettings.trackingId&&(this.globalSettings.trackingId=$N(),this.markModified("trackingId")),this.save()}getPackages(){return[...this.settings.packages??[]]}setPackages(e){this.globalSettings.packages=e,this.markModified("packages"),this.save()}setProjectPackages(e){this.updateProjectSettings("packages",n=>{n.packages=e})}getExtensionPaths(){return[...this.settings.extensions??[]]}setExtensionPaths(e){this.globalSettings.extensions=e,this.markModified("extensions"),this.save()}setProjectExtensionPaths(e){this.updateProjectSettings("extensions",n=>{n.extensions=e})}getSkillPaths(){return[...this.settings.skills??[]]}setSkillPaths(e){this.globalSettings.skills=e,this.markModified("skills"),this.save()}setProjectSkillPaths(e){this.updateProjectSettings("skills",n=>{n.skills=e})}getPromptTemplatePaths(){return[...this.settings.prompts??[]]}setPromptTemplatePaths(e){this.globalSettings.prompts=e,this.markModified("prompts"),this.save()}setProjectPromptTemplatePaths(e){this.updateProjectSettings("prompts",n=>{n.prompts=e})}getThemePaths(){return[...this.settings.themes??[]]}setThemePaths(e){this.globalSettings.themes=e,this.markModified("themes"),this.save()}setProjectThemePaths(e){this.updateProjectSettings("themes",n=>{n.themes=e})}getEnableSkillCommands(){return this.settings.enableSkillCommands??!0}setEnableSkillCommands(e){this.globalSettings.enableSkillCommands=e,this.markModified("enableSkillCommands"),this.save()}getThinkingBudgets(){return this.settings.thinkingBudgets}getShowImages(){return this.settings.terminal?.showImages??!0}setShowImages(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.showImages=e,this.markModified("terminal","showImages"),this.save()}getImageWidthCells(){let e=this.settings.terminal?.imageWidthCells;return typeof e!="number"||!Number.isFinite(e)?60:Math.max(1,Math.floor(e))}setImageWidthCells(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.imageWidthCells=Math.max(1,Math.floor(e)),this.markModified("terminal","imageWidthCells"),this.save()}getClearOnShrink(){return this.settings.terminal?.clearOnShrink!==void 0?this.settings.terminal.clearOnShrink:process.env.PI_CLEAR_ON_SHRINK==="1"}setClearOnShrink(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.clearOnShrink=e,this.markModified("terminal","clearOnShrink"),this.save()}getShowTerminalProgress(){return this.settings.terminal?.showTerminalProgress??!1}setShowTerminalProgress(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.showTerminalProgress=e,this.markModified("terminal","showTerminalProgress"),this.save()}getImageAutoResize(){return this.settings.images?.autoResize??!0}setImageAutoResize(e){this.globalSettings.images||(this.globalSettings.images={}),this.globalSettings.images.autoResize=e,this.markModified("images","autoResize"),this.save()}getBlockImages(){return this.settings.images?.blockImages??!1}setBlockImages(e){this.globalSettings.images||(this.globalSettings.images={}),this.globalSettings.images.blockImages=e,this.markModified("images","blockImages"),this.save()}getEnabledModels(){return this.settings.enabledModels}setEnabledModels(e){this.globalSettings.enabledModels=e,this.markModified("enabledModels"),this.save()}getDoubleEscapeAction(){return this.settings.doubleEscapeAction??"tree"}setDoubleEscapeAction(e){this.globalSettings.doubleEscapeAction=e,this.markModified("doubleEscapeAction"),this.save()}getTreeFilterMode(){let e=this.settings.treeFilterMode;return e&&["default","no-tools","user-only","labeled-only","all"].includes(e)?e:"default"}setTreeFilterMode(e){this.globalSettings.treeFilterMode=e,this.markModified("treeFilterMode"),this.save()}getShowHardwareCursor(){return this.settings.showHardwareCursor??process.env.PI_HARDWARE_CURSOR==="1"}setShowHardwareCursor(e){this.globalSettings.showHardwareCursor=e,this.markModified("showHardwareCursor"),this.save()}getEditorPaddingX(){return this.settings.editorPaddingX??0}setEditorPaddingX(e){this.globalSettings.editorPaddingX=Math.max(0,Math.min(3,Math.floor(e))),this.markModified("editorPaddingX"),this.save()}getAutocompleteMaxVisible(){return this.settings.autocompleteMaxVisible??5}setAutocompleteMaxVisible(e){this.globalSettings.autocompleteMaxVisible=Math.max(3,Math.min(20,Math.floor(e))),this.markModified("autocompleteMaxVisible"),this.save()}getCodeBlockIndent(){return this.settings.markdown?.codeBlockIndent??" "}getWarnings(){return{...this.settings.warnings??{}}}setWarnings(e){this.globalSettings.warnings={...e},this.markModified("warnings"),this.save()}};import{Agent as Vwe}from"@earendil-works/pi-agent-core";import Q0 from"chalk";import{minimatch as s1}from"minimatch";var X0={"amazon-bedrock":"us.anthropic.claude-opus-4-6-v1","ant-ling":"Ring-2.6-1T",anthropic:"claude-opus-4-8",openai:"gpt-5.4","azure-openai-responses":"gpt-5.4","openai-codex":"gpt-5.5",nvidia:"nvidia/nemotron-3-super-120b-a12b",deepseek:"deepseek-v4-pro",google:"gemini-3.1-pro-preview","google-vertex":"gemini-3.1-pro-preview","github-copilot":"gpt-5.4",openrouter:"moonshotai/kimi-k2.6","vercel-ai-gateway":"zai/glm-5.1",xai:"grok-4.20-0309-reasoning",groq:"openai/gpt-oss-120b",cerebras:"zai-glm-4.7",zai:"glm-5.1","zai-coding-cn":"glm-5.1",mistral:"devstral-medium-latest",minimax:"MiniMax-M2.7","minimax-cn":"MiniMax-M2.7",moonshotai:"kimi-k2.6","moonshotai-cn":"kimi-k2.6",huggingface:"moonshotai/Kimi-K2.6",fireworks:"accounts/fireworks/models/kimi-k2p6",together:"moonshotai/Kimi-K2.6",opencode:"kimi-k2.6","opencode-go":"kimi-k2.6","kimi-coding":"kimi-for-coding","cloudflare-workers-ai":"@cf/moonshotai/kimi-k2.6","cloudflare-ai-gateway":"workers-ai/@cf/moonshotai/kimi-k2.6",xiaomi:"mimo-v2.5-pro","xiaomi-token-plan-cn":"mimo-v2.5-pro","xiaomi-token-plan-ams":"mimo-v2.5-pro","xiaomi-token-plan-sgp":"mimo-v2.5-pro"};function r1(t){return t.endsWith("-latest")?!0:!/-\d{8}$/.test(t)}function Z0(t,e){let n=t.trim();if(!n)return;let i=n.toLowerCase(),s=e.filter(a=>`${a.provider}/${a.id}`.toLowerCase()===i);if(s.length===1)return s[0];if(s.length>1)return;let r=n.indexOf("/");if(r!==-1){let a=n.substring(0,r).trim(),c=n.substring(r+1).trim();if(a&&c){let l=e.filter(u=>u.provider.toLowerCase()===a.toLowerCase()&&u.id.toLowerCase()===c.toLowerCase());if(l.length===1)return l[0];if(l.length>1)return}}let o=e.filter(a=>a.id.toLowerCase()===i);return o.length===1?o[0]:void 0}function HN(t,e){let n=Z0(t,e);if(n)return n;let i=e.filter(o=>o.id.toLowerCase().includes(t.toLowerCase())||o.name?.toLowerCase().includes(t.toLowerCase()));if(i.length===0)return;let s=i.filter(o=>r1(o.id)),r=i.filter(o=>!r1(o.id));return s.length>0?(s.sort((o,a)=>a.id.localeCompare(o.id)),s[0]):(r.sort((o,a)=>a.id.localeCompare(o.id)),r[0])}function Y0(t,e,n){let i=HN(t,e);if(i)return{model:i,thinkingLevel:void 0,warning:void 0};let s=t.lastIndexOf(":");if(s===-1)return{model:void 0,thinkingLevel:void 0,warning:void 0};let r=t.substring(0,s),o=t.substring(s+1);if(Eg(o)){let a=Y0(r,e,n);return a.model?{model:a.model,thinkingLevel:a.warning?void 0:o,warning:a.warning}:a}else{if(!(n?.allowInvalidThinkingLevelFallback??!0))return{model:void 0,thinkingLevel:void 0,warning:void 0};let c=Y0(r,e,n);return c.model?{model:c.model,thinkingLevel:void 0,warning:`Invalid thinking level "${o}" in pattern "${t}". Using default instead.`}:c}}async function Xp(t,e){let n=await e.getAvailable(),i=[];for(let s of t){if(s.includes("*")||s.includes("?")||s.includes("[")){let c=s.lastIndexOf(":"),l=s,u;if(c!==-1){let p=s.substring(c+1);Eg(p)&&(u=p,l=s.substring(0,c))}let d=n.filter(p=>{let m=`${p.provider}/${p.id}`;return s1(m,l,{nocase:!0})||s1(p.id,l,{nocase:!0})});if(d.length===0){console.warn(Q0.yellow(`Warning: No models match pattern "${s}"`));continue}for(let p of d)i.find(m=>zn(m.model,p))||i.push({model:p,thinkingLevel:u});continue}let{model:r,thinkingLevel:o,warning:a}=Y0(s,n);if(a&&console.warn(Q0.yellow(`Warning: ${a}`)),!r){console.warn(Q0.yellow(`Warning: No models match pattern "${s}"`));continue}i.find(c=>zn(c.model,r))||i.push({model:r,thinkingLevel:o})}return i}function zN(t){return t?t==="1"||t.toLowerCase()==="true"||t.toLowerCase()==="yes":!1}function eb(t,e=process.env.PI_TELEMETRY){return e!==void 0?zN(e):t.getEnableInstallTelemetry()}var Mwe=process.env.PI_TIMING==="1";var Rwe=Date.now();function VN(t){let e=t.sessionFile?`
|
|
288
|
+
`,"utf-8")}getNpmInstallRoot(e,n){return n?this.getTemporaryDir("npm"):e==="project"?(this.assertProjectTrustedForScope(e),be(this.cwd,mt,"npm")):be(this.agentDir,"npm")}getGlobalNpmRoot(){let e=this.getNpmCommand(),n=[e.command,...e.args].join("\0");if(this.globalNpmRoot&&this.globalNpmRootCommandKey===n)return this.globalNpmRoot;if(this.getPackageManagerName()==="bun"){let i=this.runNpmCommandSync(["pm","bin","-g"]).trim();this.globalNpmRoot=be(Fn(i),"install","global","node_modules")}else this.globalNpmRoot=this.runNpmCommandSync(["root","-g"]).trim();return this.globalNpmRootCommandKey=n,this.globalNpmRoot}getPnpmGlobalPackagePath(e){if(this.getPackageManagerName()!=="pnpm")return;let n=this.runNpmCommandSync(["list","-g","--depth","0","--json"]),i=JSON.parse(n);for(let s of i){let r=s.dependencies?.[e]?.path;if(r)return r}}getManagedNpmInstallPath(e,n){return n==="temporary"?be(this.getTemporaryDir("npm"),"node_modules",e.name):n==="project"?(this.assertProjectTrustedForScope(n),be(this.cwd,mt,"npm","node_modules",e.name)):be(this.agentDir,"npm","node_modules",e.name)}getLegacyGlobalNpmInstallPath(e){try{return this.getPnpmGlobalPackagePath(e.name)??be(this.getGlobalNpmRoot(),e.name)}catch{return}}getNpmInstallPath(e,n){let i=this.getManagedNpmInstallPath(e,n);if(n!=="user"||ve(i))return i;let s=this.getLegacyGlobalNpmInstallPath(e);return s&&ve(s)?s:i}getGitInstallPath(e,n){if(n==="temporary")return this.getTemporaryDir(`git-${e.host}`,e.path);let i=this.getGitInstallRoot(n);if(!i)throw new Error("Missing git install root");return this.resolveManagedPath(i,e.host,e.path)}getGitInstallRoot(e){if(e!=="temporary")return e==="project"?(this.assertProjectTrustedForScope(e),be(this.cwd,mt,"git")):be(this.agentDir,"git")}getTemporaryDir(e,n){let i=this.resolveManagedPath(IN(this.agentDir),e),s=hN("sha256").update(`${e}-${n??""}`).digest("hex").slice(0,8);return this.resolveManagedPath(i,s,n??"")}resolveManagedPath(e,...n){let i=mi(e),s=mi(i,...n);if(s!==i&&!s.startsWith(`${i}${Z1}`))throw new Error(`Refusing to use path outside package install root: ${s}`);return s}getBaseDirForScope(e){return e==="project"?(this.assertProjectTrustedForScope(e),be(this.cwd,mt)):e==="user"?this.agentDir:this.cwd}resolvePath(e){return xe(e,this.cwd,{homeDir:j0(),trim:!0})}resolvePathFromBase(e,n){return xe(e,n,{homeDir:j0(),trim:!0})}collectPackageResources(e,n,i,s){if(i){for(let a of jp){let c=i[a],l=this.getTargetMap(n,a);c!==void 0?this.applyPackageFilter(e,c,a,l,s):this.collectDefaultResources(e,a,l,s)}return!0}let r=this.readPiManifest(e);if(r){for(let a of jp){let c=r[a];this.addManifestEntries(c,e,a,this.getTargetMap(n,a),s)}return!0}let o=!1;for(let a of jp){let c=be(e,a);if(ve(c)){let l=Gp(c,a);for(let u of l)this.addResource(this.getTargetMap(n,a),u,s,!0);o=!0}}return o}collectDefaultResources(e,n,i,s){let o=this.readPiManifest(e)?.[n];if(o){this.addManifestEntries(o,e,n,i,s);return}let a=be(e,n);if(ve(a)){let c=Gp(a,n);for(let l of c)this.addResource(i,l,s,!0)}}applyPackageFilter(e,n,i,s,r){let{allFiles:o}=this.collectManifestFiles(e,i);if(n.length===0){for(let c of o)this.addResource(s,c,r,!1);return}let a=Kp(o,n,e);for(let c of o){let l=a.has(c);this.addResource(s,c,r,l)}}collectManifestFiles(e,n){let s=this.readPiManifest(e)?.[n];if(s&&s.length>0){let a=this.collectFilesFromManifestEntries(s,e,n),c=s.filter(q0),l=c.length>0?Kp(a,c,e):new Set(a);return{allFiles:Array.from(l),enabledByManifest:l}}let r=be(e,n);if(!ve(r))return{allFiles:[],enabledByManifest:new Set};let o=Gp(r,n);return{allFiles:o,enabledByManifest:new Set(o)}}readPiManifest(e){let n=be(e,"package.json");if(!ve(n))return null;try{let i=Dl(n,"utf-8");return JSON.parse(i).pi??null}catch{return null}}addManifestEntries(e,n,i,s,r){if(!e)return;let o=this.collectFilesFromManifestEntries(e,n,i),a=e.filter(q0),c=Kp(o,a,n);for(let l of o)c.has(l)&&this.addResource(s,l,r,!0)}collectFilesFromManifestEntries(e,n,i){let r=e.filter(o=>!q0(o)).flatMap(o=>EN(o)?bN(o,{cwd:n,absolute:!0,dot:!1,nodir:!1}).map(a=>mi(a)):[mi(n,o)]);return this.collectFilesFromPaths(r,i)}resolveLocalEntries(e,n,i,s,r){if(e.length===0)return;let{plain:o,patterns:a}=AN(e),c=o.map(d=>this.resolvePathFromBase(d,r)),l=this.collectFilesFromPaths(c,n),u=Kp(l,a,r);for(let d of l)this.addResource(i,d,s,u.has(d))}addAutoDiscoveredResources(e,n,i,s,r){let o={source:"auto",scope:"user",origin:"top-level",baseDir:s},a={source:"auto",scope:"project",origin:"top-level",baseDir:r},c={extensions:n.extensions??[],skills:n.skills??[],prompts:n.prompts??[],themes:n.themes??[]},l={extensions:i.extensions??[],skills:i.skills??[],prompts:i.prompts??[],themes:i.themes??[]},u={extensions:be(s,"extensions"),skills:be(s,"skills"),prompts:be(s,"prompts"),themes:be(s,"themes")},d={extensions:be(r,"extensions"),skills:be(r,"skills"),prompts:be(r,"prompts"),themes:be(r,"themes")},p=be(j0(),".agents","skills"),m=this.settingsManager.isProjectTrusted(),g=m?LN(this.cwd).filter(v=>mi(v)!==mi(p)):[],h=(v,w,C,P,_)=>{let F=this.getTargetMap(e,v);for(let A of w){let W=DN(A,P,_);this.addResource(F,A,C,W)}};m&&(h("extensions",G0(d.extensions),a,l.extensions,r),h("skills",qp(d.skills,"pi"),a,l.skills,r));for(let v of g){let w=Fn(v),C={...a,baseDir:w};h("skills",qp(v,"agents"),C,l.skills,w)}m&&(h("prompts",Q1(d.prompts),a,l.prompts,r),h("themes",Y1(d.themes),a,l.themes,r)),h("extensions",G0(u.extensions),o,c.extensions,s),h("skills",qp(u.skills,"pi"),o,c.skills,s);let f=Fn(p),x={...o,baseDir:f};h("skills",qp(p,"agents"),x,c.skills,f),h("prompts",Q1(u.prompts),o,c.prompts,s),h("themes",Y1(u.themes),o,c.themes,s)}collectFilesFromPaths(e,n){let i=[];for(let s of e)if(ve(s))try{let r=Es(s);r.isFile()?i.push(s):r.isDirectory()&&i.push(...Gp(s,n))}catch{}return i}getTargetMap(e,n){switch(n){case"extensions":return e.extensions;case"skills":return e.skills;case"prompts":return e.prompts;case"themes":return e.themes;default:throw new Error(`Unknown resource type: ${n}`)}}addResource(e,n,i,s){n&&(e.has(n)||e.set(n,{metadata:i,enabled:s}))}createAccumulator(){return{extensions:new Map,skills:new Map,prompts:new Map,themes:new Map}}toResolvedPaths(e){let n=i=>{let s=Array.from(i.entries()).map(([o,{metadata:a,enabled:c}])=>({path:o,enabled:c,metadata:a}));s.sort((o,a)=>J1(o.metadata)-J1(a.metadata));let r=new Set;return s.filter(o=>{let a=oi(o.path);return r.has(a)?!1:(r.add(a),!0)})};return{extensions:n(e.extensions),skills:n(e.skills),prompts:n(e.prompts),themes:n(e.themes)}}spawnCommand(e,n,i){let s=N0();return ad(e,n,{cwd:i?.cwd,stdio:K1()?["ignore",2,2]:"inherit",env:s})}spawnCaptureCommand(e,n,i){let s=N0(),r=i?.env?{...s,...i.env}:s;return ad(e,n,{cwd:i?.cwd,stdio:["ignore","pipe","pipe"],env:r})}runCommandCapture(e,n,i){return new Promise((s,r)=>{let o=this.spawnCaptureCommand(e,n,i),a="",c="",l=!1,u=typeof i?.timeoutMs=="number"?setTimeout(()=>{l=!0,o.kill()},i.timeoutMs):void 0;o.stdout?.on("data",d=>{a+=d.toString()}),o.stderr?.on("data",d=>{c+=d.toString()}),o.once("error",d=>{u&&clearTimeout(u),r(d)}),o.once("close",(d,p)=>{if(u&&clearTimeout(u),l){r(new Error(`${e} ${n.join(" ")} timed out after ${i?.timeoutMs}ms`));return}if(d===0){s(a.trim());return}let m=d===null?`signal ${p??"unknown"}`:`code ${d}`;r(new Error(`${e} ${n.join(" ")} failed with ${m}: ${c||a}`))})})}runCommand(e,n,i){return new Promise((s,r)=>{let o=this.spawnCommand(e,n,i);o.on("error",r),o.on("exit",a=>{a===0?s():r(new Error(`${e} ${n.join(" ")} failed with code ${a}`))})})}runCommandSync(e,n){let i=N0(),s=ta(e,n,{stdio:["ignore","pipe","pipe"],encoding:"utf-8",env:i});if(s.error||s.status!==0)throw new Error(`Failed to run ${e} ${n.join(" ")}: ${s.error?.message||s.stderr||s.stdout}`);return(s.stdout||s.stderr||"").trim()}};import rwe from"chalk";import{randomUUID as $N}from"crypto";import{existsSync as tM,mkdirSync as BN,readFileSync as NN,writeFileSync as jN}from"fs";import{dirname as qN,join as nM}from"path";import GN from"proper-lockfile";import*as Ha from"undici";var z0=3e5,Jp=[{label:"30 sec",timeoutMs:3e4},{label:"1 min",timeoutMs:6e4},{label:"2 min",timeoutMs:12e4},{label:"5 min",timeoutMs:3e5},{label:"disabled",timeoutMs:0}];function Qp(t){if(typeof t=="string"){let e=t.trim();return e.toLowerCase()==="disabled"?0:e.length===0?void 0:Qp(Number(e))}if(!(typeof t!="number"||!Number.isFinite(t)||t<0))return Math.floor(t)}function Yp(t){let e=Jp.find(n=>n.timeoutMs===t);return e?e.label:`${t/1e3} sec`}function Nl(t=z0){let e=Qp(t);if(e===void 0)throw new Error(`Invalid HTTP idle timeout: ${String(t)}`);Ha.setGlobalDispatcher(new Ha.EnvHttpProxyAgent({allowH2:!1,bodyTimeout:e,headersTimeout:e})),Ha.install?.()}function Ar(t,e){let n={...t};for(let i of Object.keys(e)){let s=e[i],r=t[i];s!==void 0&&(typeof s=="object"&&s!==null&&!Array.isArray(s)&&typeof r=="object"&&r!==null&&!Array.isArray(r)?n[i]={...r,...s}:n[i]=s)}return n}function iM(t,e){let n=Qp(t);if(n!==void 0)return n;if(t!==void 0)throw new Error(`Invalid ${e} setting: ${String(t)}`)}var V0=class{constructor(e,n){let i=xe(e),s=xe(n);this.globalSettingsPath=nM(s,"settings.json"),this.projectSettingsPath=nM(i,mt,"settings.json")}acquireLockSyncWithRetry(e){let s;for(let r=1;r<=10;r++)try{return GN.lockSync(e,{realpath:!1})}catch(o){if((typeof o=="object"&&o!==null&&"code"in o?String(o.code):void 0)!=="ELOCKED"||r===10)throw o;s=o;let c=Date.now();for(;Date.now()-c<20;);}throw s??new Error("Failed to acquire settings lock")}withLock(e,n){let i=e==="global"?this.globalSettingsPath:this.projectSettingsPath,s=qN(i),r;try{let o=tM(i);o&&(r=this.acquireLockSyncWithRetry(i));let a=o?NN(i,"utf-8"):void 0,c=n(a);c!==void 0&&(tM(s)||BN(s,{recursive:!0}),r||(r=this.acquireLockSyncWithRetry(i)),jN(i,c,"utf-8"))}finally{r&&r()}}},J0=class{withLock(e,n){let i=e==="global"?this.global:this.project,s=n(i);s!==void 0&&(e==="global"?this.global=s:this.project=s)}},hi=class t{constructor(e,n,i,s=null,r=null,o=[],a=!0){this.modifiedFields=new Set;this.modifiedNestedFields=new Map;this.modifiedProjectFields=new Set;this.modifiedProjectNestedFields=new Map;this.globalSettingsLoadError=null;this.projectSettingsLoadError=null;this.writeQueue=Promise.resolve();this.storage=e,this.globalSettings=n,this.projectSettings=i,this.projectTrusted=a,this.globalSettingsLoadError=s,this.projectSettingsLoadError=r,this.errors=[...o],this.settings=Ar(this.globalSettings,this.projectSettings)}static create(e,n=Pe(),i={}){let s=new V0(e,n);return t.fromStorage(s,i)}static fromStorage(e,n={}){let i=n.projectTrusted??!0,s=t.tryLoadFromStorage(e,"global"),r=t.tryLoadFromStorage(e,"project",i),o=[];return s.error&&o.push({scope:"global",error:s.error}),r.error&&o.push({scope:"project",error:r.error}),new t(e,s.settings,r.settings,s.error,r.error,o,i)}static inMemory(e={}){let n=new J0,i=t.migrateSettings(structuredClone(e));return n.withLock("global",()=>JSON.stringify(i,null,2)),t.fromStorage(n)}static loadFromStorage(e,n,i=!0){if(n==="project"&&!i)return{};let s;if(e.withLock(n,o=>{s=o}),!s)return{};let r=JSON.parse(s);return t.migrateSettings(r)}static tryLoadFromStorage(e,n,i=!0){try{return{settings:t.loadFromStorage(e,n,i),error:null}}catch(s){return{settings:{},error:s}}}static migrateSettings(e){if("queueMode"in e&&!("steeringMode"in e)&&(e.steeringMode=e.queueMode,delete e.queueMode),!("transport"in e)&&typeof e.websockets=="boolean"&&(e.transport=e.websockets?"websocket":"sse",delete e.websockets),"skills"in e&&typeof e.skills=="object"&&e.skills!==null&&!Array.isArray(e.skills)){let n=e.skills;n.enableSkillCommands!==void 0&&e.enableSkillCommands===void 0&&(e.enableSkillCommands=n.enableSkillCommands),Array.isArray(n.customDirectories)&&n.customDirectories.length>0?e.skills=n.customDirectories:delete e.skills}if("retry"in e&&typeof e.retry=="object"&&e.retry!==null&&!Array.isArray(e.retry)){let n=e.retry,i=typeof n.provider=="object"&&n.provider!==null?n.provider:void 0;typeof n.maxDelayMs=="number"&&(i?.maxRetryDelayMs===void 0||i?.maxRetryDelayMs===null)&&(n.provider={...i??{},maxRetryDelayMs:n.maxDelayMs}),delete n.maxDelayMs}return e}getGlobalSettings(){return structuredClone(this.globalSettings)}getProjectSettings(){return structuredClone(this.projectSettings)}isProjectTrusted(){return this.projectTrusted}setProjectTrusted(e){if(this.projectTrusted===e)return;if(this.projectTrusted=e,this.modifiedProjectFields.clear(),this.modifiedProjectNestedFields.clear(),!e){this.projectSettings={},this.projectSettingsLoadError=null,this.settings=Ar(this.globalSettings,this.projectSettings);return}let n=t.tryLoadFromStorage(this.storage,"project",e);this.projectSettings=n.settings,this.projectSettingsLoadError=n.error,n.error&&this.recordError("project",n.error),this.settings=Ar(this.globalSettings,this.projectSettings)}async reload(){await this.writeQueue;let e=t.tryLoadFromStorage(this.storage,"global");e.error?(this.globalSettingsLoadError=e.error,this.recordError("global",e.error)):(this.globalSettings=e.settings,this.globalSettingsLoadError=null),this.modifiedFields.clear(),this.modifiedNestedFields.clear(),this.modifiedProjectFields.clear(),this.modifiedProjectNestedFields.clear();let n=t.tryLoadFromStorage(this.storage,"project",this.projectTrusted);n.error?(this.projectSettingsLoadError=n.error,this.recordError("project",n.error)):(this.projectSettings=n.settings,this.projectSettingsLoadError=null),this.settings=Ar(this.globalSettings,this.projectSettings)}applyOverrides(e){this.settings=Ar(this.settings,e)}markModified(e,n){this.modifiedFields.add(e),n&&(this.modifiedNestedFields.has(e)||this.modifiedNestedFields.set(e,new Set),this.modifiedNestedFields.get(e).add(n))}markProjectModified(e,n){this.modifiedProjectFields.add(e),n&&(this.modifiedProjectNestedFields.has(e)||this.modifiedProjectNestedFields.set(e,new Set),this.modifiedProjectNestedFields.get(e).add(n))}assertProjectTrustedForWrite(){if(!this.projectTrusted)throw new Error("Project is not trusted; refusing to write project settings")}recordError(e,n){let i=n instanceof Error?n:new Error(String(n));this.errors.push({scope:e,error:i})}clearModifiedScope(e){if(e==="global"){this.modifiedFields.clear(),this.modifiedNestedFields.clear();return}this.modifiedProjectFields.clear(),this.modifiedProjectNestedFields.clear()}enqueueWrite(e,n){this.writeQueue=this.writeQueue.then(()=>{e==="project"&&this.assertProjectTrustedForWrite(),n(),this.clearModifiedScope(e)}).catch(i=>{this.recordError(e,i)})}cloneModifiedNestedFields(e){let n=new Map;for(let[i,s]of e.entries())n.set(i,new Set(s));return n}persistScopedSettings(e,n,i,s){this.storage.withLock(e,r=>{let o=r?t.migrateSettings(JSON.parse(r)):{},a={...o};for(let c of i){let l=n[c];if(s.has(c)&&typeof l=="object"&&l!==null){let u=s.get(c),d=o[c]??{},p=l,m={...d};for(let g of u)m[g]=p[g];a[c]=m}else a[c]=l}return JSON.stringify(a,null,2)})}save(){if(this.settings=Ar(this.globalSettings,this.projectSettings),this.globalSettingsLoadError)return;let e=structuredClone(this.globalSettings),n=new Set(this.modifiedFields),i=this.cloneModifiedNestedFields(this.modifiedNestedFields);this.enqueueWrite("global",()=>{this.persistScopedSettings("global",e,n,i)})}saveProjectSettings(e){if(this.assertProjectTrustedForWrite(),this.projectSettings=structuredClone(e),this.settings=Ar(this.globalSettings,this.projectSettings),this.projectSettingsLoadError)return;let n=structuredClone(this.projectSettings),i=new Set(this.modifiedProjectFields),s=this.cloneModifiedNestedFields(this.modifiedProjectNestedFields);this.enqueueWrite("project",()=>{this.persistScopedSettings("project",n,i,s)})}updateProjectSettings(e,n){this.assertProjectTrustedForWrite();let i=structuredClone(this.projectSettings);n(i),this.markProjectModified(e),this.saveProjectSettings(i)}async flush(){await this.writeQueue}drainErrors(){let e=[...this.errors];return this.errors=[],e}getLastChangelogVersion(){return this.settings.lastChangelogVersion}setLastChangelogVersion(e){this.globalSettings.lastChangelogVersion=e,this.markModified("lastChangelogVersion"),this.save()}getSessionDir(){let e=this.settings.sessionDir;return e&&et(e)}getDefaultProvider(){return this.settings.defaultProvider}getDefaultModel(){return this.settings.defaultModel}setDefaultProvider(e){this.globalSettings.defaultProvider=e,this.markModified("defaultProvider"),this.save()}setDefaultModel(e){this.globalSettings.defaultModel=e,this.markModified("defaultModel"),this.save()}setDefaultModelAndProvider(e,n){this.globalSettings.defaultProvider=e,this.globalSettings.defaultModel=n,this.markModified("defaultProvider"),this.markModified("defaultModel"),this.save()}getSteeringMode(){return this.settings.steeringMode||"one-at-a-time"}setSteeringMode(e){this.globalSettings.steeringMode=e,this.markModified("steeringMode"),this.save()}getFollowUpMode(){return this.settings.followUpMode||"one-at-a-time"}setFollowUpMode(e){this.globalSettings.followUpMode=e,this.markModified("followUpMode"),this.save()}getTheme(){return this.settings.theme}setTheme(e){this.globalSettings.theme=e,this.markModified("theme"),this.save()}getDefaultThinkingLevel(){return this.settings.defaultThinkingLevel}setDefaultThinkingLevel(e){this.globalSettings.defaultThinkingLevel=e,this.markModified("defaultThinkingLevel"),this.save()}getTransport(){return this.settings.transport??"auto"}setTransport(e){this.globalSettings.transport=e,this.markModified("transport"),this.save()}getCompactionEnabled(){return this.settings.compaction?.enabled??!0}setCompactionEnabled(e){this.globalSettings.compaction||(this.globalSettings.compaction={}),this.globalSettings.compaction.enabled=e,this.markModified("compaction","enabled"),this.save()}getCompactionReserveTokens(){return this.settings.compaction?.reserveTokens??16384}getCompactionKeepRecentTokens(){return this.settings.compaction?.keepRecentTokens??2e4}getCompactionSettings(){return{enabled:this.getCompactionEnabled(),reserveTokens:this.getCompactionReserveTokens(),keepRecentTokens:this.getCompactionKeepRecentTokens()}}getBranchSummarySettings(){return{reserveTokens:this.settings.branchSummary?.reserveTokens??16384,skipPrompt:this.settings.branchSummary?.skipPrompt??!1}}getBranchSummarySkipPrompt(){return this.settings.branchSummary?.skipPrompt??!1}getRetryEnabled(){return this.settings.retry?.enabled??!0}setRetryEnabled(e){this.globalSettings.retry||(this.globalSettings.retry={}),this.globalSettings.retry.enabled=e,this.markModified("retry","enabled"),this.save()}getRetrySettings(){return{enabled:this.getRetryEnabled(),maxRetries:this.settings.retry?.maxRetries??3,baseDelayMs:this.settings.retry?.baseDelayMs??2e3}}getHttpIdleTimeoutMs(){return iM(this.settings.httpIdleTimeoutMs,"httpIdleTimeoutMs")??z0}setHttpIdleTimeoutMs(e){if(!Number.isFinite(e)||e<0)throw new Error(`Invalid httpIdleTimeoutMs setting: ${String(e)}`);this.globalSettings.httpIdleTimeoutMs=Math.floor(e),this.markModified("httpIdleTimeoutMs"),this.save()}getProviderRetrySettings(){return{timeoutMs:this.settings.retry?.provider?.timeoutMs,maxRetries:this.settings.retry?.provider?.maxRetries,maxRetryDelayMs:this.settings.retry?.provider?.maxRetryDelayMs??6e4}}getWebSocketConnectTimeoutMs(){return iM(this.settings.websocketConnectTimeoutMs,"websocketConnectTimeoutMs")}getHideThinkingBlock(){return this.settings.hideThinkingBlock??!1}setHideThinkingBlock(e){this.globalSettings.hideThinkingBlock=e,this.markModified("hideThinkingBlock"),this.save()}getShellPath(){return this.settings.shellPath}setShellPath(e){this.globalSettings.shellPath=e,this.markModified("shellPath"),this.save()}getQuietStartup(){return this.settings.quietStartup??!1}setQuietStartup(e){this.globalSettings.quietStartup=e,this.markModified("quietStartup"),this.save()}getDefaultProjectTrust(){let e=this.globalSettings.defaultProjectTrust;return e==="always"||e==="never"?e:"ask"}setDefaultProjectTrust(e){this.globalSettings.defaultProjectTrust=e,this.markModified("defaultProjectTrust"),this.save()}getShellCommandPrefix(){return this.settings.shellCommandPrefix}setShellCommandPrefix(e){this.globalSettings.shellCommandPrefix=e,this.markModified("shellCommandPrefix"),this.save()}getNpmCommand(){return this.settings.npmCommand?[...this.settings.npmCommand]:void 0}setNpmCommand(e){this.globalSettings.npmCommand=e?[...e]:void 0,this.markModified("npmCommand"),this.save()}getCollapseChangelog(){return this.settings.collapseChangelog??!1}setCollapseChangelog(e){this.globalSettings.collapseChangelog=e,this.markModified("collapseChangelog"),this.save()}getEnableInstallTelemetry(){return this.settings.enableInstallTelemetry??!0}setEnableInstallTelemetry(e){this.globalSettings.enableInstallTelemetry=e,this.markModified("enableInstallTelemetry"),this.save()}getEnableAnalytics(){return this.settings.enableAnalytics??!1}getTrackingId(){return this.settings.trackingId}setEnableAnalytics(e){this.globalSettings.enableAnalytics=e,this.markModified("enableAnalytics"),e&&!this.globalSettings.trackingId&&(this.globalSettings.trackingId=$N(),this.markModified("trackingId")),this.save()}getPackages(){return[...this.settings.packages??[]]}setPackages(e){this.globalSettings.packages=e,this.markModified("packages"),this.save()}setProjectPackages(e){this.updateProjectSettings("packages",n=>{n.packages=e})}getExtensionPaths(){return[...this.settings.extensions??[]]}setExtensionPaths(e){this.globalSettings.extensions=e,this.markModified("extensions"),this.save()}setProjectExtensionPaths(e){this.updateProjectSettings("extensions",n=>{n.extensions=e})}getSkillPaths(){return[...this.settings.skills??[]]}setSkillPaths(e){this.globalSettings.skills=e,this.markModified("skills"),this.save()}setProjectSkillPaths(e){this.updateProjectSettings("skills",n=>{n.skills=e})}getPromptTemplatePaths(){return[...this.settings.prompts??[]]}setPromptTemplatePaths(e){this.globalSettings.prompts=e,this.markModified("prompts"),this.save()}setProjectPromptTemplatePaths(e){this.updateProjectSettings("prompts",n=>{n.prompts=e})}getThemePaths(){return[...this.settings.themes??[]]}setThemePaths(e){this.globalSettings.themes=e,this.markModified("themes"),this.save()}setProjectThemePaths(e){this.updateProjectSettings("themes",n=>{n.themes=e})}getEnableSkillCommands(){return this.settings.enableSkillCommands??!0}setEnableSkillCommands(e){this.globalSettings.enableSkillCommands=e,this.markModified("enableSkillCommands"),this.save()}getThinkingBudgets(){return this.settings.thinkingBudgets}getShowImages(){return this.settings.terminal?.showImages??!0}setShowImages(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.showImages=e,this.markModified("terminal","showImages"),this.save()}getImageWidthCells(){let e=this.settings.terminal?.imageWidthCells;return typeof e!="number"||!Number.isFinite(e)?60:Math.max(1,Math.floor(e))}setImageWidthCells(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.imageWidthCells=Math.max(1,Math.floor(e)),this.markModified("terminal","imageWidthCells"),this.save()}getClearOnShrink(){return this.settings.terminal?.clearOnShrink!==void 0?this.settings.terminal.clearOnShrink:process.env.PI_CLEAR_ON_SHRINK==="1"}setClearOnShrink(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.clearOnShrink=e,this.markModified("terminal","clearOnShrink"),this.save()}getShowTerminalProgress(){return this.settings.terminal?.showTerminalProgress??!1}setShowTerminalProgress(e){this.globalSettings.terminal||(this.globalSettings.terminal={}),this.globalSettings.terminal.showTerminalProgress=e,this.markModified("terminal","showTerminalProgress"),this.save()}getImageAutoResize(){return this.settings.images?.autoResize??!0}setImageAutoResize(e){this.globalSettings.images||(this.globalSettings.images={}),this.globalSettings.images.autoResize=e,this.markModified("images","autoResize"),this.save()}getBlockImages(){return this.settings.images?.blockImages??!1}setBlockImages(e){this.globalSettings.images||(this.globalSettings.images={}),this.globalSettings.images.blockImages=e,this.markModified("images","blockImages"),this.save()}getEnabledModels(){return this.settings.enabledModels}setEnabledModels(e){this.globalSettings.enabledModels=e,this.markModified("enabledModels"),this.save()}getDoubleEscapeAction(){return this.settings.doubleEscapeAction??"tree"}setDoubleEscapeAction(e){this.globalSettings.doubleEscapeAction=e,this.markModified("doubleEscapeAction"),this.save()}getTreeFilterMode(){let e=this.settings.treeFilterMode;return e&&["default","no-tools","user-only","labeled-only","all"].includes(e)?e:"default"}setTreeFilterMode(e){this.globalSettings.treeFilterMode=e,this.markModified("treeFilterMode"),this.save()}getShowHardwareCursor(){return this.settings.showHardwareCursor??process.env.PI_HARDWARE_CURSOR==="1"}setShowHardwareCursor(e){this.globalSettings.showHardwareCursor=e,this.markModified("showHardwareCursor"),this.save()}getEditorPaddingX(){return this.settings.editorPaddingX??0}setEditorPaddingX(e){this.globalSettings.editorPaddingX=Math.max(0,Math.min(3,Math.floor(e))),this.markModified("editorPaddingX"),this.save()}getAutocompleteMaxVisible(){return this.settings.autocompleteMaxVisible??5}setAutocompleteMaxVisible(e){this.globalSettings.autocompleteMaxVisible=Math.max(3,Math.min(20,Math.floor(e))),this.markModified("autocompleteMaxVisible"),this.save()}getCodeBlockIndent(){return this.settings.markdown?.codeBlockIndent??" "}getWarnings(){return{...this.settings.warnings??{}}}setWarnings(e){this.globalSettings.warnings={...e},this.markModified("warnings"),this.save()}};import{Agent as Vwe}from"@earendil-works/pi-agent-core";import Q0 from"chalk";import{minimatch as sM}from"minimatch";var X0={"amazon-bedrock":"us.anthropic.claude-opus-4-6-v1","ant-ling":"Ring-2.6-1T",anthropic:"claude-opus-4-8",openai:"gpt-5.4","azure-openai-responses":"gpt-5.4","openai-codex":"gpt-5.5",nvidia:"nvidia/nemotron-3-super-120b-a12b",deepseek:"deepseek-v4-pro",google:"gemini-3.1-pro-preview","google-vertex":"gemini-3.1-pro-preview","github-copilot":"gpt-5.4",openrouter:"moonshotai/kimi-k2.6","vercel-ai-gateway":"zai/glm-5.1",xai:"grok-4.20-0309-reasoning",groq:"openai/gpt-oss-120b",cerebras:"zai-glm-4.7",zai:"glm-5.1","zai-coding-cn":"glm-5.1",mistral:"devstral-medium-latest",minimax:"MiniMax-M2.7","minimax-cn":"MiniMax-M2.7",moonshotai:"kimi-k2.6","moonshotai-cn":"kimi-k2.6",huggingface:"moonshotai/Kimi-K2.6",fireworks:"accounts/fireworks/models/kimi-k2p6",together:"moonshotai/Kimi-K2.6",opencode:"kimi-k2.6","opencode-go":"kimi-k2.6","kimi-coding":"kimi-for-coding","cloudflare-workers-ai":"@cf/moonshotai/kimi-k2.6","cloudflare-ai-gateway":"workers-ai/@cf/moonshotai/kimi-k2.6",xiaomi:"mimo-v2.5-pro","xiaomi-token-plan-cn":"mimo-v2.5-pro","xiaomi-token-plan-ams":"mimo-v2.5-pro","xiaomi-token-plan-sgp":"mimo-v2.5-pro"};function rM(t){return t.endsWith("-latest")?!0:!/-\d{8}$/.test(t)}function Z0(t,e){let n=t.trim();if(!n)return;let i=n.toLowerCase(),s=e.filter(a=>`${a.provider}/${a.id}`.toLowerCase()===i);if(s.length===1)return s[0];if(s.length>1)return;let r=n.indexOf("/");if(r!==-1){let a=n.substring(0,r).trim(),c=n.substring(r+1).trim();if(a&&c){let l=e.filter(u=>u.provider.toLowerCase()===a.toLowerCase()&&u.id.toLowerCase()===c.toLowerCase());if(l.length===1)return l[0];if(l.length>1)return}}let o=e.filter(a=>a.id.toLowerCase()===i);return o.length===1?o[0]:void 0}function HN(t,e){let n=Z0(t,e);if(n)return n;let i=e.filter(o=>o.id.toLowerCase().includes(t.toLowerCase())||o.name?.toLowerCase().includes(t.toLowerCase()));if(i.length===0)return;let s=i.filter(o=>rM(o.id)),r=i.filter(o=>!rM(o.id));return s.length>0?(s.sort((o,a)=>a.id.localeCompare(o.id)),s[0]):(r.sort((o,a)=>a.id.localeCompare(o.id)),r[0])}function Y0(t,e,n){let i=HN(t,e);if(i)return{model:i,thinkingLevel:void 0,warning:void 0};let s=t.lastIndexOf(":");if(s===-1)return{model:void 0,thinkingLevel:void 0,warning:void 0};let r=t.substring(0,s),o=t.substring(s+1);if(Eg(o)){let a=Y0(r,e,n);return a.model?{model:a.model,thinkingLevel:a.warning?void 0:o,warning:a.warning}:a}else{if(!(n?.allowInvalidThinkingLevelFallback??!0))return{model:void 0,thinkingLevel:void 0,warning:void 0};let c=Y0(r,e,n);return c.model?{model:c.model,thinkingLevel:void 0,warning:`Invalid thinking level "${o}" in pattern "${t}". Using default instead.`}:c}}async function Xp(t,e){let n=await e.getAvailable(),i=[];for(let s of t){if(s.includes("*")||s.includes("?")||s.includes("[")){let c=s.lastIndexOf(":"),l=s,u;if(c!==-1){let p=s.substring(c+1);Eg(p)&&(u=p,l=s.substring(0,c))}let d=n.filter(p=>{let m=`${p.provider}/${p.id}`;return sM(m,l,{nocase:!0})||sM(p.id,l,{nocase:!0})});if(d.length===0){console.warn(Q0.yellow(`Warning: No models match pattern "${s}"`));continue}for(let p of d)i.find(m=>zn(m.model,p))||i.push({model:p,thinkingLevel:u});continue}let{model:r,thinkingLevel:o,warning:a}=Y0(s,n);if(a&&console.warn(Q0.yellow(`Warning: ${a}`)),!r){console.warn(Q0.yellow(`Warning: No models match pattern "${s}"`));continue}i.find(c=>zn(c.model,r))||i.push({model:r,thinkingLevel:o})}return i}function zN(t){return t?t==="1"||t.toLowerCase()==="true"||t.toLowerCase()==="yes":!1}function eb(t,e=process.env.PI_TELEMETRY){return e!==void 0?zN(e):t.getEnableInstallTelemetry()}var Mwe=process.env.PI_TIMING==="1";var Rwe=Date.now();function VN(t){let e=t.sessionFile?`
|
|
289
289
|
Session file: ${t.sessionFile}`:"";return`Stored session working directory does not exist: ${t.sessionCwd}${e}
|
|
290
290
|
Current working directory: ${t.fallbackCwd}`}function tb(t){return`cwd from session file does not exist
|
|
291
291
|
${t.sessionCwd}
|
|
292
292
|
|
|
293
293
|
continue in current cwd
|
|
294
|
-
${t.fallbackCwd}`}var za=class extends Error{constructor(e){super(VN(e)),this.name="MissingSessionCwdError",this.issue=e}};var Zp=class extends Error{constructor(e){super(`File not found: ${e}`),this.name="SessionImportFileNotFoundError",this.filePath=e}};import{existsSync as sb,mkdirSync as
|
|
295
|
-
`,"utf-8")}function cj(t){let e=ql(t);
|
|
294
|
+
${t.fallbackCwd}`}var za=class extends Error{constructor(e){super(VN(e)),this.name="MissingSessionCwdError",this.issue=e}};var Zp=class extends Error{constructor(e){super(`File not found: ${e}`),this.name="SessionImportFileNotFoundError",this.filePath=e}};import{existsSync as sb,mkdirSync as pM,readFileSync as ej,writeFileSync as tj}from"node:fs";import{homedir as nj}from"node:os";import{dirname as ql,join as jl}from"node:path";import ij from"proper-lockfile";var sj=["settings.json","extensions","skills","prompts","themes","SYSTEM.md","APPEND_SYSTEM.md"];function em(t){return oi(xe(t))}function rj(t,e){let n=em(e);for(;;){let i=t[n];if(i===!0||i===!1)return{path:n,decision:i};let s=ql(n);if(s===n)return null;n=s}}function oj(t){let e=em(t),n=ql(e);return n===e?void 0:n}function rb(t,e){let n=em(t),i=[{label:"Trust",trusted:!0,updates:[{path:n,decision:!0}],savedPath:n}],s=oj(t);return s!==void 0&&i.push({label:`Trust parent folder (${s})`,trusted:!0,updates:[{path:s,decision:!0},{path:n,decision:null}],savedPath:s}),e?.includeSessionOnly&&i.push({label:"Trust (this session only)",trusted:!0,updates:[]}),i.push({label:"Do not trust",trusted:!1,updates:[{path:n,decision:!1}],savedPath:n}),e?.includeSessionOnly&&i.push({label:"Do not trust (this session only)",trusted:!1,updates:[]}),i}function uM(t){if(!sb(t))return{};let e;try{e=JSON.parse(ej(t,"utf-8"))}catch(i){let s=i instanceof Error?i.message:String(i);throw new Error(`Failed to read trust store ${t}: ${s}`)}if(typeof e!="object"||e===null||Array.isArray(e))throw new Error(`Invalid trust store ${t}: expected an object`);let n={};for(let[i,s]of Object.entries(e)){if(s!==!0&&s!==!1&&s!==null)throw new Error(`Invalid trust store ${t}: value for ${JSON.stringify(i)} must be true, false, or null`);n[i]=s}return n}function aj(t,e){let n={};for(let i of Object.keys(e).sort()){let s=e[i];(s===!0||s===!1||s===null)&&(n[i]=s)}pM(ql(t),{recursive:!0}),tj(t,`${JSON.stringify(n,null,2)}
|
|
295
|
+
`,"utf-8")}function cj(t){let e=ql(t);pM(e,{recursive:!0});let n=10,i=20,s;for(let r=1;r<=n;r++)try{return ij.lockSync(e,{realpath:!1,lockfilePath:`${t}.lock`})}catch(o){if((typeof o=="object"&&o!==null&&"code"in o?String(o.code):void 0)!=="ELOCKED"||r===n)throw o;s=o;let c=Date.now();for(;Date.now()-c<i;);}throw s instanceof Error?s:new Error("Failed to acquire trust store lock")}function dM(t,e){let n=cj(t);try{return e()}finally{n()}}function Or(t){let e=oi(xe(process.env.HOME||nj())),n=jl(e,".agents","skills"),i=oi(xe(t)),s=jl(i,mt);if(sj.some(r=>sb(jl(s,r))))return!0;for(;;){let r=jl(i,".agents","skills");if(r!==n&&sb(r))return!0;let o=ql(i);if(o===i)return!1;i=o}}var As=class{constructor(e){this.trustPath=jl(xe(e),"trust.json")}get(e){return this.getEntry(e)?.decision??null}getEntry(e){return dM(this.trustPath,()=>{let n=uM(this.trustPath);return rj(n,e)})}set(e,n){this.setMany([{path:e,decision:n}])}setMany(e){dM(this.trustPath,()=>{let n=uM(this.trustPath);for(let{path:i,decision:s}of e){let r=em(i);s===null?delete n[r]:n[r]=s}aj(this.trustPath,n)})}};import HRe from"chalk";import SSe from"chalk";import _Se from"chalk";import vTe from"chalk";import{existsSync as lj,readFileSync as uj}from"fs";import{join as dj}from"path";var mM={...da,"app.interrupt":{defaultKeys:"escape",description:"Cancel or abort"},"app.clear":{defaultKeys:"ctrl+c",description:"Clear editor"},"app.exit":{defaultKeys:"ctrl+d",description:"Exit when editor is empty"},"app.suspend":{defaultKeys:process.platform==="win32"?[]:"ctrl+z",description:"Suspend to background"},"app.thinking.cycle":{defaultKeys:"shift+tab",description:"Cycle thinking level"},"app.model.cycleForward":{defaultKeys:"ctrl+p",description:"Cycle to next model"},"app.model.cycleBackward":{defaultKeys:"shift+ctrl+p",description:"Cycle to previous model"},"app.model.select":{defaultKeys:"ctrl+l",description:"Open model selector"},"app.tools.expand":{defaultKeys:"ctrl+o",description:"Toggle tool output"},"app.thinking.toggle":{defaultKeys:"ctrl+t",description:"Toggle thinking blocks"},"app.session.toggleNamedFilter":{defaultKeys:"ctrl+n",description:"Toggle named session filter"},"app.editor.external":{defaultKeys:"ctrl+g",description:"Open external editor"},"app.message.followUp":{defaultKeys:"alt+enter",description:"Queue follow-up message"},"app.message.dequeue":{defaultKeys:"alt+up",description:"Restore queued messages"},"app.clipboard.pasteImage":{defaultKeys:process.platform==="win32"?"alt+v":"ctrl+v",description:"Paste image from clipboard"},"app.session.new":{defaultKeys:[],description:"Start a new session"},"app.session.tree":{defaultKeys:[],description:"Open session tree"},"app.session.fork":{defaultKeys:[],description:"Fork current session"},"app.session.resume":{defaultKeys:[],description:"Resume a session"},"app.tree.foldOrUp":{defaultKeys:["ctrl+left","alt+left"],description:"Fold tree branch or move up"},"app.tree.unfoldOrDown":{defaultKeys:["ctrl+right","alt+right"],description:"Unfold tree branch or move down"},"app.tree.editLabel":{defaultKeys:"shift+l",description:"Edit tree label"},"app.tree.toggleLabelTimestamp":{defaultKeys:"shift+t",description:"Toggle tree label timestamps"},"app.session.togglePath":{defaultKeys:"ctrl+p",description:"Toggle session path display"},"app.session.toggleSort":{defaultKeys:"ctrl+s",description:"Toggle session sort mode"},"app.session.rename":{defaultKeys:"ctrl+r",description:"Rename session"},"app.session.delete":{defaultKeys:"ctrl+d",description:"Delete session"},"app.session.deleteNoninvasive":{defaultKeys:"ctrl+backspace",description:"Delete session when query is empty"},"app.models.save":{defaultKeys:"ctrl+s",description:"Save model selection"},"app.models.enableAll":{defaultKeys:"ctrl+a",description:"Enable all models"},"app.models.clearAll":{defaultKeys:"ctrl+x",description:"Clear all models"},"app.models.toggleProvider":{defaultKeys:"ctrl+p",description:"Toggle all models for provider"},"app.models.reorderUp":{defaultKeys:"alt+up",description:"Move model up in order"},"app.models.reorderDown":{defaultKeys:"alt+down",description:"Move model down in order"},"app.tree.filter.default":{defaultKeys:"ctrl+d",description:"Tree filter: default view"},"app.tree.filter.noTools":{defaultKeys:"ctrl+t",description:"Tree filter: hide tool results"},"app.tree.filter.userOnly":{defaultKeys:"ctrl+u",description:"Tree filter: user messages only"},"app.tree.filter.labeledOnly":{defaultKeys:"ctrl+l",description:"Tree filter: labeled entries only"},"app.tree.filter.all":{defaultKeys:"ctrl+a",description:"Tree filter: show all entries"},"app.tree.filter.cycleForward":{defaultKeys:"ctrl+o",description:"Tree filter: cycle forward"},"app.tree.filter.cycleBackward":{defaultKeys:"shift+ctrl+o",description:"Tree filter: cycle backward"}},hM={cursorUp:"tui.editor.cursorUp",cursorDown:"tui.editor.cursorDown",cursorLeft:"tui.editor.cursorLeft",cursorRight:"tui.editor.cursorRight",cursorWordLeft:"tui.editor.cursorWordLeft",cursorWordRight:"tui.editor.cursorWordRight",cursorLineStart:"tui.editor.cursorLineStart",cursorLineEnd:"tui.editor.cursorLineEnd",jumpForward:"tui.editor.jumpForward",jumpBackward:"tui.editor.jumpBackward",pageUp:"tui.editor.pageUp",pageDown:"tui.editor.pageDown",deleteCharBackward:"tui.editor.deleteCharBackward",deleteCharForward:"tui.editor.deleteCharForward",deleteWordBackward:"tui.editor.deleteWordBackward",deleteWordForward:"tui.editor.deleteWordForward",deleteToLineStart:"tui.editor.deleteToLineStart",deleteToLineEnd:"tui.editor.deleteToLineEnd",yank:"tui.editor.yank",yankPop:"tui.editor.yankPop",undo:"tui.editor.undo",newLine:"tui.input.newLine",submit:"tui.input.submit",tab:"tui.input.tab",copy:"tui.input.copy",selectUp:"tui.select.up",selectDown:"tui.select.down",selectPageUp:"tui.select.pageUp",selectPageDown:"tui.select.pageDown",selectConfirm:"tui.select.confirm",selectCancel:"tui.select.cancel",interrupt:"app.interrupt",clear:"app.clear",exit:"app.exit",suspend:"app.suspend",cycleThinkingLevel:"app.thinking.cycle",cycleModelForward:"app.model.cycleForward",cycleModelBackward:"app.model.cycleBackward",selectModel:"app.model.select",expandTools:"app.tools.expand",toggleThinking:"app.thinking.toggle",toggleSessionNamedFilter:"app.session.toggleNamedFilter",externalEditor:"app.editor.external",followUp:"app.message.followUp",dequeue:"app.message.dequeue",pasteImage:"app.clipboard.pasteImage",newSession:"app.session.new",tree:"app.session.tree",fork:"app.session.fork",resume:"app.session.resume",treeFoldOrUp:"app.tree.foldOrUp",treeUnfoldOrDown:"app.tree.unfoldOrDown",treeEditLabel:"app.tree.editLabel",treeToggleLabelTimestamp:"app.tree.toggleLabelTimestamp",toggleSessionPath:"app.session.togglePath",toggleSessionSort:"app.session.toggleSort",renameSession:"app.session.rename",deleteSession:"app.session.delete",deleteSessionNoninvasive:"app.session.deleteNoninvasive"};function gM(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function pj(t){return t in hM}function mj(t){if(!gM(t))return{};let e={};for(let[n,i]of Object.entries(t)){if(typeof i=="string"){e[n]=i;continue}Array.isArray(i)&&i.every(s=>typeof s=="string")&&(e[n]=i)}return e}function fM(t){let e={},n=!1;for(let[i,s]of Object.entries(t)){let r=pj(i)?hM[i]:i;if(r!==i&&(n=!0),i!==r&&Object.hasOwn(t,r)){n=!0;continue}e[r]=s}return{config:hj(e),migrated:n}}function hj(t){let e={};for(let i of Object.keys(mM))Object.hasOwn(t,i)&&(e[i]=t[i]);let n=Object.keys(t).filter(i=>!Object.hasOwn(e,i)).sort();for(let i of n)e[i]=t[i];return e}function gj(t){if(lj(t))try{let e=JSON.parse(uj(t,"utf-8"));return gM(e)?e:void 0}catch{return}}var Os=class t extends ua{constructor(e={},n){super(mM,e),this.configPath=n}static create(e=Pe()){let n=dj(e,"keybindings.json"),i=t.loadFromFile(n);return new t(i,n)}reload(){this.configPath&&this.setUserBindings(t.loadFromFile(this.configPath))}getEffectiveConfig(){return this.getResolvedBindings()}static loadFromFile(e){let n=gj(e);return n?mj(fM(n).config):{}}};var Ls=class{constructor(e,n,i,s){this.tui=n,this.onTick=i,this.onExpire=s,this.remainingSeconds=Math.ceil(e/1e3),this.onTick(this.remainingSeconds),this.intervalId=setInterval(()=>{this.remainingSeconds--,this.onTick(this.remainingSeconds),this.tui?.requestRender(),this.remainingSeconds<=0&&(this.dispose(),this.onExpire())},1e3)}dispose(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=void 0)}};var z=class{constructor(e=n=>b.fg("border",n)){this.color=e}invalidate(){}render(e){return[this.color("\u2500".repeat(Math.max(1,e)))]}};var Lr=class extends H{constructor(n,i,s,r,o){super();this._focused=!1;this.onSubmitCallback=s,this.onCancelCallback=r,this.baseTitle=n,this.addChild(new z),this.addChild(new L(1)),this.titleText=new E(b.fg("accent",n),1,0),this.addChild(this.titleText),this.addChild(new L(1)),o?.timeout&&o.timeout>0&&o.tui&&(this.countdown=new Ls(o.timeout,o.tui,a=>this.titleText.setText(b.fg("accent",`${this.baseTitle} (${a}s)`)),()=>this.onCancelCallback())),this.input=new Qe,this.addChild(this.input),this.addChild(new L(1)),this.addChild(new E(`${re("tui.select.confirm","submit")} ${re("tui.select.cancel","cancel")}`,1,0)),this.addChild(new L(1)),this.addChild(new z)}get focused(){return this._focused}set focused(n){this._focused=n,this.input.focused=n}handleInput(n){let i=fe();i.matches(n,"tui.select.confirm")||n===`
|
|
296
296
|
`?this.onSubmitCallback(this.input.getValue()):i.matches(n,"tui.select.cancel")?this.onCancelCallback():this.input.handleInput(n)}dispose(){this.countdown?.dispose()}};var Ki=class extends H{constructor(n,i,s,r,o){super();this.selectedIndex=0;this.options=i,this.onSelectCallback=s,this.onCancelCallback=r,this.onToggleToolsExpanded=o?.onToggleToolsExpanded,this.baseTitle=n,this.addChild(new z),this.addChild(new L(1)),this.titleText=new E(b.fg("accent",b.bold(n)),1,0),this.addChild(this.titleText),this.addChild(new L(1)),o?.timeout&&o.timeout>0&&o.tui&&(this.countdown=new Ls(o.timeout,o.tui,a=>this.titleText.setText(b.fg("accent",b.bold(`${this.baseTitle} (${a}s)`))),()=>this.onCancelCallback())),this.listContainer=new H,this.addChild(this.listContainer),this.addChild(new L(1)),this.addChild(new E(tt("\u2191\u2193","navigate")+" "+re("tui.select.confirm","select")+" "+re("tui.select.cancel","cancel"),1,0)),this.addChild(new L(1)),this.addChild(new z),this.updateList()}updateList(){this.listContainer.clear();for(let n=0;n<this.options.length;n++){let s=n===this.selectedIndex?b.fg("accent","\u2192 ")+b.fg("accent",this.options[n]):` ${b.fg("text",this.options[n])}`;this.listContainer.addChild(new E(s,1,0))}}handleInput(n){let i=fe();if(i.matches(n,"app.tools.expand"))this.onToggleToolsExpanded?.();else if(i.matches(n,"tui.select.up")||n==="k")this.selectedIndex=Math.max(0,this.selectedIndex-1),this.updateList();else if(i.matches(n,"tui.select.down")||n==="j")this.selectedIndex=Math.min(this.options.length-1,this.selectedIndex+1),this.updateList();else if(i.matches(n,"tui.select.confirm")||n===`
|
|
297
|
-
`){let s=this.options[this.selectedIndex];s&&this.onSelectCallback(s)}else i.matches(n,"tui.select.cancel")&&this.onCancelCallback()}dispose(){this.countdown?.dispose()}};import{spawnSync as wj}from"node:child_process";import{existsSync as Sj}from"node:fs";import{unlink as Tj}from"node:fs/promises";import*as w1 from"node:os";function b1(t){return t.toLowerCase().replace(/\s+/g," ").trim()}function xj(t){return`${t.id} ${t.name??""} ${t.allMessagesText} ${t.cwd}`}function ob(t){return!!t.name?.trim()}function vj(t,e){return e==="all"?!0:ob(t)}function yj(t){let e=t.trim();if(!e)return{mode:"tokens",tokens:[],regex:null};if(e.startsWith("re:")){let a=e.slice(3).trim();if(!a)return{mode:"regex",tokens:[],regex:null,error:"Empty regex"};try{return{mode:"regex",tokens:[],regex:new RegExp(a,"i")}}catch(c){let l=c instanceof Error?c.message:String(c);return{mode:"regex",tokens:[],regex:null,error:l}}}let n=[],i="",s=!1,r=!1,o=a=>{let c=i.trim();i="",c&&n.push({kind:a,value:c})};for(let a=0;a<e.length;a++){let c=e[a];if(c==='"'){s?(o("phrase"),s=!1):(o("fuzzy"),s=!0);continue}if(!s&&/\s/.test(c)){o("fuzzy");continue}i+=c}return s&&(r=!0),r?{mode:"tokens",tokens:e.split(/\s+/).map(a=>a.trim()).filter(a=>a.length>0).map(a=>({kind:"fuzzy",value:a})),regex:null}:(o(s?"phrase":"fuzzy"),{mode:"tokens",tokens:n,regex:null})}function x1(t,e){let n=xj(t);if(e.mode==="regex"){if(!e.regex)return{matches:!1,score:0};let r=n.search(e.regex);return r<0?{matches:!1,score:0}:{matches:!0,score:r*.1}}if(e.tokens.length===0)return{matches:!0,score:0};let i=0,s=null;for(let r of e.tokens){if(r.kind==="phrase"){s===null&&(s=b1(n));let a=b1(r.value);if(!a)continue;let c=s.indexOf(a);if(c<0)return{matches:!1,score:0};i+=c*.1;continue}let o=Dd(r.value,n);if(!o.matches)return{matches:!1,score:0};i+=o.score}return{matches:!0,score:i}}function v1(t,e,n,i="all"){let s=i==="all"?t:t.filter(c=>vj(c,i));if(!e.trim())return s;let o=yj(e);if(o.error)return[];if(n==="recent"){let c=[];for(let l of s)x1(l,o).matches&&c.push(l);return c}let a=[];for(let c of s){let l=x1(c,o);l.matches&&a.push({session:c,score:l.score})}return a.sort((c,l)=>c.score!==l.score?c.score-l.score:l.session.modified.getTime()-c.session.modified.getTime()),a.map(c=>c.session)}function y1(t){let e=w1.homedir();return t&&(t.startsWith(e)?`~${t.slice(e.length)}`:t)}function Cj(t){let n=new Date().getTime()-t.getTime(),i=Math.floor(n/6e4),s=Math.floor(n/36e5),r=Math.floor(n/864e5);return i<1?"now":i<60?`${i}m`:s<24?`${s}h`:r<7?`${r}d`:r<30?`${Math.floor(r/7)}w`:r<365?`${Math.floor(r/30)}mo`:`${Math.floor(r/365)}y`}function Gl(t){return t&&oi(t)}var ab=class{constructor(e,n,i,s){this.loading=!1;this.loadProgress=null;this.showPath=!1;this.confirmingDeletePath=null;this.statusMessage=null;this.statusTimeout=null;this.showRenameHint=!1;this.scope=e,this.sortMode=n,this.nameFilter=i,this.requestRender=s}setScope(e){this.scope=e}setSortMode(e){this.sortMode=e}setNameFilter(e){this.nameFilter=e}setLoading(e){this.loading=e,this.loadProgress=null}setProgress(e,n){this.loadProgress={loaded:e,total:n}}setShowPath(e){this.showPath=e}setShowRenameHint(e){this.showRenameHint=e}setConfirmingDeletePath(e){this.confirmingDeletePath=e}clearStatusTimeout(){this.statusTimeout&&(clearTimeout(this.statusTimeout),this.statusTimeout=null)}setStatusMessage(e,n){this.clearStatusTimeout(),this.statusMessage=e,!(!e||!n)&&(this.statusTimeout=setTimeout(()=>{this.statusMessage=null,this.statusTimeout=null,this.requestRender()},n))}invalidate(){}render(e){let n=this.scope==="current"?"Resume Session (Current Folder)":"Resume Session (All)",i=b.bold(n),s=this.sortMode==="threaded"?"Threaded":this.sortMode==="recent"?"Recent":"Fuzzy",r=b.fg("muted","Sort: ")+b.fg("accent",s),o=this.nameFilter==="all"?"All":"Named",a=b.fg("muted","Name: ")+b.fg("accent",o),c;if(this.loading){let h=this.loadProgress?`${this.loadProgress.loaded}/${this.loadProgress.total}`:"...";c=`${b.fg("muted","\u25CB Current Folder | ")}${b.fg("accent",`Loading ${h}`)}`}else this.scope==="current"?c=`${b.fg("accent","\u25C9 Current Folder")}${b.fg("muted"," | \u25CB All")}`:c=`${b.fg("muted","\u25CB Current Folder | ")}${b.fg("accent","\u25C9 All")}`;let l=Z(`${c} ${a} ${r}`,e,""),u=Math.max(0,e-j(l)-1),d=Z(i,u,""),p=Math.max(0,e-j(d)-j(l)),m,g;if(this.confirmingDeletePath!==null){let h=`Delete session? ${re("tui.select.confirm","confirm")} \xB7 ${re("tui.select.cancel","cancel")}`;m=b.fg("error",Z(h,e,"\u2026")),g=""}else if(this.statusMessage){let h=this.statusMessage.type==="error"?"error":"accent";m=b.fg(h,Z(this.statusMessage.message,e,"\u2026")),g=""}else{let h=this.showPath?"(on)":"(off)",f=b.fg("muted"," \xB7 "),x=re("tui.input.tab","scope")+f+b.fg("muted",'re:<pattern> regex \xB7 "phrase" exact'),v=[re("app.session.toggleSort","sort"),re("app.session.toggleNamedFilter","named"),re("app.session.delete","delete"),re("app.session.togglePath",`path ${h}`)];this.showRenameHint&&v.push(re("app.session.rename","rename"));let w=v.join(f);m=Z(x,e,"\u2026"),g=Z(w,e,"\u2026")}return[`${d}${" ".repeat(p)}${l}`,m,g]}};function kj(t){let e=new Map;for(let s of t){let r=Gl(s.path)??s.path;e.set(r,{session:s,children:[]})}let n=[];for(let s of t){let r=Gl(s.path)??s.path,o=e.get(r),a=Gl(s.parentSessionPath);a&&e.has(a)?e.get(a).children.push(o):n.push(o)}let i=s=>{s.sort((r,o)=>o.session.modified.getTime()-r.session.modified.getTime());for(let r of s)i(r.children)};return i(n),n}function Mj(t){let e=[],n=(i,s,r,o)=>{e.push({session:i.session,depth:s,isLast:o,ancestorContinues:r});for(let a=0;a<i.children.length;a++){let c=a===i.children.length-1,l=s>0?!o:!1;n(i.children[a],s+1,[...r,l],c)}};for(let i=0;i<t.length;i++)n(t[i],0,[],i===t.length-1);return e}var cb=class{constructor(e,n,i,s,r,o){this.allSessions=[];this.filteredSessions=[];this.selectedIndex=0;this.showCwd=!1;this.sortMode="threaded";this.nameFilter="all";this.showPath=!1;this.confirmingDeletePath=null;this.onExit=()=>{};this.maxVisible=10;this._focused=!1;this.allSessions=e,this.filteredSessions=[],this.searchInput=new Qe,this.showCwd=n,this.sortMode=i,this.nameFilter=s,this.keybindings=r,this.currentSessionCanonicalPath=Gl(o),this.filterSessions(""),this.searchInput.onSubmit=()=>{if(this.filteredSessions[this.selectedIndex]){let a=this.filteredSessions[this.selectedIndex];this.onSelect&&this.onSelect(a.session.path)}}}getSelectedSessionPath(){return this.filteredSessions[this.selectedIndex]?.session.path}get focused(){return this._focused}set focused(e){this._focused=e,this.searchInput.focused=e}setSortMode(e){this.sortMode=e,this.filterSessions(this.searchInput.getValue())}setNameFilter(e){this.nameFilter=e,this.filterSessions(this.searchInput.getValue())}setSessions(e,n){this.allSessions=e,this.showCwd=n,this.filterSessions(this.searchInput.getValue())}filterSessions(e){let n=e.trim(),i=this.nameFilter==="all"?this.allSessions:this.allSessions.filter(s=>ob(s));if(this.sortMode==="threaded"&&!n){let s=kj(i);this.filteredSessions=Mj(s)}else{let s=v1(i,e,this.sortMode,"all");this.filteredSessions=s.map(r=>({session:r,depth:0,isLast:!0,ancestorContinues:[]}))}this.selectedIndex=Math.min(this.selectedIndex,Math.max(0,this.filteredSessions.length-1))}setConfirmingDeletePath(e){this.confirmingDeletePath=e,this.onDeleteConfirmationChange?.(e)}startDeleteConfirmationForSelectedSession(){let e=this.filteredSessions[this.selectedIndex];if(e){if(this.isCurrentSessionPath(e.session.path)){this.onError?.("Cannot delete the currently active session");return}this.setConfirmingDeletePath(e.session.path)}}isCurrentSessionPath(e){return this.currentSessionCanonicalPath?(Gl(e)??e)===this.currentSessionCanonicalPath:!1}invalidate(){}render(e){let n=[];if(n.push(...this.searchInput.render(e)),n.push(""),this.filteredSessions.length===0){let r;if(this.nameFilter==="named"){let o=ke("app.session.toggleNamedFilter");this.showCwd?r=` No named sessions found. Press ${o} to show all.`:r=` No named sessions in current folder. Press ${o} to show all, or Tab to view all.`}else this.showCwd?r=" No sessions found":r=" No sessions in current folder. Press Tab to view all.";return n.push(b.fg("muted",Z(r,e,"\u2026"))),n}let i=Math.max(0,Math.min(this.selectedIndex-Math.floor(this.maxVisible/2),this.filteredSessions.length-this.maxVisible)),s=Math.min(i+this.maxVisible,this.filteredSessions.length);for(let r=i;r<s;r++){let o=this.filteredSessions[r],a=o.session,c=r===this.selectedIndex,l=a.path===this.confirmingDeletePath,u=this.isCurrentSessionPath(a.path),d=this.buildTreePrefix(o),p=!!a.name,g=(a.name??a.firstMessage).replace(/[\x00-\x1f\x7f]/g," ").trim(),h=Cj(a.modified),x=`${String(a.messageCount)} ${h}`;this.showCwd&&a.cwd&&(x=`${y1(a.cwd)} ${x}`),this.showPath&&(x=`${y1(a.path)} ${x}`);let v=c?b.fg("accent","\u203A "):" ",w=j(d),C=j(x)+2,P=e-2-w-C,_=Z(g,Math.max(10,P),"\u2026"),F=null;l?F="error":u?F="accent":p&&(F="warning");let A=F?b.fg(F,_):_;c&&(A=b.bold(A));let W=v+b.fg("dim",d)+A,R=j(W),k=Math.max(1,e-R-j(x)),O=b.fg(l?"error":"dim",x),U=W+" ".repeat(k)+O;c&&(U=b.bg("selectedBg",U)),n.push(Z(U,e))}if(i>0||s<this.filteredSessions.length){let r=` (${this.selectedIndex+1}/${this.filteredSessions.length})`,o=b.fg("muted",Z(r,e,""));n.push(o)}return n}buildTreePrefix(e){if(e.depth===0)return"";let n=e.ancestorContinues.map(s=>s?"\u2502 ":" "),i=e.isLast?"\u2514\u2500 ":"\u251C\u2500 ";return n.join("")+i}handleInput(e){let n=fe();if(this.confirmingDeletePath!==null){if(n.matches(e,"tui.select.confirm")){let i=this.confirmingDeletePath;this.setConfirmingDeletePath(null),this.onDeleteSession?.(i);return}if(n.matches(e,"tui.select.cancel")){this.setConfirmingDeletePath(null);return}return}if(n.matches(e,"tui.input.tab")){this.onToggleScope&&this.onToggleScope();return}if(n.matches(e,"app.session.toggleSort")){this.onToggleSort?.();return}if(this.keybindings.matches(e,"app.session.toggleNamedFilter")){this.onToggleNameFilter?.();return}if(n.matches(e,"app.session.togglePath")){this.showPath=!this.showPath,this.onTogglePath?.(this.showPath);return}if(n.matches(e,"app.session.delete")){this.startDeleteConfirmationForSelectedSession();return}if(n.matches(e,"app.session.rename")){let i=this.filteredSessions[this.selectedIndex];i&&this.onRenameSession?.(i.session.path);return}if(n.matches(e,"app.session.deleteNoninvasive")){if(this.searchInput.getValue().length>0){this.searchInput.handleInput(e),this.filterSessions(this.searchInput.getValue());return}this.startDeleteConfirmationForSelectedSession();return}if(n.matches(e,"tui.select.up"))this.selectedIndex=Math.max(0,this.selectedIndex-1);else if(n.matches(e,"tui.select.down"))this.selectedIndex=Math.min(this.filteredSessions.length-1,this.selectedIndex+1);else if(n.matches(e,"tui.select.pageUp"))this.selectedIndex=Math.max(0,this.selectedIndex-this.maxVisible);else if(n.matches(e,"tui.select.pageDown"))this.selectedIndex=Math.min(this.filteredSessions.length-1,this.selectedIndex+this.maxVisible);else if(n.matches(e,"tui.select.confirm")){let i=this.filteredSessions[this.selectedIndex];i&&this.onSelect&&this.onSelect(i.session.path)}else n.matches(e,"tui.select.cancel")?this.onCancel&&this.onCancel():(this.searchInput.handleInput(e),this.filterSessions(this.searchInput.getValue()))}};async function Rj(t){let e=t.startsWith("-")?["--",t]:[t],n=wj("trash",e,{encoding:"utf-8"}),i=()=>{let s=[];n.error&&s.push(n.error.message);let r=n.stderr?.trim();return r&&s.push(r.split(`
|
|
298
|
-
`)[0]??r),s.length===0?null:`trash: ${s.join(" \xB7 ").slice(0,200)}`};if(n.status===0||!Sj(t))return{ok:!0,method:"trash"};try{return await Tj(t),{ok:!0,method:"unlink"}}catch(s){let r=s instanceof Error?s.message:String(s),o=i();return{ok:!1,method:"unlink",error:o?`${r} (${o})`:r}}}var Wr=class extends H{constructor(n,i,s,r,o,a,c,l){super();this.canRename=!0;this.scope="current";this.sortMode="threaded";this.nameFilter="all";this.currentSessions=null;this.allSessions=null;this.currentLoading=!1;this.allLoading=!1;this.allLoadSeq=0;this.mode="list";this.renameInput=new Qe;this.renameTargetPath=null;this._focused=!1;this.keybindings=c?.keybindings??Os.create(),this.currentSessionsLoader=n,this.allSessionsLoader=i,this.onCancel=r,this.requestRender=a,this.header=new ab(this.scope,this.sortMode,this.nameFilter,this.requestRender);let u=c?.renameSession;this.renameSession=u,this.canRename=!!u,this.header.setShowRenameHint(c?.showRenameHint??this.canRename),this.sessionList=new cb([],!1,this.sortMode,this.nameFilter,this.keybindings,l),this.buildBaseLayout(this.sessionList),this.renameInput.onSubmit=p=>{this.confirmRename(p)};let d=()=>this.header.setStatusMessage(null);this.sessionList.onSelect=p=>{d(),s(p)},this.sessionList.onCancel=()=>{d(),r()},this.sessionList.onExit=()=>{d(),o()},this.sessionList.onToggleScope=()=>this.toggleScope(),this.sessionList.onToggleSort=()=>this.toggleSortMode(),this.sessionList.onToggleNameFilter=()=>this.toggleNameFilter(),this.sessionList.onRenameSession=p=>{if(!u||this.scope==="current"&&this.currentLoading||this.scope==="all"&&this.allLoading)return;let g=(this.scope==="all"?this.allSessions??[]:this.currentSessions??[]).find(h=>h.path===p);this.enterRenameMode(p,g?.name)},this.sessionList.onTogglePath=p=>{this.header.setShowPath(p),this.requestRender()},this.sessionList.onDeleteConfirmationChange=p=>{this.header.setConfirmingDeletePath(p),this.requestRender()},this.sessionList.onError=p=>{this.header.setStatusMessage({type:"error",message:p},3e3),this.requestRender()},this.sessionList.onDeleteSession=async p=>{let m=await Rj(p);if(m.ok){this.currentSessions&&(this.currentSessions=this.currentSessions.filter(x=>x.path!==p)),this.allSessions&&(this.allSessions=this.allSessions.filter(x=>x.path!==p));let g=this.scope==="all"?this.allSessions??[]:this.currentSessions??[],h=this.scope==="all";this.sessionList.setSessions(g,h);let f=m.method==="trash"?"Session moved to trash":"Session deleted";this.header.setStatusMessage({type:"info",message:f},2e3),await this.refreshSessionsAfterMutation()}else{let g=m.error??"Unknown error";this.header.setStatusMessage({type:"error",message:`Failed to delete: ${g}`},3e3)}this.requestRender()},this.loadCurrentSessions()}handleInput(n){if(this.mode==="rename"){if(fe().matches(n,"tui.select.cancel")){this.exitRenameMode();return}this.renameInput.handleInput(n);return}this.sessionList.handleInput(n)}get focused(){return this._focused}set focused(n){this._focused=n,this.sessionList.focused=n,this.renameInput.focused=n,n&&this.mode==="rename"&&(this.renameInput.focused=!0)}buildBaseLayout(n,i){this.clear(),this.addChild(new L(1)),this.addChild(new z(s=>b.fg("accent",s))),this.addChild(new L(1)),(i?.showHeader??!0)&&(this.addChild(this.header),this.addChild(new L(1))),this.addChild(n),this.addChild(new L(1)),this.addChild(new z(s=>b.fg("accent",s)))}loadCurrentSessions(){this.loadScope("current","initial")}enterRenameMode(n,i){this.mode="rename",this.renameTargetPath=n,this.renameInput.setValue(i??""),this.renameInput.focused=!0;let s=new H;s.addChild(new E(b.bold("Rename Session"),1,0)),s.addChild(new L(1)),s.addChild(this.renameInput),s.addChild(new L(1)),s.addChild(new E(b.fg("muted",`${ke("tui.select.confirm")} to save \xB7 ${ke("tui.select.cancel")} to cancel`),1,0)),this.buildBaseLayout(s,{showHeader:!1}),this.requestRender()}exitRenameMode(){this.mode="list",this.renameTargetPath=null,this.buildBaseLayout(this.sessionList),this.requestRender()}async confirmRename(n){let i=n.trim();if(!i)return;let s=this.renameTargetPath;if(!s){this.exitRenameMode();return}let r=this.renameSession;if(!r){this.exitRenameMode();return}try{await r(s,i),await this.refreshSessionsAfterMutation()}finally{this.exitRenameMode()}}async loadScope(n,i){let s=n==="all";n==="current"?this.currentLoading=!0:this.allLoading=!0;let r=n==="all"?++this.allLoadSeq:void 0;this.header.setScope(n),this.header.setLoading(!0),this.requestRender();let o=(a,c)=>{n===this.scope&&(r!==void 0&&r!==this.allLoadSeq||(this.header.setProgress(a,c),this.requestRender()))};try{let a=await(n==="current"?this.currentSessionsLoader(o):this.allSessionsLoader(o));if(n==="current"?(this.currentSessions=a,this.currentLoading=!1):(this.allSessions=a,this.allLoading=!1),n!==this.scope||r!==void 0&&r!==this.allLoadSeq)return;this.header.setLoading(!1),this.sessionList.setSessions(a,s),this.requestRender(),n==="all"&&a.length===0&&(this.currentSessions?.length??0)===0&&this.onCancel()}catch(a){if(n==="current"?this.currentLoading=!1:this.allLoading=!1,n!==this.scope||r!==void 0&&r!==this.allLoadSeq)return;let c=a instanceof Error?a.message:String(a);this.header.setLoading(!1),this.header.setStatusMessage({type:"error",message:`Failed to load sessions: ${c}`},4e3),i==="initial"&&this.sessionList.setSessions([],s),this.requestRender()}}toggleSortMode(){this.sortMode=this.sortMode==="threaded"?"recent":this.sortMode==="recent"?"relevance":"threaded",this.header.setSortMode(this.sortMode),this.sessionList.setSortMode(this.sortMode),this.requestRender()}toggleNameFilter(){this.nameFilter=this.nameFilter==="all"?"named":"all",this.header.setNameFilter(this.nameFilter),this.sessionList.setNameFilter(this.nameFilter),this.requestRender()}async refreshSessionsAfterMutation(){await this.loadScope(this.scope,"refresh")}toggleScope(){if(this.scope==="current"){if(this.scope="all",this.header.setScope(this.scope),this.allSessions!==null){this.header.setLoading(!1),this.sessionList.setSessions(this.allSessions,!0),this.requestRender();return}this.allLoading||this.loadScope("all","toggle");return}this.scope="current",this.header.setScope(this.scope),this.header.setLoading(this.currentLoading),this.sessionList.setSessions(this.currentSessions??[],!1),this.requestRender()}getSessionList(){return this.sessionList}};import GTe from"chalk";import*as tR from"node:crypto";import*as wn from"node:fs";import*as pc from"node:os";import*as Ve from"node:path";import n8 from"chalk";import{spawn as Rb,spawnSync as i8}from"child_process";import{execFile as Ij,spawnSync as Pj}from"child_process";import{existsSync as Va,readFileSync as tm,statSync as _j,unwatchFile as S1,watchFile as T1}from"fs";import{dirname as M1,join as Ja,resolve as C1}from"path";function k1(t){let e=t;for(;;){let n=Ja(e,".git");if(Va(n))try{let s=_j(n);if(s.isFile()){let r=tm(n,"utf8").trim();if(r.startsWith("gitdir: ")){let o=C1(e,r.slice(8).trim()),a=Ja(o,"HEAD");if(!Va(a))return null;let c=Ja(o,"commondir"),l=Va(c)?C1(o,tm(c,"utf8").trim()):o;return{repoDir:e,commonGitDir:l,headPath:a}}}else if(s.isDirectory()){let r=Ja(n,"HEAD");return Va(r)?{repoDir:e,commonGitDir:n,headPath:r}:null}}catch{return null}let i=M1(e);if(i===e)return null;e=i}}function Ej(t){let e=Pj("git",["--no-optional-locks","symbolic-ref","--quiet","--short","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]});return(e.status===0?e.stdout.trim():"")||null}function Aj(t){return new Promise(e=>{Ij("git",["--no-optional-locks","symbolic-ref","--quiet","--short","HEAD"],{cwd:t,encoding:"utf8"},(n,i)=>{if(n){e(null);return}let s=i.trim();e(s||null)})})}function Oj(){return process.platform==="linux"&&!!(process.env.WSL_DISTRO_NAME||process.env.WSL_INTEROP)}function Lj(t){return/^\/mnt\/[a-z](?:\/|$)/i.test(t)}function Wj(t){return Oj()&&Lj(t)}var nm=class t{constructor(e){this.extensionStatuses=new Map;this.cachedBranch=void 0;this.gitPaths=void 0;this.headWatcher=null;this.headWatchFilePath=null;this.headWatchFileListener=null;this.reftableWatcher=null;this.reftableTablesListWatcher=null;this.reftableTablesListPath=null;this.branchChangeCallbacks=new Set;this.availableProviderCount=0;this.refreshTimer=null;this.gitWatcherRetryTimer=null;this.refreshInFlight=!1;this.refreshPending=!1;this.disposed=!1;this.cwd=e,this.gitPaths=k1(e),this.setupGitWatcher()}static{this.WATCH_DEBOUNCE_MS=500}getGitBranch(){return this.cachedBranch===void 0&&(this.cachedBranch=this.resolveGitBranchSync()),this.cachedBranch}getExtensionStatuses(){return this.extensionStatuses}onBranchChange(e){return this.branchChangeCallbacks.add(e),()=>this.branchChangeCallbacks.delete(e)}setExtensionStatus(e,n){n===void 0?this.extensionStatuses.delete(e):this.extensionStatuses.set(e,n)}clearExtensionStatuses(){this.extensionStatuses.clear()}getAvailableProviderCount(){return this.availableProviderCount}setAvailableProviderCount(e){this.availableProviderCount=e}setCwd(e){this.cwd!==e&&(this.cwd=e,this.refreshTimer&&(clearTimeout(this.refreshTimer),this.refreshTimer=null),this.clearGitWatchers(),this.cachedBranch=void 0,this.gitPaths=k1(e),this.setupGitWatcher(),this.notifyBranchChange())}dispose(){this.disposed=!0,this.refreshTimer&&(clearTimeout(this.refreshTimer),this.refreshTimer=null),this.clearGitWatchers(),this.branchChangeCallbacks.clear()}notifyBranchChange(){for(let e of this.branchChangeCallbacks)e()}scheduleRefresh(){if(!(this.disposed||this.refreshTimer)){if(this.refreshInFlight){this.refreshPending=!0;return}this.refreshTimer=setTimeout(()=>{this.refreshTimer=null,this.refreshGitBranchAsync()},t.WATCH_DEBOUNCE_MS)}}async refreshGitBranchAsync(){if(!this.disposed){if(this.refreshInFlight){this.refreshPending=!0;return}this.refreshInFlight=!0;try{let e=await this.resolveGitBranchAsync();if(this.disposed)return;if(this.cachedBranch!==void 0&&this.cachedBranch!==e){this.cachedBranch=e,this.notifyBranchChange();return}this.cachedBranch=e}finally{this.refreshInFlight=!1,this.refreshPending&&!this.disposed&&(this.refreshPending=!1,this.scheduleRefresh())}}}resolveGitBranchSync(){try{if(!this.gitPaths)return null;let e=tm(this.gitPaths.headPath,"utf8").trim();if(e.startsWith("ref: refs/heads/")){let n=e.slice(16);return n===".invalid"?Ej(this.gitPaths.repoDir)??"detached":n}return"detached"}catch{return null}}async resolveGitBranchAsync(){try{if(!this.gitPaths)return null;let e=tm(this.gitPaths.headPath,"utf8").trim();if(e.startsWith("ref: refs/heads/")){let n=e.slice(16);return n===".invalid"?await Aj(this.gitPaths.repoDir)??"detached":n}return"detached"}catch{return null}}clearGitWatchers(){br(this.headWatcher),this.headWatcher=null,this.headWatchFilePath&&this.headWatchFileListener&&(S1(this.headWatchFilePath,this.headWatchFileListener),this.headWatchFilePath=null,this.headWatchFileListener=null),br(this.reftableWatcher),this.reftableWatcher=null,br(this.reftableTablesListWatcher),this.reftableTablesListWatcher=null,this.reftableTablesListPath&&(S1(this.reftableTablesListPath),this.reftableTablesListPath=null),this.gitWatcherRetryTimer&&(clearTimeout(this.gitWatcherRetryTimer),this.gitWatcherRetryTimer=null)}scheduleGitWatcherRetry(){this.disposed||this.gitWatcherRetryTimer||(this.gitWatcherRetryTimer=setTimeout(()=>{this.gitWatcherRetryTimer=null,this.setupGitWatcher()},ik))}handleGitWatcherError(){this.clearGitWatchers(),this.scheduleGitWatcherRetry()}setupGitWatcher(){if(this.clearGitWatchers(),!this.gitPaths)return;let e=Wj(this.gitPaths.repoDir);if(this.headWatcher=va(M1(this.gitPaths.headPath),(i,s)=>{(!s||s==="HEAD")&&this.scheduleRefresh()},()=>this.handleGitWatcherError()),e&&(this.headWatchFilePath=this.gitPaths.headPath,this.headWatchFileListener=(i,s)=>{(i.mtimeMs!==s.mtimeMs||i.ctimeMs!==s.ctimeMs||i.size!==s.size)&&this.scheduleRefresh()},T1(this.headWatchFilePath,{interval:1e3},this.headWatchFileListener)),!this.headWatcher&&!e)return;let n=Ja(this.gitPaths.commonGitDir,"reftable");if(Va(n)){if(this.reftableWatcher=va(n,()=>{this.scheduleRefresh()},()=>this.handleGitWatcherError()),!this.reftableWatcher)return;let i=Ja(n,"tables.list");if(Va(i)){if(this.reftableTablesListPath=i,this.reftableTablesListWatcher=va(i,()=>{this.scheduleRefresh()},()=>this.handleGitWatcherError()),!this.reftableTablesListWatcher)return;T1(i,{interval:250},(s,r)=>{(s.mtimeMs!==r.mtimeMs||s.ctimeMs!==r.ctimeMs||s.size!==r.size)&&this.scheduleRefresh()})}}}};var lb=[{name:"settings",description:"Open settings menu"},{name:"model",description:"Select model (opens selector UI)"},{name:"scoped-models",description:"Enable/disable models for Ctrl+P cycling"},{name:"export",description:"Export session (HTML default, or specify path: .html/.jsonl)"},{name:"import",description:"Import and resume a session from a JSONL file"},{name:"share",description:"Share session as a secret GitHub gist"},{name:"copy",description:"Copy last agent message to clipboard"},{name:"name",description:"Set session display name"},{name:"session",description:"Show session info and stats"},{name:"changelog",description:"Show changelog entries"},{name:"hotkeys",description:"Show all keyboard shortcuts"},{name:"fork",description:"Create a new fork from a previous user message"},{name:"clone",description:"Duplicate the current session at the current position"},{name:"tree",description:"Navigate session tree (switch branches)"},{name:"trust",description:"Save project trust decision for future sessions"},{name:"login",description:"Configure provider authentication"},{name:"logout",description:"Remove provider authentication"},{name:"new",description:"Start a new session"},{name:"compact",description:"Manually compact the session context"},{name:"resume",description:"Resume a different session"},{name:"reload",description:"Reload keybindings, extensions, skills, prompts, and themes"},{name:"quit",description:`Quit ${bt}`}];import im from"node:path";import{existsSync as Fj,readFileSync as Uj}from"fs";var ub="earendil-works/pi",Dj="packages/coding-agent",$j=/^https:\/\/github\.com\/(?:badlogic|earendil-works)\/pi-mono(?=\/|$)/,Bj=/^[a-z][a-z0-9+.-]*:/i,Nj=/(!?\[[^\]\n]+\]\()([^\s)]+)((?:\s+[^)]*)?\))/g;function jj(t){return`${t.major}.${t.minor}.${t.patch}`}function qj(t){let e=typeof t=="string"?t:jj(t);return e.startsWith("v")?e:`v${e}`}function Gj(t){let e=t.indexOf("#"),n=e===-1?t:t.slice(0,e),i=e===-1?"":t.slice(e),s=n.indexOf("?");return s===-1?{fragment:i,pathPart:n,query:""}:{fragment:i,pathPart:n.slice(0,s),query:n.slice(s)}}function Kj(t){return t.replaceAll("\\","/")}function Hj(t){let e=Kj(t),n=e.startsWith("/")?im.posix.normalize(e.replace(/^\/+/,"")):im.posix.normalize(im.posix.join(Dj,e));if(!(n==="."||n.startsWith("../")||n===".."))return n}function zj(t,e){return t.endsWith("/")?!0:!im.posix.basename(e).includes(".")}function Vj(t,e){let n=t.replace($j,`https://github.com/${ub}`),i=`https://github.com/${ub}`;for(let l of["blob","tree"])for(let u of["main","master"]){let d=`${i}/${l}/${u}/`;n.startsWith(d)&&(n=`${i}/${l}/${e}/${n.slice(d.length)}`)}if(n.startsWith("#")||n.startsWith("//")||Bj.test(n))return n;let{fragment:s,pathPart:r,query:o}=Gj(n);if(!r)return n;let a=Hj(r);if(!a)return n;let c=zj(r,a)?"tree":"blob";return`https://github.com/${ub}/${c}/${e}/${encodeURI(a)}${o}${s}`}function db(t,e){let n=qj(e);return t.replace(Nj,(i,s,r,o)=>`${s}${Vj(r,n)}${o}`)}function pb(t){if(!Fj(t))return[];try{let n=Uj(t,"utf-8").split(`
|
|
297
|
+
`){let s=this.options[this.selectedIndex];s&&this.onSelectCallback(s)}else i.matches(n,"tui.select.cancel")&&this.onCancelCallback()}dispose(){this.countdown?.dispose()}};import{spawnSync as wj}from"node:child_process";import{existsSync as Sj}from"node:fs";import{unlink as Tj}from"node:fs/promises";import*as wM from"node:os";function bM(t){return t.toLowerCase().replace(/\s+/g," ").trim()}function xj(t){return`${t.id} ${t.name??""} ${t.allMessagesText} ${t.cwd}`}function ob(t){return!!t.name?.trim()}function vj(t,e){return e==="all"?!0:ob(t)}function yj(t){let e=t.trim();if(!e)return{mode:"tokens",tokens:[],regex:null};if(e.startsWith("re:")){let a=e.slice(3).trim();if(!a)return{mode:"regex",tokens:[],regex:null,error:"Empty regex"};try{return{mode:"regex",tokens:[],regex:new RegExp(a,"i")}}catch(c){let l=c instanceof Error?c.message:String(c);return{mode:"regex",tokens:[],regex:null,error:l}}}let n=[],i="",s=!1,r=!1,o=a=>{let c=i.trim();i="",c&&n.push({kind:a,value:c})};for(let a=0;a<e.length;a++){let c=e[a];if(c==='"'){s?(o("phrase"),s=!1):(o("fuzzy"),s=!0);continue}if(!s&&/\s/.test(c)){o("fuzzy");continue}i+=c}return s&&(r=!0),r?{mode:"tokens",tokens:e.split(/\s+/).map(a=>a.trim()).filter(a=>a.length>0).map(a=>({kind:"fuzzy",value:a})),regex:null}:(o(s?"phrase":"fuzzy"),{mode:"tokens",tokens:n,regex:null})}function xM(t,e){let n=xj(t);if(e.mode==="regex"){if(!e.regex)return{matches:!1,score:0};let r=n.search(e.regex);return r<0?{matches:!1,score:0}:{matches:!0,score:r*.1}}if(e.tokens.length===0)return{matches:!0,score:0};let i=0,s=null;for(let r of e.tokens){if(r.kind==="phrase"){s===null&&(s=bM(n));let a=bM(r.value);if(!a)continue;let c=s.indexOf(a);if(c<0)return{matches:!1,score:0};i+=c*.1;continue}let o=Dd(r.value,n);if(!o.matches)return{matches:!1,score:0};i+=o.score}return{matches:!0,score:i}}function vM(t,e,n,i="all"){let s=i==="all"?t:t.filter(c=>vj(c,i));if(!e.trim())return s;let o=yj(e);if(o.error)return[];if(n==="recent"){let c=[];for(let l of s)xM(l,o).matches&&c.push(l);return c}let a=[];for(let c of s){let l=xM(c,o);l.matches&&a.push({session:c,score:l.score})}return a.sort((c,l)=>c.score!==l.score?c.score-l.score:l.session.modified.getTime()-c.session.modified.getTime()),a.map(c=>c.session)}function yM(t){let e=wM.homedir();return t&&(t.startsWith(e)?`~${t.slice(e.length)}`:t)}function Cj(t){let n=new Date().getTime()-t.getTime(),i=Math.floor(n/6e4),s=Math.floor(n/36e5),r=Math.floor(n/864e5);return i<1?"now":i<60?`${i}m`:s<24?`${s}h`:r<7?`${r}d`:r<30?`${Math.floor(r/7)}w`:r<365?`${Math.floor(r/30)}mo`:`${Math.floor(r/365)}y`}function Gl(t){return t&&oi(t)}var ab=class{constructor(e,n,i,s){this.loading=!1;this.loadProgress=null;this.showPath=!1;this.confirmingDeletePath=null;this.statusMessage=null;this.statusTimeout=null;this.showRenameHint=!1;this.scope=e,this.sortMode=n,this.nameFilter=i,this.requestRender=s}setScope(e){this.scope=e}setSortMode(e){this.sortMode=e}setNameFilter(e){this.nameFilter=e}setLoading(e){this.loading=e,this.loadProgress=null}setProgress(e,n){this.loadProgress={loaded:e,total:n}}setShowPath(e){this.showPath=e}setShowRenameHint(e){this.showRenameHint=e}setConfirmingDeletePath(e){this.confirmingDeletePath=e}clearStatusTimeout(){this.statusTimeout&&(clearTimeout(this.statusTimeout),this.statusTimeout=null)}setStatusMessage(e,n){this.clearStatusTimeout(),this.statusMessage=e,!(!e||!n)&&(this.statusTimeout=setTimeout(()=>{this.statusMessage=null,this.statusTimeout=null,this.requestRender()},n))}invalidate(){}render(e){let n=this.scope==="current"?"Resume Session (Current Folder)":"Resume Session (All)",i=b.bold(n),s=this.sortMode==="threaded"?"Threaded":this.sortMode==="recent"?"Recent":"Fuzzy",r=b.fg("muted","Sort: ")+b.fg("accent",s),o=this.nameFilter==="all"?"All":"Named",a=b.fg("muted","Name: ")+b.fg("accent",o),c;if(this.loading){let h=this.loadProgress?`${this.loadProgress.loaded}/${this.loadProgress.total}`:"...";c=`${b.fg("muted","\u25CB Current Folder | ")}${b.fg("accent",`Loading ${h}`)}`}else this.scope==="current"?c=`${b.fg("accent","\u25C9 Current Folder")}${b.fg("muted"," | \u25CB All")}`:c=`${b.fg("muted","\u25CB Current Folder | ")}${b.fg("accent","\u25C9 All")}`;let l=Z(`${c} ${a} ${r}`,e,""),u=Math.max(0,e-j(l)-1),d=Z(i,u,""),p=Math.max(0,e-j(d)-j(l)),m,g;if(this.confirmingDeletePath!==null){let h=`Delete session? ${re("tui.select.confirm","confirm")} \xB7 ${re("tui.select.cancel","cancel")}`;m=b.fg("error",Z(h,e,"\u2026")),g=""}else if(this.statusMessage){let h=this.statusMessage.type==="error"?"error":"accent";m=b.fg(h,Z(this.statusMessage.message,e,"\u2026")),g=""}else{let h=this.showPath?"(on)":"(off)",f=b.fg("muted"," \xB7 "),x=re("tui.input.tab","scope")+f+b.fg("muted",'re:<pattern> regex \xB7 "phrase" exact'),v=[re("app.session.toggleSort","sort"),re("app.session.toggleNamedFilter","named"),re("app.session.delete","delete"),re("app.session.togglePath",`path ${h}`)];this.showRenameHint&&v.push(re("app.session.rename","rename"));let w=v.join(f);m=Z(x,e,"\u2026"),g=Z(w,e,"\u2026")}return[`${d}${" ".repeat(p)}${l}`,m,g]}};function kj(t){let e=new Map;for(let s of t){let r=Gl(s.path)??s.path;e.set(r,{session:s,children:[]})}let n=[];for(let s of t){let r=Gl(s.path)??s.path,o=e.get(r),a=Gl(s.parentSessionPath);a&&e.has(a)?e.get(a).children.push(o):n.push(o)}let i=s=>{s.sort((r,o)=>o.session.modified.getTime()-r.session.modified.getTime());for(let r of s)i(r.children)};return i(n),n}function Mj(t){let e=[],n=(i,s,r,o)=>{e.push({session:i.session,depth:s,isLast:o,ancestorContinues:r});for(let a=0;a<i.children.length;a++){let c=a===i.children.length-1,l=s>0?!o:!1;n(i.children[a],s+1,[...r,l],c)}};for(let i=0;i<t.length;i++)n(t[i],0,[],i===t.length-1);return e}var cb=class{constructor(e,n,i,s,r,o){this.allSessions=[];this.filteredSessions=[];this.selectedIndex=0;this.showCwd=!1;this.sortMode="threaded";this.nameFilter="all";this.showPath=!1;this.confirmingDeletePath=null;this.onExit=()=>{};this.maxVisible=10;this._focused=!1;this.allSessions=e,this.filteredSessions=[],this.searchInput=new Qe,this.showCwd=n,this.sortMode=i,this.nameFilter=s,this.keybindings=r,this.currentSessionCanonicalPath=Gl(o),this.filterSessions(""),this.searchInput.onSubmit=()=>{if(this.filteredSessions[this.selectedIndex]){let a=this.filteredSessions[this.selectedIndex];this.onSelect&&this.onSelect(a.session.path)}}}getSelectedSessionPath(){return this.filteredSessions[this.selectedIndex]?.session.path}get focused(){return this._focused}set focused(e){this._focused=e,this.searchInput.focused=e}setSortMode(e){this.sortMode=e,this.filterSessions(this.searchInput.getValue())}setNameFilter(e){this.nameFilter=e,this.filterSessions(this.searchInput.getValue())}setSessions(e,n){this.allSessions=e,this.showCwd=n,this.filterSessions(this.searchInput.getValue())}filterSessions(e){let n=e.trim(),i=this.nameFilter==="all"?this.allSessions:this.allSessions.filter(s=>ob(s));if(this.sortMode==="threaded"&&!n){let s=kj(i);this.filteredSessions=Mj(s)}else{let s=vM(i,e,this.sortMode,"all");this.filteredSessions=s.map(r=>({session:r,depth:0,isLast:!0,ancestorContinues:[]}))}this.selectedIndex=Math.min(this.selectedIndex,Math.max(0,this.filteredSessions.length-1))}setConfirmingDeletePath(e){this.confirmingDeletePath=e,this.onDeleteConfirmationChange?.(e)}startDeleteConfirmationForSelectedSession(){let e=this.filteredSessions[this.selectedIndex];if(e){if(this.isCurrentSessionPath(e.session.path)){this.onError?.("Cannot delete the currently active session");return}this.setConfirmingDeletePath(e.session.path)}}isCurrentSessionPath(e){return this.currentSessionCanonicalPath?(Gl(e)??e)===this.currentSessionCanonicalPath:!1}invalidate(){}render(e){let n=[];if(n.push(...this.searchInput.render(e)),n.push(""),this.filteredSessions.length===0){let r;if(this.nameFilter==="named"){let o=ke("app.session.toggleNamedFilter");this.showCwd?r=` No named sessions found. Press ${o} to show all.`:r=` No named sessions in current folder. Press ${o} to show all, or Tab to view all.`}else this.showCwd?r=" No sessions found":r=" No sessions in current folder. Press Tab to view all.";return n.push(b.fg("muted",Z(r,e,"\u2026"))),n}let i=Math.max(0,Math.min(this.selectedIndex-Math.floor(this.maxVisible/2),this.filteredSessions.length-this.maxVisible)),s=Math.min(i+this.maxVisible,this.filteredSessions.length);for(let r=i;r<s;r++){let o=this.filteredSessions[r],a=o.session,c=r===this.selectedIndex,l=a.path===this.confirmingDeletePath,u=this.isCurrentSessionPath(a.path),d=this.buildTreePrefix(o),p=!!a.name,g=(a.name??a.firstMessage).replace(/[\x00-\x1f\x7f]/g," ").trim(),h=Cj(a.modified),x=`${String(a.messageCount)} ${h}`;this.showCwd&&a.cwd&&(x=`${yM(a.cwd)} ${x}`),this.showPath&&(x=`${yM(a.path)} ${x}`);let v=c?b.fg("accent","\u203A "):" ",w=j(d),C=j(x)+2,P=e-2-w-C,_=Z(g,Math.max(10,P),"\u2026"),F=null;l?F="error":u?F="accent":p&&(F="warning");let A=F?b.fg(F,_):_;c&&(A=b.bold(A));let W=v+b.fg("dim",d)+A,R=j(W),k=Math.max(1,e-R-j(x)),O=b.fg(l?"error":"dim",x),U=W+" ".repeat(k)+O;c&&(U=b.bg("selectedBg",U)),n.push(Z(U,e))}if(i>0||s<this.filteredSessions.length){let r=` (${this.selectedIndex+1}/${this.filteredSessions.length})`,o=b.fg("muted",Z(r,e,""));n.push(o)}return n}buildTreePrefix(e){if(e.depth===0)return"";let n=e.ancestorContinues.map(s=>s?"\u2502 ":" "),i=e.isLast?"\u2514\u2500 ":"\u251C\u2500 ";return n.join("")+i}handleInput(e){let n=fe();if(this.confirmingDeletePath!==null){if(n.matches(e,"tui.select.confirm")){let i=this.confirmingDeletePath;this.setConfirmingDeletePath(null),this.onDeleteSession?.(i);return}if(n.matches(e,"tui.select.cancel")){this.setConfirmingDeletePath(null);return}return}if(n.matches(e,"tui.input.tab")){this.onToggleScope&&this.onToggleScope();return}if(n.matches(e,"app.session.toggleSort")){this.onToggleSort?.();return}if(this.keybindings.matches(e,"app.session.toggleNamedFilter")){this.onToggleNameFilter?.();return}if(n.matches(e,"app.session.togglePath")){this.showPath=!this.showPath,this.onTogglePath?.(this.showPath);return}if(n.matches(e,"app.session.delete")){this.startDeleteConfirmationForSelectedSession();return}if(n.matches(e,"app.session.rename")){let i=this.filteredSessions[this.selectedIndex];i&&this.onRenameSession?.(i.session.path);return}if(n.matches(e,"app.session.deleteNoninvasive")){if(this.searchInput.getValue().length>0){this.searchInput.handleInput(e),this.filterSessions(this.searchInput.getValue());return}this.startDeleteConfirmationForSelectedSession();return}if(n.matches(e,"tui.select.up"))this.selectedIndex=Math.max(0,this.selectedIndex-1);else if(n.matches(e,"tui.select.down"))this.selectedIndex=Math.min(this.filteredSessions.length-1,this.selectedIndex+1);else if(n.matches(e,"tui.select.pageUp"))this.selectedIndex=Math.max(0,this.selectedIndex-this.maxVisible);else if(n.matches(e,"tui.select.pageDown"))this.selectedIndex=Math.min(this.filteredSessions.length-1,this.selectedIndex+this.maxVisible);else if(n.matches(e,"tui.select.confirm")){let i=this.filteredSessions[this.selectedIndex];i&&this.onSelect&&this.onSelect(i.session.path)}else n.matches(e,"tui.select.cancel")?this.onCancel&&this.onCancel():(this.searchInput.handleInput(e),this.filterSessions(this.searchInput.getValue()))}};async function Rj(t){let e=t.startsWith("-")?["--",t]:[t],n=wj("trash",e,{encoding:"utf-8"}),i=()=>{let s=[];n.error&&s.push(n.error.message);let r=n.stderr?.trim();return r&&s.push(r.split(`
|
|
298
|
+
`)[0]??r),s.length===0?null:`trash: ${s.join(" \xB7 ").slice(0,200)}`};if(n.status===0||!Sj(t))return{ok:!0,method:"trash"};try{return await Tj(t),{ok:!0,method:"unlink"}}catch(s){let r=s instanceof Error?s.message:String(s),o=i();return{ok:!1,method:"unlink",error:o?`${r} (${o})`:r}}}var Wr=class extends H{constructor(n,i,s,r,o,a,c,l){super();this.canRename=!0;this.scope="current";this.sortMode="threaded";this.nameFilter="all";this.currentSessions=null;this.allSessions=null;this.currentLoading=!1;this.allLoading=!1;this.allLoadSeq=0;this.mode="list";this.renameInput=new Qe;this.renameTargetPath=null;this._focused=!1;this.keybindings=c?.keybindings??Os.create(),this.currentSessionsLoader=n,this.allSessionsLoader=i,this.onCancel=r,this.requestRender=a,this.header=new ab(this.scope,this.sortMode,this.nameFilter,this.requestRender);let u=c?.renameSession;this.renameSession=u,this.canRename=!!u,this.header.setShowRenameHint(c?.showRenameHint??this.canRename),this.sessionList=new cb([],!1,this.sortMode,this.nameFilter,this.keybindings,l),this.buildBaseLayout(this.sessionList),this.renameInput.onSubmit=p=>{this.confirmRename(p)};let d=()=>this.header.setStatusMessage(null);this.sessionList.onSelect=p=>{d(),s(p)},this.sessionList.onCancel=()=>{d(),r()},this.sessionList.onExit=()=>{d(),o()},this.sessionList.onToggleScope=()=>this.toggleScope(),this.sessionList.onToggleSort=()=>this.toggleSortMode(),this.sessionList.onToggleNameFilter=()=>this.toggleNameFilter(),this.sessionList.onRenameSession=p=>{if(!u||this.scope==="current"&&this.currentLoading||this.scope==="all"&&this.allLoading)return;let g=(this.scope==="all"?this.allSessions??[]:this.currentSessions??[]).find(h=>h.path===p);this.enterRenameMode(p,g?.name)},this.sessionList.onTogglePath=p=>{this.header.setShowPath(p),this.requestRender()},this.sessionList.onDeleteConfirmationChange=p=>{this.header.setConfirmingDeletePath(p),this.requestRender()},this.sessionList.onError=p=>{this.header.setStatusMessage({type:"error",message:p},3e3),this.requestRender()},this.sessionList.onDeleteSession=async p=>{let m=await Rj(p);if(m.ok){this.currentSessions&&(this.currentSessions=this.currentSessions.filter(x=>x.path!==p)),this.allSessions&&(this.allSessions=this.allSessions.filter(x=>x.path!==p));let g=this.scope==="all"?this.allSessions??[]:this.currentSessions??[],h=this.scope==="all";this.sessionList.setSessions(g,h);let f=m.method==="trash"?"Session moved to trash":"Session deleted";this.header.setStatusMessage({type:"info",message:f},2e3),await this.refreshSessionsAfterMutation()}else{let g=m.error??"Unknown error";this.header.setStatusMessage({type:"error",message:`Failed to delete: ${g}`},3e3)}this.requestRender()},this.loadCurrentSessions()}handleInput(n){if(this.mode==="rename"){if(fe().matches(n,"tui.select.cancel")){this.exitRenameMode();return}this.renameInput.handleInput(n);return}this.sessionList.handleInput(n)}get focused(){return this._focused}set focused(n){this._focused=n,this.sessionList.focused=n,this.renameInput.focused=n,n&&this.mode==="rename"&&(this.renameInput.focused=!0)}buildBaseLayout(n,i){this.clear(),this.addChild(new L(1)),this.addChild(new z(s=>b.fg("accent",s))),this.addChild(new L(1)),(i?.showHeader??!0)&&(this.addChild(this.header),this.addChild(new L(1))),this.addChild(n),this.addChild(new L(1)),this.addChild(new z(s=>b.fg("accent",s)))}loadCurrentSessions(){this.loadScope("current","initial")}enterRenameMode(n,i){this.mode="rename",this.renameTargetPath=n,this.renameInput.setValue(i??""),this.renameInput.focused=!0;let s=new H;s.addChild(new E(b.bold("Rename Session"),1,0)),s.addChild(new L(1)),s.addChild(this.renameInput),s.addChild(new L(1)),s.addChild(new E(b.fg("muted",`${ke("tui.select.confirm")} to save \xB7 ${ke("tui.select.cancel")} to cancel`),1,0)),this.buildBaseLayout(s,{showHeader:!1}),this.requestRender()}exitRenameMode(){this.mode="list",this.renameTargetPath=null,this.buildBaseLayout(this.sessionList),this.requestRender()}async confirmRename(n){let i=n.trim();if(!i)return;let s=this.renameTargetPath;if(!s){this.exitRenameMode();return}let r=this.renameSession;if(!r){this.exitRenameMode();return}try{await r(s,i),await this.refreshSessionsAfterMutation()}finally{this.exitRenameMode()}}async loadScope(n,i){let s=n==="all";n==="current"?this.currentLoading=!0:this.allLoading=!0;let r=n==="all"?++this.allLoadSeq:void 0;this.header.setScope(n),this.header.setLoading(!0),this.requestRender();let o=(a,c)=>{n===this.scope&&(r!==void 0&&r!==this.allLoadSeq||(this.header.setProgress(a,c),this.requestRender()))};try{let a=await(n==="current"?this.currentSessionsLoader(o):this.allSessionsLoader(o));if(n==="current"?(this.currentSessions=a,this.currentLoading=!1):(this.allSessions=a,this.allLoading=!1),n!==this.scope||r!==void 0&&r!==this.allLoadSeq)return;this.header.setLoading(!1),this.sessionList.setSessions(a,s),this.requestRender(),n==="all"&&a.length===0&&(this.currentSessions?.length??0)===0&&this.onCancel()}catch(a){if(n==="current"?this.currentLoading=!1:this.allLoading=!1,n!==this.scope||r!==void 0&&r!==this.allLoadSeq)return;let c=a instanceof Error?a.message:String(a);this.header.setLoading(!1),this.header.setStatusMessage({type:"error",message:`Failed to load sessions: ${c}`},4e3),i==="initial"&&this.sessionList.setSessions([],s),this.requestRender()}}toggleSortMode(){this.sortMode=this.sortMode==="threaded"?"recent":this.sortMode==="recent"?"relevance":"threaded",this.header.setSortMode(this.sortMode),this.sessionList.setSortMode(this.sortMode),this.requestRender()}toggleNameFilter(){this.nameFilter=this.nameFilter==="all"?"named":"all",this.header.setNameFilter(this.nameFilter),this.sessionList.setNameFilter(this.nameFilter),this.requestRender()}async refreshSessionsAfterMutation(){await this.loadScope(this.scope,"refresh")}toggleScope(){if(this.scope==="current"){if(this.scope="all",this.header.setScope(this.scope),this.allSessions!==null){this.header.setLoading(!1),this.sessionList.setSessions(this.allSessions,!0),this.requestRender();return}this.allLoading||this.loadScope("all","toggle");return}this.scope="current",this.header.setScope(this.scope),this.header.setLoading(this.currentLoading),this.sessionList.setSessions(this.currentSessions??[],!1),this.requestRender()}getSessionList(){return this.sessionList}};import GTe from"chalk";import*as tR from"node:crypto";import*as wn from"node:fs";import*as pc from"node:os";import*as Ve from"node:path";import n8 from"chalk";import{spawn as Rb,spawnSync as i8}from"child_process";import{execFile as Ij,spawnSync as Pj}from"child_process";import{existsSync as Va,readFileSync as tm,statSync as _j,unwatchFile as SM,watchFile as TM}from"fs";import{dirname as MM,join as Ja,resolve as CM}from"path";function kM(t){let e=t;for(;;){let n=Ja(e,".git");if(Va(n))try{let s=_j(n);if(s.isFile()){let r=tm(n,"utf8").trim();if(r.startsWith("gitdir: ")){let o=CM(e,r.slice(8).trim()),a=Ja(o,"HEAD");if(!Va(a))return null;let c=Ja(o,"commondir"),l=Va(c)?CM(o,tm(c,"utf8").trim()):o;return{repoDir:e,commonGitDir:l,headPath:a}}}else if(s.isDirectory()){let r=Ja(n,"HEAD");return Va(r)?{repoDir:e,commonGitDir:n,headPath:r}:null}}catch{return null}let i=MM(e);if(i===e)return null;e=i}}function Ej(t){let e=Pj("git",["--no-optional-locks","symbolic-ref","--quiet","--short","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]});return(e.status===0?e.stdout.trim():"")||null}function Aj(t){return new Promise(e=>{Ij("git",["--no-optional-locks","symbolic-ref","--quiet","--short","HEAD"],{cwd:t,encoding:"utf8"},(n,i)=>{if(n){e(null);return}let s=i.trim();e(s||null)})})}function Oj(){return process.platform==="linux"&&!!(process.env.WSL_DISTRO_NAME||process.env.WSL_INTEROP)}function Lj(t){return/^\/mnt\/[a-z](?:\/|$)/i.test(t)}function Wj(t){return Oj()&&Lj(t)}var nm=class t{constructor(e){this.extensionStatuses=new Map;this.cachedBranch=void 0;this.gitPaths=void 0;this.headWatcher=null;this.headWatchFilePath=null;this.headWatchFileListener=null;this.reftableWatcher=null;this.reftableTablesListWatcher=null;this.reftableTablesListPath=null;this.branchChangeCallbacks=new Set;this.availableProviderCount=0;this.refreshTimer=null;this.gitWatcherRetryTimer=null;this.refreshInFlight=!1;this.refreshPending=!1;this.disposed=!1;this.cwd=e,this.gitPaths=kM(e),this.setupGitWatcher()}static{this.WATCH_DEBOUNCE_MS=500}getGitBranch(){return this.cachedBranch===void 0&&(this.cachedBranch=this.resolveGitBranchSync()),this.cachedBranch}getExtensionStatuses(){return this.extensionStatuses}onBranchChange(e){return this.branchChangeCallbacks.add(e),()=>this.branchChangeCallbacks.delete(e)}setExtensionStatus(e,n){n===void 0?this.extensionStatuses.delete(e):this.extensionStatuses.set(e,n)}clearExtensionStatuses(){this.extensionStatuses.clear()}getAvailableProviderCount(){return this.availableProviderCount}setAvailableProviderCount(e){this.availableProviderCount=e}setCwd(e){this.cwd!==e&&(this.cwd=e,this.refreshTimer&&(clearTimeout(this.refreshTimer),this.refreshTimer=null),this.clearGitWatchers(),this.cachedBranch=void 0,this.gitPaths=kM(e),this.setupGitWatcher(),this.notifyBranchChange())}dispose(){this.disposed=!0,this.refreshTimer&&(clearTimeout(this.refreshTimer),this.refreshTimer=null),this.clearGitWatchers(),this.branchChangeCallbacks.clear()}notifyBranchChange(){for(let e of this.branchChangeCallbacks)e()}scheduleRefresh(){if(!(this.disposed||this.refreshTimer)){if(this.refreshInFlight){this.refreshPending=!0;return}this.refreshTimer=setTimeout(()=>{this.refreshTimer=null,this.refreshGitBranchAsync()},t.WATCH_DEBOUNCE_MS)}}async refreshGitBranchAsync(){if(!this.disposed){if(this.refreshInFlight){this.refreshPending=!0;return}this.refreshInFlight=!0;try{let e=await this.resolveGitBranchAsync();if(this.disposed)return;if(this.cachedBranch!==void 0&&this.cachedBranch!==e){this.cachedBranch=e,this.notifyBranchChange();return}this.cachedBranch=e}finally{this.refreshInFlight=!1,this.refreshPending&&!this.disposed&&(this.refreshPending=!1,this.scheduleRefresh())}}}resolveGitBranchSync(){try{if(!this.gitPaths)return null;let e=tm(this.gitPaths.headPath,"utf8").trim();if(e.startsWith("ref: refs/heads/")){let n=e.slice(16);return n===".invalid"?Ej(this.gitPaths.repoDir)??"detached":n}return"detached"}catch{return null}}async resolveGitBranchAsync(){try{if(!this.gitPaths)return null;let e=tm(this.gitPaths.headPath,"utf8").trim();if(e.startsWith("ref: refs/heads/")){let n=e.slice(16);return n===".invalid"?await Aj(this.gitPaths.repoDir)??"detached":n}return"detached"}catch{return null}}clearGitWatchers(){br(this.headWatcher),this.headWatcher=null,this.headWatchFilePath&&this.headWatchFileListener&&(SM(this.headWatchFilePath,this.headWatchFileListener),this.headWatchFilePath=null,this.headWatchFileListener=null),br(this.reftableWatcher),this.reftableWatcher=null,br(this.reftableTablesListWatcher),this.reftableTablesListWatcher=null,this.reftableTablesListPath&&(SM(this.reftableTablesListPath),this.reftableTablesListPath=null),this.gitWatcherRetryTimer&&(clearTimeout(this.gitWatcherRetryTimer),this.gitWatcherRetryTimer=null)}scheduleGitWatcherRetry(){this.disposed||this.gitWatcherRetryTimer||(this.gitWatcherRetryTimer=setTimeout(()=>{this.gitWatcherRetryTimer=null,this.setupGitWatcher()},ik))}handleGitWatcherError(){this.clearGitWatchers(),this.scheduleGitWatcherRetry()}setupGitWatcher(){if(this.clearGitWatchers(),!this.gitPaths)return;let e=Wj(this.gitPaths.repoDir);if(this.headWatcher=va(MM(this.gitPaths.headPath),(i,s)=>{(!s||s==="HEAD")&&this.scheduleRefresh()},()=>this.handleGitWatcherError()),e&&(this.headWatchFilePath=this.gitPaths.headPath,this.headWatchFileListener=(i,s)=>{(i.mtimeMs!==s.mtimeMs||i.ctimeMs!==s.ctimeMs||i.size!==s.size)&&this.scheduleRefresh()},TM(this.headWatchFilePath,{interval:1e3},this.headWatchFileListener)),!this.headWatcher&&!e)return;let n=Ja(this.gitPaths.commonGitDir,"reftable");if(Va(n)){if(this.reftableWatcher=va(n,()=>{this.scheduleRefresh()},()=>this.handleGitWatcherError()),!this.reftableWatcher)return;let i=Ja(n,"tables.list");if(Va(i)){if(this.reftableTablesListPath=i,this.reftableTablesListWatcher=va(i,()=>{this.scheduleRefresh()},()=>this.handleGitWatcherError()),!this.reftableTablesListWatcher)return;TM(i,{interval:250},(s,r)=>{(s.mtimeMs!==r.mtimeMs||s.ctimeMs!==r.ctimeMs||s.size!==r.size)&&this.scheduleRefresh()})}}}};var lb=[{name:"settings",description:"Open settings menu"},{name:"model",description:"Select model (opens selector UI)"},{name:"scoped-models",description:"Enable/disable models for Ctrl+P cycling"},{name:"export",description:"Export session (HTML default, or specify path: .html/.jsonl)"},{name:"import",description:"Import and resume a session from a JSONL file"},{name:"share",description:"Share session as a secret GitHub gist"},{name:"copy",description:"Copy last agent message to clipboard"},{name:"name",description:"Set session display name"},{name:"session",description:"Show session info and stats"},{name:"changelog",description:"Show changelog entries"},{name:"hotkeys",description:"Show all keyboard shortcuts"},{name:"fork",description:"Create a new fork from a previous user message"},{name:"clone",description:"Duplicate the current session at the current position"},{name:"tree",description:"Navigate session tree (switch branches)"},{name:"trust",description:"Save project trust decision for future sessions"},{name:"login",description:"Configure provider authentication"},{name:"logout",description:"Remove provider authentication"},{name:"new",description:"Start a new session"},{name:"compact",description:"Manually compact the session context"},{name:"resume",description:"Resume a different session"},{name:"reload",description:"Reload keybindings, extensions, skills, prompts, and themes"},{name:"quit",description:`Quit ${bt}`}];import im from"node:path";import{existsSync as Fj,readFileSync as Uj}from"fs";var ub="earendil-works/pi",Dj="packages/coding-agent",$j=/^https:\/\/github\.com\/(?:badlogic|earendil-works)\/pi-mono(?=\/|$)/,Bj=/^[a-z][a-z0-9+.-]*:/i,Nj=/(!?\[[^\]\n]+\]\()([^\s)]+)((?:\s+[^)]*)?\))/g;function jj(t){return`${t.major}.${t.minor}.${t.patch}`}function qj(t){let e=typeof t=="string"?t:jj(t);return e.startsWith("v")?e:`v${e}`}function Gj(t){let e=t.indexOf("#"),n=e===-1?t:t.slice(0,e),i=e===-1?"":t.slice(e),s=n.indexOf("?");return s===-1?{fragment:i,pathPart:n,query:""}:{fragment:i,pathPart:n.slice(0,s),query:n.slice(s)}}function Kj(t){return t.replaceAll("\\","/")}function Hj(t){let e=Kj(t),n=e.startsWith("/")?im.posix.normalize(e.replace(/^\/+/,"")):im.posix.normalize(im.posix.join(Dj,e));if(!(n==="."||n.startsWith("../")||n===".."))return n}function zj(t,e){return t.endsWith("/")?!0:!im.posix.basename(e).includes(".")}function Vj(t,e){let n=t.replace($j,`https://github.com/${ub}`),i=`https://github.com/${ub}`;for(let l of["blob","tree"])for(let u of["main","master"]){let d=`${i}/${l}/${u}/`;n.startsWith(d)&&(n=`${i}/${l}/${e}/${n.slice(d.length)}`)}if(n.startsWith("#")||n.startsWith("//")||Bj.test(n))return n;let{fragment:s,pathPart:r,query:o}=Gj(n);if(!r)return n;let a=Hj(r);if(!a)return n;let c=zj(r,a)?"tree":"blob";return`https://github.com/${ub}/${c}/${e}/${encodeURI(a)}${o}${s}`}function db(t,e){let n=qj(e);return t.replace(Nj,(i,s,r,o)=>`${s}${Vj(r,n)}${o}`)}function pb(t){if(!Fj(t))return[];try{let n=Uj(t,"utf-8").split(`
|
|
299
299
|
`),i=[],s=[],r=null;for(let o of n)if(o.startsWith("## ")){r&&s.length>0&&i.push({...r,content:s.join(`
|
|
300
300
|
`).trim()});let a=o.match(/##\s+\[?(\d+)\.(\d+)\.(\d+)\]?/);a?(r={major:Number.parseInt(a[1],10),minor:Number.parseInt(a[2],10),patch:Number.parseInt(a[3],10)},s=[o]):(r=null,s=[])}else r&&s.push(o);return r&&s.length>0&&i.push({...r,content:s.join(`
|
|
301
|
-
`).trim()}),i}catch(e){return console.error(`Warning: Could not parse changelog: ${e}`),[]}}function Jj(t,e){return t.major!==e.major?t.major-e.major:t.minor!==e.minor?t.minor-e.minor:t.patch-e.patch}function R1(t,e){let n=e.split(".").map(Number),i={major:n[0]||0,minor:n[1]||0,patch:n[2]||0,content:""};return t.filter(s=>Jj(s,i)>0)}import{execSync as Ya,spawn as b6}from"child_process";import{platform as x6}from"os";import{spawnSync as i6}from"child_process";import{randomUUID as s6}from"crypto";import{readFileSync as _1,unlinkSync as r6}from"fs";import{tmpdir as o6}from"os";import{join as a6}from"path";import{createRequire as I1}from"module";import{dirname as Qj,join as Yj}from"path";import{pathToFileURL as Xj}from"url";var Zj=I1(import.meta.url),e6=I1(Xj(Yj(Qj(process.execPath),"package.json")).href),t6=process.platform!=="linux"||!!(process.env.DISPLAY||process.env.WAYLAND_DISPLAY);function n6(t=[Zj,e6]){for(let e of t)try{return e("@mariozechner/clipboard")}catch{}return null}var Fr=!process.env.TERMUX_VERSION&&t6?n6():null;var sm=["image/png","image/jpeg","image/webp","image/gif"],mb=1e3,c6=3e3,l6=5e3,u6=50*1024*1024;function hb(t=process.env){return!!t.WAYLAND_DISPLAY||t.XDG_SESSION_TYPE==="wayland"}function Kl(t){return t.split(";")[0]?.trim().toLowerCase()??t.toLowerCase()}function E1(t){switch(Kl(t)){case"image/png":return"png";case"image/jpeg":return"jpg";case"image/webp":return"webp";case"image/gif":return"gif";default:return null}}function A1(t){let e=t.map(i=>i.trim()).filter(Boolean).map(i=>({raw:i,base:Kl(i)}));for(let i of sm){let s=e.find(r=>r.base===i);if(s)return s.raw}return e.find(i=>i.base.startsWith("image/"))?.raw??null}function d6(t){let e=Kl(t);return sm.some(n=>n===e)}async function p6(t){let e=await Ba();if(!e)return null;try{let n=e.PhotonImage.new_from_byteslice(t);try{return n.get_bytes()}finally{n.free()}}catch{return null}}function Qa(t,e,n){let i=n?.timeoutMs??c6,s=n?.maxBufferBytes??u6,r=i6(t,e,{timeout:i,maxBuffer:s,env:n?.env});return r.error?{ok:!1,stdout:Buffer.alloc(0)}:r.status!==0?{ok:!1,stdout:Buffer.alloc(0)}:{ok:!0,stdout:Buffer.isBuffer(r.stdout)?r.stdout:Buffer.from(r.stdout??"",typeof r.stdout=="string"?"utf-8":void 0)}}function m6(){let t=Qa("wl-paste",["--list-types"],{timeoutMs:mb});if(!t.ok)return null;let e=t.stdout.toString("utf-8").split(/\r?\n/).map(s=>s.trim()).filter(Boolean),n=A1(e);if(!n)return null;let i=Qa("wl-paste",["--type",n,"--no-newline"]);return!i.ok||i.stdout.length===0?null:{bytes:i.stdout,mimeType:Kl(n)}}function h6(t=process.env){if(t.WSL_DISTRO_NAME||t.WSLENV)return!0;try{let e=_1("/proc/version","utf-8");return/microsoft|wsl/i.test(e)}catch{return!1}}function g6(){let t=a6(o6(),`pi-wsl-clip-${s6()}.png`);try{let e=Qa("wslpath",["-w",t],{timeoutMs:mb});if(!e.ok)return null;let n=e.stdout.toString("utf-8").trim();if(!n)return null;let s=["Add-Type -AssemblyName System.Windows.Forms","Add-Type -AssemblyName System.Drawing",`$path = '${n.replaceAll("'","''")}'`,"$img = [System.Windows.Forms.Clipboard]::GetImage()","if ($img) { $img.Save($path, [System.Drawing.Imaging.ImageFormat]::Png); Write-Output 'ok' } else { Write-Output 'empty' }"].join("; "),r=Qa("powershell.exe",["-NoProfile","-Command",s],{timeoutMs:l6});if(!r.ok||r.stdout.toString("utf-8").trim()!=="ok")return null;let a=_1(t);return a.length===0?null:{bytes:new Uint8Array(a),mimeType:"image/png"}}catch{return null}finally{try{r6(t)}catch{}}}function f6(){let t=Qa("xclip",["-selection","clipboard","-t","TARGETS","-o"],{timeoutMs:mb}),e=[];t.ok&&(e=t.stdout.toString("utf-8").split(/\r?\n/).map(s=>s.trim()).filter(Boolean));let n=e.length>0?A1(e):null,i=n?[n,...sm]:[...sm];for(let s of i){let r=Qa("xclip",["-selection","clipboard","-t",s,"-o"]);if(r.ok&&r.stdout.length>0)return{bytes:r.stdout,mimeType:Kl(s)}}return null}async function P1(){if(!Fr||!Fr.hasImage())return null;let t=await Fr.getImageBinary();return!t||t.length===0?null:{bytes:t instanceof Uint8Array?t:Uint8Array.from(t),mimeType:"image/png"}}async function O1(t){let e=t?.env??process.env,n=t?.platform??process.platform;if(e.TERMUX_VERSION)return null;let i=null;if(n==="linux"){let s=h6(e),r=hb(e);(r||s)&&(i=m6()??f6()),!i&&s&&(i=g6()),!i&&!r&&(i=await P1())}else i=await P1();if(!i)return null;if(!d6(i.mimeType)){let s=await p6(i.bytes);return s?{bytes:s,mimeType:"image/png"}:null}return i}function L1(t){try{Ya("xclip -selection clipboard",t)}catch{Ya("xsel --clipboard --input",t)}}var v6=1e5;function y6(t=process.env){return!!(t.SSH_CONNECTION||t.SSH_CLIENT||t.MOSH_CONNECTION)}function w6(t){let e=Buffer.from(t).toString("base64");return e.length>v6?!1:(process.stdout.write(`\x1B]52;c;${e}\x07`),!0)}async function Hl(t){let e=!1,n=x6();try{Fr&&n!=="linux"&&(await Fr.setText(t),e=!0)}catch{}let i=y6();if(e&&!i)return;let s={input:t,timeout:5e3,stdio:["pipe","ignore","ignore"]};if(!e)try{if(n==="darwin")Ya("pbcopy",s),e=!0;else if(n==="win32")Ya("clip",s),e=!0;else{if(process.env.TERMUX_VERSION)try{Ya("termux-clipboard-set",s),e=!0}catch{}if(!e){let r=!!process.env.WAYLAND_DISPLAY,o=!!process.env.DISPLAY;if(hb()&&r)try{Ya("which wl-copy",{stdio:"ignore"});let c=b6("wl-copy",[],{stdio:["pipe","ignore","ignore"]});c.stdin.on("error",()=>{}),c.stdin.write(t),c.stdin.end(),c.unref(),e=!0}catch{o&&(L1(s),e=!0)}else o&&(L1(s),e=!0)}}}catch{}if(i||!e){let r=w6(t);e=e||r}if(!e)throw new Error("Failed to copy to clipboard")}function rm(t){let e=process.versions.bun?`bun/${process.versions.bun}`:`node/${process.version}`;return`pi/${t} (${process.platform}; ${e}; ${process.arch})`}import{compare as S6,valid as W1}from"semver";var T6="https://pi.dev/api/latest-version",C6=1e4;function k6(t,e){let n=W1(t.trim()),i=W1(e.trim());if(!(!n||!i))return S6(n,i)}function F1(t,e){let n=k6(t,e);return n!==void 0?n>0:t.trim()!==e.trim()}async function U1(t,e={}){if(process.env.PI_SKIP_VERSION_CHECK||process.env.PI_OFFLINE)return;let n=await fetch(T6,{headers:{"User-Agent":rm(t),accept:"application/json"},signal:AbortSignal.timeout(e.timeoutMs??C6)});if(!n.ok)return;let i=await n.json();if(typeof i.version!="string"||!i.version.trim())return;let s=typeof i.packageName=="string"&&i.packageName.trim()?i.packageName.trim():void 0,r=typeof i.note=="string"&&i.note.trim()?i.note.trim():void 0;return{version:i.version.trim(),packageName:s,...r?{note:r}:{}}}async function D1(t){try{let e=await U1(t);return e&&F1(e.version,t)?e:void 0}catch{return}}var yn=31,N1=36,M6=[255,255,255,127,255,240,255,127,255,237,255,127,255,219,255,127,255,183,255,127,255,119,254,127,63,248,254,127,223,255,254,127,223,63,252,127,159,195,251,127,111,252,244,127,247,15,247,127,247,255,247,127,247,255,227,127,247,7,232,127,239,248,103,112,15,255,187,111,241,0,208,91,253,63,236,83,193,255,239,87,159,253,238,95,159,252,174,95,31,120,172,95,63,0,80,108,127,0,220,119,255,192,63,120,255,1,248,127,255,3,156,120,255,7,140,124,255,15,206,120,255,255,207,127,255,255,207,120,255,255,223,120,255,255,223,125,255,255,63,126,255,255,255,127],R6=Math.ceil(yn/8),vt=Math.ceil(N1/2),$1=["typewriter","scanline","rain","fade","crt","glitch","dissolve"];function B1(t,e){if(e>=N1)return!1;let n=e*R6+Math.floor(t/8),i=t%8;return(M6[n]>>i&1)===0}function I6(t,e){let n=B1(t,e*2),i=B1(t,e*2+1);return n&&i?"\u2588":n?"\u2580":i?"\u2584":" "}function P6(){let t=[];for(let e=0;e<vt;e++){let n=[];for(let i=0;i<yn;i++)n.push(I6(i,e));t.push(n)}return t}var Xa=class{constructor(e){this.interval=null;this.effectState={};this.cachedLines=[];this.cachedWidth=0;this.gridVersion=0;this.cachedVersion=-1;this.ui=e,this.effect=$1[Math.floor(Math.random()*$1.length)],this.finalGrid=P6(),this.currentGrid=this.createEmptyGrid(),this.initEffect(),this.startAnimation()}invalidate(){this.cachedWidth=0}render(e){if(e===this.cachedWidth&&this.cachedVersion===this.gridVersion)return this.cachedLines;let n=1,i=e-n;this.cachedLines=this.currentGrid.map(o=>{let a=o.slice(0,i).join(""),c=Math.max(0,e-n-a.length);return` ${b.fg("accent",a)}${" ".repeat(c)}`});let s="ARMIN SAYS HI",r=Math.max(0,e-n-s.length);return this.cachedLines.push(` ${b.fg("accent",s)}${" ".repeat(r)}`),this.cachedWidth=e,this.cachedVersion=this.gridVersion,this.cachedLines}createEmptyGrid(){return Array.from({length:vt},()=>Array(yn).fill(" "))}initEffect(){switch(this.effect){case"typewriter":this.effectState={pos:0};break;case"scanline":this.effectState={row:0};break;case"rain":this.effectState={drops:Array.from({length:yn},()=>({y:-Math.floor(Math.random()*vt*2),settled:0}))};break;case"fade":{let e=[];for(let n=0;n<vt;n++)for(let i=0;i<yn;i++)e.push([n,i]);for(let n=e.length-1;n>0;n--){let i=Math.floor(Math.random()*(n+1));[e[n],e[i]]=[e[i],e[n]]}this.effectState={positions:e,idx:0};break}case"crt":this.effectState={expansion:0};break;case"glitch":this.effectState={phase:0,glitchFrames:8};break;case"dissolve":{this.currentGrid=Array.from({length:vt},()=>Array.from({length:yn},()=>{let n=[" ","\u2591","\u2592","\u2593","\u2588","\u2580","\u2584"];return n[Math.floor(Math.random()*n.length)]}));let e=[];for(let n=0;n<vt;n++)for(let i=0;i<yn;i++)e.push([n,i]);for(let n=e.length-1;n>0;n--){let i=Math.floor(Math.random()*(n+1));[e[n],e[i]]=[e[i],e[n]]}this.effectState={positions:e,idx:0};break}}}startAnimation(){let e=this.effect==="glitch"?60:30;this.interval=setInterval(()=>{let n=this.tickEffect();this.updateDisplay(),this.ui.requestRender(),n&&this.stopAnimation()},1e3/e)}stopAnimation(){this.interval&&(clearInterval(this.interval),this.interval=null)}tickEffect(){switch(this.effect){case"typewriter":return this.tickTypewriter();case"scanline":return this.tickScanline();case"rain":return this.tickRain();case"fade":return this.tickFade();case"crt":return this.tickCrt();case"glitch":return this.tickGlitch();case"dissolve":return this.tickDissolve();default:return!0}}tickTypewriter(){let e=this.effectState,n=3;for(let i=0;i<n;i++){let s=Math.floor(e.pos/yn),r=e.pos%yn;if(s>=vt)return!0;this.currentGrid[s][r]=this.finalGrid[s][r],e.pos++}return!1}tickScanline(){let e=this.effectState;if(e.row>=vt)return!0;for(let n=0;n<yn;n++)this.currentGrid[e.row][n]=this.finalGrid[e.row][n];return e.row++,!1}tickRain(){let e=this.effectState,n=!0;this.currentGrid=this.createEmptyGrid();for(let i=0;i<yn;i++){let s=e.drops[i];for(let o=vt-1;o>=vt-s.settled;o--)o>=0&&(this.currentGrid[o][i]=this.finalGrid[o][i]);if(s.settled>=vt)continue;n=!1;let r=-1;for(let o=vt-1-s.settled;o>=0;o--)if(this.finalGrid[o][i]!==" "){r=o;break}s.y++,s.y>=0&&s.y<vt&&(r>=0&&s.y>=r?(s.settled=vt-r,s.y=-Math.floor(Math.random()*5)-1):this.currentGrid[s.y][i]="\u2593")}return n}tickFade(){let e=this.effectState,n=15;for(let i=0;i<n;i++){if(e.idx>=e.positions.length)return!0;let[s,r]=e.positions[e.idx];this.currentGrid[s][r]=this.finalGrid[s][r],e.idx++}return!1}tickCrt(){let e=this.effectState,n=Math.floor(vt/2);this.currentGrid=this.createEmptyGrid();let i=n-e.expansion,s=n+e.expansion;for(let r=Math.max(0,i);r<=Math.min(vt-1,s);r++)for(let o=0;o<yn;o++)this.currentGrid[r][o]=this.finalGrid[r][o];return e.expansion++,e.expansion>vt}tickGlitch(){let e=this.effectState;return e.phase<e.glitchFrames?(this.currentGrid=this.finalGrid.map(n=>{let i=Math.floor(Math.random()*7)-3,s=[...n];if(Math.random()<.3)return s.slice(i).concat(s.slice(0,i)).slice(0,yn);if(Math.random()<.2){let r=Math.floor(Math.random()*vt);return[...this.finalGrid[r]]}return s}),e.phase++,!1):(this.currentGrid=this.finalGrid.map(n=>[...n]),!0)}tickDissolve(){let e=this.effectState,n=20;for(let i=0;i<n;i++){if(e.idx>=e.positions.length)return!0;let[s,r]=e.positions[e.idx];this.currentGrid[s][r]=this.finalGrid[s][r],e.idx++}return!1}updateDisplay(){this.gridVersion++}dispose(){this.stopAnimation()}};var _6="\x1B]133;A\x07",E6="\x1B]133;B\x07",A6="\x1B]133;C\x07",Hi=class extends H{constructor(n,i=!1,s=Mt(),r="Thinking..."){super();this.hasToolCalls=!1;this.hideThinkingBlock=i,this.markdownTheme=s,this.hiddenThinkingLabel=r,this.contentContainer=new H,this.addChild(this.contentContainer),n&&this.updateContent(n)}invalidate(){super.invalidate(),this.lastMessage&&this.updateContent(this.lastMessage)}setHideThinkingBlock(n){this.hideThinkingBlock=n,this.lastMessage&&this.updateContent(this.lastMessage)}setHiddenThinkingLabel(n){this.hiddenThinkingLabel=n,this.lastMessage&&this.updateContent(this.lastMessage)}render(n){let i=super.render(n);return this.hasToolCalls||i.length===0||(i[0]=_6+i[0],i[i.length-1]=E6+A6+i[i.length-1]),i}updateContent(n){this.lastMessage=n,this.contentContainer.clear();let i=n.content.some(r=>r.type==="text"&&r.text.trim()||r.type==="thinking"&&r.thinking.trim());i&&this.contentContainer.addChild(new L(1));for(let r=0;r<n.content.length;r++){let o=n.content[r];if(o.type==="text"&&o.text.trim())this.contentContainer.addChild(new ze(o.text.trim(),1,0,this.markdownTheme));else if(o.type==="thinking"&&o.thinking.trim()){let a=n.content.slice(r+1).some(c=>c.type==="text"&&c.text.trim()||c.type==="thinking"&&c.thinking.trim());this.hideThinkingBlock?(this.contentContainer.addChild(new E(b.italic(b.fg("thinkingText",this.hiddenThinkingLabel)),1,0)),a&&this.contentContainer.addChild(new L(1))):(this.contentContainer.addChild(new ze(o.thinking.trim(),1,0,this.markdownTheme,{color:c=>b.fg("thinkingText",c),italic:!0})),a&&this.contentContainer.addChild(new L(1)))}}let s=n.content.some(r=>r.type==="toolCall");if(this.hasToolCalls=s,!s){if(n.stopReason==="aborted"){let r=n.errorMessage&&n.errorMessage!=="Request was aborted"?n.errorMessage:"Operation aborted";i?this.contentContainer.addChild(new L(1)):this.contentContainer.addChild(new L(1)),this.contentContainer.addChild(new E(b.fg("error",r),1,0))}else if(n.stopReason==="error"){let r=n.errorMessage||"Unknown error";this.contentContainer.addChild(new L(1)),this.contentContainer.addChild(new E(b.fg("error",`Error: ${r}`),1,0))}}}};var j1=20,Ws=class extends H{constructor(n,i,s=!1){super();this.outputLines=[];this.status="running";this.exitCode=void 0;this.expanded=!1;this.command=n;let r=s?"dim":"bashMode",o=c=>b.fg(r,c);this.addChild(new L(1)),this.addChild(new z(o)),this.contentContainer=new H,this.addChild(this.contentContainer);let a=new E(b.fg(r,b.bold(`$ ${n}`)),1,0);this.contentContainer.addChild(a),this.loader=new Qt(i,c=>b.fg(r,c),c=>b.fg("muted",c),`Running... (${ke("tui.select.cancel")} to cancel)`),this.contentContainer.addChild(this.loader),this.addChild(new z(o))}setExpanded(n){this.expanded=n,this.updateDisplay()}invalidate(){super.invalidate(),this.updateDisplay()}appendOutput(n){let s=Sl(n).replace(/\r\n/g,`
|
|
301
|
+
`).trim()}),i}catch(e){return console.error(`Warning: Could not parse changelog: ${e}`),[]}}function Jj(t,e){return t.major!==e.major?t.major-e.major:t.minor!==e.minor?t.minor-e.minor:t.patch-e.patch}function RM(t,e){let n=e.split(".").map(Number),i={major:n[0]||0,minor:n[1]||0,patch:n[2]||0,content:""};return t.filter(s=>Jj(s,i)>0)}import{execSync as Ya,spawn as b6}from"child_process";import{platform as x6}from"os";import{spawnSync as i6}from"child_process";import{randomUUID as s6}from"crypto";import{readFileSync as _M,unlinkSync as r6}from"fs";import{tmpdir as o6}from"os";import{join as a6}from"path";import{createRequire as IM}from"module";import{dirname as Qj,join as Yj}from"path";import{pathToFileURL as Xj}from"url";var Zj=IM(import.meta.url),e6=IM(Xj(Yj(Qj(process.execPath),"package.json")).href),t6=process.platform!=="linux"||!!(process.env.DISPLAY||process.env.WAYLAND_DISPLAY);function n6(t=[Zj,e6]){for(let e of t)try{return e("@mariozechner/clipboard")}catch{}return null}var Fr=!process.env.TERMUX_VERSION&&t6?n6():null;var sm=["image/png","image/jpeg","image/webp","image/gif"],mb=1e3,c6=3e3,l6=5e3,u6=50*1024*1024;function hb(t=process.env){return!!t.WAYLAND_DISPLAY||t.XDG_SESSION_TYPE==="wayland"}function Kl(t){return t.split(";")[0]?.trim().toLowerCase()??t.toLowerCase()}function EM(t){switch(Kl(t)){case"image/png":return"png";case"image/jpeg":return"jpg";case"image/webp":return"webp";case"image/gif":return"gif";default:return null}}function AM(t){let e=t.map(i=>i.trim()).filter(Boolean).map(i=>({raw:i,base:Kl(i)}));for(let i of sm){let s=e.find(r=>r.base===i);if(s)return s.raw}return e.find(i=>i.base.startsWith("image/"))?.raw??null}function d6(t){let e=Kl(t);return sm.some(n=>n===e)}async function p6(t){let e=await Ba();if(!e)return null;try{let n=e.PhotonImage.new_from_byteslice(t);try{return n.get_bytes()}finally{n.free()}}catch{return null}}function Qa(t,e,n){let i=n?.timeoutMs??c6,s=n?.maxBufferBytes??u6,r=i6(t,e,{timeout:i,maxBuffer:s,env:n?.env});return r.error?{ok:!1,stdout:Buffer.alloc(0)}:r.status!==0?{ok:!1,stdout:Buffer.alloc(0)}:{ok:!0,stdout:Buffer.isBuffer(r.stdout)?r.stdout:Buffer.from(r.stdout??"",typeof r.stdout=="string"?"utf-8":void 0)}}function m6(){let t=Qa("wl-paste",["--list-types"],{timeoutMs:mb});if(!t.ok)return null;let e=t.stdout.toString("utf-8").split(/\r?\n/).map(s=>s.trim()).filter(Boolean),n=AM(e);if(!n)return null;let i=Qa("wl-paste",["--type",n,"--no-newline"]);return!i.ok||i.stdout.length===0?null:{bytes:i.stdout,mimeType:Kl(n)}}function h6(t=process.env){if(t.WSL_DISTRO_NAME||t.WSLENV)return!0;try{let e=_M("/proc/version","utf-8");return/microsoft|wsl/i.test(e)}catch{return!1}}function g6(){let t=a6(o6(),`pi-wsl-clip-${s6()}.png`);try{let e=Qa("wslpath",["-w",t],{timeoutMs:mb});if(!e.ok)return null;let n=e.stdout.toString("utf-8").trim();if(!n)return null;let s=["Add-Type -AssemblyName System.Windows.Forms","Add-Type -AssemblyName System.Drawing",`$path = '${n.replaceAll("'","''")}'`,"$img = [System.Windows.Forms.Clipboard]::GetImage()","if ($img) { $img.Save($path, [System.Drawing.Imaging.ImageFormat]::Png); Write-Output 'ok' } else { Write-Output 'empty' }"].join("; "),r=Qa("powershell.exe",["-NoProfile","-Command",s],{timeoutMs:l6});if(!r.ok||r.stdout.toString("utf-8").trim()!=="ok")return null;let a=_M(t);return a.length===0?null:{bytes:new Uint8Array(a),mimeType:"image/png"}}catch{return null}finally{try{r6(t)}catch{}}}function f6(){let t=Qa("xclip",["-selection","clipboard","-t","TARGETS","-o"],{timeoutMs:mb}),e=[];t.ok&&(e=t.stdout.toString("utf-8").split(/\r?\n/).map(s=>s.trim()).filter(Boolean));let n=e.length>0?AM(e):null,i=n?[n,...sm]:[...sm];for(let s of i){let r=Qa("xclip",["-selection","clipboard","-t",s,"-o"]);if(r.ok&&r.stdout.length>0)return{bytes:r.stdout,mimeType:Kl(s)}}return null}async function PM(){if(!Fr||!Fr.hasImage())return null;let t=await Fr.getImageBinary();return!t||t.length===0?null:{bytes:t instanceof Uint8Array?t:Uint8Array.from(t),mimeType:"image/png"}}async function OM(t){let e=t?.env??process.env,n=t?.platform??process.platform;if(e.TERMUX_VERSION)return null;let i=null;if(n==="linux"){let s=h6(e),r=hb(e);(r||s)&&(i=m6()??f6()),!i&&s&&(i=g6()),!i&&!r&&(i=await PM())}else i=await PM();if(!i)return null;if(!d6(i.mimeType)){let s=await p6(i.bytes);return s?{bytes:s,mimeType:"image/png"}:null}return i}function LM(t){try{Ya("xclip -selection clipboard",t)}catch{Ya("xsel --clipboard --input",t)}}var v6=1e5;function y6(t=process.env){return!!(t.SSH_CONNECTION||t.SSH_CLIENT||t.MOSH_CONNECTION)}function w6(t){let e=Buffer.from(t).toString("base64");return e.length>v6?!1:(process.stdout.write(`\x1B]52;c;${e}\x07`),!0)}async function Hl(t){let e=!1,n=x6();try{Fr&&n!=="linux"&&(await Fr.setText(t),e=!0)}catch{}let i=y6();if(e&&!i)return;let s={input:t,timeout:5e3,stdio:["pipe","ignore","ignore"]};if(!e)try{if(n==="darwin")Ya("pbcopy",s),e=!0;else if(n==="win32")Ya("clip",s),e=!0;else{if(process.env.TERMUX_VERSION)try{Ya("termux-clipboard-set",s),e=!0}catch{}if(!e){let r=!!process.env.WAYLAND_DISPLAY,o=!!process.env.DISPLAY;if(hb()&&r)try{Ya("which wl-copy",{stdio:"ignore"});let c=b6("wl-copy",[],{stdio:["pipe","ignore","ignore"]});c.stdin.on("error",()=>{}),c.stdin.write(t),c.stdin.end(),c.unref(),e=!0}catch{o&&(LM(s),e=!0)}else o&&(LM(s),e=!0)}}}catch{}if(i||!e){let r=w6(t);e=e||r}if(!e)throw new Error("Failed to copy to clipboard")}function rm(t){let e=process.versions.bun?`bun/${process.versions.bun}`:`node/${process.version}`;return`pi/${t} (${process.platform}; ${e}; ${process.arch})`}import{compare as S6,valid as WM}from"semver";var T6="https://pi.dev/api/latest-version",C6=1e4;function k6(t,e){let n=WM(t.trim()),i=WM(e.trim());if(!(!n||!i))return S6(n,i)}function FM(t,e){let n=k6(t,e);return n!==void 0?n>0:t.trim()!==e.trim()}async function UM(t,e={}){if(process.env.PI_SKIP_VERSION_CHECK||process.env.PI_OFFLINE)return;let n=await fetch(T6,{headers:{"User-Agent":rm(t),accept:"application/json"},signal:AbortSignal.timeout(e.timeoutMs??C6)});if(!n.ok)return;let i=await n.json();if(typeof i.version!="string"||!i.version.trim())return;let s=typeof i.packageName=="string"&&i.packageName.trim()?i.packageName.trim():void 0,r=typeof i.note=="string"&&i.note.trim()?i.note.trim():void 0;return{version:i.version.trim(),packageName:s,...r?{note:r}:{}}}async function DM(t){try{let e=await UM(t);return e&&FM(e.version,t)?e:void 0}catch{return}}var yn=31,NM=36,M6=[255,255,255,127,255,240,255,127,255,237,255,127,255,219,255,127,255,183,255,127,255,119,254,127,63,248,254,127,223,255,254,127,223,63,252,127,159,195,251,127,111,252,244,127,247,15,247,127,247,255,247,127,247,255,227,127,247,7,232,127,239,248,103,112,15,255,187,111,241,0,208,91,253,63,236,83,193,255,239,87,159,253,238,95,159,252,174,95,31,120,172,95,63,0,80,108,127,0,220,119,255,192,63,120,255,1,248,127,255,3,156,120,255,7,140,124,255,15,206,120,255,255,207,127,255,255,207,120,255,255,223,120,255,255,223,125,255,255,63,126,255,255,255,127],R6=Math.ceil(yn/8),vt=Math.ceil(NM/2),$M=["typewriter","scanline","rain","fade","crt","glitch","dissolve"];function BM(t,e){if(e>=NM)return!1;let n=e*R6+Math.floor(t/8),i=t%8;return(M6[n]>>i&1)===0}function I6(t,e){let n=BM(t,e*2),i=BM(t,e*2+1);return n&&i?"\u2588":n?"\u2580":i?"\u2584":" "}function P6(){let t=[];for(let e=0;e<vt;e++){let n=[];for(let i=0;i<yn;i++)n.push(I6(i,e));t.push(n)}return t}var Xa=class{constructor(e){this.interval=null;this.effectState={};this.cachedLines=[];this.cachedWidth=0;this.gridVersion=0;this.cachedVersion=-1;this.ui=e,this.effect=$M[Math.floor(Math.random()*$M.length)],this.finalGrid=P6(),this.currentGrid=this.createEmptyGrid(),this.initEffect(),this.startAnimation()}invalidate(){this.cachedWidth=0}render(e){if(e===this.cachedWidth&&this.cachedVersion===this.gridVersion)return this.cachedLines;let n=1,i=e-n;this.cachedLines=this.currentGrid.map(o=>{let a=o.slice(0,i).join(""),c=Math.max(0,e-n-a.length);return` ${b.fg("accent",a)}${" ".repeat(c)}`});let s="ARMIN SAYS HI",r=Math.max(0,e-n-s.length);return this.cachedLines.push(` ${b.fg("accent",s)}${" ".repeat(r)}`),this.cachedWidth=e,this.cachedVersion=this.gridVersion,this.cachedLines}createEmptyGrid(){return Array.from({length:vt},()=>Array(yn).fill(" "))}initEffect(){switch(this.effect){case"typewriter":this.effectState={pos:0};break;case"scanline":this.effectState={row:0};break;case"rain":this.effectState={drops:Array.from({length:yn},()=>({y:-Math.floor(Math.random()*vt*2),settled:0}))};break;case"fade":{let e=[];for(let n=0;n<vt;n++)for(let i=0;i<yn;i++)e.push([n,i]);for(let n=e.length-1;n>0;n--){let i=Math.floor(Math.random()*(n+1));[e[n],e[i]]=[e[i],e[n]]}this.effectState={positions:e,idx:0};break}case"crt":this.effectState={expansion:0};break;case"glitch":this.effectState={phase:0,glitchFrames:8};break;case"dissolve":{this.currentGrid=Array.from({length:vt},()=>Array.from({length:yn},()=>{let n=[" ","\u2591","\u2592","\u2593","\u2588","\u2580","\u2584"];return n[Math.floor(Math.random()*n.length)]}));let e=[];for(let n=0;n<vt;n++)for(let i=0;i<yn;i++)e.push([n,i]);for(let n=e.length-1;n>0;n--){let i=Math.floor(Math.random()*(n+1));[e[n],e[i]]=[e[i],e[n]]}this.effectState={positions:e,idx:0};break}}}startAnimation(){let e=this.effect==="glitch"?60:30;this.interval=setInterval(()=>{let n=this.tickEffect();this.updateDisplay(),this.ui.requestRender(),n&&this.stopAnimation()},1e3/e)}stopAnimation(){this.interval&&(clearInterval(this.interval),this.interval=null)}tickEffect(){switch(this.effect){case"typewriter":return this.tickTypewriter();case"scanline":return this.tickScanline();case"rain":return this.tickRain();case"fade":return this.tickFade();case"crt":return this.tickCrt();case"glitch":return this.tickGlitch();case"dissolve":return this.tickDissolve();default:return!0}}tickTypewriter(){let e=this.effectState,n=3;for(let i=0;i<n;i++){let s=Math.floor(e.pos/yn),r=e.pos%yn;if(s>=vt)return!0;this.currentGrid[s][r]=this.finalGrid[s][r],e.pos++}return!1}tickScanline(){let e=this.effectState;if(e.row>=vt)return!0;for(let n=0;n<yn;n++)this.currentGrid[e.row][n]=this.finalGrid[e.row][n];return e.row++,!1}tickRain(){let e=this.effectState,n=!0;this.currentGrid=this.createEmptyGrid();for(let i=0;i<yn;i++){let s=e.drops[i];for(let o=vt-1;o>=vt-s.settled;o--)o>=0&&(this.currentGrid[o][i]=this.finalGrid[o][i]);if(s.settled>=vt)continue;n=!1;let r=-1;for(let o=vt-1-s.settled;o>=0;o--)if(this.finalGrid[o][i]!==" "){r=o;break}s.y++,s.y>=0&&s.y<vt&&(r>=0&&s.y>=r?(s.settled=vt-r,s.y=-Math.floor(Math.random()*5)-1):this.currentGrid[s.y][i]="\u2593")}return n}tickFade(){let e=this.effectState,n=15;for(let i=0;i<n;i++){if(e.idx>=e.positions.length)return!0;let[s,r]=e.positions[e.idx];this.currentGrid[s][r]=this.finalGrid[s][r],e.idx++}return!1}tickCrt(){let e=this.effectState,n=Math.floor(vt/2);this.currentGrid=this.createEmptyGrid();let i=n-e.expansion,s=n+e.expansion;for(let r=Math.max(0,i);r<=Math.min(vt-1,s);r++)for(let o=0;o<yn;o++)this.currentGrid[r][o]=this.finalGrid[r][o];return e.expansion++,e.expansion>vt}tickGlitch(){let e=this.effectState;return e.phase<e.glitchFrames?(this.currentGrid=this.finalGrid.map(n=>{let i=Math.floor(Math.random()*7)-3,s=[...n];if(Math.random()<.3)return s.slice(i).concat(s.slice(0,i)).slice(0,yn);if(Math.random()<.2){let r=Math.floor(Math.random()*vt);return[...this.finalGrid[r]]}return s}),e.phase++,!1):(this.currentGrid=this.finalGrid.map(n=>[...n]),!0)}tickDissolve(){let e=this.effectState,n=20;for(let i=0;i<n;i++){if(e.idx>=e.positions.length)return!0;let[s,r]=e.positions[e.idx];this.currentGrid[s][r]=this.finalGrid[s][r],e.idx++}return!1}updateDisplay(){this.gridVersion++}dispose(){this.stopAnimation()}};var _6="\x1B]133;A\x07",E6="\x1B]133;B\x07",A6="\x1B]133;C\x07",Hi=class extends H{constructor(n,i=!1,s=Mt(),r="Thinking..."){super();this.hasToolCalls=!1;this.hideThinkingBlock=i,this.markdownTheme=s,this.hiddenThinkingLabel=r,this.contentContainer=new H,this.addChild(this.contentContainer),n&&this.updateContent(n)}invalidate(){super.invalidate(),this.lastMessage&&this.updateContent(this.lastMessage)}setHideThinkingBlock(n){this.hideThinkingBlock=n,this.lastMessage&&this.updateContent(this.lastMessage)}setHiddenThinkingLabel(n){this.hiddenThinkingLabel=n,this.lastMessage&&this.updateContent(this.lastMessage)}render(n){let i=super.render(n);return this.hasToolCalls||i.length===0||(i[0]=_6+i[0],i[i.length-1]=E6+A6+i[i.length-1]),i}updateContent(n){this.lastMessage=n,this.contentContainer.clear();let i=n.content.some(r=>r.type==="text"&&r.text.trim()||r.type==="thinking"&&r.thinking.trim());i&&this.contentContainer.addChild(new L(1));for(let r=0;r<n.content.length;r++){let o=n.content[r];if(o.type==="text"&&o.text.trim())this.contentContainer.addChild(new ze(o.text.trim(),1,0,this.markdownTheme));else if(o.type==="thinking"&&o.thinking.trim()){let a=n.content.slice(r+1).some(c=>c.type==="text"&&c.text.trim()||c.type==="thinking"&&c.thinking.trim());this.hideThinkingBlock?(this.contentContainer.addChild(new E(b.italic(b.fg("thinkingText",this.hiddenThinkingLabel)),1,0)),a&&this.contentContainer.addChild(new L(1))):(this.contentContainer.addChild(new ze(o.thinking.trim(),1,0,this.markdownTheme,{color:c=>b.fg("thinkingText",c),italic:!0})),a&&this.contentContainer.addChild(new L(1)))}}let s=n.content.some(r=>r.type==="toolCall");if(this.hasToolCalls=s,!s){if(n.stopReason==="aborted"){let r=n.errorMessage&&n.errorMessage!=="Request was aborted"?n.errorMessage:"Operation aborted";i?this.contentContainer.addChild(new L(1)):this.contentContainer.addChild(new L(1)),this.contentContainer.addChild(new E(b.fg("error",r),1,0))}else if(n.stopReason==="error"){let r=n.errorMessage||"Unknown error";this.contentContainer.addChild(new L(1)),this.contentContainer.addChild(new E(b.fg("error",`Error: ${r}`),1,0))}}}};var jM=20,Ws=class extends H{constructor(n,i,s=!1){super();this.outputLines=[];this.status="running";this.exitCode=void 0;this.expanded=!1;this.command=n;let r=s?"dim":"bashMode",o=c=>b.fg(r,c);this.addChild(new L(1)),this.addChild(new z(o)),this.contentContainer=new H,this.addChild(this.contentContainer);let a=new E(b.fg(r,b.bold(`$ ${n}`)),1,0);this.contentContainer.addChild(a),this.loader=new Qt(i,c=>b.fg(r,c),c=>b.fg("muted",c),`Running... (${ke("tui.select.cancel")} to cancel)`),this.contentContainer.addChild(this.loader),this.addChild(new z(o))}setExpanded(n){this.expanded=n,this.updateDisplay()}invalidate(){super.invalidate(),this.updateDisplay()}appendOutput(n){let s=Sl(n).replace(/\r\n/g,`
|
|
302
302
|
`).replace(/\r/g,`
|
|
303
303
|
`).split(`
|
|
304
304
|
`);this.outputLines.length>0&&s.length>0?(this.outputLines[this.outputLines.length-1]+=s[0],this.outputLines.push(...s.slice(1))):this.outputLines.push(...s),this.updateDisplay()}setComplete(n,i,s,r){this.exitCode=n,this.status=i?"cancelled":n!==0&&n!==void 0&&n!==null?"error":"complete",this.truncationResult=s,this.fullOutputPath=r,this.loader.stop(),this.updateDisplay()}updateDisplay(){let n=this.outputLines.join(`
|
|
305
305
|
`),i=Cr(n,{maxLines:2e3,maxBytes:51200}),s=i.content?i.content.split(`
|
|
306
|
-
`):[],r=s.slice(-
|
|
306
|
+
`):[],r=s.slice(-jM),o=s.length-r.length;this.contentContainer.clear();let a=new E(b.fg("bashMode",b.bold(`$ ${this.command}`)),1,0);if(this.contentContainer.addChild(a),s.length>0)if(this.expanded){let c=s.map(l=>b.fg("muted",l)).join(`
|
|
307
307
|
`);this.contentContainer.addChild(new E(`
|
|
308
308
|
${c}`,1,0))}else{let l=`
|
|
309
309
|
${r.map(p=>b.fg("muted",p)).join(`
|
|
310
|
-
`)}`,u,d;this.contentContainer.addChild({render:p=>((d===void 0||u!==p)&&(d=Aa(l,
|
|
310
|
+
`)}`,u,d;this.contentContainer.addChild({render:p=>((d===void 0||u!==p)&&(d=Aa(l,jM,p,1).visualLines,u=p),d??[]),invalidate:()=>{u=void 0,d=void 0}})}if(this.status==="running")this.contentContainer.addChild(this.loader);else{let c=[];o>0&&(this.expanded?c.push(`${b.fg("muted","(")}${re("app.tools.expand","to collapse")}${b.fg("muted",")")}`):c.push(`${b.fg("muted",`... ${o} more lines (`)}${re("app.tools.expand","to expand")}${b.fg("muted",")")}`)),this.status==="cancelled"?c.push(b.fg("warning","(cancelled)")):this.status==="error"&&c.push(b.fg("error",`(exit ${this.exitCode})`)),(this.truncationResult?.truncated||i.truncated)&&this.fullOutputPath&&c.push(b.fg("warning",`Output truncated. Full output: ${this.fullOutputPath}`)),c.length>0&&this.contentContainer.addChild(new E(`
|
|
311
311
|
${c.join(`
|
|
312
312
|
`)}`,1,0))}}getOutput(){return this.outputLines.join(`
|
|
313
313
|
`)}getCommand(){return this.command}};var Za=class extends H{constructor(e,n,i,s){super(),this.cancellable=s?.cancellable??!0;let r=o=>n.fg("border",o);this.addChild(new z(r)),this.cancellable?this.loader=new hl(e,o=>n.fg("accent",o),o=>n.fg("muted",o),i):(this.signalController=new AbortController,this.loader=new Qt(e,o=>n.fg("accent",o),o=>n.fg("muted",o),i)),this.addChild(this.loader),this.cancellable&&(this.addChild(new L(1)),this.addChild(new E(re("tui.select.cancel","cancel"),1,0))),this.addChild(new L(1)),this.addChild(new z(r))}get signal(){return this.cancellable?this.loader.signal:this.signalController?.signal??new AbortController().signal}set onAbort(e){this.cancellable&&(this.loader.onAbort=e)}handleInput(e){this.cancellable&&this.loader.handleInput(e)}dispose(){"dispose"in this.loader&&typeof this.loader.dispose=="function"?this.loader.dispose():"stop"in this.loader&&typeof this.loader.stop=="function"&&this.loader.stop()}};var ec=class extends ht{constructor(n,i=Mt()){super(1,1,s=>b.bg("customMessageBg",s));this.expanded=!1;this.message=n,this.markdownTheme=i,this.updateDisplay()}setExpanded(n){this.expanded=n,this.updateDisplay()}invalidate(){super.invalidate(),this.updateDisplay()}updateDisplay(){this.clear();let n=b.fg("customMessageLabel","\x1B[1m[branch]\x1B[22m");if(this.addChild(new E(n,0,0)),this.addChild(new L(1)),this.expanded){let i=`**Branch Summary**
|
|
@@ -315,10 +315,10 @@ ${c.join(`
|
|
|
315
315
|
`;this.addChild(new ze(i+this.message.summary,0,0,this.markdownTheme,{color:s=>b.fg("customMessageText",s)}))}else this.addChild(new E(b.fg("customMessageText","Branch summary (")+b.fg("dim",ke("app.tools.expand"))+b.fg("customMessageText"," to expand)"),0,0))}};var tc=class extends ht{constructor(n,i=Mt()){super(1,1,s=>b.bg("customMessageBg",s));this.expanded=!1;this.message=n,this.markdownTheme=i,this.updateDisplay()}setExpanded(n){this.expanded=n,this.updateDisplay()}invalidate(){super.invalidate(),this.updateDisplay()}updateDisplay(){this.clear();let n=this.message.tokensBefore.toLocaleString(),i=b.fg("customMessageLabel","\x1B[1m[compaction]\x1B[22m");if(this.addChild(new E(i,0,0)),this.addChild(new L(1)),this.expanded){let s=`**Compacted from ${n} tokens**
|
|
316
316
|
|
|
317
317
|
`;this.addChild(new ze(s+this.message.summary,0,0,this.markdownTheme,{color:r=>b.fg("customMessageText",r)}))}else this.addChild(new E(b.fg("customMessageText",`Compacted from ${n} tokens (`)+b.fg("dim",ke("app.tools.expand"))+b.fg("customMessageText"," to expand)"),0,0))}};var Fs=class extends gr{constructor(n,i,s,r){super(n,i,r);this.actionHandlers=new Map;this.keybindings=s}onAction(n,i){this.actionHandlers.set(n,i)}handleInput(n){if(!this.onExtensionShortcut?.(n)){if(this.keybindings.matches(n,"app.clipboard.pasteImage")){this.onPasteImage?.();return}if(this.keybindings.matches(n,"app.interrupt")){if(!this.isShowingAutocomplete()){let i=this.onEscape??this.actionHandlers.get("app.interrupt");if(i){i();return}}super.handleInput(n);return}if(this.keybindings.matches(n,"app.exit")&&this.getText().length===0){let i=this.onCtrlD??this.actionHandlers.get("app.exit");i&&i();return}for(let[i,s]of this.actionHandlers)if(i!=="app.interrupt"&&i!=="app.exit"&&this.keybindings.matches(n,i)){s();return}super.handleInput(n)}}};var nc=class extends H{constructor(n,i,s=Mt()){super();this._expanded=!1;this.message=n,this.customRenderer=i,this.markdownTheme=s,this.addChild(new L(1)),this.box=new ht(1,1,r=>b.bg("customMessageBg",r)),this.rebuild()}setExpanded(n){this._expanded!==n&&(this._expanded=n,this.rebuild())}invalidate(){super.invalidate(),this.rebuild()}rebuild(){if(this.customComponent&&(this.removeChild(this.customComponent),this.customComponent=void 0),this.removeChild(this.box),this.customRenderer)try{let s=this.customRenderer(this.message,{expanded:this._expanded},b);if(s){this.customComponent=s,this.addChild(s);return}}catch{}this.addChild(this.box),this.box.clear();let n=b.fg("customMessageLabel",`\x1B[1m[${this.message.customType}]\x1B[22m`);this.box.addChild(new E(n,0,0)),this.box.addChild(new L(1));let i;typeof this.message.content=="string"?i=this.message.content:i=this.message.content.filter(s=>s.type==="text").map(s=>s.text).join(`
|
|
318
|
-
`),this.box.addChild(new ze(i,0,0,this.markdownTheme,{color:s=>b.fg("customMessageText",s)}))}};var gb="bbbab8b9b9b6b9b8b5bcbbb8b8b7b4b7b5b2b6b5b2b8b7b4b7b6b3b6b4b1bdbcb8bab8b6bbb8b5b8b5b1bbb8b4c2bebbc1bebac0bdbabfbcb9c1bebabfbebbc0bfbcc0bdbabbb8b5c1bfbcbfbcb8bbb9b6bfbcb8c2bfbcc1bfbcbfbbb8bdb9b6b8b7b5b9b8b5b8b8b5b5b5b2b6b5b2b8b7b4b9b8b5b9b8b5b6b5b3bab8b5bcbab7bbb9b6bbb8b5bfb9b5bdb2abbcb0a8beb2aabeb5afbfbab6bebab7c0bfbcbebdbabebbb8c0bdbabfbebbc2bebbbdbab7c3c0bdc3c0bdc1bebbc2bebabfbcb8bab9b6b7b6b3b2b1aeb6b5b2b5b4b1b5b4b2b6b5b2b7b6b4b9b8b6b7b6b3bbbab7b2afaba5988fb49e90b09481b79a88b39683b09583b7a395bfb6b0c0bdbabdbbb8bebcb9c1bfbcc0bebbbdbab7bebbb8c2bfbcc0bdbac0bcb9bdb9b6c0bcb8b5b4b2b4b3b0bab9b6b9b9b6b5b4b1b5b4b1b6b5b3b9b8b5b9b8b6b9b8b6b2aeaa968174a6836eaa856eab846eaf8973ac8973b08f79b18f7ab39786b7a89dbbb3aebfbab6c2c0bdbebcb9bfbdbac3c1bdc2bebbc0bcb9bdb9b6c1bdbabfbbb8b4b3b0b9b8b5b8b7b5b4b3b1b5b4b1b8b7b4b8b7b5bab9b6bbbab7b1afad8c7a719d735ca47860a87d65a98069ae8972ae8c75af8d77aa826ba98067aa8974b39e90b6a79dbbb2adc0bdbac1bfbdbfbbb8c1bdb9bebab6c0bdb9bfbbb8c1bdbab4b2b0b7b6b4b7b6b3b4b2b0bab9b7b6b5b2b6b5b2bab9b6bab9b6958c87977663aa836bac8772b08f7aad8c77b2917db0917db0907cac8971a77d64a87f67ac8972b29887b8a89dbfbab5bfbdbac1bebac0bcb9c0bcb9c0bcb9c1bebabebab7b8b7b4b7b6b4b5b4b1b5b4b2b7b6b3b5b4b2bab9b7bab9b6b4b1ada88f7fad8973ae8d78b19684b19685b29786b69a89b29582b1917daa856ea87e66a97e66ad866ea9826baf9280b8ada6bdbbb8bebab7bfbbb8c1bdbabfbbb8bcb8b4bcb8b5b6b4b2b7b5b3b6b5b2b8b7b4b3b2afb8b7b4b6b5b2b3b2b0b3a59aab856fad8d78b0917eb19886b49b8bb49a89b39785b0917eaf8f7cab866fa77d65a77a61a87d64a9816ab08f79b5a296c1bcb8c3bfbcc2bebbbebab7bfbbb7bdbab6c2bebab8b7b4b7b6b4b6b5b3b7b6b3b6b5b2b9b8b6b4b3b1b6b1acac8f7ca9826bae8f7aaf9583b49c8cb49c8bb79d8cb59987b19380ad8e79ae8c77af8e78ac8771a3775faa826bae8972b39888bbb6b2bebbb8bfbbb8bfbbb8c0bdb9bebbb7c0bdb9b6b5b2b9b8b5b4b3b1b8b7b5b4b3b0b7b6b4b6b5b3b1a7a0aa8772a77d65a88570b49887b19b8d9c887c907a6d987f71aa907faf917daf8e7aad8c78ac8b77a8836ca9836cac8770b49b8abdb6b2c0bcb9c0bdb9bfbbb8bebab7bfbcb9bebab7b9b8b6b5b4b2b9b8b5b8b7b5b8b7b4b7b6b4b5b4b2b3a9a2ad8973a1755da9856fb398858c776a65544b776358725d526e594d9c7f6eb1907ba68672ad8e7aab8771ac856db18f79b3a092beb9b5c1bdbabdb9b5bebab7bfbbb7bebab7bcb9b6b7b6b4b6b6b3b8b7b4b5b4b2b8b6b4b7b6b3b4b3b0b4aba4a6826ba3775fb08e79b19584a88e7daa8e7db29481ad8f7c997e6da38674ac8d79ac8e7aae917f9a7c6a896a599a7c6ab3a398c1bdbabdb9b6bcb8b5bebab6bebab7bdb9b5bdb9b6b5b4b1b7b5b3b5b4b2b7b6b3b7b6b4b3b3b0b3b2b0b4aca5a7846fa97f68ae8f7bae9383b59c8bb2937fae8e79ac8b76af927eaf927eb29683b39885b2988891786a72594c6e594d978d86bdbab7bab7b3c0bcb9c0bcb9bebab7bebbb7bdb9b6b3b2b0b4b3b0b5b4b2b4b4b1b4b3b1b4b3b1b4b3b0b6ada5aa8670a57a62ad8e7ab29b8cb69d8dab856fa9826aa88069ab8771af907db49987b19684b29886b59987b39480b09787b5a9a1bcb8b5bebab7bdb9b5bebab7bfbbb8bfbbb7bbb7b4b3b2afb8b7b5b8b7b5b3b2b0b5b4b2b6b5b3b6b4b1afa299a98975a9826baf907cb39988b49a89af8e7aac8973aa856eaf8c74b1917dae907dac907db39988b29785b49785b7a090b9aca3bfbab7bcb8b5bdb9b6bcb8b4bcb8b5bdb9b5bcb8b4b5b4b2b6b5b3b4b3b0b4b3b0b9b8b5b8b6b4908b88887467aa8f7ea78976ad8973b08b74b59885b69e8eb29888b1917cb1917db1937fae907cb19686b39a8ab29886b59b8ab8a192b6aaa3b7b2afbcb8b4bcb8b5bbb7b4c0bcb9bebab7c0bcb9b6b5b2b6b5b3b4b3b0bab9b7b7b6b4b1b0ae7b716ba083709b806f716158967764b08870b29481b69b8ab69f8fb39a89b69f90b49d8db39a89b29988b49c8cb6a090b8a496baa49593867f8f8986bfbbb7bdb9b5bcb7b4bab6b3b9b5b2bab6b2b4b3b1b3b3b0b6b5b3b8b7b5b4b2b0a7a5a38f837dae917ea084725a504c63544da28370b39784b59e8db2a093a698909b918b998e8790857e95877dad998bb39c8cb5a091b9a2938d827c95908dbebab6bbb7b3bdbab7bbb7b4bdb9b6bbb7b4b4b3b0b5b4b1b8b7b5b6b5b3b8b8b5b4b2af968f8ab29a8bab9485544b483a323073655d96887f70655f61595547403e453e3c453f3d57504f655e5b90847db39c8db7a090b6a09189807aaba6a3bdb9b6c0bcb9bebab7bcb7b4bebab7bbb7b4b3b2b0b6b5b3b2b1afb7b6b4b8b7b4b5b4b1aeaba8b5a89fac998d4d44412d25244d46444e4744322b293a3230423937433a37352d2a59504c534b48524a48988a81b59f8fb19c8d827974b2afacbdb9b5bcb8b4bdb9b5bcb8b5bdb9b6bab6b2b8b7b5b5b4b2b6b6b3b9b8b5b7b6b3b6b5b2b8b6b3b9b4b1b2a9a26c64612d25242d2625312a28352d2c453d3a78675c8d7a6ea09792aea6a0615854332b29524a479f8e82b09d90a49b96c1bdb9bebab7bfbbb8bbb8b4b9b5b1b8b4b0b9b4b0b7b6b4b8b7b5b8b7b4b6b5b3b8b6b3bab9b6b9b8b5b4b3b0b7b5b2a5a29f453d3b261e1d261f1e2e2625413936857268977865b19482b5a69caca5a07c7572453d3b746963a0948cc5bfbbc0bbb8beb9b6bbb7b3bbb6b3b7b3afb8b4b0b9b5b1b7b6b3b6b5b3b5b4b2b5b4b2b7b6b3b7b6b3b8b6b3b4b2afb7b6b3b3b1ae6d6765251f1e1e18172a22212d2523443b3971625ab19888b09482a89182877e792c25243e3634766d6abeb9b5bfbbb7bebab6bcb7b3bbb6b3b9b5b1b7b3afb8b4b0b4b3b0b5b4b1b5b4b1b4b3b1b5b4b2b8b6b4b5b3b0b9b6b4b5b4b1b6b4b27f79762a2322221c1b2d2524221b1a443e3c47413f6f676281766f867971675e5a3e37352a222166605dbab7b3bdb9b5beb9b5bcb7b3bcb7b3b9b4b0bab6b2bab6b2b5b3b0b6b4b2b3b2afb7b6b3b4b4b1b4b3b0b6b4b1b5b4b1b4b3b0b9b6b29a8c8252474230292828201f181212322c2c231e1d1c16162c26252923222d26252d2523332b2a8e8885bcb8b5bcb7b3bbb6b2bcb7b3b9b4b1b9b5b1b7b2afb7b2ae7a838e9b9b9caeadacb3b2b0b3b2afb7b7b4b6b5b3b6b6b3b7b6b3b9ada4a991808e7b6f50453f2b24231a14142923221f19181d17161f18182620201d17162a22215d5654b7b3b0bbb7b3bbb6b2b8b4b0bab5b1bbb6b2bab5b1b8b4b0bab6b22c496b4c5d735f68766e727a828285929090adaba8b7b2aeb6a59ab39682a28470a387748e76674e403a1a14141d1716181211221c1c1f1918221c1b2f2827342d2c8d8884bab6b3b9b5b2bab5b1bab5b1b9b4b0bab6b2b8b4b0b9b4b0b7b2ae325e8b365f8a3a5d833f5b7a545f70646469706b6aa08f84b08e78b18e769f7e689e7f6b9e816d907766584940362d2a1c1615201b1a1a1413201a1a251e1d393331a39e9bbab5b1bcb7b3bab6b2b8b3afb8b4b0b9b4b0b9b4b1bab5b2b5b0ac3d6c9843729d44719c426e98415f805a64716f6a699d8677b1927eb3947faa89749d7a649f7f6ba487749e837186716454463f2c25231e181837302e3a33317a7471beb9b6bcb8b4bbb6b2b6b2aebab5b1b9b5b1b8b3afbab6b2b6b1adb5aeaa4877a14c7aa44e7ba345719a3a5d80586b7f767475927b6eb1927faf8e79b08e78a78169a07861a17f6aa58570a688749b83738270666f66618a8480a49e99b7b2aebab6b2bcb8b4b9b5b1b7b2aebab5b1b9b4b0b6b1aeb6b1adb2aca8b2aca84876a04a78a2517fa74771973a5d80405c7a6161677c695fac8a75b08d77b4917aaf8971ad876fa5816aa6846ea78670a98a76ac9484ab9f96b2aca8bdb8b4bcb7b3bcb8b4bcb8b4b8b3afb7b2aeb9b4b0b8b3afb8b2aeb6afabb3aeaab2aeaa4878a14b7aa34c7ba44a759b3d63873b5f825b67766f5f569c7e6caf8c77b18f79b28f78b5927caf8e78a98872aa8a76a98a76ac917fada199b7b0acb9b3afbfb9b5c1bab6bdb6b2b8b3afbab5b1b9b4b0b6afabb7b1adb3ada9b3aeaab0aba8",zl=32,q1=32;function O6(){let t=[];for(let e=0;e<q1;e++){let n=[];for(let i=0;i<zl;i++){let s=(e*zl+i)*6,r=parseInt(gb.slice(s,s+2),16),o=parseInt(gb.slice(s+2,s+4),16),a=parseInt(gb.slice(s+4,s+6),16);n.push([r,o,a])}t.push(n)}return t}function fb(t,e,n,i=!1){return`\x1B[${i?48:38};2;${t};${e};${n}m`}var G1="\x1B[0m";function L6(){let t=O6(),e=[];for(let n=0;n<q1;n+=2){let i="";for(let s=0;s<zl;s++){let r=t[n][s],o=t[n+1]?.[s]??r;i+=`${fb(o[0],o[1],o[2])}${fb(r[0],r[1],r[2],!0)}\u2584`}i+=G1,e.push(i)}return e}var Vl=class{constructor(e){this.interval=null;this.tick=0;this.maxTicks=25;this.cachedLines=[];this.cachedWidth=0;this.cachedTick=-1;this.ui=e,this.image=L6(),this.startAnimation()}invalidate(){this.cachedWidth=0}startAnimation(){this.interval=setInterval(()=>{this.tick++,this.tick>=this.maxTicks&&this.stopAnimation(),this.cachedWidth=0,this.ui.requestRender()},80)}stopAnimation(){this.interval&&(clearInterval(this.interval),this.interval=null)}render(e){if(e===this.cachedWidth&&this.cachedTick===this.tick)return this.cachedLines;let n=b,i=[],s=a=>{let c=a.replace(/\x1b\[[0-9;]*m/g,"").length,l=Math.max(0,Math.floor((e-c)/2));return" ".repeat(l)+a};i.push("");let r=Math.min(this.image.length,Math.floor(this.tick/this.maxTicks*(this.image.length+3)));for(let a=0;a<this.image.length;a++)if(a<r)i.push(s(this.image[a]));else if(a===r){let c="\u2593".repeat(zl);i.push(s(fb(100,200,255)+c+G1))}else i.push(s(" ".repeat(zl)));i.push("");let o=Math.max(0,this.tick-this.maxTicks*.6);return o>0||this.tick>=this.maxTicks?(i.push(s(n.fg("accent","Free Kimi K2.5 via OpenCode Zen"))),i.push(s(n.fg("success",'"Powered by daxnuts"'))),i.push(s(n.fg("muted","\u2014 @thdxr")))):(i.push(""),i.push(""),i.push("")),i.push(""),o>2||this.tick>=this.maxTicks?(i.push(s(n.fg("dim","Try OpenCode"))),i.push(s(n.fg("mdLink","https://mistral.ai/news/mistral-vibe-2-0")))):(i.push(""),i.push("")),i.push(""),this.cachedLines=i,this.cachedWidth=e,this.cachedTick=this.tick,i}dispose(){this.stopAnimation()}};import*as H1 from"node:fs";var W6="https://mariozechner.at/posts/2026-04-08-ive-sold-out/",z1="clankolas.png",om,K1=!1;function F6(){if(K1)return om;K1=!0;try{om=H1.readFileSync(aS(z1)).toString("base64")}catch{om=void 0}return om}var am=class extends H{constructor(){super(),this.addChild(new z(n=>b.fg("accent",n))),this.addChild(new E(b.bold(b.fg("accent","pi has joined Earendil")),1,0)),this.addChild(new L(1)),this.addChild(new E(b.fg("muted","Read the blog post:"),1,0)),this.addChild(new E(b.fg("mdLink",W6),1,0)),this.addChild(new L(1));let e=F6();e&&(this.addChild(new fr(e,"image/png",{fallbackColor:n=>b.fg("muted",n)},{maxWidthCells:56,filename:z1})),this.addChild(new L(1))),this.addChild(new z(n=>b.fg("accent",n)))}};import{spawn as U6}from"node:child_process";import*as sc from"node:fs";import*as V1 from"node:os";import*as J1 from"node:path";var ic=class extends H{constructor(n,i,s,r,o,a,c){super();this._focused=!1;this.tui=n,this.keybindings=i,this.onSubmitCallback=o,this.onCancelCallback=a,this.addChild(new z),this.addChild(new L(1)),this.addChild(new E(b.fg("accent",s),1,0)),this.addChild(new L(1)),this.editor=new gr(n,wl(),c),r&&this.editor.setText(r),this.editor.onSubmit=d=>{this.onSubmitCallback(d)},this.addChild(this.editor),this.addChild(new L(1));let l=!!(process.env.VISUAL||process.env.EDITOR),u=re("tui.select.confirm","submit")+" "+re("tui.input.newLine","newline")+" "+re("tui.select.cancel","cancel")+(l?` ${re("app.editor.external","external editor")}`:"");this.addChild(new E(u,1,0)),this.addChild(new L(1)),this.addChild(new z)}get focused(){return this._focused}set focused(n){this._focused=n,this.editor.focused=n}handleInput(n){if(fe().matches(n,"tui.select.cancel")){this.onCancelCallback();return}if(this.keybindings.matches(n,"app.editor.external")){this.openExternalEditor();return}this.editor.handleInput(n)}async openExternalEditor(){let n=process.env.VISUAL||process.env.EDITOR;if(!n)return;let i=this.editor.getText(),s=J1.join(V1.tmpdir(),`pi-extension-editor-${Date.now()}.md`);try{sc.writeFileSync(s,i,"utf-8"),this.tui.stop();let[r,...o]=n.split(" ");if(process.stdout.write(`Launching external editor: ${n}
|
|
318
|
+
`),this.box.addChild(new ze(i,0,0,this.markdownTheme,{color:s=>b.fg("customMessageText",s)}))}};var gb="bbbab8b9b9b6b9b8b5bcbbb8b8b7b4b7b5b2b6b5b2b8b7b4b7b6b3b6b4b1bdbcb8bab8b6bbb8b5b8b5b1bbb8b4c2bebbc1bebac0bdbabfbcb9c1bebabfbebbc0bfbcc0bdbabbb8b5c1bfbcbfbcb8bbb9b6bfbcb8c2bfbcc1bfbcbfbbb8bdb9b6b8b7b5b9b8b5b8b8b5b5b5b2b6b5b2b8b7b4b9b8b5b9b8b5b6b5b3bab8b5bcbab7bbb9b6bbb8b5bfb9b5bdb2abbcb0a8beb2aabeb5afbfbab6bebab7c0bfbcbebdbabebbb8c0bdbabfbebbc2bebbbdbab7c3c0bdc3c0bdc1bebbc2bebabfbcb8bab9b6b7b6b3b2b1aeb6b5b2b5b4b1b5b4b2b6b5b2b7b6b4b9b8b6b7b6b3bbbab7b2afaba5988fb49e90b09481b79a88b39683b09583b7a395bfb6b0c0bdbabdbbb8bebcb9c1bfbcc0bebbbdbab7bebbb8c2bfbcc0bdbac0bcb9bdb9b6c0bcb8b5b4b2b4b3b0bab9b6b9b9b6b5b4b1b5b4b1b6b5b3b9b8b5b9b8b6b9b8b6b2aeaa968174a6836eaa856eab846eaf8973ac8973b08f79b18f7ab39786b7a89dbbb3aebfbab6c2c0bdbebcb9bfbdbac3c1bdc2bebbc0bcb9bdb9b6c1bdbabfbbb8b4b3b0b9b8b5b8b7b5b4b3b1b5b4b1b8b7b4b8b7b5bab9b6bbbab7b1afad8c7a719d735ca47860a87d65a98069ae8972ae8c75af8d77aa826ba98067aa8974b39e90b6a79dbbb2adc0bdbac1bfbdbfbbb8c1bdb9bebab6c0bdb9bfbbb8c1bdbab4b2b0b7b6b4b7b6b3b4b2b0bab9b7b6b5b2b6b5b2bab9b6bab9b6958c87977663aa836bac8772b08f7aad8c77b2917db0917db0907cac8971a77d64a87f67ac8972b29887b8a89dbfbab5bfbdbac1bebac0bcb9c0bcb9c0bcb9c1bebabebab7b8b7b4b7b6b4b5b4b1b5b4b2b7b6b3b5b4b2bab9b7bab9b6b4b1ada88f7fad8973ae8d78b19684b19685b29786b69a89b29582b1917daa856ea87e66a97e66ad866ea9826baf9280b8ada6bdbbb8bebab7bfbbb8c1bdbabfbbb8bcb8b4bcb8b5b6b4b2b7b5b3b6b5b2b8b7b4b3b2afb8b7b4b6b5b2b3b2b0b3a59aab856fad8d78b0917eb19886b49b8bb49a89b39785b0917eaf8f7cab866fa77d65a77a61a87d64a9816ab08f79b5a296c1bcb8c3bfbcc2bebbbebab7bfbbb7bdbab6c2bebab8b7b4b7b6b4b6b5b3b7b6b3b6b5b2b9b8b6b4b3b1b6b1acac8f7ca9826bae8f7aaf9583b49c8cb49c8bb79d8cb59987b19380ad8e79ae8c77af8e78ac8771a3775faa826bae8972b39888bbb6b2bebbb8bfbbb8bfbbb8c0bdb9bebbb7c0bdb9b6b5b2b9b8b5b4b3b1b8b7b5b4b3b0b7b6b4b6b5b3b1a7a0aa8772a77d65a88570b49887b19b8d9c887c907a6d987f71aa907faf917daf8e7aad8c78ac8b77a8836ca9836cac8770b49b8abdb6b2c0bcb9c0bdb9bfbbb8bebab7bfbcb9bebab7b9b8b6b5b4b2b9b8b5b8b7b5b8b7b4b7b6b4b5b4b2b3a9a2ad8973a1755da9856fb398858c776a65544b776358725d526e594d9c7f6eb1907ba68672ad8e7aab8771ac856db18f79b3a092beb9b5c1bdbabdb9b5bebab7bfbbb7bebab7bcb9b6b7b6b4b6b6b3b8b7b4b5b4b2b8b6b4b7b6b3b4b3b0b4aba4a6826ba3775fb08e79b19584a88e7daa8e7db29481ad8f7c997e6da38674ac8d79ac8e7aae917f9a7c6a896a599a7c6ab3a398c1bdbabdb9b6bcb8b5bebab6bebab7bdb9b5bdb9b6b5b4b1b7b5b3b5b4b2b7b6b3b7b6b4b3b3b0b3b2b0b4aca5a7846fa97f68ae8f7bae9383b59c8bb2937fae8e79ac8b76af927eaf927eb29683b39885b2988891786a72594c6e594d978d86bdbab7bab7b3c0bcb9c0bcb9bebab7bebbb7bdb9b6b3b2b0b4b3b0b5b4b2b4b4b1b4b3b1b4b3b1b4b3b0b6ada5aa8670a57a62ad8e7ab29b8cb69d8dab856fa9826aa88069ab8771af907db49987b19684b29886b59987b39480b09787b5a9a1bcb8b5bebab7bdb9b5bebab7bfbbb8bfbbb7bbb7b4b3b2afb8b7b5b8b7b5b3b2b0b5b4b2b6b5b3b6b4b1afa299a98975a9826baf907cb39988b49a89af8e7aac8973aa856eaf8c74b1917dae907dac907db39988b29785b49785b7a090b9aca3bfbab7bcb8b5bdb9b6bcb8b4bcb8b5bdb9b5bcb8b4b5b4b2b6b5b3b4b3b0b4b3b0b9b8b5b8b6b4908b88887467aa8f7ea78976ad8973b08b74b59885b69e8eb29888b1917cb1917db1937fae907cb19686b39a8ab29886b59b8ab8a192b6aaa3b7b2afbcb8b4bcb8b5bbb7b4c0bcb9bebab7c0bcb9b6b5b2b6b5b3b4b3b0bab9b7b7b6b4b1b0ae7b716ba083709b806f716158967764b08870b29481b69b8ab69f8fb39a89b69f90b49d8db39a89b29988b49c8cb6a090b8a496baa49593867f8f8986bfbbb7bdb9b5bcb7b4bab6b3b9b5b2bab6b2b4b3b1b3b3b0b6b5b3b8b7b5b4b2b0a7a5a38f837dae917ea084725a504c63544da28370b39784b59e8db2a093a698909b918b998e8790857e95877dad998bb39c8cb5a091b9a2938d827c95908dbebab6bbb7b3bdbab7bbb7b4bdb9b6bbb7b4b4b3b0b5b4b1b8b7b5b6b5b3b8b8b5b4b2af968f8ab29a8bab9485544b483a323073655d96887f70655f61595547403e453e3c453f3d57504f655e5b90847db39c8db7a090b6a09189807aaba6a3bdb9b6c0bcb9bebab7bcb7b4bebab7bbb7b4b3b2b0b6b5b3b2b1afb7b6b4b8b7b4b5b4b1aeaba8b5a89fac998d4d44412d25244d46444e4744322b293a3230423937433a37352d2a59504c534b48524a48988a81b59f8fb19c8d827974b2afacbdb9b5bcb8b4bdb9b5bcb8b5bdb9b6bab6b2b8b7b5b5b4b2b6b6b3b9b8b5b7b6b3b6b5b2b8b6b3b9b4b1b2a9a26c64612d25242d2625312a28352d2c453d3a78675c8d7a6ea09792aea6a0615854332b29524a479f8e82b09d90a49b96c1bdb9bebab7bfbbb8bbb8b4b9b5b1b8b4b0b9b4b0b7b6b4b8b7b5b8b7b4b6b5b3b8b6b3bab9b6b9b8b5b4b3b0b7b5b2a5a29f453d3b261e1d261f1e2e2625413936857268977865b19482b5a69caca5a07c7572453d3b746963a0948cc5bfbbc0bbb8beb9b6bbb7b3bbb6b3b7b3afb8b4b0b9b5b1b7b6b3b6b5b3b5b4b2b5b4b2b7b6b3b7b6b3b8b6b3b4b2afb7b6b3b3b1ae6d6765251f1e1e18172a22212d2523443b3971625ab19888b09482a89182877e792c25243e3634766d6abeb9b5bfbbb7bebab6bcb7b3bbb6b3b9b5b1b7b3afb8b4b0b4b3b0b5b4b1b5b4b1b4b3b1b5b4b2b8b6b4b5b3b0b9b6b4b5b4b1b6b4b27f79762a2322221c1b2d2524221b1a443e3c47413f6f676281766f867971675e5a3e37352a222166605dbab7b3bdb9b5beb9b5bcb7b3bcb7b3b9b4b0bab6b2bab6b2b5b3b0b6b4b2b3b2afb7b6b3b4b4b1b4b3b0b6b4b1b5b4b1b4b3b0b9b6b29a8c8252474230292828201f181212322c2c231e1d1c16162c26252923222d26252d2523332b2a8e8885bcb8b5bcb7b3bbb6b2bcb7b3b9b4b1b9b5b1b7b2afb7b2ae7a838e9b9b9caeadacb3b2b0b3b2afb7b7b4b6b5b3b6b6b3b7b6b3b9ada4a991808e7b6f50453f2b24231a14142923221f19181d17161f18182620201d17162a22215d5654b7b3b0bbb7b3bbb6b2b8b4b0bab5b1bbb6b2bab5b1b8b4b0bab6b22c496b4c5d735f68766e727a828285929090adaba8b7b2aeb6a59ab39682a28470a387748e76674e403a1a14141d1716181211221c1c1f1918221c1b2f2827342d2c8d8884bab6b3b9b5b2bab5b1bab5b1b9b4b0bab6b2b8b4b0b9b4b0b7b2ae325e8b365f8a3a5d833f5b7a545f70646469706b6aa08f84b08e78b18e769f7e689e7f6b9e816d907766584940362d2a1c1615201b1a1a1413201a1a251e1d393331a39e9bbab5b1bcb7b3bab6b2b8b3afb8b4b0b9b4b0b9b4b1bab5b2b5b0ac3d6c9843729d44719c426e98415f805a64716f6a699d8677b1927eb3947faa89749d7a649f7f6ba487749e837186716454463f2c25231e181837302e3a33317a7471beb9b6bcb8b4bbb6b2b6b2aebab5b1b9b5b1b8b3afbab6b2b6b1adb5aeaa4877a14c7aa44e7ba345719a3a5d80586b7f767475927b6eb1927faf8e79b08e78a78169a07861a17f6aa58570a688749b83738270666f66618a8480a49e99b7b2aebab6b2bcb8b4b9b5b1b7b2aebab5b1b9b4b0b6b1aeb6b1adb2aca8b2aca84876a04a78a2517fa74771973a5d80405c7a6161677c695fac8a75b08d77b4917aaf8971ad876fa5816aa6846ea78670a98a76ac9484ab9f96b2aca8bdb8b4bcb7b3bcb8b4bcb8b4b8b3afb7b2aeb9b4b0b8b3afb8b2aeb6afabb3aeaab2aeaa4878a14b7aa34c7ba44a759b3d63873b5f825b67766f5f569c7e6caf8c77b18f79b28f78b5927caf8e78a98872aa8a76a98a76ac917fada199b7b0acb9b3afbfb9b5c1bab6bdb6b2b8b3afbab5b1b9b4b0b6afabb7b1adb3ada9b3aeaab0aba8",zl=32,qM=32;function O6(){let t=[];for(let e=0;e<qM;e++){let n=[];for(let i=0;i<zl;i++){let s=(e*zl+i)*6,r=parseInt(gb.slice(s,s+2),16),o=parseInt(gb.slice(s+2,s+4),16),a=parseInt(gb.slice(s+4,s+6),16);n.push([r,o,a])}t.push(n)}return t}function fb(t,e,n,i=!1){return`\x1B[${i?48:38};2;${t};${e};${n}m`}var GM="\x1B[0m";function L6(){let t=O6(),e=[];for(let n=0;n<qM;n+=2){let i="";for(let s=0;s<zl;s++){let r=t[n][s],o=t[n+1]?.[s]??r;i+=`${fb(o[0],o[1],o[2])}${fb(r[0],r[1],r[2],!0)}\u2584`}i+=GM,e.push(i)}return e}var Vl=class{constructor(e){this.interval=null;this.tick=0;this.maxTicks=25;this.cachedLines=[];this.cachedWidth=0;this.cachedTick=-1;this.ui=e,this.image=L6(),this.startAnimation()}invalidate(){this.cachedWidth=0}startAnimation(){this.interval=setInterval(()=>{this.tick++,this.tick>=this.maxTicks&&this.stopAnimation(),this.cachedWidth=0,this.ui.requestRender()},80)}stopAnimation(){this.interval&&(clearInterval(this.interval),this.interval=null)}render(e){if(e===this.cachedWidth&&this.cachedTick===this.tick)return this.cachedLines;let n=b,i=[],s=a=>{let c=a.replace(/\x1b\[[0-9;]*m/g,"").length,l=Math.max(0,Math.floor((e-c)/2));return" ".repeat(l)+a};i.push("");let r=Math.min(this.image.length,Math.floor(this.tick/this.maxTicks*(this.image.length+3)));for(let a=0;a<this.image.length;a++)if(a<r)i.push(s(this.image[a]));else if(a===r){let c="\u2593".repeat(zl);i.push(s(fb(100,200,255)+c+GM))}else i.push(s(" ".repeat(zl)));i.push("");let o=Math.max(0,this.tick-this.maxTicks*.6);return o>0||this.tick>=this.maxTicks?(i.push(s(n.fg("accent","Free Kimi K2.5 via OpenCode Zen"))),i.push(s(n.fg("success",'"Powered by daxnuts"'))),i.push(s(n.fg("muted","\u2014 @thdxr")))):(i.push(""),i.push(""),i.push("")),i.push(""),o>2||this.tick>=this.maxTicks?(i.push(s(n.fg("dim","Try OpenCode"))),i.push(s(n.fg("mdLink","https://mistral.ai/news/mistral-vibe-2-0")))):(i.push(""),i.push("")),i.push(""),this.cachedLines=i,this.cachedWidth=e,this.cachedTick=this.tick,i}dispose(){this.stopAnimation()}};import*as HM from"node:fs";var W6="https://mariozechner.at/posts/2026-04-08-ive-sold-out/",zM="clankolas.png",om,KM=!1;function F6(){if(KM)return om;KM=!0;try{om=HM.readFileSync(aS(zM)).toString("base64")}catch{om=void 0}return om}var am=class extends H{constructor(){super(),this.addChild(new z(n=>b.fg("accent",n))),this.addChild(new E(b.bold(b.fg("accent","pi has joined Earendil")),1,0)),this.addChild(new L(1)),this.addChild(new E(b.fg("muted","Read the blog post:"),1,0)),this.addChild(new E(b.fg("mdLink",W6),1,0)),this.addChild(new L(1));let e=F6();e&&(this.addChild(new fr(e,"image/png",{fallbackColor:n=>b.fg("muted",n)},{maxWidthCells:56,filename:zM})),this.addChild(new L(1))),this.addChild(new z(n=>b.fg("accent",n)))}};import{spawn as U6}from"node:child_process";import*as sc from"node:fs";import*as VM from"node:os";import*as JM from"node:path";var ic=class extends H{constructor(n,i,s,r,o,a,c){super();this._focused=!1;this.tui=n,this.keybindings=i,this.onSubmitCallback=o,this.onCancelCallback=a,this.addChild(new z),this.addChild(new L(1)),this.addChild(new E(b.fg("accent",s),1,0)),this.addChild(new L(1)),this.editor=new gr(n,wl(),c),r&&this.editor.setText(r),this.editor.onSubmit=d=>{this.onSubmitCallback(d)},this.addChild(this.editor),this.addChild(new L(1));let l=!!(process.env.VISUAL||process.env.EDITOR),u=re("tui.select.confirm","submit")+" "+re("tui.input.newLine","newline")+" "+re("tui.select.cancel","cancel")+(l?` ${re("app.editor.external","external editor")}`:"");this.addChild(new E(u,1,0)),this.addChild(new L(1)),this.addChild(new z)}get focused(){return this._focused}set focused(n){this._focused=n,this.editor.focused=n}handleInput(n){if(fe().matches(n,"tui.select.cancel")){this.onCancelCallback();return}if(this.keybindings.matches(n,"app.editor.external")){this.openExternalEditor();return}this.editor.handleInput(n)}async openExternalEditor(){let n=process.env.VISUAL||process.env.EDITOR;if(!n)return;let i=this.editor.getText(),s=JM.join(VM.tmpdir(),`pi-extension-editor-${Date.now()}.md`);try{sc.writeFileSync(s,i,"utf-8"),this.tui.stop();let[r,...o]=n.split(" ");if(process.stdout.write(`Launching external editor: ${n}
|
|
319
319
|
Pi will resume when the editor exits.
|
|
320
|
-
`),await new Promise(c=>{let l=U6(r,[...o,s],{stdio:"inherit",shell:process.platform==="win32"});l.on("error",()=>c(null)),l.on("close",u=>c(u))})===0){let c=sc.readFileSync(s,"utf-8").replace(/\n$/,"");this.editor.setText(c)}}finally{try{sc.unlinkSync(s)}catch{}this.tui.start(),this.tui.requestRender(!0)}}};import{isAbsolute as D6,relative as $6,resolve as Q1,sep as Y1}from"node:path";function B6(t){return t.replace(/[\r\n\t]/g," ").replace(/ +/g," ").trim()}function rc(t){return t<1e3?t.toString():t<1e4?`${(t/1e3).toFixed(1)}k`:t<1e6?`${Math.round(t/1e3)}k`:t<1e7?`${(t/1e6).toFixed(1)}M`:`${Math.round(t/1e6)}M`}function N6(t,e){if(!e)return t;let n=Q1(t),i=Q1(e),s=$6(i,n);return s===""||s!==".."&&!s.startsWith(`..${Y1}`)&&!D6(s)?s===""?"~":`~${Y1}${s}`:t}var oc=class{constructor(e,n){this.autoCompactEnabled=!0;this.session=e,this.footerData=n}setSession(e){this.session=e}setAutoCompactEnabled(e){this.autoCompactEnabled=e}invalidate(){}dispose(){}render(e){let n=this.session.state,i=0,s=0,r=0,o=0,a=0,c;for(let ue of this.session.sessionManager.getEntries())if(ue.type==="message"&&ue.message.role==="assistant"){i+=ue.message.usage.input,s+=ue.message.usage.output,r+=ue.message.usage.cacheRead,o+=ue.message.usage.cacheWrite,a+=ue.message.usage.cost.total;let Me=ue.message.usage.input+ue.message.usage.cacheRead+ue.message.usage.cacheWrite;c=Me>0?ue.message.usage.cacheRead/Me*100:void 0}let l=this.session.getContextUsage(),u=l?.contextWindow??n.model?.contextWindow??0,d=l?.percent??0,p=l?.percent!==null?d.toFixed(1):"?",m=N6(this.session.sessionManager.getCwd(),process.env.HOME||process.env.USERPROFILE),g=this.footerData.getGitBranch();g&&(m=`${m} (${g})`);let h=this.session.sessionManager.getSessionName();h&&(m=`${m} \u2022 ${h}`);let f=[];i&&f.push(`\u2191${rc(i)}`),s&&f.push(`\u2193${rc(s)}`),r&&f.push(`R${rc(r)}`),o&&f.push(`W${rc(o)}`),(r>0||o>0)&&c!==void 0&&f.push(`CH${c.toFixed(1)}%`);let x=n.model?this.session.modelRegistry.isUsingOAuth(n.model):!1;if(a||x){let ue=`$${a.toFixed(3)}${x?" (sub)":""}`;f.push(ue)}let v,w=this.autoCompactEnabled?" (auto)":"",C=p==="?"?`?/${rc(u)}${w}`:`${p}%/${rc(u)}${w}`;d>90?v=b.fg("error",C):d>70?v=b.fg("warning",C):v=C,f.push(v);let P=f.join(" "),_=n.model?.id||"no-model",F=j(P);F>e&&(P=Z(P,e,"..."),F=j(P));let A=2,W=_;if(n.model?.reasoning){let ue=n.thinkingLevel||"off";W=ue==="off"?`${_} \u2022 thinking off`:`${_} \u2022 ${ue}`}let R=W;this.footerData.getAvailableProviderCount()>1&&n.model&&(R=`(${n.model.provider}) ${W}`,F+A+j(R)>e&&(R=W));let k=j(R),O=F+A+k,U;if(O<=e){let ue=" ".repeat(e-F-k);U=P+ue+R}else{let ue=e-F-A;if(ue>0){let Me=Z(R,ue,""),it=j(Me),$e=" ".repeat(Math.max(0,e-F-it));U=P+$e+Me}else U=P}let N=b.fg("dim",P),K=U.slice(P.length),G=b.fg("dim",K),le=[Z(b.fg("dim",m),e,b.fg("dim","...")),N+G],ye=this.footerData.getExtensionStatuses();if(ye.size>0){let Me=Array.from(ye.entries()).sort(([it],[$e])=>it.localeCompare($e)).map(([,it])=>B6(it)).join(" ");le.push(Z(Me,e,b.fg("dim","...")))}return le}};import{spawn as j6}from"node:child_process";function bb(t){let[e,n]=process.platform==="darwin"?["open",[t]]:process.platform==="win32"?["rundll32",["url.dll,FileProtocolHandler",t]]:["xdg-open",[t]];j6(e,n,{stdio:"ignore",detached:!0}).on("error",()=>{}).unref()}var Us=class extends H{constructor(n,i,s,r,o){super();this.abortController=new AbortController;this._focused=!1;this.tui=n,this.onComplete=s;let a=p0().find(u=>u.id===i),c=r||a?.name||i,l=o??`Login to ${c}`;this.addChild(new z),this.addChild(new E(b.fg("accent",b.bold(l)),1,0)),this.contentContainer=new H,this.addChild(this.contentContainer),this.input=new Qe,this.input.onSubmit=()=>{if(this.inputResolver){let u=this.input.getValue();this.replaceInputWithSubmittedText(u),this.inputResolver(u),this.inputResolver=void 0,this.inputRejecter=void 0}},this.input.onEscape=()=>{this.cancel()},this.addChild(new z)}get focused(){return this._focused}set focused(n){this._focused=n,this.input.focused=n}get signal(){return this.abortController.signal}replaceInputWithSubmittedText(n){this.contentContainer.children=this.contentContainer.children.map(i=>i===this.input?new E(`> ${n}`,0,0):i)}cancel(){this.abortController.abort(),this.inputRejecter&&(this.inputRejecter(new Error("Login cancelled")),this.inputResolver=void 0,this.inputRejecter=void 0),this.onComplete(!1,"Login cancelled")}showAuth(n,i){this.contentContainer.clear(),this.contentContainer.addChild(new L(1));let s=`\x1B]8;;${n}\x07${n}\x1B]8;;\x07`;this.contentContainer.addChild(new E(b.fg("accent",s),1,0));let r=process.platform==="darwin"?"Cmd+click to open":"Ctrl+click to open",o=`\x1B]8;;${n}\x07${r}\x1B]8;;\x07`;this.contentContainer.addChild(new E(b.fg("dim",o),1,0)),i&&(this.contentContainer.addChild(new L(1)),this.contentContainer.addChild(new E(b.fg("warning",i),1,0))),bb(n),this.tui.requestRender()}showDeviceCode(n){this.contentContainer.clear(),this.contentContainer.addChild(new L(1));let i=`\x1B]8;;${n.verificationUri}\x07${n.verificationUri}\x1B]8;;\x07`;this.contentContainer.addChild(new E(b.fg("accent",i),1,0));let s=process.platform==="darwin"?"Cmd+click to open":"Ctrl+click to open",r=`\x1B]8;;${n.verificationUri}\x07${s}\x1B]8;;\x07`;this.contentContainer.addChild(new E(b.fg("dim",r),1,0)),this.contentContainer.addChild(new L(1)),this.contentContainer.addChild(new E(b.fg("warning",`Enter code: ${n.userCode}`),1,0)),bb(n.verificationUri),this.tui.requestRender()}showManualInput(n){return this.input.setValue(""),this.contentContainer.addChild(new L(1)),this.contentContainer.addChild(new E(b.fg("dim",n),1,0)),this.contentContainer.addChild(this.input),this.contentContainer.addChild(new E(`(${re("tui.select.cancel","to cancel")})`,1,0)),this.tui.requestRender(),new Promise((i,s)=>{this.inputResolver=i,this.inputRejecter=s})}showPrompt(n,i){return this.contentContainer.addChild(new L(1)),this.contentContainer.addChild(new E(b.fg("text",n),1,0)),i&&this.contentContainer.addChild(new E(b.fg("dim",`e.g., ${i}`),1,0)),this.contentContainer.addChild(this.input),this.contentContainer.addChild(new E(`(${re("tui.select.cancel","to cancel,")} ${re("tui.select.confirm","to submit")})`,1,0)),this.input.setValue(""),this.tui.requestRender(),new Promise((s,r)=>{this.inputResolver=s,this.inputRejecter=r})}showInfo(n){this.contentContainer.clear(),this.contentContainer.addChild(new L(1));for(let i of n)this.contentContainer.addChild(new E(i,1,0));this.contentContainer.addChild(new L(1)),this.contentContainer.addChild(new E(`(${re("tui.select.cancel","to close")})`,1,0)),this.tui.requestRender()}showWaiting(n){this.contentContainer.addChild(new L(1)),this.contentContainer.addChild(new E(b.fg("dim",n),1,0)),this.contentContainer.addChild(new E(`(${re("tui.select.cancel","to cancel")})`,1,0)),this.tui.requestRender()}showProgress(n){this.contentContainer.addChild(new E(b.fg("dim",n),1,0)),this.tui.requestRender()}handleInput(n){if(fe().matches(n,"tui.select.cancel")){this.cancel();return}this.input.handleInput(n)}};var ac=class extends H{constructor(n,i,s,r,o,a,c,l){super();this._focused=!1;this.allModels=[];this.scopedModelItems=[];this.activeModels=[];this.filteredModels=[];this.selectedIndex=0;this.scope="all";if(this.tui=n,this.currentModel=i,this.settingsManager=s,this.modelRegistry=r,this.scopedModels=o,this.scope=o.length>0?"scoped":"all",this.onSelectCallback=a,this.onCancelCallback=c,this.addChild(new z),this.addChild(new L(1)),o.length>0)this.scopeText=new E(this.getScopeText(),0,0),this.addChild(this.scopeText),this.scopeHintText=new E(this.getScopeHintText(),0,0),this.addChild(this.scopeHintText);else{let u="Only showing models from configured providers. Use /login to add providers.";this.addChild(new E(b.fg("warning",u),0,0))}this.addChild(new L(1)),this.searchInput=new Qe,l&&this.searchInput.setValue(l),this.searchInput.onSubmit=()=>{this.filteredModels[this.selectedIndex]&&this.handleSelect(this.filteredModels[this.selectedIndex].model)},this.addChild(this.searchInput),this.addChild(new L(1)),this.listContainer=new H,this.addChild(this.listContainer),this.addChild(new L(1)),this.addChild(new z),this.loadModels().then(()=>{l?this.filterModels(l):this.updateList(),this.tui.requestRender()})}get focused(){return this._focused}set focused(n){this._focused=n,this.searchInput.focused=n}async loadModels(){let n;this.modelRegistry.refresh();let i=this.modelRegistry.getError();i&&(this.errorMessage=i);try{n=(await this.modelRegistry.getAvailable()).map(o=>({provider:o.provider,id:o.id,model:o}))}catch(r){this.allModels=[],this.scopedModelItems=[],this.activeModels=[],this.filteredModels=[],this.errorMessage=r instanceof Error?r.message:String(r);return}this.allModels=this.sortModels(n),this.scopedModels=this.scopedModels.map(r=>{let o=this.modelRegistry.find(r.model.provider,r.model.id);return o?{...r,model:o}:r}),this.scopedModelItems=this.scopedModels.map(r=>({provider:r.model.provider,id:r.model.id,model:r.model})),this.activeModels=this.scope==="scoped"?this.scopedModelItems:this.allModels,this.filteredModels=this.activeModels;let s=this.filteredModels.findIndex(r=>zn(this.currentModel,r.model));this.selectedIndex=s>=0?s:Math.min(this.selectedIndex,Math.max(0,this.filteredModels.length-1))}sortModels(n){let i=[...n];return i.sort((s,r)=>{let o=zn(this.currentModel,s.model),a=zn(this.currentModel,r.model);return o&&!a?-1:!o&&a?1:s.provider.localeCompare(r.provider)}),i}getScopeText(){let n=this.scope==="all"?b.fg("accent","all"):b.fg("muted","all"),i=this.scope==="scoped"?b.fg("accent","scoped"):b.fg("muted","scoped");return`${b.fg("muted","Scope: ")}${n}${b.fg("muted"," | ")}${i}`}getScopeHintText(){return re("tui.input.tab","scope")+b.fg("muted"," (all/scoped)")}setScope(n){if(this.scope===n)return;this.scope=n,this.activeModels=this.scope==="scoped"?this.scopedModelItems:this.allModels;let i=this.activeModels.findIndex(s=>zn(this.currentModel,s.model));this.selectedIndex=i>=0?i:0,this.filterModels(this.searchInput.getValue()),this.scopeText&&this.scopeText.setText(this.getScopeText())}filterModels(n){this.filteredModels=n?Ht(this.activeModels,n,({id:i,provider:s})=>`${i} ${s} ${s}/${i} ${s} ${i}`):this.activeModels,this.selectedIndex=Math.min(this.selectedIndex,Math.max(0,this.filteredModels.length-1)),this.updateList()}updateList(){this.listContainer.clear();let n=10,i=Math.max(0,Math.min(this.selectedIndex-Math.floor(n/2),this.filteredModels.length-n)),s=Math.min(i+n,this.filteredModels.length);for(let r=i;r<s;r++){let o=this.filteredModels[r];if(!o)continue;let a=r===this.selectedIndex,c=zn(this.currentModel,o.model),l="";if(a){let u=b.fg("accent","\u2192 "),d=`${o.id}`,p=b.fg("muted",`[${o.provider}]`),m=c?b.fg("success"," \u2713"):"";l=`${u+b.fg("accent",d)} ${p}${m}`}else{let u=` ${o.id}`,d=b.fg("muted",`[${o.provider}]`),p=c?b.fg("success"," \u2713"):"";l=`${u} ${d}${p}`}this.listContainer.addChild(new E(l,0,0))}if(i>0||s<this.filteredModels.length){let r=b.fg("muted",` (${this.selectedIndex+1}/${this.filteredModels.length})`);this.listContainer.addChild(new E(r,0,0))}if(this.errorMessage){let r=this.errorMessage.split(`
|
|
321
|
-
`);for(let o of r)this.listContainer.addChild(new E(b.fg("error",o),0,0))}else if(this.filteredModels.length===0)this.listContainer.addChild(new E(b.fg("muted"," No matching models"),0,0));else{let r=this.filteredModels[this.selectedIndex];this.listContainer.addChild(new L(1)),this.listContainer.addChild(new E(b.fg("muted",` Model Name: ${r.model.name}`),0,0))}}handleInput(n){let i=fe();if(i.matches(n,"tui.input.tab")){if(this.scopedModelItems.length>0){let s=this.scope==="all"?"scoped":"all";this.setScope(s),this.scopeHintText&&this.scopeHintText.setText(this.getScopeHintText())}return}if(i.matches(n,"tui.select.up")){if(this.filteredModels.length===0)return;this.selectedIndex=this.selectedIndex===0?this.filteredModels.length-1:this.selectedIndex-1,this.updateList()}else if(i.matches(n,"tui.select.down")){if(this.filteredModels.length===0)return;this.selectedIndex=this.selectedIndex===this.filteredModels.length-1?0:this.selectedIndex+1,this.updateList()}else if(i.matches(n,"tui.select.confirm")){let s=this.filteredModels[this.selectedIndex];s&&this.handleSelect(s.model)}else i.matches(n,"tui.select.cancel")?this.onCancelCallback():(this.searchInput.handleInput(n),this.filterModels(this.searchInput.getValue()))}handleSelect(n){this.settingsManager.setDefaultModelAndProvider(n.provider,n.id),this.onSelectCallback(n)}getSearchInput(){return this.searchInput}};var Ur=class extends H{constructor(n,i,s,r,o,a){super();this._focused=!1;this.selectedIndex=0;this.mode=n,this.authStorage=i,this.getAuthStatus=a??(l=>this.authStorage.getAuthStatus(l)),this.allProviders=s,this.filteredProviders=s,this.onSelectCallback=r,this.onCancelCallback=o,this.addChild(new z),this.addChild(new L(1));let c=n==="login"?"Select provider to configure:":"Select provider to logout:";this.addChild(new An(b.fg("accent",b.bold(c)),1,0)),this.addChild(new L(1)),this.searchInput=new Qe,this.searchInput.onSubmit=()=>{let l=this.filteredProviders[this.selectedIndex];l&&this.onSelectCallback(l.id)},this.addChild(this.searchInput),this.addChild(new L(1)),this.listContainer=new H,this.addChild(this.listContainer),this.addChild(new L(1)),this.addChild(new z),this.filterProviders("")}get focused(){return this._focused}set focused(n){this._focused=n,this.searchInput.focused=n}filterProviders(n){this.filteredProviders=n?Ht(this.allProviders,n,i=>`${i.name} ${i.id} ${i.authType}`):this.allProviders,this.selectedIndex=Math.max(0,Math.min(this.selectedIndex,Math.max(0,this.filteredProviders.length-1))),this.updateList()}updateList(){this.listContainer.clear();let n=8,i=Math.max(0,Math.min(this.selectedIndex-Math.floor(n/2),this.filteredProviders.length-n)),s=Math.min(i+n,this.filteredProviders.length);for(let r=i;r<s;r++){let o=this.filteredProviders[r];if(!o)continue;let a=r===this.selectedIndex,c=this.formatStatusIndicator(o),l="";if(a){let u=b.fg("accent","\u2192 "),d=b.fg("accent",o.name);l=u+d+c}else l=` ${b.fg("text",o.name)}`+c;this.listContainer.addChild(new An(l,1,0))}if(i>0||s<this.filteredProviders.length){let r=b.fg("muted",` (${this.selectedIndex+1}/${this.filteredProviders.length})`);this.listContainer.addChild(new An(r,1,0))}if(this.filteredProviders.length===0){let r=this.allProviders.length===0?this.mode==="login"?"No providers available":"No providers logged in. Use /login first.":"No matching providers";this.listContainer.addChild(new An(b.fg("muted",` ${r}`),1,0))}}formatStatusIndicator(n){let i=this.authStorage.get(n.id);if(i?.type===n.authType)return b.fg("success"," \u2713 configured");if(i){let r=i.type==="oauth"?"subscription configured":"API key configured";return b.fg("muted"," \u2022 ")+b.fg("warning",r)}if(n.authType!=="api_key")return b.fg("muted"," \u2022 unconfigured");let s=this.getAuthStatus(n.id);switch(s.source){case"environment":return b.fg("success",` \u2713 env: ${s.label??"API key"}`);case"runtime":return b.fg("success"," \u2713 runtime API key");case"fallback":return b.fg("success"," \u2713 custom API key");case"models_json_key":return b.fg("success"," \u2713 key in models.json");case"models_json_command":return b.fg("success"," \u2713 command in models.json");default:return b.fg("muted"," \u2022 unconfigured")}}handleInput(n){let i=fe();if(i.matches(n,"tui.select.up")){if(this.filteredProviders.length===0)return;this.selectedIndex=Math.max(0,this.selectedIndex-1),this.updateList()}else if(i.matches(n,"tui.select.down")){if(this.filteredProviders.length===0)return;this.selectedIndex=Math.min(this.filteredProviders.length-1,this.selectedIndex+1),this.updateList()}else if(i.matches(n,"tui.select.confirm")){let s=this.filteredProviders[this.selectedIndex];s&&this.onSelectCallback(s.id)}else i.matches(n,"tui.select.cancel")?this.onCancelCallback():(this.searchInput.handleInput(n),this.filterProviders(this.searchInput.getValue()))}};function xb(t,e){return t===null||t.includes(e)}function q6(t,e){if(t===null)return[e];let n=t.indexOf(e);return n>=0?[...t.slice(0,n),...t.slice(n+1)]:[...t,e]}function X1(t,e,n){if(t===null)return null;let i=n??e,s=[...t];for(let r of i)s.includes(r)||s.push(r);return s.length===e.length?null:s}function Z1(t,e,n){if(t===null)return n?e.filter(s=>!n.includes(s)):[];let i=new Set(n??t);return t.filter(s=>!i.has(s))}function G6(t,e,n){if(t===null)return null;let i=[...t],s=i.indexOf(e);if(s<0)return i;let r=s+n;if(r<0||r>=i.length)return i;let o=[...i];return[o[s],o[r]]=[o[r],o[s]],o}function K6(t,e){if(t===null)return e;let n=new Set(t);return[...t,...e.filter(i=>!n.has(i))]}var Jl=class extends H{constructor(n,i){super();this.modelsById=new Map;this.allIds=[];this.enabledIds=null;this.filteredItems=[];this.selectedIndex=0;this._focused=!1;this.maxVisible=8;this.isDirty=!1;this.callbacks=i;for(let s of n.allModels){let r=`${s.provider}/${s.id}`;this.modelsById.set(r,s),this.allIds.push(r)}this.enabledIds=n.enabledModelIds===null?null:[...n.enabledModelIds],this.filteredItems=this.buildItems(),this.addChild(new z),this.addChild(new L(1)),this.addChild(new E(b.fg("accent",b.bold("Model Configuration")),0,0)),this.addChild(new E(b.fg("muted",`Session-only. ${ke("app.models.save")} to save to settings.`),0,0)),this.addChild(new L(1)),this.searchInput=new Qe,this.addChild(this.searchInput),this.addChild(new L(1)),this.listContainer=new H,this.addChild(this.listContainer),this.addChild(new L(1)),this.footerText=new E(this.getFooterText(),0,0),this.addChild(this.footerText),this.addChild(new z),this.updateList()}get focused(){return this._focused}set focused(n){this._focused=n,this.searchInput.focused=n}buildItems(){return K6(this.enabledIds,this.allIds).filter(n=>this.modelsById.has(n)).map(n=>({fullId:n,model:this.modelsById.get(n),enabled:xb(this.enabledIds,n)}))}getFooterText(){let n=this.enabledIds?.length??this.allIds.length,s=this.enabledIds===null?"all enabled":`${n}/${this.allIds.length} enabled`,r=[`${ke("tui.select.confirm")} toggle`,`${ke("app.models.enableAll")} all`,`${ke("app.models.clearAll")} clear`,`${ke("app.models.toggleProvider")} provider`,`${ke("app.models.reorderUp")}/${ke("app.models.reorderDown")} reorder`,`${ke("app.models.save")} save`,s];return this.isDirty?b.fg("dim",` ${r.join(" \xB7 ")} `)+b.fg("warning","(unsaved)"):b.fg("dim",` ${r.join(" \xB7 ")}`)}refresh(){let n=this.searchInput.getValue(),i=this.buildItems();this.filteredItems=n?Ht(i,n,s=>`${s.model.id} ${s.model.provider}`):i,this.selectedIndex=Math.min(this.selectedIndex,Math.max(0,this.filteredItems.length-1)),this.updateList(),this.footerText.setText(this.getFooterText())}notifyChange(){this.callbacks.onChange(this.enabledIds===null?null:[...this.enabledIds])}updateList(){if(this.listContainer.clear(),this.filteredItems.length===0){this.listContainer.addChild(new E(b.fg("muted"," No matching models"),0,0));return}let n=Math.max(0,Math.min(this.selectedIndex-Math.floor(this.maxVisible/2),this.filteredItems.length-this.maxVisible)),i=Math.min(n+this.maxVisible,this.filteredItems.length),s=this.enabledIds===null;for(let r=n;r<i;r++){let o=this.filteredItems[r],a=r===this.selectedIndex,c=a?b.fg("accent","\u2192 "):" ",l=a?b.fg("accent",o.model.id):o.model.id,u=b.fg("muted",` [${o.model.provider}]`),d=s?"":o.enabled?b.fg("success"," \u2713"):b.fg("dim"," \u2717");this.listContainer.addChild(new E(`${c}${l}${u}${d}`,0,0))}if((n>0||i<this.filteredItems.length)&&this.listContainer.addChild(new E(b.fg("muted",` (${this.selectedIndex+1}/${this.filteredItems.length})`),0,0)),this.filteredItems.length>0){let r=this.filteredItems[this.selectedIndex];this.listContainer.addChild(new L(1)),this.listContainer.addChild(new E(b.fg("muted",` Model Name: ${r.model.name}`),0,0))}}handleInput(n){let i=fe();if(i.matches(n,"tui.select.up")){if(this.filteredItems.length===0)return;this.selectedIndex=this.selectedIndex===0?this.filteredItems.length-1:this.selectedIndex-1,this.updateList();return}if(i.matches(n,"tui.select.down")){if(this.filteredItems.length===0)return;this.selectedIndex=this.selectedIndex===this.filteredItems.length-1?0:this.selectedIndex+1,this.updateList();return}let s=i.matches(n,"app.models.reorderUp"),r=i.matches(n,"app.models.reorderDown");if(s||r){if(this.enabledIds===null)return;let o=this.filteredItems[this.selectedIndex];if(o&&xb(this.enabledIds,o.fullId)){let a=s?-1:1,l=this.enabledIds.indexOf(o.fullId)+a;l>=0&&l<this.enabledIds.length&&(this.enabledIds=G6(this.enabledIds,o.fullId,a),this.isDirty=!0,this.selectedIndex+=a,this.refresh(),this.notifyChange())}return}if(i.matches(n,"tui.select.confirm")){let o=this.filteredItems[this.selectedIndex];o&&(this.enabledIds=q6(this.enabledIds,o.fullId),this.isDirty=!0,this.refresh(),this.notifyChange());return}if(i.matches(n,"app.models.enableAll")){let o=this.searchInput.getValue()?this.filteredItems.map(a=>a.fullId):void 0;this.enabledIds=X1(this.enabledIds,this.allIds,o),this.isDirty=!0,this.refresh(),this.notifyChange();return}if(i.matches(n,"app.models.clearAll")){let o=this.searchInput.getValue()?this.filteredItems.map(a=>a.fullId):void 0;this.enabledIds=Z1(this.enabledIds,this.allIds,o),this.isDirty=!0,this.refresh(),this.notifyChange();return}if(i.matches(n,"app.models.toggleProvider")){let o=this.filteredItems[this.selectedIndex];if(o){let a=o.model.provider,c=this.allIds.filter(u=>this.modelsById.get(u).provider===a),l=c.every(u=>xb(this.enabledIds,u));this.enabledIds=l?Z1(this.enabledIds,this.allIds,c):X1(this.enabledIds,this.allIds,c),this.isDirty=!0,this.refresh(),this.notifyChange()}return}if(i.matches(n,"app.models.save")){this.callbacks.onPersist(this.enabledIds===null?null:[...this.enabledIds]),this.isDirty=!1,this.footerText.setText(this.getFooterText());return}if(Ae(n,pr.ctrl("c"))){this.searchInput.getValue()?(this.searchInput.setValue(""),this.refresh()):this.callbacks.onCancel();return}if(Ae(n,pr.escape)){this.callbacks.onCancel();return}this.searchInput.handleInput(n),this.refresh()}getSearchInput(){return this.searchInput}};var H6={minPrimaryColumnWidth:12,maxPrimaryColumnWidth:32},z6={off:"No reasoning",minimal:"Very brief reasoning (~1k tokens)",low:"Light reasoning (~2k tokens)",medium:"Moderate reasoning (~8k tokens)",high:"Deep reasoning (~16k tokens)",xhigh:"Maximum reasoning (~32k tokens)"},vb={ask:"Ask",always:"Always trust",never:"Never trust"},V6=new Map(Object.entries(vb).map(([t,e])=>[e,t])),yb=class extends H{constructor(e,n,i){super(),this.state={...e};let s=[{id:"anthropic-extra-usage",label:"Anthropic extra usage",description:"Warn when Anthropic subscription auth may use paid extra usage",currentValue:this.state.anthropicExtraUsage??!0?"true":"false",values:["true","false"]}];this.settingsList=new xa(s,Math.min(s.length,10),ip(),(r,o)=>{r==="anthropic-extra-usage"&&(this.state={...this.state,anthropicExtraUsage:o==="true"},n({...this.state}))},i),this.addChild(this.settingsList)}handleInput(e){this.settingsList.handleInput(e)}},cm=class extends H{constructor(e,n,i,s,r,o,a){super(),this.addChild(new E(b.bold(b.fg("accent",e)),0,0)),n&&(this.addChild(new L(1)),this.addChild(new E(b.fg("muted",n),0,0))),this.addChild(new L(1)),this.selectList=new Yt(i,Math.min(i.length,10),Tr(),H6);let c=i.findIndex(l=>l.value===s);c!==-1&&this.selectList.setSelectedIndex(c),this.selectList.onSelect=l=>{r(l.value)},this.selectList.onCancel=o,a&&(this.selectList.onSelectionChange=l=>{a(l.value)}),this.addChild(this.selectList),this.addChild(new L(1)),this.addChild(new E(b.fg("dim"," Enter to select \xB7 Esc to go back"),0,0))}handleInput(e){this.selectList.handleInput(e)}},cc=class extends H{constructor(e,n){super();let i=ct().images,s=Rl("app.message.followUp"),r={...e.warnings},o=[{id:"autocompact",label:"Auto-compact",description:"Automatically compact context when it gets too large",currentValue:e.autoCompact?"true":"false",values:["true","false"]},{id:"steering-mode",label:"Steering mode",description:"Enter while streaming queues steering messages. 'one-at-a-time': deliver one, wait for response. 'all': deliver all at once.",currentValue:e.steeringMode,values:["one-at-a-time","all"]},{id:"follow-up-mode",label:"Follow-up mode",description:`${s} queues follow-up messages until agent stops. 'one-at-a-time': deliver one, wait for response. 'all': deliver all at once.`,currentValue:e.followUpMode,values:["one-at-a-time","all"]},{id:"transport",label:"Transport",description:"Preferred transport for providers that support multiple transports",currentValue:e.transport,values:["sse","websocket","websocket-cached","auto"]},{id:"http-idle-timeout",label:"HTTP idle timeout",description:"Maximum idle gap while waiting for HTTP headers or body chunks. Disable for local models that pause longer than five minutes.",currentValue:Yp(e.httpIdleTimeoutMs),values:Jp.map(g=>g.label)},{id:"hide-thinking",label:"Hide thinking",description:"Hide thinking blocks in assistant responses",currentValue:e.hideThinkingBlock?"true":"false",values:["true","false"]},{id:"collapse-changelog",label:"Collapse changelog",description:"Show condensed changelog after updates",currentValue:e.collapseChangelog?"true":"false",values:["true","false"]},{id:"quiet-startup",label:"Quiet startup",description:"Disable verbose printing at startup",currentValue:e.quietStartup?"true":"false",values:["true","false"]},{id:"install-telemetry",label:"Install telemetry",description:"Send an anonymous version/update ping after changelog-detected updates",currentValue:e.enableInstallTelemetry?"true":"false",values:["true","false"]},{id:"default-project-trust",label:"Default project trust",description:"Fallback behavior when no extension or saved trust decision decides project trust",currentValue:vb[e.defaultProjectTrust],values:Object.values(vb)},{id:"double-escape-action",label:"Double-escape action",description:"Action when pressing Escape twice with empty editor",currentValue:e.doubleEscapeAction,values:["tree","fork","none"]},{id:"tree-filter-mode",label:"Tree filter mode",description:"Default filter when opening /tree",currentValue:e.treeFilterMode,values:["default","no-tools","user-only","labeled-only","all"]},{id:"warnings",label:"Warnings",description:"Enable or disable individual warnings",currentValue:"configure",submenu:(g,h)=>new yb(r,f=>{r=f,n.onWarningsChange(f)},()=>h())},{id:"thinking",label:"Thinking level",description:"Reasoning depth for thinking-capable models",currentValue:e.thinkingLevel,submenu:(g,h)=>new cm("Thinking Level","Select reasoning depth for thinking-capable models",e.availableThinkingLevels.map(f=>({value:f,label:f,description:z6[f]})),g,f=>{n.onThinkingLevelChange(f),h(f)},()=>h())},{id:"theme",label:"Theme",description:"Color theme for the interface",currentValue:e.currentTheme,submenu:(g,h)=>new cm("Theme","Select color theme",e.availableThemes.map(f=>({value:f,label:f})),g,f=>{n.onThemeChange(f),h(f)},()=>{n.onThemePreview?.(g),h()},f=>{n.onThemePreview?.(f)})}];i&&(o.splice(1,0,{id:"show-images",label:"Show images",description:"Render images inline in terminal",currentValue:e.showImages?"true":"false",values:["true","false"]}),o.splice(2,0,{id:"image-width-cells",label:"Image width",description:"Preferred inline image width in terminal cells",currentValue:String(e.imageWidthCells),values:["60","80","120"]})),o.splice(i?3:1,0,{id:"auto-resize-images",label:"Auto-resize images",description:"Resize large images to 2000x2000 max for better model compatibility",currentValue:e.autoResizeImages?"true":"false",values:["true","false"]});let a=o.findIndex(g=>g.id==="auto-resize-images");o.splice(a+1,0,{id:"block-images",label:"Block images",description:"Prevent images from being sent to LLM providers",currentValue:e.blockImages?"true":"false",values:["true","false"]});let c=o.findIndex(g=>g.id==="block-images");o.splice(c+1,0,{id:"skill-commands",label:"Skill commands",description:"Register skills as /skill:name commands",currentValue:e.enableSkillCommands?"true":"false",values:["true","false"]});let l=o.findIndex(g=>g.id==="skill-commands");o.splice(l+1,0,{id:"show-hardware-cursor",label:"Show hardware cursor",description:"Show the terminal cursor while still positioning it for IME support",currentValue:e.showHardwareCursor?"true":"false",values:["true","false"]});let u=o.findIndex(g=>g.id==="show-hardware-cursor");o.splice(u+1,0,{id:"editor-padding",label:"Editor padding",description:"Horizontal padding for input editor (0-3)",currentValue:String(e.editorPaddingX),values:["0","1","2","3"]});let d=o.findIndex(g=>g.id==="editor-padding");o.splice(d+1,0,{id:"autocomplete-max-visible",label:"Autocomplete max items",description:"Max visible items in autocomplete dropdown (3-20)",currentValue:String(e.autocompleteMaxVisible),values:["3","5","7","10","15","20"]});let p=o.findIndex(g=>g.id==="autocomplete-max-visible");o.splice(p+1,0,{id:"clear-on-shrink",label:"Clear on shrink",description:"Clear empty rows when content shrinks (may cause flicker)",currentValue:e.clearOnShrink?"true":"false",values:["true","false"]});let m=o.findIndex(g=>g.id==="clear-on-shrink");o.splice(m+1,0,{id:"terminal-progress",label:"Terminal progress",description:"Show OSC 9;4 progress indicators in the terminal tab bar",currentValue:e.showTerminalProgress?"true":"false",values:["true","false"]}),this.addChild(new z),this.settingsList=new xa(o,10,ip(),(g,h)=>{switch(g){case"autocompact":n.onAutoCompactChange(h==="true");break;case"show-images":n.onShowImagesChange(h==="true");break;case"image-width-cells":n.onImageWidthCellsChange(parseInt(h,10));break;case"auto-resize-images":n.onAutoResizeImagesChange(h==="true");break;case"block-images":n.onBlockImagesChange(h==="true");break;case"skill-commands":n.onEnableSkillCommandsChange(h==="true");break;case"steering-mode":n.onSteeringModeChange(h);break;case"follow-up-mode":n.onFollowUpModeChange(h);break;case"transport":n.onTransportChange(h);break;case"http-idle-timeout":{let f=Jp.find(x=>x.label===h);f&&n.onHttpIdleTimeoutMsChange(f.timeoutMs);break}case"hide-thinking":n.onHideThinkingBlockChange(h==="true");break;case"collapse-changelog":n.onCollapseChangelogChange(h==="true");break;case"quiet-startup":n.onQuietStartupChange(h==="true");break;case"install-telemetry":n.onEnableInstallTelemetryChange(h==="true");break;case"default-project-trust":{let f=V6.get(h);f&&n.onDefaultProjectTrustChange(f);break}case"double-escape-action":n.onDoubleEscapeActionChange(h);break;case"tree-filter-mode":n.onTreeFilterModeChange(h);break;case"show-hardware-cursor":n.onShowHardwareCursorChange(h==="true");break;case"editor-padding":n.onEditorPaddingXChange(parseInt(h,10));break;case"autocomplete-max-visible":n.onAutocompleteMaxVisibleChange(parseInt(h,10));break;case"clear-on-shrink":n.onClearOnShrinkChange(h==="true");break;case"terminal-progress":n.onShowTerminalProgressChange(h==="true");break}},n.onCancel,{enableSearch:!0}),this.addChild(this.settingsList),this.addChild(new z)}getSettingsList(){return this.settingsList}};var lc=class extends ht{constructor(n,i=Mt()){super(1,1,s=>b.bg("customMessageBg",s));this.expanded=!1;this.skillBlock=n,this.markdownTheme=i,this.updateDisplay()}setExpanded(n){this.expanded=n,this.updateDisplay()}invalidate(){super.invalidate(),this.updateDisplay()}updateDisplay(){if(this.clear(),this.expanded){let n=b.fg("customMessageLabel","\x1B[1m[skill]\x1B[22m");this.addChild(new E(n,0,0));let i=`**${this.skillBlock.name}**
|
|
320
|
+
`),await new Promise(c=>{let l=U6(r,[...o,s],{stdio:"inherit",shell:process.platform==="win32"});l.on("error",()=>c(null)),l.on("close",u=>c(u))})===0){let c=sc.readFileSync(s,"utf-8").replace(/\n$/,"");this.editor.setText(c)}}finally{try{sc.unlinkSync(s)}catch{}this.tui.start(),this.tui.requestRender(!0)}}};import{isAbsolute as D6,relative as $6,resolve as QM,sep as YM}from"node:path";function B6(t){return t.replace(/[\r\n\t]/g," ").replace(/ +/g," ").trim()}function rc(t){return t<1e3?t.toString():t<1e4?`${(t/1e3).toFixed(1)}k`:t<1e6?`${Math.round(t/1e3)}k`:t<1e7?`${(t/1e6).toFixed(1)}M`:`${Math.round(t/1e6)}M`}function N6(t,e){if(!e)return t;let n=QM(t),i=QM(e),s=$6(i,n);return s===""||s!==".."&&!s.startsWith(`..${YM}`)&&!D6(s)?s===""?"~":`~${YM}${s}`:t}var oc=class{constructor(e,n){this.autoCompactEnabled=!0;this.session=e,this.footerData=n}setSession(e){this.session=e}setAutoCompactEnabled(e){this.autoCompactEnabled=e}invalidate(){}dispose(){}render(e){let n=this.session.state,i=0,s=0,r=0,o=0,a=0,c;for(let ue of this.session.sessionManager.getEntries())if(ue.type==="message"&&ue.message.role==="assistant"){i+=ue.message.usage.input,s+=ue.message.usage.output,r+=ue.message.usage.cacheRead,o+=ue.message.usage.cacheWrite,a+=ue.message.usage.cost.total;let Me=ue.message.usage.input+ue.message.usage.cacheRead+ue.message.usage.cacheWrite;c=Me>0?ue.message.usage.cacheRead/Me*100:void 0}let l=this.session.getContextUsage(),u=l?.contextWindow??n.model?.contextWindow??0,d=l?.percent??0,p=l?.percent!==null?d.toFixed(1):"?",m=N6(this.session.sessionManager.getCwd(),process.env.HOME||process.env.USERPROFILE),g=this.footerData.getGitBranch();g&&(m=`${m} (${g})`);let h=this.session.sessionManager.getSessionName();h&&(m=`${m} \u2022 ${h}`);let f=[];i&&f.push(`\u2191${rc(i)}`),s&&f.push(`\u2193${rc(s)}`),r&&f.push(`R${rc(r)}`),o&&f.push(`W${rc(o)}`),(r>0||o>0)&&c!==void 0&&f.push(`CH${c.toFixed(1)}%`);let x=n.model?this.session.modelRegistry.isUsingOAuth(n.model):!1;if(a||x){let ue=`$${a.toFixed(3)}${x?" (sub)":""}`;f.push(ue)}let v,w=this.autoCompactEnabled?" (auto)":"",C=p==="?"?`?/${rc(u)}${w}`:`${p}%/${rc(u)}${w}`;d>90?v=b.fg("error",C):d>70?v=b.fg("warning",C):v=C,f.push(v);let P=f.join(" "),_=n.model?.id||"no-model",F=j(P);F>e&&(P=Z(P,e,"..."),F=j(P));let A=2,W=_;if(n.model?.reasoning){let ue=n.thinkingLevel||"off";W=ue==="off"?`${_} \u2022 thinking off`:`${_} \u2022 ${ue}`}let R=W;this.footerData.getAvailableProviderCount()>1&&n.model&&(R=`(${n.model.provider}) ${W}`,F+A+j(R)>e&&(R=W));let k=j(R),O=F+A+k,U;if(O<=e){let ue=" ".repeat(e-F-k);U=P+ue+R}else{let ue=e-F-A;if(ue>0){let Me=Z(R,ue,""),it=j(Me),$e=" ".repeat(Math.max(0,e-F-it));U=P+$e+Me}else U=P}let N=b.fg("dim",P),K=U.slice(P.length),G=b.fg("dim",K),le=[Z(b.fg("dim",m),e,b.fg("dim","...")),N+G],ye=this.footerData.getExtensionStatuses();if(ye.size>0){let Me=Array.from(ye.entries()).sort(([it],[$e])=>it.localeCompare($e)).map(([,it])=>B6(it)).join(" ");le.push(Z(Me,e,b.fg("dim","...")))}return le}};import{spawn as j6}from"node:child_process";function bb(t){let[e,n]=process.platform==="darwin"?["open",[t]]:process.platform==="win32"?["rundll32",["url.dll,FileProtocolHandler",t]]:["xdg-open",[t]];j6(e,n,{stdio:"ignore",detached:!0}).on("error",()=>{}).unref()}var Us=class extends H{constructor(n,i,s,r,o){super();this.abortController=new AbortController;this._focused=!1;this.tui=n,this.onComplete=s;let a=p0().find(u=>u.id===i),c=r||a?.name||i,l=o??`Login to ${c}`;this.addChild(new z),this.addChild(new E(b.fg("accent",b.bold(l)),1,0)),this.contentContainer=new H,this.addChild(this.contentContainer),this.input=new Qe,this.input.onSubmit=()=>{if(this.inputResolver){let u=this.input.getValue();this.replaceInputWithSubmittedText(u),this.inputResolver(u),this.inputResolver=void 0,this.inputRejecter=void 0}},this.input.onEscape=()=>{this.cancel()},this.addChild(new z)}get focused(){return this._focused}set focused(n){this._focused=n,this.input.focused=n}get signal(){return this.abortController.signal}replaceInputWithSubmittedText(n){this.contentContainer.children=this.contentContainer.children.map(i=>i===this.input?new E(`> ${n}`,0,0):i)}cancel(){this.abortController.abort(),this.inputRejecter&&(this.inputRejecter(new Error("Login cancelled")),this.inputResolver=void 0,this.inputRejecter=void 0),this.onComplete(!1,"Login cancelled")}showAuth(n,i){this.contentContainer.clear(),this.contentContainer.addChild(new L(1));let s=`\x1B]8;;${n}\x07${n}\x1B]8;;\x07`;this.contentContainer.addChild(new E(b.fg("accent",s),1,0));let r=process.platform==="darwin"?"Cmd+click to open":"Ctrl+click to open",o=`\x1B]8;;${n}\x07${r}\x1B]8;;\x07`;this.contentContainer.addChild(new E(b.fg("dim",o),1,0)),i&&(this.contentContainer.addChild(new L(1)),this.contentContainer.addChild(new E(b.fg("warning",i),1,0))),bb(n),this.tui.requestRender()}showDeviceCode(n){this.contentContainer.clear(),this.contentContainer.addChild(new L(1));let i=`\x1B]8;;${n.verificationUri}\x07${n.verificationUri}\x1B]8;;\x07`;this.contentContainer.addChild(new E(b.fg("accent",i),1,0));let s=process.platform==="darwin"?"Cmd+click to open":"Ctrl+click to open",r=`\x1B]8;;${n.verificationUri}\x07${s}\x1B]8;;\x07`;this.contentContainer.addChild(new E(b.fg("dim",r),1,0)),this.contentContainer.addChild(new L(1)),this.contentContainer.addChild(new E(b.fg("warning",`Enter code: ${n.userCode}`),1,0)),bb(n.verificationUri),this.tui.requestRender()}showManualInput(n){return this.input.setValue(""),this.contentContainer.addChild(new L(1)),this.contentContainer.addChild(new E(b.fg("dim",n),1,0)),this.contentContainer.addChild(this.input),this.contentContainer.addChild(new E(`(${re("tui.select.cancel","to cancel")})`,1,0)),this.tui.requestRender(),new Promise((i,s)=>{this.inputResolver=i,this.inputRejecter=s})}showPrompt(n,i){return this.contentContainer.addChild(new L(1)),this.contentContainer.addChild(new E(b.fg("text",n),1,0)),i&&this.contentContainer.addChild(new E(b.fg("dim",`e.g., ${i}`),1,0)),this.contentContainer.addChild(this.input),this.contentContainer.addChild(new E(`(${re("tui.select.cancel","to cancel,")} ${re("tui.select.confirm","to submit")})`,1,0)),this.input.setValue(""),this.tui.requestRender(),new Promise((s,r)=>{this.inputResolver=s,this.inputRejecter=r})}showInfo(n){this.contentContainer.clear(),this.contentContainer.addChild(new L(1));for(let i of n)this.contentContainer.addChild(new E(i,1,0));this.contentContainer.addChild(new L(1)),this.contentContainer.addChild(new E(`(${re("tui.select.cancel","to close")})`,1,0)),this.tui.requestRender()}showWaiting(n){this.contentContainer.addChild(new L(1)),this.contentContainer.addChild(new E(b.fg("dim",n),1,0)),this.contentContainer.addChild(new E(`(${re("tui.select.cancel","to cancel")})`,1,0)),this.tui.requestRender()}showProgress(n){this.contentContainer.addChild(new E(b.fg("dim",n),1,0)),this.tui.requestRender()}handleInput(n){if(fe().matches(n,"tui.select.cancel")){this.cancel();return}this.input.handleInput(n)}};var ac=class extends H{constructor(n,i,s,r,o,a,c,l){super();this._focused=!1;this.allModels=[];this.scopedModelItems=[];this.activeModels=[];this.filteredModels=[];this.selectedIndex=0;this.scope="all";if(this.tui=n,this.currentModel=i,this.settingsManager=s,this.modelRegistry=r,this.scopedModels=o,this.scope=o.length>0?"scoped":"all",this.onSelectCallback=a,this.onCancelCallback=c,this.addChild(new z),this.addChild(new L(1)),o.length>0)this.scopeText=new E(this.getScopeText(),0,0),this.addChild(this.scopeText),this.scopeHintText=new E(this.getScopeHintText(),0,0),this.addChild(this.scopeHintText);else{let u="Only showing models from configured providers. Use /login to add providers.";this.addChild(new E(b.fg("warning",u),0,0))}this.addChild(new L(1)),this.searchInput=new Qe,l&&this.searchInput.setValue(l),this.searchInput.onSubmit=()=>{this.filteredModels[this.selectedIndex]&&this.handleSelect(this.filteredModels[this.selectedIndex].model)},this.addChild(this.searchInput),this.addChild(new L(1)),this.listContainer=new H,this.addChild(this.listContainer),this.addChild(new L(1)),this.addChild(new z),this.loadModels().then(()=>{l?this.filterModels(l):this.updateList(),this.tui.requestRender()})}get focused(){return this._focused}set focused(n){this._focused=n,this.searchInput.focused=n}async loadModels(){let n;this.modelRegistry.refresh();let i=this.modelRegistry.getError();i&&(this.errorMessage=i);try{n=(await this.modelRegistry.getAvailable()).map(o=>({provider:o.provider,id:o.id,model:o}))}catch(r){this.allModels=[],this.scopedModelItems=[],this.activeModels=[],this.filteredModels=[],this.errorMessage=r instanceof Error?r.message:String(r);return}this.allModels=this.sortModels(n),this.scopedModels=this.scopedModels.map(r=>{let o=this.modelRegistry.find(r.model.provider,r.model.id);return o?{...r,model:o}:r}),this.scopedModelItems=this.scopedModels.map(r=>({provider:r.model.provider,id:r.model.id,model:r.model})),this.activeModels=this.scope==="scoped"?this.scopedModelItems:this.allModels,this.filteredModels=this.activeModels;let s=this.filteredModels.findIndex(r=>zn(this.currentModel,r.model));this.selectedIndex=s>=0?s:Math.min(this.selectedIndex,Math.max(0,this.filteredModels.length-1))}sortModels(n){let i=[...n];return i.sort((s,r)=>{let o=zn(this.currentModel,s.model),a=zn(this.currentModel,r.model);return o&&!a?-1:!o&&a?1:s.provider.localeCompare(r.provider)}),i}getScopeText(){let n=this.scope==="all"?b.fg("accent","all"):b.fg("muted","all"),i=this.scope==="scoped"?b.fg("accent","scoped"):b.fg("muted","scoped");return`${b.fg("muted","Scope: ")}${n}${b.fg("muted"," | ")}${i}`}getScopeHintText(){return re("tui.input.tab","scope")+b.fg("muted"," (all/scoped)")}setScope(n){if(this.scope===n)return;this.scope=n,this.activeModels=this.scope==="scoped"?this.scopedModelItems:this.allModels;let i=this.activeModels.findIndex(s=>zn(this.currentModel,s.model));this.selectedIndex=i>=0?i:0,this.filterModels(this.searchInput.getValue()),this.scopeText&&this.scopeText.setText(this.getScopeText())}filterModels(n){this.filteredModels=n?Ht(this.activeModels,n,({id:i,provider:s})=>`${i} ${s} ${s}/${i} ${s} ${i}`):this.activeModels,this.selectedIndex=Math.min(this.selectedIndex,Math.max(0,this.filteredModels.length-1)),this.updateList()}updateList(){this.listContainer.clear();let n=10,i=Math.max(0,Math.min(this.selectedIndex-Math.floor(n/2),this.filteredModels.length-n)),s=Math.min(i+n,this.filteredModels.length);for(let r=i;r<s;r++){let o=this.filteredModels[r];if(!o)continue;let a=r===this.selectedIndex,c=zn(this.currentModel,o.model),l="";if(a){let u=b.fg("accent","\u2192 "),d=`${o.id}`,p=b.fg("muted",`[${o.provider}]`),m=c?b.fg("success"," \u2713"):"";l=`${u+b.fg("accent",d)} ${p}${m}`}else{let u=` ${o.id}`,d=b.fg("muted",`[${o.provider}]`),p=c?b.fg("success"," \u2713"):"";l=`${u} ${d}${p}`}this.listContainer.addChild(new E(l,0,0))}if(i>0||s<this.filteredModels.length){let r=b.fg("muted",` (${this.selectedIndex+1}/${this.filteredModels.length})`);this.listContainer.addChild(new E(r,0,0))}if(this.errorMessage){let r=this.errorMessage.split(`
|
|
321
|
+
`);for(let o of r)this.listContainer.addChild(new E(b.fg("error",o),0,0))}else if(this.filteredModels.length===0)this.listContainer.addChild(new E(b.fg("muted"," No matching models"),0,0));else{let r=this.filteredModels[this.selectedIndex];this.listContainer.addChild(new L(1)),this.listContainer.addChild(new E(b.fg("muted",` Model Name: ${r.model.name}`),0,0))}}handleInput(n){let i=fe();if(i.matches(n,"tui.input.tab")){if(this.scopedModelItems.length>0){let s=this.scope==="all"?"scoped":"all";this.setScope(s),this.scopeHintText&&this.scopeHintText.setText(this.getScopeHintText())}return}if(i.matches(n,"tui.select.up")){if(this.filteredModels.length===0)return;this.selectedIndex=this.selectedIndex===0?this.filteredModels.length-1:this.selectedIndex-1,this.updateList()}else if(i.matches(n,"tui.select.down")){if(this.filteredModels.length===0)return;this.selectedIndex=this.selectedIndex===this.filteredModels.length-1?0:this.selectedIndex+1,this.updateList()}else if(i.matches(n,"tui.select.confirm")){let s=this.filteredModels[this.selectedIndex];s&&this.handleSelect(s.model)}else i.matches(n,"tui.select.cancel")?this.onCancelCallback():(this.searchInput.handleInput(n),this.filterModels(this.searchInput.getValue()))}handleSelect(n){this.settingsManager.setDefaultModelAndProvider(n.provider,n.id),this.onSelectCallback(n)}getSearchInput(){return this.searchInput}};var Ur=class extends H{constructor(n,i,s,r,o,a){super();this._focused=!1;this.selectedIndex=0;this.mode=n,this.authStorage=i,this.getAuthStatus=a??(l=>this.authStorage.getAuthStatus(l)),this.allProviders=s,this.filteredProviders=s,this.onSelectCallback=r,this.onCancelCallback=o,this.addChild(new z),this.addChild(new L(1));let c=n==="login"?"Select provider to configure:":"Select provider to logout:";this.addChild(new An(b.fg("accent",b.bold(c)),1,0)),this.addChild(new L(1)),this.searchInput=new Qe,this.searchInput.onSubmit=()=>{let l=this.filteredProviders[this.selectedIndex];l&&this.onSelectCallback(l.id)},this.addChild(this.searchInput),this.addChild(new L(1)),this.listContainer=new H,this.addChild(this.listContainer),this.addChild(new L(1)),this.addChild(new z),this.filterProviders("")}get focused(){return this._focused}set focused(n){this._focused=n,this.searchInput.focused=n}filterProviders(n){this.filteredProviders=n?Ht(this.allProviders,n,i=>`${i.name} ${i.id} ${i.authType}`):this.allProviders,this.selectedIndex=Math.max(0,Math.min(this.selectedIndex,Math.max(0,this.filteredProviders.length-1))),this.updateList()}updateList(){this.listContainer.clear();let n=8,i=Math.max(0,Math.min(this.selectedIndex-Math.floor(n/2),this.filteredProviders.length-n)),s=Math.min(i+n,this.filteredProviders.length);for(let r=i;r<s;r++){let o=this.filteredProviders[r];if(!o)continue;let a=r===this.selectedIndex,c=this.formatStatusIndicator(o),l="";if(a){let u=b.fg("accent","\u2192 "),d=b.fg("accent",o.name);l=u+d+c}else l=` ${b.fg("text",o.name)}`+c;this.listContainer.addChild(new An(l,1,0))}if(i>0||s<this.filteredProviders.length){let r=b.fg("muted",` (${this.selectedIndex+1}/${this.filteredProviders.length})`);this.listContainer.addChild(new An(r,1,0))}if(this.filteredProviders.length===0){let r=this.allProviders.length===0?this.mode==="login"?"No providers available":"No providers logged in. Use /login first.":"No matching providers";this.listContainer.addChild(new An(b.fg("muted",` ${r}`),1,0))}}formatStatusIndicator(n){let i=this.authStorage.get(n.id);if(i?.type===n.authType)return b.fg("success"," \u2713 configured");if(i){let r=i.type==="oauth"?"subscription configured":"API key configured";return b.fg("muted"," \u2022 ")+b.fg("warning",r)}if(n.authType!=="api_key")return b.fg("muted"," \u2022 unconfigured");let s=this.getAuthStatus(n.id);switch(s.source){case"environment":return b.fg("success",` \u2713 env: ${s.label??"API key"}`);case"runtime":return b.fg("success"," \u2713 runtime API key");case"fallback":return b.fg("success"," \u2713 custom API key");case"models_json_key":return b.fg("success"," \u2713 key in models.json");case"models_json_command":return b.fg("success"," \u2713 command in models.json");default:return b.fg("muted"," \u2022 unconfigured")}}handleInput(n){let i=fe();if(i.matches(n,"tui.select.up")){if(this.filteredProviders.length===0)return;this.selectedIndex=Math.max(0,this.selectedIndex-1),this.updateList()}else if(i.matches(n,"tui.select.down")){if(this.filteredProviders.length===0)return;this.selectedIndex=Math.min(this.filteredProviders.length-1,this.selectedIndex+1),this.updateList()}else if(i.matches(n,"tui.select.confirm")){let s=this.filteredProviders[this.selectedIndex];s&&this.onSelectCallback(s.id)}else i.matches(n,"tui.select.cancel")?this.onCancelCallback():(this.searchInput.handleInput(n),this.filterProviders(this.searchInput.getValue()))}};function xb(t,e){return t===null||t.includes(e)}function q6(t,e){if(t===null)return[e];let n=t.indexOf(e);return n>=0?[...t.slice(0,n),...t.slice(n+1)]:[...t,e]}function XM(t,e,n){if(t===null)return null;let i=n??e,s=[...t];for(let r of i)s.includes(r)||s.push(r);return s.length===e.length?null:s}function ZM(t,e,n){if(t===null)return n?e.filter(s=>!n.includes(s)):[];let i=new Set(n??t);return t.filter(s=>!i.has(s))}function G6(t,e,n){if(t===null)return null;let i=[...t],s=i.indexOf(e);if(s<0)return i;let r=s+n;if(r<0||r>=i.length)return i;let o=[...i];return[o[s],o[r]]=[o[r],o[s]],o}function K6(t,e){if(t===null)return e;let n=new Set(t);return[...t,...e.filter(i=>!n.has(i))]}var Jl=class extends H{constructor(n,i){super();this.modelsById=new Map;this.allIds=[];this.enabledIds=null;this.filteredItems=[];this.selectedIndex=0;this._focused=!1;this.maxVisible=8;this.isDirty=!1;this.callbacks=i;for(let s of n.allModels){let r=`${s.provider}/${s.id}`;this.modelsById.set(r,s),this.allIds.push(r)}this.enabledIds=n.enabledModelIds===null?null:[...n.enabledModelIds],this.filteredItems=this.buildItems(),this.addChild(new z),this.addChild(new L(1)),this.addChild(new E(b.fg("accent",b.bold("Model Configuration")),0,0)),this.addChild(new E(b.fg("muted",`Session-only. ${ke("app.models.save")} to save to settings.`),0,0)),this.addChild(new L(1)),this.searchInput=new Qe,this.addChild(this.searchInput),this.addChild(new L(1)),this.listContainer=new H,this.addChild(this.listContainer),this.addChild(new L(1)),this.footerText=new E(this.getFooterText(),0,0),this.addChild(this.footerText),this.addChild(new z),this.updateList()}get focused(){return this._focused}set focused(n){this._focused=n,this.searchInput.focused=n}buildItems(){return K6(this.enabledIds,this.allIds).filter(n=>this.modelsById.has(n)).map(n=>({fullId:n,model:this.modelsById.get(n),enabled:xb(this.enabledIds,n)}))}getFooterText(){let n=this.enabledIds?.length??this.allIds.length,s=this.enabledIds===null?"all enabled":`${n}/${this.allIds.length} enabled`,r=[`${ke("tui.select.confirm")} toggle`,`${ke("app.models.enableAll")} all`,`${ke("app.models.clearAll")} clear`,`${ke("app.models.toggleProvider")} provider`,`${ke("app.models.reorderUp")}/${ke("app.models.reorderDown")} reorder`,`${ke("app.models.save")} save`,s];return this.isDirty?b.fg("dim",` ${r.join(" \xB7 ")} `)+b.fg("warning","(unsaved)"):b.fg("dim",` ${r.join(" \xB7 ")}`)}refresh(){let n=this.searchInput.getValue(),i=this.buildItems();this.filteredItems=n?Ht(i,n,s=>`${s.model.id} ${s.model.provider}`):i,this.selectedIndex=Math.min(this.selectedIndex,Math.max(0,this.filteredItems.length-1)),this.updateList(),this.footerText.setText(this.getFooterText())}notifyChange(){this.callbacks.onChange(this.enabledIds===null?null:[...this.enabledIds])}updateList(){if(this.listContainer.clear(),this.filteredItems.length===0){this.listContainer.addChild(new E(b.fg("muted"," No matching models"),0,0));return}let n=Math.max(0,Math.min(this.selectedIndex-Math.floor(this.maxVisible/2),this.filteredItems.length-this.maxVisible)),i=Math.min(n+this.maxVisible,this.filteredItems.length),s=this.enabledIds===null;for(let r=n;r<i;r++){let o=this.filteredItems[r],a=r===this.selectedIndex,c=a?b.fg("accent","\u2192 "):" ",l=a?b.fg("accent",o.model.id):o.model.id,u=b.fg("muted",` [${o.model.provider}]`),d=s?"":o.enabled?b.fg("success"," \u2713"):b.fg("dim"," \u2717");this.listContainer.addChild(new E(`${c}${l}${u}${d}`,0,0))}if((n>0||i<this.filteredItems.length)&&this.listContainer.addChild(new E(b.fg("muted",` (${this.selectedIndex+1}/${this.filteredItems.length})`),0,0)),this.filteredItems.length>0){let r=this.filteredItems[this.selectedIndex];this.listContainer.addChild(new L(1)),this.listContainer.addChild(new E(b.fg("muted",` Model Name: ${r.model.name}`),0,0))}}handleInput(n){let i=fe();if(i.matches(n,"tui.select.up")){if(this.filteredItems.length===0)return;this.selectedIndex=this.selectedIndex===0?this.filteredItems.length-1:this.selectedIndex-1,this.updateList();return}if(i.matches(n,"tui.select.down")){if(this.filteredItems.length===0)return;this.selectedIndex=this.selectedIndex===this.filteredItems.length-1?0:this.selectedIndex+1,this.updateList();return}let s=i.matches(n,"app.models.reorderUp"),r=i.matches(n,"app.models.reorderDown");if(s||r){if(this.enabledIds===null)return;let o=this.filteredItems[this.selectedIndex];if(o&&xb(this.enabledIds,o.fullId)){let a=s?-1:1,l=this.enabledIds.indexOf(o.fullId)+a;l>=0&&l<this.enabledIds.length&&(this.enabledIds=G6(this.enabledIds,o.fullId,a),this.isDirty=!0,this.selectedIndex+=a,this.refresh(),this.notifyChange())}return}if(i.matches(n,"tui.select.confirm")){let o=this.filteredItems[this.selectedIndex];o&&(this.enabledIds=q6(this.enabledIds,o.fullId),this.isDirty=!0,this.refresh(),this.notifyChange());return}if(i.matches(n,"app.models.enableAll")){let o=this.searchInput.getValue()?this.filteredItems.map(a=>a.fullId):void 0;this.enabledIds=XM(this.enabledIds,this.allIds,o),this.isDirty=!0,this.refresh(),this.notifyChange();return}if(i.matches(n,"app.models.clearAll")){let o=this.searchInput.getValue()?this.filteredItems.map(a=>a.fullId):void 0;this.enabledIds=ZM(this.enabledIds,this.allIds,o),this.isDirty=!0,this.refresh(),this.notifyChange();return}if(i.matches(n,"app.models.toggleProvider")){let o=this.filteredItems[this.selectedIndex];if(o){let a=o.model.provider,c=this.allIds.filter(u=>this.modelsById.get(u).provider===a),l=c.every(u=>xb(this.enabledIds,u));this.enabledIds=l?ZM(this.enabledIds,this.allIds,c):XM(this.enabledIds,this.allIds,c),this.isDirty=!0,this.refresh(),this.notifyChange()}return}if(i.matches(n,"app.models.save")){this.callbacks.onPersist(this.enabledIds===null?null:[...this.enabledIds]),this.isDirty=!1,this.footerText.setText(this.getFooterText());return}if(Ae(n,pr.ctrl("c"))){this.searchInput.getValue()?(this.searchInput.setValue(""),this.refresh()):this.callbacks.onCancel();return}if(Ae(n,pr.escape)){this.callbacks.onCancel();return}this.searchInput.handleInput(n),this.refresh()}getSearchInput(){return this.searchInput}};var H6={minPrimaryColumnWidth:12,maxPrimaryColumnWidth:32},z6={off:"No reasoning",minimal:"Very brief reasoning (~1k tokens)",low:"Light reasoning (~2k tokens)",medium:"Moderate reasoning (~8k tokens)",high:"Deep reasoning (~16k tokens)",xhigh:"Maximum reasoning (~32k tokens)"},vb={ask:"Ask",always:"Always trust",never:"Never trust"},V6=new Map(Object.entries(vb).map(([t,e])=>[e,t])),yb=class extends H{constructor(e,n,i){super(),this.state={...e};let s=[{id:"anthropic-extra-usage",label:"Anthropic extra usage",description:"Warn when Anthropic subscription auth may use paid extra usage",currentValue:this.state.anthropicExtraUsage??!0?"true":"false",values:["true","false"]}];this.settingsList=new xa(s,Math.min(s.length,10),ip(),(r,o)=>{r==="anthropic-extra-usage"&&(this.state={...this.state,anthropicExtraUsage:o==="true"},n({...this.state}))},i),this.addChild(this.settingsList)}handleInput(e){this.settingsList.handleInput(e)}},cm=class extends H{constructor(e,n,i,s,r,o,a){super(),this.addChild(new E(b.bold(b.fg("accent",e)),0,0)),n&&(this.addChild(new L(1)),this.addChild(new E(b.fg("muted",n),0,0))),this.addChild(new L(1)),this.selectList=new Yt(i,Math.min(i.length,10),Tr(),H6);let c=i.findIndex(l=>l.value===s);c!==-1&&this.selectList.setSelectedIndex(c),this.selectList.onSelect=l=>{r(l.value)},this.selectList.onCancel=o,a&&(this.selectList.onSelectionChange=l=>{a(l.value)}),this.addChild(this.selectList),this.addChild(new L(1)),this.addChild(new E(b.fg("dim"," Enter to select \xB7 Esc to go back"),0,0))}handleInput(e){this.selectList.handleInput(e)}},cc=class extends H{constructor(e,n){super();let i=ct().images,s=Rl("app.message.followUp"),r={...e.warnings},o=[{id:"autocompact",label:"Auto-compact",description:"Automatically compact context when it gets too large",currentValue:e.autoCompact?"true":"false",values:["true","false"]},{id:"steering-mode",label:"Steering mode",description:"Enter while streaming queues steering messages. 'one-at-a-time': deliver one, wait for response. 'all': deliver all at once.",currentValue:e.steeringMode,values:["one-at-a-time","all"]},{id:"follow-up-mode",label:"Follow-up mode",description:`${s} queues follow-up messages until agent stops. 'one-at-a-time': deliver one, wait for response. 'all': deliver all at once.`,currentValue:e.followUpMode,values:["one-at-a-time","all"]},{id:"transport",label:"Transport",description:"Preferred transport for providers that support multiple transports",currentValue:e.transport,values:["sse","websocket","websocket-cached","auto"]},{id:"http-idle-timeout",label:"HTTP idle timeout",description:"Maximum idle gap while waiting for HTTP headers or body chunks. Disable for local models that pause longer than five minutes.",currentValue:Yp(e.httpIdleTimeoutMs),values:Jp.map(g=>g.label)},{id:"hide-thinking",label:"Hide thinking",description:"Hide thinking blocks in assistant responses",currentValue:e.hideThinkingBlock?"true":"false",values:["true","false"]},{id:"collapse-changelog",label:"Collapse changelog",description:"Show condensed changelog after updates",currentValue:e.collapseChangelog?"true":"false",values:["true","false"]},{id:"quiet-startup",label:"Quiet startup",description:"Disable verbose printing at startup",currentValue:e.quietStartup?"true":"false",values:["true","false"]},{id:"install-telemetry",label:"Install telemetry",description:"Send an anonymous version/update ping after changelog-detected updates",currentValue:e.enableInstallTelemetry?"true":"false",values:["true","false"]},{id:"default-project-trust",label:"Default project trust",description:"Fallback behavior when no extension or saved trust decision decides project trust",currentValue:vb[e.defaultProjectTrust],values:Object.values(vb)},{id:"double-escape-action",label:"Double-escape action",description:"Action when pressing Escape twice with empty editor",currentValue:e.doubleEscapeAction,values:["tree","fork","none"]},{id:"tree-filter-mode",label:"Tree filter mode",description:"Default filter when opening /tree",currentValue:e.treeFilterMode,values:["default","no-tools","user-only","labeled-only","all"]},{id:"warnings",label:"Warnings",description:"Enable or disable individual warnings",currentValue:"configure",submenu:(g,h)=>new yb(r,f=>{r=f,n.onWarningsChange(f)},()=>h())},{id:"thinking",label:"Thinking level",description:"Reasoning depth for thinking-capable models",currentValue:e.thinkingLevel,submenu:(g,h)=>new cm("Thinking Level","Select reasoning depth for thinking-capable models",e.availableThinkingLevels.map(f=>({value:f,label:f,description:z6[f]})),g,f=>{n.onThinkingLevelChange(f),h(f)},()=>h())},{id:"theme",label:"Theme",description:"Color theme for the interface",currentValue:e.currentTheme,submenu:(g,h)=>new cm("Theme","Select color theme",e.availableThemes.map(f=>({value:f,label:f})),g,f=>{n.onThemeChange(f),h(f)},()=>{n.onThemePreview?.(g),h()},f=>{n.onThemePreview?.(f)})}];i&&(o.splice(1,0,{id:"show-images",label:"Show images",description:"Render images inline in terminal",currentValue:e.showImages?"true":"false",values:["true","false"]}),o.splice(2,0,{id:"image-width-cells",label:"Image width",description:"Preferred inline image width in terminal cells",currentValue:String(e.imageWidthCells),values:["60","80","120"]})),o.splice(i?3:1,0,{id:"auto-resize-images",label:"Auto-resize images",description:"Resize large images to 2000x2000 max for better model compatibility",currentValue:e.autoResizeImages?"true":"false",values:["true","false"]});let a=o.findIndex(g=>g.id==="auto-resize-images");o.splice(a+1,0,{id:"block-images",label:"Block images",description:"Prevent images from being sent to LLM providers",currentValue:e.blockImages?"true":"false",values:["true","false"]});let c=o.findIndex(g=>g.id==="block-images");o.splice(c+1,0,{id:"skill-commands",label:"Skill commands",description:"Register skills as /skill:name commands",currentValue:e.enableSkillCommands?"true":"false",values:["true","false"]});let l=o.findIndex(g=>g.id==="skill-commands");o.splice(l+1,0,{id:"show-hardware-cursor",label:"Show hardware cursor",description:"Show the terminal cursor while still positioning it for IME support",currentValue:e.showHardwareCursor?"true":"false",values:["true","false"]});let u=o.findIndex(g=>g.id==="show-hardware-cursor");o.splice(u+1,0,{id:"editor-padding",label:"Editor padding",description:"Horizontal padding for input editor (0-3)",currentValue:String(e.editorPaddingX),values:["0","1","2","3"]});let d=o.findIndex(g=>g.id==="editor-padding");o.splice(d+1,0,{id:"autocomplete-max-visible",label:"Autocomplete max items",description:"Max visible items in autocomplete dropdown (3-20)",currentValue:String(e.autocompleteMaxVisible),values:["3","5","7","10","15","20"]});let p=o.findIndex(g=>g.id==="autocomplete-max-visible");o.splice(p+1,0,{id:"clear-on-shrink",label:"Clear on shrink",description:"Clear empty rows when content shrinks (may cause flicker)",currentValue:e.clearOnShrink?"true":"false",values:["true","false"]});let m=o.findIndex(g=>g.id==="clear-on-shrink");o.splice(m+1,0,{id:"terminal-progress",label:"Terminal progress",description:"Show OSC 9;4 progress indicators in the terminal tab bar",currentValue:e.showTerminalProgress?"true":"false",values:["true","false"]}),this.addChild(new z),this.settingsList=new xa(o,10,ip(),(g,h)=>{switch(g){case"autocompact":n.onAutoCompactChange(h==="true");break;case"show-images":n.onShowImagesChange(h==="true");break;case"image-width-cells":n.onImageWidthCellsChange(parseInt(h,10));break;case"auto-resize-images":n.onAutoResizeImagesChange(h==="true");break;case"block-images":n.onBlockImagesChange(h==="true");break;case"skill-commands":n.onEnableSkillCommandsChange(h==="true");break;case"steering-mode":n.onSteeringModeChange(h);break;case"follow-up-mode":n.onFollowUpModeChange(h);break;case"transport":n.onTransportChange(h);break;case"http-idle-timeout":{let f=Jp.find(x=>x.label===h);f&&n.onHttpIdleTimeoutMsChange(f.timeoutMs);break}case"hide-thinking":n.onHideThinkingBlockChange(h==="true");break;case"collapse-changelog":n.onCollapseChangelogChange(h==="true");break;case"quiet-startup":n.onQuietStartupChange(h==="true");break;case"install-telemetry":n.onEnableInstallTelemetryChange(h==="true");break;case"default-project-trust":{let f=V6.get(h);f&&n.onDefaultProjectTrustChange(f);break}case"double-escape-action":n.onDoubleEscapeActionChange(h);break;case"tree-filter-mode":n.onTreeFilterModeChange(h);break;case"show-hardware-cursor":n.onShowHardwareCursorChange(h==="true");break;case"editor-padding":n.onEditorPaddingXChange(parseInt(h,10));break;case"autocomplete-max-visible":n.onAutocompleteMaxVisibleChange(parseInt(h,10));break;case"clear-on-shrink":n.onClearOnShrinkChange(h==="true");break;case"terminal-progress":n.onShowTerminalProgressChange(h==="true");break}},n.onCancel,{enableSearch:!0}),this.addChild(this.settingsList),this.addChild(new z)}getSettingsList(){return this.settingsList}};var lc=class extends ht{constructor(n,i=Mt()){super(1,1,s=>b.bg("customMessageBg",s));this.expanded=!1;this.skillBlock=n,this.markdownTheme=i,this.updateDisplay()}setExpanded(n){this.expanded=n,this.updateDisplay()}invalidate(){super.invalidate(),this.updateDisplay()}updateDisplay(){if(this.clear(),this.expanded){let n=b.fg("customMessageLabel","\x1B[1m[skill]\x1B[22m");this.addChild(new E(n,0,0));let i=`**${this.skillBlock.name}**
|
|
322
322
|
|
|
323
323
|
`;this.addChild(new ze(i+this.skillBlock.content,0,0,this.markdownTheme,{color:s=>b.fg("customMessageText",s)}))}else{let n=b.fg("customMessageLabel","\x1B[1m[skill]\x1B[22m ")+b.fg("customMessageText",this.skillBlock.name)+b.fg("dim",` (${ke("app.tools.expand")} to expand)`);this.addChild(new E(n,0,0))}}};async function wb(t,e){if(e==="image/png")return{data:t,mimeType:e};let n=await Ba();if(!n)return null;try{let i=new Uint8Array(Buffer.from(t,"base64")),s=n.PhotonImage.new_from_byteslice(i),r=Lp(n,s,i);r!==s&&s.free();try{let o=r.get_bytes();return{data:Buffer.from(o).toString("base64"),mimeType:"image/png"}}finally{r.free()}}catch{return null}}var gi=class extends H{constructor(n,i,s,r={},o,a,c){super();this.rendererState={};this.imageComponents=[];this.imageSpacers=[];this.expanded=!1;this.isPartial=!0;this.executionStarted=!1;this.argsComplete=!1;this.convertedImages=new Map;this.hideComponent=!1;this.toolName=n,this.toolCallId=i,this.args=s,this.toolDefinition=o,this.builtInToolDefinition=F0(c)[n],this.showImages=r.showImages??!0,this.imageWidthCells=r.imageWidthCells??60,this.ui=a,this.cwd=c,this.addChild(new L(1)),this.contentBox=new ht(1,1,l=>b.bg("toolPendingBg",l)),this.contentText=new E("",1,1,l=>b.bg("toolPendingBg",l)),this.selfRenderContainer=new H,this.hasRendererDefinition()?this.addChild(this.getRenderShell()==="self"?this.selfRenderContainer:this.contentBox):this.addChild(this.contentText),this.updateDisplay()}getCallRenderer(){return this.builtInToolDefinition?this.toolDefinition?this.toolDefinition.renderCall??this.builtInToolDefinition.renderCall:this.builtInToolDefinition.renderCall:this.toolDefinition?.renderCall}getResultRenderer(){return this.builtInToolDefinition?this.toolDefinition?this.toolDefinition.renderResult??this.builtInToolDefinition.renderResult:this.builtInToolDefinition.renderResult:this.toolDefinition?.renderResult}hasRendererDefinition(){return this.builtInToolDefinition!==void 0||this.toolDefinition!==void 0}getRenderShell(){return this.builtInToolDefinition?this.toolDefinition?this.toolDefinition.renderShell??this.builtInToolDefinition.renderShell??"default":this.builtInToolDefinition.renderShell??"default":this.toolDefinition?.renderShell??"default"}getRenderContext(n){return{args:this.args,toolCallId:this.toolCallId,invalidate:()=>{this.invalidate(),this.ui.requestRender()},lastComponent:n,state:this.rendererState,cwd:this.cwd,executionStarted:this.executionStarted,argsComplete:this.argsComplete,isPartial:this.isPartial,expanded:this.expanded,showImages:this.showImages,isError:this.result?.isError??!1}}createCallFallback(){return new E(b.fg("toolTitle",b.bold(this.toolName)),0,0)}createResultFallback(){let n=this.getTextOutput();if(n)return new E(b.fg("toolOutput",n),0,0)}updateArgs(n){this.args=n,this.updateDisplay()}markExecutionStarted(){this.executionStarted=!0,this.updateDisplay(),this.ui.requestRender()}setArgsComplete(){this.argsComplete=!0,this.updateDisplay(),this.ui.requestRender()}updateResult(n,i=!1){this.result=n,this.isPartial=i,this.updateDisplay(),this.maybeConvertImagesForKitty()}maybeConvertImagesForKitty(){if(ct().images!=="kitty"||!this.result)return;let i=this.result.content.filter(s=>s.type==="image");for(let s=0;s<i.length;s++){let r=i[s];if(!r.data||!r.mimeType||r.mimeType==="image/png"||this.convertedImages.has(s))continue;let o=s;wb(r.data,r.mimeType).then(a=>{a&&(this.convertedImages.set(o,a),this.updateDisplay(),this.ui.requestRender())})}}setExpanded(n){this.expanded=n,this.updateDisplay()}setShowImages(n){this.showImages=n,this.updateDisplay()}setImageWidthCells(n){this.imageWidthCells=Math.max(1,Math.floor(n)),this.updateDisplay()}invalidate(){super.invalidate(),this.updateDisplay()}render(n){if(this.hideComponent)return[];if(this.hasRendererDefinition()&&this.getRenderShell()==="self"){let i=this.selfRenderContainer.render(n);if(i.length===0&&this.imageComponents.length===0)return[];let s=[];i.length>0&&(s.push(""),s.push(...i));for(let r=0;r<this.imageComponents.length;r++){let o=this.imageSpacers[r];o&&s.push(...o.render(n));let a=this.imageComponents[r];a&&s.push(...a.render(n))}return s}return super.render(n)}updateDisplay(){let n=this.isPartial?s=>b.bg("toolPendingBg",s):this.result?.isError?s=>b.bg("toolErrorBg",s):s=>b.bg("toolSuccessBg",s),i=!1;if(this.hideComponent=!1,this.hasRendererDefinition()){let s=this.getRenderShell()==="self"?this.selfRenderContainer:this.contentBox;s instanceof ht&&s.setBgFn(n),s.clear();let r=this.getCallRenderer();if(!r)s.addChild(this.createCallFallback()),i=!0;else try{let o=r(this.args,b,this.getRenderContext(this.callRendererComponent));this.callRendererComponent=o,s.addChild(o),i=!0}catch{this.callRendererComponent=void 0,s.addChild(this.createCallFallback()),i=!0}if(this.result){let o=this.getResultRenderer();if(o)try{let a=o({content:this.result.content,details:this.result.details},{expanded:this.expanded,isPartial:this.isPartial},b,this.getRenderContext(this.resultRendererComponent));this.resultRendererComponent=a,s.addChild(a),i=!0}catch{this.resultRendererComponent=void 0;let a=this.createResultFallback();a&&(s.addChild(a),i=!0)}else{let a=this.createResultFallback();a&&(s.addChild(a),i=!0)}}}else this.contentText.setCustomBgFn(n),this.contentText.setText(this.formatToolExecution()),i=!0;for(let s of this.imageComponents)this.removeChild(s);this.imageComponents=[];for(let s of this.imageSpacers)this.removeChild(s);if(this.imageSpacers=[],this.result){let s=this.result.content.filter(o=>o.type==="image"),r=ct();for(let o=0;o<s.length;o++){let a=s[o];if(r.images&&this.showImages&&a.data&&a.mimeType){let c=this.convertedImages.get(o),l=c?.data??a.data,u=c?.mimeType??a.mimeType;if(r.images==="kitty"&&u!=="image/png")continue;let d=new L(1);this.addChild(d),this.imageSpacers.push(d);let p=new fr(l,u,{fallbackColor:m=>b.fg("toolOutput",m)},{maxWidthCells:this.imageWidthCells});this.imageComponents.push(p),this.addChild(p)}}}this.hasRendererDefinition()&&!i&&this.imageComponents.length===0&&(this.hideComponent=!0)}getTextOutput(){return Wn(this.result,this.showImages)}formatToolExecution(){let n=b.fg("toolTitle",b.bold(this.toolName)),i=JSON.stringify(this.args,null,2);i&&(n+=`
|
|
324
324
|
|
|
@@ -332,7 +332,7 @@ ${o}
|
|
|
332
332
|
${a}`,()=>`${n}
|
|
333
333
|
${s}
|
|
334
334
|
|
|
335
|
-
${a}`,this.getStartupExpansionState(),1,0),this.headerContainer.addChild(new L(1)),this.headerContainer.addChild(this.builtInHeader),this.headerContainer.addChild(new L(1))}else this.builtInHeader=new E("",0,0),this.headerContainer.addChild(this.builtInHeader);this.ui.requestRender(),await this.rebindCurrentSession(),this.renderInitialMessages(),vk(()=>{this.ui.invalidate(),this.updateEditorBorderColor(),this.ui.requestRender()}),this.footerDataProvider.onBranchChange(()=>{this.ui.requestRender()}),await this.updateAvailableProviderCount()}updateTerminalTitle(){let e=Ve.basename(this.sessionManager.getCwd()),n=this.sessionManager.getSessionName();n?this.ui.terminal.setTitle(`${Ig} - ${n} - ${e}`):this.ui.terminal.setTitle(`${Ig} - ${e}`)}async run(){await this.init(),
|
|
335
|
+
${a}`,this.getStartupExpansionState(),1,0),this.headerContainer.addChild(new L(1)),this.headerContainer.addChild(this.builtInHeader),this.headerContainer.addChild(new L(1))}else this.builtInHeader=new E("",0,0),this.headerContainer.addChild(this.builtInHeader);this.ui.requestRender(),await this.rebindCurrentSession(),this.renderInitialMessages(),vk(()=>{this.ui.invalidate(),this.updateEditorBorderColor(),this.ui.requestRender()}),this.footerDataProvider.onBranchChange(()=>{this.ui.requestRender()}),await this.updateAvailableProviderCount()}updateTerminalTitle(){let e=Ve.basename(this.sessionManager.getCwd()),n=this.sessionManager.getSessionName();n?this.ui.terminal.setTitle(`${Ig} - ${n} - ${e}`):this.ui.terminal.setTitle(`${Ig} - ${e}`)}async run(){await this.init(),DM(this.version).then(a=>{a&&this.showNewVersionNotification(a)}),this.checkForPackageUpdates().then(a=>{a.length>0&&this.showPackageUpdateNotification(a)}),this.checkTmuxKeyboardSetup().then(a=>{a&&this.showWarning(a)});let{migratedProviders:e,modelFallbackMessage:n,initialMessage:i,initialImages:s,initialMessages:r}=this.options;e&&e.length>0&&this.showWarning(`Migrated credentials to auth.json: ${e.join(", ")}`);let o=this.session.modelRegistry.getError();if(o&&this.showError(`models.json error: ${o}`),n&&this.showWarning(n),this.maybeWarnAboutAnthropicSubscriptionAuth(),i)try{await this.session.prompt(i,{images:s})}catch(a){let c=a instanceof Error?a.message:"Unknown error occurred";this.showError(c)}if(r)for(let a of r)try{await this.session.prompt(a)}catch(c){let l=c instanceof Error?c.message:"Unknown error occurred";this.showError(l)}for(;;){let a=await this.getUserInput();try{await this.session.prompt(a)}catch(c){let l=c instanceof Error?c.message:"Unknown error occurred";this.showError(l)}}}async checkForPackageUpdates(){if(process.env.PI_OFFLINE)return[];try{return(await new Gi({cwd:this.sessionManager.getCwd(),agentDir:Pe(),settingsManager:this.settingsManager}).checkForAvailableUpdates()).map(i=>i.displayName)}catch{return[]}}async checkTmuxKeyboardSetup(){if(!process.env.TMUX)return;let e=s=>new Promise(r=>{let o=Rb("tmux",["show","-gv",s],{stdio:["ignore","pipe","ignore"]}),a="",c=setTimeout(()=>{o.kill(),r(void 0)},2e3);o.stdout?.on("data",l=>{a+=l.toString()}),o.on("error",()=>{clearTimeout(c),r(void 0)}),o.on("close",l=>{clearTimeout(c),r(l===0?a.trim():void 0)})}),[n,i]=await Promise.all([e("extended-keys"),e("extended-keys-format")]);if(n!==void 0){if(n!=="on"&&n!=="always")return"tmux extended-keys is off. Modified Enter keys may not work. Add `set -g extended-keys on` to ~/.tmux.conf and restart tmux.";if(i==="xterm")return"tmux extended-keys-format is xterm. Pi works best with csi-u. Add `set -g extended-keys-format csi-u` to ~/.tmux.conf and restart tmux."}}getChangelogForDisplay(){if(this.session.state.messages.length>0)return;let e=this.settingsManager.getLastChangelogVersion(),n=md(),i=pb(n);if(!e){this.settingsManager.setLastChangelogVersion(Ai),this.reportInstallTelemetry(Ai);return}let s=RM(i,e);if(s.length>0)return this.settingsManager.setLastChangelogVersion(Ai),this.reportInstallTelemetry(Ai),s.map(r=>db(r.content,r)).join(`
|
|
336
336
|
|
|
337
337
|
`)}reportInstallTelemetry(e){process.env.PI_OFFLINE||eb(this.settingsManager)&&fetch(`https://pi.dev/api/report-install?version=${encodeURIComponent(e)}`,{headers:{"User-Agent":rm(e)},signal:AbortSignal.timeout(5e3)}).then(()=>{}).catch(()=>{})}getMarkdownThemeWithSettings(){return{...Mt(),codeBlockIndent:this.settingsManager.getCodeBlockIndent()}}formatDisplayPath(e){let n=pc.homedir(),i=e;return i.startsWith(n)&&(i=`~${i.slice(n.length)}`),i}formatExtensionDisplayPath(e){let n=this.formatDisplayPath(e);return n=n.replace(/\/index\.ts$/,"").replace(/\/index\.js$/,""),n}formatContextPath(e){let n=Ve.resolve(this.sessionManager.getCwd()),i=Ve.isAbsolute(e)?Ve.resolve(e):Ve.resolve(n,e),s=ld(i,n);return s!==void 0?s:this.formatDisplayPath(i)}getStartupExpansionState(){return this.options.verbose||this.toolOutputExpanded}getShortPath(e,n){let i=n?.baseDir;if(i&&this.isPackageSource(n)){let a=Ve.relative(Ve.resolve(i),Ve.resolve(e));if(a&&a!=="."&&!a.startsWith("..")&&!a.startsWith(`..${Ve.sep}`)&&!Ve.isAbsolute(a))return a.replace(/\\/g,"/")}let s=n?.source??"",r=e.match(/node_modules\/(@?[^/]+(?:\/[^/]+)?)\/(.*)/);if(r&&s.startsWith("npm:"))return r[2];let o=e.match(/git\/[^/]+\/[^/]+\/(.*)/);return o&&s.startsWith("git:")?o[1]:this.formatDisplayPath(e)}getCompactPathLabel(e,n){let i=this.getShortPath(e,n),r=i.replace(/\\/g,"/").split("/").filter(o=>o.length>0&&o!=="~");return r.length>0?r[r.length-1]:i}getCompactPackageSourceLabel(e){let n=e?.source??"";if(n.startsWith("npm:"))return n.slice(4)||n;let i=Ul(n);return i&&i.path||n}getCompactExtensionLabel(e,n){if(!this.isPackageSource(n))return this.getCompactPathLabel(e,n);let i=this.getCompactPackageSourceLabel(n);if(!i)return this.getCompactPathLabel(e,n);let s=this.getShortPath(e,n).replace(/\\/g,"/"),r=s.startsWith("extensions/")?s.slice(11):s,o=Ve.posix.parse(r);return o.name==="index"?!o.dir||o.dir==="."?i:`${i}:${o.dir}`:`${i}:${r}`}getCompactDisplayPathSegments(e){return this.formatDisplayPath(e).replace(/\\/g,"/").split("/").filter(n=>n.length>0&&n!=="~")}getCompactNonPackageExtensionLabel(e,n,i){let s=i[n]?.segments;if(!s||s.length===0)return this.getCompactPathLabel(e);for(let r=1;r<=s.length;r+=1){let o=s.slice(-r).join("/");if(i.every((c,l)=>l===n?!0:c.segments.slice(-r).join("/")!==o))return o}return s.join("/")}getCompactExtensionLabels(e){let n=e.map(i=>{let s=this.getCompactDisplayPathSegments(i.path),r=s[s.length-1];return s.length>1&&(r==="index.ts"||r==="index.js")&&s.pop(),{path:i.path,sourceInfo:i.sourceInfo,segments:s}}).filter(i=>!this.isPackageSource(i.sourceInfo));return e.map(i=>{if(this.isPackageSource(i.sourceInfo))return this.getCompactExtensionLabel(i.path,i.sourceInfo);let s=n.findIndex(r=>r.path===i.path);return s===-1?this.getCompactPathLabel(i.path,i.sourceInfo):this.getCompactNonPackageExtensionLabel(i.path,s,n)})}getDisplaySourceInfo(e){let n=e?.source??"local",i=e?.scope??"project";return n==="local"?i==="user"?{label:"user",color:"muted"}:i==="project"?{label:"project",color:"muted"}:i==="temporary"?{label:"path",scopeLabel:"temp",color:"muted"}:{label:"path",color:"muted"}:n==="cli"?{label:"path",scopeLabel:i==="temporary"?"temp":void 0,color:"muted"}:{label:n,scopeLabel:i==="user"?"user":i==="project"?"project":i==="temporary"?"temp":void 0,color:"accent"}}getScopeGroup(e){let n=e?.source??"local",i=e?.scope??"project";return n==="cli"||i==="temporary"?"path":i==="user"?"user":i==="project"?"project":"path"}isPackageSource(e){let n=e?.source??"";return n.startsWith("npm:")||n.startsWith("git:")}buildScopeGroups(e){let n={user:{scope:"user",paths:[],packages:new Map},project:{scope:"project",paths:[],packages:new Map},path:{scope:"path",paths:[],packages:new Map}};for(let i of e){let s=this.getScopeGroup(i.sourceInfo),r=n[s],o=i.sourceInfo?.source??"local";if(this.isPackageSource(i.sourceInfo)){let a=r.packages.get(o)??[];a.push(i),r.packages.set(o,a)}else r.paths.push(i)}return[n.project,n.user,n.path].filter(i=>i.paths.length>0||i.packages.size>0)}formatScopeGroups(e,n){let i=[];for(let s of e){i.push(` ${b.fg("accent",s.scope)}`);let r=[...s.paths].sort((a,c)=>a.path.localeCompare(c.path));for(let a of r)i.push(b.fg("dim",` ${n.formatPath(a)}`));let o=Array.from(s.packages.entries()).sort(([a],[c])=>a.localeCompare(c));for(let[a,c]of o){i.push(` ${b.fg("mdLink",a)}`);let l=[...c].sort((u,d)=>u.path.localeCompare(d.path));for(let u of l)i.push(b.fg("dim",` ${n.formatPackagePath(u,a)}`))}}return i.join(`
|
|
338
338
|
`)}findSourceInfoForPath(e,n){let i=n.get(e);if(i)return i;let s=e;for(;s.includes("/");){s=s.substring(0,s.lastIndexOf("/"));let r=n.get(s);if(r)return r}}formatPathWithSource(e,n){if(n){let i=this.getShortPath(e,n),{label:s,scopeLabel:r}=this.getDisplaySourceInfo(n);return`${r?`${s} (${r})`:s} ${i}`}return this.formatDisplayPath(e)}formatDiagnostics(e,n){let i=[],s=new Map,r=[];for(let o of e)if(o.type==="collision"&&o.collision){let a=s.get(o.collision.name)??[];a.push(o),s.set(o.collision.name,a)}else r.push(o);for(let[o,a]of s){let c=a[0]?.collision;if(c){i.push(b.fg("warning",` "${o}" collision:`)),i.push(b.fg("dim",` ${b.fg("success","\u2713")} ${this.formatPathWithSource(c.winnerPath,this.findSourceInfoForPath(c.winnerPath,n))}`));for(let l of a)l.collision&&i.push(b.fg("dim",` ${b.fg("warning","\u2717")} ${this.formatPathWithSource(l.collision.loserPath,this.findSourceInfoForPath(l.collision.loserPath,n))} (skipped)`))}}for(let o of r)if(o.path){let a=this.formatPathWithSource(o.path,this.findSourceInfoForPath(o.path,n));i.push(b.fg(o.type==="error"?"error":"warning",` ${a}`)),i.push(b.fg(o.type==="error"?"error":"warning",` ${o.message}`))}else i.push(b.fg(o.type==="error"?"error":"warning",` ${o.message}`));return i.join(`
|
|
@@ -346,7 +346,7 @@ ${w}`,0,0)),this.chatContainer.addChild(new L(1))}let v=l.diagnostics;if(v.lengt
|
|
|
346
346
|
${w}`,0,0)),this.chatContainer.addChild(new L(1))}}}async bindCurrentSessionExtensions(){let e=this.createExtensionUIContext();await this.session.bindExtensions({uiContext:e,mode:"tui",abortHandler:()=>{this.restoreQueuedMessagesToEditor({abort:!0})},commandContextActions:{waitForIdle:()=>this.session.agent.waitForIdle(),newSession:async i=>{this.loadingAnimation&&(this.loadingAnimation.stop(),this.loadingAnimation=void 0),this.statusContainer.clear();try{let s=await this.runtimeHost.newSession(i);return s.cancelled||(this.renderCurrentSessionState(),this.ui.requestRender()),s}catch(s){return this.handleFatalRuntimeError("Failed to create session",s)}},fork:async(i,s)=>{try{let r=await this.runtimeHost.fork(i,s);return r.cancelled||(this.renderCurrentSessionState(),this.editor.setText(r.selectedText??""),this.showStatus("Forked to new session")),{cancelled:r.cancelled}}catch(r){return this.handleFatalRuntimeError("Failed to fork session",r)}},navigateTree:async(i,s)=>{let r=await this.session.navigateTree(i,{summarize:s?.summarize,customInstructions:s?.customInstructions,replaceInstructions:s?.replaceInstructions,label:s?.label});return r.cancelled?{cancelled:!0}:(this.chatContainer.clear(),this.renderInitialMessages(),r.editorText&&!this.editor.getText().trim()&&this.editor.setText(r.editorText),this.showStatus("Navigated to selected point"),this.flushCompactionQueue({willRetry:!1}),{cancelled:!1})},switchSession:async(i,s)=>this.handleResumeSession(i,s),reload:async()=>{await this.handleReloadCommand()}},shutdownHandler:()=>{this.shutdownRequested=!0,this.session.isStreaming||this.shutdown()},onError:i=>{this.showExtensionError(i.extensionPath,i.error,i.stack)}}),np(this.session.resourceLoader.getThemes().themes),this.setupAutocompleteProvider();let n=this.session.extensionRunner;this.setupExtensionShortcuts(n),this.showLoadedResources({force:!1,showDiagnosticsWhenQuiet:!0}),this.showStartupNoticesIfNeeded()}applyRuntimeSettings(){Nl(this.settingsManager.getHttpIdleTimeoutMs()),this.footer.setSession(this.session),this.footer.setAutoCompactEnabled(this.session.autoCompactionEnabled),this.footerDataProvider.setCwd(this.sessionManager.getCwd()),this.hideThinkingBlock=this.settingsManager.getHideThinkingBlock(),this.ui.setShowHardwareCursor(this.settingsManager.getShowHardwareCursor()),this.ui.setClearOnShrink(this.settingsManager.getClearOnShrink());let e=this.settingsManager.getEditorPaddingX(),n=this.settingsManager.getAutocompleteMaxVisible();this.defaultEditor.setPaddingX(e),this.defaultEditor.setAutocompleteMaxVisible(n),this.editor!==this.defaultEditor&&(this.editor.setPaddingX?.(e),this.editor.setAutocompleteMaxVisible?.(n))}async rebindCurrentSession(){this.unsubscribe?.(),this.unsubscribe=void 0,this.applyRuntimeSettings(),await this.bindCurrentSessionExtensions(),this.subscribeToAgent(),await this.updateAvailableProviderCount(),this.updateEditorBorderColor(),this.updateTerminalTitle()}async handleFatalRuntimeError(e,n){let i=n instanceof Error?n.message:String(n);this.showError(`${e}: ${i}`),ka(),this.stop(),process.exit(1)}renderCurrentSessionState(){this.chatContainer.clear(),this.pendingMessagesContainer.clear(),this.compactionQueuedMessages=[],this.streamingComponent=void 0,this.streamingMessage=void 0,this.pendingTools.clear(),this.renderInitialMessages()}getRegisteredToolDefinition(e){return this.session.getToolDefinition(e)}setupExtensionShortcuts(e){let n=e.getShortcuts(this.keybindings.getEffectiveConfig());if(n.size===0)return;let i=()=>({ui:this.createExtensionUIContext(),mode:"tui",hasUI:!0,cwd:this.sessionManager.getCwd(),sessionManager:this.sessionManager,modelRegistry:this.session.modelRegistry,model:this.session.model,isIdle:()=>!this.session.isStreaming,isProjectTrusted:()=>this.settingsManager.isProjectTrusted(),signal:this.session.agent.signal,abort:()=>{this.restoreQueuedMessagesToEditor({abort:!0})},hasPendingMessages:()=>this.session.pendingMessageCount>0,shutdown:()=>{this.shutdownRequested=!0},getContextUsage:()=>this.session.getContextUsage(),compact:s=>{(async()=>{try{let r=await this.session.compact(s?.customInstructions);s?.onComplete?.(r)}catch(r){let o=r instanceof Error?r:new Error(String(r));s?.onError?.(o)}})()},getSystemPrompt:()=>this.session.systemPrompt});this.defaultEditor.onExtensionShortcut=s=>{for(let[r,o]of n)if(Ae(s,r))return Promise.resolve(o.handler(i())).catch(a=>{this.showError(`Shortcut handler error: ${a instanceof Error?a.message:String(a)}`)}),!0;return!1}}setExtensionStatus(e,n){this.footerDataProvider.setExtensionStatus(e,n),this.ui.requestRender()}getWorkingLoaderMessage(){return this.workingMessage??this.defaultWorkingMessage}createWorkingLoader(){return new Qt(this.ui,e=>b.fg("accent",e),e=>b.fg("muted",e),this.getWorkingLoaderMessage(),this.workingIndicatorOptions)}stopWorkingLoader(){this.loadingAnimation&&(this.loadingAnimation.stop(),this.loadingAnimation=void 0),this.statusContainer.clear()}setWorkingVisible(e){if(this.workingVisible=e,!e){this.stopWorkingLoader(),this.ui.requestRender();return}this.session.isStreaming&&!this.loadingAnimation&&(this.statusContainer.clear(),this.loadingAnimation=this.createWorkingLoader(),this.statusContainer.addChild(this.loadingAnimation)),this.ui.requestRender()}setWorkingIndicator(e){this.workingIndicatorOptions=e,this.loadingAnimation?.setIndicator(e),this.ui.requestRender()}setHiddenThinkingLabel(e){this.hiddenThinkingLabel=e??this.defaultHiddenThinkingLabel;for(let n of this.chatContainer.children)n instanceof Hi&&n.setHiddenThinkingLabel(this.hiddenThinkingLabel);this.streamingComponent&&this.streamingComponent.setHiddenThinkingLabel(this.hiddenThinkingLabel),this.ui.requestRender()}setExtensionWidget(e,n,i){let s=i?.placement??"aboveEditor",r=c=>{let l=c.get(e);l?.dispose&&l.dispose(),c.delete(e)};if(r(this.extensionWidgetsAbove),r(this.extensionWidgetsBelow),n===void 0){this.renderWidgets();return}let o;if(Array.isArray(n)){let c=new H;for(let l of n.slice(0,t.MAX_WIDGET_LINES))c.addChild(new E(l,1,0));n.length>t.MAX_WIDGET_LINES&&c.addChild(new E(b.fg("muted","... (widget truncated)"),1,0)),o=c}else o=n(this.ui,b);(s==="belowEditor"?this.extensionWidgetsBelow:this.extensionWidgetsAbove).set(e,o),this.renderWidgets()}clearExtensionWidgets(){for(let e of this.extensionWidgetsAbove.values())e.dispose?.();for(let e of this.extensionWidgetsBelow.values())e.dispose?.();this.extensionWidgetsAbove.clear(),this.extensionWidgetsBelow.clear(),this.renderWidgets()}resetExtensionUI(){this.extensionSelector&&this.hideExtensionSelector(),this.extensionInput&&this.hideExtensionInput(),this.extensionEditor&&this.hideExtensionEditor(),this.ui.hideOverlay(),this.clearExtensionTerminalInputListeners(),this.setExtensionFooter(void 0),this.setExtensionHeader(void 0),this.clearExtensionWidgets(),this.footerDataProvider.clearExtensionStatuses(),this.footer.invalidate(),this.autocompleteProviderWrappers=[],this.setCustomEditorComponent(void 0),this.setupAutocompleteProvider(),this.defaultEditor.onExtensionShortcut=void 0,this.updateTerminalTitle(),this.workingMessage=void 0,this.workingVisible=!0,this.setWorkingIndicator(),this.loadingAnimation&&this.loadingAnimation.setMessage(`${this.defaultWorkingMessage} (${ke("app.interrupt")} to interrupt)`),this.setHiddenThinkingLabel()}static{this.MAX_WIDGET_LINES=10}renderWidgets(){!this.widgetContainerAbove||!this.widgetContainerBelow||(this.renderWidgetContainer(this.widgetContainerAbove,this.extensionWidgetsAbove,!0,!0),this.renderWidgetContainer(this.widgetContainerBelow,this.extensionWidgetsBelow,!1,!1),this.ui.requestRender())}renderWidgetContainer(e,n,i,s){if(e.clear(),n.size===0){i&&e.addChild(new L(1));return}s&&e.addChild(new L(1));for(let r of n.values())e.addChild(r)}setExtensionFooter(e){this.customFooter?.dispose&&this.customFooter.dispose(),this.customFooter?this.ui.removeChild(this.customFooter):this.ui.removeChild(this.footer),e?(this.customFooter=e(this.ui,b,this.footerDataProvider),this.ui.addChild(this.customFooter)):(this.customFooter=void 0,this.ui.addChild(this.footer)),this.ui.requestRender()}setExtensionHeader(e){if(!this.builtInHeader)return;this.customHeader?.dispose&&this.customHeader.dispose();let n=this.customHeader||this.builtInHeader,i=this.headerContainer.children.indexOf(n);e?(this.customHeader=e(this.ui,b),Yl(this.customHeader)&&this.customHeader.setExpanded(this.toolOutputExpanded),i!==-1?this.headerContainer.children[i]=this.customHeader:this.headerContainer.children.unshift(this.customHeader)):(this.customHeader=void 0,Yl(this.builtInHeader)&&this.builtInHeader.setExpanded(this.toolOutputExpanded),i!==-1&&(this.headerContainer.children[i]=this.builtInHeader)),this.ui.requestRender()}addExtensionTerminalInputListener(e){let n=this.ui.addInputListener(e);return this.extensionTerminalInputUnsubscribers.add(n),()=>{n(),this.extensionTerminalInputUnsubscribers.delete(n)}}clearExtensionTerminalInputListeners(){for(let e of this.extensionTerminalInputUnsubscribers)e();this.extensionTerminalInputUnsubscribers.clear()}createProjectTrustContext(e){let n=this.createExtensionUIContext();return{cwd:e,mode:"tui",hasUI:!0,ui:{select:n.select,confirm:n.confirm,input:n.input,notify:n.notify}}}createExtensionUIContext(){return{select:(e,n,i)=>this.showExtensionSelector(e,n,i),confirm:(e,n,i)=>this.showExtensionConfirm(e,n,i),input:(e,n,i)=>this.showExtensionInput(e,n,i),notify:(e,n)=>this.showExtensionNotify(e,n),onTerminalInput:e=>this.addExtensionTerminalInputListener(e),setStatus:(e,n)=>this.setExtensionStatus(e,n),setWorkingMessage:e=>{this.workingMessage=e,this.loadingAnimation&&this.loadingAnimation.setMessage(e??this.defaultWorkingMessage)},setWorkingVisible:e=>this.setWorkingVisible(e),setWorkingIndicator:e=>this.setWorkingIndicator(e),setHiddenThinkingLabel:e=>this.setHiddenThinkingLabel(e),setWidget:(e,n,i)=>this.setExtensionWidget(e,n,i),setFooter:e=>this.setExtensionFooter(e),setHeader:e=>this.setExtensionHeader(e),setTitle:e=>this.ui.terminal.setTitle(e),custom:(e,n)=>this.showExtensionCustom(e,n),pasteToEditor:e=>this.editor.handleInput(`\x1B[200~${e}\x1B[201~`),setEditorText:e=>this.editor.setText(e),getEditorText:()=>this.editor.getExpandedText?.()??this.editor.getText(),editor:(e,n)=>this.showExtensionEditor(e,n),addAutocompleteProvider:e=>{this.autocompleteProviderWrappers.push(e),this.setupAutocompleteProvider()},setEditorComponent:e=>this.setCustomEditorComponent(e),getEditorComponent:()=>this.editorComponentFactory,get theme(){return b},getAllThemes:()=>Of(),getTheme:e=>Wf(e),setTheme:e=>{if(e instanceof wa)return xk(e),this.ui.requestRender(),{success:!0};let n=wr(e,!0);return n.success&&(this.settingsManager.getTheme()!==e&&this.settingsManager.setTheme(e),this.ui.requestRender()),n},getToolsExpanded:()=>this.toolOutputExpanded,setToolsExpanded:e=>this.setToolsExpanded(e)}}showExtensionSelector(e,n,i){return new Promise(s=>{if(i?.signal?.aborted){s(void 0);return}let r=()=>{this.hideExtensionSelector(),s(void 0)};i?.signal?.addEventListener("abort",r,{once:!0}),this.extensionSelector=new Ki(e,n,o=>{i?.signal?.removeEventListener("abort",r),this.hideExtensionSelector(),s(o)},()=>{i?.signal?.removeEventListener("abort",r),this.hideExtensionSelector(),s(void 0)},{tui:this.ui,timeout:i?.timeout,onToggleToolsExpanded:()=>this.toggleToolOutputExpansion()}),this.editorContainer.clear(),this.editorContainer.addChild(this.extensionSelector),this.ui.setFocus(this.extensionSelector),this.ui.requestRender()})}hideExtensionSelector(){this.extensionSelector?.dispose(),this.editorContainer.clear(),this.editorContainer.addChild(this.editor),this.extensionSelector=void 0,this.ui.setFocus(this.editor),this.ui.requestRender()}async showExtensionConfirm(e,n,i){return await this.showExtensionSelector(`${e}
|
|
347
347
|
${n}`,["Yes","No"],i)==="Yes"}async promptForMissingSessionCwd(e){return await this.showExtensionConfirm("Session cwd not found",tb(e.issue))?e.issue.fallbackCwd:void 0}showExtensionInput(e,n,i){return new Promise(s=>{if(i?.signal?.aborted){s(void 0);return}let r=()=>{this.hideExtensionInput(),s(void 0)};i?.signal?.addEventListener("abort",r,{once:!0}),this.extensionInput=new Lr(e,n,o=>{i?.signal?.removeEventListener("abort",r),this.hideExtensionInput(),s(o)},()=>{i?.signal?.removeEventListener("abort",r),this.hideExtensionInput(),s(void 0)},{tui:this.ui,timeout:i?.timeout}),this.editorContainer.clear(),this.editorContainer.addChild(this.extensionInput),this.ui.setFocus(this.extensionInput),this.ui.requestRender()})}hideExtensionInput(){this.extensionInput?.dispose(),this.editorContainer.clear(),this.editorContainer.addChild(this.editor),this.extensionInput=void 0,this.ui.setFocus(this.editor),this.ui.requestRender()}showExtensionEditor(e,n){return new Promise(i=>{this.extensionEditor=new ic(this.ui,this.keybindings,e,n,s=>{this.hideExtensionEditor(),i(s)},()=>{this.hideExtensionEditor(),i(void 0)}),this.editorContainer.clear(),this.editorContainer.addChild(this.extensionEditor),this.ui.setFocus(this.extensionEditor),this.ui.requestRender()})}hideExtensionEditor(){this.editorContainer.clear(),this.editorContainer.addChild(this.editor),this.extensionEditor=void 0,this.ui.setFocus(this.editor),this.ui.requestRender()}setCustomEditorComponent(e){this.editorComponentFactory=e;let n=this.editor.getText();if(this.editorContainer.clear(),e){let i=e(this.ui,wl(),this.keybindings);i.onSubmit=this.defaultEditor.onSubmit,i.onChange=this.defaultEditor.onChange,i.setText(n),i.borderColor!==void 0&&(i.borderColor=this.defaultEditor.borderColor),i.setPaddingX!==void 0&&i.setPaddingX(this.defaultEditor.getPaddingX()),i.setAutocompleteProvider&&this.autocompleteProvider&&i.setAutocompleteProvider(this.autocompleteProvider);let s=i;if("actionHandlers"in s&&s.actionHandlers instanceof Map){s.onEscape||(s.onEscape=()=>this.defaultEditor.onEscape?.()),s.onCtrlD||(s.onCtrlD=()=>this.defaultEditor.onCtrlD?.()),s.onPasteImage||(s.onPasteImage=()=>this.defaultEditor.onPasteImage?.()),s.onExtensionShortcut||(s.onExtensionShortcut=r=>this.defaultEditor.onExtensionShortcut?.(r));for(let[r,o]of this.defaultEditor.actionHandlers)s.actionHandlers.set(r,o)}this.editor=i}else this.defaultEditor.setText(n),this.editor=this.defaultEditor;this.editorContainer.addChild(this.editor),this.ui.setFocus(this.editor),this.ui.requestRender()}showExtensionNotify(e,n){n==="error"?this.showError(e):n==="warning"?this.showWarning(e):this.showStatus(e)}async showExtensionCustom(e,n){let i=this.editor.getText(),s=n?.overlay??!1,r=()=>{this.editorContainer.clear(),this.editorContainer.addChild(this.editor),this.editor.setText(i),this.ui.setFocus(this.editor),this.ui.requestRender()};return new Promise((o,a)=>{let c,l=!1,u=d=>{if(!l){l=!0,s?this.ui.hideOverlay():r(),o(d);try{c?.dispose?.()}catch{}}};Promise.resolve(e(this.ui,b,this.keybindings,u)).then(d=>{if(!l)if(c=d,s){let p=()=>{if(n?.overlayOptions)return typeof n.overlayOptions=="function"?n.overlayOptions():n.overlayOptions;let g=c.width;return g?{width:g}:void 0},m=this.ui.showOverlay(c,p());n?.onHandle?.(m)}else this.editorContainer.clear(),this.editorContainer.addChild(c),this.ui.setFocus(c),this.ui.requestRender()}).catch(d=>{l||(s||r(),a(d))})})}showExtensionError(e,n,i){let s=`Extension "${e}" error: ${n}`,r=new E(b.fg("error",s),1,0);if(this.chatContainer.addChild(r),i){let o=i.split(`
|
|
348
348
|
`).slice(1).map(a=>b.fg("dim",` ${a.trim()}`)).join(`
|
|
349
|
-
`);o&&this.chatContainer.addChild(new E(o,1,0))}this.ui.requestRender()}setupKeyHandlers(){this.defaultEditor.onEscape=()=>{if(this.session.isStreaming)this.restoreQueuedMessagesToEditor({abort:!0});else if(this.session.isBashRunning)this.session.abortBash();else if(this.isBashMode)this.editor.setText(""),this.isBashMode=!1,this.updateEditorBorderColor();else if(!this.editor.getText().trim()){let e=this.settingsManager.getDoubleEscapeAction();if(e!=="none"){let n=Date.now();n-this.lastEscapeTime<500?(e==="tree"?this.showTreeSelector():this.showUserMessageSelector(),this.lastEscapeTime=0):this.lastEscapeTime=n}}},this.defaultEditor.onAction("app.clear",()=>this.handleCtrlC()),this.defaultEditor.onCtrlD=()=>this.handleCtrlD(),this.defaultEditor.onAction("app.suspend",()=>this.handleCtrlZ()),this.defaultEditor.onAction("app.thinking.cycle",()=>this.cycleThinkingLevel()),this.defaultEditor.onAction("app.model.cycleForward",()=>this.cycleModel("forward")),this.defaultEditor.onAction("app.model.cycleBackward",()=>this.cycleModel("backward")),this.ui.onDebug=()=>this.handleDebugCommand(),this.defaultEditor.onAction("app.model.select",()=>this.showModelSelector()),this.defaultEditor.onAction("app.tools.expand",()=>this.toggleToolOutputExpansion()),this.defaultEditor.onAction("app.thinking.toggle",()=>this.toggleThinkingBlockVisibility()),this.defaultEditor.onAction("app.editor.external",()=>this.openExternalEditor()),this.defaultEditor.onAction("app.message.followUp",()=>this.handleFollowUp()),this.defaultEditor.onAction("app.message.dequeue",()=>this.handleDequeue()),this.defaultEditor.onAction("app.session.new",()=>this.handleClearCommand()),this.defaultEditor.onAction("app.session.tree",()=>this.showTreeSelector()),this.defaultEditor.onAction("app.session.fork",()=>this.showUserMessageSelector()),this.defaultEditor.onAction("app.session.resume",()=>this.showSessionSelector()),this.defaultEditor.onChange=e=>{let n=this.isBashMode;this.isBashMode=e.trimStart().startsWith("!"),n!==this.isBashMode&&this.updateEditorBorderColor()},this.defaultEditor.onPasteImage=()=>{this.handleClipboardImagePaste()}}async handleClipboardImagePaste(){try{let e=await O1();if(!e)return;let n=pc.tmpdir(),i=E1(e.mimeType)??"png",s=`pi-clipboard-${tR.randomUUID()}.${i}`,r=Ve.join(n,s);wn.writeFileSync(r,Buffer.from(e.bytes)),this.editor.insertTextAtCursor?.(r),this.ui.requestRender()}catch{}}setupEditorSubmitHandler(){this.defaultEditor.onSubmit=async e=>{if(e=e.trim(),!!e){if(e==="/settings"){this.showSettingsSelector(),this.editor.setText("");return}if(e==="/scoped-models"){this.editor.setText(""),await this.showModelsSelector();return}if(e==="/model"||e.startsWith("/model ")){let n=e.startsWith("/model ")?e.slice(7).trim():void 0;this.editor.setText(""),await this.handleModelCommand(n);return}if(e==="/export"||e.startsWith("/export ")){await this.handleExportCommand(e),this.editor.setText("");return}if(e==="/import"||e.startsWith("/import ")){await this.handleImportCommand(e),this.editor.setText("");return}if(e==="/share"){await this.handleShareCommand(),this.editor.setText("");return}if(e==="/copy"){await this.handleCopyCommand(),this.editor.setText("");return}if(e==="/name"||e.startsWith("/name ")){this.handleNameCommand(e),this.editor.setText("");return}if(e==="/session"){this.handleSessionCommand(),this.editor.setText("");return}if(e==="/changelog"){this.handleChangelogCommand(),this.editor.setText("");return}if(e==="/hotkeys"){this.handleHotkeysCommand(),this.editor.setText("");return}if(e==="/fork"){this.showUserMessageSelector(),this.editor.setText("");return}if(e==="/clone"){this.editor.setText(""),await this.handleCloneCommand();return}if(e==="/tree"){this.showTreeSelector(),this.editor.setText("");return}if(e==="/trust"){this.showTrustSelector(),this.editor.setText("");return}if(e==="/login"){this.showOAuthSelector("login"),this.editor.setText("");return}if(e==="/logout"){this.showOAuthSelector("logout"),this.editor.setText("");return}if(e==="/new"){this.editor.setText(""),await this.handleClearCommand();return}if(e==="/compact"||e.startsWith("/compact ")){let n=e.startsWith("/compact ")?e.slice(9).trim():void 0;this.editor.setText(""),await this.handleCompactCommand(n);return}if(e==="/reload"){this.editor.setText(""),await this.handleReloadCommand();return}if(e==="/debug"){this.handleDebugCommand(),this.editor.setText("");return}if(e==="/arminsayshi"){this.handleArminSaysHi(),this.editor.setText("");return}if(e==="/dementedelves"){this.handleDementedDelves(),this.editor.setText("");return}if(e==="/resume"){this.showSessionSelector(),this.editor.setText("");return}if(e==="/quit"){this.editor.setText(""),await this.shutdown();return}if(e.startsWith("!")){let n=e.startsWith("!!"),i=n?e.slice(2).trim():e.slice(1).trim();if(i){if(this.session.isBashRunning){this.showWarning("A bash command is already running. Press Esc to cancel it first."),this.editor.setText(e);return}this.editor.addToHistory?.(e),await this.handleBashCommand(i,n),this.isBashMode=!1,this.updateEditorBorderColor();return}}if(this.session.isCompacting){this.isExtensionCommand(e)?(this.editor.addToHistory?.(e),this.editor.setText(""),await this.session.prompt(e)):this.queueCompactionMessage(e,"steer");return}if(this.session.isStreaming){this.editor.addToHistory?.(e),this.editor.setText(""),await this.session.prompt(e,{streamingBehavior:"steer"}),this.updatePendingMessagesDisplay(),this.ui.requestRender();return}this.flushPendingBashComponents(),this.onInputCallback?this.onInputCallback(e):this.pendingUserInputs.push(e),this.editor.addToHistory?.(e)}}}subscribeToAgent(){this.unsubscribe=this.session.subscribe(async e=>{await this.handleEvent(e)})}async handleEvent(e){switch(this.isInitialized||await this.init(),this.footer.invalidate(),e.type){case"agent_start":this.pendingTools.clear(),this.settingsManager.getShowTerminalProgress()&&this.ui.terminal.setProgress(!0),this.retryEscapeHandler&&(this.defaultEditor.onEscape=this.retryEscapeHandler,this.retryEscapeHandler=void 0),this.retryCountdown&&(this.retryCountdown.dispose(),this.retryCountdown=void 0),this.retryLoader&&(this.retryLoader.stop(),this.retryLoader=void 0),this.stopWorkingLoader(),this.workingVisible&&(this.loadingAnimation=this.createWorkingLoader(),this.statusContainer.addChild(this.loadingAnimation)),this.ui.requestRender();break;case"queue_update":this.updatePendingMessagesDisplay(),this.ui.requestRender();break;case"session_info_changed":this.updateTerminalTitle(),this.footer.invalidate(),this.ui.requestRender();break;case"thinking_level_changed":this.footer.invalidate(),this.updateEditorBorderColor();break;case"message_start":e.message.role==="custom"?(this.addMessageToChat(e.message),this.ui.requestRender()):e.message.role==="user"?(this.addMessageToChat(e.message),this.updatePendingMessagesDisplay(),this.ui.requestRender()):e.message.role==="assistant"&&(this.streamingComponent=new Hi(void 0,this.hideThinkingBlock,this.getMarkdownThemeWithSettings(),this.hiddenThinkingLabel),this.streamingMessage=e.message,this.chatContainer.addChild(this.streamingComponent),this.streamingComponent.updateContent(this.streamingMessage),this.ui.requestRender());break;case"message_update":if(this.streamingComponent&&e.message.role==="assistant"){this.streamingMessage=e.message,this.streamingComponent.updateContent(this.streamingMessage);for(let n of this.streamingMessage.content)if(n.type==="toolCall")if(this.pendingTools.has(n.id)){let i=this.pendingTools.get(n.id);i&&i.updateArgs(n.arguments)}else{let i=new gi(n.name,n.id,n.arguments,{showImages:this.settingsManager.getShowImages(),imageWidthCells:this.settingsManager.getImageWidthCells()},this.getRegisteredToolDefinition(n.name),this.ui,this.sessionManager.getCwd());i.setExpanded(this.toolOutputExpanded),this.chatContainer.addChild(i),this.pendingTools.set(n.id,i)}this.ui.requestRender()}break;case"message_end":if(e.message.role==="user")break;if(this.streamingComponent&&e.message.role==="assistant"){this.streamingMessage=e.message;let n;if(this.streamingMessage.stopReason==="aborted"){let i=this.session.retryAttempt;n=i>0?`Aborted after ${i} retry attempt${i>1?"s":""}`:"Operation aborted",this.streamingMessage.errorMessage=n}if(this.streamingComponent.updateContent(this.streamingMessage),this.streamingMessage.stopReason==="aborted"||this.streamingMessage.stopReason==="error"){n||(n=this.streamingMessage.errorMessage||"Error");for(let[,i]of this.pendingTools.entries())i.updateResult({content:[{type:"text",text:n}],isError:!0});this.pendingTools.clear()}else for(let[,i]of this.pendingTools.entries())i.setArgsComplete();this.streamingComponent=void 0,this.streamingMessage=void 0,this.footer.invalidate()}this.ui.requestRender();break;case"tool_execution_start":{let n=this.pendingTools.get(e.toolCallId);n||(n=new gi(e.toolName,e.toolCallId,e.args,{showImages:this.settingsManager.getShowImages(),imageWidthCells:this.settingsManager.getImageWidthCells()},this.getRegisteredToolDefinition(e.toolName),this.ui,this.sessionManager.getCwd()),n.setExpanded(this.toolOutputExpanded),this.chatContainer.addChild(n),this.pendingTools.set(e.toolCallId,n)),n.markExecutionStarted(),this.ui.requestRender();break}case"tool_execution_update":{let n=this.pendingTools.get(e.toolCallId);n&&(n.updateResult({...e.partialResult,isError:!1},!0),this.ui.requestRender());break}case"tool_execution_end":{let n=this.pendingTools.get(e.toolCallId);n&&(n.updateResult({...e.result,isError:e.isError}),this.pendingTools.delete(e.toolCallId),this.ui.requestRender());break}case"agent_end":this.settingsManager.getShowTerminalProgress()&&this.ui.terminal.setProgress(!1),this.loadingAnimation&&(this.loadingAnimation.stop(),this.loadingAnimation=void 0,this.statusContainer.clear()),this.streamingComponent&&(this.chatContainer.removeChild(this.streamingComponent),this.streamingComponent=void 0,this.streamingMessage=void 0),this.pendingTools.clear(),await this.checkShutdownRequested(),this.ui.requestRender();break;case"compaction_start":{this.settingsManager.getShowTerminalProgress()&&this.ui.terminal.setProgress(!0),this.autoCompactionEscapeHandler=this.defaultEditor.onEscape,this.defaultEditor.onEscape=()=>{this.session.abortCompaction()},this.statusContainer.clear();let n=`(${ke("app.interrupt")} to cancel)`,i=e.reason==="manual"?`Compacting context... ${n}`:`${e.reason==="overflow"?"Context overflow detected, ":""}Auto-compacting... ${n}`;this.autoCompactionLoader=new Qt(this.ui,s=>b.fg("accent",s),s=>b.fg("muted",s),i),this.statusContainer.addChild(this.autoCompactionLoader),this.ui.requestRender();break}case"compaction_end":{this.settingsManager.getShowTerminalProgress()&&this.ui.terminal.setProgress(!1),this.autoCompactionEscapeHandler&&(this.defaultEditor.onEscape=this.autoCompactionEscapeHandler,this.autoCompactionEscapeHandler=void 0),this.autoCompactionLoader&&(this.autoCompactionLoader.stop(),this.autoCompactionLoader=void 0,this.statusContainer.clear()),e.aborted?e.reason==="manual"?this.showError("Compaction cancelled"):this.showStatus("Auto-compaction cancelled"):e.result?(this.chatContainer.clear(),this.rebuildChatFromMessages(),this.addMessageToChat(Ra(e.result.summary,e.result.tokensBefore,new Date().toISOString())),this.footer.invalidate()):e.errorMessage&&(e.reason==="manual"?this.showError(e.errorMessage):(this.chatContainer.addChild(new L(1)),this.chatContainer.addChild(new E(b.fg("error",e.errorMessage),1,0)))),this.flushCompactionQueue({willRetry:e.willRetry}),this.ui.requestRender();break}case"auto_retry_start":{this.retryEscapeHandler=this.defaultEditor.onEscape,this.defaultEditor.onEscape=()=>{this.session.abortRetry()},this.statusContainer.clear(),this.retryCountdown?.dispose();let n=i=>`Retrying (${e.attempt}/${e.maxAttempts}) in ${i}s... (${ke("app.interrupt")} to cancel)`;this.retryLoader=new Qt(this.ui,i=>b.fg("warning",i),i=>b.fg("muted",i),n(Math.ceil(e.delayMs/1e3))),this.retryCountdown=new Ls(e.delayMs,this.ui,i=>{this.retryLoader?.setMessage(n(i))},()=>{this.retryCountdown=void 0}),this.statusContainer.addChild(this.retryLoader),this.ui.requestRender();break}case"auto_retry_end":{this.retryEscapeHandler&&(this.defaultEditor.onEscape=this.retryEscapeHandler,this.retryEscapeHandler=void 0),this.retryCountdown&&(this.retryCountdown.dispose(),this.retryCountdown=void 0),this.retryLoader&&(this.retryLoader.stop(),this.retryLoader=void 0,this.statusContainer.clear()),e.success||this.showError(`Retry failed after ${e.attempt} attempts: ${e.finalError||"Unknown error"}`),this.ui.requestRender();break}}}getUserMessageText(e){return e.role!=="user"?"":(typeof e.content=="string"?[{type:"text",text:e.content}]:e.content.filter(i=>i.type==="text")).map(i=>i.text).join("")}showStatus(e){let n=this.chatContainer.children,i=n.length>0?n[n.length-1]:void 0,s=n.length>1?n[n.length-2]:void 0;if(i&&s&&i===this.lastStatusText&&s===this.lastStatusSpacer){this.lastStatusText.setText(b.fg("dim",e)),this.ui.requestRender();return}let r=new L(1),o=new E(b.fg("dim",e),1,0);this.chatContainer.addChild(r),this.chatContainer.addChild(o),this.lastStatusSpacer=r,this.lastStatusText=o,this.ui.requestRender()}addMessageToChat(e,n){switch(e.role){case"bashExecution":{let i=new Ws(e.command,this.ui,e.excludeFromContext);e.output&&i.appendOutput(e.output),i.setComplete(e.exitCode,e.cancelled,e.truncated?{truncated:!0}:void 0,e.fullOutputPath),this.chatContainer.addChild(i);break}case"custom":{if(e.display){let i=this.session.extensionRunner.getMessageRenderer(e.customType),s=new nc(e,i,this.getMarkdownThemeWithSettings());s.setExpanded(this.toolOutputExpanded),this.chatContainer.addChild(s)}break}case"compactionSummary":{this.chatContainer.addChild(new L(1));let i=new tc(e,this.getMarkdownThemeWithSettings());i.setExpanded(this.toolOutputExpanded),this.chatContainer.addChild(i);break}case"branchSummary":{this.chatContainer.addChild(new L(1));let i=new ec(e,this.getMarkdownThemeWithSettings());i.setExpanded(this.toolOutputExpanded),this.chatContainer.addChild(i);break}case"user":{let i=this.getUserMessageText(e);if(i){this.chatContainer.children.length>0&&this.chatContainer.addChild(new L(1));let s=U0(i);if(s){let r=new lc(s,this.getMarkdownThemeWithSettings());if(r.setExpanded(this.toolOutputExpanded),this.chatContainer.addChild(r),s.userMessage){this.chatContainer.addChild(new L(1));let o=new Dr(s.userMessage,this.getMarkdownThemeWithSettings());this.chatContainer.addChild(o)}}else{let r=new Dr(i,this.getMarkdownThemeWithSettings());this.chatContainer.addChild(r)}n?.populateHistory&&this.editor.addToHistory?.(i)}break}case"assistant":{let i=new Hi(e,this.hideThinkingBlock,this.getMarkdownThemeWithSettings(),this.hiddenThinkingLabel);this.chatContainer.addChild(i);break}case"toolResult":break;default:{let i=e}}}renderSessionContext(e,n={}){this.pendingTools.clear();let i=new Map;n.updateFooter&&(this.footer.invalidate(),this.updateEditorBorderColor());for(let s of e.messages)if(s.role==="assistant"){this.addMessageToChat(s);for(let r of s.content)if(r.type==="toolCall"){let o=new gi(r.name,r.id,r.arguments,{showImages:this.settingsManager.getShowImages(),imageWidthCells:this.settingsManager.getImageWidthCells()},this.getRegisteredToolDefinition(r.name),this.ui,this.sessionManager.getCwd());if(o.setExpanded(this.toolOutputExpanded),this.chatContainer.addChild(o),s.stopReason==="aborted"||s.stopReason==="error"){let a;if(s.stopReason==="aborted"){let c=this.session.retryAttempt;a=c>0?`Aborted after ${c} retry attempt${c>1?"s":""}`:"Operation aborted"}else a=s.errorMessage||"Error";o.updateResult({content:[{type:"text",text:a}],isError:!0})}else i.set(r.id,o)}}else if(s.role==="toolResult"){let r=i.get(s.toolCallId);r&&(r.updateResult(s),i.delete(s.toolCallId))}else this.addMessageToChat(s,n);for(let[s,r]of i)this.pendingTools.set(s,r);this.ui.requestRender()}renderInitialMessages(){let e=this.sessionManager.buildSessionContext();this.renderSessionContext(e,{updateFooter:!0,populateHistory:!0}),this.renderProjectTrustWarningIfNeeded();let i=this.sessionManager.getEntries().filter(s=>s.type==="compaction").length;if(i>0){let s=i===1?"1 time":`${i} times`;this.showStatus(`Session compacted ${s}`)}}renderProjectTrustWarningIfNeeded(){this.settingsManager.isProjectTrusted()||!Or(this.sessionManager.getCwd())||(this.chatContainer.children.length>0&&this.chatContainer.addChild(new L(1)),this.chatContainer.addChild(new E(b.fg("warning","This project is not trusted. Project .pi resources and packages are ignored. Use /trust to save a trust decision, then restart pi."),1,0)))}async getUserInput(){let e=this.pendingUserInputs.shift();return e!==void 0?e:new Promise(n=>{this.onInputCallback=i=>{this.onInputCallback=void 0,n(i)}})}rebuildChatFromMessages(){this.chatContainer.clear();let e=this.sessionManager.buildSessionContext();this.renderSessionContext(e)}handleCtrlC(){let e=Date.now();e-this.lastSigintTime<500?this.shutdown():(this.clearEditor(),this.lastSigintTime=e)}handleCtrlD(){this.shutdown()}async shutdown(e){if(this.isShuttingDown)return;this.isShuttingDown=!0,e?.fromSignal&&(await this.runtimeHost.dispose(),await this.ui.terminal.drainInput(1e3),this.stop(),process.exit(0)),await this.ui.terminal.drainInput(1e3),this.stop(),await this.runtimeHost.dispose();let n=l8(this.sessionManager);n&&process.stdout.write(`${n8.dim("To resume this session:")} ${n}
|
|
349
|
+
`);o&&this.chatContainer.addChild(new E(o,1,0))}this.ui.requestRender()}setupKeyHandlers(){this.defaultEditor.onEscape=()=>{if(this.session.isStreaming)this.restoreQueuedMessagesToEditor({abort:!0});else if(this.session.isBashRunning)this.session.abortBash();else if(this.isBashMode)this.editor.setText(""),this.isBashMode=!1,this.updateEditorBorderColor();else if(!this.editor.getText().trim()){let e=this.settingsManager.getDoubleEscapeAction();if(e!=="none"){let n=Date.now();n-this.lastEscapeTime<500?(e==="tree"?this.showTreeSelector():this.showUserMessageSelector(),this.lastEscapeTime=0):this.lastEscapeTime=n}}},this.defaultEditor.onAction("app.clear",()=>this.handleCtrlC()),this.defaultEditor.onCtrlD=()=>this.handleCtrlD(),this.defaultEditor.onAction("app.suspend",()=>this.handleCtrlZ()),this.defaultEditor.onAction("app.thinking.cycle",()=>this.cycleThinkingLevel()),this.defaultEditor.onAction("app.model.cycleForward",()=>this.cycleModel("forward")),this.defaultEditor.onAction("app.model.cycleBackward",()=>this.cycleModel("backward")),this.ui.onDebug=()=>this.handleDebugCommand(),this.defaultEditor.onAction("app.model.select",()=>this.showModelSelector()),this.defaultEditor.onAction("app.tools.expand",()=>this.toggleToolOutputExpansion()),this.defaultEditor.onAction("app.thinking.toggle",()=>this.toggleThinkingBlockVisibility()),this.defaultEditor.onAction("app.editor.external",()=>this.openExternalEditor()),this.defaultEditor.onAction("app.message.followUp",()=>this.handleFollowUp()),this.defaultEditor.onAction("app.message.dequeue",()=>this.handleDequeue()),this.defaultEditor.onAction("app.session.new",()=>this.handleClearCommand()),this.defaultEditor.onAction("app.session.tree",()=>this.showTreeSelector()),this.defaultEditor.onAction("app.session.fork",()=>this.showUserMessageSelector()),this.defaultEditor.onAction("app.session.resume",()=>this.showSessionSelector()),this.defaultEditor.onChange=e=>{let n=this.isBashMode;this.isBashMode=e.trimStart().startsWith("!"),n!==this.isBashMode&&this.updateEditorBorderColor()},this.defaultEditor.onPasteImage=()=>{this.handleClipboardImagePaste()}}async handleClipboardImagePaste(){try{let e=await OM();if(!e)return;let n=pc.tmpdir(),i=EM(e.mimeType)??"png",s=`pi-clipboard-${tR.randomUUID()}.${i}`,r=Ve.join(n,s);wn.writeFileSync(r,Buffer.from(e.bytes)),this.editor.insertTextAtCursor?.(r),this.ui.requestRender()}catch{}}setupEditorSubmitHandler(){this.defaultEditor.onSubmit=async e=>{if(e=e.trim(),!!e){if(e==="/settings"){this.showSettingsSelector(),this.editor.setText("");return}if(e==="/scoped-models"){this.editor.setText(""),await this.showModelsSelector();return}if(e==="/model"||e.startsWith("/model ")){let n=e.startsWith("/model ")?e.slice(7).trim():void 0;this.editor.setText(""),await this.handleModelCommand(n);return}if(e==="/export"||e.startsWith("/export ")){await this.handleExportCommand(e),this.editor.setText("");return}if(e==="/import"||e.startsWith("/import ")){await this.handleImportCommand(e),this.editor.setText("");return}if(e==="/share"){await this.handleShareCommand(),this.editor.setText("");return}if(e==="/copy"){await this.handleCopyCommand(),this.editor.setText("");return}if(e==="/name"||e.startsWith("/name ")){this.handleNameCommand(e),this.editor.setText("");return}if(e==="/session"){this.handleSessionCommand(),this.editor.setText("");return}if(e==="/changelog"){this.handleChangelogCommand(),this.editor.setText("");return}if(e==="/hotkeys"){this.handleHotkeysCommand(),this.editor.setText("");return}if(e==="/fork"){this.showUserMessageSelector(),this.editor.setText("");return}if(e==="/clone"){this.editor.setText(""),await this.handleCloneCommand();return}if(e==="/tree"){this.showTreeSelector(),this.editor.setText("");return}if(e==="/trust"){this.showTrustSelector(),this.editor.setText("");return}if(e==="/login"){this.showOAuthSelector("login"),this.editor.setText("");return}if(e==="/logout"){this.showOAuthSelector("logout"),this.editor.setText("");return}if(e==="/new"){this.editor.setText(""),await this.handleClearCommand();return}if(e==="/compact"||e.startsWith("/compact ")){let n=e.startsWith("/compact ")?e.slice(9).trim():void 0;this.editor.setText(""),await this.handleCompactCommand(n);return}if(e==="/reload"){this.editor.setText(""),await this.handleReloadCommand();return}if(e==="/debug"){this.handleDebugCommand(),this.editor.setText("");return}if(e==="/arminsayshi"){this.handleArminSaysHi(),this.editor.setText("");return}if(e==="/dementedelves"){this.handleDementedDelves(),this.editor.setText("");return}if(e==="/resume"){this.showSessionSelector(),this.editor.setText("");return}if(e==="/quit"){this.editor.setText(""),await this.shutdown();return}if(e.startsWith("!")){let n=e.startsWith("!!"),i=n?e.slice(2).trim():e.slice(1).trim();if(i){if(this.session.isBashRunning){this.showWarning("A bash command is already running. Press Esc to cancel it first."),this.editor.setText(e);return}this.editor.addToHistory?.(e),await this.handleBashCommand(i,n),this.isBashMode=!1,this.updateEditorBorderColor();return}}if(this.session.isCompacting){this.isExtensionCommand(e)?(this.editor.addToHistory?.(e),this.editor.setText(""),await this.session.prompt(e)):this.queueCompactionMessage(e,"steer");return}if(this.session.isStreaming){this.editor.addToHistory?.(e),this.editor.setText(""),await this.session.prompt(e,{streamingBehavior:"steer"}),this.updatePendingMessagesDisplay(),this.ui.requestRender();return}this.flushPendingBashComponents(),this.onInputCallback?this.onInputCallback(e):this.pendingUserInputs.push(e),this.editor.addToHistory?.(e)}}}subscribeToAgent(){this.unsubscribe=this.session.subscribe(async e=>{await this.handleEvent(e)})}async handleEvent(e){switch(this.isInitialized||await this.init(),this.footer.invalidate(),e.type){case"agent_start":this.pendingTools.clear(),this.settingsManager.getShowTerminalProgress()&&this.ui.terminal.setProgress(!0),this.retryEscapeHandler&&(this.defaultEditor.onEscape=this.retryEscapeHandler,this.retryEscapeHandler=void 0),this.retryCountdown&&(this.retryCountdown.dispose(),this.retryCountdown=void 0),this.retryLoader&&(this.retryLoader.stop(),this.retryLoader=void 0),this.stopWorkingLoader(),this.workingVisible&&(this.loadingAnimation=this.createWorkingLoader(),this.statusContainer.addChild(this.loadingAnimation)),this.ui.requestRender();break;case"queue_update":this.updatePendingMessagesDisplay(),this.ui.requestRender();break;case"session_info_changed":this.updateTerminalTitle(),this.footer.invalidate(),this.ui.requestRender();break;case"thinking_level_changed":this.footer.invalidate(),this.updateEditorBorderColor();break;case"message_start":e.message.role==="custom"?(this.addMessageToChat(e.message),this.ui.requestRender()):e.message.role==="user"?(this.addMessageToChat(e.message),this.updatePendingMessagesDisplay(),this.ui.requestRender()):e.message.role==="assistant"&&(this.streamingComponent=new Hi(void 0,this.hideThinkingBlock,this.getMarkdownThemeWithSettings(),this.hiddenThinkingLabel),this.streamingMessage=e.message,this.chatContainer.addChild(this.streamingComponent),this.streamingComponent.updateContent(this.streamingMessage),this.ui.requestRender());break;case"message_update":if(this.streamingComponent&&e.message.role==="assistant"){this.streamingMessage=e.message,this.streamingComponent.updateContent(this.streamingMessage);for(let n of this.streamingMessage.content)if(n.type==="toolCall")if(this.pendingTools.has(n.id)){let i=this.pendingTools.get(n.id);i&&i.updateArgs(n.arguments)}else{let i=new gi(n.name,n.id,n.arguments,{showImages:this.settingsManager.getShowImages(),imageWidthCells:this.settingsManager.getImageWidthCells()},this.getRegisteredToolDefinition(n.name),this.ui,this.sessionManager.getCwd());i.setExpanded(this.toolOutputExpanded),this.chatContainer.addChild(i),this.pendingTools.set(n.id,i)}this.ui.requestRender()}break;case"message_end":if(e.message.role==="user")break;if(this.streamingComponent&&e.message.role==="assistant"){this.streamingMessage=e.message;let n;if(this.streamingMessage.stopReason==="aborted"){let i=this.session.retryAttempt;n=i>0?`Aborted after ${i} retry attempt${i>1?"s":""}`:"Operation aborted",this.streamingMessage.errorMessage=n}if(this.streamingComponent.updateContent(this.streamingMessage),this.streamingMessage.stopReason==="aborted"||this.streamingMessage.stopReason==="error"){n||(n=this.streamingMessage.errorMessage||"Error");for(let[,i]of this.pendingTools.entries())i.updateResult({content:[{type:"text",text:n}],isError:!0});this.pendingTools.clear()}else for(let[,i]of this.pendingTools.entries())i.setArgsComplete();this.streamingComponent=void 0,this.streamingMessage=void 0,this.footer.invalidate()}this.ui.requestRender();break;case"tool_execution_start":{let n=this.pendingTools.get(e.toolCallId);n||(n=new gi(e.toolName,e.toolCallId,e.args,{showImages:this.settingsManager.getShowImages(),imageWidthCells:this.settingsManager.getImageWidthCells()},this.getRegisteredToolDefinition(e.toolName),this.ui,this.sessionManager.getCwd()),n.setExpanded(this.toolOutputExpanded),this.chatContainer.addChild(n),this.pendingTools.set(e.toolCallId,n)),n.markExecutionStarted(),this.ui.requestRender();break}case"tool_execution_update":{let n=this.pendingTools.get(e.toolCallId);n&&(n.updateResult({...e.partialResult,isError:!1},!0),this.ui.requestRender());break}case"tool_execution_end":{let n=this.pendingTools.get(e.toolCallId);n&&(n.updateResult({...e.result,isError:e.isError}),this.pendingTools.delete(e.toolCallId),this.ui.requestRender());break}case"agent_end":this.settingsManager.getShowTerminalProgress()&&this.ui.terminal.setProgress(!1),this.loadingAnimation&&(this.loadingAnimation.stop(),this.loadingAnimation=void 0,this.statusContainer.clear()),this.streamingComponent&&(this.chatContainer.removeChild(this.streamingComponent),this.streamingComponent=void 0,this.streamingMessage=void 0),this.pendingTools.clear(),await this.checkShutdownRequested(),this.ui.requestRender();break;case"compaction_start":{this.settingsManager.getShowTerminalProgress()&&this.ui.terminal.setProgress(!0),this.autoCompactionEscapeHandler=this.defaultEditor.onEscape,this.defaultEditor.onEscape=()=>{this.session.abortCompaction()},this.statusContainer.clear();let n=`(${ke("app.interrupt")} to cancel)`,i=e.reason==="manual"?`Compacting context... ${n}`:`${e.reason==="overflow"?"Context overflow detected, ":""}Auto-compacting... ${n}`;this.autoCompactionLoader=new Qt(this.ui,s=>b.fg("accent",s),s=>b.fg("muted",s),i),this.statusContainer.addChild(this.autoCompactionLoader),this.ui.requestRender();break}case"compaction_end":{this.settingsManager.getShowTerminalProgress()&&this.ui.terminal.setProgress(!1),this.autoCompactionEscapeHandler&&(this.defaultEditor.onEscape=this.autoCompactionEscapeHandler,this.autoCompactionEscapeHandler=void 0),this.autoCompactionLoader&&(this.autoCompactionLoader.stop(),this.autoCompactionLoader=void 0,this.statusContainer.clear()),e.aborted?e.reason==="manual"?this.showError("Compaction cancelled"):this.showStatus("Auto-compaction cancelled"):e.result?(this.chatContainer.clear(),this.rebuildChatFromMessages(),this.addMessageToChat(Ra(e.result.summary,e.result.tokensBefore,new Date().toISOString())),this.footer.invalidate()):e.errorMessage&&(e.reason==="manual"?this.showError(e.errorMessage):(this.chatContainer.addChild(new L(1)),this.chatContainer.addChild(new E(b.fg("error",e.errorMessage),1,0)))),this.flushCompactionQueue({willRetry:e.willRetry}),this.ui.requestRender();break}case"auto_retry_start":{this.retryEscapeHandler=this.defaultEditor.onEscape,this.defaultEditor.onEscape=()=>{this.session.abortRetry()},this.statusContainer.clear(),this.retryCountdown?.dispose();let n=i=>`Retrying (${e.attempt}/${e.maxAttempts}) in ${i}s... (${ke("app.interrupt")} to cancel)`;this.retryLoader=new Qt(this.ui,i=>b.fg("warning",i),i=>b.fg("muted",i),n(Math.ceil(e.delayMs/1e3))),this.retryCountdown=new Ls(e.delayMs,this.ui,i=>{this.retryLoader?.setMessage(n(i))},()=>{this.retryCountdown=void 0}),this.statusContainer.addChild(this.retryLoader),this.ui.requestRender();break}case"auto_retry_end":{this.retryEscapeHandler&&(this.defaultEditor.onEscape=this.retryEscapeHandler,this.retryEscapeHandler=void 0),this.retryCountdown&&(this.retryCountdown.dispose(),this.retryCountdown=void 0),this.retryLoader&&(this.retryLoader.stop(),this.retryLoader=void 0,this.statusContainer.clear()),e.success||this.showError(`Retry failed after ${e.attempt} attempts: ${e.finalError||"Unknown error"}`),this.ui.requestRender();break}}}getUserMessageText(e){return e.role!=="user"?"":(typeof e.content=="string"?[{type:"text",text:e.content}]:e.content.filter(i=>i.type==="text")).map(i=>i.text).join("")}showStatus(e){let n=this.chatContainer.children,i=n.length>0?n[n.length-1]:void 0,s=n.length>1?n[n.length-2]:void 0;if(i&&s&&i===this.lastStatusText&&s===this.lastStatusSpacer){this.lastStatusText.setText(b.fg("dim",e)),this.ui.requestRender();return}let r=new L(1),o=new E(b.fg("dim",e),1,0);this.chatContainer.addChild(r),this.chatContainer.addChild(o),this.lastStatusSpacer=r,this.lastStatusText=o,this.ui.requestRender()}addMessageToChat(e,n){switch(e.role){case"bashExecution":{let i=new Ws(e.command,this.ui,e.excludeFromContext);e.output&&i.appendOutput(e.output),i.setComplete(e.exitCode,e.cancelled,e.truncated?{truncated:!0}:void 0,e.fullOutputPath),this.chatContainer.addChild(i);break}case"custom":{if(e.display){let i=this.session.extensionRunner.getMessageRenderer(e.customType),s=new nc(e,i,this.getMarkdownThemeWithSettings());s.setExpanded(this.toolOutputExpanded),this.chatContainer.addChild(s)}break}case"compactionSummary":{this.chatContainer.addChild(new L(1));let i=new tc(e,this.getMarkdownThemeWithSettings());i.setExpanded(this.toolOutputExpanded),this.chatContainer.addChild(i);break}case"branchSummary":{this.chatContainer.addChild(new L(1));let i=new ec(e,this.getMarkdownThemeWithSettings());i.setExpanded(this.toolOutputExpanded),this.chatContainer.addChild(i);break}case"user":{let i=this.getUserMessageText(e);if(i){this.chatContainer.children.length>0&&this.chatContainer.addChild(new L(1));let s=U0(i);if(s){let r=new lc(s,this.getMarkdownThemeWithSettings());if(r.setExpanded(this.toolOutputExpanded),this.chatContainer.addChild(r),s.userMessage){this.chatContainer.addChild(new L(1));let o=new Dr(s.userMessage,this.getMarkdownThemeWithSettings());this.chatContainer.addChild(o)}}else{let r=new Dr(i,this.getMarkdownThemeWithSettings());this.chatContainer.addChild(r)}n?.populateHistory&&this.editor.addToHistory?.(i)}break}case"assistant":{let i=new Hi(e,this.hideThinkingBlock,this.getMarkdownThemeWithSettings(),this.hiddenThinkingLabel);this.chatContainer.addChild(i);break}case"toolResult":break;default:{let i=e}}}renderSessionContext(e,n={}){this.pendingTools.clear();let i=new Map;n.updateFooter&&(this.footer.invalidate(),this.updateEditorBorderColor());for(let s of e.messages)if(s.role==="assistant"){this.addMessageToChat(s);for(let r of s.content)if(r.type==="toolCall"){let o=new gi(r.name,r.id,r.arguments,{showImages:this.settingsManager.getShowImages(),imageWidthCells:this.settingsManager.getImageWidthCells()},this.getRegisteredToolDefinition(r.name),this.ui,this.sessionManager.getCwd());if(o.setExpanded(this.toolOutputExpanded),this.chatContainer.addChild(o),s.stopReason==="aborted"||s.stopReason==="error"){let a;if(s.stopReason==="aborted"){let c=this.session.retryAttempt;a=c>0?`Aborted after ${c} retry attempt${c>1?"s":""}`:"Operation aborted"}else a=s.errorMessage||"Error";o.updateResult({content:[{type:"text",text:a}],isError:!0})}else i.set(r.id,o)}}else if(s.role==="toolResult"){let r=i.get(s.toolCallId);r&&(r.updateResult(s),i.delete(s.toolCallId))}else this.addMessageToChat(s,n);for(let[s,r]of i)this.pendingTools.set(s,r);this.ui.requestRender()}renderInitialMessages(){let e=this.sessionManager.buildSessionContext();this.renderSessionContext(e,{updateFooter:!0,populateHistory:!0}),this.renderProjectTrustWarningIfNeeded();let i=this.sessionManager.getEntries().filter(s=>s.type==="compaction").length;if(i>0){let s=i===1?"1 time":`${i} times`;this.showStatus(`Session compacted ${s}`)}}renderProjectTrustWarningIfNeeded(){this.settingsManager.isProjectTrusted()||!Or(this.sessionManager.getCwd())||(this.chatContainer.children.length>0&&this.chatContainer.addChild(new L(1)),this.chatContainer.addChild(new E(b.fg("warning","This project is not trusted. Project .pi resources and packages are ignored. Use /trust to save a trust decision, then restart pi."),1,0)))}async getUserInput(){let e=this.pendingUserInputs.shift();return e!==void 0?e:new Promise(n=>{this.onInputCallback=i=>{this.onInputCallback=void 0,n(i)}})}rebuildChatFromMessages(){this.chatContainer.clear();let e=this.sessionManager.buildSessionContext();this.renderSessionContext(e)}handleCtrlC(){let e=Date.now();e-this.lastSigintTime<500?this.shutdown():(this.clearEditor(),this.lastSigintTime=e)}handleCtrlD(){this.shutdown()}async shutdown(e){if(this.isShuttingDown)return;this.isShuttingDown=!0,e?.fromSignal&&(await this.runtimeHost.dispose(),await this.ui.terminal.drainInput(1e3),this.stop(),process.exit(0)),await this.ui.terminal.drainInput(1e3),this.stop(),await this.runtimeHost.dispose();let n=l8(this.sessionManager);n&&process.stdout.write(`${n8.dim("To resume this session:")} ${n}
|
|
350
350
|
`),process.exit(0)}emergencyTerminalExit(){this.isShuttingDown=!0,this.unregisterSignalHandlers(),Ma(),process.exit(129)}uncaughtCrash(e){this.isShuttingDown&&process.exit(1),this.isShuttingDown=!0;try{this.unregisterSignalHandlers()}catch{}try{Ma()}catch{}try{this.ui.stop()}catch{}console.error("pi exiting due to uncaughtException:"),console.error(e),process.exit(1)}async checkShutdownRequested(){this.shutdownRequested&&await this.shutdown()}registerSignalHandlers(){this.unregisterSignalHandlers();let e=["SIGTERM"];process.platform!=="win32"&&e.push("SIGHUP");for(let s of e){let r=()=>{Ma(),this.shutdown({fromSignal:!0})};process.prependListener(s,r),this.signalCleanupHandlers.push(()=>process.off(s,r))}let n=s=>{throw r8(s)&&this.emergencyTerminalExit(),s};process.stdout.on("error",n),process.stderr.on("error",n),this.signalCleanupHandlers.push(()=>process.stdout.off("error",n)),this.signalCleanupHandlers.push(()=>process.stderr.off("error",n));let i=s=>this.uncaughtCrash(s);process.prependListener("uncaughtException",i),this.signalCleanupHandlers.push(()=>process.off("uncaughtException",i))}unregisterSignalHandlers(){for(let e of this.signalCleanupHandlers)e();this.signalCleanupHandlers=[]}handleCtrlZ(){if(process.platform==="win32"){this.showStatus("Suspend to background is not supported on Windows");return}let e=setInterval(()=>{},2**30),n=()=>{};process.on("SIGINT",n),process.once("SIGCONT",()=>{clearInterval(e),process.removeListener("SIGINT",n),this.ui.start(),this.ui.requestRender(!0)});try{this.ui.stop(),process.kill(0,"SIGTSTP")}catch(i){throw clearInterval(e),process.removeListener("SIGINT",n),i}}async handleFollowUp(){let e=(this.editor.getExpandedText?.()??this.editor.getText()).trim();if(e){if(this.session.isCompacting){this.isExtensionCommand(e)?(this.editor.addToHistory?.(e),this.editor.setText(""),await this.session.prompt(e)):this.queueCompactionMessage(e,"followUp");return}this.session.isStreaming?(this.editor.addToHistory?.(e),this.editor.setText(""),await this.session.prompt(e,{streamingBehavior:"followUp"}),this.updatePendingMessagesDisplay(),this.ui.requestRender()):this.editor.onSubmit&&(this.editor.setText(""),this.editor.onSubmit(e))}}handleDequeue(){let e=this.restoreQueuedMessagesToEditor();e===0?this.showStatus("No queued messages to restore"):this.showStatus(`Restored ${e} queued message${e>1?"s":""} to editor`)}updateEditorBorderColor(){if(this.isBashMode)this.editor.borderColor=b.getBashModeBorderColor();else{let e=this.session.thinkingLevel||"off";this.editor.borderColor=b.getThinkingBorderColor(e)}this.ui.requestRender()}cycleThinkingLevel(){let e=this.session.cycleThinkingLevel();e===void 0?this.showStatus("Current model does not support thinking"):(this.footer.invalidate(),this.updateEditorBorderColor(),this.showStatus(`Thinking level: ${e}`))}async cycleModel(e){try{let n=await this.session.cycleModel(e);if(n===void 0){let i=this.session.scopedModels.length>0?"Only one model in scope":"Only one model available";this.showStatus(i)}else{this.footer.invalidate(),this.updateEditorBorderColor();let i=n.model.reasoning&&n.thinkingLevel!=="off"?` (thinking: ${n.thinkingLevel})`:"";this.showStatus(`Switched to ${n.model.name||n.model.id}${i}`),this.maybeWarnAboutAnthropicSubscriptionAuth(n.model)}}catch(n){this.showError(n instanceof Error?n.message:String(n))}}toggleToolOutputExpansion(){this.setToolsExpanded(!this.toolOutputExpanded)}setToolsExpanded(e){this.toolOutputExpanded=e;let n=this.customHeader??this.builtInHeader;Yl(n)&&n.setExpanded(e);for(let i of this.chatContainer.children)Yl(i)&&i.setExpanded(e);this.ui.requestRender()}toggleThinkingBlockVisibility(){this.hideThinkingBlock=!this.hideThinkingBlock,this.settingsManager.setHideThinkingBlock(this.hideThinkingBlock),this.chatContainer.clear(),this.rebuildChatFromMessages(),this.streamingComponent&&this.streamingMessage&&(this.streamingComponent.setHideThinkingBlock(this.hideThinkingBlock),this.streamingComponent.updateContent(this.streamingMessage),this.chatContainer.addChild(this.streamingComponent)),this.showStatus(`Thinking blocks: ${this.hideThinkingBlock?"hidden":"visible"}`)}async openExternalEditor(){let e=process.env.VISUAL||process.env.EDITOR;if(!e){this.showWarning("No editor configured. Set $VISUAL or $EDITOR environment variable.");return}let n=this.editor.getExpandedText?.()??this.editor.getText(),i=Ve.join(pc.tmpdir(),`pi-editor-${Date.now()}.pi.md`);try{wn.writeFileSync(i,n,"utf-8"),this.ui.stop();let[s,...r]=e.split(" ");if(process.stdout.write(`Launching external editor: ${e}
|
|
351
351
|
Pi will resume when the editor exits.
|
|
352
352
|
`),await new Promise(a=>{let c=Rb(s,[...r,i],{stdio:"inherit",shell:process.platform==="win32"});c.on("error",()=>a(null)),c.on("close",l=>a(l))})===0){let a=wn.readFileSync(i,"utf-8").replace(/\n$/,"");this.editor.setText(a)}}finally{try{wn.unlinkSync(i)}catch{}this.ui.start(),this.ui.requestRender(!0)}}clearEditor(){this.editor.setText(""),this.ui.requestRender()}showError(e){this.chatContainer.addChild(new L(1)),this.chatContainer.addChild(new E(b.fg("error",`Error: ${e}`),1,0)),this.chatContainer.addChild(new L(1)),this.ui.requestRender()}showWarning(e){this.chatContainer.addChild(new L(1)),this.chatContainer.addChild(new E(b.fg("warning",`Warning: ${e}`),1,0)),this.ui.requestRender()}showNewVersionNotification(e){let n=b.fg("accent",`${bt} update`),i=b.fg("muted",`New version ${e.version} is available. Run `)+n,s="https://pi.dev/changelog",r=ct().hyperlinks?mr(b.fg("accent","open changelog"),s):b.fg("accent",s),o=b.fg("muted","Changelog: ")+r,a=e.note?.trim();this.chatContainer.addChild(new L(1)),this.chatContainer.addChild(new z(c=>b.fg("warning",c))),this.chatContainer.addChild(new E(`${b.bold(b.fg("warning","Update Available"))}
|
|
@@ -448,7 +448,7 @@ Log file: ${zi}
|
|
|
448
448
|
`;Ds.appendFileSync(zi,n)}catch{}}function Je(t,e){if(!(!zi||!Ds||!Zl))try{let i=`[${new Date().toISOString()}] ${t}:
|
|
449
449
|
${JSON.stringify(e,null,2)}
|
|
450
450
|
|
|
451
|
-
`;Ds.appendFileSync(zi,i)}catch{}}var $s=null;function oR(t){if(!t)return;let e=t.trim();if(e)return e.replace(/\/+$/,"")}var Se=class t{static{this.BASE_URL="base_url"}static{this.ANALYTICS_DOMAIN="analytics_domain"}static{this.CLIENT_ID="client_id"}static{this.PROJECT_ID="project_id"}static{this.WORKSPACE_ID="workspace_id"}static{this.defaultValues={[t.BASE_URL]:"https://sapientaiproducts.com",[t.ANALYTICS_DOMAIN]:"https://slingshot.sapientaiproducts.com",[t.CLIENT_ID]:"b97fbef7-cad9-4e56-9850-39e86c8fdf61",[t.PROJECT_ID]:"fa8121c4-e2fc-48f1-9478-8949c04e13cc",[t.WORKSPACE_ID]:"6e5756eb-d7e2-4d80-ad07-9d7a51600d85"}}static{this.LOGIN_PATH="/web/v1/studio-auth/login"}static{this.EXCHANGE_PATH="/api/v1/studio-auth/auth/desktop/exchange"}static{this.REFRESH_PATH="/api/v3/auth/refreshtoken"}static{this.REFRESH_CLIENT_NAME="machine"}static{this.API_BASE_PATH="/api/v1/llm"}static{this.SAGE_EVENTS_PATH="/api/v1/ai-portal/sage_events"}static{this.APP_TOKEN_PATH="/api/v3/auth/app-token"}static{this.CONFIG_SERVICE_PATH="/api/v2/configservice/client"}static{this.APP_TOKEN_REFRESH_BUFFER_MS=60*1e3}static{this.SLINGSHOT_APP_TOKEN_ENV="SLINGSHOT_APP_TOKEN_HEADER"}static{this.TOKEN_EXPIRY_BUFFER_MS=300*1e3}static{this.SAPI="/save/api/v1"}static{this.CLIENT_NAME="desktop"}static defaults(e){return this.defaultValues[e]}static getSettingsPath(){let e=tu.resolve(process.cwd(),".sling","sling.settings.json");if(Vi.existsSync(e))return e;let n=Pe();return tu.resolve(n,"sling.settings.json")}static getSettings(){if(!$s){let i=this.getSettingsPath();try{if(Vi.existsSync(i)){let s=Vi.readFileSync(i,"utf-8"),r=JSON.parse(s)||{};$s={...this.defaultValues,...r}}else{let s=tu.dirname(i);Vi.existsSync(s)||Vi.mkdirSync(s,{recursive:!0}),Vi.writeFileSync(i,JSON.stringify(this.defaultValues,null,2),"utf-8"),$s={...this.defaultValues}}}catch(s){Je("Error reading/writing sling.settings.json: ",s),$s={...this.defaultValues}}}let e=oR(process.env.SLINGSHOT_API_DOMAIN),n=oR(process.env.SLINGSHOT_ANALYTICS_DOMAIN);return{...$s,[t.BASE_URL]:e||$s[t.BASE_URL],[t.ANALYTICS_DOMAIN]:n||$s[t.ANALYTICS_DOMAIN]}}static updateSettings(e){let n=Pe(),i=tu.resolve(n,"sling.settings.json");try{let r={...this.getSettings()||{},...e},o=tu.dirname(i);Vi.existsSync(o)||Vi.mkdirSync(o,{recursive:!0}),Vi.writeFileSync(i,JSON.stringify(r,null,2),"utf-8"),$s=r}catch(s){Je("Error updating sling.settings.json: ",s)}}static getLoginUrl(e){let n=this.getSettings(),i=new URLSearchParams({client:this.CLIENT_NAME,port:String(e.port),localState:e.localState});return e.clientId&&i.set("clientId",e.clientId),`${n[t.BASE_URL]}${this.LOGIN_PATH}?${i.toString()}`}static getExchangeUrl(){return`${this.getSettings()[t.BASE_URL]}${this.EXCHANGE_PATH}`}static getRefreshUrl(){let e=this.getSettings(),n=new URLSearchParams({client:this.REFRESH_CLIENT_NAME});return`${e[t.BASE_URL]}${this.REFRESH_PATH}?${n.toString()}`}static getApiBaseUrl(){return`${this.getSettings()[t.BASE_URL]}${this.API_BASE_PATH}`}static getSageEventsUrl(){return`${this.getSettings()[t.ANALYTICS_DOMAIN]}${this.SAGE_EVENTS_PATH}`}static getTokenExpiryBuffer(){return this.TOKEN_EXPIRY_BUFFER_MS}static getDefaultProjectId(){let e=this.getSettings();return process.env.SLINGSHOT_PROJECT_ID||e[t.PROJECT_ID]}static getDefaultWorkspaceId(){let e=this.getSettings();return process.env.SLINGSHOT_WORKSPACE_ID||e[t.WORKSPACE_ID]}static getDefaultClientId(){let e=this.getSettings();return process.env.CLIENT_ID||e[t.CLIENT_ID]}static getUserActivityUrl(){return`${this.getSettings()[t.BASE_URL]}${this.SAPI}/users/activity`}static getUserUrl(){return`${this.getSettings()[t.BASE_URL]}${this.SAPI}/users`}static getAppTokenUrl(){return`${this.getSettings()[t.BASE_URL]}${this.APP_TOKEN_PATH}`}static getConfigServiceUrl(e){let n=this.getSettings(),i=this.getDefaultClientId(),s=new URLSearchParams({keys:e});return`${n[t.BASE_URL]}${this.CONFIG_SERVICE_PATH}/${i}?${s.toString()}`}static getAppTokenRefreshBuffer(){return this.APP_TOKEN_REFRESH_BUFFER_MS}};function nu(t){try{let e=t.split(".");if(e.length!==3)return 0;let n=JSON.parse(atob(e[1]));return n.exp?n.exp*1e3:0}catch{return 0}}function um(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function aR(){return`user_${um()}`}var Pb="Xq7Wm2zR9pLkVbN4cD8fH3jT6yG1sA5",I8=BigInt(Pb.length);function P8(t){if(t.length===0)return"";let e=0n;for(let i of t){let s=Pb.indexOf(i);if(s===-1)throw new Error(`Cannot decode app_key: character "${i}" is not in the expected alphabet`);e=e*I8+BigInt(s)}let n=[];for(;e>0n;)n.unshift(Number(e&0xffn)),e>>=8n;for(let i of t)if(i===Pb[0])n.unshift(0);else break;return new TextDecoder().decode(new Uint8Array(n))}var _b=new Map,dm=new Map;async function _8(t,e){let n=Se.getConfigServiceUrl(t);Ie(`sling-config: fetching ${n}`);let i;try{i=await fetch(n,{method:"GET",headers:{Accept:"application/json",Authorization:`Bearer ${e}`}})}catch(o){let a=o instanceof Error?o.message:String(o);throw new Error(`Cannot reach config service: ${a}`)}if(!i.ok){let o=`${i.status} ${i.statusText}`;try{let a=await i.json();a.message?o=String(a.message):a.error&&(o=String(a.error))}catch{}throw new Error(`Config service request failed: ${o}`)}let r=(await i.json())?.data?.config;if(!r||typeof r!="object")throw new Error("Config service response missing data.config");return r}async function cR(t,e){let n=_b.get(t);if(n)return n;let i=dm.get(t);if(i)return i;if(!e)throw new Error("Cannot reach config service: no Slingshot user token provided");let s=_8(t,e).then(r=>(_b.set(t,r),r)).finally(()=>{dm.delete(t)});return dm.set(t,s),s}var mc=class{static async getSlingcliConfig(e){let n=await cR("slingcli",e),i=n.slingcli;if(!i||typeof i.app_id!="string"||typeof i.app_key!="string"||!i.app_id||!i.app_key)throw Je("sling-config: missing slingcli block",n),new Error("Config service did not return slingcli.app_id / slingcli.app_key for this client");return{app_id:i.app_id,app_key:P8(i.app_key)}}static async getRemoteConfig(e,n){return cR(e,n)}static clearCache(){_b.clear(),dm=new Map}};import lR from"node:path";import Bs from"node:fs";var E8="sling.app-creds.json";function Eb(){return lR.resolve(Pe(),E8)}function uR(){let t=Eb();if(!Bs.existsSync(t))return null;try{let e=Bs.readFileSync(t,"utf-8"),n=JSON.parse(e);return typeof n.app_id!="string"||typeof n.app_key!="string"||!n.app_id||!n.app_key?(Je("app-creds-store: invalid creds file, ignoring",n),null):{app_id:n.app_id,app_key:n.app_key}}catch(e){return Je("app-creds-store: failed to read creds file",e),null}}function Ab(t){let e=Eb(),n=lR.dirname(e);try{Bs.existsSync(n)||Bs.mkdirSync(n,{recursive:!0});let i={...t,savedAt:Date.now()};Bs.writeFileSync(e,JSON.stringify(i,null,2),{encoding:"utf-8",mode:384});try{Bs.chmodSync(e,384)}catch{}Ie(`app-creds-store: persisted to ${e}`)}catch(i){Je("app-creds-store: failed to persist creds",i)}}function dR(){let t=Eb();try{Bs.existsSync(t)&&(Bs.unlinkSync(t),Ie(`app-creds-store: cleared ${t}`))}catch(e){Je("app-creds-store: failed to clear creds file",e)}}var mm=class extends Error{constructor(n,i){super(i);this.status=n;this.name="AppTokenHttpError"}},iu=null,su=null,pm=null,hc=null;function pR(t){process.env[Se.SLINGSHOT_APP_TOKEN_ENV]=`Bearer ${t}`}function A8(t){hc&&(clearTimeout(hc),hc=null);let e=t.expiresAt-Date.now();e<=0||(hc=setTimeout(()=>{hc=null,Ji().catch(n=>{Je("app-token: scheduled refresh failed",n)})},e),hc.unref?.())}async function mR(t){let e=Buffer.from(`${t.app_id}:${t.app_key}`).toString("base64"),n=Se.getAppTokenUrl();Ie(`app-token: minting from ${n}`);let i;try{i=await fetch(n,{method:"GET",headers:{Accept:"application/json",Authorization:`Basic ${e}`}})}catch(a){let c=a instanceof Error?a.message:String(a);throw new Error(`Cannot reach app-token service: ${c}`)}if(!i.ok){let a=`${i.status} ${i.statusText}`;try{let c=await i.text()||"";c&&(a=c)}catch{}throw new mm(i.status,`App token request failed: ${a}`)}let s=await i.json();if(!s.app_token||typeof s.expires_in!="number")throw new Error("App token response missing app_token or expires_in");let r=Se.getAppTokenRefreshBuffer(),o=Date.now()+s.expires_in*1e3-r;return Ie(`app-token: minted, expires at ${new Date(o).toISOString()}`),{token:s.app_token,expiresAt:o}}async function O8(){let t=uR();if(t)return{creds:t,fromDisk:!0};if(!su)throw new Error("Cannot mint app token: no on-disk app credentials and no Slingshot user token available (please /login slingshot first)");let e=await mc.getSlingcliConfig(su);return Ab(e),{creds:e,fromDisk:!1}}async function L8(){let{creds:t,fromDisk:e}=await O8();try{return await mR(t)}catch(n){let i=n instanceof mm&&(n.status===401||n.status===403);if(!e||!i)throw n;if(Je("app-token: disk creds rejected (likely rotated), refetching from config service",{status:n.status}),dR(),!su)throw new Error("Cannot rotate app credentials: on-disk creds rejected and no Slingshot user token available (please /login slingshot)");let s=await mc.getSlingcliConfig(su);return Ab(s),await mR(s)}}async function Ji(t){if(t&&(su=t),iu&&iu.expiresAt>Date.now())return pR(iu.token),iu.token;if(pm)return(await pm).token;let e=L8().then(i=>(iu=i,pR(i.token),A8(i),i)).finally(()=>{pm=null});return pm=e,(await e).token}var ru=null,Ob=null;typeof process<"u"&&process.versions?.node&&(Ob=import("node:http").then(t=>{ru=t.createServer}));async function W8(){if(ru||(Ob&&await Ob,ru))return ru;throw new Error("Slingshot OAuth requires Node.js")}async function Lb(t){let e=await W8(),n,i,s,r=!1,o=new Promise((u,d)=>{i=u,s=d}),a=u=>{if(!r){r=!0;try{n.close()}catch{}u()}};n=e((u,d)=>{let p=new URL(u.url||"","http://127.0.0.1"),m=p.searchParams.get("code"),g=p.searchParams.get("state"),h=p.searchParams.get("clientId"),f=p.searchParams.get("error"),x=p.searchParams.get("error_description");if(f){d.writeHead(400,{"Content-Type":"text/html"}),d.end(`<html><body><h1>Login Failed</h1><p>${x||f}</p><p>You can close this window.</p></body></html>`),a(()=>s(new Error(`Login failed: ${x||f}`)));return}if(!m||!g){d.writeHead(400,{"Content-Type":"text/html"}),d.end("<html><body><h1>Login Failed</h1><p>Missing code or state in callback.</p><p>You can close this window.</p></body></html>"),a(()=>s(new Error("Missing code or state in callback")));return}d.writeHead(200,{"Content-Type":"text/html"}),d.end("<html><body><h1>Login Successful</h1><p>You can close this window and return to your terminal.</p><script>setTimeout(()=>window.close(),3000)</script></body></html>"),a(()=>i({code:m,state:g,clientId:h||""}))}),n.on("error",u=>{a(()=>s(u))});let c=setTimeout(()=>{a(()=>s(new Error("Login timeout - no callback received within 5 minutes")))},300*1e3);return n.on("close",()=>clearTimeout(c)),t&&t.addEventListener("abort",()=>{a(()=>s(new Error("Login cancelled")))}),{port:await new Promise((u,d)=>{n.once("error",d),n.listen(0,"127.0.0.1",()=>{let p=n.address();p&&typeof p=="object"?u(p.port):d(new Error("Failed to obtain loopback server port"))})}),result:o}}async function Wb(t,e){if(!t)throw new Error("Missing exchange code");if(!e)throw new Error("Missing clientId for exchange");let n=Se.getExchangeUrl(),i;try{i=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json"},body:JSON.stringify({code:t,clientId:e})})}catch(r){let o=r instanceof Error?r.message:String(r);throw new Error(`Cannot reach Studio Auth: ${o}`)}if(!i.ok){let r,o=`${i.status} ${i.statusText}`;try{let a=await i.json();r=a.error?.code,a.error?.message?o=a.error.message:a.message?o=a.message:r&&(o=r)}catch{}throw r==="INVALID_CALLBACK"?new Error("Login failed: exchange code is expired, already used, or bound to a different tenant. Please log in again."):new Error(`Code exchange failed: ${o}`)}let s=await i.json();if(!s.accessToken||!s.refreshToken)throw new Error("Exchange response missing accessToken or refreshToken");return s}function U8(){return F8(16).toString("hex")}function D8(t){let e=new URL(t),n=e.searchParams.get("code"),i=e.searchParams.get("state"),s=e.searchParams.get("clientId");if(!n||!i)throw new Error("Pasted URL is missing code or state");return{code:n,state:i,clientId:s||""}}async function Fb(t){let e=process.env.SLINGSHOT_TOKEN;if(e){let u=nu(e);return Ie("Using Slingshot token from SLINGSHOT_TOKEN environment variable"),await Ji(e),{refresh:"",access:e,expires:u>0?u-Se.getTokenExpiryBuffer():Date.now()+10800*1e3,projectId:process.env.SLINGSHOT_PROJECT_ID,workspaceId:process.env.SLINGSHOT_WORKSPACE_ID}}let{port:n,result:i}=await Lb(t.signal),s=U8(),r=Se.getDefaultClientId(),o=Se.getLoginUrl({port:n,localState:s,clientId:r||void 0});t.onAuth({url:o});let a;if(t.onManualCodeInput){let u=t.onManualCodeInput().then(D8);a=await Promise.race([i,u])}else a=await i;if(a.state!==s)throw new Error("CSRF check failed - state does not match localState");if(!a.clientId)throw new Error("Login callback did not include clientId");let c=await Wb(a.code,a.clientId),l=nu(c.accessToken);return await Ji(c.accessToken),{refresh:c.refreshToken,access:c.accessToken,expires:l>0?l-Se.getTokenExpiryBuffer():Date.now()+10800*1e3,projectId:void 0,workspaceId:void 0}}import{randomUUID as $8}from"node:crypto";async function hm(t){if(!t.refresh)throw new Error("No refresh token available. Please login again.");let e;try{e=await Ji()}catch(a){throw Je("auth/refresh: app token unavailable for refresh call",a),new Error(`Cannot refresh Slingshot token: app token unavailable (${a instanceof Error?a.message:String(a)}). Please /login slingshot.`)}let n=$8(),i={accept:"application/json",rt:t.refresh,"trace-id":n,Authorization:`Bearer ${e}`},s;try{let a=Se.getRefreshUrl();s=await fetch(a,{headers:i})}catch(a){let c=a instanceof Error?a.message:String(a);throw new Error(`Cannot reach Slingshot server: ${c}`)}if(!s.ok){let a=`${s.status} ${s.statusText}`;try{let c=await s.json();c.message?a=String(c.message):c.error&&(a=String(c.error))}catch{}throw new Error(`Token refresh failed: ${a}`)}let r=await s.json();if(!r.accessToken)throw new Error("No access token in refresh response");let o=nu(r.accessToken);try{await Ji(r.accessToken)}catch(a){throw Je("auth/refresh: app token refresh failed",a),a}return{refresh:r.refreshToken||t.refresh,access:r.accessToken,expires:o>0?o-Se.getTokenExpiryBuffer():Date.now()+10800*1e3,projectId:t.projectId,workspaceId:t.workspaceId}}var hR=[{id:"gpt-5.4-nano",name:"GPT-5.4 nano",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:null,medium:null,high:null,xhigh:"xhigh"},input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,api:"openai-completions",provider:"slingshot"},{id:"gpt-4.1",name:"GPT-4.1",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:1047576,maxTokens:32768,provider:"slingshot",api:"openai-completions"},{id:"gpt-5",name:"GPT-5",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,provider:"slingshot",api:"openai-completions"},{id:"gpt-5-mini",name:"GPT-5 Mini",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,provider:"slingshot",api:"openai-completions"},{id:"gpt-5-nano",name:"GPT-5 Nano",reasoning:!0,input:["text","image"],cost:{input:.05,output:.4,cacheRead:.005,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,provider:"slingshot",api:"openai-completions"},{id:"gpt-5.1",name:"GPT-5.1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.13,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,provider:"slingshot",api:"openai-completions"},{id:"gpt-5.2",name:"GPT-5.2",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,provider:"slingshot",api:"openai-completions"},{id:"gpt-5.4-mini",name:"GPT-5.4 mini",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:null,medium:null,high:null,xhigh:"xhigh"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,api:"openai-completions",provider:"slingshot"},{id:"gpt-5.4",name:"GPT-5.4",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:null,medium:null,high:null,xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:272e3,maxTokens:128e3,api:"openai-completions",provider:"slingshot"},{id:"gpt-5.5",name:"GPT-5.5",reasoning:!0,thinkingLevelMap:{off:null,minimal:null,low:null,medium:null,high:null,xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:272e3,maxTokens:128e3,api:"openai-completions",provider:"slingshot"},{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,provider:"slingshot",api:"openai-codex-responses"},{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,provider:"slingshot",api:"openai-codex-responses"},{id:"claude-opus-4@20250514",name:"Claude Opus 4",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3,provider:"slingshot",api:"openai-completions"},{id:"claude-sonnet-4@20250514",name:"Claude Sonnet 4",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3,provider:"slingshot",api:"openai-completions"},{id:"claude-sonnet-4-5@20250929",name:"Claude Sonnet 4.5",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3,provider:"slingshot",api:"openai-completions"},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3,provider:"slingshot",api:"openai-completions"},{id:"claude-opus-4-6",name:"Claude Opus 4.6",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3,provider:"slingshot",api:"openai-completions"},{id:"o3",name:"O3",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5,provider:"slingshot",api:"openai-completions"},{id:"o3-mini",name:"o3-mini",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5,provider:"slingshot",api:"openai-completions"},{id:"o4-mini",name:"o4-mini",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.28,cacheWrite:0},contextWindow:2e5,maxTokens:1e5,provider:"slingshot",api:"openai-completions"},{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.075,cacheWrite:0},contextWindow:1048576,maxTokens:65536,provider:"slingshot",api:"openai-completions"}];var $r={name:"slingshot.cli",private:!0,type:"module",workspaces:["packages/*","packages/web-ui/example","packages/coding-agent/examples/extensions/with-deps","packages/coding-agent/examples/extensions/custom-provider-anthropic","packages/coding-agent/examples/extensions/custom-provider-gitlab-duo"],scripts:{clean:"npm run clean --workspaces",build:"cd packages/tui && npm run build && cd ../ai && npm run build && cd ../agent && npm run build && cd ../coding-agent && npm run build && cd ../web-ui && npm run build",dev:'concurrently --names "ai,agent,coding-agent,web-ui,tui" --prefix-colors "cyan,yellow,red,white,green,magenta" "cd packages/ai && npm run dev" "cd packages/agent && npm run dev" "cd packages/coding-agent && npm run dev" "cd packages/web-ui && npm run dev" "cd packages/tui && npm run dev"',"dev:tsc":'concurrently --names "ai,web-ui" --prefix-colors "cyan,green" "cd packages/ai && npm run dev:tsc" "cd packages/web-ui && npm run dev:tsc"',check:"","check:browser-smoke":"","profile:tui":"node scripts/profile-coding-agent-node.mjs --mode tui","profile:rpc":"node scripts/profile-coding-agent-node.mjs --mode rpc",test:"npm run test --workspaces --if-present","version:patch":"npm version patch -ws --no-git-tag-version && node scripts/sync-versions.js && shx rm -rf node_modules packages/*/node_modules package-lock.json && npm install","version:minor":"npm version minor -ws --no-git-tag-version && node scripts/sync-versions.js && shx rm -rf node_modules packages/*/node_modules package-lock.json && npm install","version:major":"npm version major -ws --no-git-tag-version && node scripts/sync-versions.js && shx rm -rf node_modules packages/*/node_modules package-lock.json && npm install","version:set":"npm version -ws",prepublishOnly:"npm run clean && npm run build && npm run check",publish:"npm run prepublishOnly && npm publish -ws --access public","publish:dry":"npm run prepublishOnly && npm publish -ws --access public --dry-run","release:patch":"node scripts/release.mjs patch","release:minor":"node scripts/release.mjs minor","release:major":"node scripts/release.mjs major",prepare:"husky"},devDependencies:{"@anthropic-ai/sandbox-runtime":"0.0.26","@biomejs/biome":"2.3.5","@types/node":"22.19.19","@typescript/native-preview":"7.0.0-dev.20260120.1",concurrently:"^9.2.1",esbuild:"0.28.0",husky:"9.1.7",jiti:"2.7.0",shx:"0.4.0",tsx:"4.22.1",typescript:"5.9.3","@types/lodash.mergewith":"^4.6.9","fast-xml-parser":"^5.5.8",turbo:"^2.5.8",vitest:"^4.0.14"},engines:{node:">=20.0.0"},slingVersion:"2.5.20260615-2",overrides:{postcss:"8.5.14",next:{postcss:"8.5.14"},"ip-address":"^10.1.1","@modelcontextprotocol/sdk":"^1.29.0",ai:">=5.0.52","fast-xml-parser":"^5.5.8","@aws-sdk/xml-builder":{"fast-xml-parser":"^5.5.8"},"adaptivecards-templating":{"adaptive-expressions":{"fast-xml-parser":"^5.5.8"}},picomatch:"^4.0.4","path-to-regexp":"8.4.1",router:{"path-to-regexp":"8.4.1"},minimatch:"^10.2.3",tar:"7.5.11",react:"19.1.1","react-dom":"19.1.1","@types/react":"19","@types/react-dom":"19",tailwindcss:"4.1.12",lightningcss:"1.30.2",glob:{".":"11.1.0",minimatch:"10.2.3"},prismjs:"^1.30.0",qs:"^6.15.0","@hono/node-server":"1.19.14",protobufjs:"^8.2.0","@opentelemetry/otlp-transformer":{protobufjs:"^8.2.0"},langchain:{langsmith:">=0.7.0"},hono:"4.12.18",fsevents:"^2.3.3",swiper:"^12.1.2",lodash:"^4.18.0","lodash-es":"^4.18.1",axios:"^1.15.0","ibm-cloud-sdk-core":"^5.4.11",dompurify:">=3.4.0","react-markdown-mermaid":{mermaid:"10.9.6"}},dependencies:{"@modelcontextprotocol/sdk":"^1.29.0","@mozilla/readability":"^0.6.0","compound-engineering-pi":"^0.2.4","get-east-asian-width":"^1.4.0",linkedom:"^0.18.12",turndown:"^7.2.4",unpdf:"^1.6.2"}};var H_e=Se.getRefreshUrl(),z_e=Se.getApiBaseUrl(),V_e=Se.getSageEventsUrl(),J_e=Se.getTokenExpiryBuffer(),gR=Se.getDefaultProjectId(),fR=Se.getDefaultWorkspaceId(),bR=Se.getDefaultClientId();async function gm(t,e,n){let i=aR(),s=await e.modelRegistry.getApiKeyForProvider(e.model?.provider||"slingshot");if(!s){Ie("ERROR: No API key found");return}let r=s.startsWith("Bearer ")?s:`Bearer ${s}`,o=process.env.SLINGSHOT_PROJECT_ID||gR,a=process.env.SLINGSHOT_WORKSPACE_ID||fR,c=process.env.CLIENT_ID||bR,l={"Content-Type":"application/json",accept:"application/json","access-token":r,"x-project-id":o,"x-workspace-id":a,"x-client-id":c,"sage-trace-id":i,"User-Agent":"pi-slingshot/1.0.0"},u=parseFloat(process.env.SLINGSHOT_TEMPERATURE||"0.2"),d=parseFloat(process.env.SLINGSHOT_TOP_P||"0.8"),p={source:$r.name||"sling",ai_model_info:{ai_provider_name:e.model?.provider||"slingshot",sage_modl_name:e.model?.id||"unknown",sage_modl_option:{temperature:String(u),max_token_size:String(e.model?.maxTokens||16834),top_p:String(d)}},rag_info:{type:null,account_name:"dummy",project_names:[],repository_names:[],programming_language:null},tab_data:{tab_count:"1"},tags:null,slingshot_version:$r.slingVersion||"2.3.2",chat_type:"agent",...n||{}};return{headers:l,sageCommonData:p}}async function fm(t,e,n,i){let s={eventName:t,sageCommonData:n,eventData:i};Ie(`Sending analytics event: ${t} : `+Se.getSageEventsUrl());try{let r=await fetch(Se.getSageEventsUrl(),{method:"POST",headers:e,body:JSON.stringify(s)});if(r.ok){let o=await r.json().catch(()=>{});if(o.error_code)throw new Error(`Analytics API error: ${o.error_code} - ${o.error_message||"No message"}`);Ie(`'SUCCESS: Event sent: ${t}`),Ie(`Response: ${JSON.stringify(o)}`),Ie("\u2500".repeat(66))}else{let o=await r.text().catch(()=>""),a={status:r.status,statusText:r.statusText,responseBody:o,requestHeaders:e};throw Ie(`ERROR: ${r.status} ${r.statusText}`),Je("Error Details",a),Je("Failed Request Body",s),new Error(`Analytics API error: ${r.status} ${r.statusText}`)}}catch(r){let o=r instanceof Error?r.message:String(r);console.warn("[Slingshot Analytics] Request that caused error:",o),Ie(`EXCEPTION: ${o}`),r instanceof Error&&r.stack&&Ie(`Stack trace: ${r.stack}`),Je("Request that caused exception",s)}}import ou from"chalk";function xR(t,e){return{render(n){let i=` \u26AC _______. __ __ .__ __. _______
|
|
451
|
+
`;Ds.appendFileSync(zi,i)}catch{}}var $s=null;function oR(t){if(!t)return;let e=t.trim();if(e)return e.replace(/\/+$/,"")}var Se=class t{static{this.BASE_URL="base_url"}static{this.ANALYTICS_DOMAIN="analytics_domain"}static{this.CLIENT_ID="client_id"}static{this.PROJECT_ID="project_id"}static{this.WORKSPACE_ID="workspace_id"}static{this.defaultValues={[t.BASE_URL]:"https://sapientaiproducts.com",[t.ANALYTICS_DOMAIN]:"https://slingshot.sapientaiproducts.com",[t.CLIENT_ID]:"b97fbef7-cad9-4e56-9850-39e86c8fdf61",[t.PROJECT_ID]:"fa8121c4-e2fc-48f1-9478-8949c04e13cc",[t.WORKSPACE_ID]:"6e5756eb-d7e2-4d80-ad07-9d7a51600d85"}}static{this.LOGIN_PATH="/web/v1/studio-auth/login"}static{this.EXCHANGE_PATH="/api/v1/studio-auth/auth/desktop/exchange"}static{this.REFRESH_PATH="/api/v3/auth/refreshtoken"}static{this.REFRESH_CLIENT_NAME="machine"}static{this.API_BASE_PATH="/api/v1/llm"}static{this.SAGE_EVENTS_PATH="/api/v1/ai-portal/sage_events"}static{this.APP_TOKEN_PATH="/api/v3/auth/app-token"}static{this.CONFIG_SERVICE_PATH="/api/v2/configservice/client"}static{this.APP_TOKEN_REFRESH_BUFFER_MS=60*1e3}static{this.SLINGSHOT_APP_TOKEN_ENV="SLINGSHOT_APP_TOKEN_HEADER"}static{this.TOKEN_EXPIRY_BUFFER_MS=300*1e3}static{this.SAPI="/save/api/v1"}static{this.CLIENT_NAME="desktop"}static defaults(e){return this.defaultValues[e]}static getSettingsPath(){let e=tu.resolve(process.cwd(),".sling","sling.settings.json");if(Vi.existsSync(e))return e;let n=Pe();return tu.resolve(n,"sling.settings.json")}static getSettings(){if(!$s){let i=this.getSettingsPath();try{if(Vi.existsSync(i)){let s=Vi.readFileSync(i,"utf-8"),r=JSON.parse(s)||{};$s={...this.defaultValues,...r}}else{let s=tu.dirname(i);Vi.existsSync(s)||Vi.mkdirSync(s,{recursive:!0}),Vi.writeFileSync(i,JSON.stringify(this.defaultValues,null,2),"utf-8"),$s={...this.defaultValues}}}catch(s){Je("Error reading/writing sling.settings.json: ",s),$s={...this.defaultValues}}}let e=oR(process.env.SLINGSHOT_API_DOMAIN),n=oR(process.env.SLINGSHOT_ANALYTICS_DOMAIN);return{...$s,[t.BASE_URL]:e||$s[t.BASE_URL],[t.ANALYTICS_DOMAIN]:n||$s[t.ANALYTICS_DOMAIN]}}static updateSettings(e){let n=Pe(),i=tu.resolve(n,"sling.settings.json");try{let r={...this.getSettings()||{},...e},o=tu.dirname(i);Vi.existsSync(o)||Vi.mkdirSync(o,{recursive:!0}),Vi.writeFileSync(i,JSON.stringify(r,null,2),"utf-8"),$s=r}catch(s){Je("Error updating sling.settings.json: ",s)}}static getLoginUrl(e){let n=this.getSettings(),i=new URLSearchParams({client:this.CLIENT_NAME,port:String(e.port),localState:e.localState});return e.clientId&&i.set("clientId",e.clientId),`${n[t.BASE_URL]}${this.LOGIN_PATH}?${i.toString()}`}static getExchangeUrl(){return`${this.getSettings()[t.BASE_URL]}${this.EXCHANGE_PATH}`}static getRefreshUrl(){let e=this.getSettings(),n=new URLSearchParams({client:this.REFRESH_CLIENT_NAME});return`${e[t.BASE_URL]}${this.REFRESH_PATH}?${n.toString()}`}static getApiBaseUrl(){return`${this.getSettings()[t.BASE_URL]}${this.API_BASE_PATH}`}static getSageEventsUrl(){return`${this.getSettings()[t.ANALYTICS_DOMAIN]}${this.SAGE_EVENTS_PATH}`}static getTokenExpiryBuffer(){return this.TOKEN_EXPIRY_BUFFER_MS}static getDefaultProjectId(){let e=this.getSettings();return process.env.SLINGSHOT_PROJECT_ID||e[t.PROJECT_ID]}static getDefaultWorkspaceId(){let e=this.getSettings();return process.env.SLINGSHOT_WORKSPACE_ID||e[t.WORKSPACE_ID]}static getDefaultClientId(){let e=this.getSettings();return process.env.CLIENT_ID||e[t.CLIENT_ID]}static getUserActivityUrl(){return`${this.getSettings()[t.BASE_URL]}${this.SAPI}/users/activity`}static getUserUrl(){return`${this.getSettings()[t.BASE_URL]}${this.SAPI}/users`}static getAppTokenUrl(){return`${this.getSettings()[t.BASE_URL]}${this.APP_TOKEN_PATH}`}static getConfigServiceUrl(e){let n=this.getSettings(),i=this.getDefaultClientId(),s=new URLSearchParams({keys:e});return`${n[t.BASE_URL]}${this.CONFIG_SERVICE_PATH}/${i}?${s.toString()}`}static getAppTokenRefreshBuffer(){return this.APP_TOKEN_REFRESH_BUFFER_MS}};function nu(t){try{let e=t.split(".");if(e.length!==3)return 0;let n=JSON.parse(atob(e[1]));return n.exp?n.exp*1e3:0}catch{return 0}}function um(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function aR(){return`user_${um()}`}var Pb="Xq7Wm2zR9pLkVbN4cD8fH3jT6yG1sA5",I8=BigInt(Pb.length);function P8(t){if(t.length===0)return"";let e=0n;for(let i of t){let s=Pb.indexOf(i);if(s===-1)throw new Error(`Cannot decode app_key: character "${i}" is not in the expected alphabet`);e=e*I8+BigInt(s)}let n=[];for(;e>0n;)n.unshift(Number(e&0xffn)),e>>=8n;for(let i of t)if(i===Pb[0])n.unshift(0);else break;return new TextDecoder().decode(new Uint8Array(n))}var _b=new Map,dm=new Map;async function _8(t,e){let n=Se.getConfigServiceUrl(t);Ie(`sling-config: fetching ${n}`);let i;try{i=await fetch(n,{method:"GET",headers:{Accept:"application/json",Authorization:`Bearer ${e}`}})}catch(o){let a=o instanceof Error?o.message:String(o);throw new Error(`Cannot reach config service: ${a}`)}if(!i.ok){let o=`${i.status} ${i.statusText}`;try{let a=await i.json();a.message?o=String(a.message):a.error&&(o=String(a.error))}catch{}throw new Error(`Config service request failed: ${o}`)}let r=(await i.json())?.data?.config;if(!r||typeof r!="object")throw new Error("Config service response missing data.config");return r}async function cR(t,e){let n=_b.get(t);if(n)return n;let i=dm.get(t);if(i)return i;if(!e)throw new Error("Cannot reach config service: no Slingshot user token provided");let s=_8(t,e).then(r=>(_b.set(t,r),r)).finally(()=>{dm.delete(t)});return dm.set(t,s),s}var mc=class{static async getSlingcliConfig(e){let n=await cR("slingcli",e),i=n.slingcli;if(!i||typeof i.app_id!="string"||typeof i.app_key!="string"||!i.app_id||!i.app_key)throw Je("sling-config: missing slingcli block",n),new Error("Config service did not return slingcli.app_id / slingcli.app_key for this client");return{app_id:i.app_id,app_key:P8(i.app_key)}}static async getRemoteConfig(e,n){return cR(e,n)}static clearCache(){_b.clear(),dm=new Map}};import lR from"node:path";import Bs from"node:fs";var E8="sling.app-creds.json";function Eb(){return lR.resolve(Pe(),E8)}function uR(){let t=Eb();if(!Bs.existsSync(t))return null;try{let e=Bs.readFileSync(t,"utf-8"),n=JSON.parse(e);return typeof n.app_id!="string"||typeof n.app_key!="string"||!n.app_id||!n.app_key?(Je("app-creds-store: invalid creds file, ignoring",n),null):{app_id:n.app_id,app_key:n.app_key}}catch(e){return Je("app-creds-store: failed to read creds file",e),null}}function Ab(t){let e=Eb(),n=lR.dirname(e);try{Bs.existsSync(n)||Bs.mkdirSync(n,{recursive:!0});let i={...t,savedAt:Date.now()};Bs.writeFileSync(e,JSON.stringify(i,null,2),{encoding:"utf-8",mode:384});try{Bs.chmodSync(e,384)}catch{}Ie(`app-creds-store: persisted to ${e}`)}catch(i){Je("app-creds-store: failed to persist creds",i)}}function dR(){let t=Eb();try{Bs.existsSync(t)&&(Bs.unlinkSync(t),Ie(`app-creds-store: cleared ${t}`))}catch(e){Je("app-creds-store: failed to clear creds file",e)}}var mm=class extends Error{constructor(n,i){super(i);this.status=n;this.name="AppTokenHttpError"}},iu=null,su=null,pm=null,hc=null;function pR(t){process.env[Se.SLINGSHOT_APP_TOKEN_ENV]=`Bearer ${t}`}function A8(t){hc&&(clearTimeout(hc),hc=null);let e=t.expiresAt-Date.now();e<=0||(hc=setTimeout(()=>{hc=null,Ji().catch(n=>{Je("app-token: scheduled refresh failed",n)})},e),hc.unref?.())}async function mR(t){let e=Buffer.from(`${t.app_id}:${t.app_key}`).toString("base64"),n=Se.getAppTokenUrl();Ie(`app-token: minting from ${n}`);let i;try{i=await fetch(n,{method:"GET",headers:{Accept:"application/json",Authorization:`Basic ${e}`}})}catch(a){let c=a instanceof Error?a.message:String(a);throw new Error(`Cannot reach app-token service: ${c}`)}if(!i.ok){let a=`${i.status} ${i.statusText}`;try{let c=await i.text()||"";c&&(a=c)}catch{}throw new mm(i.status,`App token request failed: ${a}`)}let s=await i.json();if(!s.app_token||typeof s.expires_in!="number")throw new Error("App token response missing app_token or expires_in");let r=Se.getAppTokenRefreshBuffer(),o=Date.now()+s.expires_in*1e3-r;return Ie(`app-token: minted, expires at ${new Date(o).toISOString()}`),{token:s.app_token,expiresAt:o}}async function O8(){let t=uR();if(t)return{creds:t,fromDisk:!0};if(!su)throw new Error("Cannot mint app token: no on-disk app credentials and no Slingshot user token available (please /login slingshot first)");let e=await mc.getSlingcliConfig(su);return Ab(e),{creds:e,fromDisk:!1}}async function L8(){let{creds:t,fromDisk:e}=await O8();try{return await mR(t)}catch(n){let i=n instanceof mm&&(n.status===401||n.status===403);if(!e||!i)throw n;if(Je("app-token: disk creds rejected (likely rotated), refetching from config service",{status:n.status}),dR(),!su)throw new Error("Cannot rotate app credentials: on-disk creds rejected and no Slingshot user token available (please /login slingshot)");let s=await mc.getSlingcliConfig(su);return Ab(s),await mR(s)}}async function Ji(t){if(t&&(su=t),iu&&iu.expiresAt>Date.now())return pR(iu.token),iu.token;if(pm)return(await pm).token;let e=L8().then(i=>(iu=i,pR(i.token),A8(i),i)).finally(()=>{pm=null});return pm=e,(await e).token}var ru=null,Ob=null;typeof process<"u"&&process.versions?.node&&(Ob=import("node:http").then(t=>{ru=t.createServer}));async function W8(){if(ru||(Ob&&await Ob,ru))return ru;throw new Error("Slingshot OAuth requires Node.js")}async function Lb(t){let e=await W8(),n,i,s,r=!1,o=new Promise((u,d)=>{i=u,s=d}),a=u=>{if(!r){r=!0;try{n.close()}catch{}u()}};n=e((u,d)=>{let p=new URL(u.url||"","http://127.0.0.1"),m=p.searchParams.get("code"),g=p.searchParams.get("state"),h=p.searchParams.get("clientId"),f=p.searchParams.get("error"),x=p.searchParams.get("error_description");if(f){d.writeHead(400,{"Content-Type":"text/html"}),d.end(`<html><body><h1>Login Failed</h1><p>${x||f}</p><p>You can close this window.</p></body></html>`),a(()=>s(new Error(`Login failed: ${x||f}`)));return}if(!m||!g){d.writeHead(400,{"Content-Type":"text/html"}),d.end("<html><body><h1>Login Failed</h1><p>Missing code or state in callback.</p><p>You can close this window.</p></body></html>"),a(()=>s(new Error("Missing code or state in callback")));return}d.writeHead(200,{"Content-Type":"text/html"}),d.end("<html><body><h1>Login Successful</h1><p>You can close this window and return to your terminal.</p><script>setTimeout(()=>window.close(),3000)</script></body></html>"),a(()=>i({code:m,state:g,clientId:h||""}))}),n.on("error",u=>{a(()=>s(u))});let c=setTimeout(()=>{a(()=>s(new Error("Login timeout - no callback received within 5 minutes")))},300*1e3);return n.on("close",()=>clearTimeout(c)),t&&t.addEventListener("abort",()=>{a(()=>s(new Error("Login cancelled")))}),{port:await new Promise((u,d)=>{n.once("error",d),n.listen(0,"127.0.0.1",()=>{let p=n.address();p&&typeof p=="object"?u(p.port):d(new Error("Failed to obtain loopback server port"))})}),result:o}}async function Wb(t,e){if(!t)throw new Error("Missing exchange code");if(!e)throw new Error("Missing clientId for exchange");let n=Se.getExchangeUrl(),i;try{i=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json"},body:JSON.stringify({code:t,clientId:e})})}catch(r){let o=r instanceof Error?r.message:String(r);throw new Error(`Cannot reach Studio Auth: ${o}`)}if(!i.ok){let r,o=`${i.status} ${i.statusText}`;try{let a=await i.json();r=a.error?.code,a.error?.message?o=a.error.message:a.message?o=a.message:r&&(o=r)}catch{}throw r==="INVALID_CALLBACK"?new Error("Login failed: exchange code is expired, already used, or bound to a different tenant. Please log in again."):new Error(`Code exchange failed: ${o}`)}let s=await i.json();if(!s.accessToken||!s.refreshToken)throw new Error("Exchange response missing accessToken or refreshToken");return s}function U8(){return F8(16).toString("hex")}function D8(t){let e=new URL(t),n=e.searchParams.get("code"),i=e.searchParams.get("state"),s=e.searchParams.get("clientId");if(!n||!i)throw new Error("Pasted URL is missing code or state");return{code:n,state:i,clientId:s||""}}async function Fb(t){let e=process.env.SLINGSHOT_TOKEN;if(e){let u=nu(e);return Ie("Using Slingshot token from SLINGSHOT_TOKEN environment variable"),await Ji(e),{refresh:"",access:e,expires:u>0?u-Se.getTokenExpiryBuffer():Date.now()+10800*1e3,projectId:process.env.SLINGSHOT_PROJECT_ID,workspaceId:process.env.SLINGSHOT_WORKSPACE_ID}}let{port:n,result:i}=await Lb(t.signal),s=U8(),r=Se.getDefaultClientId(),o=Se.getLoginUrl({port:n,localState:s,clientId:r||void 0});t.onAuth({url:o});let a;if(t.onManualCodeInput){let u=t.onManualCodeInput().then(D8);a=await Promise.race([i,u])}else a=await i;if(a.state!==s)throw new Error("CSRF check failed - state does not match localState");if(!a.clientId)throw new Error("Login callback did not include clientId");let c=await Wb(a.code,a.clientId),l=nu(c.accessToken);return await Ji(c.accessToken),{refresh:c.refreshToken,access:c.accessToken,expires:l>0?l-Se.getTokenExpiryBuffer():Date.now()+10800*1e3,projectId:void 0,workspaceId:void 0}}import{randomUUID as $8}from"node:crypto";async function hm(t){if(!t.refresh)throw new Error("No refresh token available. Please login again.");let e;try{e=await Ji()}catch(a){throw Je("auth/refresh: app token unavailable for refresh call",a),new Error(`Cannot refresh Slingshot token: app token unavailable (${a instanceof Error?a.message:String(a)}). Please /login slingshot.`)}let n=$8(),i={accept:"application/json",rt:t.refresh,"trace-id":n,Authorization:`Bearer ${e}`},s;try{let a=Se.getRefreshUrl();s=await fetch(a,{headers:i})}catch(a){let c=a instanceof Error?a.message:String(a);throw new Error(`Cannot reach Slingshot server: ${c}`)}if(!s.ok){let a=`${s.status} ${s.statusText}`;try{let c=await s.json();c.message?a=String(c.message):c.error&&(a=String(c.error))}catch{}throw new Error(`Token refresh failed: ${a}`)}let r=await s.json();if(!r.accessToken)throw new Error("No access token in refresh response");let o=nu(r.accessToken);try{await Ji(r.accessToken)}catch(a){throw Je("auth/refresh: app token refresh failed",a),a}return{refresh:r.refreshToken||t.refresh,access:r.accessToken,expires:o>0?o-Se.getTokenExpiryBuffer():Date.now()+10800*1e3,projectId:t.projectId,workspaceId:t.workspaceId}}var hR=[{id:"gpt-5.4-nano",name:"GPT-5.4 nano",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:.2,output:1.25,cacheRead:.02,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,api:"openai-responses",provider:"slingshot"},{id:"gpt-4.1",name:"GPT-4.1",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:1047576,maxTokens:32768,provider:"slingshot",api:"openai-completions"},{id:"gpt-5",name:"GPT-5",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.125,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,provider:"slingshot",api:"openai-responses"},{id:"gpt-5-mini",name:"GPT-5 Mini",reasoning:!0,input:["text","image"],cost:{input:.25,output:2,cacheRead:.025,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,provider:"slingshot",api:"openai-responses"},{id:"gpt-5-nano",name:"GPT-5 Nano",reasoning:!0,input:["text","image"],cost:{input:.05,output:.4,cacheRead:.005,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,provider:"slingshot",api:"openai-responses"},{id:"gpt-5.1",name:"GPT-5.1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:.13,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,provider:"slingshot",api:"openai-responses"},{id:"gpt-5.2",name:"GPT-5.2",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,provider:"slingshot",api:"openai-responses"},{id:"gpt-5.4-mini",name:"GPT-5.4 mini",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:.75,output:4.5,cacheRead:.075,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,api:"openai-responses",provider:"slingshot"},{id:"gpt-5.4",name:"GPT-5.4",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:2.5,output:15,cacheRead:.25,cacheWrite:0},contextWindow:272e3,maxTokens:128e3,api:"openai-responses",provider:"slingshot"},{id:"gpt-5.5",name:"GPT-5.5",reasoning:!0,thinkingLevelMap:{xhigh:"xhigh"},input:["text","image"],cost:{input:5,output:30,cacheRead:.5,cacheWrite:0},contextWindow:272e3,maxTokens:128e3,api:"openai-responses",provider:"slingshot"},{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,provider:"slingshot",api:"openai-codex-responses"},{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:.175,cacheWrite:0},contextWindow:4e5,maxTokens:128e3,provider:"slingshot",api:"openai-codex-responses"},{id:"claude-opus-4@20250514",name:"Claude Opus 4",reasoning:!0,input:["text","image"],cost:{input:15,output:75,cacheRead:1.5,cacheWrite:18.75},contextWindow:2e5,maxTokens:32e3,provider:"slingshot",api:"openai-completions"},{id:"claude-sonnet-4@20250514",name:"Claude Sonnet 4",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3,provider:"slingshot",api:"openai-completions"},{id:"claude-sonnet-4-5@20250929",name:"Claude Sonnet 4.5",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:2e5,maxTokens:64e3,provider:"slingshot",api:"openai-completions"},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:64e3,provider:"slingshot",api:"openai-completions"},{id:"claude-opus-4-6",name:"Claude Opus 4.6",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:128e3,provider:"slingshot",api:"openai-completions"},{id:"o3",name:"O3",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:.5,cacheWrite:0},contextWindow:2e5,maxTokens:1e5,provider:"slingshot",api:"openai-completions"},{id:"o3-mini",name:"o3-mini",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.55,cacheWrite:0},contextWindow:2e5,maxTokens:1e5,provider:"slingshot",api:"openai-completions"},{id:"o4-mini",name:"o4-mini",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:.28,cacheWrite:0},contextWindow:2e5,maxTokens:1e5,provider:"slingshot",api:"openai-completions"},{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash",reasoning:!0,input:["text","image"],cost:{input:.3,output:2.5,cacheRead:.075,cacheWrite:0},contextWindow:1048576,maxTokens:65536,provider:"slingshot",api:"openai-completions"}];var $r={name:"slingshot.cli",private:!0,type:"module",workspaces:["packages/*","packages/web-ui/example","packages/coding-agent/examples/extensions/with-deps","packages/coding-agent/examples/extensions/custom-provider-anthropic","packages/coding-agent/examples/extensions/custom-provider-gitlab-duo"],scripts:{clean:"npm run clean --workspaces",build:"cd packages/tui && npm run build && cd ../ai && npm run build && cd ../agent && npm run build && cd ../coding-agent && npm run build && cd ../web-ui && npm run build",dev:'concurrently --names "ai,agent,coding-agent,web-ui,tui" --prefix-colors "cyan,yellow,red,white,green,magenta" "cd packages/ai && npm run dev" "cd packages/agent && npm run dev" "cd packages/coding-agent && npm run dev" "cd packages/web-ui && npm run dev" "cd packages/tui && npm run dev"',"dev:tsc":'concurrently --names "ai,web-ui" --prefix-colors "cyan,green" "cd packages/ai && npm run dev:tsc" "cd packages/web-ui && npm run dev:tsc"',check:"","check:browser-smoke":"","test:models":"node scripts/test-models.mjs","profile:tui":"node scripts/profile-coding-agent-node.mjs --mode tui","profile:rpc":"node scripts/profile-coding-agent-node.mjs --mode rpc",test:"npm run test --workspaces --if-present","version:patch":"npm version patch -ws --no-git-tag-version && node scripts/sync-versions.js && shx rm -rf node_modules packages/*/node_modules package-lock.json && npm install","version:minor":"npm version minor -ws --no-git-tag-version && node scripts/sync-versions.js && shx rm -rf node_modules packages/*/node_modules package-lock.json && npm install","version:major":"npm version major -ws --no-git-tag-version && node scripts/sync-versions.js && shx rm -rf node_modules packages/*/node_modules package-lock.json && npm install","version:set":"npm version -ws",prepublishOnly:"npm run clean && npm run build && npm run check",publish:"npm run prepublishOnly && npm publish -ws --access public","publish:dry":"npm run prepublishOnly && npm publish -ws --access public --dry-run","release:patch":"node scripts/release.mjs patch","release:minor":"node scripts/release.mjs minor","release:major":"node scripts/release.mjs major",prepare:"husky"},devDependencies:{"@anthropic-ai/sandbox-runtime":"0.0.26","@biomejs/biome":"2.3.5","@types/node":"22.19.19","@typescript/native-preview":"7.0.0-dev.20260120.1",concurrently:"^9.2.1",esbuild:"0.28.0",husky:"9.1.7",jiti:"2.7.0",shx:"0.4.0",tsx:"4.22.1",typescript:"5.9.3","@types/lodash.mergewith":"^4.6.9","fast-xml-parser":"^5.5.8",turbo:"^2.5.8",vitest:"^4.0.14"},engines:{node:">=20.0.0"},slingVersion:"2.5.20260617-1",overrides:{postcss:"8.5.14",next:{postcss:"8.5.14"},"ip-address":"^10.1.1","@modelcontextprotocol/sdk":"^1.29.0",ai:">=5.0.52","fast-xml-parser":"^5.5.8","@aws-sdk/xml-builder":{"fast-xml-parser":"^5.5.8"},"adaptivecards-templating":{"adaptive-expressions":{"fast-xml-parser":"^5.5.8"}},picomatch:"^4.0.4","path-to-regexp":"8.4.1",router:{"path-to-regexp":"8.4.1"},minimatch:"^10.2.3",tar:"7.5.11",react:"19.1.1","react-dom":"19.1.1","@types/react":"19","@types/react-dom":"19",tailwindcss:"4.1.12",lightningcss:"1.30.2",glob:{".":"11.1.0",minimatch:"10.2.3"},prismjs:"^1.30.0",qs:"^6.15.0","@hono/node-server":"1.19.14",protobufjs:"^8.2.0","@opentelemetry/otlp-transformer":{protobufjs:"^8.2.0"},langchain:{langsmith:">=0.7.0"},hono:"4.12.18",fsevents:"^2.3.3",swiper:"^12.1.2",lodash:"^4.18.0","lodash-es":"^4.18.1",axios:"^1.15.0","ibm-cloud-sdk-core":"^5.4.11",dompurify:">=3.4.0","react-markdown-mermaid":{mermaid:"10.9.6"}},dependencies:{"@modelcontextprotocol/sdk":"^1.29.0","@mozilla/readability":"^0.6.0","compound-engineering-pi":"^0.2.4","get-east-asian-width":"^1.4.0",linkedom:"^0.18.12",turndown:"^7.2.4",unpdf:"^1.6.2"}};var H_e=Se.getRefreshUrl(),z_e=Se.getApiBaseUrl(),V_e=Se.getSageEventsUrl(),J_e=Se.getTokenExpiryBuffer(),gR=Se.getDefaultProjectId(),fR=Se.getDefaultWorkspaceId(),bR=Se.getDefaultClientId();async function gm(t,e,n){let i=aR(),s=await e.modelRegistry.getApiKeyForProvider(e.model?.provider||"slingshot");if(!s){Ie("ERROR: No API key found");return}let r=s.startsWith("Bearer ")?s:`Bearer ${s}`,o=process.env.SLINGSHOT_PROJECT_ID||gR,a=process.env.SLINGSHOT_WORKSPACE_ID||fR,c=process.env.CLIENT_ID||bR,l={"Content-Type":"application/json",accept:"application/json","access-token":r,"x-project-id":o,"x-workspace-id":a,"x-client-id":c,"sage-trace-id":i,"User-Agent":"pi-slingshot/1.0.0"},u=parseFloat(process.env.SLINGSHOT_TEMPERATURE||"0.2"),d=parseFloat(process.env.SLINGSHOT_TOP_P||"0.8"),p={source:$r.name||"sling",ai_model_info:{ai_provider_name:e.model?.provider||"slingshot",sage_modl_name:e.model?.id||"unknown",sage_modl_option:{temperature:String(u),max_token_size:String(e.model?.maxTokens||16834),top_p:String(d)}},rag_info:{type:null,account_name:"dummy",project_names:[],repository_names:[],programming_language:null},tab_data:{tab_count:"1"},tags:null,slingshot_version:$r.slingVersion||"2.3.2",chat_type:"agent",...n||{}};return{headers:l,sageCommonData:p}}async function fm(t,e,n,i){let s={eventName:t,sageCommonData:n,eventData:i};Ie(`Sending analytics event: ${t} : `+Se.getSageEventsUrl());try{let r=await fetch(Se.getSageEventsUrl(),{method:"POST",headers:e,body:JSON.stringify(s)});if(r.ok){let o=await r.json().catch(()=>{});if(o.error_code)throw new Error(`Analytics API error: ${o.error_code} - ${o.error_message||"No message"}`);Ie(`'SUCCESS: Event sent: ${t}`),Ie(`Response: ${JSON.stringify(o)}`),Ie("\u2500".repeat(66))}else{let o=await r.text().catch(()=>""),a={status:r.status,statusText:r.statusText,responseBody:o,requestHeaders:e};throw Ie(`ERROR: ${r.status} ${r.statusText}`),Je("Error Details",a),Je("Failed Request Body",s),new Error(`Analytics API error: ${r.status} ${r.statusText}`)}}catch(r){let o=r instanceof Error?r.message:String(r);console.warn("[Slingshot Analytics] Request that caused error:",o),Ie(`EXCEPTION: ${o}`),r instanceof Error&&r.stack&&Ie(`Stack trace: ${r.stack}`),Je("Request that caused exception",s)}}import ou from"chalk";function xR(t,e){return{render(n){let i=` \u26AC _______. __ __ .__ __. _______
|
|
452
452
|
\u274D \xB7 \u274D / || | | | | \\ | | / _____|
|
|
453
453
|
\u2726 \u26AC \u2726 | (----\`| | | | | \\| | | | __
|
|
454
454
|
\u26AC \xB7 \u26AC \u26AC \xB7 \u26AC \\ \\ | | | | | . \` | | | |_ |
|