Skip to content

fix(models): add glm 4.5v and adapt pricing - #751

Merged
steebchen merged 1 commit into
mainfrom
feat/zai
Sep 8, 2025
Merged

steebchen merged 1 commit into
mainfrom
feat/zai

Conversation

@steebchen

@steebchen steebchen commented Sep 8, 2025

Copy link
Copy Markdown
Member

Revised input/output pricing, reasoning, and tools support for ZAI models to reflect updated specifications. Models impacted include glm-4.5, glm-4.5-air, glm-4.5-x, glm-4.5-airx, glm-4.5-flash, and glm-4-32b-0414-128k.

Summary by CodeRabbit

  • New Features
    • Added glm-4.5v model with vision, reasoning, tool use, streaming, and large context support.
  • Changes
    • Updated pricing across glm-4.5 family (glm-4.5, 4.5-air, 4.5-x, 4.5-airx, 4.5-flash) and glm-4-32b-0414-128k.
    • Enabled tool use across these models; reasoning enabled on select variants.
  • Tests
    • Minor comment added in an e2e test; no behavioral impact.

Revised input/output pricing, reasoning, and tools support for ZAI models to reflect updated specifications.
Models impacted include glm-4.5, glm-4.5-air, glm-4.5-x, glm-4.5-airx, glm-4.5-flash, and glm-4-32b-0414-128k.
@coderabbitai

coderabbitai Bot commented Sep 8, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Adds a comment in an e2e test regarding empty text handling. Updates Z AI model registry: introduces glm-4.5v and revises pricing and capability flags (reasoning/tools/vision/streaming/context) for multiple glm-4.5* providers in zai.ts. No exported API shape changes beyond the new model entry.

Changes

Cohort / File(s) Summary
E2E tests
apps/gateway/src/api.e2e.ts
Inserted a comment after an empty text field in a test message; no logic, data, or flow changes.
Z AI models
packages/models/src/models/zai.ts
Added model glm-4.5v (vision, reasoning, tools, streaming, context 128k, pricing set). Updated glm-4.5, -air, -x, -airx, -flash, and glm-4-32b-0414-128k pricing and capability flags (reasoning/tools as specified); no other structural changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Client
  participant Gateway
  participant ZAI as Z AI Provider

  Client->>Gateway: Request with model=glm-4.5v | glm-4.5* …
  alt Model supports tools/reasoning/vision
    Note over Gateway: Set flags per model (tools/reasoning/vision/streaming)
    Gateway->>ZAI: Forward request with capabilities + pricing metadata
    ZAI-->>Gateway: Response (streaming if enabled)
  else Model without reasoning
    Gateway->>ZAI: Forward request (tools as applicable)
    ZAI-->>Gateway: Response
  end
  Gateway-->>Client: Deliver response
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • smakosh
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/zai

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.

@steebchen
steebchen enabled auto-merge September 8, 2025 01:00
@steebchen
steebchen added this pull request to the merge queue Sep 8, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
apps/gateway/src/api.e2e.ts (1)

1274-1276: Avoid empty text parts in multi-part content to reduce flakiness.

Some providers reject empty text items in content arrays. If the goal isn't to test this edge case, prefer a single space or drop the segment.

Apply this minimal tweak if you see intermittent 4xx:

-            text: "", // empty text – note this may need special handling
+            text: " ", // intentionally blank but non-empty to avoid provider validation failures
packages/models/src/models/zai.ts (1)

130-142: Zero-priced glm-4.5-flash — decide whether it should be treated as “free”.

Test filtering uses the model-level free flag, not prices. If you intend Flash to be excluded in non-full runs as a free model, mark it accordingly.

Optional change:

   {
     id: "glm-4.5-flash",
     name: "GLM-4.5 Flash",
     family: "glm",
     deprecatedAt: undefined,
     deactivatedAt: undefined,
+    free: true,
     providers: [
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 64d7366 and 7ef329e.

📒 Files selected for processing (2)
  • apps/gateway/src/api.e2e.ts (1 hunks)
  • packages/models/src/models/zai.ts (6 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use localStorage instead of cookies for client-side data persistence

Files:

  • apps/gateway/src/api.e2e.ts
  • packages/models/src/models/zai.ts
**/*.{js,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{js,ts}: Use drizzle with the latest object syntax for database operations
For read queries, always use db().query.<table>.findMany() or db().query.<table>.findFirst()

Files:

  • apps/gateway/src/api.e2e.ts
  • packages/models/src/models/zai.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

Never use as any or : any in TypeScript files.

Files:

  • apps/gateway/src/api.e2e.ts
  • packages/models/src/models/zai.ts
apps/{api,gateway}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

apps/{api,gateway}/**/*.{ts,tsx}: Use Drizzle with the latest object syntax for database operations
For read queries, use db().query.

.findMany() or db().query.
.findFirst()

apps/{api,gateway}/**/*.{ts,tsx}: Use the Hono framework for backend HTTP services in apps/api and apps/gateway
Use Zod for request/response validation in backend routes and handlers
Maintain OpenAPI/Swagger documentation for backend APIs

Files:

  • apps/gateway/src/api.e2e.ts
apps/gateway/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

In apps/gateway (Hono), always use Hono + Zod + OpenAPI for validation and typesafety

Files:

  • apps/gateway/src/api.e2e.ts
**/*.e2e.ts

📄 CodeRabbit inference engine (CLAUDE.md)

Name end-to-end tests with the .e2e.ts suffix (run by pnpm test:e2e)

Files:

  • apps/gateway/src/api.e2e.ts
**/*.{spec,e2e}.ts

📄 CodeRabbit inference engine (CLAUDE.md)

Use Vitest as the test framework for unit and E2E tests

Files:

  • apps/gateway/src/api.e2e.ts
⏰ 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). (2)
  • GitHub Check: e2e / run
  • GitHub Check: build / run
🔇 Additional comments (3)
packages/models/src/models/zai.ts (3)

14-23: glm-4.5 pricing/capabilities updated — verify reasoning output semantics.

Numbers/flags look consistent. If glm-4.5 does not emit explicit reasoning output, set reasoningOutput: "omit" like 4.5v to keep e2e assertions aligned.


28-50: New glm-4.5v (vision + reasoningOutput: "omit") — LGTM.

Configuration matches tests that gate reasoning output on reasoningOutput !== "omit" and include vision inputs.


61-70: Pricing/tools updates across glm-4.5-air/x/airx and glm-4-32b — looks good.

Flags (tools: true, reasoning on the right variants) align with test filters; no type issues with satisfies.

Also applies to: 84-93, 107-116, 153-162

Merged via the queue into main with commit 1f96e37 Sep 8, 2025
11 of 12 checks passed
@steebchen
steebchen deleted the feat/zai branch September 8, 2025 01:05
@coderabbitai coderabbitai Bot mentioned this pull request Mar 27, 2026
5 tasks
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