Migrate zai provider from Anthropic to OpenAI-compatible API

- Migrate glm-4.5, glm-4.5-air, glm-4.5-flash, glm-4.6, glm-4.7 from anthropic-messages to openai-completions API
- Updated baseUrl from https://api.z.ai/api/anthropic to https://api.z.ai/api/coding/paas/v4
- Added compat setting to disable developer role for zai models
- Filter empty text blocks in openai-completions to avoid zai API validation errors
- Fixed zai provider tests to use OpenAI-style options (reasoningEffort)
This commit is contained in:
Anton Kuzmenko 2025-12-29 11:54:10 -08:00
parent 65fb9116fb
commit 0250b7ac03
4 changed files with 34 additions and 29 deletions

View file

@ -556,7 +556,7 @@ describe("Generate E2E Tests", () => {
});
});
describe.skipIf(!process.env.ZAI_API_KEY)("zAI Provider (glm-4.5-air via Anthropic Messages)", () => {
describe.skipIf(!process.env.ZAI_API_KEY)("zAI Provider (glm-4.5-air via OpenAI Completions)", () => {
const llm = getModel("zai", "glm-4.5-air");
it("should complete basic text generation", { retry: 3 }, async () => {
@ -572,11 +572,11 @@ describe("Generate E2E Tests", () => {
});
it.skip("should handle thinking mode", { retry: 3 }, async () => {
await handleThinking(llm, { thinkingEnabled: true, thinkingBudgetTokens: 2048 });
await handleThinking(llm, { reasoningEffort: "medium" });
});
it("should handle multi-turn with thinking and tools", { retry: 3 }, async () => {
await multiTurn(llm, { thinkingEnabled: true, thinkingBudgetTokens: 2048 });
await multiTurn(llm, { reasoningEffort: "medium" });
});
});