[GH-ISSUE #4350] [Feature]: Add Z.AI (GLM-Image) as a native Image Generation service #2359

Closed
opened 2026-10-21 05:47:36 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @koolara on GitHub (Jul 31, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4350

Originally assigned to: @SpicyMarinara on GitHub.

What problem does this solve?

The Image Generation provider currently ships 15 services, and Z.AI is not one of them (docs/media/image-providers.md). That leaves three imperfect paths for anyone holding a Z.AI API key:

  1. Go through an aggregator (NanoGPT / OpenRouter Images) and hope GLM-Image is exposed there, with the aggregator's markup on top.
  2. Reuse the Block Entropy service, hand-edit the Base URL to Z.AI and type the model ID manually. The docs themselves say Block Entropy has no dedicated handler and its compatibility is unconfirmed, so this is a guess, not a supported path.
  3. Give up and use a different image model than the one they are already paying for.

This is a little odd given that the Engine already speaks to Z.AI natively on the text side — the changelog has entries about fixing native Z.AI GLM connections and their thinking parameters.

Describe the solution you'd like

Add a Z.AI tile to the Service grid in the Image Generation connection editor, alongside Venice.ai and the other cloud services.

Suggested defaults:

  • Default Base URL: https://api.z.ai/api/paas/v4
  • API key: required, sent as Authorization: Bearer <key>
  • Endpoint: POST /images/generations
  • Request body: { "model": "glm-image", "prompt": "...", "size": "1024x1024" }
  • Models: glm-image and the CogView line (cogview-4, etc.), either as a short static list or via Fetch Models from API
  • Sizing: GLM-Image goes up to 1536x1536, so the requested width/height needs to be mapped into the size string — much like the model-aware sizing already added for Venice.ai in #3682
  • Response handling: Z.AI returns an image URL in data[0].url, not base64, so the file has to be downloaded and stored locally before the link expires

API reference: https://docs.z.ai/api-reference/image/generate-image

Reference images could be a later phase — GLM-Image does support image-to-image, editing and identity-preserving generation, but a text-to-image-only first pass would already be useful.

Why is this important? (Use Case)

One key, one bill, both halves of the app. Plenty of users already hold a Z.AI key for GLM chat models, and right now that key is useless for avatars, sprites, scene backgrounds and storyboards even though the same account can generate them.

GLM-Image is also a genuinely different tool from what's on the list today: its stated strength is text rendering inside the image and bilingual Chinese/English prompts. That matters for Game Mode storyboards, signage, book covers, UI-ish props — the places where FLUX and SD tend to produce scribbles.

Additional context

  • Venice.ai landed in v2.3.2 (#3682) with authenticated model discovery, native endpoint support and model-aware sizing. Z.AI would follow essentially the same shape, so there is a recent template to copy.

  • One gotcha worth encoding in the default: Z.AI has two endpoint families. General API keys use https://api.z.ai/api/paas/v4; GLM Coding Plan keys use https://api.z.ai/api/coding/paas/v4 and are not interchangeable. If image generation is only served on the general endpoint, a clear error for coding-plan keys would save a lot of confused bug reports.

  • Happy to test a build against a live Z.AI key if that helps.

  • I DID NOT read this template and provide the requested details.

Originally created by @koolara on GitHub (Jul 31, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4350 Originally assigned to: @SpicyMarinara on GitHub. ## What problem does this solve? The Image Generation provider currently ships 15 services, and Z.AI is not one of them (docs/media/image-providers.md). That leaves three imperfect paths for anyone holding a Z.AI API key: 1. Go through an aggregator (NanoGPT / OpenRouter Images) and hope GLM-Image is exposed there, with the aggregator's markup on top. 2. Reuse the **Block Entropy** service, hand-edit the Base URL to Z.AI and type the model ID manually. The docs themselves say Block Entropy has no dedicated handler and its compatibility is unconfirmed, so this is a guess, not a supported path. 3. Give up and use a different image model than the one they are already paying for. This is a little odd given that the Engine already speaks to Z.AI natively on the text side — the changelog has entries about fixing native Z.AI GLM connections and their thinking parameters. ## Describe the solution you'd like Add a **Z.AI** tile to the **Service** grid in the Image Generation connection editor, alongside Venice.ai and the other cloud services. Suggested defaults: - **Default Base URL:** `https://api.z.ai/api/paas/v4` - **API key:** required, sent as `Authorization: Bearer <key>` - **Endpoint:** `POST /images/generations` - **Request body:** `{ "model": "glm-image", "prompt": "...", "size": "1024x1024" }` - **Models:** `glm-image` and the CogView line (`cogview-4`, etc.), either as a short static list or via **Fetch Models from API** - **Sizing:** GLM-Image goes up to 1536x1536, so the requested width/height needs to be mapped into the `size` string — much like the model-aware sizing already added for Venice.ai in #3682 - **Response handling:** Z.AI returns an image **URL** in `data[0].url`, not base64, so the file has to be downloaded and stored locally before the link expires API reference: https://docs.z.ai/api-reference/image/generate-image Reference images could be a later phase — GLM-Image does support image-to-image, editing and identity-preserving generation, but a text-to-image-only first pass would already be useful. ## Why is this important? (Use Case) One key, one bill, both halves of the app. Plenty of users already hold a Z.AI key for GLM chat models, and right now that key is useless for avatars, sprites, scene backgrounds and storyboards even though the same account can generate them. GLM-Image is also a genuinely different tool from what's on the list today: its stated strength is text rendering inside the image and bilingual Chinese/English prompts. That matters for Game Mode storyboards, signage, book covers, UI-ish props — the places where FLUX and SD tend to produce scribbles. ## Additional context - Venice.ai landed in v2.3.2 (#3682) with authenticated model discovery, native endpoint support and model-aware sizing. Z.AI would follow essentially the same shape, so there is a recent template to copy. - One gotcha worth encoding in the default: Z.AI has two endpoint families. General API keys use `https://api.z.ai/api/paas/v4`; GLM Coding Plan keys use `https://api.z.ai/api/coding/paas/v4` and are not interchangeable. If image generation is only served on the general endpoint, a clear error for coding-plan keys would save a lot of confused bug reports. - Happy to test a build against a live Z.AI key if that helps. - [ ] I DID NOT read this template and provide the requested details.
Author
Owner

@SpicyMarinara commented on GitHub (Jul 31, 2026):

SpicyMarinara is taking this in agent/issue-sweep-4350-4361. Work is tracked in draft PR #4362.

<!-- gh-comment-id:5145468880 --> @SpicyMarinara commented on GitHub (Jul 31, 2026): SpicyMarinara is taking this in `agent/issue-sweep-4350-4361`. Work is tracked in draft PR #4362.
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#2359
No description provided.