Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e38bed092 | ||
|
|
6df9095ee8 | ||
|
|
d06fb41f48 | ||
|
|
69f9b8d603 | ||
|
|
2f75929fda | ||
|
|
a1c3f06bdf | ||
|
|
acde6d97c2 | ||
|
|
6cbaea7159 | ||
|
|
f0d5e27bb4 | ||
|
|
38a11666ac | ||
|
|
de132ffb3a | ||
|
|
a285d192eb | ||
|
|
127818a7c3 | ||
|
|
6bc9e4644e | ||
|
|
dfd41d12c0 | ||
|
|
615dfb54e0 | ||
|
|
8914b40bec | ||
|
|
4071930aff | ||
|
|
1b5cd0f416 |
No files matched your search
@@ -86,6 +86,6 @@ jobs:
|
||||
- **Linux**: `.deb` / `.AppImage` / `.rpm`
|
||||
|
||||
Full changelog: see commit history.
|
||||
releaseDraft: true
|
||||
prerelease: ${{ contains(github.ref_name, '-rc') || contains(github.ref_name, '-beta') || contains(github.ref_name, '-alpha') }}
|
||||
overwrite: true
|
||||
args: ${{ matrix.args }}
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "kimiswitch",
|
||||
"private": true,
|
||||
"version": "0.6.8",
|
||||
"version": "0.7.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
Generated
+1
-1
@@ -1958,7 +1958,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "kimiswitch"
|
||||
version = "0.6.7"
|
||||
version = "0.7.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "kimiswitch"
|
||||
version = "0.6.8"
|
||||
version = "0.7.0"
|
||||
description = "Kimi Switch - model config manager"
|
||||
authors = ["you"]
|
||||
edition = "2021"
|
||||
|
||||
+133
-5
@@ -590,6 +590,20 @@ fn models_dev_lookup(model_name: &str) -> Option<(String, ModelsDevCost)> {
|
||||
Some((key.clone(), *cost))
|
||||
}
|
||||
|
||||
/// Strip a trailing derived-variant suffix ("-highspeed", "-free") from a
|
||||
/// model id: plan endpoints expose e.g. `glm-5.2-highspeed`, which bills at
|
||||
/// the base model's price.
|
||||
fn strip_variant_suffix(model_name: &str) -> Option<String> {
|
||||
for suffix in ["-highspeed", "-free"] {
|
||||
if let Some(base) = model_name.strip_suffix(suffix) {
|
||||
if !base.is_empty() {
|
||||
return Some(base.to_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
/// Strip a trailing context-size suffix ("-256k", "-128k", "-1m") from a model
|
||||
/// id: context variants like "k3-256k" bill at the base model's ("k3") price.
|
||||
/// Returns the stripped id (provider prefix preserved), or None when there is
|
||||
@@ -610,7 +624,62 @@ fn strip_context_suffix(model_name: &str) -> Option<String> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Memoized price resolution. `match_price` is called once per usage record
|
||||
/// during the scan, and the models.dev suffix scan is O(5910) per miss — with
|
||||
/// thousands of records sharing a handful of model names, memoizing the result
|
||||
/// turns the whole scan from O(records × 5910) into O(unique_models × 5910).
|
||||
static MATCH_PRICE_MEMO: OnceLock<Mutex<HashMap<String, (String, f64, f64, f64, bool)>>> =
|
||||
OnceLock::new();
|
||||
|
||||
/// Resolve a model's price, caching per-model results (hits and misses).
|
||||
fn match_price(model_name: &str) -> (String, f64, f64, f64, bool) {
|
||||
let key = model_name.to_ascii_lowercase();
|
||||
let memo = MATCH_PRICE_MEMO.get_or_init(|| Mutex::new(HashMap::new()));
|
||||
if let Some(hit) = memo.lock().unwrap().get(&key) {
|
||||
return hit.clone();
|
||||
}
|
||||
let result = match_price_inner(model_name);
|
||||
memo.lock().unwrap().insert(key, result.clone());
|
||||
result
|
||||
}
|
||||
|
||||
/// Suffix-match a model against the models.dev index, skipping zero-priced
|
||||
/// (subscription-plan) listings so a paid official entry wins. Used as the
|
||||
/// fallback when the exact hit resolves to a zero-cost plan entry such as
|
||||
/// `zhipuai-coding-plan/glm-5.2` or `kimi-for-coding/kimi-for-coding`.
|
||||
fn priced_suffix_lookup(model_name: &str) -> Option<(String, ModelsDevCost)> {
|
||||
let bare = model_name.rsplit_once('/').map(|(_, b)| b).unwrap_or(model_name);
|
||||
let bare_l = bare.to_ascii_lowercase();
|
||||
let mut matches: Vec<(&String, &ModelsDevCost)> = models_dev_cost_index()
|
||||
.iter()
|
||||
.filter(|(key, cost)| {
|
||||
(cost.input > 0.0 || cost.output > 0.0)
|
||||
&& key
|
||||
.rsplit_once('/')
|
||||
.map(|(_, model)| model.ends_with(&bare_l))
|
||||
.unwrap_or(false)
|
||||
})
|
||||
.collect();
|
||||
if matches.is_empty() {
|
||||
return None;
|
||||
}
|
||||
matches.sort_by(|(a, _), (b, _)| {
|
||||
provider_rank(a)
|
||||
.cmp(&provider_rank(b))
|
||||
.then_with(|| a.cmp(b))
|
||||
});
|
||||
let (key, cost) = matches[0];
|
||||
Some((key.clone(), *cost))
|
||||
}
|
||||
|
||||
/// Subscription-plan models without any priced counterpart in the snapshot
|
||||
/// (e.g. the "Kimi For Coding" plan endpoint has no per-token price) bill at
|
||||
/// the flagship model of the same family for cost estimation.
|
||||
const PLAN_MODEL_FALLBACK: &[(&str, &str)] = &[
|
||||
("kimi-for-coding", "moonshotai/kimi-k3"),
|
||||
];
|
||||
|
||||
fn match_price_inner(model_name: &str) -> (String, f64, f64, f64, bool) {
|
||||
let bare = match model_name.rsplit_once('/') {
|
||||
Some((_, b)) => b,
|
||||
None => model_name,
|
||||
@@ -621,11 +690,30 @@ fn match_price(model_name: &str) -> (String, f64, f64, f64, bool) {
|
||||
return (id, c.cache_read, c.input, c.output, false);
|
||||
}
|
||||
// Zero-priced listing (subscription-plan entries such as
|
||||
// kimi-for-coding/k3-256k): bill at the base model's list price.
|
||||
if let Some(base) = strip_context_suffix(model_name) {
|
||||
if let Some((base_id, base_c)) = models_dev_lookup(&base) {
|
||||
if base_c.input > 0.0 || base_c.output > 0.0 {
|
||||
return (base_id, base_c.cache_read, base_c.input, base_c.output, false);
|
||||
// zhipuai-coding-plan/glm-5.2 or kimi-for-coding/kimi-for-coding):
|
||||
// bill at a priced equivalent — the full id first, then derived
|
||||
// variants (-highspeed / -free), then the context-size base, then the
|
||||
// curated flagship fallback.
|
||||
for base in [
|
||||
Some(model_name.to_string()),
|
||||
strip_variant_suffix(model_name),
|
||||
strip_context_suffix(model_name),
|
||||
]
|
||||
.into_iter()
|
||||
.flatten()
|
||||
{
|
||||
if let Some((bid, bc)) = priced_suffix_lookup(&base) {
|
||||
if bc.input > 0.0 || bc.output > 0.0 {
|
||||
return (bid, bc.cache_read, bc.input, bc.output, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
let bare = model_name.rsplit_once('/').map(|(_, b)| b).unwrap_or(model_name);
|
||||
let bare_l = bare.to_ascii_lowercase();
|
||||
for (plan, flagship) in PLAN_MODEL_FALLBACK {
|
||||
if bare_l.contains(plan) {
|
||||
if let Some((fid, fc)) = models_dev_lookup(flagship) {
|
||||
return (fid, fc.cache_read, fc.input, fc.output, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1537,6 +1625,7 @@ pub fn get_prices() -> PricesResult {
|
||||
|
||||
#[tauri::command]
|
||||
pub fn get_summary(home_override: Option<String>, range: Option<String>, refresh: Option<bool>) -> SummaryResult {
|
||||
let t0 = std::time::Instant::now();
|
||||
let refresh = refresh.unwrap_or(false);
|
||||
let home = resolve_kimi_home(home_override);
|
||||
let now_ms = std::time::SystemTime::now()
|
||||
@@ -1544,6 +1633,7 @@ pub fn get_summary(home_override: Option<String>, range: Option<String>, refresh
|
||||
let r = range.unwrap_or_else(|| "30d".into());
|
||||
|
||||
let (records, meta) = scan_usage_cached(&home, refresh);
|
||||
let t1 = std::time::Instant::now();
|
||||
let stats = aggregate(&records, &r, now_ms);
|
||||
let all_stats = aggregate(&records, "all", now_ms);
|
||||
let heatmap = build_heatmap(&records, now_ms);
|
||||
@@ -1568,6 +1658,15 @@ pub fn get_summary(home_override: Option<String>, range: Option<String>, refresh
|
||||
name, provider: std::env::var("KIMI_MODEL_PROVIDER").ok(), model: std::env::var("KIMI_MODEL_ID").ok(),
|
||||
});
|
||||
|
||||
let t2 = std::time::Instant::now();
|
||||
let scan_ms = t1.duration_since(t0).as_secs_f64() * 1000.0;
|
||||
let aggregate_ms = t2.duration_since(t1).as_secs_f64() * 1000.0;
|
||||
let total_ms = t2.duration_since(t0).as_secs_f64() * 1000.0;
|
||||
eprintln!(
|
||||
"[dashboard] get_summary range={} records={} scan={:.0}ms aggregate={:.0}ms total={:.0}ms",
|
||||
r, records.len(), scan_ms, aggregate_ms, total_ms
|
||||
);
|
||||
|
||||
SummaryResult {
|
||||
home: home.to_string_lossy().to_string(),
|
||||
valid: is_kimi_home(&home),
|
||||
@@ -1687,6 +1786,35 @@ mod pricing_tests {
|
||||
assert_eq!(strip_context_suffix("kimi-k2-thinking"), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn subscription_plan_models_bill_at_priced_equivalent() {
|
||||
// zhipuai-coding-plan/glm-5.2 is a zero-cost plan entry; the priced
|
||||
// official zhipuai/glm-5.2 must win.
|
||||
let (id, ch, input, output, est) = match_price("zhipuai-coding-plan/glm-5.2");
|
||||
assert!(!est);
|
||||
assert_eq!(id, "zhipuai/glm-5.2");
|
||||
assert_eq!(input, 1.4);
|
||||
assert_eq!(output, 4.4);
|
||||
assert_eq!(ch, 0.26);
|
||||
|
||||
// Kimi For Coding has no priced counterpart at all → curated flagship.
|
||||
let (id, _, input, _, est) = match_price("kimi-code/kimi-for-coding");
|
||||
assert!(!est);
|
||||
assert_eq!(id, "moonshotai/kimi-k3");
|
||||
assert_eq!(input, 3.0);
|
||||
|
||||
// -highspeed variants strip back to the priced base model.
|
||||
let (id, _, input, _, est) = match_price("zhipuai-coding-plan/glm-5.2-highspeed");
|
||||
assert!(!est);
|
||||
assert_eq!(id, "zhipuai/glm-5.2");
|
||||
assert_eq!(input, 1.4);
|
||||
assert_eq!(
|
||||
strip_variant_suffix("glm-5.2-highspeed").as_deref(),
|
||||
Some("glm-5.2")
|
||||
);
|
||||
assert_eq!(strip_variant_suffix("glm-5.2"), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cache_write_price_preferred_when_present() {
|
||||
// glm-4.6 has cache_write: 0 → cache creation billed at 0, not input.
|
||||
|
||||
@@ -79,7 +79,20 @@ pub async fn query_kimi_coding(api_key: &str, timeout: Duration) -> Result<Usage
|
||||
)
|
||||
.await?
|
||||
{
|
||||
Fetched::Body(body) => Ok(UsageResult::ok(parse_kimi_coding(&body))),
|
||||
Fetched::Body(body) => {
|
||||
let tiers = parse_kimi_coding(&body);
|
||||
if tiers.is_empty() {
|
||||
// 响应里没有可解析的套餐档位(limits/usage 缺失或字段变了)。
|
||||
// 把原始响应(仅用量数字,无密钥)透出,方便对照接口结构修复。
|
||||
let preview = serde_json::to_string(&body)
|
||||
.unwrap_or_else(|_| "<unserializable body>".into());
|
||||
let trimmed: String = preview.chars().take(400).collect();
|
||||
return Ok(UsageResult::failure(format!(
|
||||
"kimi usages 响应无套餐数据,原始返回: {trimmed}"
|
||||
)));
|
||||
}
|
||||
Ok(UsageResult::ok(tiers))
|
||||
}
|
||||
Fetched::Failed(err) => Ok(err),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"productName": "Kimi Switch",
|
||||
"version": "0.6.8",
|
||||
"version": "0.7.0",
|
||||
"identifier": "com.kimiswitch.app",
|
||||
"build": {
|
||||
"beforeDevCommand": "npm run dev",
|
||||
|
||||
@@ -699,6 +699,7 @@ function ModelMapping({
|
||||
<td className="px-4 py-2">
|
||||
<CapabilitiesCell
|
||||
capabilities={m.capabilities || []}
|
||||
nativeImage={getModelRef(m.model)?.image === true}
|
||||
onChange={(next) =>
|
||||
onModelChange({ ...m, capabilities: next })
|
||||
}
|
||||
@@ -822,9 +823,13 @@ function JsonPreview({
|
||||
function CapabilitiesCell({
|
||||
capabilities,
|
||||
onChange,
|
||||
nativeImage,
|
||||
}: {
|
||||
capabilities: string[];
|
||||
onChange: (next: string[]) => void;
|
||||
/** 模型本身是否原生支持图像输入(models.dev `image` 能力)。原生多模态
|
||||
* 模型无需 kimi-eyes 插件,提示不展示。 */
|
||||
nativeImage?: boolean;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -838,13 +843,12 @@ function CapabilitiesCell({
|
||||
|
||||
return (
|
||||
<div className="flex flex-wrap items-center gap-x-3 gap-y-1.5">
|
||||
{/* Only `thinking` is user-editable. The other capabilities
|
||||
(always_thinking / image_in / video_in / tool_use) are still
|
||||
auto-derived from models.dev via `capabilitiesFromRef` and saved
|
||||
to config.toml — they just aren't exposed for manual editing.
|
||||
To restore the full editor, drop the `.filter(...)` below and
|
||||
re-add the custom-capabilities input (see git history). */}
|
||||
{KNOWN_CAPABILITIES.filter((cap) => cap === "thinking").map((cap) => (
|
||||
{/* `thinking` 与 `image_in`(识图)可手动编辑;其余能力
|
||||
(always_thinking / video_in / tool_use) 仍由 models.dev 自动派生,
|
||||
保存时照常写入 config.toml。 */}
|
||||
{KNOWN_CAPABILITIES.filter(
|
||||
(cap) => cap === "thinking" || cap === "image_in",
|
||||
).map((cap) => (
|
||||
<label
|
||||
key={cap}
|
||||
className="flex items-center gap-1 text-xs text-content-muted cursor-pointer"
|
||||
@@ -858,6 +862,11 @@ function CapabilitiesCell({
|
||||
{t(CAPABILITY_LABELS[cap])}
|
||||
</label>
|
||||
))}
|
||||
{capabilities.includes("image_in") && !nativeImage && (
|
||||
<span className="w-full text-[11px] text-content-muted">
|
||||
{t("capImageInHint")}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -372,6 +372,30 @@ export function SettingsModal({
|
||||
<div>{t("appDescription")}</div>
|
||||
<div className="text-xs text-content-muted">v{appVersion} · MIT License</div>
|
||||
<div className="pt-2 space-y-1">
|
||||
<div>
|
||||
{t("settingsWebsite")}:{" "}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() =>
|
||||
openExternal("https://billowliu2.github.io/KimiSwitch")
|
||||
}
|
||||
className="text-blue-500 hover:text-blue-400 underline bg-transparent p-0 border-0 cursor-pointer"
|
||||
>
|
||||
billowliu2.github.io/KimiSwitch
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
{t("kimiEyesSite")}:{" "}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() =>
|
||||
openExternal("https://billowliu2.github.io/kimi-eyes")
|
||||
}
|
||||
className="text-blue-500 hover:text-blue-400 underline bg-transparent p-0 border-0 cursor-pointer"
|
||||
>
|
||||
billowliu2.github.io/kimi-eyes
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
{t("attributionPorted")}{" "}
|
||||
<button
|
||||
|
||||
@@ -357,7 +357,9 @@ export function UsageFooter({
|
||||
// success, or error/loading with last-good data (ghost).
|
||||
// Compact header already shows the primary entry; detail only adds value
|
||||
// when there are multiple tiers (e.g. 5h + weekly) or on error ghost.
|
||||
if (data.length <= 1 && status === "success") return null;
|
||||
// NOTE: single-tier plans (e.g. only five_hour) must still render — hiding
|
||||
// them made kimi-for-coding look like it had no plan quota at all.
|
||||
if (data.length === 0 && status === "success") return null;
|
||||
const ghost = status !== "success";
|
||||
return (
|
||||
<div
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { useMemo, useState } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
import { useTranslation } from "../../i18n";
|
||||
import { fmtPct, fmtTokens, fmtUsd } from "../../lib/dashboard-format";
|
||||
import { useCurrency } from "../../hooks/useCurrency";
|
||||
import { fmtPct, fmtTokens } from "../../lib/dashboard-format";
|
||||
import type { DailyRow } from "../../types/dashboard";
|
||||
import { DailyDetailModal } from "./DailyDetailModal";
|
||||
|
||||
@@ -43,6 +44,7 @@ function shortModel(model: string): string {
|
||||
|
||||
export function DailyBars({ daily, dimension, names, unknownProviderLabel }: DailyBarsProps) {
|
||||
const { t } = useTranslation();
|
||||
const { money } = useCurrency();
|
||||
const [selected, setSelected] = useState<DailyRow | null>(null);
|
||||
|
||||
const colorMap = useMemo(() => {
|
||||
@@ -103,7 +105,7 @@ export function DailyBars({ daily, dimension, names, unknownProviderLabel }: Dai
|
||||
|
||||
const tooltipLines = [
|
||||
d.date,
|
||||
`${t("totalTokens")}: ${fmtTokens(d.totalTokens)} · ${fmtUsd(d.costUsd)} · ${t("colCacheHit")} ${fmtPct(d.cacheHitRate)}`,
|
||||
`${t("totalTokens")}: ${fmtTokens(d.totalTokens)} · ${money(d.costUsd)} · ${t("colCacheHit")} ${fmtPct(d.cacheHitRate)}`,
|
||||
...segments.map((s) => `${displayName(s.key)}: ${fmtTokens(s.tokens)}`),
|
||||
"",
|
||||
t("doubleClickHint"),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useEffect } from "react";
|
||||
import { useTranslation } from "../../i18n";
|
||||
import { fmtPct, fmtTokens, fmtUsd } from "../../lib/dashboard-format";
|
||||
import { useCurrency } from "../../hooks/useCurrency";
|
||||
import { fmtPct, fmtTokens } from "../../lib/dashboard-format";
|
||||
import type { DailyRow } from "../../types/dashboard";
|
||||
import { modelColor } from "./DailyBars";
|
||||
|
||||
@@ -22,6 +23,7 @@ function shortModel(model: string): string {
|
||||
|
||||
export function DailyDetailModal({ day, dimension, colorMap, unknownProviderLabel, onClose }: DailyDetailModalProps) {
|
||||
const { t } = useTranslation();
|
||||
const { money } = useCurrency();
|
||||
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
@@ -106,7 +108,7 @@ export function DailyDetailModal({ day, dimension, colorMap, unknownProviderLabe
|
||||
{/* Day summary chips */}
|
||||
<div className="grid grid-cols-2 gap-2 px-5 py-3 sm:grid-cols-4">
|
||||
<SummaryChip label={t("totalTokens")} value={fmtTokens(day.totalTokens)} tone="default" />
|
||||
<SummaryChip label={t("cost")} value={fmtUsd(day.costUsd)} tone="orange" />
|
||||
<SummaryChip label={t("cost")} value={money(day.costUsd)} tone="orange" />
|
||||
<SummaryChip label={t("requests")} value={Math.round(day.requests).toLocaleString()} tone="blue" />
|
||||
<SummaryChip label={t("cacheHitRate")} value={fmtPct(day.cacheHitRate)} tone="green" />
|
||||
</div>
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
import { useState, type ReactNode } from "react";
|
||||
import { useDashboard, type DashboardRange } from "../../hooks/useDashboard";
|
||||
import { useCurrency } from "../../hooks/useCurrency";
|
||||
import { useTranslation } from "../../i18n";
|
||||
import { fmtInt, fmtPct, fmtTime, fmtTokens, fmtUsd } from "../../lib/dashboard-format";
|
||||
import { fmtInt, fmtPct, fmtTime, fmtTokens } from "../../lib/dashboard-format";
|
||||
import { DailyBars } from "./DailyBars";
|
||||
import { Heatmap } from "./Heatmap";
|
||||
import { TrendLineChart } from "./TrendLineChart";
|
||||
|
||||
const RANGES: DashboardRange[] = ["today", "7d", "30d", "all"];
|
||||
|
||||
/** Per-request cache hit rate: cached tokens / total input tokens. */
|
||||
function cacheHitOf(r: { inputOther: number; inputCacheRead: number }): number {
|
||||
const denom = r.inputOther + r.inputCacheRead;
|
||||
return denom > 0 ? r.inputCacheRead / denom : 0;
|
||||
}
|
||||
|
||||
function Card({
|
||||
title,
|
||||
subtitle,
|
||||
@@ -44,7 +51,8 @@ function KpiCard({ label, value, sub }: { label: string; value: string; sub?: st
|
||||
|
||||
export function DashboardPage() {
|
||||
const { t } = useTranslation();
|
||||
const { range, changeRange, data, loading, error, refresh } = useDashboard();
|
||||
const { money } = useCurrency();
|
||||
const { range, changeRange, data, loading, error, refresh, loadStats } = useDashboard();
|
||||
const [showAllModels, setShowAllModels] = useState(false);
|
||||
const [recentPage, setRecentPage] = useState(1);
|
||||
const [trendTab, setTrendTab] = useState<"daily" | "model" | "provider">("daily");
|
||||
@@ -120,28 +128,35 @@ export function DashboardPage() {
|
||||
{ label: t("kpiCacheCreation"), value: fmtTokens(totals.inputCacheCreation), sub: fmtInt(totals.inputCacheCreation) },
|
||||
{ label: t("kpiCacheHit"), value: fmtPct(totals.cacheHitRate) },
|
||||
{ label: t("totalTokens"), value: fmtTokens(totals.totalTokens), sub: fmtInt(totals.totalTokens) },
|
||||
{ label: t("kpiCost"), value: fmtUsd(totals.costUsd) },
|
||||
{ label: t("kpiCost"), value: money(totals.costUsd) },
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="h-full overflow-auto p-4 space-y-4">
|
||||
{/* Range tabs + refresh */}
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center bg-input border border-border rounded p-0.5">
|
||||
{RANGES.map((r) => (
|
||||
<button
|
||||
key={r}
|
||||
type="button"
|
||||
onClick={() => changeRange(r)}
|
||||
className={`px-3 py-1 text-sm rounded transition-colors ${
|
||||
range === r
|
||||
? "bg-blue-600 text-white"
|
||||
: "text-content-muted hover:text-content-primary"
|
||||
}`}
|
||||
>
|
||||
{RANGE_LABELS[r]}
|
||||
</button>
|
||||
))}
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="flex items-center bg-input border border-border rounded p-0.5">
|
||||
{RANGES.map((r) => (
|
||||
<button
|
||||
key={r}
|
||||
type="button"
|
||||
onClick={() => changeRange(r)}
|
||||
className={`px-3 py-1 text-sm rounded transition-colors ${
|
||||
range === r
|
||||
? "bg-blue-600 text-white"
|
||||
: "text-content-muted hover:text-content-primary"
|
||||
}`}
|
||||
>
|
||||
{RANGE_LABELS[r]}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
{loadStats && !loading && (
|
||||
<span className="hidden text-[10px] text-content-muted sm:inline">
|
||||
{t("loadStats", { ms: loadStats.ms, kb: loadStats.kb })}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
@@ -175,7 +190,7 @@ export function DashboardPage() {
|
||||
{fmtTokens(tot.totalTokens)}
|
||||
</div>
|
||||
<div className="mt-1 text-[11px] text-content-muted">
|
||||
{fmtInt(tot.requests)} {t("unitTimes")} · {fmtUsd(tot.costUsd)} · {fmtPct(tot.cacheHitRate)}
|
||||
{fmtInt(tot.requests)} {t("unitTimes")} · {money(tot.costUsd)} · {fmtPct(tot.cacheHitRate)}
|
||||
</div>
|
||||
</button>
|
||||
);
|
||||
@@ -305,7 +320,7 @@ export function DashboardPage() {
|
||||
<td className="py-2 pr-3 text-right text-content-muted">{fmtInt(m.requests)}</td>
|
||||
<td className="py-2 pr-3 text-right text-content-muted">{fmtTokens(m.totalTokens)}</td>
|
||||
<td className="py-2 pr-3 text-right text-content-muted">{fmtPct(m.cacheHitRate)}</td>
|
||||
<td className="py-2 text-right text-orange-600 dark:text-orange-400">{fmtUsd(m.costUsd)}</td>
|
||||
<td className="py-2 text-right text-orange-600 dark:text-orange-400">{money(m.costUsd)}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
@@ -346,6 +361,7 @@ export function DashboardPage() {
|
||||
<th className="pb-2 pr-4 font-normal text-right">{t("colInput")}</th>
|
||||
<th className="pb-2 pr-4 font-normal text-right">{t("colOutput")}</th>
|
||||
<th className="pb-2 pr-4 font-normal text-right">{t("colCacheRead")}</th>
|
||||
<th className="pb-2 pr-4 font-normal text-right">{t("colCacheHit")}</th>
|
||||
<th className="pb-2 font-normal text-right">{t("cost")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -359,7 +375,8 @@ export function DashboardPage() {
|
||||
<td className="py-1.5 pr-4 text-right text-content-muted">{fmtTokens(r.inputOther)}</td>
|
||||
<td className="py-1.5 pr-4 text-right text-content-muted">{fmtTokens(r.output)}</td>
|
||||
<td className="py-1.5 pr-4 text-right text-content-muted">{fmtTokens(r.inputCacheRead)}</td>
|
||||
<td className="py-1.5 text-right text-orange-600 dark:text-orange-400">{fmtUsd(r.costUsd)}</td>
|
||||
<td className="py-1.5 pr-4 text-right text-content-muted">{fmtPct(cacheHitOf(r))}</td>
|
||||
<td className="py-1.5 text-right text-orange-600 dark:text-orange-400">{money(r.costUsd)}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { useEffect, useMemo, useRef, useState, type MouseEvent } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
import { useTranslation } from "../../i18n";
|
||||
import { fmtPct, fmtTokens, fmtUsd } from "../../lib/dashboard-format";
|
||||
import { useCurrency } from "../../hooks/useCurrency";
|
||||
import { fmtPct, fmtTokens } from "../../lib/dashboard-format";
|
||||
import type { HeatmapCell, HeatmapData } from "../../types/dashboard";
|
||||
|
||||
interface HeatmapProps {
|
||||
@@ -220,6 +221,7 @@ export function Heatmap({ heatmap }: HeatmapProps) {
|
||||
|
||||
function HeatmapTooltip({ state }: { state: HoverState }) {
|
||||
const { t } = useTranslation();
|
||||
const { money } = useCurrency();
|
||||
const { cell, x, y } = state;
|
||||
// Position above the cursor with a small offset; flip below if too close to top.
|
||||
const offset = 14;
|
||||
@@ -239,7 +241,7 @@ function HeatmapTooltip({ state }: { state: HoverState }) {
|
||||
>
|
||||
<div className="font-medium text-content-primary">{cell.date}</div>
|
||||
<div className="text-content-muted">
|
||||
{fmtTokens(cell.totalTokens)} · {fmtUsd(cell.costUsd)} ·{" "}
|
||||
{fmtTokens(cell.totalTokens)} · {money(cell.costUsd)} ·{" "}
|
||||
{fmtInt(cell.requests)} {t("requests")}
|
||||
</div>
|
||||
<div className="text-content-muted">
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { useTranslation } from "../i18n";
|
||||
import { fmtUsd } from "../lib/dashboard-format";
|
||||
|
||||
/**
|
||||
* USD → CNY exchange rate for the dashboard.
|
||||
* Chinese mode shows prices in CNY (latest available rate), English stays in
|
||||
* USD. The rate is fetched once and cached in localStorage for 12h; any
|
||||
* failure falls back to a conservative fixed rate so the UI never blocks.
|
||||
*/
|
||||
|
||||
const FALLBACK_RATE = 7.2;
|
||||
const CACHE_KEY = "kimi-switch-cny-rate";
|
||||
const CACHE_TTL = 12 * 60 * 60 * 1000; // 12 hours
|
||||
|
||||
function readCachedRate(): number | null {
|
||||
try {
|
||||
const raw = localStorage.getItem(CACHE_KEY);
|
||||
if (!raw) return null;
|
||||
const { ts, rate } = JSON.parse(raw) as { ts: number; rate: number };
|
||||
if (Date.now() - ts > CACHE_TTL || !(rate > 1)) return null;
|
||||
return rate;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function writeCachedRate(rate: number) {
|
||||
try {
|
||||
localStorage.setItem(CACHE_KEY, JSON.stringify({ ts: Date.now(), rate }));
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
|
||||
export function useCurrency() {
|
||||
const { lang } = useTranslation();
|
||||
const [rate, setRate] = useState<number | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
(async () => {
|
||||
const cached = readCachedRate();
|
||||
if (cached) {
|
||||
setRate(cached);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const res = await fetch("https://open.er-api.com/v6/latest/USD");
|
||||
if (res.ok) {
|
||||
const data = (await res.json()) as { rates?: { CNY?: number } };
|
||||
const cny = Number(data.rates?.CNY);
|
||||
if (cny > 1) {
|
||||
if (!cancelled) setRate(cny);
|
||||
writeCachedRate(cny);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
/* network blocked → fallback */
|
||||
}
|
||||
if (!cancelled) setRate(FALLBACK_RATE);
|
||||
})();
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, []);
|
||||
|
||||
/** Format a USD cost for display: CNY in Chinese mode, USD otherwise. */
|
||||
const money = useCallback(
|
||||
(usd: number): string => {
|
||||
if (lang !== "zh") return fmtUsd(usd);
|
||||
const v = (Number(usd) || 0) * (rate ?? FALLBACK_RATE);
|
||||
if (v === 0) return "¥0.00";
|
||||
if (v < 0.1) return "¥" + v.toFixed(3);
|
||||
if (v < 1) return "¥" + v.toFixed(2);
|
||||
return "¥" + v.toFixed(2);
|
||||
},
|
||||
[lang, rate],
|
||||
);
|
||||
|
||||
return { money, cnyRate: rate ?? FALLBACK_RATE };
|
||||
}
|
||||
@@ -22,16 +22,23 @@ export function useDashboard() {
|
||||
const [data, setData] = useState<SummaryResult | null>(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
/** Round-trip timing for the last get_summary call (user-perceived lag). */
|
||||
const [loadStats, setLoadStats] = useState<{ ms: number; kb: number } | null>(null);
|
||||
|
||||
const refresh = useCallback(async (force = false) => {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
const start = performance.now();
|
||||
try {
|
||||
const result = await invoke<SummaryResult>("get_summary", {
|
||||
range,
|
||||
refresh: force,
|
||||
});
|
||||
setData(result);
|
||||
setLoadStats({
|
||||
ms: Math.round(performance.now() - start),
|
||||
kb: Math.round(JSON.stringify(result).length / 1024),
|
||||
});
|
||||
} catch (err) {
|
||||
const msg = err instanceof Error ? err.message : String(err);
|
||||
setError(msg);
|
||||
@@ -53,5 +60,5 @@ export function useDashboard() {
|
||||
}
|
||||
}, []);
|
||||
|
||||
return { range, changeRange, data, loading, error, refresh };
|
||||
return { range, changeRange, data, loading, error, refresh, loadStats };
|
||||
}
|
||||
@@ -163,6 +163,7 @@ export const enTranslations: Record<TranslationKey, string> = {
|
||||
capThinking: "Thinking",
|
||||
capAlwaysThinking: "Always Thinking",
|
||||
capImageIn: "Image Input",
|
||||
capImageInHint: "Text models actually need the plugin-kimi-eyes:kimi-eyes plugin for image recognition",
|
||||
capVideoIn: "Video Input",
|
||||
capToolUse: "Tool Use",
|
||||
customCapabilities: "Other capabilities (comma-separated)",
|
||||
@@ -197,6 +198,7 @@ export const enTranslations: Record<TranslationKey, string> = {
|
||||
scanning: "Scanning…",
|
||||
refresh: "Refresh",
|
||||
refreshing: "Refreshing…",
|
||||
loadStats: "Loaded in {ms} ms · {kb} KB payload",
|
||||
refreshed: "Refreshed",
|
||||
cancel: "Cancel",
|
||||
confirmDeleteTitle: "Delete session forever?",
|
||||
@@ -260,6 +262,8 @@ export const enTranslations: Record<TranslationKey, string> = {
|
||||
updateCheckFailed: "Update check failed",
|
||||
lastChecked: "Last checked",
|
||||
appDescription: "Windows desktop LLM provider config manager",
|
||||
settingsWebsite: "Official website",
|
||||
kimiEyesSite: "Kimi Eyes plugin site",
|
||||
referenceProject: "Reference project",
|
||||
|
||||
// Validation errors
|
||||
|
||||
@@ -161,6 +161,7 @@ export const zhTranslations = {
|
||||
capThinking: "思考",
|
||||
capAlwaysThinking: "始终思考",
|
||||
capImageIn: "图像输入",
|
||||
capImageInHint: "文本推理模型实际需要搭配 plugin-kimi-eyes:kimi-eyes 插件才能识图",
|
||||
capVideoIn: "视频输入",
|
||||
capToolUse: "工具调用",
|
||||
customCapabilities: "其他能力(逗号分隔)",
|
||||
@@ -194,6 +195,7 @@ export const zhTranslations = {
|
||||
scanning: "扫描中…",
|
||||
refresh: "刷新",
|
||||
refreshing: "刷新中…",
|
||||
loadStats: "加载 {ms} ms · 数据 {kb} KB",
|
||||
refreshed: "已刷新",
|
||||
cancel: "取消",
|
||||
confirmDeleteTitle: "永久删除会话?",
|
||||
@@ -255,6 +257,8 @@ export const zhTranslations = {
|
||||
updateCheckFailed: "检查更新失败",
|
||||
lastChecked: "上次检查",
|
||||
appDescription: "Windows 桌面端 LLM 供应商配置管理器",
|
||||
settingsWebsite: "官方网站",
|
||||
kimiEyesSite: "Kimi Eyes 插件站",
|
||||
referenceProject: "引用项目",
|
||||
|
||||
// Validation errors
|
||||
|
||||
+703
-92
File diff suppressed because it is too large.
Load diff
+594
-72
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"last_updated": "2026-08-01",
|
||||
"last_updated": "2026-08-02",
|
||||
"zhipuai/glm-5": {
|
||||
"name": "GLM-5",
|
||||
"context": 204800,
|
||||
@@ -600,6 +600,18 @@
|
||||
"cache_read": 0.145
|
||||
}
|
||||
},
|
||||
"fireworks-ai/accounts/fireworks/models/deepseek-v4-flash-0731": {
|
||||
"name": "DeepSeek V4 Flash 0731",
|
||||
"context": 1000000,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"cost": {
|
||||
"input": 0.14,
|
||||
"output": 0.28,
|
||||
"cache_read": 0.028
|
||||
}
|
||||
},
|
||||
"fireworks-ai/accounts/fireworks/models/kimi-k2p7-code": {
|
||||
"name": "Kimi K2.7 Code",
|
||||
"context": 262000,
|
||||
@@ -1320,6 +1332,21 @@
|
||||
"cache_write": 0.3
|
||||
}
|
||||
},
|
||||
"crossmodel/gemini/gemini-3.5-flash-lite": {
|
||||
"name": "Gemini 3.5 Flash Lite",
|
||||
"context": 1048576,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"image": true,
|
||||
"video": true,
|
||||
"cost": {
|
||||
"input": 0.3,
|
||||
"output": 2.5,
|
||||
"cache_read": 0.03,
|
||||
"cache_write": 0.3
|
||||
}
|
||||
},
|
||||
"crossmodel/gemini/gemini-3-flash-preview": {
|
||||
"name": "Gemini 3 Flash Preview",
|
||||
"context": 1048576,
|
||||
@@ -3884,6 +3911,19 @@
|
||||
"cache_read": 0.12
|
||||
}
|
||||
},
|
||||
"baseten/thinkingmachines/inkling-small": {
|
||||
"name": "Inkling Small",
|
||||
"context": 1048576,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"image": true,
|
||||
"cost": {
|
||||
"input": 0.5,
|
||||
"output": 1.2,
|
||||
"cache_read": 0.1
|
||||
}
|
||||
},
|
||||
"baseten/thinkingmachines/inkling": {
|
||||
"name": "Inkling",
|
||||
"context": 1048576,
|
||||
@@ -3966,6 +4006,18 @@
|
||||
"output": 1.2
|
||||
}
|
||||
},
|
||||
"baseten/deepseek-ai/DeepSeek-V4-Flash-0731": {
|
||||
"name": "DeepSeek V4 Flash 0731",
|
||||
"context": 1048576,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"cost": {
|
||||
"input": 0.13,
|
||||
"output": 0.26,
|
||||
"cache_read": 0.028
|
||||
}
|
||||
},
|
||||
"baseten/deepseek-ai/DeepSeek-V3.1": {
|
||||
"name": "DeepSeek V3.1",
|
||||
"context": 164000,
|
||||
@@ -6220,7 +6272,7 @@
|
||||
"cache_write": 0
|
||||
}
|
||||
},
|
||||
"zhipuai-coding-plan/glm-5.2-highspeed[1m]": {
|
||||
"zhipuai-coding-plan/glm-5.2-highspeed": {
|
||||
"name": "GLM-5.2 Highspeed",
|
||||
"context": 1000000,
|
||||
"reasoning": true,
|
||||
@@ -13610,6 +13662,8 @@
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"image": true,
|
||||
"video": true,
|
||||
"cost": {
|
||||
"input": 0,
|
||||
"output": 0
|
||||
@@ -13674,7 +13728,8 @@
|
||||
"structured_output": true,
|
||||
"cost": {
|
||||
"input": 5,
|
||||
"output": 5
|
||||
"output": 5,
|
||||
"cache_read": 0.5
|
||||
}
|
||||
},
|
||||
"abliteration-ai/abliterated-model": {
|
||||
@@ -13685,7 +13740,8 @@
|
||||
"image": true,
|
||||
"cost": {
|
||||
"input": 3,
|
||||
"output": 3
|
||||
"output": 3,
|
||||
"cache_read": 0.3
|
||||
}
|
||||
},
|
||||
"alibaba-coding-plan-cn/qwen3.7-plus": {
|
||||
@@ -14520,6 +14576,8 @@
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"image": true,
|
||||
"video": true,
|
||||
"cost": {
|
||||
"input": 0.1,
|
||||
"output": 0.15
|
||||
@@ -15883,6 +15941,20 @@
|
||||
"cache_read": 0.2
|
||||
}
|
||||
},
|
||||
"llmgateway/kimi-k3-fast": {
|
||||
"name": "Kimi K3",
|
||||
"context": 1040384,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"image": true,
|
||||
"video": true,
|
||||
"cost": {
|
||||
"input": 4.5,
|
||||
"output": 22.5,
|
||||
"cache_read": 0.45
|
||||
}
|
||||
},
|
||||
"llmgateway/claude-opus-5": {
|
||||
"name": "Claude Opus 5",
|
||||
"context": 1000000,
|
||||
@@ -23525,6 +23597,8 @@
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"image": true,
|
||||
"video": true,
|
||||
"cost": {
|
||||
"input": 0.3,
|
||||
"output": 0.3,
|
||||
@@ -23853,7 +23927,8 @@
|
||||
"structured_output": true,
|
||||
"cost": {
|
||||
"input": 0.95,
|
||||
"output": 2.55
|
||||
"output": 2.55,
|
||||
"cache_read": 0.2
|
||||
}
|
||||
},
|
||||
"siliconflow/zai-org/GLM-4.5-Air": {
|
||||
@@ -23875,6 +23950,7 @@
|
||||
"cost": {
|
||||
"input": 1.4,
|
||||
"output": 4.4,
|
||||
"cache_read": 0.26,
|
||||
"cache_write": 0
|
||||
}
|
||||
},
|
||||
@@ -23887,6 +23963,7 @@
|
||||
"cost": {
|
||||
"input": 1.4,
|
||||
"output": 4.4,
|
||||
"cache_read": 0.26,
|
||||
"cache_write": 0
|
||||
}
|
||||
},
|
||||
@@ -23899,6 +23976,7 @@
|
||||
"cost": {
|
||||
"input": 1.2,
|
||||
"output": 4,
|
||||
"cache_read": 0.24,
|
||||
"cache_write": 0
|
||||
}
|
||||
},
|
||||
@@ -24174,7 +24252,8 @@
|
||||
"tool_call": true,
|
||||
"cost": {
|
||||
"input": 0.3,
|
||||
"output": 1.2
|
||||
"output": 1.2,
|
||||
"cache_read": 0.03
|
||||
}
|
||||
},
|
||||
"siliconflow/inclusionAI/Ling-flash-2.0": {
|
||||
@@ -24319,7 +24398,8 @@
|
||||
"image": true,
|
||||
"cost": {
|
||||
"input": 0.45,
|
||||
"output": 2.25
|
||||
"output": 2.25,
|
||||
"cache_read": 0.07
|
||||
}
|
||||
},
|
||||
"siliconflow/openai/gpt-oss-20b": {
|
||||
@@ -29988,8 +30068,9 @@
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"cost": {
|
||||
"input": 0.125,
|
||||
"output": 0.5
|
||||
"input": 0.06,
|
||||
"output": 0.4,
|
||||
"cache_read": 0.01
|
||||
}
|
||||
},
|
||||
"venice/llama-3.2-3b": {
|
||||
@@ -30013,6 +30094,18 @@
|
||||
"output": 225
|
||||
}
|
||||
},
|
||||
"venice/deepseek-v4-flash-0731": {
|
||||
"name": "DeepSeek V4 Flash 0731",
|
||||
"context": 1000000,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"cost": {
|
||||
"input": 0.175,
|
||||
"output": 0.35,
|
||||
"cache_read": 0.035
|
||||
}
|
||||
},
|
||||
"venice/qwen3-235b-a22b-instruct-2507": {
|
||||
"name": "Qwen 3 235B A22B Instruct 2507",
|
||||
"context": 128000,
|
||||
@@ -30792,7 +30885,8 @@
|
||||
"structured_output": true,
|
||||
"cost": {
|
||||
"input": 1.4,
|
||||
"output": 4.4
|
||||
"output": 4.4,
|
||||
"cache_read": 0.26
|
||||
}
|
||||
},
|
||||
"togetherai/pearl-ai/gemma-4-31b-it": {
|
||||
@@ -30849,7 +30943,8 @@
|
||||
"tool_call": true,
|
||||
"cost": {
|
||||
"input": 1.25,
|
||||
"output": 3.75
|
||||
"output": 3.75,
|
||||
"cache_read": 0.125
|
||||
}
|
||||
},
|
||||
"togetherai/Qwen/Qwen3-235B-A22B-Instruct-2507-tput": {
|
||||
@@ -30869,7 +30964,8 @@
|
||||
"image": true,
|
||||
"cost": {
|
||||
"input": 0.6,
|
||||
"output": 3.6
|
||||
"output": 3.6,
|
||||
"cache_read": 0.35
|
||||
}
|
||||
},
|
||||
"togetherai/Qwen/Qwen3.6-Plus": {
|
||||
@@ -33439,6 +33535,19 @@
|
||||
"cache_read": 0.27
|
||||
}
|
||||
},
|
||||
"modal/moonshotai/Kimi-K3": {
|
||||
"name": "Kimi K3",
|
||||
"context": 1048576,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"image": true,
|
||||
"cost": {
|
||||
"input": 3,
|
||||
"output": 15,
|
||||
"cache_read": 0.3
|
||||
}
|
||||
},
|
||||
"qihang-ai/gemini-2.5-flash": {
|
||||
"name": "Gemini 2.5 Flash",
|
||||
"context": 1048576,
|
||||
@@ -33814,7 +33923,9 @@
|
||||
"tool_call": true,
|
||||
"cost": {
|
||||
"input": 2.1,
|
||||
"output": 8.4
|
||||
"output": 8.4,
|
||||
"cache_read": 2.1,
|
||||
"cache_write": 8.4
|
||||
}
|
||||
},
|
||||
"moark/GLM-4.7": {
|
||||
@@ -37298,6 +37409,8 @@
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"image": true,
|
||||
"video": true,
|
||||
"cost": {
|
||||
"input": 0.16,
|
||||
"output": 0.48
|
||||
@@ -38030,7 +38143,7 @@
|
||||
"cache_write": 0
|
||||
}
|
||||
},
|
||||
"zai-coding-plan/glm-5.2-highspeed[1m]": {
|
||||
"zai-coding-plan/glm-5.2-highspeed": {
|
||||
"name": "GLM-5.2 Highspeed",
|
||||
"context": 1000000,
|
||||
"reasoning": true,
|
||||
@@ -39859,7 +39972,9 @@
|
||||
"tool_call": true,
|
||||
"cost": {
|
||||
"input": 0.3,
|
||||
"output": 1.2
|
||||
"output": 1.2,
|
||||
"cache_read": 0.03,
|
||||
"cache_write": 0.375
|
||||
}
|
||||
},
|
||||
"minimax/MiniMax-M2.5": {
|
||||
@@ -40611,6 +40726,303 @@
|
||||
"cache_read": 0.11
|
||||
}
|
||||
},
|
||||
"tensorx/nvidia/nemotron-3-super-120b-a12b": {
|
||||
"name": "Nemotron 3 Super 120B A12B",
|
||||
"context": 262144,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"cost": {
|
||||
"input": 0.3,
|
||||
"output": 0.9,
|
||||
"cache_read": 0.075,
|
||||
"cache_write": 0.375
|
||||
}
|
||||
},
|
||||
"tensorx/qwen/qwen3-coder-30b-a3b-instruct": {
|
||||
"name": "Qwen3-Coder 30B-A3B Instruct",
|
||||
"context": 262000,
|
||||
"tool_call": true,
|
||||
"cost": {
|
||||
"input": 0.06,
|
||||
"output": 0.25,
|
||||
"cache_read": 0.015,
|
||||
"cache_write": 0.075
|
||||
}
|
||||
},
|
||||
"tensorx/qwen/qwen3.5-9b": {
|
||||
"name": "Qwen3.5 9B",
|
||||
"context": 262144,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"image": true,
|
||||
"video": true,
|
||||
"cost": {
|
||||
"input": 0.15,
|
||||
"output": 0.2,
|
||||
"cache_read": 0.0375,
|
||||
"cache_write": 0.1875
|
||||
}
|
||||
},
|
||||
"tensorx/qwen/qwen3-vl-235b-a22b-instruct": {
|
||||
"name": "Qwen3 VL 235B-A22B Instruct",
|
||||
"context": 131000,
|
||||
"tool_call": true,
|
||||
"image": true,
|
||||
"cost": {
|
||||
"input": 0.21,
|
||||
"output": 1.9,
|
||||
"cache_read": 0.0525,
|
||||
"cache_write": 0.2625
|
||||
}
|
||||
},
|
||||
"tensorx/qwen/qwen3-235b-a22b-2507": {
|
||||
"name": "Qwen3 235B-A22B-2507",
|
||||
"context": 131000,
|
||||
"tool_call": true,
|
||||
"cost": {
|
||||
"input": 0.072,
|
||||
"output": 0.464,
|
||||
"cache_read": 0.018,
|
||||
"cache_write": 0.09
|
||||
}
|
||||
},
|
||||
"tensorx/qwen/qwen3.5-122b-a10b": {
|
||||
"name": "Qwen3.5 122B-A10B",
|
||||
"context": 262144,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"image": true,
|
||||
"video": true,
|
||||
"cost": {
|
||||
"input": 0.5,
|
||||
"output": 3.5,
|
||||
"cache_read": 0.125,
|
||||
"cache_write": 0.625
|
||||
}
|
||||
},
|
||||
"tensorx/minimax/minimax-m3": {
|
||||
"name": "MiniMax-M3",
|
||||
"context": 1048576,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"image": true,
|
||||
"video": true,
|
||||
"cost": {
|
||||
"input": 0.4,
|
||||
"output": 2,
|
||||
"cache_read": 0.1
|
||||
}
|
||||
},
|
||||
"tensorx/minimax/minimax-m2.5": {
|
||||
"name": "MiniMax-M2.5",
|
||||
"context": 196608,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"cost": {
|
||||
"input": 0.3,
|
||||
"output": 1.2,
|
||||
"cache_read": 0.075,
|
||||
"cache_write": 0.375
|
||||
}
|
||||
},
|
||||
"tensorx/deepseek/deepseek-v4-flash": {
|
||||
"name": "DeepSeek V4 Flash",
|
||||
"context": 1048576,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"cost": {
|
||||
"input": 0.15,
|
||||
"output": 0.3,
|
||||
"cache_read": 0.0375,
|
||||
"cache_write": 0.1875
|
||||
}
|
||||
},
|
||||
"tensorx/deepseek/deepseek-v4-pro": {
|
||||
"name": "DeepSeek V4 Pro",
|
||||
"context": 1048576,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"cost": {
|
||||
"input": 1.75,
|
||||
"output": 3.5,
|
||||
"cache_read": 0.4375,
|
||||
"cache_write": 2.185
|
||||
}
|
||||
},
|
||||
"tensorx/deepseek/deepseek-r1-0528": {
|
||||
"name": "DeepSeek R1-0528",
|
||||
"context": 164000,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"cost": {
|
||||
"input": 0.66,
|
||||
"output": 2.6,
|
||||
"cache_read": 0.165,
|
||||
"cache_write": 0.825
|
||||
}
|
||||
},
|
||||
"tensorx/deepseek/deepseek-v3.2": {
|
||||
"name": "DeepSeek V3.2",
|
||||
"context": 163840,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"cost": {
|
||||
"input": 0.3,
|
||||
"output": 0.5,
|
||||
"cache_read": 0.075,
|
||||
"cache_write": 0.375
|
||||
}
|
||||
},
|
||||
"tensorx/deepseek/deepseek-chat-v3.1": {
|
||||
"name": "DeepSeek Chat V3.1",
|
||||
"context": 164000,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"cost": {
|
||||
"input": 0.2,
|
||||
"output": 0.8,
|
||||
"cache_read": 0.05,
|
||||
"cache_write": 0.25
|
||||
}
|
||||
},
|
||||
"tensorx/z-ai/glm-5": {
|
||||
"name": "GLM-5",
|
||||
"context": 202752,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"cost": {
|
||||
"input": 1,
|
||||
"output": 3.2,
|
||||
"cache_read": 0.25,
|
||||
"cache_write": 1.25
|
||||
}
|
||||
},
|
||||
"tensorx/z-ai/glm-5.1": {
|
||||
"name": "GLM-5.1",
|
||||
"context": 202752,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"cost": {
|
||||
"input": 1.4,
|
||||
"output": 4.4,
|
||||
"cache_read": 0.35,
|
||||
"cache_write": 1.75
|
||||
}
|
||||
},
|
||||
"tensorx/z-ai/glm-5.2": {
|
||||
"name": "GLM-5.2",
|
||||
"context": 1048576,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"cost": {
|
||||
"input": 1.5,
|
||||
"output": 4.5,
|
||||
"cache_read": 0.375
|
||||
}
|
||||
},
|
||||
"tensorx/z-ai/glm-4.7": {
|
||||
"name": "GLM-4.7",
|
||||
"context": 200000,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"image": true,
|
||||
"cost": {
|
||||
"input": 0.6,
|
||||
"output": 2.2,
|
||||
"cache_read": 0.15,
|
||||
"cache_write": 0.75
|
||||
}
|
||||
},
|
||||
"tensorx/z-ai/glm-5-turbo": {
|
||||
"name": "GLM-5-Turbo",
|
||||
"context": 202752,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"cost": {
|
||||
"input": 1.2,
|
||||
"output": 4,
|
||||
"cache_read": 0.3,
|
||||
"cache_write": 1.5
|
||||
}
|
||||
},
|
||||
"tensorx/z-ai/glm-5v-turbo": {
|
||||
"name": "GLM-5V-Turbo",
|
||||
"context": 202752,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"image": true,
|
||||
"video": true,
|
||||
"cost": {
|
||||
"input": 1.2,
|
||||
"output": 4,
|
||||
"cache_read": 0.3,
|
||||
"cache_write": 1.5
|
||||
}
|
||||
},
|
||||
"tensorx/moonshotai/kimi-k2.5": {
|
||||
"name": "Kimi K2.5",
|
||||
"context": 262144,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"image": true,
|
||||
"video": true,
|
||||
"cost": {
|
||||
"input": 0.5,
|
||||
"output": 2.8,
|
||||
"cache_read": 0.125,
|
||||
"cache_write": 0.625
|
||||
}
|
||||
},
|
||||
"tensorx/moonshotai/kimi-k2.6": {
|
||||
"name": "Kimi K2.6",
|
||||
"context": 262144,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"image": true,
|
||||
"video": true,
|
||||
"cost": {
|
||||
"input": 1,
|
||||
"output": 4,
|
||||
"cache_read": 0.25,
|
||||
"cache_write": 1.25
|
||||
}
|
||||
},
|
||||
"tensorx/moonshotai/kimi-k2.7-code": {
|
||||
"name": "Kimi K2.7 Code",
|
||||
"context": 262144,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"image": true,
|
||||
"video": true,
|
||||
"cost": {
|
||||
"input": 1.25,
|
||||
"output": 4.5,
|
||||
"cache_read": 0.3125
|
||||
}
|
||||
},
|
||||
"tensorx/openai/gpt-oss-120b": {
|
||||
"name": "GPT OSS 120B",
|
||||
"context": 131072,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"cost": {
|
||||
"input": 0.04,
|
||||
"output": 0.2,
|
||||
"cache_read": 0.01,
|
||||
"cache_write": 0.05
|
||||
}
|
||||
},
|
||||
"llama/cerebras-llama-4-maverick-17b-128e-instruct": {
|
||||
"name": "Cerebras-Llama-4-Maverick-17B-128E-Instruct",
|
||||
"context": 128000,
|
||||
@@ -45975,6 +46387,109 @@
|
||||
"output": 2.92
|
||||
}
|
||||
},
|
||||
"modelis/claude-sonnet-4-6": {
|
||||
"name": "Claude Sonnet 4.6",
|
||||
"context": 1000000,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"image": true,
|
||||
"cost": {
|
||||
"input": 3,
|
||||
"output": 15
|
||||
}
|
||||
},
|
||||
"modelis/gemini-2.5-flash": {
|
||||
"name": "Gemini 2.5 Flash",
|
||||
"context": 1048576,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"image": true,
|
||||
"video": true,
|
||||
"cost": {
|
||||
"input": 0.3,
|
||||
"output": 2.5
|
||||
}
|
||||
},
|
||||
"modelis/claude-fable-5": {
|
||||
"name": "Claude Fable 5",
|
||||
"context": 1000000,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"image": true,
|
||||
"cost": {
|
||||
"input": 10,
|
||||
"output": 50
|
||||
}
|
||||
},
|
||||
"modelis/deepseek-v4-flash": {
|
||||
"name": "DeepSeek V4 Flash",
|
||||
"context": 1000000,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"cost": {
|
||||
"input": 0.0983,
|
||||
"output": 0.1966
|
||||
}
|
||||
},
|
||||
"modelis/claude-opus-4-8": {
|
||||
"name": "Claude Opus 4.8",
|
||||
"context": 1000000,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"image": true,
|
||||
"cost": {
|
||||
"input": 5,
|
||||
"output": 25
|
||||
}
|
||||
},
|
||||
"modelis/deepseek-v4-pro": {
|
||||
"name": "DeepSeek V4 Pro",
|
||||
"context": 1000000,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"cost": {
|
||||
"input": 0.435,
|
||||
"output": 0.87
|
||||
}
|
||||
},
|
||||
"modelis/gemini-2.5-pro": {
|
||||
"name": "Gemini 2.5 Pro",
|
||||
"context": 1048576,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"image": true,
|
||||
"video": true,
|
||||
"cost": {
|
||||
"input": 1.25,
|
||||
"output": 10
|
||||
}
|
||||
},
|
||||
"modelis/qwen/qwen3.7-plus": {
|
||||
"name": "Qwen3.7 Plus",
|
||||
"context": 1000000,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"image": true,
|
||||
"video": true,
|
||||
"cost": {
|
||||
"input": 0.768,
|
||||
"output": 3.072
|
||||
}
|
||||
},
|
||||
"modelis/qwen/qwen3.7-max": {
|
||||
"name": "Qwen3.7 Max",
|
||||
"context": 1000000,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"cost": {
|
||||
"input": 3,
|
||||
"output": 9
|
||||
}
|
||||
},
|
||||
"subconscious/subconscious/glm-5.2": {
|
||||
"name": "GLM-5.2",
|
||||
"context": 1000000,
|
||||
@@ -47689,6 +48204,7 @@
|
||||
"vercel/google/gemini-2.5-flash-image": {
|
||||
"name": "Nano Banana (Gemini 2.5 Flash Image)",
|
||||
"context": 32768,
|
||||
"image": true,
|
||||
"cost": {
|
||||
"input": 0.3,
|
||||
"output": 2.5,
|
||||
@@ -47702,6 +48218,7 @@
|
||||
"vercel/google/gemini-3-pro-image": {
|
||||
"name": "Nano Banana Pro",
|
||||
"context": 65536,
|
||||
"image": true,
|
||||
"cost": {
|
||||
"input": 2,
|
||||
"output": 12,
|
||||
@@ -47721,6 +48238,9 @@
|
||||
"cache_read": 0.2
|
||||
}
|
||||
},
|
||||
"vercel/google/veo-3.1-lite-generate-001": {
|
||||
"name": "Veo 3.1 Lite Generate"
|
||||
},
|
||||
"vercel/google/gemini-2.5-flash-lite": {
|
||||
"name": "Gemini 2.5 Flash Lite",
|
||||
"context": 1048576,
|
||||
@@ -48298,6 +48818,7 @@
|
||||
"name": "Mistral Nemo",
|
||||
"context": 128000,
|
||||
"tool_call": true,
|
||||
"image": true,
|
||||
"cost": {
|
||||
"input": 0.15,
|
||||
"output": 0.15
|
||||
@@ -48578,6 +49099,17 @@
|
||||
"cache_read": 0.0036
|
||||
}
|
||||
},
|
||||
"vercel/deepseek/deepseek-v4-flash-0731": {
|
||||
"name": "DeepSeek V4 Flash 0731",
|
||||
"context": 1000000,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"cost": {
|
||||
"input": 0.13,
|
||||
"output": 0.26,
|
||||
"cache_read": 0.028
|
||||
}
|
||||
},
|
||||
"vercel/deepseek/deepseek-v3": {
|
||||
"name": "DeepSeek V3 0324",
|
||||
"context": 163840,
|
||||
@@ -49002,6 +49534,7 @@
|
||||
"context": 256000,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"image": true,
|
||||
"cost": {
|
||||
"input": 0.74,
|
||||
"output": 2.96,
|
||||
@@ -49013,6 +49546,7 @@
|
||||
"context": 256000,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"image": true,
|
||||
"cost": {
|
||||
"input": 0.15,
|
||||
"output": 0.6,
|
||||
@@ -49266,7 +49800,8 @@
|
||||
"vercel/perplexity/sonar-reasoning-pro": {
|
||||
"name": "Sonar Reasoning Pro",
|
||||
"context": 127000,
|
||||
"reasoning": true
|
||||
"reasoning": true,
|
||||
"image": true
|
||||
},
|
||||
"vercel/moonshotai/kimi-k2.5": {
|
||||
"name": "Kimi K2.5",
|
||||
@@ -50157,6 +50692,7 @@
|
||||
"context": 262114,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"image": true,
|
||||
"cost": {
|
||||
"input": 0.09,
|
||||
"output": 0.3,
|
||||
@@ -52783,11 +53319,12 @@
|
||||
"name": "Inkling Small",
|
||||
"context": 524288,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"image": true,
|
||||
"cost": {
|
||||
"input": 0.58,
|
||||
"output": 1.44,
|
||||
"cache_read": 0.116
|
||||
"input": 0.5,
|
||||
"output": 1.2,
|
||||
"cache_read": 0.1
|
||||
}
|
||||
},
|
||||
"openrouter/thinkingmachines/inkling": {
|
||||
@@ -52819,6 +53356,18 @@
|
||||
"output": 3
|
||||
}
|
||||
},
|
||||
"openrouter/~deepseek/deepseek-v4-flash-latest": {
|
||||
"name": "DeepSeek V4 Flash Latest",
|
||||
"context": 1048576,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"cost": {
|
||||
"input": 0.09,
|
||||
"output": 0.18,
|
||||
"cache_read": 0.018
|
||||
}
|
||||
},
|
||||
"openrouter/perceptron/perceptron-mk1": {
|
||||
"name": "Perceptron Mk1",
|
||||
"context": 32768,
|
||||
@@ -52978,7 +53527,7 @@
|
||||
"structured_output": true,
|
||||
"cost": {
|
||||
"input": 0.07,
|
||||
"output": 0.27
|
||||
"output": 0.28
|
||||
}
|
||||
},
|
||||
"openrouter/qwen/qwen3.5-plus-02-15": {
|
||||
@@ -54179,10 +54728,11 @@
|
||||
"context": 1048576,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"cost": {
|
||||
"input": 0.14,
|
||||
"output": 0.28,
|
||||
"cache_read": 0.0028
|
||||
"input": 0.09,
|
||||
"output": 0.18,
|
||||
"cache_read": 0.018
|
||||
}
|
||||
},
|
||||
"openrouter/deepseek/deepseek-v3.2": {
|
||||
@@ -54916,9 +55466,9 @@
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"cost": {
|
||||
"input": 1.12,
|
||||
"output": 3.52,
|
||||
"cache_read": 0.208
|
||||
"input": 0.4186,
|
||||
"output": 1.3156,
|
||||
"cache_read": 0.07774
|
||||
}
|
||||
},
|
||||
"openrouter/z-ai/glm-4.6": {
|
||||
@@ -55061,9 +55611,9 @@
|
||||
"structured_output": true,
|
||||
"image": true,
|
||||
"cost": {
|
||||
"input": 0.589,
|
||||
"output": 2.48,
|
||||
"cache_read": 0.0992
|
||||
"input": 0.6,
|
||||
"output": 3.41,
|
||||
"cache_read": 0.2
|
||||
}
|
||||
},
|
||||
"openrouter/moonshotai/kimi-k2.7-code": {
|
||||
@@ -55276,7 +55826,8 @@
|
||||
"structured_output": true,
|
||||
"cost": {
|
||||
"input": 0.03,
|
||||
"output": 0.14
|
||||
"output": 0.13,
|
||||
"cache_read": 0.03
|
||||
}
|
||||
},
|
||||
"openrouter/openai/gpt-oss-safeguard-20b": {
|
||||
@@ -56667,7 +57218,9 @@
|
||||
"tool_call": true,
|
||||
"cost": {
|
||||
"input": 0,
|
||||
"output": 0
|
||||
"output": 0,
|
||||
"cache_read": 0,
|
||||
"cache_write": 0
|
||||
}
|
||||
},
|
||||
"minimax-coding-plan/MiniMax-M2.5": {
|
||||
@@ -56729,6 +57282,7 @@
|
||||
"cost": {
|
||||
"input": 1.4,
|
||||
"output": 4.4,
|
||||
"cache_read": 0.26,
|
||||
"cache_write": 0
|
||||
}
|
||||
},
|
||||
@@ -56782,6 +57336,7 @@
|
||||
"cost": {
|
||||
"input": 1.4,
|
||||
"output": 4.4,
|
||||
"cache_read": 0.26,
|
||||
"cache_write": 0
|
||||
}
|
||||
},
|
||||
@@ -56860,7 +57415,8 @@
|
||||
"image": true,
|
||||
"cost": {
|
||||
"input": 0.45,
|
||||
"output": 2.25
|
||||
"output": 2.25,
|
||||
"cache_read": 0.07
|
||||
}
|
||||
},
|
||||
"siliconflow-cn/Qwen/Qwen3.5-27B": {
|
||||
@@ -59386,18 +59942,6 @@
|
||||
"cache_read": 0.06
|
||||
}
|
||||
},
|
||||
"chutes/zai-org/GLM-5-TEE": {
|
||||
"name": "GLM 5 TEE",
|
||||
"context": 202752,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"cost": {
|
||||
"input": 0.95,
|
||||
"output": 2.55,
|
||||
"cache_read": 0.475
|
||||
}
|
||||
},
|
||||
"chutes/zai-org/GLM-5.1-TEE": {
|
||||
"name": "GLM 5.1 TEE",
|
||||
"context": 202752,
|
||||
@@ -59481,18 +60025,6 @@
|
||||
"cache_read": 0.225
|
||||
}
|
||||
},
|
||||
"chutes/MiniMaxAI/MiniMax-M2.5-TEE": {
|
||||
"name": "MiniMax M2.5 TEE",
|
||||
"context": 196608,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"cost": {
|
||||
"input": 0.15,
|
||||
"output": 1.2,
|
||||
"cache_read": 0.075
|
||||
}
|
||||
},
|
||||
"chutes/deepseek-ai/DeepSeek-V3.2-TEE": {
|
||||
"name": "DeepSeek V3.2 TEE",
|
||||
"context": 131072,
|
||||
@@ -59519,20 +60051,6 @@
|
||||
"cache_read": 0.33
|
||||
}
|
||||
},
|
||||
"chutes/moonshotai/Kimi-K2.5-TEE": {
|
||||
"name": "Kimi K2.5 TEE",
|
||||
"context": 262144,
|
||||
"reasoning": true,
|
||||
"tool_call": true,
|
||||
"structured_output": true,
|
||||
"image": true,
|
||||
"video": true,
|
||||
"cost": {
|
||||
"input": 0.44,
|
||||
"output": 2,
|
||||
"cache_read": 0.22
|
||||
}
|
||||
},
|
||||
"chutes/moonshotai/Kimi-K3-TEE": {
|
||||
"name": "Kimi K3 TEE",
|
||||
"context": 1048576,
|
||||
@@ -63413,7 +63931,9 @@
|
||||
"tool_call": true,
|
||||
"cost": {
|
||||
"input": 0.3,
|
||||
"output": 1.2
|
||||
"output": 1.2,
|
||||
"cache_read": 0.03,
|
||||
"cache_write": 0.375
|
||||
}
|
||||
},
|
||||
"minimax-cn/MiniMax-M2.5": {
|
||||
@@ -63930,7 +64450,9 @@
|
||||
"tool_call": true,
|
||||
"cost": {
|
||||
"input": 0,
|
||||
"output": 0
|
||||
"output": 0,
|
||||
"cache_read": 0,
|
||||
"cache_write": 0
|
||||
}
|
||||
},
|
||||
"minimax-cn-coding-plan/MiniMax-M2.5": {
|
||||
|
||||
+4
-4
@@ -13,7 +13,7 @@
|
||||
/>
|
||||
<meta
|
||||
name="keywords"
|
||||
content="KimiSwitch, KimiCodeSwitch, SwitchKimi, Kimi Code Switch, Kimi 切换, LLM 供应商管理, AI 供应商切换, 多 LLM 管理, Kimi 用量监控, 智谱 GLM, MiniMax, DeepSeek, OpenRouter, 基元律动, 用量查询, 账单监控, Token 套餐, Claude, GPT, Windows LLM 桌面工具"
|
||||
content="Kimi Switch, KimiSwitch, KimiCode Switch, KimiCodeSwitch, SwitchKimi, Kimi Code Switch, Kimi 切换, LLM 供应商管理, AI 供应商切换, 多 LLM 管理, Kimi 用量监控, 智谱 GLM, MiniMax, DeepSeek, OpenRouter, 基元律动, 用量查询, 账单监控, Token 套餐, Claude, GPT, Windows LLM 桌面工具"
|
||||
/>
|
||||
|
||||
<!-- Open Graph -->
|
||||
@@ -24,7 +24,7 @@
|
||||
content="一键切换 Kimi / 智谱 GLM / MiniMax / DeepSeek 等供应商,用量与账单一目了然,开源 MIT。"
|
||||
/>
|
||||
<meta property="og:url" content="https://billowliu2.github.io/KimiSwitch/" />
|
||||
<meta property="og:image" content="%BASE_URL%og.png" />
|
||||
<meta property="og:image" content="https://billowliu2.github.io/KimiSwitch/og.png" />
|
||||
|
||||
<!-- Twitter -->
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
@@ -33,7 +33,7 @@
|
||||
name="twitter:description"
|
||||
content="一键切换 Kimi / 智谱 GLM / MiniMax / DeepSeek 等供应商,用量与账单一目了然,开源 MIT。"
|
||||
/>
|
||||
<meta name="twitter:image" content="%BASE_URL%og.png" />
|
||||
<meta name="twitter:image" content="https://billowliu2.github.io/KimiSwitch/og.png" />
|
||||
|
||||
<!-- Canonical -->
|
||||
<link rel="canonical" href="https://billowliu2.github.io/KimiSwitch/" />
|
||||
@@ -46,7 +46,7 @@
|
||||
{
|
||||
"@type": "SoftwareApplication",
|
||||
"name": "Kimi Switch",
|
||||
"alternateName": ["KimiSwitch", "KimiCodeSwitch"],
|
||||
"alternateName": ["KimiSwitch", "KimiCodeSwitch", "Kimi Switch", "KimiCode Switch"],
|
||||
"url": "https://billowliu2.github.io/KimiSwitch/",
|
||||
"applicationCategory": "DeveloperApplication",
|
||||
"operatingSystem": "Windows 10, Windows 11",
|
||||
|
||||
Generated
+18
@@ -16,6 +16,7 @@
|
||||
"react-router-dom": "^7.18.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^26.1.2",
|
||||
"@types/react": "^18.3.3",
|
||||
"@types/react-dom": "^18.3.0",
|
||||
"@vitejs/plugin-react": "^4.3.1",
|
||||
@@ -1299,6 +1300,16 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "26.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-26.1.2.tgz",
|
||||
"integrity": "sha512-Vu4a5UFA9rIIFJ7rB/Vaafh9lrCQszopTCx6KjFboXTGQbPNasehVR5TEiithSDGyd1DEiUByggTZsg8jukeIg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"undici-types": "~8.3.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/prop-types": {
|
||||
"version": "15.7.15",
|
||||
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz",
|
||||
@@ -2723,6 +2734,13 @@
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "8.3.0",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.3.0.tgz",
|
||||
"integrity": "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/update-browserslist-db": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz",
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"react-router-dom": "^7.18.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^26.1.2",
|
||||
"@types/react": "^18.3.3",
|
||||
"@types/react-dom": "^18.3.0",
|
||||
"@vitejs/plugin-react": "^4.3.1",
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#0F62FE"><path d="M12 2L4 6v6c0 5 3.5 8.5 8 10 4.5-1.5 8-5 8-10V6l-8-4zm0 4l4 2v4c0 3-1.5 5-4 6-2.5-1-4-3-4-6V8l4-2z"/></svg>
|
||||
|
Before Width: | Height: | Size: 192 B |
@@ -6,27 +6,17 @@
|
||||
<priority>1.0</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://billowliu2.github.io/KimiSwitch/#/features</loc>
|
||||
<loc>https://billowliu2.github.io/KimiSwitch/features</loc>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.8</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://billowliu2.github.io/KimiSwitch/#/showcase</loc>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.8</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://billowliu2.github.io/KimiSwitch/#/performance</loc>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.7</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://billowliu2.github.io/KimiSwitch/#/changelog</loc>
|
||||
<loc>https://billowliu2.github.io/KimiSwitch/changelog</loc>
|
||||
<changefreq>weekly</changefreq>
|
||||
<priority>0.7</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://billowliu2.github.io/KimiSwitch/#/download</loc>
|
||||
<loc>https://billowliu2.github.io/KimiSwitch/download</loc>
|
||||
<changefreq>weekly</changefreq>
|
||||
<priority>0.9</priority>
|
||||
</url>
|
||||
|
||||
@@ -8,6 +8,10 @@ import Download from "./sections/Download";
|
||||
import Privacy from "./sections/Privacy";
|
||||
import CTA from "./sections/CTA";
|
||||
import Footer from "./components/Footer";
|
||||
import { useLang, type Dict } from "./i18n";
|
||||
|
||||
const SITE_URL = "https://billowliu2.github.io/KimiSwitch";
|
||||
type SeoKey = keyof Dict["seo"];
|
||||
|
||||
function ScrollToTop() {
|
||||
const { pathname } = useLocation();
|
||||
@@ -17,6 +21,47 @@ function ScrollToTop() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Update per-page title / description / OG / canonical for SEO. */
|
||||
function RouteMeta() {
|
||||
const { pathname } = useLocation();
|
||||
const { t } = useLang();
|
||||
|
||||
useEffect(() => {
|
||||
const page = pathname.replace(/\/+$/, "");
|
||||
const seoKey: SeoKey =
|
||||
page === "/features" || page === "/changelog" || page === "/download"
|
||||
? (page.slice(1) as SeoKey)
|
||||
: "home";
|
||||
const m = t.seo[seoKey];
|
||||
const url = `${SITE_URL}${page === "" ? "/" : page}`;
|
||||
|
||||
document.title = m.title;
|
||||
setMeta("name", "description", m.description);
|
||||
setMeta("property", "og:title", m.title);
|
||||
setMeta("property", "og:description", m.description);
|
||||
setMeta("property", "og:url", url);
|
||||
setMeta("name", "twitter:title", m.title);
|
||||
setMeta("name", "twitter:description", m.description);
|
||||
|
||||
const canon = document.querySelector('link[rel="canonical"]');
|
||||
if (canon) canon.setAttribute("href", url);
|
||||
}, [pathname, t]);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function setMeta(attr: "name" | "property", key: string, content: string) {
|
||||
let el = document.head.querySelector<HTMLMetaElement>(
|
||||
`meta[${attr}="${key}"]`,
|
||||
);
|
||||
if (!el) {
|
||||
el = document.createElement("meta");
|
||||
el.setAttribute(attr, key);
|
||||
document.head.appendChild(el);
|
||||
}
|
||||
el.setAttribute("content", content);
|
||||
}
|
||||
|
||||
const homePage = (
|
||||
<>
|
||||
<Hero />
|
||||
@@ -30,6 +75,7 @@ export default function App() {
|
||||
<Nav />
|
||||
<main className="flex-1">
|
||||
<ScrollToTop />
|
||||
<RouteMeta />
|
||||
<Routes>
|
||||
<Route path="/" element={homePage} />
|
||||
<Route
|
||||
|
||||
@@ -5,7 +5,7 @@ import { asset } from "../lib/asset";
|
||||
/** Map recommendLink.name → logo file in public/logos (only when we have one). */
|
||||
const logoFor: Record<string, string> = {
|
||||
"Kimi": "logos/kimi.svg",
|
||||
"智谱 GLM": "logos/glm.svg",
|
||||
"智谱 GLM": "logos/zhipu.svg",
|
||||
"DeepSeek": "logos/deepseek.svg",
|
||||
"OpenCodeGo": "logos/opencode.svg",
|
||||
"MiniMax": "logos/minimax.svg",
|
||||
|
||||
+113
-9
@@ -16,10 +16,10 @@ const zh = {
|
||||
performance: "性能",
|
||||
changelog: "更新日志",
|
||||
download: "下载",
|
||||
downloadBtn: "下载 v0.6.7",
|
||||
downloadBtn: "下载 v0.7.0",
|
||||
},
|
||||
hero: {
|
||||
badge: "开源 MIT · Windows 10 / 11",
|
||||
badge: "v0.7.0 · 开源 MIT · Windows / macOS / Linux",
|
||||
titleBefore: "统一管理你的",
|
||||
titleAccent: "AI 供应商",
|
||||
titleAfter: "",
|
||||
@@ -141,11 +141,37 @@ const zh = {
|
||||
fallbackNote: "内置版本记录",
|
||||
entries: [
|
||||
{
|
||||
version: "v0.6.7",
|
||||
version: "v0.7.0",
|
||||
date: "2026-08-02",
|
||||
items: [
|
||||
"订阅套餐模型计价修正:零价条目按官方付费模型计价(zhipuai-coding-plan/glm-5.2 按 zhipuai/glm-5.2 牌价)",
|
||||
"-highspeed / -free 派生变体自动回退到基础模型价格",
|
||||
"Kimi For Coding 套餐无牌价时按旗舰模型 kimi-k3 价格估算用量",
|
||||
"设置页:识图(image_in)能力可手动编辑,原生多模态模型不再提示 kimi-eyes 插件",
|
||||
"修复仅单个套餐档位(如 5 小时)时用量卡片不显示的问题",
|
||||
"kimi usages 响应异常时透出原始返回,便于对照接口排查",
|
||||
"models.dev 价格快照同步",
|
||||
"关于页新增官方网站链接",
|
||||
"设置-关于页新增 Kimi Eyes 识图插件站链接",
|
||||
],
|
||||
},
|
||||
{
|
||||
version: "v0.6.9",
|
||||
date: "2026-08-01",
|
||||
items: [
|
||||
"应用内置 Kimi 设备授权登录(等同 kimi login),浏览器授权即用,过期自动续期",
|
||||
"外链打开统一走 Rust 命令,修复部分链接无法跳转",
|
||||
"最近请求新增缓存命中率列,每次请求命中一目了然",
|
||||
"中文模式费用按最新汇率换算人民币(¥)显示,英文模式保持美元",
|
||||
"仪表盘性能再优化:价格解析记忆化缓存,扫描从秒级降到百毫秒级;右上角新增加载耗时/数据量跟踪",
|
||||
],
|
||||
},
|
||||
{
|
||||
version: "v0.6.8",
|
||||
date: "2026-08-01",
|
||||
items: [
|
||||
"仪表盘加载提速:models.dev 快照移出主 bundle,异步加载不阻塞首帧",
|
||||
"Rust 价格索引启动时后台预热;get_summary 扫描结果 8 秒缓存",
|
||||
"k3-256k 按 k3 牌价计费",
|
||||
"官网更新:Kimi 风格重设计、中英文切换、更新日志同步 GitHub Releases、三平台下载",
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -234,7 +260,7 @@ const zh = {
|
||||
},
|
||||
download: {
|
||||
title: "下载 Kimi Switch",
|
||||
subtitle: "当前版本 v0.6.7 · Windows 10 / 11 主推,macOS 与 Linux 路线图上。",
|
||||
subtitle: "当前版本 v0.7.0 · Windows / macOS / Linux 三平台已发布",
|
||||
autoUpdate: "应用内置自动检测更新,新版本发布后在设置页一键升级。",
|
||||
ready: "已发布",
|
||||
wip: "开发中",
|
||||
@@ -252,6 +278,28 @@ const zh = {
|
||||
download: "免费下载",
|
||||
source: "GitHub 源码",
|
||||
},
|
||||
seo: {
|
||||
home: {
|
||||
title: "Kimi Switch — 多 LLM 供应商统一管理 · 用量监控 · 账单一目了然",
|
||||
description:
|
||||
"Kimi Switch / KimiCodeSwitch — Windows 桌面端多 LLM 供应商统一管理器,一键切换 Kimi / 智谱 GLM / MiniMax / DeepSeek / OpenRouter / 基元律动,用量账单实时监控,开源 MIT。",
|
||||
},
|
||||
features: {
|
||||
title: "核心功能 - Kimi Switch",
|
||||
description:
|
||||
"Kimi Switch 核心功能:多供应商管理、用量与账单监控、Kimi 一键授权登录、智能模型发现与自动更新,22 个预设开箱即用。",
|
||||
},
|
||||
changelog: {
|
||||
title: "更新日志 - Kimi Switch",
|
||||
description:
|
||||
"Kimi Switch 更新日志:每个版本的重要变更记录,同步自 GitHub Releases。",
|
||||
},
|
||||
download: {
|
||||
title: "下载 - Kimi Switch",
|
||||
description:
|
||||
"下载 Kimi Switch:Windows .msi、macOS .dmg、Linux .deb / .AppImage / .rpm,免费开源 MIT。",
|
||||
},
|
||||
},
|
||||
footer: {
|
||||
recommend: "推荐供应商",
|
||||
mirror: "国内镜像",
|
||||
@@ -280,10 +328,10 @@ const en: Dict = {
|
||||
performance: "Performance",
|
||||
changelog: "Changelog",
|
||||
download: "Download",
|
||||
downloadBtn: "Download v0.6.7",
|
||||
downloadBtn: "Download v0.7.0",
|
||||
},
|
||||
hero: {
|
||||
badge: "Open source MIT · Windows 10 / 11",
|
||||
badge: "v0.7.0 · Open source MIT · Windows / macOS / Linux",
|
||||
titleBefore: "One app for all your ",
|
||||
titleAccent: "AI providers",
|
||||
titleAfter: "",
|
||||
@@ -404,6 +452,40 @@ const en: Dict = {
|
||||
syncedNote: "Synced from GitHub Releases",
|
||||
fallbackNote: "Built-in release notes",
|
||||
entries: [
|
||||
{
|
||||
version: "v0.7.0",
|
||||
date: "2026-08-02",
|
||||
items: [
|
||||
"Plan-entry pricing fix: zero-price plan listings bill at the official priced model (zhipuai-coding-plan/glm-5.2 → zhipuai/glm-5.2)",
|
||||
"-highspeed / -free derived variants fall back to the base model price",
|
||||
"Kimi For Coding (no list price) estimates usage at the flagship kimi-k3 rate",
|
||||
"Settings: image_in capability is now manually editable; native multimodal models no longer show the kimi-eyes plugin hint",
|
||||
"Fix single-tier plans (e.g. 5-hour only) showing no usage card",
|
||||
"kimi usages failure now exposes the raw response for easier debugging",
|
||||
"models.dev price snapshot sync",
|
||||
"About page gains an official website link",
|
||||
"Settings-About page gains a Kimi Eyes plugin site link",
|
||||
],
|
||||
},
|
||||
{
|
||||
version: "v0.6.9",
|
||||
date: "2026-08-01",
|
||||
items: [
|
||||
"Recent requests gain a cache-hit-rate column, per request at a glance",
|
||||
"Chinese UI now shows costs in CNY (latest exchange rate); English keeps USD",
|
||||
"Dashboard speedup: memoized price resolution drops the scan from seconds to milliseconds; load time / payload tracking in the top-right corner",
|
||||
],
|
||||
},
|
||||
{
|
||||
version: "v0.6.8",
|
||||
date: "2026-08-01",
|
||||
items: [
|
||||
"Dashboard speedup: models.dev snapshot moved out of the main bundle, async load without blocking first paint",
|
||||
"Rust price index warmed in the background at startup; get_summary scan cached for 8s",
|
||||
"k3-256k billed at the k3 list price",
|
||||
"Website refresh: Kimi-style redesign, zh/en switch, changelog synced from GitHub Releases, downloads for all three platforms",
|
||||
],
|
||||
},
|
||||
{
|
||||
version: "v0.6.7",
|
||||
date: "2026-08-01",
|
||||
@@ -498,7 +580,7 @@ const en: Dict = {
|
||||
},
|
||||
download: {
|
||||
title: "Download Kimi Switch",
|
||||
subtitle: "Current version v0.6.7 · Windows 10 / 11 first, macOS and Linux on the roadmap.",
|
||||
subtitle: "Current version v0.7.0 · Windows, macOS and Linux now released",
|
||||
autoUpdate: "Built-in update detection: upgrade in one click from Settings when a new version ships.",
|
||||
ready: "Available",
|
||||
wip: "In development",
|
||||
@@ -516,6 +598,28 @@ const en: Dict = {
|
||||
download: "Free Download",
|
||||
source: "GitHub Source",
|
||||
},
|
||||
seo: {
|
||||
home: {
|
||||
title: "Kimi Switch — Unified Management for AI Providers · Usage & Billing",
|
||||
description:
|
||||
"Kimi Switch / KimiCodeSwitch — a Windows desktop manager for multiple LLM providers. Switch between Kimi, Zhipu GLM, MiniMax, DeepSeek, OpenRouter and TokenRhythm in one click, with usage and billing at a glance. Open source MIT.",
|
||||
},
|
||||
features: {
|
||||
title: "Core Features - Kimi Switch",
|
||||
description:
|
||||
"Kimi Switch core features: multi-provider management, usage & billing, one-click Kimi login, smart model discovery and auto updates. 22 presets out of the box.",
|
||||
},
|
||||
changelog: {
|
||||
title: "Changelog - Kimi Switch",
|
||||
description:
|
||||
"Kimi Switch changelog: notable changes in every release, synced from GitHub Releases.",
|
||||
},
|
||||
download: {
|
||||
title: "Download - Kimi Switch",
|
||||
description:
|
||||
"Download Kimi Switch: Windows .msi, macOS .dmg, Linux .deb / .AppImage / .rpm. Free and open source under MIT.",
|
||||
},
|
||||
},
|
||||
footer: {
|
||||
recommend: "Recommended Providers",
|
||||
mirror: "China mirror",
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { StrictMode } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { HashRouter } from "react-router-dom";
|
||||
import { BrowserRouter } from "react-router-dom";
|
||||
import { LangProvider } from "./i18n";
|
||||
import App from "./App";
|
||||
import "./index.css";
|
||||
|
||||
createRoot(document.getElementById("root")!).render(
|
||||
<StrictMode>
|
||||
<HashRouter>
|
||||
<BrowserRouter basename="/KimiSwitch">
|
||||
<LangProvider>
|
||||
<App />
|
||||
</LangProvider>
|
||||
</HashRouter>
|
||||
</BrowserRouter>
|
||||
</StrictMode>,
|
||||
);
|
||||
@@ -10,9 +10,14 @@ interface ChangelogEntry {
|
||||
|
||||
const API_URL =
|
||||
"https://api.github.com/repos/billowliu2/KimiSwitch/releases?per_page=20";
|
||||
const CACHE_KEY = "kimi-switch-changelog";
|
||||
const CACHE_TTL = 60 * 60 * 1000; // 1 hour
|
||||
|
||||
/** Cache key is versioned by the newest embedded release so redeploys
|
||||
* invalidate stale caches in the browser immediately. */
|
||||
function cacheKey(embedded: ChangelogEntry[]) {
|
||||
return `kimi-switch-changelog-${embedded[0]?.version ?? "v1"}`;
|
||||
}
|
||||
|
||||
/** Parse a GitHub release body into bullet items. */
|
||||
function parseBody(body: string): string[] {
|
||||
return body
|
||||
@@ -36,9 +41,9 @@ async function fetchReleases(): Promise<ChangelogEntry[]> {
|
||||
}));
|
||||
}
|
||||
|
||||
function readCache(): ChangelogEntry[] | null {
|
||||
function readCache(embedded: ChangelogEntry[]): ChangelogEntry[] | null {
|
||||
try {
|
||||
const raw = localStorage.getItem(CACHE_KEY);
|
||||
const raw = localStorage.getItem(cacheKey(embedded));
|
||||
if (!raw) return null;
|
||||
const { ts, data } = JSON.parse(raw) as { ts: number; data: ChangelogEntry[] };
|
||||
if (Date.now() - ts > CACHE_TTL) return null;
|
||||
@@ -48,10 +53,10 @@ function readCache(): ChangelogEntry[] | null {
|
||||
}
|
||||
}
|
||||
|
||||
function writeCache(data: ChangelogEntry[]) {
|
||||
function writeCache(data: ChangelogEntry[], embedded: ChangelogEntry[]) {
|
||||
try {
|
||||
localStorage.setItem(
|
||||
CACHE_KEY,
|
||||
cacheKey(embedded),
|
||||
JSON.stringify({ ts: Date.now(), data }),
|
||||
);
|
||||
} catch {
|
||||
@@ -67,7 +72,7 @@ export default function Changelog() {
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
const cached = readCache();
|
||||
const cached = readCache(embedded);
|
||||
if (cached) {
|
||||
setRemote(cached);
|
||||
setSynced(true);
|
||||
@@ -78,7 +83,7 @@ export default function Changelog() {
|
||||
if (cancelled) return;
|
||||
setRemote(data);
|
||||
setSynced(true);
|
||||
writeCache(data);
|
||||
writeCache(data, embedded);
|
||||
})
|
||||
.catch(() => {
|
||||
/* 网络不通时使用内置列表兜底 */
|
||||
|
||||
@@ -8,25 +8,25 @@ const icons: Record<string, Icon> = {
|
||||
linux: LinuxLogo,
|
||||
};
|
||||
|
||||
const VERSION = "0.6.8";
|
||||
const VERSION = "0.7.0";
|
||||
const GITHUB = "https://github.com/billowliu2/KimiSwitch";
|
||||
const MIRROR_RELEASES = "https://git.codingplan.site/admin/KimiCodeSwitch/releases";
|
||||
const dl = (file: string) => `${GITHUB}/releases/download/v${VERSION}/${file}`;
|
||||
|
||||
/** Per-platform download assets for the current release (names match the CI
|
||||
* release workflow, e.g. Kimi.Switch_0.6.8_x64_en-US.msi). */
|
||||
* release workflow, e.g. Kimi.Switch_0.7.0_x64_en-US.msi). */
|
||||
const assets: Record<string, { label: string; href: string }[]> = {
|
||||
windows: [
|
||||
{ label: "MSI", href: dl("Kimi.Switch_0.6.8_x64_en-US.msi") },
|
||||
{ label: "MSI", href: dl("Kimi.Switch_0.7.0_x64_en-US.msi") },
|
||||
{ label: "镜像", href: MIRROR_RELEASES },
|
||||
],
|
||||
macos: [
|
||||
{ label: "Apple Silicon (.dmg)", href: dl("Kimi.Switch_0.6.8_aarch64.dmg") },
|
||||
{ label: "Apple Silicon (.dmg)", href: dl("Kimi.Switch_0.7.0_aarch64.dmg") },
|
||||
],
|
||||
linux: [
|
||||
{ label: ".deb", href: dl("Kimi.Switch_0.6.8_amd64.deb") },
|
||||
{ label: ".AppImage", href: dl("Kimi.Switch_0.6.8_amd64.AppImage") },
|
||||
{ label: ".rpm", href: dl("Kimi.Switch-0.6.8-1.x86_64.rpm") },
|
||||
{ label: ".deb", href: dl("Kimi.Switch_0.7.0_amd64.deb") },
|
||||
{ label: ".AppImage", href: dl("Kimi.Switch_0.7.0_amd64.AppImage") },
|
||||
{ label: ".rpm", href: dl("Kimi.Switch-0.7.0-1.x86_64.rpm") },
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
+21
-2
@@ -1,10 +1,29 @@
|
||||
import { defineConfig } from "vite";
|
||||
import { defineConfig, type Plugin } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import { copyFileSync } from "node:fs";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
/**
|
||||
* GitHub Pages SPA fallback: any deep path (e.g. /KimiSwitch/features) is
|
||||
* served by 404.html; duplicating the built index.html there lets the
|
||||
* BrowserRouter boot and render the right route. This keeps every page
|
||||
* indexable as a real URL instead of a `#/` fragment.
|
||||
*/
|
||||
function generate404(): Plugin {
|
||||
return {
|
||||
name: "generate-404",
|
||||
apply: "build",
|
||||
closeBundle() {
|
||||
const dist = fileURLToPath(new URL("./dist", import.meta.url));
|
||||
copyFileSync(`${dist}/index.html`, `${dist}/404.html`);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// GitHub Pages subpath: billowliu2.github.io/KimiSwitch/
|
||||
export default defineConfig({
|
||||
base: "/KimiSwitch/",
|
||||
plugins: [react()],
|
||||
plugins: [react(), generate404()],
|
||||
resolve: {
|
||||
alias: { "@": "/src" },
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user