feat: 新增 ZenMux Token Plan 供应商,支持手动凭证与 USD 额度富展示 (#2709)

* feat(Token plan): 增加 ZenMux 支持

* chore: format code with prettier

* chore: format code with cargo fmt

---------

Co-authored-by: 明桓 <jihaodong.jhd@oceanbase.com>
Co-authored-by: Jason <farion1231@gmail.com>
This commit is contained in:
Eter
2026-06-03 14:45:49 +08:00
committed by GitHub
parent 43ae1e5f2c
commit c1dff06625
11 changed files with 438 additions and 17 deletions
+14
View File
@@ -32,6 +32,12 @@ pub struct QuotaTier {
pub utilization: f64,
/// ISO 8601 重置时间
pub resets_at: Option<String>,
/// ZenMux: 已用额度(USD
#[serde(skip_serializing_if = "Option::is_none")]
pub used_value_usd: Option<f64>,
/// ZenMux: 窗口上限(USD
#[serde(skip_serializing_if = "Option::is_none")]
pub max_value_usd: Option<f64>,
}
/// 超额使用信息
@@ -377,6 +383,8 @@ async fn query_claude_quota(access_token: &str) -> SubscriptionQuota {
name: tier_name.to_string(),
utilization: util,
resets_at: w.resets_at,
used_value_usd: None,
max_value_usd: None,
});
}
}
@@ -395,6 +403,8 @@ async fn query_claude_quota(access_token: &str) -> SubscriptionQuota {
name: key.clone(),
utilization: util,
resets_at: w.resets_at,
used_value_usd: None,
max_value_usd: None,
});
}
}
@@ -714,6 +724,8 @@ pub(crate) async fn query_codex_quota(
.unwrap_or_else(|| "unknown".to_string()),
utilization: used,
resets_at: window.reset_at.and_then(unix_ts_to_iso),
used_value_usd: None,
max_value_usd: None,
});
}
}
@@ -1179,6 +1191,8 @@ async fn query_gemini_quota(access_token: &str) -> SubscriptionQuota {
name,
utilization: (1.0 - remaining) * 100.0,
resets_at: reset_time,
used_value_usd: None,
max_value_usd: None,
})
.collect();