Series A legal AI assistant · B2B AI SaaS
A Series A legal AI assistant took gross margin from 48% to 66% and stopped a weekend loop at $8.
Contract review agents on flat $299 seats were burning half of revenue on Claude tokens. Per-tenant caps, a tool-thrashing breaker and Stripe overages fixed the economics inside one quarter.
- Revenue
- $58,600
- LLM spend
- $16,800
- Gross margin
- 65.9%
- Incidents > $500
- 0
($58,600 - $16,800 LLM - $3,200 other COGS) / $58,600 = 65.9%
+17.5 points vs baseline
$4,780 of Stripe overage revenue from nine bulk-review firms. Breaker tripped 11 times.
Gross margin
48.3% to 65.9%
Day 30: 64.5%
Monthly LLM spend
$24,600 to $16,800
down $7,800
Runaway incidents > $500
2 to 0
per month, baseline to Day 90
The challenge
The product reviews contracts with a multi-step agent: it splits a document into clauses, retrieves precedent, drafts a redline and checks it against the firm's playbook. Each review sends 80k to 150k input tokens to Claude Sonnet 4.5 because the playbook and precedent are re-sent on every step.
Pricing was a flat seat licence. Nine firms that ran bulk due-diligence reviews used more tokens than the next 120 firms combined, and nobody could see it until the monthly Anthropic invoice arrived as one number.
Twice in the quarter before onboarding, a document-parsing exception left the agent retrying the same retrieval tool against the same clause. The second incident ran from a Friday evening until someone checked the provider console on Sunday.
What was configured
The policy, as deployed.
- 01
Tenant attribution on day one
One base URL change plus X-PalmSouq-Tenant set to the firm ID. The first week of metering showed the nine bulk-review firms at 58% of all LLM spend.
- 02
Tool-thrashing breaker
Cyclical tool thrashing heuristic set to trip after 20 identical retrieval calls with matching arguments inside 5 minutes, returning HTTP 429 with X-PalmSouq-Reason: circuit_breaker_triggered to the agent runner.
- 03
Soft and hard caps per seat tier
A soft cap at 80% of a $60 per-seat monthly allowance posts a Slack alert to the account owner. The hard cap at 100% switches the firm to metered overage instead of blocking reviews.
- 04
Stripe overage sync
Usage above the allowance streams to a Stripe metered price at cost plus 35%, so heavy firms pay for their own volume on the next invoice.
tenant_policy "law-firm-seat" {
allowance_usd_per_seat = 60
soft_cap = 0.80 # Slack + in-app banner
hard_cap = 1.00 # switch to metered overage
overage = { sync = "stripe", markup = 0.35 }
}
breaker "retrieval-thrash" {
heuristic = "cyclical_tool_thrashing"
identical_calls = 20
window = "5m"
action = "halt" # HTTP 429, circuit_breaker_triggered
}- Cost per looping call
- 120k input x $3/M + 1.5k output x $15/M = $0.3825
- Loop rate observed in the trace
- 9 calls per minute
- Unattended window, Friday 19:00 to Sunday 00:00
- 29 hours = 15,660 calls
- Projected cost without a breaker
- 15,660 x $0.3825 = $5,990
- Actual cost with the breaker at 22 calls
- 22 x $0.3825 = $8.42
The breaker allows 20 identical calls; two more were in flight when it tripped. Prices are Claude Sonnet 4.5 list prices from the PALM SOUQ price table.
Results, snapshot by snapshot
| Revenue | LLM | GM | |
|---|---|---|---|
| Baseline | $53,820 | $24,600 | 48.3% |
| Day 30 | $53,820 | $15,900 | 64.5% |
| Day 90 | $58,600 | $16,800 | 65.9% |
Other COGS: Baseline $3,200, Day 30 $3,200, Day 90 $3,200. GM = (revenue - LLM - other COGS) / revenue.
“PALM SOUQ caught an infinite tool loop in our agent during our second week. It saved us roughly $6,000 on a single Saturday.”
What the team would tell you.
- Attribution came first. Nobody argued about caps once the per-firm cost table was on screen.
- Hard caps that convert to overage keep firms working, so sales never had to defend a lockout.
- The breaker threshold was tuned once, from 12 to 20 calls, after a legitimate 15-clause batch tripped it in week one.
More customer stories
Don't wait for a surprise $10,000 OpenAI invoice.
Route your agent traffic through PALM SOUQ in 2 minutes. Change one base URL, pass a tenant header, and every token is attributed and governed.
14-day free production trial · 100k requests included · no card required