Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix(usage): keep local/non-Claude models out of the Claude per-model card and name peers that haven't published history

[._.]/ Adam Eivyca20dada96da
diff --git a/client/src/components/usage/ClaudeCodeModelTokensCard.jsx b/client/src/components/usage/ClaudeCodeModelTokensCard.jsx
index 9f41d32414..12433d1deb 100644
--- a/client/src/components/usage/ClaudeCodeModelTokensCard.jsx
+++ b/client/src/components/usage/ClaudeCodeModelTokensCard.jsx
@@ -71,6 +71,7 @@ export default function ClaudeCodeModelTokensCard({ period, from, to, isCustom }
}, [period, from, to, isCustom]);
const instances = report?.instances || [];
+ const pending = report?.pendingInstances || [];
return (
<div className="bg-port-card border border-port-border rounded-xl p-3 sm:p-4 space-y-3">
@@ -105,10 +106,15 @@ export default function ClaudeCodeModelTokensCard({ period, from, to, isCustom }
))}
</div>
)}
+ {pending.length > 0 && (
+ <p className="text-xs text-port-warning">
+ No token history yet from {pending.join(", ")} — it needs to update PortOS (or finish its first scan) before it appears here.
+ </p>
+ )}
<p className="text-[10px] sm:text-xs text-gray-500">
Read from each machine&rsquo;s local Claude Code session transcripts, so it includes sessions run outside PortOS, and
history is kept after the CLI prunes old transcripts. Cost is an informational API-rate equivalent from the shared
- pricing table (cache reads and writes at their own tiers; local models free). Instances on an older PortOS build
+ pricing table (cache reads and writes at their own tiers). Only Claude models are listed. Instances on an older PortOS build
contribute nothing until they update. claude.ai and unfederated devices are not included.
</p>
</div>
diff --git a/server/services/claudeCodeModelReport.js b/server/services/claudeCodeModelReport.js
index 4b2cfbdb2d..98a258c8d9 100644
--- a/server/services/claudeCodeModelReport.js
+++ b/server/services/claudeCodeModelReport.js
@@ -8,6 +8,11 @@ import { roundCents } from '../lib/subscriptionSavings.js';
*/
const COUNT_FIELDS = ['messages', 'input', 'output', 'cacheRead', 'cacheWrite'];
+// Claude Code can be pointed at local or third-party backends (Ollama, LM Studio,
+// HF GGUFs), so its transcripts also hold non-Claude ids. This is the Claude card:
+// only Claude ids (incl. Bedrock/Vertex-prefixed forms) belong in it.
+const CLAUDE_MODEL_ID = /claude/i;
+
const SUM_FIELDS = [...COUNT_FIELDS, 'total', 'estimatedCost'];
// Group rows by model, sum every field, round the money, and total — the one
@@ -29,14 +34,15 @@ function rollUp(rows) {
/**
* Sum a day map over an inclusive window into per-model rows (highest cost
- * first), each priced at API rates. Cache tiers bill at their own rates;
- * local/free model ids cost nothing.
+ * first), each priced at API rates. Cache tiers bill at their own rates.
+ * Non-Claude ids (local/third-party backends) are excluded.
*/
export function summarizeTranscriptDays(days, { from = null, to = null } = {}) {
const rows = [];
for (const [day, models] of Object.entries(days || {})) {
if ((from && day < from) || (to && day > to)) continue;
for (const [model, c] of Object.entries(models)) {
+ if (!CLAUDE_MODEL_ID.test(model)) continue;
const cost = isFreeModelId(model)
? 0
: estimateCostUsd(c.input, c.output, resolveModelRates('claude-code', model), { cacheReadTokens: c.cacheRead, cacheWriteTokens: c.cacheWrite });
diff --git a/server/services/peerUsage.js b/server/services/peerUsage.js
index 0135e9931d..4b2a942659 100644
--- a/server/services/peerUsage.js
+++ b/server/services/peerUsage.js
@@ -499,7 +499,10 @@ export async function getFleetClaudeCodeModels({ from = null, to = null, apiBill
...peers.filter((e) => e.claudeCode).map((e) => row(e, false)),
];
const combined = mergeModelRows(instances.filter((i) => i.usesSubscriptions).map((i) => i.models));
- return { instances, ...combined };
+ // Peers we know of that published no history (older build, or not scanned yet)
+ // — named so the UI can say why they are missing rather than dropping them.
+ const pending = peers.filter((e) => !e.claudeCode).map((e) => e.name || e.instanceId);
+ return { instances, pendingInstances: pending, ...combined };
}
/**