fix(vercel): factor free routes onto base models (#5077)
Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
d328ece240
commit
98de72cc24
@@ -0,0 +1,25 @@
|
||||
# Sources (accessed 2026-08-19):
|
||||
# - https://z.ai/blog/glm-4.6v
|
||||
# - https://huggingface.co/zai-org/GLM-4.6V-Flash
|
||||
name = "GLM-4.6V-Flash"
|
||||
description = "Lightweight GLM vision model for visual reasoning, documents, and multimodal agents"
|
||||
family = "glm"
|
||||
release_date = "2025-12-08"
|
||||
last_updated = "2025-12-08"
|
||||
attachment = true
|
||||
reasoning = true
|
||||
temperature = true
|
||||
tool_call = true
|
||||
open_weights = true
|
||||
|
||||
[limit]
|
||||
context = 128_000
|
||||
output = 32_768
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image", "video"]
|
||||
output = ["text"]
|
||||
|
||||
[[weights]]
|
||||
label = "Hugging Face"
|
||||
url = "https://huggingface.co/zai-org/GLM-4.6V-Flash"
|
||||
@@ -70,13 +70,15 @@ export const vercel = {
|
||||
},
|
||||
translateModel(model, context) {
|
||||
const existing = context.existing(model.id);
|
||||
const baseModel = existing?.base_model ?? resolveCanonicalBaseModel(model.id);
|
||||
const routeBase = freeRouteBase(model.id);
|
||||
const baseModel = existing?.base_model ?? resolveVercelBaseModel(model.id);
|
||||
const inherited = routeBase === undefined ? undefined : context.existing(routeBase);
|
||||
return {
|
||||
id: model.id,
|
||||
model: buildVercelModel(
|
||||
model,
|
||||
existing,
|
||||
baseModel === undefined || baseModel === model.id ? undefined : context.existing(baseModel),
|
||||
inherited ?? (baseModel === undefined || baseModel === model.id ? undefined : context.existing(baseModel)),
|
||||
),
|
||||
};
|
||||
},
|
||||
@@ -178,7 +180,7 @@ export function buildVercelModel(
|
||||
},
|
||||
};
|
||||
|
||||
const baseModel = existing?.base_model ?? resolveCanonicalBaseModel(model.id);
|
||||
const baseModel = existing?.base_model ?? resolveVercelBaseModel(model.id);
|
||||
if (baseModel === undefined) return synced;
|
||||
|
||||
return factorBaseModel(baseModel, {
|
||||
@@ -199,6 +201,16 @@ export function buildVercelModel(
|
||||
}, synced.limit, existing?.base_model_omit);
|
||||
}
|
||||
|
||||
function resolveVercelBaseModel(modelID: string) {
|
||||
const routeBase = freeRouteBase(modelID);
|
||||
return resolveCanonicalBaseModel(modelID)
|
||||
?? (routeBase === undefined ? undefined : resolveCanonicalBaseModel(routeBase));
|
||||
}
|
||||
|
||||
function freeRouteBase(modelID: string) {
|
||||
return modelID.endsWith("-free") ? modelID.slice(0, -"-free".length) : undefined;
|
||||
}
|
||||
|
||||
function dateFromTimestamp(timestamp: number) {
|
||||
return new Date(timestamp * 1000).toISOString().slice(0, 10);
|
||||
}
|
||||
|
||||
@@ -3541,6 +3541,44 @@ test("Vercel factored models inherit temperature from base metadata", () => {
|
||||
expect(synced).not.toHaveProperty("temperature");
|
||||
});
|
||||
|
||||
test("Vercel free routes factor onto the canonical non-free model", () => {
|
||||
const [model] = vercel.parseModels({
|
||||
data: [{
|
||||
id: "zai/glm-4.6v-flash-free",
|
||||
name: "GLM-4.6V-Flash (Free)",
|
||||
created: 1_765_152_000,
|
||||
released: 1_765_152_000,
|
||||
context_window: 128_000,
|
||||
max_tokens: 24_000,
|
||||
type: "language",
|
||||
tags: ["reasoning", "tool-use", "vision", "file-input"],
|
||||
pricing: { input: "0", output: "0" },
|
||||
}],
|
||||
});
|
||||
|
||||
const translated = vercel.translateModel(model!, {
|
||||
existing(id) {
|
||||
return id === "zai/glm-4.6v-flash"
|
||||
? { reasoning_options: [{ type: "toggle" }] }
|
||||
: undefined;
|
||||
},
|
||||
authored() {
|
||||
return undefined;
|
||||
},
|
||||
});
|
||||
|
||||
expect(translated?.model).toMatchObject({
|
||||
base_model: "zhipuai/glm-4.6v-flash",
|
||||
name: "GLM-4.6V-Flash (Free)",
|
||||
reasoning_options: [{ type: "toggle" }],
|
||||
cost: { input: 0, output: 0 },
|
||||
limit: { output: 24_000 },
|
||||
modalities: { input: ["text", "image", "pdf"] },
|
||||
});
|
||||
expect(translated?.model).not.toHaveProperty("description");
|
||||
expect(translated?.model).not.toHaveProperty("family");
|
||||
});
|
||||
|
||||
test("Vercel Claude Opus fast variants factor onto base opus metadata", () => {
|
||||
const [model] = vercel.parseModels({
|
||||
data: [{
|
||||
|
||||
@@ -1,20 +1,8 @@
|
||||
name = "GLM-4.6V-Flash"
|
||||
description = "GLM vision model for visual reasoning, documents, and multimodal agents"
|
||||
family = "glm"
|
||||
release_date = "2025-09-30"
|
||||
last_updated = "2025-09-30"
|
||||
attachment = true
|
||||
reasoning = true
|
||||
base_model = "zhipuai/glm-4.6v-flash"
|
||||
reasoning_options = [{ type = "toggle" }]
|
||||
temperature = true
|
||||
tool_call = true
|
||||
open_weights = false
|
||||
knowledge = "2024-10"
|
||||
|
||||
[limit]
|
||||
context = 128000
|
||||
output = 24000
|
||||
output = 24_000
|
||||
|
||||
[modalities]
|
||||
input = ["text", "image", "pdf"]
|
||||
output = ["text"]
|
||||
|
||||
Reference in New Issue
Block a user