Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

6.8 KB
Raw Blame
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Beacon | Self‑improving memory for coding agents</title>
    <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
    <link rel="stylesheet" href="/styles.css" />
  </head>
  <body data-page="tokens">
    <header class="topbar">
      <div>
        <p class="eyebrow">Local-only</p>
        <h1>Token Usage</h1>
      </div>
      <nav class="nav-toggle" aria-label="Dashboard navigation">
        <div class="nav-section">
          <div class="nav-section-title">Overview</div>
          <a href="/findings.html">Findings</a>
        </div>
        <div class="nav-section">
          <div class="nav-parent">Analytics</div>
          <a class="active" aria-current="page" href="/tokens.html">Token Usage</a>
          <a href="/overview.html">Agent Activity</a>
          <a href="/memory.html">Memory</a>
        </div>
        <div class="nav-section">
          <div class="nav-section-title">Observe</div>
          <a href="/inventory.html">Agent Inventory</a>
          <a href="/">Agent Activity Sessions</a>
        </div>
        <div class="nav-section">
          <div class="nav-section-title">Control</div>
          <a href="/detections.html">Detections</a>
        </div>
      </nav>
    </header>

    <main>
      <section class="dashboard-hero analytics-hero">
        <div>
          <h2>Token usage analytics</h2>
          <p class="muted">Token consumption, runtime-reported and list-price estimated cost, cache usage, and context-window pressure across local AI agents.</p>
        </div>
        <div class="range-pills" aria-label="Local token analytics range">
          <span class="active">Local log</span>
          <span>1h buckets</span>
        </div>
      </section>

      <section class="panel status-panel">
        <div>
          <h2>Endpoint</h2>
          <p id="log-path" class="muted">Loading runtime log...</p>
        </div>
      </section>

      <section>
        <div class="section-head overview-head">
          <div>
            <h2>Token Totals</h2>
            <p class="muted">Prompt, completion, cache, reasoning, runtime-reported cost and a list-price estimate across all captured telemetry.</p>
          </div>
          <div id="token-meta" class="muted"></div>
        </div>
        <div class="cards" id="token-cards"></div>
      </section>

      <section class="analytics-grid token-analytics-grid">
        <div class="analytics-panel">
          <div class="panel-title-row">
            <div>
              <h2>Token throughput</h2>
              <p class="muted">Hourly local usage trend from the runtime log. Bars include input, cache, output, and reasoning tokens when captured.</p>
            </div>
          </div>
          <div class="chart-legend">
            <span><i class="legend-input"></i>Input</span>
            <span><i class="legend-output"></i>Output</span>
          </div>
          <div class="throughput-bars" id="token-throughput"></div>
        </div>
        <div class="analytics-panel">
          <div class="panel-title-row">
            <div>
              <h2>Token split</h2>
              <p class="muted">Fresh input, cached input, output, and reasoning share for the selected local log.</p>
            </div>
          </div>
          <div id="token-split" class="token-split"></div>
        </div>
      </section>

      <section id="token-breakdowns" class="analytics-stack"></section>

      <section class="panel">
        <h2>Context Window Utilization</h2>
        <p class="muted">Input plus cache tokens per call against each model's context window. Unknown models show raw input tokens.</p>
        <table>
          <thead>
            <tr><th>Model</th><th>Window</th><th>Calls</th><th>Max Input</th><th>Max</th><th>P95</th><th>Near Limit</th></tr>
          </thead>
          <tbody id="token-utilization"></tbody>
        </table>
      </section>

      <section class="panel">
        <h2>By Model</h2>
        <table>
          <thead>
            <tr><th>Model</th><th>Input</th><th>Output</th><th>Cache Read</th><th>Cache Create</th><th>Reasoning</th><th title="What the runtime reported">Reported USD</th><th title="List-price estimate from the embedded catalog">Est. USD</th><th>Events</th></tr>
          </thead>
          <tbody id="token-models"></tbody>
        </table>
      </section>

      <section class="panel">
        <h2>By Session</h2>
        <p class="muted">Select a session to inspect per-step usage.</p>
        <table>
          <thead>
            <tr><th>Session</th><th>Input</th><th>Output</th><th>Cache Read</th><th>Cache Create</th><th>Reasoning</th><th title="What the runtime reported">Reported USD</th><th title="List-price estimate from the embedded catalog">Est. USD</th><th>Events</th></tr>
          </thead>
          <tbody id="token-sessions"></tbody>
        </table>
      </section>

      <section class="panel">
        <h2>By User</h2>
        <table>
          <thead>
            <tr><th>User</th><th>Input</th><th>Output</th><th>Cache Read</th><th>Cache Create</th><th>Reasoning</th><th title="What the runtime reported">Reported USD</th><th title="List-price estimate from the embedded catalog">Est. USD</th><th>Events</th></tr>
          </thead>
          <tbody id="token-users"></tbody>
        </table>
      </section>

      <section class="panel" id="token-session-panel" hidden>
        <h2 id="token-session-title">Session Detail</h2>
        <table>
          <thead>
            <tr><th>Step</th><th>Model</th><th>Input</th><th>Output</th><th>Cache Read</th><th>Cache Create</th><th>Reasoning</th><th title="What the runtime reported">Reported USD</th><th title="List-price estimate from the embedded catalog">Est. USD</th></tr>
          </thead>
          <tbody id="token-session-detail"></tbody>
        </table>
      </section>

      <section class="panel">
        <h2>By CI Run</h2>
        <table>
          <thead>
            <tr><th>Run</th><th>Input</th><th>Output</th><th>Cache Read</th><th>Cache Create</th><th>Reasoning</th><th title="What the runtime reported">Reported USD</th><th title="List-price estimate from the embedded catalog">Est. USD</th><th>Events</th></tr>
          </thead>
          <tbody id="token-runs"></tbody>
        </table>
      </section>

      <section class="panel">
        <h2>By Harness</h2>
        <table>
          <thead>
            <tr><th>Harness</th><th>Input</th><th>Output</th><th>Cache Read</th><th>Cache Create</th><th>Reasoning</th><th title="What the runtime reported">Reported USD</th><th title="List-price estimate from the embedded catalog">Est. USD</th><th>Events</th></tr>
          </thead>
          <tbody id="token-harnesses"></tbody>
        </table>
      </section>
    </main>

    <script src="/app.js"></script>
  </body>
</html>