AS | Ankit Sarawagi|Founder, CFOmatrix·July 2026·10 min read | Margin deep-dive |
- COGS leaks hide in delivery. Compute, model APIs, vector databases, data pipelines, third-party tools in the product, payment processing and delivery support all belong in cost of services, and each is easy to leave out.
- Put all direct cost in COGS, and segregate R&D. A product company builds the product and runs production at once; mixing R&D into cost of services (or the reverse) makes gross margin fiction.
- AI costs hide because they are per-customer and variable. A single account can quietly turn loss-making while blended margin still looks fine. Meter and tag compute per customer.
- Opex leaks are just as real. Tool sprawl, forex on USD revenue, discounts, dunning and refunds all shave margin without ever showing up as a headline cost.
- You cannot fix what you cannot see. A per-customer margin view is how the leaks surface.
| 2 Buckets leaks hide in: COGS and opex | Per-customer The lens that surfaces AI SaaS margin leaks | R&D The cost most often blurred into COGS |
| 1. Why hidden costs kill the story 2. The COGS leaks 3. The R&D-vs-COGS blur | 4. The opex and margin leaks 5. Where margin quietly goes 6. How to find your leaks |
01Why Hidden Costs Kill the Story, Not Just the Margin
Gross margin is the number investors anchor on, so a margin that is quietly overstated is not a rounding error, it is a story that falls apart in diligence. The hidden costs killing your SaaS margins are rarely dramatic. They are the lines a founder leaves out of the model because each one feels too small to matter: a model API bill here, a payment fee there, a SaaS subscription three teams share. Add them up across a year and they are the difference between a gross margin that reads healthy and one that is honest.
For AI SaaS the risk is sharper, because so much of the cost is variable and per-customer. This post walks the leaks in two groups: the COGS leaks that make delivery cost more than you think, and the opex and margin leaks that erode the bottom line without ever appearing as a headline cost. It builds on the gross-margin discipline in the SaaS finance pillar guide.
02The COGS Leaks: What Delivery Really Costs
Cost of services should capture everything directly needed to deliver the product to a paying customer. When founders build COGS from memory, they tend to count the cloud bill and stop. The leaks are the lines below the cloud bill.
- Compute: model APIs, own models, inference
- Vector databases and data stores
- Data pipelines and orchestration
- Third-party tools embedded in the product
- Payment processing fees
- Customer-success and support that delivers
- SaaS tool sprawl across teams
- Forex loss on USD revenue to rupees
- Discounts and price concessions
- Dunning: failed-payment leakage
- Refunds and credits
- R&D cost blurred into cost of services
Two of these deserve special attention for AI SaaS. Compute is not one line, it is several vendors: the model API, the vector database, the pipeline that feeds it and the orchestration that ties them together, each billed separately and each moving with usage. And payment processing quietly takes a slice of every transaction, which matters more as self-serve volume grows. For the full treatment of what belongs in delivery cost, see SaaS gross margin and cloud COGS.
A blended gross margin hides the leaks. The moment you compute margin per customer, the loss-making accounts, the heavy-compute users and the forex-hit contracts all stand out on their own line. Set up metering and per-customer cost tags early, and the hidden costs stop being hidden. This is the single most useful move to protect an AI SaaS margin. See per-customer gross margin.
03The R&D-vs-COGS Blur
This is the leak that hurts most, because it works in both directions. A product company is building the product and running production at the same time, often with the same engineers. If production support and delivery time get parked in R&D, gross margin looks better than it is. If R&D gets parked in cost of services, gross margin looks worse than it is. Either way the number investors anchor on is fiction.
“You have to put all the direct cost into COGS: the customer success and support that delivers the service, all the compute, your models, your databases, your pipelines, every third-party provider tied to delivery. And you have to segregate R&D from cost of services, because a product company is building tools and running production at the same time. Get that split wrong and your gross margin is not real.”
Ankit Sarawagi, from working across SaaS and AI SaaS startupsThe fix is not complicated: draw a clear line between the work that delivers today’s service (COGS) and the work that builds tomorrow’s product (R&D, which is opex), and apply it consistently. Time-splitting shared engineers by activity is enough for most early companies. The point is to do it deliberately, not to let the accounting default decide your headline margin for you.
04The Opex and Margin Leaks
Below the gross-margin line sits a second set of leaks that never overstate gross margin but quietly erode the bottom line. They are easy to miss because none of them arrives as a single big invoice.
If a meaningful share of revenue is billed in USD, treat the conversion rate as a number to manage. Negotiate the bank spread, track realised versus quoted rates, and model margin per geography, since employment, rent and data-center costs also differ by region. A point of forex is a point of margin.
05Where Margin Quietly Goes
To make the leaks concrete, here is an illustrative view of how a rupee of AI SaaS revenue can drain before it reaches operating margin. The exact split varies by business, but the shape is typical: a chunk to compute, then a long tail of small leaks that most models ignore.
The headline compute cost is the one founders remember. The long tail below it, delivery support, payment fees, forex, tool sprawl and revenue leakage, is where the gap between reported and real margin opens up. None of it is exotic; all of it is easy to miss.
06How to Find Your Leaks: A Checklist
Finding the leaks is a methodical walk down the P&L with a per-customer lens. Run this checklist quarterly, or before any raise.
Do this once with discipline and it becomes part of the monthly close rather than a fire drill before a raise. The SaaS P&L template lays out the line items so nothing gets left off, and the pillar guide puts it all in the context of the wider finance function.
“Hidden costs are not hidden because they are complicated. They are hidden because nobody put them on one page, per customer. Do that, and they stop being hidden.”
Ankit Sarawagi, CFOmatrix
|
FAQFrequently Asked Questions
What costs do founders miss in SaaS?
They split into two buckets. Hidden COGS: compute and model APIs, vector databases, data pipelines, other software embedded in your product, payment processing, and the customer-success or support that delivers the service. Hidden opex and margin leaks: SaaS tool sprawl, forex loss on USD revenue converted to rupees, discounts and dunning leakage, refunds, and R&D cost sitting inside cost of services. Left out, each makes gross margin look better than it is.
What belongs in COGS versus opex for a SaaS company?
COGS is everything directly needed to deliver the product: all compute (models, cloud, databases, pipelines), third-party model APIs and providers tied to delivery, payment processing, and enterprise customer-success and support. Opex is everything else: sales and marketing, general and administrative, and R&D. The key discipline is to segregate R&D from cost of services, because you build the product and run production at once, and mixing them makes gross margin fiction.
How do AI and model costs hide in a SaaS P&L?
Because they are variable and spread across vendors. One customer request can trigger a model API call, a vector-database lookup, a pipeline run and orchestration compute, each billed by a different provider and each moving with usage. Billed per request rather than as a fixed line, a heavy-usage customer can quietly turn loss-making while blended margin still looks healthy. The fix is per-customer metering and cost tags from day one.
How do I find margin leaks in my SaaS business?
Walk down the P&L with a per-customer lens. Rebuild a clean COGS that captures all compute, model APIs, third-party tools in the product, payment fees and delivery support, and pull R&D out. Meter usage and tag cost per customer to compute margin per account. Audit opex for tool sprawl, forex loss, discount and dunning leakage, and refunds. The leaks show up as accounts or lines where the true cost to serve is far above the blended average.
Does foreign exchange matter to SaaS margins?
Yes. If you bill in US dollars but pay salaries, rent and costs in rupees, the conversion rate, bank spread and remittance fees sit between billed and banked revenue. A poor rate or wide spread quietly shaves a point or two off net margin every month and never appears as a cost line unless you look for it. It is a real margin leak worth managing: negotiate rates and track realised versus quoted conversion.
How much can hidden costs cost me?
There is no single number, but enough to change the story your P&L tells. Misclassifying delivery support or R&D out of COGS can overstate gross margin by several points. For AI SaaS, un-metered compute on heavy accounts can turn a headline 65 percent plus margin into far less on specific customers. Add tool sprawl, forex, dunning and refunds, and the gap between reported and true margin can decide whether you pass diligence. You cannot defend a margin you have not measured honestly.
This is general educational information for founders, current to mid-2026, drawing on the author’s experience across SaaS and AI SaaS startups, and is not legal, tax or investment advice. The cost splits shown are illustrative to explain structure, not benchmarks, and vary by stage and business model. Verify the current position or consult a professional before acting on a specific matter.
AS | Founder, CFOmatrix | Finance Strategy & Equity Compliance CFOmatrix is a knowledge platform focused on how finance actually works inside growing companies. This guide draws on hands-on experience across SaaS and AI SaaS startups, from rebuilding COGS and per-customer margin to pricing, structure and the finance function. |