feat(provider): Z.AI endpoints + model catalog (#13456) (thanks @tomsun28) (#13456)

Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
Tomsun28
2026-02-12 21:01:48 +08:00
committed by GitHub
parent b094491cf5
commit 540996f10f
17 changed files with 482 additions and 32 deletions

View File

@@ -187,7 +187,13 @@ export async function applyNonInteractiveAuthChoice(params: {
return applyGoogleGeminiModelDefault(nextConfig).next;
}
if (authChoice === "zai-api-key") {
if (
authChoice === "zai-api-key" ||
authChoice === "zai-coding-global" ||
authChoice === "zai-coding-cn" ||
authChoice === "zai-global" ||
authChoice === "zai-cn"
) {
const resolved = await resolveNonInteractiveApiKey({
provider: "zai",
cfg: baseConfig,
@@ -207,7 +213,21 @@ export async function applyNonInteractiveAuthChoice(params: {
provider: "zai",
mode: "api_key",
});
return applyZaiConfig(nextConfig);
// Determine endpoint from authChoice or opts
let endpoint: "global" | "cn" | "coding-global" | "coding-cn" | undefined;
if (authChoice === "zai-coding-global") {
endpoint = "coding-global";
} else if (authChoice === "zai-coding-cn") {
endpoint = "coding-cn";
} else if (authChoice === "zai-global") {
endpoint = "global";
} else if (authChoice === "zai-cn") {
endpoint = "cn";
} else {
endpoint = "coding-global";
}
return applyZaiConfig(nextConfig, { endpoint });
}
if (authChoice === "xiaomi-api-key") {