@pinkbanana/dsh-balance 0.15.2 → 0.17.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -12
- package/README_EN.md +26 -12
- package/docs/dsh-advisor-card-en.png +0 -0
- package/docs/dsh-advisor-card.png +0 -0
- package/docs/dsh-advisor-dark-narrow-en.png +0 -0
- package/docs/dsh-advisor-dark-narrow-zh-tw.png +0 -0
- package/docs/dsh-session-drilldown-en.png +0 -0
- package/docs/dsh-session-drilldown.png +0 -0
- package/docs/dsh-usage-dark-narrow-en.png +0 -0
- package/docs/dsh-usage-dark-narrow-zh-tw.png +0 -0
- package/docs/estimates.en.md +54 -0
- package/docs/estimates.md +54 -0
- package/lib/client.js +332 -76
- package/lib/client.js.map +1 -1
- package/lib/index.js +239 -25
- package/lib/index.js.map +1 -1
- package/lib/types/advice.d.ts +6 -1
- package/lib/types/billing.d.ts +14 -8
- package/lib/types/client/AdviceCard.d.ts +4 -1
- package/lib/types/client/BalanceDock.d.ts +4 -0
- package/lib/types/client/locales.d.ts +9 -1
- package/lib/types/client/styles.d.ts +1 -1
- package/lib/types/pricing.d.ts +8 -0
- package/lib/types/tokener-pricing.d.ts +59 -6
- package/package.json +19 -15
package/lib/client.js
CHANGED
|
@@ -720,13 +720,10 @@ window.__ModuleLoader__.load({
|
|
|
720
720
|
if (converted !== null && estimate.costUsd !== null) parts.push(`${displayAmount(String(converted), "CNY", locale)} (${t("billing.fixedRate")})`);
|
|
721
721
|
return parts.length === 0 ? [t("advice.noEstimate")] : parts;
|
|
722
722
|
}
|
|
723
|
-
function formatCost(estimate, locale, rate, t) {
|
|
724
|
-
return formatCostParts(estimate, locale, rate, t).join(" · ");
|
|
725
|
-
}
|
|
726
723
|
/** Each amount stays on one line; long rows wrap between amounts, never inside "(fixed rate)". */
|
|
727
|
-
function CostText({ estimate, locale, usdToCny, t }) {
|
|
724
|
+
function CostText({ estimate, locale, usdToCny, t, inline = false }) {
|
|
728
725
|
const parts = formatCostParts(estimate, locale, usdToCny, t);
|
|
729
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", {
|
|
726
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(inline ? "span" : "strong", {
|
|
730
727
|
className: "dsh-advice-cost",
|
|
731
728
|
children: parts.map((part, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [index > 0 ? " · " : "", /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
732
729
|
className: "dsh-advice-amount",
|
|
@@ -734,17 +731,53 @@ window.__ModuleLoader__.load({
|
|
|
734
731
|
})] }, index))
|
|
735
732
|
});
|
|
736
733
|
}
|
|
734
|
+
/** Hint for a successful response that still has no current-period estimate. */
|
|
735
|
+
function adviceMissingHintKey(advice) {
|
|
736
|
+
if (advice.coverage.status === "unpriced") return "advice.unpricedHint";
|
|
737
|
+
if (advice.now === void 0 && advice.sampleSize > 0) return "advice.unpricedHint";
|
|
738
|
+
if (advice.coverage.status === "free") return "advice.freeHint";
|
|
739
|
+
return "advice.emptyHint";
|
|
740
|
+
}
|
|
741
|
+
function RefreshButton({ loading, onRefresh, t }) {
|
|
742
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
743
|
+
type: "button",
|
|
744
|
+
className: "dsh-balance-refresh",
|
|
745
|
+
disabled: loading,
|
|
746
|
+
onClick: onRefresh,
|
|
747
|
+
children: loading ? t("advice.loading") : t("advice.refresh")
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
function AdviceNextStep({ compact, title, hint, loading, onRefresh, t }) {
|
|
751
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
752
|
+
className: `${compact ? "dsh-advice-dock" : "dsh-balance-status"} dsh-advice-guidance`,
|
|
753
|
+
role: "status",
|
|
754
|
+
children: [
|
|
755
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: title }),
|
|
756
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
757
|
+
className: "dsh-advice-hint",
|
|
758
|
+
children: hint
|
|
759
|
+
}),
|
|
760
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(RefreshButton, {
|
|
761
|
+
loading,
|
|
762
|
+
onRefresh,
|
|
763
|
+
t
|
|
764
|
+
})
|
|
765
|
+
]
|
|
766
|
+
});
|
|
767
|
+
}
|
|
737
768
|
/** Session-shaped next-turn estimates. Prompt text is never requested or rendered. */
|
|
738
769
|
function AdviceCard({ sessionId, provider, model, loadAdvice, t, usdToCny = null, compact = false }) {
|
|
739
770
|
const [result, setResult] = (0, react.useState)();
|
|
740
771
|
const [loading, setLoading] = (0, react.useState)(true);
|
|
772
|
+
const [refreshNonce, setRefreshNonce] = (0, react.useState)(0);
|
|
741
773
|
(0, react.useEffect)(() => {
|
|
742
774
|
const controller = new AbortController();
|
|
743
775
|
setLoading(true);
|
|
744
776
|
loadAdvice({
|
|
745
777
|
sessionId,
|
|
746
778
|
...provider === void 0 ? {} : { provider },
|
|
747
|
-
...model === void 0 ? {} : { model }
|
|
779
|
+
...model === void 0 ? {} : { model },
|
|
780
|
+
...refreshNonce > 0 ? { forceRefresh: true } : {}
|
|
748
781
|
}, controller.signal).then((value) => {
|
|
749
782
|
if (!controller.signal.aborted) setResult(value);
|
|
750
783
|
}).catch(() => {
|
|
@@ -763,74 +796,105 @@ window.__ModuleLoader__.load({
|
|
|
763
796
|
loadAdvice,
|
|
764
797
|
sessionId,
|
|
765
798
|
provider,
|
|
766
|
-
model
|
|
799
|
+
model,
|
|
800
|
+
refreshNonce
|
|
767
801
|
]);
|
|
768
802
|
const locale = t("locale.tag");
|
|
803
|
+
const onRefresh = () => {
|
|
804
|
+
setRefreshNonce((value) => value + 1);
|
|
805
|
+
};
|
|
769
806
|
if (loading && result === void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
770
807
|
className: compact ? "dsh-advice-dock" : "dsh-balance-status",
|
|
771
808
|
role: "status",
|
|
772
809
|
children: t("advice.loading")
|
|
773
810
|
});
|
|
774
|
-
if (result === void 0 || !result.ok) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
811
|
+
if (result === void 0 || !result.ok) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AdviceNextStep, {
|
|
812
|
+
compact,
|
|
813
|
+
title: t("advice.unavailable"),
|
|
814
|
+
hint: t("advice.unavailableHint"),
|
|
815
|
+
loading,
|
|
816
|
+
onRefresh,
|
|
817
|
+
t
|
|
778
818
|
});
|
|
779
819
|
return compact ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CompactAdvice, {
|
|
780
820
|
advice: result,
|
|
781
821
|
t,
|
|
782
822
|
usdToCny,
|
|
783
|
-
locale
|
|
823
|
+
locale,
|
|
824
|
+
loading,
|
|
825
|
+
onRefresh
|
|
784
826
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PanelAdvice, {
|
|
785
827
|
advice: result,
|
|
786
828
|
t,
|
|
787
829
|
usdToCny,
|
|
788
|
-
locale
|
|
830
|
+
locale,
|
|
831
|
+
loading,
|
|
832
|
+
onRefresh
|
|
789
833
|
});
|
|
790
834
|
}
|
|
791
|
-
function CompactAdvice({ advice, t, usdToCny, locale }) {
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
835
|
+
function CompactAdvice({ advice, t, usdToCny, locale, loading, onRefresh }) {
|
|
836
|
+
if (advice.now === void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AdviceNextStep, {
|
|
837
|
+
compact: true,
|
|
838
|
+
title: t("advice.noEstimate"),
|
|
839
|
+
hint: t(adviceMissingHintKey(advice)),
|
|
840
|
+
loading,
|
|
841
|
+
onRefresh,
|
|
842
|
+
t
|
|
843
|
+
});
|
|
844
|
+
const items = [[
|
|
845
|
+
t("advice.now"),
|
|
846
|
+
advice.now,
|
|
847
|
+
advice.cheapest === "now"
|
|
848
|
+
]];
|
|
849
|
+
if (advice.afterChange !== void 0) items.push([
|
|
850
|
+
t("advice.afterChange"),
|
|
851
|
+
advice.afterChange,
|
|
852
|
+
advice.cheapest === "after-change"
|
|
853
|
+
]);
|
|
854
|
+
if (advice.fresh !== void 0) items.push([
|
|
855
|
+
t("advice.fresh"),
|
|
856
|
+
advice.fresh,
|
|
857
|
+
advice.cheapest === "fresh"
|
|
858
|
+
]);
|
|
859
|
+
if (advice.compact !== void 0) items.push([
|
|
860
|
+
t("advice.compact"),
|
|
861
|
+
advice.compact,
|
|
862
|
+
advice.cheapest === "compact"
|
|
863
|
+
]);
|
|
796
864
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
797
865
|
className: "dsh-advice-dock",
|
|
798
|
-
children: [
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
": ",
|
|
802
|
-
|
|
803
|
-
] }),
|
|
804
|
-
after === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
|
|
805
|
-
" · ",
|
|
806
|
-
t("advice.afterChange"),
|
|
807
|
-
": ",
|
|
808
|
-
after
|
|
809
|
-
] }),
|
|
810
|
-
fresh === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
|
|
811
|
-
" · ",
|
|
812
|
-
t("advice.fresh"),
|
|
813
|
-
": ",
|
|
814
|
-
fresh
|
|
815
|
-
] }),
|
|
816
|
-
compactCost === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
|
|
817
|
-
" · ",
|
|
818
|
-
t("advice.compact"),
|
|
866
|
+
children: [items.map(([label, estimate, best], index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
867
|
+
className: "dsh-advice-item",
|
|
868
|
+
children: [
|
|
869
|
+
index > 0 ? " · " : "",
|
|
870
|
+
label,
|
|
819
871
|
": ",
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
872
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CostText, {
|
|
873
|
+
estimate,
|
|
874
|
+
locale,
|
|
875
|
+
usdToCny,
|
|
876
|
+
t,
|
|
877
|
+
inline: true
|
|
878
|
+
}),
|
|
879
|
+
best ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
880
|
+
className: "dsh-advice-best",
|
|
881
|
+
children: [" ", t("advice.cheapest")]
|
|
882
|
+
}) : null
|
|
883
|
+
]
|
|
884
|
+
}, label)), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
885
|
+
className: "dsh-advice-note",
|
|
886
|
+
children: t("advice.estimateOnly")
|
|
887
|
+
})]
|
|
827
888
|
});
|
|
828
889
|
}
|
|
829
|
-
function EstimateRow({ label, estimate, t, usdToCny, locale }) {
|
|
890
|
+
function EstimateRow({ label, estimate, t, usdToCny, locale, best = false }) {
|
|
830
891
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
831
|
-
className: "dsh-advice-row",
|
|
892
|
+
className: best ? "dsh-advice-row dsh-advice-row-best" : "dsh-advice-row",
|
|
832
893
|
children: [
|
|
833
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
894
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [label, best ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
895
|
+
className: "dsh-advice-best",
|
|
896
|
+
children: [" ", t("advice.cheapest")]
|
|
897
|
+
}) : null] }),
|
|
834
898
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CostText, {
|
|
835
899
|
estimate,
|
|
836
900
|
locale,
|
|
@@ -847,7 +911,7 @@ window.__ModuleLoader__.load({
|
|
|
847
911
|
]
|
|
848
912
|
});
|
|
849
913
|
}
|
|
850
|
-
function PanelAdvice({ advice, t, usdToCny, locale }) {
|
|
914
|
+
function PanelAdvice({ advice, t, usdToCny, locale, loading, onRefresh }) {
|
|
851
915
|
const nextChange = advice.nextChangeAt === null ? void 0 : formatClockTime(new Date(advice.nextChangeAt), locale);
|
|
852
916
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
853
917
|
className: "dsh-advice-card",
|
|
@@ -884,10 +948,26 @@ window.__ModuleLoader__.load({
|
|
|
884
948
|
cacheWrite: displayTokens(advice.tokenShape.cacheWriteTokens, locale)
|
|
885
949
|
})
|
|
886
950
|
}),
|
|
887
|
-
advice.now === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.
|
|
888
|
-
className: "dsh-advice-
|
|
889
|
-
|
|
951
|
+
advice.now === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
952
|
+
className: "dsh-advice-guidance",
|
|
953
|
+
role: "status",
|
|
954
|
+
children: [
|
|
955
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
956
|
+
className: "dsh-advice-meta",
|
|
957
|
+
children: t("advice.noEstimate")
|
|
958
|
+
}),
|
|
959
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
960
|
+
className: "dsh-advice-meta dsh-advice-hint",
|
|
961
|
+
children: t(adviceMissingHintKey(advice))
|
|
962
|
+
}),
|
|
963
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(RefreshButton, {
|
|
964
|
+
loading,
|
|
965
|
+
onRefresh,
|
|
966
|
+
t
|
|
967
|
+
})
|
|
968
|
+
]
|
|
890
969
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EstimateRow, {
|
|
970
|
+
best: advice.cheapest === "now",
|
|
891
971
|
label: t("advice.now"),
|
|
892
972
|
estimate: advice.now,
|
|
893
973
|
t,
|
|
@@ -895,6 +975,7 @@ window.__ModuleLoader__.load({
|
|
|
895
975
|
locale
|
|
896
976
|
}),
|
|
897
977
|
advice.afterChange === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EstimateRow, {
|
|
978
|
+
best: advice.cheapest === "after-change",
|
|
898
979
|
label: t("advice.afterChange"),
|
|
899
980
|
estimate: advice.afterChange,
|
|
900
981
|
t,
|
|
@@ -902,6 +983,7 @@ window.__ModuleLoader__.load({
|
|
|
902
983
|
locale
|
|
903
984
|
}),
|
|
904
985
|
advice.fresh === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EstimateRow, {
|
|
986
|
+
best: advice.cheapest === "fresh",
|
|
905
987
|
label: t("advice.fresh"),
|
|
906
988
|
estimate: advice.fresh,
|
|
907
989
|
t,
|
|
@@ -909,6 +991,7 @@ window.__ModuleLoader__.load({
|
|
|
909
991
|
locale
|
|
910
992
|
}),
|
|
911
993
|
advice.compact === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EstimateRow, {
|
|
994
|
+
best: advice.cheapest === "compact",
|
|
912
995
|
label: t("advice.compact"),
|
|
913
996
|
estimate: advice.compact,
|
|
914
997
|
t,
|
|
@@ -2128,13 +2211,19 @@ window.__ModuleLoader__.load({
|
|
|
2128
2211
|
const { weekday, dateKey } = beijingCalendar(date);
|
|
2129
2212
|
return weekday >= 1 && weekday <= 5 && !CHINESE_PUBLIC_HOLIDAYS.has(dateKey);
|
|
2130
2213
|
}
|
|
2131
|
-
/** Whether the
|
|
2132
|
-
|
|
2133
|
-
|
|
2214
|
+
/** Whether the Beijing clock falls in Mon–Fri 09:00–12:00 or 14:00–18:00, excluding Chinese public holidays.
|
|
2215
|
+
* Unlike `isPeakHour`, this has no provider-specific effective-from gate.
|
|
2216
|
+
*/
|
|
2217
|
+
function isChineseStatutoryPeakHour(date) {
|
|
2134
2218
|
if (!isPeakCalendarDay(date)) return false;
|
|
2135
2219
|
const hour = beijingCalendar(date).hour;
|
|
2136
2220
|
return PEAK_WINDOWS.some(([start, end]) => hour >= start && hour < end);
|
|
2137
2221
|
}
|
|
2222
|
+
/** Whether the given instant falls inside a DeepSeek peak-pricing window. */
|
|
2223
|
+
function isPeakHour(date) {
|
|
2224
|
+
if (date.getTime() < PEAK_EFFECTIVE_FROM) return false;
|
|
2225
|
+
return isChineseStatutoryPeakHour(date);
|
|
2226
|
+
}
|
|
2138
2227
|
/** The next instant at which the current pricing period ends (Beijing time). */
|
|
2139
2228
|
function nextPeriodChange(date) {
|
|
2140
2229
|
const ms = date.getTime();
|
|
@@ -2153,13 +2242,32 @@ window.__ModuleLoader__.load({
|
|
|
2153
2242
|
}
|
|
2154
2243
|
//#endregion
|
|
2155
2244
|
//#region src/tokener-pricing.ts
|
|
2156
|
-
/** USD per million tokens from
|
|
2157
|
-
*
|
|
2158
|
-
*
|
|
2159
|
-
*
|
|
2245
|
+
/** USD per million tokens from the public Tokener catalog.
|
|
2246
|
+
* Current snapshot checked 2026-11-28 against
|
|
2247
|
+
* https://console.tokener.ai/api/public/v1/models
|
|
2248
|
+
* (schemaVersion 1, catalogRevision sha256:d6e160bc81b620b91cb7b6c263fb2487d0e0060f84e651b3b06d6ca9b77bcf31),
|
|
2249
|
+
* https://www.tokener.ai/docs/guides/models, and model pages such as
|
|
2250
|
+
* https://www.tokener.ai/models/deepseek-flash and
|
|
2251
|
+
* https://www.tokener.ai/models/claude-haiku-5-5.
|
|
2252
|
+
* Model IDs are exact and case-sensitive. These are reference estimates, not account bills.
|
|
2253
|
+
* Cache-write pricing is not published; requests with cache writes stay unpriced.
|
|
2254
|
+
* Embedding models are priced on input only; a cache-read rate is not published for them.
|
|
2160
2255
|
*/
|
|
2161
|
-
const TOKENER_PRICING_VERSION = "tokener-reference-2026-11-
|
|
2162
|
-
const
|
|
2256
|
+
const TOKENER_PRICING_VERSION = "tokener-reference-2026-11-28";
|
|
2257
|
+
const TOKENER_LEGACY_PRICING_VERSION = "tokener-reference-2026-11-03";
|
|
2258
|
+
/** Re-verification instant for rate changes noticed on 2026-11-28. Not a vendor-published effective date. */
|
|
2259
|
+
const TOKENER_CURRENT_EFFECTIVE_FROM = Date.parse("2026-11-28T00:00:00+08:00");
|
|
2260
|
+
function rates(cacheMissUsdPerMillion, cacheHitUsdPerMillion, outputUsdPerMillion) {
|
|
2261
|
+
return {
|
|
2262
|
+
cacheMissUsdPerMillion,
|
|
2263
|
+
cacheHitUsdPerMillion,
|
|
2264
|
+
outputUsdPerMillion
|
|
2265
|
+
};
|
|
2266
|
+
}
|
|
2267
|
+
/** Last known public-catalog rates from the 2026-11-03 snapshot.
|
|
2268
|
+
* Kept so IDs that left the public catalog, and pre-change rates for repriced models, can still be estimated.
|
|
2269
|
+
*/
|
|
2270
|
+
const TOKENER_LEGACY_PRICES = {
|
|
2163
2271
|
"claude-fable-5": [
|
|
2164
2272
|
10,
|
|
2165
2273
|
1,
|
|
@@ -2671,6 +2779,74 @@ window.__ModuleLoader__.load({
|
|
|
2671
2779
|
12
|
|
2672
2780
|
]
|
|
2673
2781
|
};
|
|
2782
|
+
/** Public catalog models as of 2026-11-28 (38 entries). */
|
|
2783
|
+
const TOKENER_CURRENT_PRICES = {
|
|
2784
|
+
"claude-fable-5": { rates: rates(10, 1, 50) },
|
|
2785
|
+
"claude-fable-5-1": { rates: rates(10, .25, 50) },
|
|
2786
|
+
"claude-fable-5-2": { rates: rates(8, .2, 40) },
|
|
2787
|
+
"claude-haiku-4-5-20251001": { rates: rates(1, .1, 5) },
|
|
2788
|
+
"claude-haiku-5-5": {
|
|
2789
|
+
rates: rates(.1, .01, .5),
|
|
2790
|
+
contextPriceTiers: [{
|
|
2791
|
+
thresholdTokens: 100001,
|
|
2792
|
+
...rates(.5, .05, 2.5)
|
|
2793
|
+
}]
|
|
2794
|
+
},
|
|
2795
|
+
"claude-opus-4-5-20251101": { rates: rates(5, .5, 25) },
|
|
2796
|
+
"claude-opus-4-6": { rates: rates(5, .5, 25) },
|
|
2797
|
+
"claude-opus-4-7": { rates: rates(5, .5, 25) },
|
|
2798
|
+
"claude-opus-4-8": { rates: rates(5, .5, 25) },
|
|
2799
|
+
"claude-opus-5": { rates: rates(5, .5, 25) },
|
|
2800
|
+
"claude-opus-5-5": { rates: rates(4, .2, 20) },
|
|
2801
|
+
"claude-sonnet-4-5-20250929": { rates: rates(3, .3, 15) },
|
|
2802
|
+
"claude-sonnet-4-6": { rates: rates(3, .3, 15) },
|
|
2803
|
+
"claude-sonnet-5": { rates: rates(2, .2, 10) },
|
|
2804
|
+
"claude-sonnet-5-5": { rates: rates(2, .1, 10) },
|
|
2805
|
+
"deepseek-flash": {
|
|
2806
|
+
rates: rates(.3, .006, 1.2),
|
|
2807
|
+
offPeakRates: rates(.15, .003, .6)
|
|
2808
|
+
},
|
|
2809
|
+
"deepseek-v3.2": { rates: rates(.62, .62, 1.85) },
|
|
2810
|
+
"deepseek-v4-pro": {
|
|
2811
|
+
rates: rates(1.32, .044, 3.96),
|
|
2812
|
+
offPeakRates: rates(.66, .022, 1.98)
|
|
2813
|
+
},
|
|
2814
|
+
"embed-english-v3": {
|
|
2815
|
+
rates: rates(.1, 0, 0),
|
|
2816
|
+
unpublishedCacheRead: true
|
|
2817
|
+
},
|
|
2818
|
+
"embed-multilingual-v3": {
|
|
2819
|
+
rates: rates(.1, 0, 0),
|
|
2820
|
+
unpublishedCacheRead: true
|
|
2821
|
+
},
|
|
2822
|
+
"embed-v4": {
|
|
2823
|
+
rates: rates(.12, 0, 0),
|
|
2824
|
+
unpublishedCacheRead: true
|
|
2825
|
+
},
|
|
2826
|
+
"glm-4.7": { rates: rates(.6, .6, 2.2) },
|
|
2827
|
+
"glm-4.7-flash": { rates: rates(.07, .07, .4) },
|
|
2828
|
+
"glm-5": { rates: rates(1, .2, 3.2) },
|
|
2829
|
+
"grok-4.3": { rates: rates(1.25, .2, 2.5) },
|
|
2830
|
+
"grok-4.6": { rates: rates(2, .5, 6) },
|
|
2831
|
+
"grok-4.7": { rates: rates(2, .5, 6) },
|
|
2832
|
+
"kimi-k3": { rates: rates(3, .3, 15) },
|
|
2833
|
+
"kimi-k3.1": { rates: rates(4, .2, 20) },
|
|
2834
|
+
"kimi-k3.1-pro": { rates: rates(2, .2, 10) },
|
|
2835
|
+
"MiniMax-M2.5": { rates: rates(.3, .03, 1.2) },
|
|
2836
|
+
"qwen3-235b-a22b-2507": { rates: rates(.22, .22, .88) },
|
|
2837
|
+
"qwen3-32b": { rates: rates(.15, .15, .6) },
|
|
2838
|
+
"qwen3-coder-30b-a3b": { rates: rates(.15, .15, .6) },
|
|
2839
|
+
"qwen3-coder-480b-a35b": { rates: rates(.45, .45, 1.8) },
|
|
2840
|
+
"qwen3-coder-next": { rates: rates(.5, .5, 1.2) },
|
|
2841
|
+
"qwen3-next-80b-a3b": { rates: rates(.15, .15, 1.2) },
|
|
2842
|
+
"qwen3-vl-235b-a22b": { rates: rates(.53, .53, 2.66) }
|
|
2843
|
+
};
|
|
2844
|
+
/** Models whose public-catalog rates changed between the 2026-11-03 snapshot and the 2026-11-28 check. */
|
|
2845
|
+
const TOKENER_REPRICED_MODELS = /* @__PURE__ */ new Set([
|
|
2846
|
+
"claude-haiku-5-5",
|
|
2847
|
+
"grok-4.3",
|
|
2848
|
+
"grok-4.6"
|
|
2849
|
+
]);
|
|
2674
2850
|
//#endregion
|
|
2675
2851
|
//#region src/billing.ts
|
|
2676
2852
|
const USAGE_ROUTE = "/dsh-balance/api/usage";
|
|
@@ -2802,16 +2978,43 @@ window.__ModuleLoader__.load({
|
|
|
2802
2978
|
pricingVersion,
|
|
2803
2979
|
...rates
|
|
2804
2980
|
})),
|
|
2805
|
-
...
|
|
2981
|
+
...tokenerBillingPrices()
|
|
2982
|
+
];
|
|
2983
|
+
function tokenerUsdPrice(model, quote, effectiveFrom, pricingVersion) {
|
|
2984
|
+
return {
|
|
2806
2985
|
provider: "tokener",
|
|
2807
2986
|
model,
|
|
2808
|
-
effectiveFrom
|
|
2809
|
-
pricingVersion
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2987
|
+
effectiveFrom,
|
|
2988
|
+
pricingVersion,
|
|
2989
|
+
...quote.rates,
|
|
2990
|
+
...quote.contextPriceTiers === void 0 ? {} : { contextPriceTiers: quote.contextPriceTiers },
|
|
2991
|
+
...quote.offPeakRates === void 0 ? {} : { offPeakRates: quote.offPeakRates },
|
|
2992
|
+
...quote.unpublishedCacheRead === void 0 ? {} : { unpublishedCacheRead: true }
|
|
2993
|
+
};
|
|
2994
|
+
}
|
|
2995
|
+
/** Historical 2026-11-03 snapshot plus the 2026-11-28 public catalog, with dated rows for repriced models. */
|
|
2996
|
+
function tokenerBillingPrices() {
|
|
2997
|
+
const epoch = (/* @__PURE__ */ new Date(0)).toISOString();
|
|
2998
|
+
const currentFrom = new Date(TOKENER_CURRENT_EFFECTIVE_FROM).toISOString();
|
|
2999
|
+
const rows = [];
|
|
3000
|
+
for (const [model, [input, cacheRead, output]] of Object.entries(TOKENER_LEGACY_PRICES)) {
|
|
3001
|
+
if (model in TOKENER_CURRENT_PRICES && !TOKENER_REPRICED_MODELS.has(model)) continue;
|
|
3002
|
+
rows.push({
|
|
3003
|
+
provider: "tokener",
|
|
3004
|
+
model,
|
|
3005
|
+
effectiveFrom: epoch,
|
|
3006
|
+
pricingVersion: TOKENER_LEGACY_PRICING_VERSION,
|
|
3007
|
+
cacheMissUsdPerMillion: input,
|
|
3008
|
+
cacheHitUsdPerMillion: cacheRead,
|
|
3009
|
+
outputUsdPerMillion: output
|
|
3010
|
+
});
|
|
3011
|
+
}
|
|
3012
|
+
for (const [model, quote] of Object.entries(TOKENER_CURRENT_PRICES)) {
|
|
3013
|
+
const effectiveFrom = TOKENER_REPRICED_MODELS.has(model) ? currentFrom : epoch;
|
|
3014
|
+
rows.push(tokenerUsdPrice(model, quote, effectiveFrom, TOKENER_PRICING_VERSION));
|
|
3015
|
+
}
|
|
3016
|
+
return rows;
|
|
3017
|
+
}
|
|
2815
3018
|
/** The latest effective price for one provider/model pair, for display only. */
|
|
2816
3019
|
function findBillingPrice(provider, model) {
|
|
2817
3020
|
const providerId = findBalanceProvider(provider)?.id ?? provider;
|
|
@@ -2825,6 +3028,23 @@ window.__ModuleLoader__.load({
|
|
|
2825
3028
|
//#region src/client/BalanceDock.tsx
|
|
2826
3029
|
const REFRESH_INTERVAL_MS = 6e4;
|
|
2827
3030
|
const PEAK_TICK_MS = 3e4;
|
|
3031
|
+
/** sessionStorage key for the composer-dock advisor open/closed state. */
|
|
3032
|
+
const ADVICE_DOCK_STORAGE_KEY = "dsh-balance:advice-dock-open";
|
|
3033
|
+
/** Read whether the composer-dock advisor was left open in this tab. */
|
|
3034
|
+
function readAdviceDockOpen() {
|
|
3035
|
+
try {
|
|
3036
|
+
return globalThis.sessionStorage?.getItem(ADVICE_DOCK_STORAGE_KEY) === "1";
|
|
3037
|
+
} catch {
|
|
3038
|
+
return false;
|
|
3039
|
+
}
|
|
3040
|
+
}
|
|
3041
|
+
/** Persist the composer-dock advisor open/closed state for this tab. */
|
|
3042
|
+
function writeAdviceDockOpen(open) {
|
|
3043
|
+
try {
|
|
3044
|
+
if (open) globalThis.sessionStorage?.setItem(ADVICE_DOCK_STORAGE_KEY, "1");
|
|
3045
|
+
else globalThis.sessionStorage?.removeItem(ADVICE_DOCK_STORAGE_KEY);
|
|
3046
|
+
} catch {}
|
|
3047
|
+
}
|
|
2828
3048
|
/** Compact ambient balance readout below the active-session composer card. */
|
|
2829
3049
|
function BalanceDock({ selection, loadBalance, loadAdvice, t, sessionId }) {
|
|
2830
3050
|
const snapshot = (0, react.useSyncExternalStore)(selection.store.subscribe, selection.store.getSnapshot);
|
|
@@ -2846,7 +3066,7 @@ window.__ModuleLoader__.load({
|
|
|
2846
3066
|
function ProviderBalanceDock({ provider, providerName, model, loadBalance, loadAdvice, sessionId, t }) {
|
|
2847
3067
|
const [result, setResult] = (0, react.useState)();
|
|
2848
3068
|
const [now, setNow] = (0, react.useState)(() => /* @__PURE__ */ new Date());
|
|
2849
|
-
const [adviceOpen, setAdviceOpen] = (0, react.useState)(
|
|
3069
|
+
const [adviceOpen, setAdviceOpen] = (0, react.useState)(readAdviceDockOpen);
|
|
2850
3070
|
(0, react.useEffect)(() => {
|
|
2851
3071
|
if (typeof document === "undefined") {
|
|
2852
3072
|
const timer = setInterval(() => setNow(/* @__PURE__ */ new Date()), PEAK_TICK_MS);
|
|
@@ -2975,7 +3195,11 @@ window.__ModuleLoader__.load({
|
|
|
2975
3195
|
className: "dsh-balance-dock-advice-toggle",
|
|
2976
3196
|
"aria-expanded": adviceOpen,
|
|
2977
3197
|
onClick: () => {
|
|
2978
|
-
setAdviceOpen((open) =>
|
|
3198
|
+
setAdviceOpen((open) => {
|
|
3199
|
+
const next = !open;
|
|
3200
|
+
writeAdviceDockOpen(next);
|
|
3201
|
+
return next;
|
|
3202
|
+
});
|
|
2979
3203
|
},
|
|
2980
3204
|
children: t(adviceOpen ? "advice.dockCollapse" : "advice.dockToggle")
|
|
2981
3205
|
}), adviceOpen ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AdviceCard, {
|
|
@@ -3044,6 +3268,7 @@ window.__ModuleLoader__.load({
|
|
|
3044
3268
|
"tokener.console": "打开 Tokener 控制台",
|
|
3045
3269
|
"error.BALANCE_NOT_SUPPORTED": "此提供方尚未公开余额查询接口",
|
|
3046
3270
|
"billing.reason.unknown-cache-write-price": "缓存写入价格未公开",
|
|
3271
|
+
"billing.reason.unknown-cache-read-price": "缓存读取价格未公开",
|
|
3047
3272
|
"dock.loading": "查询中…",
|
|
3048
3273
|
"dock.unavailable": "暂时无法获取",
|
|
3049
3274
|
"dock.empty": "暂无余额信息",
|
|
@@ -3167,16 +3392,23 @@ window.__ModuleLoader__.load({
|
|
|
3167
3392
|
"advice.dockCollapse": "收起估算",
|
|
3168
3393
|
"advice.loading": "正在估算下轮费用…",
|
|
3169
3394
|
"advice.unavailable": "暂时无法估算下轮费用",
|
|
3395
|
+
"advice.refresh": "重新估算",
|
|
3396
|
+
"advice.unavailableHint": "请先重试;若仍然失败,打开用量统计确认本会话的请求是否可读。",
|
|
3397
|
+
"advice.emptyHint": "还没有已计价的请求,因此无法估算下轮费用。发送一轮对话后点重新估算,或打开用量统计查看请求。",
|
|
3398
|
+
"advice.unpricedHint": "当前模型或本会话请求无法计价。打开用量统计查看原因,或点重新估算重试。",
|
|
3399
|
+
"advice.freeHint": "本会话请求均为免费,因此没有可估算的费用。打开用量统计查看请求,或在出现计费请求后再重新估算。",
|
|
3170
3400
|
"advice.now": "当前时段",
|
|
3171
3401
|
"advice.afterChange": "下个峰谷切换后",
|
|
3172
3402
|
"advice.fresh": "新开会话(全部未命中缓存)",
|
|
3173
3403
|
"advice.compact": "现在 /compact(摘要请求 + 压缩后首轮)",
|
|
3404
|
+
"advice.cheapest": "最便宜",
|
|
3174
3405
|
"advice.alternative": "其他已配置模型",
|
|
3175
3406
|
"advice.cacheSavings": "继续本会话相对新开可节省",
|
|
3176
3407
|
"advice.sample": "取最近 {count} / {limit} 次已计费请求的中位数",
|
|
3177
3408
|
"advice.shape": "估算用量:未缓存输入 {input} · 输出 {output} · 缓存读取 {cacheHit} · 缓存写入 {cacheWrite}",
|
|
3178
3409
|
"advice.nextChange": "{time} 切换",
|
|
3179
3410
|
"advice.coverage.priced": "本会话 {requests} 次请求均已计价",
|
|
3411
|
+
"advice.coverage.free": "本会话 {requests} 次请求均为免费,没有可用于估算的已计价样本",
|
|
3180
3412
|
"advice.coverage.partial": "本会话 {requests} 次请求中 {priced} 次已计价、{unpriced} 次未计价",
|
|
3181
3413
|
"advice.coverage.unpriced": "本会话 {requests} 次请求均未能计价",
|
|
3182
3414
|
"advice.coverage.empty": "本会话还没有可用于估算的请求",
|
|
@@ -3184,7 +3416,7 @@ window.__ModuleLoader__.load({
|
|
|
3184
3416
|
"advice.caveat.estimate-not-a-bill": "以上为公开标准价估算,不是官方账单;套餐、折扣或账户特殊价格可能导致实际扣款不同。",
|
|
3185
3417
|
"advice.caveat.shape-may-differ": "下轮实际用量可能与此中位数不同,例如上下文压缩、大段粘贴或视觉输入。",
|
|
3186
3418
|
"advice.caveat.stepfun-grandfathering": "step-5-preview 缓存命中标准价自 2026-10-14 起为 0.70 元/百万 tokens;此前已按量调用的账户可能仍适用 0.35 元,插件无法识别该保留价。",
|
|
3187
|
-
"advice.caveat.tokener-snapshot": "Tokener 费用按 2026-11-
|
|
3419
|
+
"advice.caveat.tokener-snapshot": "Tokener 费用按 2026-11-28 公开目录估算,已计入官方低谷价和上下文分档(如有);不套用原厂价格或 DeepSeek 峰谷倍率。",
|
|
3188
3420
|
"advice.caveat.no-priced-sample": "本会话还没有已计费请求,无法根据历史用量估算下轮费用。",
|
|
3189
3421
|
"advice.caveat.unpriced-omitted": "无法定价的模型已省略,不会显示为 $0。",
|
|
3190
3422
|
"advice.caveat.holiday-calendar-stale": "内置法定节假日仅到 2027 年;此后的节假日会被按普通工作日(峰时)估算,请升级插件。",
|
|
@@ -3248,6 +3480,7 @@ window.__ModuleLoader__.load({
|
|
|
3248
3480
|
"tokener.console": "Open Tokener console",
|
|
3249
3481
|
"error.BALANCE_NOT_SUPPORTED": "This provider has no documented balance API",
|
|
3250
3482
|
"billing.reason.unknown-cache-write-price": "Cache-write pricing is not published",
|
|
3483
|
+
"billing.reason.unknown-cache-read-price": "Cache-read pricing is not published",
|
|
3251
3484
|
"dock.loading": "Loading…",
|
|
3252
3485
|
"dock.unavailable": "Temporarily unavailable",
|
|
3253
3486
|
"dock.empty": "No balance information",
|
|
@@ -3371,16 +3604,23 @@ window.__ModuleLoader__.load({
|
|
|
3371
3604
|
"advice.dockCollapse": "Hide estimate",
|
|
3372
3605
|
"advice.loading": "Estimating the next turn…",
|
|
3373
3606
|
"advice.unavailable": "The next-turn estimate is temporarily unavailable",
|
|
3607
|
+
"advice.refresh": "Refresh estimate",
|
|
3608
|
+
"advice.unavailableHint": "Try refresh first. If it still fails, open Usage to check that this session's requests can be read.",
|
|
3609
|
+
"advice.emptyHint": "There is no priced sample yet, so the next turn cannot be estimated. After you send a turn, refresh the estimate, or open Usage to inspect requests.",
|
|
3610
|
+
"advice.unpricedHint": "The current model or this session's requests could not be priced. Open Usage to see why, or refresh the estimate.",
|
|
3611
|
+
"advice.freeHint": "All requests in this session were free, so there is nothing to estimate. Open Usage to inspect them, or refresh after a priced turn.",
|
|
3374
3612
|
"advice.now": "Current period",
|
|
3375
3613
|
"advice.afterChange": "After the next peak change",
|
|
3376
3614
|
"advice.fresh": "Fresh session (all cache-miss)",
|
|
3377
3615
|
"advice.compact": "Compact now (summary request + first turn after)",
|
|
3616
|
+
"advice.cheapest": "Cheapest",
|
|
3378
3617
|
"advice.alternative": "Other configured model",
|
|
3379
3618
|
"advice.cacheSavings": "Saved by continuing this session vs starting over",
|
|
3380
3619
|
"advice.sample": "Median of the last {count} / {limit} priced requests",
|
|
3381
3620
|
"advice.shape": "Estimated usage: uncached input {input} · output {output} · cache read {cacheHit} · cache write {cacheWrite}",
|
|
3382
3621
|
"advice.nextChange": "Changes at {time}",
|
|
3383
3622
|
"advice.coverage.priced": "All {requests} requests in this session are priced",
|
|
3623
|
+
"advice.coverage.free": "All {requests} requests in this session were free, so there is no priced sample to estimate from",
|
|
3384
3624
|
"advice.coverage.partial": "{priced} of {requests} requests in this session are priced; {unpriced} are unpriced",
|
|
3385
3625
|
"advice.coverage.unpriced": "None of the {requests} requests in this session could be priced",
|
|
3386
3626
|
"advice.coverage.empty": "This session has no requests to estimate from yet",
|
|
@@ -3388,7 +3628,7 @@ window.__ModuleLoader__.load({
|
|
|
3388
3628
|
"advice.caveat.estimate-not-a-bill": "These figures are published-rate estimates, not an official bill. Plans, discounts, or account-specific rates can change the actual charge.",
|
|
3389
3629
|
"advice.caveat.shape-may-differ": "The next turn may not match this median, for example after compaction, a large paste, or vision input.",
|
|
3390
3630
|
"advice.caveat.stepfun-grandfathering": "The standard step-5-preview cache-hit rate is 0.70 CNY per million tokens from 2026-10-14. Accounts that already used pay-as-you-go before then may still be billed at 0.35; this plugin cannot detect that grandfathering.",
|
|
3391
|
-
"advice.caveat.tokener-snapshot": "Tokener costs use the 2026-11-
|
|
3631
|
+
"advice.caveat.tokener-snapshot": "Tokener costs use the 2026-11-28 public catalog, including official off-peak and context-tier rates where published, without vendor rates or the DeepSeek peak multiplier.",
|
|
3392
3632
|
"advice.caveat.no-priced-sample": "This session has no priced requests yet, so the next turn cannot be estimated from usage history.",
|
|
3393
3633
|
"advice.caveat.unpriced-omitted": "Models that cannot be priced are omitted rather than shown as $0.",
|
|
3394
3634
|
"advice.caveat.holiday-calendar-stale": "Built-in Chinese public holidays end in 2027; later holidays are priced as ordinary weekdays (peak). Update the plugin.",
|
|
@@ -3841,6 +4081,7 @@ window.__ModuleLoader__.load({
|
|
|
3841
4081
|
"tokener.console": "開啟 Tokener 控制台",
|
|
3842
4082
|
"error.BALANCE_NOT_SUPPORTED": "此供應商尚未公開餘額查詢介面",
|
|
3843
4083
|
"billing.reason.unknown-cache-write-price": "快取寫入價格未公開",
|
|
4084
|
+
"billing.reason.unknown-cache-read-price": "快取讀取價格未公開",
|
|
3844
4085
|
"dock.loading": "查詢中…",
|
|
3845
4086
|
"dock.unavailable": "暫時無法獲取",
|
|
3846
4087
|
"dock.empty": "暫無餘額資訊",
|
|
@@ -3964,16 +4205,23 @@ window.__ModuleLoader__.load({
|
|
|
3964
4205
|
"advice.dockCollapse": "收起估算",
|
|
3965
4206
|
"advice.loading": "正在估算下輪費用…",
|
|
3966
4207
|
"advice.unavailable": "暫時無法估算下輪費用",
|
|
4208
|
+
"advice.refresh": "重新估算",
|
|
4209
|
+
"advice.unavailableHint": "請先重試;若仍然失敗,打開用量統計確認本工作階段的請求是否可讀。",
|
|
4210
|
+
"advice.emptyHint": "還沒有已計價的請求,因此無法估算下輪費用。發送一輪對話後點重新估算,或打開用量統計查看請求。",
|
|
4211
|
+
"advice.unpricedHint": "目前模型或本工作階段請求無法定價。打開用量統計查看原因,或點重新估算重試。",
|
|
4212
|
+
"advice.freeHint": "本工作階段請求均為免費,因此沒有可估算的費用。打開用量統計查看請求,或在出現計費請求後再重新估算。",
|
|
3967
4213
|
"advice.now": "目前時段",
|
|
3968
4214
|
"advice.afterChange": "下個尖離峰切換後",
|
|
3969
4215
|
"advice.fresh": "新開工作階段(全部未命中快取)",
|
|
3970
4216
|
"advice.compact": "現在 /compact(摘要請求 + 壓縮後首輪)",
|
|
4217
|
+
"advice.cheapest": "最便宜",
|
|
3971
4218
|
"advice.alternative": "其他已設定模型",
|
|
3972
4219
|
"advice.cacheSavings": "繼續本工作階段相對新開可節省",
|
|
3973
4220
|
"advice.sample": "取最近 {count} / {limit} 次已計費請求的中位數",
|
|
3974
4221
|
"advice.shape": "估算用量:未快取輸入 {input} · 輸出 {output} · 快取讀取 {cacheHit} · 快取寫入 {cacheWrite}",
|
|
3975
4222
|
"advice.nextChange": "{time} 切換",
|
|
3976
4223
|
"advice.coverage.priced": "本工作階段 {requests} 次請求均已計價",
|
|
4224
|
+
"advice.coverage.free": "本工作階段 {requests} 次請求均為免費,沒有可用於估算的已計價樣本",
|
|
3977
4225
|
"advice.coverage.partial": "本工作階段 {requests} 次請求中 {priced} 次已計價、{unpriced} 次未計價",
|
|
3978
4226
|
"advice.coverage.unpriced": "本工作階段 {requests} 次請求均未能計價",
|
|
3979
4227
|
"advice.coverage.empty": "本工作階段還沒有可用於估算的請求",
|
|
@@ -3981,7 +4229,7 @@ window.__ModuleLoader__.load({
|
|
|
3981
4229
|
"advice.caveat.estimate-not-a-bill": "以上為公開標準價估算,不是官方帳單;套餐、折扣或帳戶特殊價格可能導致實際扣款不同。",
|
|
3982
4230
|
"advice.caveat.shape-may-differ": "下輪實際用量可能與此中位數不同,例如上下文壓縮、大段貼上或視覺輸入。",
|
|
3983
4231
|
"advice.caveat.stepfun-grandfathering": "step-5-preview 快取命中標準價自 2026-10-14 起為 0.70 元/百萬 tokens;此前已依量呼叫的帳戶可能仍適用 0.35 元,外掛無法識別該保留價。",
|
|
3984
|
-
"advice.caveat.tokener-snapshot": "Tokener 費用依 2026-11-
|
|
4232
|
+
"advice.caveat.tokener-snapshot": "Tokener 費用依 2026-11-28 公開目錄估算,已計入官方離峰價與上下文分檔(如有);不套用原廠價格或 DeepSeek 尖離峰倍率。",
|
|
3985
4233
|
"advice.caveat.no-priced-sample": "本工作階段還沒有已計費請求,無法根據歷史用量估算下輪費用。",
|
|
3986
4234
|
"advice.caveat.unpriced-omitted": "無法定價的模型已省略,不會顯示為 $0。",
|
|
3987
4235
|
"advice.caveat.holiday-calendar-stale": "內建法定假日僅到 2027 年;此後的假日會依一般工作日(尖峰)估算,請升級外掛。",
|
|
@@ -4271,16 +4519,23 @@ window.__ModuleLoader__.load({
|
|
|
4271
4519
|
.dsh-balance-dock-advice-toggle:hover { color: var(--dsw-alias-label-secondary); }
|
|
4272
4520
|
.dsh-balance-dock-advice-toggle:focus-visible { outline: 2px solid var(--dsw-alias-state-business-primary, #4d6bfe); outline-offset: 2px; border-radius: 4px; }
|
|
4273
4521
|
.dsh-advice-dock { margin-top: 4px; color: var(--dsw-alias-label-tertiary); font-size: 11px; line-height: 18px; white-space: normal; }
|
|
4522
|
+
.dsh-advice-guidance { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
|
|
4523
|
+
.dsh-advice-guidance p { margin: 0; }
|
|
4524
|
+
.dsh-advice-hint { color: var(--ledger-muted, var(--dsw-alias-label-secondary, #686b70)); }
|
|
4525
|
+
.dsh-advice-dock.dsh-advice-guidance { gap: 4px; }
|
|
4526
|
+
.dsh-advice-dock .dsh-balance-refresh { min-height: 28px; padding: 0 8px; font-size: 11px; }
|
|
4274
4527
|
.dsh-advice-note { color: var(--dsw-alias-label-dimmed, var(--dsw-alias-label-tertiary)); font-size: 10px; }
|
|
4275
4528
|
.dsh-advice-card { min-width: 0; border: .5px solid var(--ledger-line); border-radius: var(--dsw-radius-lg, 12px); padding: 20px; background: var(--ledger-paper); display: flex; flex-direction: column; gap: 10px; }
|
|
4276
4529
|
.dsh-advice-card-head .dsh-balance-heading { font-size: 16px; }
|
|
4277
4530
|
.dsh-advice-meta { margin: 0; color: var(--ledger-muted); font-size: 12px; line-height: 1.6; }
|
|
4278
4531
|
.dsh-advice-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; font-size: 13px; }
|
|
4279
4532
|
.dsh-advice-row strong { font-variant-numeric: tabular-nums; min-width: 0; }
|
|
4280
|
-
.dsh-advice-amount { display: inline-block; max-width: 100%; overflow-wrap: anywhere; }
|
|
4533
|
+
.dsh-advice-amount { display: inline-block; max-width: 100%; overflow-wrap: anywhere; white-space: nowrap; }
|
|
4534
|
+
.dsh-advice-dock .dsh-advice-cost { font-variant-numeric: tabular-nums; }
|
|
4281
4535
|
.dsh-advice-row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
|
|
4282
4536
|
.dsh-advice-meta, .dsh-advice-caveats li { overflow-wrap: anywhere; }
|
|
4283
4537
|
.dsh-advice-row small { flex-basis: 100%; color: var(--ledger-muted); font-size: 11px; }
|
|
4538
|
+
.dsh-advice-best { color: var(--dsw-alias-label-success, #1a7f37); font-size: 11px; font-weight: 600; white-space: nowrap; }
|
|
4284
4539
|
.dsh-advice-alternatives { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; border-top: 1px solid var(--ledger-line); }
|
|
4285
4540
|
.dsh-advice-caveats { margin: 0; padding-left: 18px; color: var(--ledger-muted); font-size: 11px; line-height: 1.6; }
|
|
4286
4541
|
.dsh-balance-dock-model { display: inline-block; max-width: 40%; margin-left: 8px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
|
|
@@ -4378,6 +4633,7 @@ window.__ModuleLoader__.load({
|
|
|
4378
4633
|
const params = new URLSearchParams({ session: options.sessionId });
|
|
4379
4634
|
if (options.provider !== void 0) params.set("provider", options.provider);
|
|
4380
4635
|
if (options.model !== void 0) params.set("model", options.model);
|
|
4636
|
+
if (options.forceRefresh === true) params.set("refresh", "1");
|
|
4381
4637
|
const value = await (await fetch(`${ADVICE_ROUTE}?${params.toString()}`, {
|
|
4382
4638
|
method: "GET",
|
|
4383
4639
|
headers: { accept: "application/json" },
|