Skip to content

Conversation

@daniel-lxs
Copy link
Member

@daniel-lxs daniel-lxs commented Sep 15, 2025

Adds support for Z.ai's coding plan subscription tiers (International and China).

Pulled from downstream PR Kilo-Org/kilocode#2402. Thanks @chrarnoldus.


Important

Add support for Z.ai's new coding plan subscription tiers, updating schemas, configurations, and tests to handle international and China options.

  • Behavior:
    • Adds support for Z.ai's new coding plan subscription tiers (international_coding, china_coding) in provider-settings.ts and zai.ts.
    • Updates ZAiHandler in zai.ts to use zaiApiLineConfigs for determining base URL and region.
    • Defaults to international_coding if zaiApiLine is not specified.
  • Configuration:
    • Introduces zaiApiLineSchema and zaiApiLineConfigs in provider-settings.ts to manage Z.ai API lines.
    • Updates zaiApiLine handling in ZAi.tsx to reflect new subscription tiers.
  • Testing:
    • Updates tests in zai.spec.ts to cover new subscription tiers and default behavior.
    • Ensures correct API key and base URL usage in tests for both international and China configurations.

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

Adds support for Z.ai's coding plan subscription tiers:
- International Coding Plan
- China Coding Plan

Pulls changes from downstream PR Kilo-Org/kilocode#2402
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. enhancement New feature or request labels Sep 15, 2025
Copy link

@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.

Thank you for your contribution! I've reviewed the changes and found the implementation to be solid overall. The addition of Z.ai's coding plan subscription tiers is well-structured. I've left some suggestions inline to help improve the implementation.

@@ -1,4 +1,5 @@
import type { ModelInfo } from "../model.js"
import { ZaiApiLine } from "../provider-settings.js" // kilocode_change
Copy link

Choose a reason for hiding this comment

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

Could we remove these comments (lines 2, 108, 119)? They appear to be merge/tracking comments from the downstream PR that don't belong in the final code.

export class ZAiHandler extends BaseOpenAiCompatibleProvider<InternationalZAiModelId | MainlandZAiModelId> {
constructor(options: ApiHandlerOptions) {
const isChina = options.zaiApiLine === "china"
const isChina = zaiApiLineConfigs[options.zaiApiLine ?? "international_coding"].isChina
Copy link

Choose a reason for hiding this comment

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

Is the change in default from "international" to "international_coding" intentional? This is a breaking change for existing users who haven't specified a . Consider documenting this change clearly or maintaining backward compatibility by defaulting to "international" instead.

})

describe("Default behavior", () => {
it("should default to international when no zaiApiLine is specified", () => {
Copy link

Choose a reason for hiding this comment

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

Would it be beneficial to add explicit test cases for the new "international_coding" and "china_coding" options? Currently, the tests only cover "international" and "china" options, but not the new coding-specific plans.

const config = zaiApiLineConfigs[zaiApiLine]
return (
<VSCodeOption key={zaiApiLine} value={zaiApiLine} className="p-2">
{config.name} ({config.baseUrl})
Copy link

Choose a reason for hiding this comment

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

Consider showing just the name in the dropdown and moving the URL to the description/help text below for better UI clarity. The current format with both name and URL might be a bit verbose:

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Sep 15, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Sep 15, 2025
@mrubens mrubens merged commit 3fe2918 into main Sep 15, 2025
13 of 15 checks passed
@mrubens mrubens deleted the pull-zai-coding-plan-support branch September 15, 2025 21:53
@github-project-automation github-project-automation bot moved this from Triage 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants