-
Notifications
You must be signed in to change notification settings - Fork 2.5k
fix: update Z.AI endpoint to use improved coding API #7896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- 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
There was a problem hiding this 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", |
There was a problem hiding this comment.
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" }), |
There was a problem hiding this comment.
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.
|
We got in contact with the Z.AI team, I'll be opening a new PR soon. |
Summary
This PR attempts to address Issue #7895 by updating the Z.AI international endpoint to use the improved coding-specific API endpoint.
Changes
https://api.z.ai/api/paas/v4tohttps://api.z.ai/api/coding/paas/v4Motivation
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
References
Feedback and guidance are welcome!
Important
Update international Z.AI endpoint to
https://api.z.ai/api/coding/paas/v4inzai.tsand adjust tests inzai.spec.tsaccordingly.zai.tsfromhttps://api.z.ai/api/paas/v4tohttps://api.z.ai/api/coding/paas/v4.https://open.bigmodel.cn/api/paas/v4.zai.spec.tsto expect the new international endpoint.This description was created by
for 088f721. You can customize this summary. It will automatically update as commits are pushed.