fix(ai): remove stale model metadata fallbacks
This commit is contained in:
@@ -68,8 +68,6 @@ const KIMI_STATIC_HEADERS = {
|
||||
"User-Agent": "KimiCLI/1.5",
|
||||
} as const;
|
||||
|
||||
const MOONSHOT_CN_MIRRORED_MODEL_IDS = new Set(["kimi-k2.7-code", "kimi-k2.7-code-highspeed"]);
|
||||
|
||||
const TOGETHER_BASE_URL = "https://api.together.ai/v1";
|
||||
const TOGETHER_BASE_COMPAT: OpenAICompletionsCompat = {
|
||||
supportsStore: false,
|
||||
@@ -1502,16 +1500,6 @@ async function loadModelsDevData(): Promise<Model<any>[]> {
|
||||
"moonshotai-cn": getMoonshotProviderModels("moonshotai-cn"),
|
||||
};
|
||||
|
||||
// models.dev can lag the CN catalog while the global Moonshot catalog already
|
||||
// has the model. Mirror selected current model IDs into moonshotai-cn until
|
||||
// upstream CN metadata catches up.
|
||||
for (const modelId of MOONSHOT_CN_MIRRORED_MODEL_IDS) {
|
||||
const model = moonshotModels.moonshotai[modelId];
|
||||
if (model && !moonshotModels["moonshotai-cn"][modelId]) {
|
||||
moonshotModels["moonshotai-cn"][modelId] = model;
|
||||
}
|
||||
}
|
||||
|
||||
for (const { key, provider, baseUrl } of moonshotVariants) {
|
||||
for (const [modelId, m] of Object.entries(moonshotModels[key])) {
|
||||
if (m.tool_call !== true) continue;
|
||||
@@ -1604,20 +1592,8 @@ async function generateModels() {
|
||||
!((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)
|
||||
const opus45 = allModels.find(m => m.provider === "anthropic" && m.id === "claude-opus-4-5");
|
||||
if (opus45) {
|
||||
opus45.cost.cacheRead = 0.5;
|
||||
opus45.cost.cacheWrite = 6.25;
|
||||
}
|
||||
|
||||
// Temporary overrides until upstream model metadata is corrected.
|
||||
for (const candidate of allModels) {
|
||||
if (candidate.provider === "amazon-bedrock" && candidate.id.includes("anthropic.claude-opus-4-6-v1")) {
|
||||
candidate.cost.cacheRead = 0.5;
|
||||
candidate.cost.cacheWrite = 6.25;
|
||||
}
|
||||
if (
|
||||
(candidate.provider === "anthropic" ||
|
||||
candidate.provider === "opencode" ||
|
||||
@@ -1678,132 +1654,6 @@ async function generateModels() {
|
||||
}
|
||||
|
||||
|
||||
// Add missing EU Opus 4.6 profile
|
||||
if (!allModels.some((m) => m.provider === "amazon-bedrock" && m.id === "eu.anthropic.claude-opus-4-6-v1")) {
|
||||
allModels.push({
|
||||
id: "eu.anthropic.claude-opus-4-6-v1",
|
||||
name: "Claude Opus 4.6 (EU)",
|
||||
api: "bedrock-converse-stream",
|
||||
provider: "amazon-bedrock",
|
||||
baseUrl: getBedrockBaseUrl("eu.anthropic.claude-opus-4-6-v1"),
|
||||
reasoning: true,
|
||||
input: ["text", "image"],
|
||||
cost: {
|
||||
input: 5,
|
||||
output: 25,
|
||||
cacheRead: 0.5,
|
||||
cacheWrite: 6.25,
|
||||
},
|
||||
contextWindow: 200000,
|
||||
maxTokens: 128000,
|
||||
});
|
||||
}
|
||||
|
||||
// Add missing Claude Opus 4.6
|
||||
if (!allModels.some(m => m.provider === "anthropic" && m.id === "claude-opus-4-6")) {
|
||||
allModels.push({
|
||||
id: "claude-opus-4-6",
|
||||
name: "Claude Opus 4.6",
|
||||
api: "anthropic-messages",
|
||||
baseUrl: "https://api.anthropic.com",
|
||||
provider: "anthropic",
|
||||
reasoning: true,
|
||||
input: ["text", "image"],
|
||||
cost: {
|
||||
input: 5,
|
||||
output: 25,
|
||||
cacheRead: 0.5,
|
||||
cacheWrite: 6.25,
|
||||
},
|
||||
contextWindow: 1000000,
|
||||
maxTokens: 128000,
|
||||
});
|
||||
}
|
||||
|
||||
// Add missing Claude Opus 4.7
|
||||
if (!allModels.some(m => m.provider === "anthropic" && m.id === "claude-opus-4-7")) {
|
||||
allModels.push({
|
||||
id: "claude-opus-4-7",
|
||||
name: "Claude Opus 4.7",
|
||||
api: "anthropic-messages",
|
||||
baseUrl: "https://api.anthropic.com",
|
||||
provider: "anthropic",
|
||||
reasoning: true,
|
||||
input: ["text", "image"],
|
||||
cost: {
|
||||
input: 5,
|
||||
output: 25,
|
||||
cacheRead: 0.5,
|
||||
cacheWrite: 6.25,
|
||||
},
|
||||
contextWindow: 1000000,
|
||||
maxTokens: 128000,
|
||||
});
|
||||
}
|
||||
|
||||
// Add missing Claude Opus 4.8
|
||||
if (!allModels.some(m => m.provider === "anthropic" && m.id === "claude-opus-4-8")) {
|
||||
allModels.push({
|
||||
id: "claude-opus-4-8",
|
||||
name: "Claude Opus 4.8",
|
||||
api: "anthropic-messages",
|
||||
baseUrl: "https://api.anthropic.com",
|
||||
provider: "anthropic",
|
||||
reasoning: true,
|
||||
input: ["text", "image"],
|
||||
cost: {
|
||||
input: 5,
|
||||
output: 25,
|
||||
cacheRead: 0.5,
|
||||
cacheWrite: 6.25,
|
||||
},
|
||||
contextWindow: 1000000,
|
||||
maxTokens: 128000,
|
||||
});
|
||||
}
|
||||
|
||||
// Add missing Claude Sonnet 4.6
|
||||
if (!allModels.some(m => m.provider === "anthropic" && m.id === "claude-sonnet-4-6")) {
|
||||
allModels.push({
|
||||
id: "claude-sonnet-4-6",
|
||||
name: "Claude Sonnet 4.6",
|
||||
api: "anthropic-messages",
|
||||
baseUrl: "https://api.anthropic.com",
|
||||
provider: "anthropic",
|
||||
reasoning: true,
|
||||
input: ["text", "image"],
|
||||
cost: {
|
||||
input: 3,
|
||||
output: 15,
|
||||
cacheRead: 0.3,
|
||||
cacheWrite: 3.75,
|
||||
},
|
||||
contextWindow: 1000000,
|
||||
maxTokens: 64000,
|
||||
});
|
||||
}
|
||||
|
||||
// Add missing Gemini 3.1 Flash Lite Preview until models.dev includes it.
|
||||
if (!allModels.some((m) => m.provider === "google" && m.id === "gemini-3.1-flash-lite-preview")) {
|
||||
allModels.push({
|
||||
id: "gemini-3.1-flash-lite-preview",
|
||||
name: "Gemini 3.1 Flash Lite Preview",
|
||||
api: "google-generative-ai",
|
||||
baseUrl: "https://generativelanguage.googleapis.com/v1beta",
|
||||
provider: "google",
|
||||
reasoning: true,
|
||||
input: ["text", "image"],
|
||||
cost: {
|
||||
input: 0,
|
||||
output: 0,
|
||||
cacheRead: 0,
|
||||
cacheWrite: 0,
|
||||
},
|
||||
contextWindow: 1048576,
|
||||
maxTokens: 65536,
|
||||
});
|
||||
}
|
||||
|
||||
// Add missing gpt models
|
||||
if (!allModels.some(m => m.provider === "openai" && m.id === "gpt-5-chat-latest")) {
|
||||
allModels.push({
|
||||
@@ -1825,66 +1675,6 @@ async function generateModels() {
|
||||
});
|
||||
}
|
||||
|
||||
if (!allModels.some(m => m.provider === "openai" && m.id === "gpt-5.1-codex")) {
|
||||
allModels.push({
|
||||
id: "gpt-5.1-codex",
|
||||
name: "GPT-5.1 Codex",
|
||||
api: "openai-responses",
|
||||
baseUrl: "https://api.openai.com/v1",
|
||||
provider: "openai",
|
||||
reasoning: true,
|
||||
input: ["text", "image"],
|
||||
cost: {
|
||||
input: 1.25,
|
||||
output: 5,
|
||||
cacheRead: 0.125,
|
||||
cacheWrite: 1.25,
|
||||
},
|
||||
contextWindow: 400000,
|
||||
maxTokens: 128000,
|
||||
});
|
||||
}
|
||||
|
||||
if (!allModels.some(m => m.provider === "openai" && m.id === "gpt-5.1-codex-max")) {
|
||||
allModels.push({
|
||||
id: "gpt-5.1-codex-max",
|
||||
name: "GPT-5.1 Codex Max",
|
||||
api: "openai-responses",
|
||||
baseUrl: "https://api.openai.com/v1",
|
||||
provider: "openai",
|
||||
reasoning: true,
|
||||
input: ["text", "image"],
|
||||
cost: {
|
||||
input: 1.25,
|
||||
output: 10,
|
||||
cacheRead: 0.125,
|
||||
cacheWrite: 0,
|
||||
},
|
||||
contextWindow: 400000,
|
||||
maxTokens: 128000,
|
||||
});
|
||||
}
|
||||
|
||||
if (!allModels.some(m => m.provider === "openai" && m.id === "gpt-5.3-codex-spark")) {
|
||||
allModels.push({
|
||||
id: "gpt-5.3-codex-spark",
|
||||
name: "GPT-5.3 Codex Spark",
|
||||
api: "openai-responses",
|
||||
baseUrl: "https://api.openai.com/v1",
|
||||
provider: "openai",
|
||||
reasoning: true,
|
||||
input: ["text"],
|
||||
cost: {
|
||||
input: 0,
|
||||
output: 0,
|
||||
cacheRead: 0,
|
||||
cacheWrite: 0,
|
||||
},
|
||||
contextWindow: 128000,
|
||||
maxTokens: 16384,
|
||||
});
|
||||
}
|
||||
|
||||
// Add missing GitHub Copilot Claude Sonnet 5 until models.dev includes it.
|
||||
const anthropicSonnet5 = allModels.find((m) => m.provider === "anthropic" && m.id === "claude-sonnet-5");
|
||||
if (anthropicSonnet5 && !allModels.some((m) => m.provider === "github-copilot" && m.id === "claude-sonnet-5")) {
|
||||
|
||||
@@ -257,8 +257,8 @@ export const AMAZON_BEDROCK_MODELS = {
|
||||
cost: {
|
||||
input: 16.5,
|
||||
output: 82.5,
|
||||
cacheRead: 0.5,
|
||||
cacheWrite: 6.25,
|
||||
cacheRead: 1.65,
|
||||
cacheWrite: 20.625,
|
||||
},
|
||||
contextWindow: 1000000,
|
||||
maxTokens: 128000,
|
||||
@@ -447,8 +447,8 @@ export const AMAZON_BEDROCK_MODELS = {
|
||||
cost: {
|
||||
input: 5.5,
|
||||
output: 27.5,
|
||||
cacheRead: 0.5,
|
||||
cacheWrite: 6.25,
|
||||
cacheRead: 0.55,
|
||||
cacheWrite: 6.875,
|
||||
},
|
||||
contextWindow: 1000000,
|
||||
maxTokens: 128000,
|
||||
|
||||
Reference in New Issue
Block a user