{#if loading && !usage} {:else if error && !usage} {:else if usage}
{#if usage.from || usage.to}

窗口: {usage.from ? fmtDateOnly(usage.from) : '—'} → {usage.to ? fmtDateOnly(usage.to) : '—'}

{/if}
{#if error}

{error}

{/if}
n + b.factCount, 0))} hint={`${fmtNum(usage.breakdown.length)} 个分项`} />

按来源分账

kind × provider × model/capability。外部能力显示页数/秒等计量,不与 tokens 混排。

{#if usage.breakdown.length === 0} {:else}
{#each usage.breakdown as row} {/each}
类型 供应方 模型 / 能力 次数 计量 有成本 / 未知 成本
{usageKindLabel(row.kind)} {row.provider} {sourceLabel(row)} {fmtNum(row.factCount)}
{meterCell(row)}
{meterHint(row)}
{fmtNum(row.factsWithCost)} / {fmtNum(row.factsWithoutCost)} {fmtCost(row.costUsd)}
{/if}

按项目

项目仍是权限边界;行内成本已含该项目全部 fact 类型。

{#if usage.projects.length === 0} {:else}
{#each usage.projects as p} {/each}
项目 运行 有成本 / 未知 in / out tokens 成本
{p.projectName} {fmtNum(p.runCount)} {fmtNum(p.runsWithCost)} / {fmtNum(p.runsWithoutCost)} {fmtTokens(p.inputTokens, p.outputTokens)} {fmtCost(p.costUsd)} 查看项目
{/if}
{/if}