# Prime Agent Cost Tracking — Registering a Provider for the Proxy

Prime Agent ships no permission framework and no cost tracking — a hard fork of pi that kept its typed extension events but not a native usage hook. Cost visibility comes from pi.registerProvider, a three-line call that re-points Prime Agent's model traffic through the ACP proxy. What it captures, and why the extension is the entire control story here, cost included.

<div class="acp-shot-frame">
<img src="/assets/img/screenshots/session-trace-dark.png" alt="An ACP session trace: each model call priced with its token and cached-token counts, interleaved with the tool calls it drove — the cost X-ray for one run" style="width:100%;height:auto;border:1px solid var(--line-2);border-radius:10px;box-shadow:0 20px 50px -24px rgba(0,0,0,0.9);margin:8px 0;" />
</div>

<div style="margin:8px 0 28px;padding:20px 22px;border:1px solid var(--line-2);border-radius:12px;background:var(--color-accent-light,#f0effe);">
  <p style="margin:0 0 12px;font-size:15px;line-height:1.6;color:var(--acp-text);"><strong>Just want the answer?</strong> Prime Agent has no cost hook either — register a provider that points at the proxy:</p>
  <pre data-track="PrimeAgentCost: Hero Config Copy" style="margin:0 0 12px;background:var(--color-surface,#faf9ff);border:1px solid var(--line-2);border-radius:8px;padding:12px 14px;overflow-x:auto;"><code>curl -sf https://agenticcontrolplane.com/install.sh | bash

// ~/.prime/agent/extensions/acp-cost.ts
pi.registerProvider("anthropic", {
  baseUrl: "https://api.agenticcontrolplane.com/v1",
});</code></pre>
  <p style="margin:0;font-size:13px;color:var(--acp-text-dim);"><a href="/integrations/prime-agent" data-track="PrimeAgentCost: Integration Guide" style="font-weight:600;">Full Prime Agent install guide →</a> &nbsp;·&nbsp; <a href="/controls/prime-agent" data-track="PrimeAgentCost: Controls Reference">Prime Agent's control model, explained →</a> &nbsp;·&nbsp; free up to 5 agents</p>
</div>

Prime Agent — [PrimeIntellect-ai/prime-agent](https://github.com/PrimeIntellect-ai/prime-agent), a hard fork of [pi](/blog/pi-cost-tracking) — kept pi's minimalism and pushed it further: one model-facing tool (a persistent `ipython` kernel) instead of pi's four, wrapped in daemon-backed sessions built for unattended, long-running work. What it inherited from pi along with the minimalism is the honest zero: no permission framework, and no cost tracking either. The [control-model reference](/controls/prime-agent) covers the first gap. This is the second.

## No native hook, same as pi

Prime Agent's two typed extension events, `tool_call` and `tool_result`, work exactly as they do in pi — deny or rewrite a call before it runs, redact or rewrite what comes back after. Neither carries a token count. The kernel executes code; it doesn't report what the model call that produced the code cost, and there's no third event that would. If you've read the [pi cost post](/blog/pi-cost-tracking), the shape of the gap is identical, because Prime Agent didn't change this part of the fork.

What *is* different is the stakes: Prime Agent is explicitly built to run longer with less supervision — daemon sessions that persist across restarts, bounded `/autonomous` mode, recursive subagents. A harness built to run unattended for hours is exactly where an unnoticed cost spike does the most damage before anyone looks.

## The provider seam

pi's model-routing API survived the fork intact: `pi.registerProvider(name, config)`, called from an extension file, re-points a named provider's `baseUrl`. Prime Agent's [control-model reference](/controls/prime-agent) already documents this line as "the metering half of the story" alongside the `tool_call`/`tool_result` policy pair — this post is that half, in full.

```typescript
// ~/.prime/agent/extensions/acp-cost.ts
pi.registerProvider("anthropic", {
  baseUrl: "https://api.agenticcontrolplane.com/v1",
});
```

Dropped in the global extensions path (`~/.prime/agent/extensions/`, no trust prompt — where a control extension belongs, per the same reference), this takes effect for every session the daemon hosts. Three lines, no build step — Prime Agent loads TypeScript directly via jiti, same as pi. Anthropic-shaped traffic now transits the ACP proxy, which forwards the request unchanged upstream and reads the token-usage fields off the response on the way through.

## What you get

Once registered, every model call Prime Agent makes shows up priced in [the console](https://cloud.agenticcontrolplane.com), joined to whatever the `tool_call`/`tool_result` extension is separately recording for the `ipython` kernel:

- **Per-call cost** — tokens in and out, priced to dollars, rolled up per session and across the daemon's restarts
- **Prompt-cache hit rate** — worth watching closely here, since a long-running daemon session is exactly where a cold cache compounds unnoticed
- **The loop-vs-leaf split** — how much of a long autonomous run is spent re-deriving context versus doing the next step of actual work
- **A policy check on the tool calls the model emits** — a second, coarser layer than the extension's own `tool_call` interception on the kernel, not a substitute for it

Because Prime Agent's daemon can keep a session alive across `/autonomous` continuations and scheduled wakeups, this is closer to a running meter than a single-session report — the console's per-day rollup is the more useful view for a session that outlives any one terminal window.

## Budget limits

Registering the provider is what makes a budget cap possible at all. **Workspace-billed** traffic is checked against your workspace's daily LLM cost cap at the gateway, before the call reaches the upstream provider — a session that would exceed it fails closed rather than running up further spend. **Bring-your-own-key** traffic is billed by whichever provider you're calling directly; ACP can meter it but can't enforce a cap on an account it doesn't hold. Without `registerProvider`, Prime Agent's daemon has no cap at all — nothing in its path can see the spend to stop it, which matters more for a harness whose sessions are designed to keep running after you've stopped watching.

## Cost and policy are still two separate pieces

Registering the provider doesn't add tool-call policy, and installing the `tool_call`/`tool_result` extension doesn't add cost visibility — they're unrelated integrations that happen to write to the same console. For Prime Agent specifically, that matters more than it does for most harnesses: because there's no native permission framework underneath either one, the extension file is the entire control story, cost included. Nothing stops you from shipping only one half, but a daemon that runs unattended for hours is the case where both halves — knowing what it's allowed to do, and knowing what it's spending — earn their keep together.

## Frequently asked questions



## Where to read more

- [Prime Agent's control model, explained](/controls/prime-agent) — the tool_call/tool_result policy half, and the hasUI print-mode bug
- [pi cost tracking](/blog/pi-cost-tracking) — the same provider-seam pattern on the harness Prime Agent forked from
- [Hermes Agent cost tracking](/blog/hermes-cost-tracking) — the in-process hook alternative, for comparison
- [Claude Code cost tracking reference](/blog/claude-code-cost-tracking-reference) and [Codex CLI cost tracking](/blog/codex-cli-cost-tracking) — the sibling references for the other coding agents
