A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode,DeepSeek Harness and more. Only official website: ccswitch.io
Rust ai-toolsclaude-codecodexdeepseek-harnessdesktop-appgrokgrokbuildhermeskimi-codemcpopen-sourceopencodepiprovider-managementrustskillsskills-managementtauriwsl-support
import { invoke } from "@tauri-apps/api/core";
import type {
AgyAccountQuota,
ClaudeAccountPlan,
ClaudeAccountQuota,
SubscriptionQuota,
} from "@/types/subscription";
export const subscriptionApi = {
getQuota: (tool: string): Promise<SubscriptionQuota> =>
invoke("get_subscription_quota", { tool }),
getCodexOauthQuota: (accountId: string | null): Promise<SubscriptionQuota> =>
invoke("get_codex_oauth_quota", { accountId }),
getXaiOauthQuota: (accountId: string | null): Promise<SubscriptionQuota> =>
invoke("get_xai_oauth_quota", { accountId }),
/** 绑了账号的 Claude 官方卡:按那个账号自己的登录查,带上它的套餐 */
getClaudeAccountQuota: (accountId: string): Promise<ClaudeAccountQuota> =>
invoke("get_claude_account_quota", { accountId }),
/** Claude Code 默认登录的套餐(没绑账号的官方卡显示) */
getClaudeDefaultPlan: (): Promise<ClaudeAccountPlan | null> =>
invoke("get_claude_default_plan"),
getAgyAccountQuota: (
accountId: string,
force = false,
): Promise<AgyAccountQuota> =>
invoke(
"agy_account_quota",
force ? { accountId, force: true } : { accountId },
),
/** 只读本地保存的 Antigravity 额度快照,不读钥匙串、不启动 `agy`。 */
getAgyAccountLastQuota: (
accountId: string,
): Promise<SubscriptionQuota | null> =>
invoke("agy_account_last_quota", { accountId }),
getCodingPlanQuota: (
baseUrl: string,
apiKey: string,
// 火山方舟用账号 AK/SK 签名查询用量;其他供应商不传。
accessKeyId?: string,
secretAccessKey?: string,
// 智谱团队版(zhipu_team)靠显式标识路由(base_url 与个人版相同无法区分)。
codingPlanProvider?: string,
teamOrganizationId?: string,
teamProjectId?: string,
): Promise<SubscriptionQuota> =>
invoke("get_coding_plan_quota", {
baseUrl,
apiKey,
accessKeyId,
secretAccessKey,
codingPlanProvider,
teamOrganizationId,
teamProjectId,
}),
getBalance: (
baseUrl: string,
apiKey: string,
): Promise<import("@/types").UsageResult> =>
invoke("get_balance", { baseUrl, apiKey }),
};