비용 패널: 기간 밖 모델(호출 0) 행 제외

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
kimandClaude Sonnet 5.5 committed 2026-10-17 22:39:59 +09:00
1 parent 0a46e76065
commit 3c9054830d
2 files changed
+2 -1

No files matched your search

+1
View File
@@ -79,6 +79,7 @@ export function summarize(rows: UsageRow[], billing: BillingState = {}, now: Dat
if (day >= weekAgo) { add(out.last7, r, usd); out.daily[day] = (out.daily[day] || 0) + (usd ?? 0); }
if (day.startsWith(monthPrefix) || day >= weekAgo) add(bm, r, usd);
}
for (const [m, b] of Object.entries(out.byModel)) if (b.calls === 0) delete out.byModel[m]; // 이번 달·7일 밖 모델은 표에서 뺀다
// 앤트로픽 잔액 추산: 사용자가 콘솔에서 확인해 입력한 잔액 − 그 시점 이후 claude 호출의 추산 지출
let anthropic: null | { balance_usd: number; as_of: string; spent_since: number; estimated_balance: number; warn_below_usd: number; low: boolean } = null;
if (typeof billing.balance_usd === 'number' && billing.as_of) {
+1 -1
View File
@@ -1598,7 +1598,7 @@ async function loadCostPanel() {
const d = await api('/api/usage/cost');
totals.innerHTML = ['today:오늘', 'last7:최근 7일', 'month:이번 달']
.map(x => { const [k, label] = x.split(':'); return '<span><span style="color:var(--muted)">' + label + '</span> <b>' + _fmtUsd(d[k].usd) + '</b> · ' + d[k].calls + '회</span>'; }).join('');
const rows = Object.entries(d.byModel).sort((a, b) => b[1].usd - a[1].usd || b[1].calls - a[1].calls).slice(0, 12);
const rows = Object.entries(d.byModel).filter(([, b]) => b.calls > 0).sort((a, b) => b[1].usd - a[1].usd || b[1].calls - a[1].calls).slice(0, 12);
table.innerHTML = '<tr style="color:var(--muted);text-align:left"><th>모델 (최근 7일·이번 달)</th><th>호출</th><th>입력</th><th>출력</th><th>추산</th></tr>' +
rows.map(([m, b]) => '<tr style="border-top:1px solid var(--line)"><td style="padding:3px 6px 3px 0">' + escHtml(m) + '</td><td>' + b.calls + '</td><td>' + _fmtTok(b.promptTokens) + '</td><td>' + _fmtTok(b.completionTokens) + '</td><td>' +
(b.priced ? _fmtUsd(b.usd) : '<span style="color:var(--muted)">정액/로컬</span>') + '</td></tr>').join('');