Files
coder/docs/ai-coder/agents/platform-controls/usage-insights.md
T
Matt Vollmer e189f73cc0 docs: close Coder Agents coverage gaps and align nav references (#24971)
Closes coverage gaps in `docs/ai-coder/agents/` and aligns nav
references with the current UI (post #24574 Behavior split, post #24644
Insights removal).

**Content fixes:**

- Replace site-wide `coder users edit-roles` flow with org-scoped
`agents-access` role (per migration `000475`). CLI examples now preserve
existing org roles since `edit-roles` overwrites the full set.
- Correct computer-use claim: supports Anthropic *and* OpenAI providers,
configured under the Virtual desktop experiment.
- New `platform-controls/experiments.md` covering Virtual desktop,
Advisor, and Chat debug logging (each as: what, how to enable, API).
Includes the Debug tab in the chat right panel.
- Trim `models.md` "Model overrides" to essentials: two layers (admin
subagent, user personal), contexts table, resolution order, API pointer.
- Remove retired `platform-controls/pr-insights.md` (page + manifest +
cross-links).

**Nav cleanup:**

- Admin-only tabs use the full `Agents > Settings > Manage Agents >
<Tab>` path; user-side tabs keep `Agents > Settings > <Tab>`.
- Replace stale "Behavior" references with Instructions / Lifecycle /
Experiments to match the current sidebar.
- Replace references to the removed top-bar Admin dialog with the
Settings sidebar.

<details>
<summary>Decision log</summary>

- Experimental features were originally drafted as a standalone Advisor
page plus inline sections in `platform-controls/index.md`. Consolidated
into one `experiments.md` since no individual feature warrants a full
page yet and parallel short sections are easier to scan.
- Reviewer feedback on early drafts: drop the inline experiments list
from `index.md` (avoid drift), drop the "users created before this role
was introduced" note (handled transparently by migration `000475`),
specify the full nav path for per-model pricing, link the
`type=computer_use` row in `architecture.md` to the Experiments page.
- CLI bulk-grant script previously called `edit-roles <user>
agents-access`. That replaces the user's full org role set, so the
script would silently strip `organization-admin`,
`organization-template-admin`, etc. Rewrote to read each user's current
roles, append `agents-access`, dedupe, and write the union back.

</details>

PR generated with Coder Agents.
2026-05-05 12:40:03 -04:00

3.4 KiB

Spend Management

Coder provides admin-only controls for monitoring and controlling agent spend: usage limits and cost tracking.

Usage limits

Navigate to Agents > Settings > Manage Agents > Spend.

Usage limits cap how much each user can spend on LLM usage within a rolling time period. When enabled, the system checks the user's current spend before processing each chat message.

Configuration

  • Enable/disable toggle — master on/off for the entire limit system.
  • Periodday, week, or month. Periods are UTC-aligned: midnight UTC for daily, Monday start for weekly, first of the month for monthly.
  • Default limit — deployment-wide default in dollars. Applies to all users who do not have a more specific override. Leave unset for no limit.
  • Per-user overrides — set a custom dollar limit for an individual user. Takes highest priority.
  • Per-group overrides — set a limit for a group. When a user belongs to multiple groups, the lowest group limit applies.

Priority hierarchy

The system resolves a user's effective limit in this order:

  1. Individual user override (highest priority)
  2. Minimum group limit across all of the user's groups
  3. Global default limit
  4. No limit (if limits are disabled or no value is configured)

Enforcement

  • Checked before each chat message is processed.
  • When current spend meets or exceeds the limit, the chat returns a 409 Conflict response and the message is blocked.
  • Fail-open: if the limit query itself fails, the message is allowed through.
  • Brief overage is possible when concurrent messages are in flight, because cost is determined only after the LLM returns.

User-facing status

Users can view their own spend status, including whether a limit is active, their effective limit, current spend, and when the current period resets.

Note

The admin configuration page shows the count of models without pricing data. Models missing pricing cannot be tracked accurately against limits.

Cost tracking

Navigate to Agents > Settings > Manage Agents > Spend.

This view shows deployment-wide LLM chat costs with per-user drill-down.

Top-level view

A per-user rollup table with the following columns:

Column Description
Total cost Aggregate dollar spend for the user
Messages Number of chat messages sent
Chats Number of distinct chat sessions
Input tokens Total input tokens consumed
Output tokens Total output tokens consumed
Cache read tokens Tokens served from cache
Cache write tokens Tokens written to cache

The table supports date range filtering (default: last 30 days), search by name or username, and pagination.

Per-user detail view

Select a user to see:

  • Summary cards — total cost, token breakdowns, and message counts.
  • Usage limit progress — if a limit is active, a color-coded progress bar shows current spend relative to the limit.
  • Per-model breakdown — table of costs and token usage by model.
  • Per-chat breakdown — table of costs and token usage by chat session.

Note

Automatic title generation uses lightweight models, such as Claude Haiku or GPT-4o Mini. Its token usage is not counted towards usage limits or shown in usage summaries.