AI unit economics · built for engineers

See the cost behind
every call.

CtrlSpend tags every AI call in your code, so cost and margin are finally per customer, per agent, per run.

See the SDK

Wraps OpenAI, Anthropic, and your LiteLLM gateway. No code rewrites, no added latency.

app/api/parse/route.ts
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,
  }),
)
becomes

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%

Weighted gross margin56%

Why request-level

Deep, accurate, and not your team’s problem.

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

  • Spend by provider, model, and API key
  • Spend by internal team or department
  • Accurate totals, straight from the bill
  • Cannot see the customer, agent, or request

Build it yourself

A ledger on your own gateway

  • Can reach the customer and agent dimensions
  • But the numbers drift from the provider bill
  • Metering loss, mispriced cache, dropped context
  • And it competes with your roadmap for eng time

CtrlSpend

Request-level, reconciled

  • Spend by customer, agent, project, and request
  • Reconciled to your provider bill
  • Joined to revenue for real gross margin
  • Maintained, without spending your eng team

How it works

Tag once. Attribute everything.

Two ways in, one data model. Instrument application code with the SDK, or point your existing gateway at CtrlSpend. Most teams do both.

01

Tag

Wrap your OpenAI or Anthropic client, or pass metadata through your LiteLLM gateway. Attach customer, agent, and project context in one place.

02

Attribute

Every call ships to CtrlSpend with its full tag context and cost. No per-call bookkeeping, no added latency in the request path.

03

Act

Read cost per customer, per agent, and per run. Catch reruns and retry loops. See which workloads to right-size, with the ROI attached.

SDK · TypeScript
import { withTags } from '@ctrlspend/node'

await withTags(
  { customer_id: 'acme-corp' },
  () => openai.chat.completions.create({ ... }),
)
Gateway · LiteLLM
litellm.success_callback = ["ctrlspend"]

litellm.completion(model, messages,
  metadata={ "customer_id": "acme-corp" })

The Platform

Everything downstream of the tag.

One attribution primitive powers every surface. Instrument once, and the cost, waste, right-sizing, and margin views all come from the same data.

Tagging SDK

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.

Gateway Native

Route through LiteLLM, Bifrost, or Portkey? One line of config captures every provider behind the gateway, with no SDK install in any service.

Bill Reconciliation

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.

Agent Run Economics

Cost per agent run, cost distribution, and expensive-run alerts. Prove which agents are efficient and which are burning margin on retries.

Rerun & Waste Detection

Identical prompt repetition, retry loops, and prompt bloat, all surfaced as dollars, not error counts. This is the waste your provider dashboard cannot flag.

Right-Sizing Recommendations

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."

Cost Guardrails

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.

Margin Contribution

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

You can’t specialize what you can’t attribute.

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.

Find the workloads worth specializing

Not every workload benefits from post-training. Attribution surfaces the volume, cost, and flat-frontier-improvement combo that actually justifies the engineering effort.

Model the ROI before you commit

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.

Insure against vendor lock-in

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

Engineering instruments it.
Finance reads it.

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.

Per-customer gross margin

Once calls carry customer context, CtrlSpend joins spend to revenue and reports gross margin for every customer, with no spreadsheet reconciliation.

At-risk revenue alerts

See which customers slipped below break-even and which margins are trending down month over month, before it shows up in the quarterly numbers.

Board-ready reporting

Export the margin picture your CFO takes to the board. The same tags engineering already set, turned into finance-grade numbers.

Integrations

Every provider,
and every gateway in front of them.

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

OpenAI
Anthropic

Shipping next

LiteLLMgateway
AWS Bedrockprovider
Azure OpenAIprovider
Google Vertex AIprovider
Reductovertical
Coherevertical
Voyagevertical
Mistralvertical

Enterprise-ready

Ready for your security review.

Encryption, row-level isolation, SSO, and the documentation InfoSec and procurement will ask for, ready before your first call with them.

AES-256-GCM encryption

Every vendor credential is encrypted at rest with a random IV per write. Keys are never stored in plaintext, ever.

Row-level security

Supabase RLS ensures no query can leak cross-organization data. Enforced at the database layer, not just the app.

SOC 2 in progress

SOC 2 Type I planned alongside the first Enterprise deal, Type II following in year two. Security questionnaire available on request.

SAML SSO

Native SAML 2.0 via Clerk. Works with Okta, Azure AD, Google Workspace, and any SAML-compliant IdP.

Custom DPA

Data Processing Agreement available for every enterprise customer. Signed before data access begins.

Named onboarding

Every customer gets a named implementation contact. No ticket queue. We're on-call for go-live.

Instrument one service.
See real numbers in a day.

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.