feat: display official subscription quota on Claude provider cards

Read Claude OAuth credentials from macOS Keychain (with file fallback)
and query the Anthropic usage API to show quota utilization inline on
official provider cards. Includes compact countdown timer for reset
windows and hides the rarely-used seven_day_sonnet tier in inline mode.
This commit is contained in:
Jason
2026-04-04 17:18:42 +08:00
parent d9c0e4c452
commit b30f3c27ad
15 changed files with 945 additions and 1 deletions
+2
View File
@@ -21,6 +21,7 @@ mod session_manager;
mod settings;
pub mod skill;
mod stream_check;
mod subscription;
mod sync_support;
mod lightweight;
@@ -49,6 +50,7 @@ pub use session_manager::*;
pub use settings::*;
pub use skill::*;
pub use stream_check::*;
pub use subscription::*;
pub use lightweight::*;
pub use usage::*;
+10
View File
@@ -0,0 +1,10 @@
use crate::services::subscription::SubscriptionQuota;
/// 查询官方订阅额度
///
/// 读取 CLI 工具已有的 OAuth 凭据并调用官方 API 获取使用额度。
/// 不需要 AppState(不访问数据库),直接读文件 + 发 HTTP。
#[tauri::command]
pub async fn get_subscription_quota(tool: String) -> Result<SubscriptionQuota, String> {
crate::services::subscription::get_subscription_quota(&tool).await
}