Review model usage and spend across an Organization, identify the Agents and models responsible for that spend, and investigate unexpected changes.
Overview
Agent Barn’s Costs view is a usage report. It shows spend reported by LiteLLM and attributes it to Agents through their individual LiteLLM keys. It is not an invoice, payment system, budget, quota, or spending limit.
Use the Costs page to answer four operational questions:
| Question | Where to look |
|---|---|
| How much has this Organization spent? | Total Spend |
| How has spend changed over time? | Cost over time |
| Which models account for the spend? | Cost by model |
| Which Agents account for the spend? | Agent breakdown |
After completing this guide, you will be able to:
- Select an Organization cost-reporting period
- Review total spend and daily changes
- Compare spend across models
- Inspect input and output tokens by Agent
- Expand an Agent to see its model breakdown
- Interpret deleted, stopped, and missing Agent data
- Distinguish Organization-wide access from per-Agent cost access
What the report includes
The Organization cost summary contains the following information:
| Report value | Meaning |
|---|---|
| Total spend | The sum of spend LiteLLM attributed to the Organization’s Agent keys during the reporting period |
| Daily spend | Spend grouped by date for the cost-over-time chart |
| Model spend | Spend grouped by the models observed by LiteLLM |
| Agent spend | Spend attributed to each Agent’s LiteLLM key |
| Input tokens | Prompt or input tokens reported for the Agent |
| Output tokens | Completion or output tokens reported for the Agent |
| Agent status | A cost-facing projection of the Agent’s current or deleted state |
Costs are displayed in US dollars.
The report can include active, stopped, errored, and soft-deleted Agents. An Agent without a LiteLLM key is omitted from the Organization summary, because there is no key identity through which spend can be attributed.
Access model
Organization-wide and per-Agent cost access are separate authorizations.
| User authority | Organization summary | Accessible Agent cost | Deleted-Agent cost history |
|---|---|---|---|
| Organization Owner | Yes | Yes, for every Organization Agent | Yes |
| Organization Admin | Yes | Yes, for every Organization Agent | Yes |
| Organization Member without Agent Access | No | No | No |
| Agent Viewer | No | Yes, for the assigned active Agent | No |
| Agent Editor | No | Yes, for the assigned active Agent | No |
| Agent Owner | No | Yes, for the assigned active Agent | No |
| Platform Administrator without Membership | No | No | No |
The Organization summary requires the Organization-level cost.read Permission. The fixed Organization Owner and Admin Roles contain it.
All three fixed Agent Access Roles — Viewer, Editor, and Owner — contain cost.read, but only for the Agents made accessible through those roles. An Agent Access Role never grants access to the Organization-wide summary.
Before you begin
Confirm that:
- You are signed in to Agent Barn
- You selected the Organization whose spend you want to review
- You are an Organization Owner or Administrator, to use the Organization Costs page
- The Organization has at least one Agent with a provisioned LiteLLM key
- LiteLLM is running and reachable from the Agent Barn API
- The Agents made model requests during the period you intend to inspect
If you hold only Agent Viewer, Editor, or Owner access, use the per-Agent API described in Cost API. Those roles do not provide access to the Organization-wide page.
Open Usage & Billing
- Select the correct Organization from the Organization switcher.
- Select Costs in the top navigation.
- Confirm that the page heading is Usage & Billing.
The initial report uses Agent Barn’s default 365-day lookback.
If Costs does not appear in the navigation, check that your current Membership is Owner or Admin. Being assigned to an individual Agent does not make the Organization Costs page available.
Set the reporting period
When daily cost data is available, the Cost over time section displays From and To date controls.
- Select the first date in From.
- Select the last date in To.
- Select Apply.
- Wait for the summary, chart, model totals, and Agent rows to refresh.
Both dates are required. The API applies an explicit period only when it receives both start_date and end_date; supplying just one falls back to the default range.
Select Reset to remove the explicit range and return to the default 365-day lookback.
Use shorter ranges when investigating an incident or a recent cost increase. Use a longer range when comparing model or Agent usage over time.
Review the overview
The top of the page contains three summary cards.
Total Spend
Total Spend is the sum of cost reported for the Organization’s attributable Agent keys during the selected period.
The value is calculated when the page requests the report. Agent Barn does not maintain a separate cost ledger in the Costs domain.
Active Agents
The Active Agents card counts non-deleted Agents represented in the cost report.
Top Model
Top Model identifies the displayed model name with the highest reported spend.
Agent Barn shortens provider-qualified model paths for display, so different paths ending in the same model name can be combined under that trailing name.
This card reflects observed model usage in the report — not necessarily the model currently configured on an Agent.
Analyze cost over time
The Cost over time chart shows daily spend across the Organization’s attributable Agents. Use it to look for:
- A sudden increase after an Agent configuration change
- Sustained growth in daily model usage
- Spend continuing after an Agent was expected to stop
- A new usage pattern after changing models
- Days with no reported usage
- Differences between a short incident window and the normal baseline
Move the pointer over a bar to see the date and its reported cost. Dates without reported spend are displayed as zero when they fall between the beginning and end of the rendered series.
Correlate cost changes with Agent activity, configuration changes, model changes, and operational events. Conversation and Tool Call records can help explain what an Agent was doing, but they are not the source used to calculate cost. See Review Agent activity.
Compare model costs
The Cost by model section groups spend by model and orders the displayed models from highest to lowest cost. Each row contains:
- The shortened model name
- A relative bar compared with the most expensive model in the report
- The model’s total reported cost
Use this section to determine whether a cost increase is concentrated in one model or distributed across several.
Model names come from LiteLLM’s observed usage data. Agent Barn removes provider-path prefixes for display, and entries sharing a trailing model name can be merged. For example:
openrouter/acme/model-x
acme/model-xBoth can be displayed as:
model-xBecause models have different prices, token volume and cost do not always move proportionally. A model with fewer tokens can still account for more spend.
Review Agent attribution
The Agent breakdown table attributes reported usage to individual Agents.
| Column | Meaning |
|---|---|
| Agent | Agent name and abbreviated Agent ID |
| Status | Cost-facing status for the Agent |
| Model | Number of observed models, or the available model fallback |
| Input Tokens | Prompt or input tokens attributed to the Agent |
| Output Tokens | Completion or output tokens attributed to the Agent |
| Cost | Total spend attributed to the Agent |
Select an Agent row to expand its model breakdown. An expanded row shows each observed model, its input tokens, its output tokens, and the spend attributed to that model.
Use the Agent ID when two Agents have similar names. Names are display labels; the ID is the stable identity used by the API.
The table shows ten Agents per page. Use Previous and Next when additional rows are available.
Deleted Agents
Soft-deleted Agents remain in the Organization summary when they have historical spend associated with their LiteLLM keys. This is intentional — removing a live Agent should not erase its historical contribution to Organization spend.
Only Organization Owners and Administrators can retrieve deleted-Agent cost history. Access granted through an explicit Agent Access Role does not survive Agent deletion.
Agents without a LiteLLM key
An Agent without a LiteLLM key is omitted from the Organization summary.
The individual Agent cost endpoint behaves differently: when an accessible Agent has no key, it returns zero-valued cost and token data with the status stopped.
Interpret Agent statuses
Cost-facing statuses are reporting labels.
| Cost status | Meaning |
|---|---|
active | The Agent’s persisted lifecycle status is running |
stopped | The Agent is stopped, or the individual cost endpoint found no LiteLLM key |
error | The Agent is currently in an error lifecycle state |
deleted | The Agent was soft-deleted but remains attributable in historical cost reporting |
These values are not the same API contract as the persisted Agent lifecycle enum.
Cost and runtime state also describe different things. Stopping an Agent prevents new runtime work, but it does not remove spend already reported for its key.
How cost attribution works
Agent Barn attributes spend through a per-Agent LiteLLM identity:
- Agent
- Per-Agent LiteLLM key
- LiteLLM spend report
- Agent Barn Costs
The diagram reads left to right: an Agent holds a per-Agent LiteLLM key; requests made with that key appear in the LiteLLM spend report; Agent Barn Costs joins the key identity back to the Agent.
When an Organization summary is requested, Agent Barn:
- Loads active and soft-deleted Agents belonging to the Organization.
- Omits Agents that have no LiteLLM key.
- Decrypts each stored per-Agent key inside the service boundary.
- Derives the key identity used by LiteLLM’s report.
- Matches LiteLLM report entries to Agents.
- Aggregates total spend, daily spend, model spend, token counts, and Agent spend.
- Returns the calculated report to the caller.
Cost data is fetched from LiteLLM when the report is requested. The Costs domain does not persist the resulting cost records.
Only usage reported through the relevant Agent key can be joined to that Agent. Model requests made outside the configured Agent Barn and LiteLLM path do not automatically appear in this report.
Reporting boundaries
Interpret the Costs page as an operational attribution report. It does not provide:
- Provider invoices
- Payment history
- Account balances
- Budgets or alerts
- Per-Agent spending limits
- Quota enforcement
- Conversation-level cost allocation
- Tool-call-level cost allocation
- A permanent Agent Barn cost ledger
- Platform-wide cost oversight
Conversation Messages, Tool Calls, Logs, and runtime Telemetry do not feed the cost calculation. They may help explain usage, but LiteLLM remains the reporting source.
The report can differ from a provider invoice because of:
- Different reporting windows
- Provider-side adjustments
- Reporting delays
- Requests made outside Agent Barn’s per-Agent keys
- Display-name normalization
- Different rounding and aggregation rules
Use the provider’s billing records as the financial authority for invoicing and reconciliation.
Cost API
All endpoints require an authenticated Agent Barn access token.
Organization summary
GET /api/v1/organizations/{organization_id}/costs/summary
Authorization: Bearer <access-token>Apply an explicit date range with both query parameters:
GET /api/v1/organizations/{organization_id}/costs/summary?start_date=2026-08-01&end_date=2026-08-29
Authorization: Bearer <access-token>Example request:
curl \
--request GET \
--header "Authorization: Bearer $ACCESS_TOKEN" \
"$AGENT_BARN_URL/api/v1/organizations/$ORGANIZATION_ID/costs/summary?start_date=2026-08-01&end_date=2026-08-29"The response contains totalCost, agents, byModel, and timeSeries. Each Agent entry includes its identity, status, configured model, total cost, token totals, and available model breakdown.
This endpoint requires Organization-level cost.read.
Individual Agent cost
GET /api/v1/organizations/{organization_id}/costs/agents/{agent_id}
Authorization: Bearer <access-token>Example request:
curl \
--request GET \
--header "Authorization: Bearer $ACCESS_TOKEN" \
"$AGENT_BARN_URL/api/v1/organizations/$ORGANIZATION_ID/costs/agents/$AGENT_ID"This endpoint requires effective cost.read authority for the requested Agent. The fixed Agent Viewer, Editor, and Owner Access Roles contain that Permission.
An inaccessible Agent returns 404 Not Found, so the endpoint does not reveal whether an Agent exists in another access scope.
Authorization behavior
| Result | Meaning |
|---|---|
200 OK | The caller can read the requested cost data |
401 Unauthorized | Authentication is missing or invalid |
403 Forbidden | The Organization is known, but the caller lacks Organization-level cost permission |
404 Not Found | The Agent does not exist in the caller’s accessible scope |
Security considerations
Cost data is billing-sensitive Organization information.
Follow these practices:
- Grant Organization Admin access only to users who need Organization-wide cost visibility
- Use Agent Viewer when someone needs read access to one Agent without Organization-wide cost visibility
- Do not expose LiteLLM virtual keys in reports, support tickets, screenshots, or documentation
- Do not attempt to reproduce attribution by exporting decrypted keys
- Treat Agent names, model usage, token totals, and spend as potentially sensitive operational data
- Verify the selected Organization before exporting or discussing cost figures
- Remove obsolete Agent access assignments, even though deleted-Agent history is limited to Organization management authority
- Remember that Platform Administrator privilege does not replace Organization Membership
Agent Barn decrypts per-Agent LiteLLM keys inside the service to derive their reporting identity. The plaintext key is never part of the cost response.
Troubleshooting
| Symptom | Likely cause | Resolution |
|---|---|---|
| Costs is missing from the navigation | The current Membership is not Organization Owner or Admin | Switch to the correct Organization, or ask an Owner to review your Membership. |
| The summary returns 403 Forbidden | The caller lacks Organization-level cost.read | Use an Owner or Admin Membership. An Agent Access Role is not sufficient. |
| A Platform Administrator receives 403 Forbidden | Platform privilege is not an Organization Membership | Obtain an appropriate Membership, or use a dedicated Platform View capability. |
| An Agent request returns 404 Not Found | The Agent is outside the caller’s access scope, deleted, or belongs to another Organization | Verify the Organization and the Agent Access assignment. |
| Total Spend unexpectedly shows $0 | There was no reported usage, the selected period is wrong, or LiteLLM reporting was unavailable | Check the dates, LiteLLM health, proxy configuration, and provider reporting. |
| An Agent is missing from the table | The Agent has no LiteLLM key, so no spend can be attributed to it | Verify that the Agent was provisioned and started through the supported lifecycle. |
| A deleted Agent remains in the report | Historical spend is intentionally retained | Use the deleted status to distinguish retained history from live Agents. |
| A stopped Agent still shows spend | The report includes historical usage from the selected period | Narrow the date range to the period after the Agent stopped. |
| The chart and its date controls are missing | LiteLLM returned no daily spend series | Verify usage and LiteLLM reporting, and use the summary API if necessary. |
| Applying dates does nothing | Only one date was entered, or the range is invalid | Enter both From and To, then select Apply. |
| The default period appears to say “all time” | The current interface label differs from the service behavior | Interpret the default as the previous 365 days. |
| Active Agents includes a stopped or errored Agent | The card counts non-deleted Agents represented in the report | Use the Agent status column for the actual reporting status. |
| Top Model does not match an Agent’s configured model | The report uses the models observed by LiteLLM | Expand the Agent row and review its observed model breakdown. |
| Two provider-qualified models appear combined | Display grouping uses the final model-name segment | Use LiteLLM’s underlying report when provider-path distinctions are required. |
| Cost does not track token count proportionally | Models have different token prices | Compare the model breakdown instead of token totals alone. |
| Cost differs from a provider invoice | The two surfaces use different windows, attribution, rounding, and adjustments | Use provider billing as the invoice authority, and Agent Barn for operational attribution. |
Next steps
- Correlate spend changes with conversations and Tool Calls.
- Review who holds Organization-wide and per-Agent cost visibility.
- Verify unexpected totals against LiteLLM and provider reporting.
- Reconcile invoices against the provider’s billing records, not this report.
- Continue to Administer the platform.