CtrlSpend tags every AI call in your code, so cost and margin are finally per customer, per agent, per run.
Wraps OpenAI, Anthropic, and your LiteLLM gateway. No code rewrites, no added latency.
import { withTags } from '@ctrlspend/node'
// every call inside inherits this context
await withTags(
{ customer_id: 'acme-corp', agent_id: 'doc-parser' },
() => openai.chat.completions.create({
model: 'gpt-4o',
messages,
}),
)Margin Contribution
Last 30 days · by customer
Customer
Revenue
Margin
Acme Corp
$26,000
82%
Globex Financial
$32,000
70%
Umbrella Health
$15,000
25%
Contoso Holdings
$9,200
-19%
Why request-level
Invoice-level tools read the bill, so they never see the customer or agent behind a cost. Building it yourself reaches those dimensions but drifts from the bill and eats engineering time. CtrlSpend is the only option that is request-level and reconciled to your invoice, without becoming your team’s side project.
Invoice-level dashboards
Provider and card-based tools
Build it yourself
A ledger on your own gateway
CtrlSpend
Request-level, reconciled
How it works
Two ways in, one data model. Instrument application code with the SDK, or point your existing gateway at CtrlSpend. Most teams do both.
Wrap your OpenAI or Anthropic client, or pass metadata through your LiteLLM gateway. Attach customer, agent, and project context in one place.
Every call ships to CtrlSpend with its full tag context and cost. No per-call bookkeeping, no added latency in the request path.
Read cost per customer, per agent, and per run. Catch reruns and retry loops. See which workloads to right-size, with the ROI attached.
import { withTags } from '@ctrlspend/node'
await withTags(
{ customer_id: 'acme-corp' },
() => openai.chat.completions.create({ ... }),
)litellm.success_callback = ["ctrlspend"]
litellm.completion(model, messages,
metadata={ "customer_id": "acme-corp" })The Platform
One attribution primitive powers every surface. Instrument once, and the cost, waste, right-sizing, and margin views all come from the same data.
Wrap your OpenAI, Anthropic, or Google client once. Every call inherits customer, project, and agent context automatically. Zero per-call code changes, zero added latency.
Route through LiteLLM, Bifrost, or Portkey? One line of config captures every provider behind the gateway, with no SDK install in any service.
Reconcile every ingested event against your provider invoice and see exactly what share we capture. The number in-house builds get wrong, ours matches the bill.
Cost per agent run, cost distribution, and expensive-run alerts. Prove which agents are efficient and which are burning margin on retries.
Identical prompt repetition, retry loops, and prompt bloat, all surfaced as dollars, not error counts. This is the waste your provider dashboard cannot flag.
Where can you move workloads from frontier to smaller models without quality loss? We show you, with ROI math attached, not just "try a smaller model."
Per-customer and per-job cost ceilings with auto-disable on runaway, so one workload cannot blow the budget before anyone notices. Safety limits you configure, never autopilot.
The number your CFO will ask for. Revenue against cost per customer, in one screen, the moment your tags start flowing.
For AI-native teams
Every AI-native SaaS is about to make the same call: which workloads move to smaller, specialized, or fine-tuned models? That decision needs per-workload cost, per-customer margin, and evidence that the frontier has stopped improving the task. That data is what CtrlSpend is built to produce.
Not every workload benefits from post-training. Attribution surfaces the volume, cost, and flat-frontier-improvement combo that actually justifies the engineering effort.
A post-training program costs real engineering time and compute. Our right-sizing engine models expected savings against that cost, so you know if the math works before you build the team.
Frontier labs raise prices, change terms, and restrict access. Attribution tells you which workloads to specialize first as a hedge, and which to leave on the frontier.
For finance, later
Start with a single service and the SDK. When the tags are flowing, the margin view is already built. Loop in your CFO when you are ready, and they get per-customer profitability from the same data, no separate integration required.
Once calls carry customer context, CtrlSpend joins spend to revenue and reports gross margin for every customer, with no spreadsheet reconciliation.
See which customers slipped below break-even and which margins are trending down month over month, before it shows up in the quarterly numbers.
Export the margin picture your CFO takes to the board. The same tags engineering already set, turned into finance-grade numbers.
Integrations
Native connectors for the frontier providers plus first-class gateway support. One integration with your existing LiteLLM setup covers your entire vendor list.
Available now
Shipping next
Enterprise-ready
Encryption, row-level isolation, SSO, and the documentation InfoSec and procurement will ask for, ready before your first call with them.
Every vendor credential is encrypted at rest with a random IV per write. Keys are never stored in plaintext, ever.
Supabase RLS ensures no query can leak cross-organization data. Enforced at the database layer, not just the app.
SOC 2 Type I planned alongside the first Enterprise deal, Type II following in year two. Security questionnaire available on request.
Native SAML 2.0 via Clerk. Works with Okta, Azure AD, Google Workspace, and any SAML-compliant IdP.
Data Processing Agreement available for every enterprise customer. Signed before data access begins.
Every customer gets a named implementation contact. No ticket queue. We're on-call for go-live.
Wrap a single service or point your gateway at CtrlSpend, run a day of traffic, and we will walk your team through cost per customer, per agent, and per run on your own data.