On watch
The AI margin agent

Know what everycustomer costsyou in AI.

Lancelot tracks AI cost per customer against Stripe revenue, finds the customers losing you money, and fixes them.

Install
Margin
Agent
Example
$ npm i @lancelotwatch/node
+ @lancelotwatch/node 0.3.0
const openai = lc.wrapOpenAI(client, {
  customerId: user.id,
});
✓ First call received
  acct_7Hq2 · claude-haiku-5-5 · $0.0021
Margin after AI costs
80%
Customer
Pays
AI cost
Margin
Birchline
$399
$48
88%
Corvid Labs
$399
$136
66%
Acme Co
$99
$311
−$212
Auto · by Lancelot
2:14 a.m.
Stopped a runaway loop
412 identical calls in 10 min. Limited to 5 a minute.
Prevented ≈ $38
Undo anytime
The problem
Works with
01
The problem

Your customers pay a flat fee. You pay OpenAI and Anthropic for every call. Neither bill tells you which customers cost more than they pay.

Two bills thatnever meet.

One invoice. One payout. From here, all 412 customers look the same.

Lancelot joins cost to revenue, customer by customer.

The blended number looked fine. These 38 were underwater the whole time.

TOKEN USAGE · Invoice
$6,240
One total. No customers.
Stripe · Payout
$31,200
One total. No costs.
Blended margin
80%
Looks healthy.
38
of 412 customers
cost more than they pay
← Pays least
Each bar is one customer’s margin
Pays most →
Two totals
Joined per customer
Who’s underwater
02
How Lancelot works

Lancelot finds unprofitable customers and fixes them.

01
Watch

Every AI call, tagged by customer and feature, matched to what they pay.

Margin intelligence →
02
Detect

Underwater customers, runaway loops, cost spikes and free-tier farming.

Runtime protection →
03
Diagnose

Lancelot works out why. Rules decide what’s allowed.

The Agent →
04
Act

Offer an upgrade, cap the spend, switch to a cheaper model or stop the loop.

Plan economics →
05
Learn

Undo something once and it remembers next time.

Autonomy →
Margins · last 30 days
Customer
Plan
Pays
AI cost
Margin
Birchline
Pro
$399
$48
88%
Delta Nine
Pro
$399
$64
84%
Corvid Labs
Pro
$399
$136
66%
Eastfield
Starter
$99
$71
28%
Acme Co
Starter
$99
$311
−$212
Needs attention · 4
Underwater customer
Acme Co costs $311, pays $99. Third week running.
High
Runaway loop
acct_7Hq2 made 412 identical calls in 10 minutes.
High
Cost spike
Corvid Labs is up 6.4× on last week.
Medium
Free-tier farming
14 new free accounts share one device.
Low
How Lancelot decided · Acme Co
Signal
AI cost $311 against $99 paid. Underwater three weeks running.
Cause
71% of the cost is research-agent on claude-sonnet-5-5. Steady use, not a loop.
Rules
Upgrade offers allowed. Throttling a paying customer is not.
Decision
Offer the Pro plan. On Pro, Acme Co makes you $88 a month.
Action · Acme Co
Ask · approved by you
Upgrade offer drafted
Pro, $399 a month, with your own Stripe Payment Link. You send it.
+$300 a month if accepted
Copy message
Cap the spend
Ready
Switch to a cheaper model
Ready
Stop the loop
Ready
Memory
You undid this.Lancelot will remember.
Don’t throttle customers on annual plans.
From an undo
Ask before any offer to Birchline.
From an undo
Haiku is fine for summaries.
From an approval
03
Autonomy

You decide how much it does alone.

Suggest
Every plan
It tells you what it would do.
Ask
Founder and up
One click to approve, in Slack or email.
Auto
Growth and up
It acts within limits you can see.
# margins
Lancelot
App
9:02 a.m.
Acme Co is losing $212 a month. Draft a Pro plan offer?
Approve
Why?
Undo anything
Daily caps on every action
Every decision explained
04
Platform

One agent for AI cost, margin and spend.

Margin intelligence

Profit per customer, plan, feature and model.

chat
82%
search
64%
summaries
71%
research-agent
−12%
→

Runtime protection

Emergency stop, per-customer budgets, loop and abuse detection, enforced in your app.

600
calls a minute
$50
in 5 minutes
5 min
cooldown
Defaults
→

Plan economics

Learns what each plan should cost and flags the thin ones.

Starter · cost per customer
ceiling $38
now $49
→

Bill matching

Checks your real OpenAI and Anthropic bill against what we tracked.

97%
of the bill accounted for
→

Alerts and the Monday briefing

Seven channels, with Approve and Undo in the message.

Slack
Email
Telegram
Discord
Teams
SMS
Webhooks
→

SDK and API

Zero dependencies. Fails open. Streams.

const lc = lancelot();
lc.wrapOpenAI(client, {
  customerId: user.id,
});
→
05
Trust

Safe with your bill, your data and your app.

Reads Stripe, never writes.

No way to charge, refund or move money.

Token counts, never prompts.

We store usage, not content.

No proxy.

Your calls go straight to the provider.

Fails open.

If Lancelot is down, your app keeps working.

Undo anything.

Every action the agent takes can be reversed.

Erase any customer.

One API call clears their name, email and ID.

06
Questions

Questions about Lancelot

AI margin is what a customer pays you (monthly or yearly) minus what they cost you in AI model usage. Lancelot tracks it per customer, plan and feature and model, so you can see who is profitable after AI cost.

Your app tags each AI call with a customer ID through the SDK. Lancelot prices the tokens at the model's current rates, adds them up per customer and subtracts the total from what that customer paid you. That's their AI margin.

No. The SDK sends token counts, model, customer and feature tags. Never the content.

Your app keeps working. The SDK fails open, and calls go straight to the provider, never through us.

No. Lancelot drafts upgrade and top-up offers with your own Stripe Payment Link, and you decide whether to send them.

The SDK wraps the OpenAI and Anthropic clients in Node and Python. Other providers send usage over the API, and Lancelot imports calls from OpenRouter, Helicone and OpenTelemetry.

They trace calls for debugging. Lancelot joins cost to revenue per customer and acts on margin. Many teams use both.

A restricted key with read access to customers, subscriptions and invoices. Lancelot rejects full secret keys and never calls a Stripe write endpoint.

Plans start at $49 a month, with a 7-day trial on every plan. Pricing scales with the AI spend Lancelot tracks, not with seats or customers.

It learns ceilings from your own customers’ usage and revenue. You don’t set budgets for it.

Yes. One API call, or a button in Settings, replaces their ID with a pseudonym and clears their name and email. Totals stay, so your margins don't move.