Skip to content

🤖 feat: add Z.ai as a native provider with GLM 5.3 Flash - #4007

Merged
ibetitsmike merged 2 commits into
mainfrom
mike/glm-5.3-flash
Aug 29, 2026
Merged

🤖 feat: add Z.ai as a native provider with GLM 5.3 Flash#4007
ibetitsmike merged 2 commits into
mainfrom
mike/glm-5.3-flash

Conversation

@ibetitsmike

Copy link
Copy Markdown
Contributor

Summary

Adds Z.ai (Zhipu) as a first-class native provider (provider id zai, backed by the official @ai-sdk/zai package), starting with one model: zai:glm-5.3-flash (GLM 5.3 Flash, aliases glm / glm-flash).

Background

GLM models were previously reachable only through the OpenRouter gateway (openrouter:z-ai/glm-4.6). Users with a Z.ai API key can now use GLM 5.3 Flash directly: 1M context, 128K max output, vision input, and forced reasoning with Z.ai's reasoning_effort control.

Implementation

  • Provider registry: zai direct provider (createZai, ZAI_API_KEY, default base URL https://api.z.ai/api/paas/v4); the generic direct-provider factory path handles it with no custom code. OpenRouter routing is intentionally not wired (OpenRouter uses the hyphenated z-ai vendor slug).
  • Known model GLM_53_FLASH with tokenizer override zai/glm-4.5 (closest published GLM encoding in ai-tokenizer).
  • Thinking: the GLM 5.3 family cannot disable reasoning and accepts effort low/high/max only. isGlm53Model drives a ["low", "high", "max"] policy, and resolveEffectiveThinkingLevel clamps unset/"off" through the policy the same way Mythos-class Anthropic models do, so tracked levels match wire behavior.
  • Provider options: the zai branch sends thinking: enabled, mapped reasoningEffort (high/xhigh to high, max to max, else low), and toolStream: true (Z.ai's recommended streaming-tool-calls flag).
  • Cost/limits metadata uses Z.ai list prices ($0.15/M in, $0.03/M cached read, $0.50/M out; a temporary 50% promo ends 2026-09-09).
  • UI: Z.ai provider icon, settings key URL, and "GLM" display-name casing.

Validation

  • Remote dogfood UAT (Coder Agents) against this exact head: settings UI and key persistence (reload + restart), model picker casing and alias resolution, icon at 1440px and 375px, no-NaN cost surfaces, and the wire contract proven via API debug logs plus a local capture: endpoint /api/paas/v4/chat/completions, model glm-5.3-flash, thinking: enabled, and reasoning_effort mapping low to low, high to high, max to max. A dummy key surfaced Z.ai's genuine auth error cleanly.
  • No live Z.ai key exists in dev/CI environments, so tests and UAT validate wiring rather than live completions.

Notes

UAT observation for a product-level call: the composer hides Low for this model by default because the global default Min Thinking floor is medium (existing behavior for all models, see policy.test.ts "medium floor hides off/low"; Grok 4.6 loses Low the same way). With the per-model Min Thinking setting lowered, the composer offers exactly Low/High/Max, and "off" is never offered. If always-reasoning models should be exempt from the floor, that belongs in a follow-up.

Risks

Low regression risk: the change is almost entirely additive (new provider/model entries plus one new providerOptions branch). The one shared-path edit is resolveEffectiveThinkingLevel, which now clamps for GLM 5.3 in addition to Mythos-class Anthropic models; behavior for all other models is unchanged and covered by existing policy tests.


Generated with xum • Model: anthropic:claude-fable-5 • Thinking: xhigh • Cost: $40.18

@mintlify

mintlify Bot commented Aug 29, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
Mux 🟢 Ready View Preview Aug 29, 2026, 8:28 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@chatgpt-codex-connector

This comment has been minimized.

@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

This comment has been minimized.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e9c4983eba

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/config/providers.mdx
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 82e96fa0e3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

This comment has been minimized.

@ibetitsmike
ibetitsmike added this pull request to the merge queue Aug 29, 2026
Merged via the queue into main with commit f04e0f8 Aug 29, 2026
21 checks passed
@ibetitsmike
ibetitsmike deleted the mike/glm-5.3-flash branch August 29, 2026 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant