fix(ai): cap gpt-5.4 context windows to 272k

This commit is contained in:
Mario Zechner 2026-03-05 22:57:20 +01:00
parent f8d731a134
commit 16ec7de29c
2 changed files with 23 additions and 25 deletions

View file

@ -647,7 +647,10 @@ async function generateModels() {
const aiGatewayModels = await fetchAiGatewayModels();
// Combine models (models.dev has priority)
const allModels = [...modelsDevModels, ...openRouterModels, ...aiGatewayModels];
const allModels = [...modelsDevModels, ...openRouterModels, ...aiGatewayModels].filter(
(model) =>
!((model.provider === "opencode" || model.provider === "opencode-go") && model.id === "gpt-5.3-codex-spark"),
);
// Fix incorrect cache pricing for Claude Opus 4.5 from models.dev
// models.dev has 3x the correct pricing (1.5/18.75 instead of 0.5/6.25)
@ -685,6 +688,18 @@ async function generateModels() {
candidate.contextWindow = 272000;
candidate.maxTokens = 128000;
}
// Keep selected OpenRouter model metadata stable until upstream settles.
if (candidate.provider === "openrouter" && candidate.id === "moonshotai/kimi-k2.5") {
candidate.cost.input = 0.41;
candidate.cost.output = 2.06;
candidate.cost.cacheRead = 0.07;
candidate.maxTokens = 4096;
}
if (candidate.provider === "openrouter" && candidate.id === "z-ai/glm-5") {
candidate.cost.input = 0.6;
candidate.cost.output = 1.9;
candidate.cost.cacheRead = 0.119;
}
}

View file

@ -6155,23 +6155,6 @@ export const MODELS = {
contextWindow: 400000,
maxTokens: 128000,
} satisfies Model<"openai-responses">,
"gpt-5.3-codex-spark": {
id: "gpt-5.3-codex-spark",
name: "GPT-5.3 Codex Spark",
api: "openai-responses",
provider: "opencode",
baseUrl: "https://opencode.ai/zen/v1",
reasoning: true,
input: ["text"],
cost: {
input: 1.75,
output: 14,
cacheRead: 0.175,
cacheWrite: 0,
},
contextWindow: 128000,
maxTokens: 128000,
} satisfies Model<"openai-responses">,
"gpt-5.4": {
id: "gpt-5.4",
name: "GPT-5.4",
@ -8055,13 +8038,13 @@ export const MODELS = {
reasoning: true,
input: ["text", "image"],
cost: {
input: 0.44999999999999996,
output: 2.2,
cacheRead: 0.22499999999999998,
input: 0.41,
output: 2.06,
cacheRead: 0.07,
cacheWrite: 0,
},
contextWindow: 262144,
maxTokens: 65535,
maxTokens: 4096,
} satisfies Model<"openai-completions">,
"nex-agi/deepseek-v3.1-nex-n1": {
id: "nex-agi/deepseek-v3.1-nex-n1",
@ -10401,9 +10384,9 @@ export const MODELS = {
reasoning: true,
input: ["text"],
cost: {
input: 0.7999999999999999,
output: 2.56,
cacheRead: 0.16,
input: 0.6,
output: 1.9,
cacheRead: 0.119,
cacheWrite: 0,
},
contextWindow: 202752,