Skip to content
Source
Sign inSign up
TanStack/ai

feat(ai-zai): add Z.AI adapter on the OpenAI chat completions base #1937

Mergedshakibdshy(GitHub profile, opens in a new tab)merged 24 commits intomain fromrefs/pull/1937/headmerged by AlemTuzlak View on GitHub

Showing 69 changed files with 7 additions and 0 deletions (loading 67).

x
0 of 69 viewed, 69 left
7 additions and 0 deletions.changeset/zai-chat-completions-adapter.mdAdded
View file
@@ -0,0 +1,7 @@
+---
+'@tanstack/ai-zai': minor
+---
+​
+Add the Z.AI adapter. It drives Z.AI's OpenAI-compatible Chat Completions API through `@tanstack/openai-base` and ships the GLM-5 and GLM-4 model catalog (`glm-5.3`, `glm-5.3-flash`, and `glm-5.2` first), `createZAIText`/`zaiText`, `createZAISummarize`/`zaiSummarize`, the branded `zaiWebSearchTool`, and a `zaiByok` descriptor at `@tanstack/ai-zai/byok` so a browser-supplied key wins over `ZAI_API_KEY`.
+​
+The adapter sets the coding-plan base URL when `coding: true` is passed. It sends `json_object` plus a schema system prompt because Z.AI rejects `json_schema`. Z.AI accepts a `tool_choice` of `auto` only, so `toolChoice: 'none'` sends no tools and `'required'` or a named tool warns once and falls back to `auto`. It streams `delta.reasoning_content` as AG-UI reasoning events.
docs/adapters/zai.mdAdded
View file
Loading the diff
docs/config.jsonModified
View file
Loading the diff
examples/ts-code-mode-web/src/routes/_banking-demo/api.banking-demo.tsModified
View file
Loading the diff
examples/ts-code-mode-web/src/routes/_banking-demo/banking-demo.tsxModified
View file
Loading the diff
examples/ts-code-mode-web/src/routes/_database-demo/api.database-demo.tsModified
View file
Loading the diff
examples/ts-code-mode-web/src/routes/_database-demo/database-demo.tsxModified
View file
Loading the diff
examples/ts-code-mode-web/src/routes/_home/api.product-codemode.tsModified
View file
Loading the diff
examples/ts-code-mode-web/src/routes/_home/api.product-regular.tsModified
View file