fix(coding-agent): bundle OAuth flows in Bun binaries

This commit is contained in:
Armin Ronacher
2026-07-16 15:36:16 +02:00
parent eb793510ad
commit 6442536b1e
8 changed files with 263 additions and 140 deletions
+4
View File
@@ -34,6 +34,10 @@
"./bedrock-provider": { "./bedrock-provider": {
"types": "./dist/bedrock-provider.d.ts", "types": "./dist/bedrock-provider.d.ts",
"import": "./dist/bedrock-provider.js" "import": "./dist/bedrock-provider.js"
},
"./bun-oauth": {
"types": "./dist/bun-oauth.d.ts",
"import": "./dist/bun-oauth.js"
} }
}, },
"bin": { "bin": {
+35 -10
View File
@@ -11,21 +11,46 @@ const importOAuthModule = (specifier: string): Promise<unknown> => {
return import(runtimeSpecifier); return import(runtimeSpecifier);
}; };
export const loadAnthropicOAuth = async (): Promise<OAuthAuth> => type OAuthFlowLoaders = {
((await importOAuthModule("./anthropic.ts")) as { anthropicOAuth: OAuthAuth }).anthropicOAuth; anthropic: () => OAuthAuth | Promise<OAuthAuth>;
openaiCodex: () => OAuthAuth | Promise<OAuthAuth>;
githubCopilot: () => OAuthAuth | Promise<OAuthAuth>;
xai: () => OAuthAuth | Promise<OAuthAuth>;
radius: (options: { name: string; gateway: string }) => OAuthAuth | Promise<OAuthAuth>;
};
export const loadOpenAICodexOAuth = async (): Promise<OAuthAuth> => let bundledLoaders: OAuthFlowLoaders | undefined;
((await importOAuthModule("./openai-codex.ts")) as { openaiCodexOAuth: OAuthAuth }).openaiCodexOAuth;
export const loadGitHubCopilotOAuth = async (): Promise<OAuthAuth> => /** Registers statically bundled OAuth flows for standalone Bun binaries. */
((await importOAuthModule("./github-copilot.ts")) as { githubCopilotOAuth: OAuthAuth }).githubCopilotOAuth; export function registerBundledOAuthFlowLoaders(loaders: OAuthFlowLoaders): void {
bundledLoaders = loaders;
}
export const loadXaiOAuth = async (): Promise<OAuthAuth> => export const loadAnthropicOAuth = async (): Promise<OAuthAuth> => {
((await importOAuthModule("./xai.ts")) as { xaiOAuth: OAuthAuth }).xaiOAuth; if (bundledLoaders) return bundledLoaders.anthropic();
return ((await importOAuthModule("./anthropic.ts")) as { anthropicOAuth: OAuthAuth }).anthropicOAuth;
};
export const loadRadiusOAuth = async (options: { name: string; gateway: string }): Promise<OAuthAuth> => export const loadOpenAICodexOAuth = async (): Promise<OAuthAuth> => {
( if (bundledLoaders) return bundledLoaders.openaiCodex();
return ((await importOAuthModule("./openai-codex.ts")) as { openaiCodexOAuth: OAuthAuth }).openaiCodexOAuth;
};
export const loadGitHubCopilotOAuth = async (): Promise<OAuthAuth> => {
if (bundledLoaders) return bundledLoaders.githubCopilot();
return ((await importOAuthModule("./github-copilot.ts")) as { githubCopilotOAuth: OAuthAuth }).githubCopilotOAuth;
};
export const loadXaiOAuth = async (): Promise<OAuthAuth> => {
if (bundledLoaders) return bundledLoaders.xai();
return ((await importOAuthModule("./xai.ts")) as { xaiOAuth: OAuthAuth }).xaiOAuth;
};
export const loadRadiusOAuth = async (options: { name: string; gateway: string }): Promise<OAuthAuth> => {
if (bundledLoaders) return bundledLoaders.radius(options);
return (
(await importOAuthModule("./radius.ts")) as { (await importOAuthModule("./radius.ts")) as {
createRadiusOAuth: (input: { name: string; gateway: string }) => OAuthAuth; createRadiusOAuth: (input: { name: string; gateway: string }) => OAuthAuth;
} }
).createRadiusOAuth(options); ).createRadiusOAuth(options);
};
+17
View File
@@ -0,0 +1,17 @@
import { anthropicOAuth } from "./auth/oauth/anthropic.ts";
import { githubCopilotOAuth } from "./auth/oauth/github-copilot.ts";
import { registerBundledOAuthFlowLoaders } from "./auth/oauth/load.ts";
import { openaiCodexOAuth } from "./auth/oauth/openai-codex.ts";
import { createRadiusOAuth } from "./auth/oauth/radius.ts";
import { xaiOAuth } from "./auth/oauth/xai.ts";
/** Register OAuth flows statically embedded in the standalone Bun binary. */
export function registerBunOAuthFlows(): void {
registerBundledOAuthFlowLoaders({
anthropic: () => anthropicOAuth,
openaiCodex: () => openaiCodexOAuth,
githubCopilot: () => githubCopilotOAuth,
xai: () => xaiOAuth,
radius: createRadiusOAuth,
});
}
@@ -40,6 +40,24 @@ export const KIMI_CODING_MODELS = {
contextWindow: 262144, contextWindow: 262144,
maxTokens: 32768, maxTokens: 32768,
} satisfies Model<"anthropic-messages">, } satisfies Model<"anthropic-messages">,
"kimi-for-coding-highspeed": {
id: "kimi-for-coding-highspeed",
name: "Kimi For Coding HighSpeed",
api: "anthropic-messages",
provider: "kimi-coding",
baseUrl: "https://api.kimi.com/coding",
headers: {"User-Agent":"KimiCLI/1.5"},
reasoning: true,
input: ["text", "image"],
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
contextWindow: 262144,
maxTokens: 32768,
} satisfies Model<"anthropic-messages">,
"kimi-k2-thinking": { "kimi-k2-thinking": {
id: "kimi-k2-thinking", id: "kimi-k2-thinking",
name: "Kimi K2 Thinking", name: "Kimi K2 Thinking",
+128 -128
View File
@@ -385,7 +385,7 @@ export const OPENROUTER_MODELS = {
cacheRead: 0.3, cacheRead: 0.3,
cacheWrite: 3.75, cacheWrite: 3.75,
}, },
contextWindow: 1000000, contextWindow: 200000,
maxTokens: 64000, maxTokens: 64000,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"anthropic/claude-sonnet-4.5": { "anthropic/claude-sonnet-4.5": {
@@ -652,13 +652,13 @@ export const OPENROUTER_MODELS = {
reasoning: false, reasoning: false,
input: ["text"], input: ["text"],
cost: { cost: {
input: 0.24, input: 0.27,
output: 0.9, output: 1.12,
cacheRead: 0.135, cacheRead: 0.135,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 163840, contextWindow: 163840,
maxTokens: 16384, maxTokens: 65536,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"deepseek/deepseek-chat-v3.1": { "deepseek/deepseek-chat-v3.1": {
id: "deepseek/deepseek-chat-v3.1", id: "deepseek/deepseek-chat-v3.1",
@@ -725,11 +725,11 @@ export const OPENROUTER_MODELS = {
input: ["text"], input: ["text"],
cost: { cost: {
input: 0.27, input: 0.27,
output: 0.95, output: 1,
cacheRead: 0.13, cacheRead: 0.135,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 163840, contextWindow: 131072,
maxTokens: 32768, maxTokens: 32768,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"deepseek/deepseek-v3.2": { "deepseek/deepseek-v3.2": {
@@ -742,13 +742,13 @@ export const OPENROUTER_MODELS = {
reasoning: true, reasoning: true,
input: ["text"], input: ["text"],
cost: { cost: {
input: 0.2145, input: 0.269,
output: 0.32175, output: 0.4,
cacheRead: 0.02145, cacheRead: 0.1345,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 128000, contextWindow: 163840,
maxTokens: 64000, maxTokens: 65536,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"deepseek/deepseek-v3.2-exp": { "deepseek/deepseek-v3.2-exp": {
id: "deepseek/deepseek-v3.2-exp", id: "deepseek/deepseek-v3.2-exp",
@@ -779,13 +779,13 @@ export const OPENROUTER_MODELS = {
thinkingLevelMap: {"minimal":null,"low":null,"medium":null,"high":"high","max":null,"xhigh":"xhigh"}, thinkingLevelMap: {"minimal":null,"low":null,"medium":null,"high":"high","max":null,"xhigh":"xhigh"},
input: ["text"], input: ["text"],
cost: { cost: {
input: 0.09, input: 0.098,
output: 0.18, output: 0.196,
cacheRead: 0.018, cacheRead: 0.02,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 1048576, contextWindow: 1048575,
maxTokens: 65536, maxTokens: 4096,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"deepseek/deepseek-v4-pro": { "deepseek/deepseek-v4-pro": {
id: "deepseek/deepseek-v4-pro", id: "deepseek/deepseek-v4-pro",
@@ -1051,12 +1051,12 @@ export const OPENROUTER_MODELS = {
input: ["text", "image"], input: ["text", "image"],
cost: { cost: {
input: 0.08, input: 0.08,
output: 0.16, output: 0.45,
cacheRead: 0, cacheRead: 0.04,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 131072, contextWindow: 131072,
maxTokens: 16384, maxTokens: 131072,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"google/gemma-4-26b-a4b-it": { "google/gemma-4-26b-a4b-it": {
id: "google/gemma-4-26b-a4b-it", id: "google/gemma-4-26b-a4b-it",
@@ -1068,13 +1068,13 @@ export const OPENROUTER_MODELS = {
reasoning: true, reasoning: true,
input: ["text", "image"], input: ["text", "image"],
cost: { cost: {
input: 0.06, input: 0.1,
output: 0.33, output: 0.3,
cacheRead: 0, cacheRead: 0,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 262144, contextWindow: 256000,
maxTokens: 4096, maxTokens: 256000,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"google/gemma-4-26b-a4b-it:free": { "google/gemma-4-26b-a4b-it:free": {
id: "google/gemma-4-26b-a4b-it:free", id: "google/gemma-4-26b-a4b-it:free",
@@ -1104,13 +1104,13 @@ export const OPENROUTER_MODELS = {
reasoning: true, reasoning: true,
input: ["text", "image"], input: ["text", "image"],
cost: { cost: {
input: 0.06, input: 0.22,
output: 0.35, output: 0.55,
cacheRead: 0, cacheRead: 0.12,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 262144, contextWindow: 262144,
maxTokens: 8192, maxTokens: 262144,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"google/gemma-4-31b-it:free": { "google/gemma-4-31b-it:free": {
id: "google/gemma-4-31b-it:free", id: "google/gemma-4-31b-it:free",
@@ -1303,13 +1303,13 @@ export const OPENROUTER_MODELS = {
reasoning: false, reasoning: false,
input: ["text"], input: ["text"],
cost: { cost: {
input: 0.02, input: 0.05,
output: 0.03, output: 0.08,
cacheRead: 0, cacheRead: 0.025,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 131072, contextWindow: 131072,
maxTokens: 16384, maxTokens: 131072,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"meta-llama/llama-3.3-70b-instruct": { "meta-llama/llama-3.3-70b-instruct": {
id: "meta-llama/llama-3.3-70b-instruct", id: "meta-llama/llama-3.3-70b-instruct",
@@ -1321,13 +1321,13 @@ export const OPENROUTER_MODELS = {
reasoning: false, reasoning: false,
input: ["text"], input: ["text"],
cost: { cost: {
input: 0.1, input: 0.13,
output: 0.32, output: 0.4,
cacheRead: 0, cacheRead: 0,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 131072, contextWindow: 131072,
maxTokens: 16384, maxTokens: 128000,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"meta-llama/llama-3.3-70b-instruct:free": { "meta-llama/llama-3.3-70b-instruct:free": {
id: "meta-llama/llama-3.3-70b-instruct:free", id: "meta-llama/llama-3.3-70b-instruct:free",
@@ -1393,7 +1393,7 @@ export const OPENROUTER_MODELS = {
reasoning: true, reasoning: true,
input: ["text"], input: ["text"],
cost: { cost: {
input: 0.4, input: 0.55,
output: 2.2, output: 2.2,
cacheRead: 0, cacheRead: 0,
cacheWrite: 0, cacheWrite: 0,
@@ -1465,13 +1465,13 @@ export const OPENROUTER_MODELS = {
reasoning: true, reasoning: true,
input: ["text"], input: ["text"],
cost: { cost: {
input: 0.24, input: 0.3,
output: 0.96, output: 1.2,
cacheRead: 0, cacheRead: 0.06,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 196608, contextWindow: 204800,
maxTokens: 196608, maxTokens: 131072,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"minimax/minimax-m3": { "minimax/minimax-m3": {
id: "minimax/minimax-m3", id: "minimax/minimax-m3",
@@ -1488,8 +1488,8 @@ export const OPENROUTER_MODELS = {
cacheRead: 0.06, cacheRead: 0.06,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 1000000, contextWindow: 524288,
maxTokens: 131072, maxTokens: 512000,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"mistralai/codestral-2508": { "mistralai/codestral-2508": {
id: "mistralai/codestral-2508", id: "mistralai/codestral-2508",
@@ -1700,12 +1700,12 @@ export const OPENROUTER_MODELS = {
input: ["text"], input: ["text"],
cost: { cost: {
input: 0.02, input: 0.02,
output: 0.03, output: 0.04,
cacheRead: 0, cacheRead: 0,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 131072, contextWindow: 131072,
maxTokens: 4096, maxTokens: 16384,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"mistralai/mistral-saba": { "mistralai/mistral-saba": {
id: "mistralai/mistral-saba", id: "mistralai/mistral-saba",
@@ -1753,13 +1753,13 @@ export const OPENROUTER_MODELS = {
reasoning: false, reasoning: false,
input: ["text", "image"], input: ["text", "image"],
cost: { cost: {
input: 0.075, input: 0.1,
output: 0.2, output: 0.3,
cacheRead: 0, cacheRead: 0.01,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 128000, contextWindow: 131072,
maxTokens: 16384, maxTokens: 4096,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"mistralai/mixtral-8x22b-instruct": { "mistralai/mixtral-8x22b-instruct": {
id: "mistralai/mixtral-8x22b-instruct", id: "mistralai/mixtral-8x22b-instruct",
@@ -1845,11 +1845,11 @@ export const OPENROUTER_MODELS = {
cost: { cost: {
input: 0.6, input: 0.6,
output: 2.5, output: 2.5,
cacheRead: 0.15, cacheRead: 0,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 262144, contextWindow: 262144,
maxTokens: 100352, maxTokens: 262144,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"moonshotai/kimi-k2.5": { "moonshotai/kimi-k2.5": {
id: "moonshotai/kimi-k2.5", id: "moonshotai/kimi-k2.5",
@@ -1879,13 +1879,13 @@ export const OPENROUTER_MODELS = {
reasoning: true, reasoning: true,
input: ["text", "image"], input: ["text", "image"],
cost: { cost: {
input: 0.66, input: 0.95,
output: 3.41, output: 4,
cacheRead: 0.15, cacheRead: 0.16,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 262144, contextWindow: 262144,
maxTokens: 262144, maxTokens: 4096,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"moonshotai/kimi-k2.7-code": { "moonshotai/kimi-k2.7-code": {
id: "moonshotai/kimi-k2.7-code", id: "moonshotai/kimi-k2.7-code",
@@ -2023,12 +2023,12 @@ export const OPENROUTER_MODELS = {
reasoning: true, reasoning: true,
input: ["text"], input: ["text"],
cost: { cost: {
input: 0.08, input: 0.21,
output: 0.45, output: 0.455,
cacheRead: 0, cacheRead: 0.06,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 262144, contextWindow: 1000000,
maxTokens: 4096, maxTokens: 4096,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"nvidia/nemotron-3-super-120b-a12b:free": { "nvidia/nemotron-3-super-120b-a12b:free": {
@@ -2059,13 +2059,13 @@ export const OPENROUTER_MODELS = {
reasoning: true, reasoning: true,
input: ["text"], input: ["text"],
cost: { cost: {
input: 0.5, input: 0.6,
output: 2.2, output: 3.6,
cacheRead: 0.1, cacheRead: 0.2,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 262144, contextWindow: 512288,
maxTokens: 16384, maxTokens: 4096,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"nvidia/nemotron-3-ultra-550b-a55b:free": { "nvidia/nemotron-3-ultra-550b-a55b:free": {
id: "nvidia/nemotron-3-ultra-550b-a55b:free", id: "nvidia/nemotron-3-ultra-550b-a55b:free",
@@ -2245,7 +2245,7 @@ export const OPENROUTER_MODELS = {
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 1047576, contextWindow: 1047576,
maxTokens: 4096, maxTokens: 32768,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"openai/gpt-4.1-mini": { "openai/gpt-4.1-mini": {
id: "openai/gpt-4.1-mini", id: "openai/gpt-4.1-mini",
@@ -2295,7 +2295,7 @@ export const OPENROUTER_MODELS = {
cost: { cost: {
input: 2.5, input: 2.5,
output: 10, output: 10,
cacheRead: 0, cacheRead: 1.25,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 128000, contextWindow: 128000,
@@ -2511,11 +2511,11 @@ export const OPENROUTER_MODELS = {
cost: { cost: {
input: 1.25, input: 1.25,
output: 10, output: 10,
cacheRead: 0.13, cacheRead: 0.125,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 128000, contextWindow: 128000,
maxTokens: 32000, maxTokens: 16384,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"openai/gpt-5.1-codex": { "openai/gpt-5.1-codex": {
id: "openai/gpt-5.1-codex", id: "openai/gpt-5.1-codex",
@@ -2529,7 +2529,7 @@ export const OPENROUTER_MODELS = {
cost: { cost: {
input: 1.25, input: 1.25,
output: 10, output: 10,
cacheRead: 0.13, cacheRead: 0.125,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 400000, contextWindow: 400000,
@@ -2977,8 +2977,8 @@ export const OPENROUTER_MODELS = {
reasoning: true, reasoning: true,
input: ["text"], input: ["text"],
cost: { cost: {
input: 0.03, input: 0.037,
output: 0.15, output: 0.17,
cacheRead: 0, cacheRead: 0,
cacheWrite: 0, cacheWrite: 0,
}, },
@@ -2995,13 +2995,13 @@ export const OPENROUTER_MODELS = {
reasoning: true, reasoning: true,
input: ["text"], input: ["text"],
cost: { cost: {
input: 0.029, input: 0.03,
output: 0.14, output: 0.13,
cacheRead: 0, cacheRead: 0.03,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 131072, contextWindow: 131072,
maxTokens: 4096, maxTokens: 131072,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"openai/gpt-oss-20b:free": { "openai/gpt-oss-20b:free": {
id: "openai/gpt-oss-20b:free", id: "openai/gpt-oss-20b:free",
@@ -3517,13 +3517,13 @@ export const OPENROUTER_MODELS = {
reasoning: false, reasoning: false,
input: ["text"], input: ["text"],
cost: { cost: {
input: 0.04815, input: 0.1,
output: 0.19305, output: 0.3,
cacheRead: 0, cacheRead: 0,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 128000, contextWindow: 262144,
maxTokens: 32000, maxTokens: 4096,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"qwen/qwen3-30b-a3b-thinking-2507": { "qwen/qwen3-30b-a3b-thinking-2507": {
id: "qwen/qwen3-30b-a3b-thinking-2507", id: "qwen/qwen3-30b-a3b-thinking-2507",
@@ -3589,9 +3589,9 @@ export const OPENROUTER_MODELS = {
reasoning: false, reasoning: false,
input: ["text"], input: ["text"],
cost: { cost: {
input: 0.22, input: 0.3,
output: 1.8, output: 1,
cacheRead: 0, cacheRead: 0.1,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 262144, contextWindow: 262144,
@@ -3733,13 +3733,13 @@ export const OPENROUTER_MODELS = {
reasoning: false, reasoning: false,
input: ["text"], input: ["text"],
cost: { cost: {
input: 0.09, input: 0.1,
output: 1.1, output: 1.1,
cacheRead: 0, cacheRead: 0.07,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 262144, contextWindow: 262144,
maxTokens: 16384, maxTokens: 262144,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"qwen/qwen3-next-80b-a3b-instruct:free": { "qwen/qwen3-next-80b-a3b-instruct:free": {
id: "qwen/qwen3-next-80b-a3b-instruct:free", id: "qwen/qwen3-next-80b-a3b-instruct:free",
@@ -3787,13 +3787,13 @@ export const OPENROUTER_MODELS = {
reasoning: false, reasoning: false,
input: ["text", "image"], input: ["text", "image"],
cost: { cost: {
input: 0.2, input: 0.21,
output: 0.88, output: 1.9,
cacheRead: 0.11, cacheRead: 0.1,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 262144, contextWindow: 131072,
maxTokens: 16384, maxTokens: 32768,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"qwen/qwen3-vl-235b-a22b-thinking": { "qwen/qwen3-vl-235b-a22b-thinking": {
id: "qwen/qwen3-vl-235b-a22b-thinking", id: "qwen/qwen3-vl-235b-a22b-thinking",
@@ -3919,7 +3919,7 @@ export const OPENROUTER_MODELS = {
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 262144, contextWindow: 262144,
maxTokens: 262144, maxTokens: 65536,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"qwen/qwen3.5-27b": { "qwen/qwen3.5-27b": {
id: "qwen/qwen3.5-27b", id: "qwen/qwen3.5-27b",
@@ -3951,11 +3951,11 @@ export const OPENROUTER_MODELS = {
cost: { cost: {
input: 0.14, input: 0.14,
output: 1, output: 1,
cacheRead: 0.05, cacheRead: 0,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 262144, contextWindow: 262144,
maxTokens: 81920, maxTokens: 262144,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"qwen/qwen3.5-397b-a17b": { "qwen/qwen3.5-397b-a17b": {
id: "qwen/qwen3.5-397b-a17b", id: "qwen/qwen3.5-397b-a17b",
@@ -3967,13 +3967,13 @@ export const OPENROUTER_MODELS = {
reasoning: true, reasoning: true,
input: ["text", "image"], input: ["text", "image"],
cost: { cost: {
input: 0.385, input: 0.45,
output: 2.45, output: 3,
cacheRead: 0.111, cacheRead: 0.225,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 131072, contextWindow: 262144,
maxTokens: 4096, maxTokens: 65536,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"qwen/qwen3.5-9b": { "qwen/qwen3.5-9b": {
id: "qwen/qwen3.5-9b", id: "qwen/qwen3.5-9b",
@@ -4057,13 +4057,13 @@ export const OPENROUTER_MODELS = {
reasoning: true, reasoning: true,
input: ["text", "image"], input: ["text", "image"],
cost: { cost: {
input: 0.289, input: 0.45,
output: 2.4, output: 2.7,
cacheRead: 0, cacheRead: 0,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 131072, contextWindow: 262144,
maxTokens: 131072, maxTokens: 65536,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"qwen/qwen3.6-35b-a3b": { "qwen/qwen3.6-35b-a3b": {
id: "qwen/qwen3.6-35b-a3b", id: "qwen/qwen3.6-35b-a3b",
@@ -4147,10 +4147,10 @@ export const OPENROUTER_MODELS = {
reasoning: true, reasoning: true,
input: ["text"], input: ["text"],
cost: { cost: {
input: 1.25, input: 1.475,
output: 3.75, output: 4.425,
cacheRead: 0.25, cacheRead: 0.295,
cacheWrite: 1.5625, cacheWrite: 1.84375,
}, },
contextWindow: 1000000, contextWindow: 1000000,
maxTokens: 65536, maxTokens: 65536,
@@ -4291,13 +4291,13 @@ export const OPENROUTER_MODELS = {
reasoning: true, reasoning: true,
input: ["text"], input: ["text"],
cost: { cost: {
input: 0.14, input: 0.2,
output: 0.58, output: 0.8,
cacheRead: 0.035, cacheRead: 0.05,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 262144, contextWindow: 262144,
maxTokens: 4096, maxTokens: 131072,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"tencent/hy3-preview": { "tencent/hy3-preview": {
id: "tencent/hy3-preview", id: "tencent/hy3-preview",
@@ -4453,13 +4453,13 @@ export const OPENROUTER_MODELS = {
reasoning: true, reasoning: true,
input: ["text", "image"], input: ["text", "image"],
cost: { cost: {
input: 0.105, input: 0.14,
output: 0.28, output: 0.28,
cacheRead: 0.028, cacheRead: 0.0028,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 262144, contextWindow: 1048576,
maxTokens: 4096, maxTokens: 131072,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"xiaomi/mimo-v2.5-pro": { "xiaomi/mimo-v2.5-pro": {
id: "xiaomi/mimo-v2.5-pro", id: "xiaomi/mimo-v2.5-pro",
@@ -4543,13 +4543,13 @@ export const OPENROUTER_MODELS = {
reasoning: true, reasoning: true,
input: ["text"], input: ["text"],
cost: { cost: {
input: 0.43, input: 0.5,
output: 1.75, output: 2,
cacheRead: 0.08, cacheRead: 0.1,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 198000, contextWindow: 202752,
maxTokens: 16384, maxTokens: 131072,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"z-ai/glm-4.6v": { "z-ai/glm-4.6v": {
id: "z-ai/glm-4.6v", id: "z-ai/glm-4.6v",
@@ -4620,8 +4620,8 @@ export const OPENROUTER_MODELS = {
cacheRead: 0.119, cacheRead: 0.119,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 198000, contextWindow: 202752,
maxTokens: 128000, maxTokens: 202752,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"z-ai/glm-5-turbo": { "z-ai/glm-5-turbo": {
id: "z-ai/glm-5-turbo", id: "z-ai/glm-5-turbo",
@@ -4638,7 +4638,7 @@ export const OPENROUTER_MODELS = {
cacheRead: 0.24, cacheRead: 0.24,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 262144, contextWindow: 202752,
maxTokens: 131072, maxTokens: 131072,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"z-ai/glm-5.1": { "z-ai/glm-5.1": {
@@ -4670,13 +4670,13 @@ export const OPENROUTER_MODELS = {
thinkingLevelMap: {"xhigh":"xhigh"}, thinkingLevelMap: {"xhigh":"xhigh"},
input: ["text"], input: ["text"],
cost: { cost: {
input: 0.924, input: 0.9464,
output: 2.904, output: 2.9744,
cacheRead: 0.1716, cacheRead: 0.17576,
cacheWrite: 0, cacheWrite: 0,
}, },
contextWindow: 1024000, contextWindow: 1048576,
maxTokens: 128000, maxTokens: 131072,
} satisfies Model<"openai-completions">, } satisfies Model<"openai-completions">,
"z-ai/glm-5v-turbo": { "z-ai/glm-5v-turbo": {
id: "z-ai/glm-5v-turbo", id: "z-ai/glm-5v-turbo",
@@ -622,6 +622,25 @@ export const VERCEL_AI_GATEWAY_MODELS = {
contextWindow: 1000000, contextWindow: 1000000,
maxTokens: 128000, maxTokens: 128000,
} satisfies Model<"anthropic-messages">, } satisfies Model<"anthropic-messages">,
"anthropic/claude-opus-4.7-fast": {
id: "anthropic/claude-opus-4.7-fast",
name: "Claude Opus 4.7 (Fast)",
api: "anthropic-messages",
provider: "vercel-ai-gateway",
baseUrl: "https://ai-gateway.vercel.sh",
compat: {"forceAdaptiveThinking":true,"supportsTemperature":false},
reasoning: true,
thinkingLevelMap: {"xhigh":"xhigh","max":"max"},
input: ["text", "image"],
cost: {
input: 30,
output: 150,
cacheRead: 3,
cacheWrite: 37.5,
},
contextWindow: 1000000,
maxTokens: 128000,
} satisfies Model<"anthropic-messages">,
"anthropic/claude-opus-4.8": { "anthropic/claude-opus-4.8": {
id: "anthropic/claude-opus-4.8", id: "anthropic/claude-opus-4.8",
name: "Claude Opus 4.8", name: "Claude Opus 4.8",
@@ -641,6 +660,25 @@ export const VERCEL_AI_GATEWAY_MODELS = {
contextWindow: 1000000, contextWindow: 1000000,
maxTokens: 128000, maxTokens: 128000,
} satisfies Model<"anthropic-messages">, } satisfies Model<"anthropic-messages">,
"anthropic/claude-opus-4.8-fast": {
id: "anthropic/claude-opus-4.8-fast",
name: "Claude Opus 4.8 (Fast)",
api: "anthropic-messages",
provider: "vercel-ai-gateway",
baseUrl: "https://ai-gateway.vercel.sh",
compat: {"forceAdaptiveThinking":true,"supportsTemperature":false},
reasoning: true,
thinkingLevelMap: {"xhigh":"xhigh","max":"max"},
input: ["text", "image"],
cost: {
input: 10,
output: 50,
cacheRead: 1,
cacheWrite: 12.5,
},
contextWindow: 1000000,
maxTokens: 128000,
} satisfies Model<"anthropic-messages">,
"anthropic/claude-sonnet-4": { "anthropic/claude-sonnet-4": {
id: "anthropic/claude-sonnet-4", id: "anthropic/claude-sonnet-4",
name: "Claude Sonnet 4", name: "Claude Sonnet 4",
@@ -841,8 +879,8 @@ export const VERCEL_AI_GATEWAY_MODELS = {
reasoning: true, reasoning: true,
input: ["text"], input: ["text"],
cost: { cost: {
input: 0.21, input: 0.25,
output: 0.79, output: 0.95,
cacheRead: 0.13, cacheRead: 0.13,
cacheWrite: 0, cacheWrite: 0,
}, },
@@ -2717,6 +2755,23 @@ export const VERCEL_AI_GATEWAY_MODELS = {
contextWindow: 256000, contextWindow: 256000,
maxTokens: 256000, maxTokens: 256000,
} satisfies Model<"anthropic-messages">, } satisfies Model<"anthropic-messages">,
"thinkingmachines/inkling": {
id: "thinkingmachines/inkling",
name: "Inkling",
api: "anthropic-messages",
provider: "vercel-ai-gateway",
baseUrl: "https://ai-gateway.vercel.sh",
reasoning: true,
input: ["text", "image"],
cost: {
input: 1,
output: 4.05,
cacheRead: 0.17,
cacheWrite: 0,
},
contextWindow: 256000,
maxTokens: 256000,
} satisfies Model<"anthropic-messages">,
"xai/grok-4.1-fast-non-reasoning": { "xai/grok-4.1-fast-non-reasoning": {
id: "xai/grok-4.1-fast-non-reasoning", id: "xai/grok-4.1-fast-non-reasoning",
name: "Grok 4.1 Fast Non-Reasoning", name: "Grok 4.1 Fast Non-Reasoning",
+1
View File
@@ -38,6 +38,7 @@
- Fixed inherited OpenAI Codex session IDs longer than 64 characters to meet the API limit ([#6630](https://github.com/earendil-works/pi-mono/issues/6630)). - Fixed inherited OpenAI Codex session IDs longer than 64 characters to meet the API limit ([#6630](https://github.com/earendil-works/pi-mono/issues/6630)).
- Fixed inherited terminal output to normalize tab characters consistently ([#6697](https://github.com/earendil-works/pi-mono/pull/6697) by [@xz-dev](https://github.com/xz-dev)). - Fixed inherited terminal output to normalize tab characters consistently ([#6697](https://github.com/earendil-works/pi-mono/pull/6697) by [@xz-dev](https://github.com/xz-dev)).
- Fixed the Windows terminal title after checking npm packages ([#6629](https://github.com/earendil-works/pi-mono/issues/6629)). - Fixed the Windows terminal title after checking npm packages ([#6629](https://github.com/earendil-works/pi-mono/issues/6629)).
- Fixed Bun standalone binaries to bundle OAuth adapters for interactive logins.
## [0.80.7] - 2026-07-14 ## [0.80.7] - 2026-07-14
+3
View File
@@ -1,9 +1,12 @@
#!/usr/bin/env node #!/usr/bin/env node
import { registerBunOAuthFlows } from "@earendil-works/pi-ai/bun-oauth";
import { APP_NAME } from "../config.ts"; import { APP_NAME } from "../config.ts";
process.title = APP_NAME; process.title = APP_NAME;
process.emitWarning = (() => {}) as typeof process.emitWarning; process.emitWarning = (() => {}) as typeof process.emitWarning;
registerBunOAuthFlows();
import { restoreSandboxEnv } from "./restore-sandbox-env.ts"; import { restoreSandboxEnv } from "./restore-sandbox-env.ts";
restoreSandboxEnv(); restoreSandboxEnv();