feat: add support for Z.AI provider and enhance quota handling

This commit is contained in:
Jan Leon
2026-05-06 20:20:26 +00:00
parent ffde066951
commit 23aa213cef
7 changed files with 90 additions and 22 deletions

View File

@@ -3,7 +3,6 @@
import { useTranslations } from "next-intl";
import { useState, useEffect, useCallback, useMemo, useRef } from "react";
import Image from "next/image";
import {
parseQuotaData,
calculatePercentage,
@@ -18,6 +17,7 @@ import { USAGE_SUPPORTED_PROVIDERS } from "@/shared/constants/providers";
import { pickMaskedDisplayValue, pickDisplayValue } from "@/shared/utils/maskEmail";
import useEmailPrivacyStore from "@/store/emailPrivacyStore";
import EmailPrivacyToggle from "@/shared/components/EmailPrivacyToggle";
import ProviderIcon from "@/shared/components/ProviderIcon";
const LS_GROUP_BY = "omniroute:limits:groupBy";
const LS_EXPANDED_GROUPS = "omniroute:limits:expandedGroups";
@@ -36,6 +36,7 @@ const PROVIDER_CONFIG = {
codex: { label: "OpenAI Codex", color: "#10A37F" },
claude: { label: "Claude Code", color: "#D97757" },
glm: { label: "GLM (Z.AI)", color: "#4A90D9" },
zai: { label: "Z.AI", color: "#2563EB" },
glmt: { label: "GLM Thinking", color: "#2563EB" },
"kimi-coding": { label: "Kimi Coding", color: "#1E3A8A" },
minimax: { label: "MiniMax", color: "#7C3AED" },
@@ -298,11 +299,12 @@ export default function ProviderLimits() {
claude: 5,
kiro: 6,
glm: 7,
glmt: 8,
"kimi-coding": 9,
minimax: 10,
"minimax-cn": 11,
nanogpt: 12,
zai: 8,
glmt: 9,
"kimi-coding": 10,
minimax: 11,
"minimax-cn": 12,
nanogpt: 13,
};
return [...filteredConnections].sort(
(a, b) => (priority[a.provider] || 9) - (priority[b.provider] || 9)
@@ -551,14 +553,7 @@ export default function ProviderLimits() {
{/* Account Info */}
<div className="flex items-center gap-2.5 min-w-0">
<div className="w-8 h-8 rounded-lg flex items-center justify-center overflow-hidden shrink-0">
<Image
src={`/providers/${conn.provider}.png`}
alt={conn.provider}
width={32}
height={32}
className="object-contain"
sizes="32px"
/>
<ProviderIcon providerId={conn.provider} size={32} className="object-contain" />
</div>
<div className="min-w-0">
<div className="text-[13px] font-semibold text-text-main truncate">

View File

@@ -22,6 +22,8 @@ const QUOTA_LABEL_MAP: Record<string, string> = {
agentic_request_freetrial: "Agentic (Trial)",
credits: "AI Credits",
models: "Models",
tokens: "Tokens",
time_limit: "Time Limit",
};
function toRecord(value: unknown): Record<string, unknown> {

View File

@@ -43,7 +43,15 @@ interface ProviderConnectionLike {
backoffLevel?: number;
}
const PROVIDER_LIMITS_APIKEY_PROVIDERS = new Set(["glm", "glmt", "minimax", "minimax-cn", "crof", "nanogpt"]);
const PROVIDER_LIMITS_APIKEY_PROVIDERS = new Set([
"glm",
"zai",
"glmt",
"minimax",
"minimax-cn",
"crof",
"nanogpt",
]);
const DEFAULT_PROVIDER_LIMITS_SYNC_INTERVAL_MINUTES = 70;
const PROVIDER_LIMITS_AUTO_SYNC_SETTING_KEY = "provider_limits_auto_sync_last_run";

View File

@@ -1840,6 +1840,7 @@ export const USAGE_SUPPORTED_PROVIDERS = [
"claude",
"kimi-coding",
"glm",
"zai",
"glmt",
"minimax",
"minimax-cn",