fix: show native Claude CLI usage as unpriced

This commit is contained in:
amosblomqvist
2026-10-28 19:58:07 +02:00
parent 5093809ea0
commit 17c94be327
11 changed files with 64 additions and 13 deletions
+4 -1
View File
@@ -4,12 +4,15 @@
*/
import { calculateCost, type Usage } from "@earendil-works/pi-ai";
import { piModels } from "../agent/models.ts";
import { CLAUDE_CODE_PROVIDER } from "../core/contracts/claude-code.ts";
import type { CallUsage, ChatRecord, JobRecord, TurnUsage } from "../core/contracts.ts";
import { isSubscriptionModel, sessionCost as foldSessionCost, turnCost as foldTurnCost, jobCost as foldJobCost } from "../core/prices.ts";
function catalogModel(id: string) {
const colon = id.indexOf(":");
if (colon < 0 || isSubscriptionModel(id)) return undefined;
// Native CLI routing determines billing. Adapter zero-rate placeholders
// must never become an apparent $0 estimate or subscription classification.
if (colon < 0 || isSubscriptionModel(id) || id.slice(0, colon) === CLAUDE_CODE_PROVIDER) return undefined;
return piModels().getModel(id.slice(0, colon), id.slice(colon + 1));
}