Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(cost-dashboard): show a dash when every request is unpriced

Steven Enamakela8e2fdc74800
diff --git a/app/src/components/dashboard/ModelCostTable.tsx b/app/src/components/dashboard/ModelCostTable.tsx
index 139a2aa57e..c3946c709b 100644
--- a/app/src/components/dashboard/ModelCostTable.tsx
+++ b/app/src/components/dashboard/ModelCostTable.tsx
@@ -68,7 +68,12 @@ const ModelCostTable = ({ models, currency, title, description }: ModelCostTable
header: t('settings.costDashboard.cost'),
align: 'right',
className: 'whitespace-nowrap font-medium tabular-nums text-content',
- cell: row => formatCurrency(row.cost_usd, currency),
+ // Every request unpriced: the cost is not known, so show none rather
+ // than a $0 that reads as free.
+ cell: row =>
+ row.request_count > 0 && (row.unpriced_request_count ?? 0) >= row.request_count
+ ? '—'
+ : formatCurrency(row.cost_usd, currency),
},
{
id: 'share',
diff --git a/app/src/hooks/useCostDashboard.ts b/app/src/hooks/useCostDashboard.ts
index 1015984b74..4225bf4eed 100644
--- a/app/src/hooks/useCostDashboard.ts
+++ b/app/src/hooks/useCostDashboard.ts
@@ -9,6 +9,8 @@ export interface CostDashboardModelStats {
cost_usd: number;
total_tokens: number;
request_count: number;
+ /** Requests with no known cost; absent from an older core. */
+ unpriced_request_count?: number;
provider: string | null;
percent_of_total: number;
}
diff --git a/crates/openhuman-core/src/platform/cost/rpc.rs b/crates/openhuman-core/src/platform/cost/rpc.rs
index 3e00bc5097..53000ea3fc 100644
--- a/crates/openhuman-core/src/platform/cost/rpc.rs
+++ b/crates/openhuman-core/src/platform/cost/rpc.rs
@@ -43,6 +43,8 @@ pub struct ModelStatsDto {
pub cost_usd: f64,
pub total_tokens: u64,
pub request_count: usize,
+ /// Requests with no known cost; `cost_usd` excludes them.
+ pub unpriced_request_count: usize,
pub provider: Option<String>,
pub percent_of_total: f64,
}
@@ -153,6 +155,7 @@ fn model_stats_to_dto(stats: &ModelStats, total_cost: f64) -> ModelStatsDto {
cost_usd: stats.cost_usd,
total_tokens: stats.total_tokens,
request_count: stats.request_count,
+ unpriced_request_count: stats.unpriced_request_count,
provider: provider_for(&stats.model),
percent_of_total,
}