Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/grumpy-teeth-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"kilo-code": patch
---

The Z.ai provider now supports their coding plan (subscription)
12 changes: 10 additions & 2 deletions src/api/providers/__tests__/zai.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ describe("ZAiHandler", () => {

it("should use the correct international Z AI base URL", () => {
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", // kilocode_change, upstream pr pending
}),
)
})

it("should use the provided API key for international", () => {
Expand Down Expand Up @@ -109,7 +113,11 @@ describe("ZAiHandler", () => {
describe("Default behavior", () => {
it("should default to international when no zaiApiLine is specified", () => {
const handlerDefault = new ZAiHandler({ zaiApiKey: "test-zai-api-key" })
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", // kilocode_change, upstream pr pending
}),
)

const model = handlerDefault.getModel()
expect(model.id).toBe(internationalZAiDefaultModelId)
Expand Down
2 changes: 1 addition & 1 deletion src/api/providers/zai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class ZAiHandler extends BaseOpenAiCompatibleProvider<InternationalZAiMod
super({
...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", // kilocode_change, upstream pr pending
apiKey: options.zaiApiKey ?? "not-provided",
defaultProviderModelId: defaultModelId,
providerModels: models,
Expand Down
Loading