[GH-ISSUE #5963] [Feature]: Add Z.AI (GLM) as a native text provider, with GLM 5.3 and GLM 5.3 Flash in the model list #3303

Closed
opened 2026-10-21 06:01:50 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @ghost on GitHub (Sep 8, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5963

Originally assigned to: @SpicyMarinara on GitHub.

What problem does this solve?

The connection editor's provider list (PROVIDERS in packages/shared/src/constants/providers.ts) has no Z.AI entry for text. Someone holding a Z.AI key today picks Custom (OAI-Compatible), types https://api.z.ai/api/paas/v4 by hand, and types the model ID by hand.

That is odd for three reasons:

  1. The server already speaks native Z.AI. glm-request-compat.ts recognises api.z.ai, knows GLM 5.3 always reasons, and maps reasoning effort onto the three levels Z.AI accepts (low / high / max). The wire is right; only the front door is missing.
  2. Z.AI is already a first-class image service (#4350). One key, one bill — but the text half of the same account still takes the Custom detour.
  3. The built-in ZAI_MODELS list stops at glm-5.2. glm-5.3 and glm-5.3-flash — the models the compat layer was written for — are not in it, so even the Custom path offers no picker entry for them.

Proposed solution

Add Z.AI as a text provider the way NanoGPT was added in #117, minus the image and video parts:

  • zai in APIProvider, the connection Zod enum, and the DB enum (packages/shared/src/types/connection.ts, packages/shared/src/schemas/connection.schema.ts, packages/server/src/db/schema/connections.ts).
  • PROVIDERS.zai: name Z.AI, default base URL https://api.z.ai/api/paas/v4, modelsEndpoint: "/models", Bearer auth. Z.AI serves GET /models on that base (checked today with a live key: 200, ten GLM models including glm-5.3 and glm-5.3-flash), so Fetch Models from API works as-is.
  • provider-registry.ts: route zai to the OpenAI-compatible provider, where applyGlmThinkingParameters already fires for the native endpoint.
  • MODEL_LISTS.zai = ZAI_MODELS, and add glm-5.3 and glm-5.3-flash to ZAI_MODELS (1M context, 128K max output, per Z.AI's model pages). custom keeps its current seed.
  • API_KEY_LINKS.zai in ConnectionEditor.tsx → https://z.ai/manage-apikey/apikey-list.
  • Reasoning effort on a zai connection with a GLM 5.3 model: offer only low / high / max, default max (Z.AI's documented default). "none" / disabled is rejected by the API with code 1210 — checked live today.
  • Docs: a Z.AI block in docs/connections/providers-reference.md, an [Unreleased] changelog line, English UI strings as localization keys, and a [docs-i18n] follow-up issue.

One default worth encoding, the same gotcha #4350 called out for images: Z.AI's Coding Plan endpoint (/api/coding/paas/v4) is licensed for their listed tools only under their usage policy, so the provider should default to the pay-as-you-go endpoint and the docs entry should say why.

Alternatives considered

  • Keep using Custom. It works today because the compat layer keys on the hostname — but it means typing a URL and a model ID by hand, no key link, no model list, and effort controls that offer levels the API rejects.
  • Only add glm-5.3 / glm-5.3-flash to ZAI_MODELS. Fixes the stale list, not the front door.

Additional context

  • #4350 landed Z.AI for images; this is the text side of the same account.
  • #117 (NanoGPT) is the shape to copy: 13 files, +227/−102. This should come in smaller — Z.AI has a static list plus a working /models, and no image/video defaults.
  • Measured today against a live pay-as-you-go key: streaming with usage works; tool calls and a tool-result round trip work; thinking cannot be disabled (code 1210); max output ceiling is 131,072.
  • I'll build this on my fork (OneWayGondola/Marinara-Engine) with a draft PR against staging open from the first commit, per CONTRIBUTING. Happy to trim or reshape scope to whatever the team prefers.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @ghost on GitHub (Sep 8, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5963 Originally assigned to: @SpicyMarinara on GitHub. ## What problem does this solve? The connection editor's provider list (`PROVIDERS` in `packages/shared/src/constants/providers.ts`) has no Z.AI entry for text. Someone holding a Z.AI key today picks **Custom (OAI-Compatible)**, types `https://api.z.ai/api/paas/v4` by hand, and types the model ID by hand. That is odd for three reasons: 1. The server already speaks native Z.AI. `glm-request-compat.ts` recognises `api.z.ai`, knows GLM 5.3 always reasons, and maps reasoning effort onto the three levels Z.AI accepts (low / high / max). The wire is right; only the front door is missing. 2. Z.AI is already a first-class **image** service (#4350). One key, one bill — but the text half of the same account still takes the Custom detour. 3. The built-in `ZAI_MODELS` list stops at `glm-5.2`. `glm-5.3` and `glm-5.3-flash` — the models the compat layer was written for — are not in it, so even the Custom path offers no picker entry for them. ## Proposed solution Add **Z.AI** as a text provider the way NanoGPT was added in #117, minus the image and video parts: - `zai` in `APIProvider`, the connection Zod enum, and the DB enum (`packages/shared/src/types/connection.ts`, `packages/shared/src/schemas/connection.schema.ts`, `packages/server/src/db/schema/connections.ts`). - `PROVIDERS.zai`: name **Z.AI**, default base URL `https://api.z.ai/api/paas/v4`, `modelsEndpoint: "/models"`, Bearer auth. Z.AI serves `GET /models` on that base (checked today with a live key: 200, ten GLM models including `glm-5.3` and `glm-5.3-flash`), so **Fetch Models from API** works as-is. - `provider-registry.ts`: route `zai` to the OpenAI-compatible provider, where `applyGlmThinkingParameters` already fires for the native endpoint. - `MODEL_LISTS.zai = ZAI_MODELS`, and add `glm-5.3` and `glm-5.3-flash` to `ZAI_MODELS` (1M context, 128K max output, per Z.AI's model pages). `custom` keeps its current seed. - `API_KEY_LINKS.zai` in `ConnectionEditor.tsx` → `https://z.ai/manage-apikey/apikey-list`. - Reasoning effort on a `zai` connection with a GLM 5.3 model: offer only low / high / max, default **max** (Z.AI's documented default). "none" / disabled is rejected by the API with code 1210 — checked live today. - Docs: a Z.AI block in `docs/connections/providers-reference.md`, an `[Unreleased]` changelog line, English UI strings as localization keys, and a `[docs-i18n]` follow-up issue. One default worth encoding, the same gotcha #4350 called out for images: Z.AI's Coding Plan endpoint (`/api/coding/paas/v4`) is licensed for their listed tools only under their usage policy, so the provider should default to the pay-as-you-go endpoint and the docs entry should say why. ## Alternatives considered - Keep using Custom. It works today because the compat layer keys on the hostname — but it means typing a URL and a model ID by hand, no key link, no model list, and effort controls that offer levels the API rejects. - Only add `glm-5.3` / `glm-5.3-flash` to `ZAI_MODELS`. Fixes the stale list, not the front door. ## Additional context - #4350 landed Z.AI for images; this is the text side of the same account. - #117 (NanoGPT) is the shape to copy: 13 files, +227/−102. This should come in smaller — Z.AI has a static list plus a working `/models`, and no image/video defaults. - Measured today against a live pay-as-you-go key: streaming with usage works; tool calls and a tool-result round trip work; thinking cannot be disabled (code 1210); max output ceiling is 131,072. - I'll build this on my fork (`OneWayGondola/Marinara-Engine`) with a draft PR against `staging` open from the first commit, per CONTRIBUTING. Happy to trim or reshape scope to whatever the team prefers. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 06:01:50 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Sep 12, 2026):

Owner: @SpicyMarinara (Codex). The maintainer has requested that this issue be completed in the assigned issue sweep, tracked in draft PR #6072. Existing contributor patches and previously completed translations will be reviewed and reused with attribution; the final PR will document the implementation and verification before this issue is closed.

<!-- gh-comment-id:5644875752 --> @SpicyMarinara commented on GitHub (Sep 12, 2026): Owner: @SpicyMarinara (Codex). The maintainer has requested that this issue be completed in the assigned issue sweep, tracked in draft PR #6072. Existing contributor patches and previously completed translations will be reviewed and reused with attribution; the final PR will document the implementation and verification before this issue is closed.
Author
Owner

@SpicyMarinara commented on GitHub (Sep 12, 2026):

Fixed in #6072, merged into staging.

Native Z.AI text connections, GLM 5.3 model metadata, supported reasoning choices, and actionable empty-response diagnostics are in staging. Contributor work from #5965 is preserved and credited; provider request and output-budget regressions passed. Paid live generation remains a manual verification item.

<!-- gh-comment-id:5645733418 --> @SpicyMarinara commented on GitHub (Sep 12, 2026): Fixed in #6072, merged into `staging`. Native Z.AI text connections, GLM 5.3 model metadata, supported reasoning choices, and actionable empty-response diagnostics are in staging. Contributor work from #5965 is preserved and credited; provider request and output-budget regressions passed. Paid live generation remains a manual verification item.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#3303
No description provided.