Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Sep 11, 2025

Summary

This PR attempts to address Issue #7895 by updating the Z.AI international endpoint to use the improved coding-specific API endpoint.

Changes

  • Updated the international Z.AI endpoint from https://api.z.ai/api/paas/v4 to https://api.z.ai/api/coding/paas/v4
  • Updated corresponding tests to reflect the new endpoint
  • The China endpoint remains unchanged as it was not mentioned in the issue

Motivation

As reported in #7895, the normal endpoint produces poor results in Roo-Code, particularly with tool-calling capabilities. The new endpoint (https://api.z.ai/api/coding/paas/v4) is explicitly documented by Z.AI for Roo integration and provides better tool-calling support for GLM models.

Testing

  • ✅ All existing tests pass
  • ✅ Updated test expectations to match the new endpoint
  • ✅ Linting and type checking pass

References

Feedback and guidance are welcome!


Important

Update international Z.AI endpoint to https://api.z.ai/api/coding/paas/v4 in zai.ts and adjust tests in zai.spec.ts accordingly.

  • Behavior:
    • Update international Z.AI endpoint in zai.ts from https://api.z.ai/api/paas/v4 to https://api.z.ai/api/coding/paas/v4.
    • China endpoint remains https://open.bigmodel.cn/api/paas/v4.
  • Tests:
    • Update tests in zai.spec.ts to expect the new international endpoint.
    • Ensure tests pass with updated endpoint.
  • References:

This description was created by Ellipsis for 088f721. You can customize this summary. It will automatically update as commits are pushed.

- Changed international Z.AI endpoint from /api/paas/v4 to /api/coding/paas/v4
- Updated corresponding tests to reflect the new endpoint
- This improves tool-calling capabilities for GLM models as documented by Z.AI

Fixes #7895
@roomote roomote bot requested review from cte, jr and mrubens as code owners September 11, 2025 12:39
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Sep 11, 2025
Copy link
Contributor Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

Reviewing my own code is like grading my own homework - suspiciously perfect yet somehow still wrong.

...options,
providerName: "Z AI",
baseURL: isChina ? "https://open.bigmodel.cn/api/paas/v4" : "https://api.z.ai/api/paas/v4",
baseURL: isChina ? "https://open.bigmodel.cn/api/paas/v4" : "https://api.z.ai/api/coding/paas/v4",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Consider adding a comment here explaining why the international endpoint uses path while China doesn't. This would help future maintainers understand the reasoning behind this difference:

new ZAiHandler({ zaiApiKey: "test-zai-api-key", zaiApiLine: "international" })
expect(OpenAI).toHaveBeenCalledWith(expect.objectContaining({ baseURL: "https://api.z.ai/api/paas/v4" }))
expect(OpenAI).toHaveBeenCalledWith(
expect.objectContaining({ baseURL: "https://api.z.ai/api/coding/paas/v4" }),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

While the unit tests correctly verify the endpoint URLs, would it be valuable to add integration tests that verify the improved tool-calling capabilities mentioned in issue #7895? This could help ensure the new endpoint actually delivers the expected improvements.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Sep 11, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Sep 12, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Sep 12, 2025
@daniel-lxs
Copy link
Member

We got in contact with the Z.AI team, I'll be opening a new PR soon.

@daniel-lxs daniel-lxs closed this Sep 15, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Prelim Review] to Done in Roo Code Roadmap Sep 15, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Sep 15, 2025
@daniel-lxs daniel-lxs deleted the fix/zai-endpoint-update branch September 15, 2025 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working PR - Needs Preliminary Review size:S This PR changes 10-29 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Change Z.AI endpoint to use https://api.z.ai/api/coding/paas/v4

5 participants