Skip to content

feat: add GLM-Image model via Z.AI provider - #1452

Merged
steebchen merged 6 commits into
mainfrom
feat/add-glm-image-model
Jan 16, 2026
Merged

steebchen merged 6 commits into
mainfrom
feat/add-glm-image-model

Conversation

@rcogal

@rcogal rcogal commented Jan 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds GLM-Image text-to-image generation model via Z.AI provider with verified pricing and configuration.

Model Details

Property Value
Model ID glm-image
Provider Z.AI
Pricing $0.015 per image
Context Size 2,000 characters
API Endpoint /api/paas/v4/images/generations

Implementation

  • Added model definition to packages/models/src/models/zai.ts
  • Configured with test: "skip" flag to exclude from E2E tests (as requested, due to cost)
  • Uses existing Z.AI image generation API infrastructure (already implemented for CogView-4)
  • Pricing verified from Z.AI official documentation

Technical Notes

API Support Already Exists

The Z.AI image generation API integration is already fully implemented in the codebase:

  • Endpoint routing: get-provider-endpoint.ts:227-231 routes to /api/paas/v4/images/generations
  • Request preparation: prepare-request-body.ts:232-259 formats image generation requests
  • Response parsing: parse-provider-response.ts:475-496 handles Z.AI image response format

This implementation was created for CogView-4 and works uniformly for all Z.AI image models through provider-based checks (not model-specific logic).

Response Format

Z.AI image API returns:

{
  "created": 1760335349,
  "data": [{"url": "https://..."}],
  "content_filter": [{"role": "assistant", "level": 1}]
}

This format is handled by the existing parser that checks usedProvider === "zai" && json.data.

Configuration Flags

{
  test: "skip",              // Excluded from E2E tests
  imageGenerations: true,    // Routes to image generation API
  output: ["text", "image"], // Image-capable model
  streaming: false,          // Image generation is non-streaming
  requestPrice: 0.015,       // $0.015 per image
}

Test Plan

  • Model definition added with correct configuration
  • Pricing verified from Z.AI official docs ($0.015/image)
  • test: "skip" flag set to exclude from automated E2E tests
  • Code formatted with pnpm format
  • Production build passes with pnpm build
  • Model appears in /v1/models API correctly
  • Verified existing Z.AI image generation API handles both CogView-4 and GLM-Image uniformly

Note: Manual testing confirmed the model routes correctly and uses the existing Z.AI image generation infrastructure. Full end-to-end image generation testing was performed once to verify the implementation (as requested, to avoid unnecessary API costs).

Files Changed

  • packages/models/src/models/zai.ts - Added GLM-Image model definition

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added GLM-Image to the AI model lineup — supports text+image outputs, 2000-token context, up to 4096-token output, priced at $0.015 per request.
  • Documentation

    • Updated image-generation docs: added GLM-Image to the models table, adjusted table layout, and clarified CogView-4 description to note embedded-text support.

✏️ Tip: You can customize this high-level summary in your review settings.

Add GLM-Image text-to-image generation model with verified pricing
and configuration. Model uses Z.AI's existing image generation API
infrastructure which is already implemented for CogView-4.

- Model ID: glm-image
- Pricing: $0.015 per image
- Provider: Z.AI
- Test skip: Excluded from E2E tests due to cost
- API support: Uses existing Z.AI image generation endpoint

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jan 15, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Adds a new GLM-Image model entry to the Z.AI model registry and updates the image-generation docs table and CogView-4 callout to include the new model and note embedded text capabilities.

Changes

Cohort / File(s) Summary
Z.AI model registry
packages/models/src/models/zai.ts
Appended a new glm-image model object to the zaiModels export: id "glm-image", name "GLM-Image", family "glm", outputs ["text","image"], releasedAt: new Date("2025-01-06"), provider zai with modelName: "glm-image", requestPrice: 0.015, contextSize: 2000, maxOutput: 4096, imageGenerations: true.
Docs — image generation feature page
apps/docs/content/features/image-generation.mdx
Updated the "Available Z.AI models" table to add zai/glm-image and adjusted CogView-4 description/callout to mention image text-embedding/embedded text rendering.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • smakosh
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the primary change: adding a new GLM-Image model through the Z.AI provider, which aligns directly with the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.



📜 Recent review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ff7119f and 64ac3c4.

📒 Files selected for processing (1)
  • apps/docs/content/features/image-generation.mdx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: e2e-shards (1)
  • GitHub Check: e2e-shards (3)
  • GitHub Check: e2e-shards (5)
  • GitHub Check: e2e-shards (4)
  • GitHub Check: e2e-shards (2)
  • GitHub Check: build / run
  • GitHub Check: generate / run
  • GitHub Check: lint / run
  • GitHub Check: autofix
  • GitHub Check: test / run
🔇 Additional comments (2)
apps/docs/content/features/image-generation.mdx (2)

135-138: Clear addition of GLM-Image model details.

The new row is concise and consistent with the existing Z.AI table formatting.


140-142: Callout clarification reads well.

This phrasing makes the embedded-text capability explicit and easy to understand.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@rcogal rcogal linked an issue Jan 15, 2026 that may be closed by this pull request
rcogal and others added 2 commits January 15, 2026 23:18
Add GLM-Image model to the image generation documentation with pricing and description.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@steebchen
steebchen added this pull request to the merge queue Jan 16, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jan 16, 2026
@steebchen
steebchen added this pull request to the merge queue Jan 16, 2026
@steebchen
steebchen removed this pull request from the merge queue due to a manual request Jan 16, 2026
@steebchen
steebchen enabled auto-merge January 16, 2026 02:54
@steebchen
steebchen added this pull request to the merge queue Jan 16, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jan 16, 2026
@steebchen
steebchen enabled auto-merge January 16, 2026 13:59
@steebchen
steebchen added this pull request to the merge queue Jan 16, 2026
Merged via the queue into main with commit e18a92f Jan 16, 2026
13 of 14 checks passed
@steebchen
steebchen deleted the feat/add-glm-image-model branch January 16, 2026 14:12
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.

add glm image model

3 participants