Mohamed Elsherifالعربية

COGS in SaaS Companies

If you run a SaaS company, there is one number on your financials more dangerous than revenue itself: cost of goods sold. Get it wrong and your gross margin — and your valuation — go with it.

  • Finance
  • Unit economics
  • AI

The number that can send your valuation to the sky or bury it in the ground.

If you are a SaaS founder, there is one line on your financial statements more dangerous than revenue itself. That line is COGS — cost of goods sold.

Why? Because a good investor looks at gross margin. If your COGS is wrong, your margin is wrong, and your company’s valuation can be cut in half.

In this article I will take COGS apart piece by piece, and share the accounting details that separate a $100k company from the $10M ones I know — especially if you are using AI.

1. What does COGS actually mean in SaaS?

Very simply: the money you must spend so that your existing customer can use the service today. Ask yourself this question: “If I stopped paying this bill this morning, would the service stop for the customer?”

If the answer is yes, that is COGS. If the answer is no — the service keeps running, we just cannot sell to new people or ship new features — that is operating expense (OpEx).

2. How do you calculate the cost of AI?

Most SaaS products now have AI features, and this is where everyone makes the same mistake. AI cost is not like ordinary servers. It is an open tap.

Token costs. If you are wired into OpenAI or Anthropic, every question your customer asks costs you money. That belongs in COGS. It is a direct cost of delivering the service.

A warning: if you have built an “unlimited AI” package, be careful. Your COGS can exceed the subscription price itself under heavy usage, and at that point your gross margin is negative.

Dedicated AI servers. If you are not using a ready-made API but running your own model on expensive GPU servers, that rent is COGS, plainly.

3. Salaries: who counts and who does not?

This is where most of the accounting mess happens. Not every employee is the same.

Customer support and onboarding: COGS. These people solve the customer’s problems so they can use the product they paid for. Salaries, insurance, laptops — all of it.

DevOps: COGS. The people making sure the servers are up and the system has not fallen over. They are essential to running the service.

Developers: not COGS. Developers build new features for the future. That is operating expense. The exception is a developer whose only job is bug maintenance on the current product; part of their time can sit in COGS, though it is usually simpler to leave them out.

4. Infrastructure and APIs

Any invoice that arrives so the system can run:

Hosting. AWS, Azure, Google Cloud. This is usually the largest COGS line.

Third-party APIs. Twilio for messaging, SendGrid for email, Google Maps inside your application. All direct costs, all COGS.

Payment fees. The 2.5% Stripe or your payment gateway takes. COGS.

5. The free-user problem. Where do I put them?

This is a professional move that can meaningfully change how your company looks to an investor.

If you have a free tier to pull customers in:

The old school puts their server and support cost in COGS.

The new school treats the cost of free users as a marketing expense, not COGS. Why? Because you are spending that money to acquire them in the hope they convert to paid. Taking their cost out of COGS raises your gross margin and makes your numbers look considerably cleaner.

But you must be transparent and disclose it in a note to the investor.

6. Why does every cent in COGS matter in the millions?

Investors like SaaS companies with gross margins above 70% or 80%. High COGS means your product is expensive to run, and that makes scaling hard.

Company A sells $1M with COGS of $200k — an 80% margin. Company B sells $1M with COGS of $500k — a 50% margin.

In summary

  1. Clean up your accounts. Separate support salaries from sales from developers.

  2. Watch the AI bill. If you use AI, monitor token consumption by the minute, and cache repeated answers to save money.

  3. Review the APIs. Look at your external service invoices periodically. If one is taking too much, find a cheaper alternative or build it in-house.

  4. Separate the free users. Move their cost into marketing to lift your gross margin.

First published on LinkedIn

All writing