Skip to content
Source
Sign inSign up
TanStack/ai

feat: Add Z.AI adapter (`@tanstack/ai-zai`) and update examples #227

Closedshakibdshy(GitHub profile, opens in a new tab)wants to merge 10 commits intomain fromrefs/pull/227/headopened View on GitHub

Showing 59 changed files with 11 additions and 3 deletions (loading 55).

x
0 of 59 viewed, 59 left
4 additions and 1 deletionexamples/ts-code-mode-web/src/routes/_banking-demo/api.banking-demo.tsModified
View file
@@ -4,6 +4,7 @@
import { anthropicText } from '@tanstack/ai-anthropic'
import { openaiText } from '@tanstack/ai-openai'
import { geminiText } from '@tanstack/ai-gemini'
+import { zaiText } from '@tanstack/ai-zai'
import type { AnyTextAdapter } from '@tanstack/ai'
​
import { allTools } from '@/lib/tools'
@@ -11,7 +12,7 @@
import { reportTools } from '@/lib/reports/tools'
import { createReportBindings } from '@/lib/reports/create-report-bindings'
​
-type Provider = 'anthropic' | 'openai' | 'gemini'
+type Provider = 'anthropic' | 'openai' | 'gemini' | 'zai'
​
function getAdapter(provider: Provider, model?: string): AnyTextAdapter {
switch (provider) {
@@ -19,6 +20,8 @@
return openaiText((model || 'gpt-4o') as 'gpt-4o')
case 'gemini':
return geminiText((model || 'gemini-2.5-flash') as 'gemini-2.5-flash')
+ case 'zai':
+ return zaiText((model || 'glm-4.7') as 'glm-4.7')
case 'anthropic':
default:
return anthropicText((model || 'claude-haiku-4-5') as 'claude-haiku-4-5')