From 4b080fd6dd9a466247c2f4007aae353d03f7d42f Mon Sep 17 00:00:00 2001 From: Kayvan Sylvan Date: Thu, 4 Dec 2025 11:35:05 +0800 Subject: [PATCH] feat: add Z AI provider and glm model support - Add Z AI provider configuration to ProviderMap - Include BaseURL for Z AI API endpoint - Add test case for Z AI provider existence - Add glm to OpenAI model prefixes list - Reorder gpt-5 in model prefixes list - Support new Z AI provider in OpenAI compatible plugins --- README.md | 1 + cmd/generate_changelog/incoming/1851.txt | 7 +++++++ internal/plugins/ai/openai/openai.go | 3 ++- internal/plugins/ai/openai_compatible/providers_config.go | 5 +++++ .../plugins/ai/openai_compatible/providers_config_test.go | 5 +++++ 5 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 cmd/generate_changelog/incoming/1851.txt diff --git a/README.md b/README.md index a24c5964..28976592 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,7 @@ Below are the **new features and capabilities** we've added (newest first): ### Recent Major Features +- [v1.4.337](https://github.com/danielmiessler/fabric/releases/tag/v1.4.337) (Dec 4, 2025) — Add "Z AI" vendor support. See the [Z AI overview](https://docs.z.ai/guides/overview/overview) page for more details. - [v1.4.334](https://github.com/danielmiessler/fabric/releases/tag/v1.4.334) (Nov 26, 2025) — **Claude Opus 4.5**: Updates the Anthropic SDK to the latest and adds the new [Claude Opus 4.5](https://www.anthropic.com/news/claude-opus-4-5) to the available models. - [v1.4.331](https://github.com/danielmiessler/fabric/releases/tag/v1.4.331) (Nov 23, 2025) — **Support for GitHub Models**: Adds support for using GitHub Models. - [v1.4.322](https://github.com/danielmiessler/fabric/releases/tag/v1.4.322) (Nov 5, 2025) — **Interactive HTML Concept Maps and Claude Sonnet 4.5**: Adds `create_conceptmap` pattern for visual knowledge representation using Vis.js, introduces WELLNESS category with psychological analysis patterns, and upgrades to Claude Sonnet 4.5 diff --git a/cmd/generate_changelog/incoming/1851.txt b/cmd/generate_changelog/incoming/1851.txt new file mode 100644 index 00000000..418943a3 --- /dev/null +++ b/cmd/generate_changelog/incoming/1851.txt @@ -0,0 +1,7 @@ +### PR [#1851](https://github.com/danielmiessler/Fabric/pull/1851) by [ksylvan](https://github.com/ksylvan): Add Z AI provider and glm model support + +- Add Z AI provider configuration to ProviderMap +- Include BaseURL for Z AI API endpoint +- Add test case for Z AI provider existence +- Add glm to OpenAI model prefixes list +- Support new Z AI provider in OpenAI compatible plugins diff --git a/internal/plugins/ai/openai/openai.go b/internal/plugins/ai/openai/openai.go index ac91d807..efd767e6 100644 --- a/internal/plugins/ai/openai/openai.go +++ b/internal/plugins/ai/openai/openai.go @@ -172,10 +172,11 @@ func (o *Client) supportsResponsesAPI() bool { func (o *Client) NeedsRawMode(modelName string) bool { openaiModelsPrefixes := []string{ + "glm", + "gpt-5", "o1", "o3", "o4", - "gpt-5", } openAIModelsNeedingRaw := []string{ "gpt-4o-mini-search-preview", diff --git a/internal/plugins/ai/openai_compatible/providers_config.go b/internal/plugins/ai/openai_compatible/providers_config.go index 8d50f21e..96cf094a 100644 --- a/internal/plugins/ai/openai_compatible/providers_config.go +++ b/internal/plugins/ai/openai_compatible/providers_config.go @@ -123,6 +123,11 @@ var ProviderMap = map[string]ProviderConfig{ BaseURL: "https://api.venice.ai/api/v1", ImplementsResponses: false, }, + "Z AI": { + Name: "Z AI", + BaseURL: "https://api.z.ai/api/paas/v4", + ImplementsResponses: false, + }, } // GetProviderByName returns the provider configuration for a given name with O(1) lookup diff --git a/internal/plugins/ai/openai_compatible/providers_config_test.go b/internal/plugins/ai/openai_compatible/providers_config_test.go index 61275b2c..19323f61 100644 --- a/internal/plugins/ai/openai_compatible/providers_config_test.go +++ b/internal/plugins/ai/openai_compatible/providers_config_test.go @@ -20,6 +20,11 @@ func TestCreateClient(t *testing.T) { provider: "Groq", exists: true, }, + { + name: "Existing provider - Z AI", + provider: "Z AI", + exists: true, + }, { name: "Non-existent provider", provider: "NonExistent",