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 { QoderEdition } from "@/config/qoder";
export interface QoderModel {
model: string;
displayName?: string;
contextWindow?: number;
maxOutputTokens?: number;
capabilities?: {
tools?: boolean;
vision?: boolean;
thinking?: {
modes: string[];
preferredMode?: string;
[key: string]: unknown;
};
[key: string]: unknown;
};
[key: string]: unknown;
}
export interface QoderProvider {
displayName?: string;
type?: "openai-compatible" | "alibaba" | "aliyun-bailian";
protocol?: "openai" | "openai-responses" | "anthropic";
authType?: "bearer" | "api-key";
baseUrl: string;
apiKey: string;
model?: string;
models?: QoderModel[];
[key: string]: unknown;
}
export interface QoderAuthStatus {
installed: boolean;
loggedIn: boolean;
username?: string | null;
email?: string | null;
plan?: string | null;
accounts?: QoderAccount[];
currentAccountId?: string | null;
/** Qoder 当前登录的账号还没收录进账号列表时,它的显示名(用户点「收录」才收录) */
uncollectedLogin?: string | null;
}
export interface QoderAccount {
id: string;
username?: string | null;
email?: string | null;
plan?: string | null;
isCurrent: boolean;
}
export interface QoderLoginProgress {
authUrl?: string | null;
complete: boolean;
error?: string | null;
accountId?: string | null;
}
/**
* Qoder 是一个应用,后端按设置里选的版本读写;查询键带上版本,切换版本后会重新读取。
*/
export const qoderKeys = {
all: ["qoder"] as const,
auth: (edition: QoderEdition) => ["qoder", "auth", edition] as const,
login: (edition: QoderEdition, flowId: string | null) =>
["qoder", "login", edition, flowId] as const,
};
export const qoderApi = {
getAuthStatus: () => invoke<QoderAuthStatus>("get_qoder_auth_status"),
/** 收录 Qoder 当前登录的账号(只在用户点「收录」时调用) */
importCurrentAccount: () =>
invoke<QoderAuthStatus>("import_current_qoder_account"),
startLogin: (accountId?: string) =>
invoke<string>("start_qoder_login", { accountId: accountId ?? null }),
pollLogin: (flowId: string) =>
invoke<QoderLoginProgress>("poll_qoder_login", { flowId }),
cancelLogin: (flowId: string) =>
invoke<void>("cancel_qoder_login", { flowId }),
useAccount: (accountId: string) =>
invoke<QoderAuthStatus>("use_qoder_account", { accountId }),
/** 只从 CC Switch 的账号列表里删掉,不会在 Qoder 里登出 */
deleteAccount: (accountId: string) =>
invoke<QoderAuthStatus>("delete_qoder_account", { accountId }),
/** 设为默认:自定义卡把 `model.name` 指到它的模型(不传 model 用它自己的默认模型),官方卡改成 auto */
setDefaultModel: (providerId: string, model?: string) =>
invoke<void>("set_qoder_default_model", {
providerId,
model: model ?? null,
}),
};