From a511ac0eb59cd5f1fd42db93c6ce65e39471bad2 Mon Sep 17 00:00:00 2001 From: GeekQiaQia Date: Tue, 3 Mar 2026 12:14:27 +0800 Subject: [PATCH 1/2] feat: Add GLM-5 model support to Fireworks provider "accounts/fireworks/models/glm-5" to FireworksModelId type union - Add GLM-5 model configuration with 202k context window, reasoning support, and appropriate pricing - Add test case to verify GLM-5 model configuration is correctly returned Resolves #11830 --- packages/types/src/providers/fireworks.ts | 14 +++ src/api/providers/__tests__/fireworks.spec.ts | 96 +++++++++++++++++++ 2 files changed, 110 insertions(+) diff --git a/packages/types/src/providers/fireworks.ts b/packages/types/src/providers/fireworks.ts index c9017c54cde..445e5a1fac7 100644 --- a/packages/types/src/providers/fireworks.ts +++ b/packages/types/src/providers/fireworks.ts @@ -17,6 +17,7 @@ export type FireworksModelId = | "accounts/fireworks/models/glm-4p5-air" | "accounts/fireworks/models/glm-4p6" | "accounts/fireworks/models/glm-4p7" + | "accounts/fireworks/models/glm-5" | "accounts/fireworks/models/gpt-oss-20b" | "accounts/fireworks/models/gpt-oss-120b" | "accounts/fireworks/models/llama-v3p3-70b-instruct" @@ -210,6 +211,19 @@ export const fireworksModels = { description: "Z.ai GLM-4.7 is the latest coding model with exceptional performance on complex programming tasks. Features improved reasoning capabilities and enhanced code generation quality.", }, + "accounts/fireworks/models/glm-5": { + maxTokens: 16384, + contextWindow: 202752, + supportsImages: false, + supportsPromptCache: true, + supportsReasoningEffort: ["disable", "medium"], + reasoningEffort: "medium", + preserveReasoning: true, + inputPrice: 0.55, + outputPrice: 2.19, + description: + "Z.ai GLM-5 is Zhipu's next-generation model with a 202k context window and built-in thinking capabilities. It delivers state-of-the-art reasoning, coding, and agentic performance.", + }, "accounts/fireworks/models/llama-v3p3-70b-instruct": { maxTokens: 16384, contextWindow: 131072, diff --git a/src/api/providers/__tests__/fireworks.spec.ts b/src/api/providers/__tests__/fireworks.spec.ts index 79f69f868b1..437b325d6b0 100644 --- a/src/api/providers/__tests__/fireworks.spec.ts +++ b/src/api/providers/__tests__/fireworks.spec.ts @@ -308,6 +308,30 @@ describe("FireworksHandler", () => { ) }) + it("should return GLM-5 model with correct configuration", () => { + const testModelId: FireworksModelId = "accounts/fireworks/models/glm-5" + const handlerWithModel = new FireworksHandler({ + apiModelId: testModelId, + fireworksApiKey: "test-fireworks-api-key", + }) + const model = handlerWithModel.getModel() + expect(model.id).toBe(testModelId) + expect(model.info).toEqual( + expect.objectContaining({ + maxTokens: 16384, + contextWindow: 202752, + supportsImages: false, + supportsPromptCache: true, + supportsReasoningEffort: ["disable", "medium"], + reasoningEffort: "medium", + preserveReasoning: true, + inputPrice: 0.55, + outputPrice: 2.19, + description: expect.stringContaining("Z.ai GLM-5 is Zhipu's next-generation model"), + }), + ) + }) + it("should return gpt-oss-20b model with correct configuration", () => { const testModelId: FireworksModelId = "accounts/fireworks/models/gpt-oss-20b" const handlerWithModel = new FireworksHandler({ @@ -587,6 +611,78 @@ describe("FireworksHandler", () => { chunks.push(chunk) } + expect(chunks[0]).toEqual({ type: "text", text: "Hello" }) + expect(chunks[1]).toEqual({ type: "text", text: " world" }) + expect(chunks[2]).toMatchObject({ type: "usage", inputTokens: 5, outputTokens: 10 }) + }) +}) + ], + usage: { + prompt_tokens: 5, + completion_tokens: 10, + total_tokens: 15, + }, + } + }, + })) + + const systemPrompt = "You are a helpful assistant." + const messages: Anthropic.Messages.MessageParam[] = [{ role: "user", content: "Hi" }] + + const stream = handler.createMessage(systemPrompt, messages) + const chunks = [] + for await (const chunk of stream) { + chunks.push(chunk) + } + + expect(chunks[0]).toEqual({ type: "text", text: "Hello" }) + expect(chunks[1]).toEqual({ type: "text", text: " world" }) + expect(chunks[2]).toMatchObject({ type: "usage", inputTokens: 5, outputTokens: 10 }) + }) +}) + ], + usage: { + prompt_tokens: 5, + completion_tokens: 10, + total_tokens: 15, + }, + } + }, + })) + + const systemPrompt = "You are a helpful assistant." + const messages: Anthropic.Messages.MessageParam[] = [{ role: "user", content: "Hi" }] + + const stream = handler.createMessage(systemPrompt, messages) + const chunks = [] + for await (const chunk of stream) { + chunks.push(chunk) + } + + expect(chunks[0]).toEqual({ type: "text", text: "Hello" }) + expect(chunks[1]).toEqual({ type: "text", text: " world" }) + expect(chunks[2]).toMatchObject({ type: "usage", inputTokens: 5, outputTokens: 10 }) + }) +}) + ], + usage: { + prompt_tokens: 5, + completion_tokens: 10, + total_tokens: 15, + }, + } + }, + })) + + const systemPrompt = "You are a helpful assistant." + const messages: Anthropic.Messages.MessageParam[] = [{ role: "user", content: "Hi" }] + + const stream = handler.createMessage(systemPrompt, messages) + const chunks = [] + for await (const chunk of stream) { + chunks.push(chunk) + } + expect(chunks[0]).toEqual({ type: "text", text: "Hello" }) expect(chunks[1]).toEqual({ type: "text", text: " world" }) expect(chunks[2]).toMatchObject({ type: "usage", inputTokens: 5, outputTokens: 10 }) From 9f86deb441c1a163aa4eb63a686d6da2c38a6c1c Mon Sep 17 00:00:00 2001 From: GeekQiaQia Date: Tue, 3 Mar 2026 12:40:05 +0800 Subject: [PATCH 2/2] feat(fireworks): add GLM-5 model and fix fireworks tests --- src/api/providers/__tests__/fireworks.spec.ts | 72 ------------------- 1 file changed, 72 deletions(-) diff --git a/src/api/providers/__tests__/fireworks.spec.ts b/src/api/providers/__tests__/fireworks.spec.ts index 437b325d6b0..656dd2ffef4 100644 --- a/src/api/providers/__tests__/fireworks.spec.ts +++ b/src/api/providers/__tests__/fireworks.spec.ts @@ -611,78 +611,6 @@ describe("FireworksHandler", () => { chunks.push(chunk) } - expect(chunks[0]).toEqual({ type: "text", text: "Hello" }) - expect(chunks[1]).toEqual({ type: "text", text: " world" }) - expect(chunks[2]).toMatchObject({ type: "usage", inputTokens: 5, outputTokens: 10 }) - }) -}) - ], - usage: { - prompt_tokens: 5, - completion_tokens: 10, - total_tokens: 15, - }, - } - }, - })) - - const systemPrompt = "You are a helpful assistant." - const messages: Anthropic.Messages.MessageParam[] = [{ role: "user", content: "Hi" }] - - const stream = handler.createMessage(systemPrompt, messages) - const chunks = [] - for await (const chunk of stream) { - chunks.push(chunk) - } - - expect(chunks[0]).toEqual({ type: "text", text: "Hello" }) - expect(chunks[1]).toEqual({ type: "text", text: " world" }) - expect(chunks[2]).toMatchObject({ type: "usage", inputTokens: 5, outputTokens: 10 }) - }) -}) - ], - usage: { - prompt_tokens: 5, - completion_tokens: 10, - total_tokens: 15, - }, - } - }, - })) - - const systemPrompt = "You are a helpful assistant." - const messages: Anthropic.Messages.MessageParam[] = [{ role: "user", content: "Hi" }] - - const stream = handler.createMessage(systemPrompt, messages) - const chunks = [] - for await (const chunk of stream) { - chunks.push(chunk) - } - - expect(chunks[0]).toEqual({ type: "text", text: "Hello" }) - expect(chunks[1]).toEqual({ type: "text", text: " world" }) - expect(chunks[2]).toMatchObject({ type: "usage", inputTokens: 5, outputTokens: 10 }) - }) -}) - ], - usage: { - prompt_tokens: 5, - completion_tokens: 10, - total_tokens: 15, - }, - } - }, - })) - - const systemPrompt = "You are a helpful assistant." - const messages: Anthropic.Messages.MessageParam[] = [{ role: "user", content: "Hi" }] - - const stream = handler.createMessage(systemPrompt, messages) - const chunks = [] - for await (const chunk of stream) { - chunks.push(chunk) - } - expect(chunks[0]).toEqual({ type: "text", text: "Hello" }) expect(chunks[1]).toEqual({ type: "text", text: " world" }) expect(chunks[2]).toMatchObject({ type: "usage", inputTokens: 5, outputTokens: 10 })