Skip to content

Commit bb0a944

Browse files
committed
fix(providers): route Z.ai through the workspace BYOK resolver too
getApiKeyWithBYOK (the resolver actually used by workspace provider runs, per providers/index.ts) only rotated server keys for openai/anthropic/google/mistral, so GLM calls without a user apiKey failed even with ZAI_API_KEY_1/2/3 configured — getApiKey in providers/utils.ts had zai wired but that's not the codepath workspace runs go through. Add zai to the hosted-check condition, and register it as a BYOKProviderId so a workspace can also bring its own Z.ai key.
1 parent 24df698 commit bb0a944

3 files changed

Lines changed: 4 additions & 1 deletion

File tree

apps/sim/lib/api-key/byok.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,14 @@ export async function getApiKeyWithBYOK(
204204
const isClaudeModel = provider === 'anthropic'
205205
const isGeminiModel = provider === 'google'
206206
const isMistralModel = provider === 'mistral'
207+
const isZaiModel = provider === 'zai'
207208

208209
const byokProviderId = isGeminiModel ? 'google' : (provider as BYOKProviderId)
209210

210211
if (
211212
isHosted &&
212213
workspaceId &&
213-
(isOpenAIModel || isClaudeModel || isGeminiModel || isMistralModel)
214+
(isOpenAIModel || isClaudeModel || isGeminiModel || isMistralModel || isZaiModel)
214215
) {
215216
const hostedModels = getHostedModels()
216217
const isModelHosted = hostedModels.some((m) => m.toLowerCase() === model.toLowerCase())

apps/sim/lib/api/contracts/byok-keys.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export const byokProviderIdSchema = z.enum([
66
'anthropic',
77
'google',
88
'mistral',
9+
'zai',
910
'fireworks',
1011
'together',
1112
'baseten',

apps/sim/tools/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export type BYOKProviderId =
77
| 'anthropic'
88
| 'google'
99
| 'mistral'
10+
| 'zai'
1011
| 'fireworks'
1112
| 'together'
1213
| 'baseten'

0 commit comments

Comments
 (0)