fix(ai): align Fireworks GLM 5.2 Fast with GLM 5.2

Broaden the Fireworks GLM 5.2 special-case in generate-models.ts from
an exact id match to a glm-5p2 substring match, so the router variant
accounts/fireworks/routers/glm-5p2-fast also uses the OpenAI-compatible
endpoint and thinkingLevelMap instead of falling back to the default
Anthropic Messages config.

closes #6195
This commit is contained in:
Vegard Stikbakke 2026-07-01 10:34:46 +02:00
parent 040f0a5197
commit 844d175eaf
4 changed files with 18 additions and 6 deletions

View file

@ -5,6 +5,7 @@
### Fixed
- Fixed OpenAI Codex user-agent construction to synchronously load Node OS metadata, avoiding a startup race that could report `pi (browser)` in Node/Bun.
- Fixed Fireworks GLM 5.2 Fast to use the OpenAI-compatible endpoint and `thinkingLevelMap`, aligning it with GLM 5.2 ([#6195](https://github.com/earendil-works/pi/issues/6195)).
### Added

View file

@ -526,7 +526,7 @@ function applyThinkingLevelMetadata(model: Model<any>): void {
if (model.provider === "openrouter" && model.id === "z-ai/glm-5.2") {
mergeThinkingLevelMap(model, { xhigh: "xhigh" });
}
if (model.provider === "fireworks" && model.id === "accounts/fireworks/models/glm-5p2") {
if (model.provider === "fireworks" && model.id.includes("glm-5p2")) {
mergeThinkingLevelMap(model, { off: "none", minimal: null, low: "high", medium: "high", xhigh: "max" });
}
if (model.provider === "opencode-go" && model.id === "glm-5.2") {
@ -1670,7 +1670,7 @@ async function generateModels() {
candidate.cost.output = 1.9;
candidate.cost.cacheRead = 0.119;
}
if (candidate.provider === "fireworks" && candidate.id === "accounts/fireworks/models/glm-5p2") {
if (candidate.provider === "fireworks" && candidate.id.includes("glm-5p2")) {
candidate.api = "openai-completions";
candidate.baseUrl = "https://api.fireworks.ai/inference/v1";
candidate.compat = { supportsStore: false, supportsDeveloperRole: false };

View file

@ -224,11 +224,12 @@ export const FIREWORKS_MODELS = {
"accounts/fireworks/routers/glm-5p2-fast": {
id: "accounts/fireworks/routers/glm-5p2-fast",
name: "GLM 5.2 Fast",
api: "anthropic-messages",
api: "openai-completions",
provider: "fireworks",
baseUrl: "https://api.fireworks.ai/inference",
compat: {"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false},
baseUrl: "https://api.fireworks.ai/inference/v1",
compat: {"supportsStore":false,"supportsDeveloperRole":false},
reasoning: true,
thinkingLevelMap: {"off":"none","minimal":null,"low":"high","medium":"high","xhigh":"max"},
input: ["text"],
cost: {
input: 2.1,
@ -238,7 +239,7 @@ export const FIREWORKS_MODELS = {
},
contextWindow: 1048575,
maxTokens: 131072,
} satisfies Model<"anthropic-messages">,
} satisfies Model<"openai-completions">,
"accounts/fireworks/routers/kimi-k2p6-fast": {
id: "accounts/fireworks/routers/kimi-k2p6-fast",
name: "Kimi K2.6 Fast",

View file

@ -48,6 +48,16 @@ describe("Fireworks models", () => {
expect(model?.input).toEqual(["text", "image"]);
});
it("aligns GLM 5.2 Fast with GLM 5.2's OpenAI-compatible config", () => {
const base = getModel("fireworks", "accounts/fireworks/models/glm-5p2");
const fast = getModel("fireworks", "accounts/fireworks/routers/glm-5p2-fast");
expect(fast.api).toBe(base.api);
expect(fast.baseUrl).toBe(base.baseUrl);
expect(fast.compat).toEqual(base.compat);
expect(fast.thinkingLevelMap).toEqual(base.thinkingLevelMap);
});
it("resolves FIREWORKS_API_KEY from the environment", () => {
process.env.FIREWORKS_API_KEY = "test-fireworks-key";