fix(ai): prevent removed xAI models regenerating, closes #6736

This commit is contained in:
Armin Ronacher
2026-07-16 20:07:36 +02:00
parent 78ff249436
commit c1b7856e26
11 changed files with 41 additions and 160 deletions
+8 -50
View File
@@ -302,6 +302,13 @@ const OPENAI_RESPONSES_NONE_REASONING_MODELS = new Set([
"gpt-5.6-luna",
]);
const XAI_RESPONSES_MODEL_ID = "grok-4.5";
const XAI_BUILTIN_EXCLUDED_MODEL_IDS = new Set([
"grok-3",
"grok-3-fast",
"grok-4.20-0309-non-reasoning",
"grok-4.20-0309-reasoning",
"grok-code-fast-1",
]);
const XAI_RESPONSES_EFFORT_LEVEL_MAP = {
off: null,
minimal: null,
@@ -1783,6 +1790,7 @@ async function generateModels() {
// Combine models (models.dev has priority)
const allModels = [...modelsDevModels, ...openRouterModels, ...aiGatewayModels].filter(
(model) =>
!(model.provider === "xai" && XAI_BUILTIN_EXCLUDED_MODEL_IDS.has(model.id)) &&
!((model.provider === "opencode" || model.provider === "opencode-go") && model.id === "gpt-5.3-codex-spark"),
);
@@ -2142,56 +2150,6 @@ async function generateModels() {
];
allModels.push(...codexModels);
// Add missing Grok models
const missingGrokModels: Model<"openai-completions">[] = [
{
id: "grok-3",
name: "Grok 3",
api: "openai-completions",
baseUrl: "https://api.x.ai/v1",
provider: "xai",
reasoning: false,
input: ["text"],
cost: { input: 3, output: 15, cacheRead: 0.75, cacheWrite: 0 },
contextWindow: 131072,
maxTokens: 8192,
},
{
id: "grok-3-fast",
name: "Grok 3 Fast",
api: "openai-completions",
baseUrl: "https://api.x.ai/v1",
provider: "xai",
reasoning: false,
input: ["text"],
cost: { input: 5, output: 25, cacheRead: 1.25, cacheWrite: 0 },
contextWindow: 131072,
maxTokens: 8192,
},
{
id: "grok-code-fast-1",
name: "Grok Code Fast 1",
api: "openai-completions",
baseUrl: "https://api.x.ai/v1",
provider: "xai",
reasoning: false,
input: ["text"],
cost: {
input: 0.2,
output: 1.5,
cacheRead: 0.02,
cacheWrite: 0,
},
contextWindow: 32768,
maxTokens: 8192,
},
];
for (const model of missingGrokModels) {
if (!allModels.some(m => m.provider === model.provider && m.id === model.id)) {
allModels.push(model);
}
}
// Add missing Mistral Medium 3.5 model until models.dev includes it
if (!allModels.some(m => m.provider === "mistral" && m.id === "mistral-medium-3.5")) {
allModels.push({