All Docs
FeaturesSaaS FactoryUpdated March 11, 2026

AI Cost & Budget Dashboard

AI Cost & Budget Dashboard

The AI Cost & Budget dashboard gives you per-project visibility into how credits are being consumed by the platform's autonomous agents. It surfaces spend by agent type, monthly trends, the most expensive pipeline runs, and recent credit deductions — all scoped to a single product.

Accessing the Dashboard

Navigate to any product and select AI Cost & Budget from the Operations section of the product sidebar (identified by the BrainCircuit icon).

Direct URL: /dashboard/products/[id]/ai-cost


Dashboard Layout

Summary Stat Cards

Three cards appear at the top of the page:

  • Credits Spent (This Month) — total credits consumed so far this calendar month. Displayed alongside a USD equivalent (1 credit = $0.01). The card background turns yellow or red if a budget warning or overage is active.
  • Agent Types Active — the number of distinct agent categories that have run this month, with the top-spending agent type named.
  • Monthly Budget — your configured credit limit for the month (if set) and the percentage consumed.

Budget Alert Bar

When a monthly budget limit is configured, a colour-coded progress bar appears between the header and the stat cards:

ColourConditionMessage
🟢 Green< 80% of budget used"Within budget — X / Y credits used (Z%)"
🟡 Yellow80–99% of budget used"Approaching budget — X / Y credits used (Z%)"
🔴 Red≥ 100% of budget used"Budget exceeded — X / Y credits used (Z%)" + guidance text

Tabs

By Agent Type

A horizontal bar chart listing every agent category that has consumed credits this month, sorted by total spend descending. Each bar is colour-coded by agent type.

Supported agent types and their colours:

AgentColour
researchBlue
implementationViolet
testingGreen
releaseOrange
marketingPink
documentationTeal
designYellow
architectIndigo
complianceRed
securityRose
revenueEmerald
uiuxCyan
performanceLime
seoAmber

Monthly Trend

A 6-month CSS bar chart showing total credit consumption per calendar month. Useful for spotting growth trends or anomalies in agent activity over time.

Top Pipelines

A table of the most expensive pipeline runs this month (up to 5), including the pipeline name and total credits consumed. Each row links directly to the pipeline run for further inspection.

Recent Runs

A chronological list of the last 50 individual credit deduction events, each showing the agent type, the amount deducted, and the timestamp.


Setting a Monthly Budget

  1. Click the Set Budget button in the top-right corner of the dashboard.
  2. Enter a credit limit in the dialog (e.g. 10000).
    • The dialog shows the USD equivalent as you type.
  3. Click Save Budget to apply.

The limit is stored per-project and takes effect immediately — the budget alert bar and stat cards will update on next load.

To remove a budget, set the value to 0.

Credit conversion: 1 credit = $0.01 USD.


tRPC API Reference

The dashboard is powered by the aiCost tRPC router. All procedures require an authenticated session and accept a projectId parameter scoped to a project you own.

aiCost.getMonthlySummary

Returns the current month's credit summary for a project.

Input:

{ projectId: string }

Returns:

{
  month: string;                  // e.g. "June 2025"
  totalCredits: number;
  agentBreakdown: { agentType: string; credits: number }[];  // sorted by credits desc
  topPipelines: { id: string; name: string; credits: number }[];  // top 5
  budgetLimit: number | null;
  budgetPct: number | null;       // percentage of budget consumed
}

aiCost.getMonthlyTrend

Returns the last 6 months of credit spend as a time series.

Input:

{ projectId: string }

Returns:

{ month: string; credits: number }[]  // oldest → newest

aiCost.getCrossProjectSummary

Returns monthly credit spend across all projects owned by the authenticated user.

Input: (none beyond auth)

Returns:

{ projectId: string; projectName: string; credits: number }[]

aiCost.setBudgetLimit

Upserts a monthly credit budget threshold for a project. Stored in billingSettings under key ai_budget_monthly_limit.

Input:

{ projectId: string; limitCredits: number }

Returns: (void)

aiCost.getRecentTransactions

Returns the last 50 credit deduction events for a project, enriched with agent type.

Input:

{ projectId: string }

Returns:

{
  id: string;
  agentType: string;
  credits: number;
  createdAt: Date;
}[]

Data Model

All queries join three tables to scope data to the correct project:

creditTransactions → agentJobs → pipelineRuns

This means every credit deduction is traceable back to the specific pipeline run and agent job that caused it.