You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Proposal: first-class Zhipu AI (GLM) chat model provider
#4091
Opening this here because the triage bot on #4062 suggested feature proposals reach more people in Discussions. The full write-up and the per-field details are in #4062.
What
A zhipu provider following the chat-model checklist in CONTRIBUTING Section 5: ZhipuCredential, ZhipuChatModel, model cards for glm-5.3 and glm-4.6, ZhipuChatFormatter + ZhipuMultiAgentFormatter, and offline unit tests. No new dependency - the GLM v4 endpoint is OpenAI-compatible, so the existing openai client is reused.
Why not just point OpenAIChatModel at the endpoint
That works for a script but misses what the other providers get: a typed credential that appears in CredentialFactory and the credential form, model cards so the picker knows the context/output limits, and the GLM-specific controls below.
Provider differences that a thin wrapper gets wrong
All verified against the live API:
Topic
OpenAI / DeepSeek
GLM
thinking toggle
reasoning_effort
thinking: {type: ...} as a top-level body field, sent via extra_body
always-thinking models
-
glm-5.3 / glm-4.7 reject disabled, so it must raise before the request
tool_choice
auto / none / required / named
auto only - named forcing is rejected, so it is downgraded and none drops the schemas
streaming usage
stream_options.include_usage
chunk_include_usage, and usage is already on the final chunk by default
cache hits
flat prompt_cache_hit_tokens
nested usage.prompt_tokens_details.cached_tokens
reasoning_content
required on every assistant message (DeepSeek)
optional, omitted when empty
Status
The implementation is written and verified: 15 offline unit tests, plus a live smoke test on glm-5.3 and glm-4.6 covering non-streaming, streaming, tool calls and thinking.
I can open the PR as soon as the direction is confirmed, or trim it to just the credential plus the model cards if a smaller first step is preferred.
Happy to wait for a maintainer's call on whether this belongs in core.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Opening this here because the triage bot on #4062 suggested feature proposals reach more people in Discussions. The full write-up and the per-field details are in #4062.
What
A
zhipuprovider following the chat-model checklist in CONTRIBUTING Section 5:ZhipuCredential,ZhipuChatModel, model cards forglm-5.3andglm-4.6,ZhipuChatFormatter+ZhipuMultiAgentFormatter, and offline unit tests. No new dependency - the GLM v4 endpoint is OpenAI-compatible, so the existingopenaiclient is reused.Why not just point
OpenAIChatModelat the endpointThat works for a script but misses what the other providers get: a typed credential that appears in
CredentialFactoryand the credential form, model cards so the picker knows the context/output limits, and the GLM-specific controls below.Provider differences that a thin wrapper gets wrong
All verified against the live API:
reasoning_effortthinking: {type: ...}as a top-level body field, sent viaextra_bodyglm-5.3/glm-4.7rejectdisabled, so it must raise before the requesttool_choiceautoonly - named forcing is rejected, so it is downgraded andnonedrops the schemasstream_options.include_usagechunk_include_usage, and usage is already on the final chunk by defaultprompt_cache_hit_tokensusage.prompt_tokens_details.cached_tokensreasoning_contentStatus
The implementation is written and verified: 15 offline unit tests, plus a live smoke test on
glm-5.3andglm-4.6covering non-streaming, streaming, tool calls and thinking.I can open the PR as soon as the direction is confirmed, or trim it to just the credential plus the model cards if a smaller first step is preferred.
Happy to wait for a maintainer's call on whether this belongs in core.
All reactions