@jeffreycao/copilot-api 2.6.31 → 2.6.32

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/pages/index.html +21 -2
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@jeffreycao/copilot-api",
4
- "version": "2.6.31",
4
+ "version": "2.6.32",
5
5
  "description": "GitHub Copilot, OpenAI Codex, OpenCode Go, and third-party AI provider gateway with OpenAI and Anthropic API compatibility.",
6
6
  "keywords": [
7
7
  "github-copilot",
package/pages/index.html CHANGED
@@ -349,7 +349,7 @@
349
349
  }
350
350
 
351
351
  .metric-grid-tight {
352
- grid-template-columns: repeat(7, minmax(0, 1fr));
352
+ grid-template-columns: repeat(8, minmax(0, 1fr));
353
353
  }
354
354
 
355
355
  .metric-card {
@@ -1035,6 +1035,16 @@
1035
1035
  return Number.isFinite(value) ? Number(value).toLocaleString() : "0";
1036
1036
  }
1037
1037
 
1038
+ function formatCacheHitRate(usage) {
1039
+ const inputTokens =
1040
+ usage.input_tokens +
1041
+ usage.cache_read_input_tokens +
1042
+ usage.cache_creation_input_tokens;
1043
+ return inputTokens > 0
1044
+ ? `${((usage.cache_read_input_tokens / inputTokens) * 100).toFixed(1)}%`
1045
+ : "—";
1046
+ }
1047
+
1038
1048
  function getMetricDisplayText(value) {
1039
1049
  return typeof value === "number" ? formatNumber(value) : value;
1040
1050
  }
@@ -1658,6 +1668,7 @@
1658
1668
  getMetricDisplayText(totals.output_tokens),
1659
1669
  getMetricDisplayText(totals.cache_read_input_tokens),
1660
1670
  getMetricDisplayText(totals.cache_creation_input_tokens),
1671
+ formatCacheHitRate(totals),
1661
1672
  getMetricDisplayText(totals.request_count),
1662
1673
  formatTokenUsageCosts(totals.costs),
1663
1674
  ]);
@@ -1692,6 +1703,12 @@
1692
1703
  "var(--color-yellow-accent)",
1693
1704
  metricFontSize
1694
1705
  ),
1706
+ renderTokenUsageMetric(
1707
+ "Cache Hit Rate",
1708
+ formatCacheHitRate(totals),
1709
+ "var(--color-aqua-accent)",
1710
+ metricFontSize
1711
+ ),
1695
1712
  renderTokenUsageMetric(
1696
1713
  "Requests",
1697
1714
  totals.request_count,
@@ -2219,6 +2236,7 @@
2219
2236
  <td class="px-4 py-2 text-right" style="color: var(--color-fg-dark);">${formatNumber(
2220
2237
  model.cache_creation_input_tokens
2221
2238
  )}</td>
2239
+ <td class="px-4 py-2 text-right" style="color: var(--color-fg-dark);">${formatCacheHitRate(model)}</td>
2222
2240
  <td class="px-4 py-2 text-right font-semibold" style="color: var(--color-yellow-accent);">${formatNumber(
2223
2241
  model.total_tokens
2224
2242
  )}</td>
@@ -2234,7 +2252,7 @@
2234
2252
 
2235
2253
  return `
2236
2254
  <div class="overflow-auto ${state.isTokenUsageLoading ? "opacity-60" : ""}">
2237
- <table class="data-table min-w-[860px] text-left">
2255
+ <table class="data-table min-w-[960px] text-left">
2238
2256
  <thead>
2239
2257
  <tr>
2240
2258
  <th class="px-4 py-2 font-semibold">Model</th>
@@ -2243,6 +2261,7 @@
2243
2261
  <th class="px-4 py-2 text-right font-semibold">Output</th>
2244
2262
  <th class="px-4 py-2 text-right font-semibold">Cache Read</th>
2245
2263
  <th class="px-4 py-2 text-right font-semibold">Cache Write</th>
2264
+ <th class="px-4 py-2 text-right font-semibold">Cache Hit Rate</th>
2246
2265
  <th class="px-4 py-2 text-right font-semibold">Total Tokens</th>
2247
2266
  <th class="px-4 py-2 text-right font-semibold">Total Cost</th>
2248
2267
  </tr>