SaaS COGS for AI products: what belongs and how to split it

What belongs in SaaS COGS once you sell AI, where inference goes, and a worked P&L showing a 78% gross margin falling to 56%.

Brandon Holt
November 27, 2026
9
min read
Summarize
SaaS COGS for AI products: what belongs and how to split it

SaaS COGS is what you spend to deliver the product to paying customers: hosting, production support, third-party software inside the product and, if you sell AI, the model API calls behind your AI features. SaaS Capital reports 80% to 85% gross margins on SaaS license revenue. ICONIQ's 2026 survey put AI products at 45% for 2025.

Inference is the cost line classic SaaS never carried. It grows with each customer's usage, and a small group of customers drives most of it. For the wider model that COGS feeds into, see our guide to AI unit economics.

What SaaS COGS includes and excludes

SaaS cost of goods sold, often reported as cost of revenue, covers the cost of running the service for customers who already pay. SaaS Capital's guidance lists four groups: hosting, the staff who keep production running, support and success staff focused on retention, and third-party software or data delivered inside the product.

The same guidance keeps sales commissions, product management, upsell-focused customer success and all other R&D out of COGS. It also says professional services should be reported apart from SaaS revenue and costs, so implementation work gets its own margin line.

CostWhere it goesReason
Production cloud hostingCOGSRuns the service
DevOps and SRE time on productionCOGSKeeps the service up
Support and retention-focused successCOGSServes current customers
Third-party software or data in the productCOGSDelivered to customers
Model API calls from customer-facing featuresCOGSDelivery cost of the feature
Payment processing feesYour policyPick COGS or G&A and stay consistent
Sales commissionsSales and marketingWins new revenue
Upsell-focused account managementSales and marketingExpands revenue
Product management and new featuresR&DBuilds the next version

Source: SaaS Capital's COGS guidance (October 2024) for the classic rows. The model API and payment rows show the treatment recommended here.

Why AI inference costs belong in COGS

A model API call made while a customer uses your product is a delivery cost, in the same family as a server. The customer's request triggers it, and the customer's usage scales it. If you book inference under R&D, your gross margin reads like classic SaaS while your cash tells a different story, and an investor doing diligence may move it back.

The same logic covers the services around the call. Embeddings, the vector database that serves them, and the monitoring you run on production prompts all exist to deliver the feature.

R&D experiments and evals

Calls your engineers make while building features, testing prompts or running evals belong in R&D. Give development its own API key, workspace or project. Anthropic's cost report groups by workspace and OpenAI's by project, so the provider does the split for you.

Internal employee AI use

Seats for ChatGPT, Claude or Copilot that your team uses to work are operating expenses, booked to the department that uses them. Support is the one case to think through: if your support team sits in COGS, the AI tools they use to answer customers can sit there too.

Free-tier and trial usage

Free-tier inference is the hardest call. It serves users who pay nothing, so some finance teams book it in sales and marketing as an acquisition cost. Keeping it in COGS shows the true cost of the product; moving it gives a cleaner margin on paid customers. Pick one, write it down, and report free-tier inference as its own line either way.

This isn't accounting advice. Confirm the treatment with your accountant before you close the books on it.

What a typical SaaS gross margin looks like in 2026

The most recent full-year data is for 2025. The Aleph and Benchmarkit 2026 report, published June 1, 2026, puts the median software gross margin at 80% across 228 to 232 companies. Total-revenue margin, with services included, was 76%.

BenchmarkPeriodGross margin
SaaS license revenue, SaaS Capital portfolio and surveyPublished 202480% to 85%
Median software gross margin (Aleph and Benchmarkit)FY202580%
Median total-revenue gross margin, services includedFY202576%
Bottom-quartile software gross marginFY202550%
Median for usage-only pricingFY202562%
Average AI product gross margin (ICONIQ)202545%
ICONIQ projection for AI products202653%

Source: SaaS Capital (October 2024), Aleph and Benchmarkit 2026 SaaS & AI Performance Benchmarks (FY2025 actuals), ICONIQ State of AI 2026.

Aleph notes that its report did not isolate AI-native products, and its median software margin held at 79% to 81% over four years. ICONIQ surveyed companies building AI products and found 45%, a gap of 35 points. A SaaS company adding AI features sits somewhere between the two, and the AI share of revenue decides where. The model providers' own margins are a separate question, covered in whether AI companies are profitable.

How adding AI features changes a SaaS P&L

Example. A SaaS product has 2,000 customers on a $49 monthly plan, or $98,000 in monthly revenue. The team ships document chat, summaries and autocomplete to every customer at the same price. The table shows the monthly P&L down to gross profit, before and after.

LineBefore AIAfter AI
Revenue (2,000 × $49)$98,000$98,000
Production hosting$7,000$7,000
Support and DevOps staff$9,000$9,000
Third-party software in the product$2,000$2,000
Payment processing$3,442$3,442
Model API calls$0$19,600
Vector database and embeddings$0$1,500
Production prompt monitoring$0$800
Total COGS$21,442$43,342
Gross profit$76,558$54,658
Gross margin78.1%55.8%

Example data. Monthly figures for an illustrative $49 SaaS product.

−22.3 pts
Gross margin change after adding AI at the same $49 price

Revenue stays flat and COGS doubles. Model API calls average $9.80 per customer, 20% of the price. One release takes the company from near the 80% median to within six points of the bottom quartile.

How to split AI COGS by customer, plan and feature

Total COGS reports an average, and an average of $9.80 can hide customers who cost ten times that. In the example, the same $19,600 of model calls splits across three usage groups. Other COGS ($23,742) is spread at an equal $11.87 per customer.

Usage groupCustomersAI cost per customerShare of AI costGross profit per customerGross margin
Light1,600$3.0024.5%$34.1369.7%
Regular340$25.0043.4%$12.1324.8%
Heavy60$105.0032.1%−$67.87−138.5%
All customers2,000$9.80100%$27.3355.8%

Example data. Revenue is $49 per customer in every group.

Sixty heavy customers, 3% of the base, cost more than they pay and remove $4,072 of gross profit each month. The other 1,940 customers run at 61.8% gross margin.

Four steps get you the split:

  1. Tag every model call at the call site with the billing customer ID (the Stripe customer, for example), the feature and the model.
  2. Price each call from its token counts at the provider's published rates, including cache reads and cache writes.
  3. Roll the cost up by customer, then by plan, then by feature.
  4. Allocate shared COGS such as hosting and support with one simple rule, per customer or per seat, and label the result as allocated.

By feature, the example's $19,600 breaks into document chat at $12,400, summaries at $4,200 and autocomplete at $3,000. That points the first cost work at document chat. By plan, compare what the typical customer on each plan costs with the plan's price. The full per-customer method, with annual plans and payment fees, is in our customer profitability analysis.

How to check the AI COGS line against the provider invoice

Your tracked AI cost and the provider's bill should agree within a small tolerance before the number goes into COGS. The provider's reports can't do the customer split, because they group cost by API key, workspace, project and model.

  1. Pull the provider's numbers for the same window. Anthropic's cost report needs an Admin API key and returns daily cost in USD. OpenAI's help center says to export Cost data grouped by line item, with dates set to the invoice service period in UTC.
  2. Compare the two by model and by day, so a gap points to a date and a model.
  3. Explain the gap. Common causes are calls from code you never tagged (scripts, internal tools, the Console playground), a stale price table, discounts or credits, and time zones. Anthropic's cost endpoint also leaves out Priority Tier, which uses a different billing model.
  4. Book the invoice amount, split between COGS and R&D by API key or project.

Example. Tracked model cost for the month is $19,240 and the invoices total $19,600. The $360 gap (1.8%) traces to an eval script on the production key ($310), which moves to R&D, and a missing cache-write rate in the price table ($50). OpenAI has also stopped printing detailed API costs on Enterprise invoices issued from April 1, 2026, so the export is now where the line-item detail lives.

Lancelot's Bill matching runs this check daily: it reads the OpenAI and Anthropic cost reports with an admin key, ties them to the cost Lancelot tracked, and explains any gap. Margin intelligence then splits the matched cost per customer, plan and feature.

Questions about SaaS COGS

Are AI API costs COGS or R&D?

Model API calls made to serve paying customers are COGS, because they are a direct cost of delivering the product. Calls made while building features, testing prompts or running evals are R&D. Use separate API keys or projects for development so the provider's cost report separates the two.

What is a good gross margin for a SaaS company?

About 80% on software revenue is the median. The Aleph and Benchmarkit 2026 report puts the FY2025 median software gross margin at 80% and total-revenue margin at 76%. SaaS Capital reports 80% to 85% on license revenue. AI products averaged 45% in 2025, according to ICONIQ.

Is cost of revenue the same as COGS for a SaaS company?

Yes, in practice. SaaS companies often label the line "cost of revenue" because they sell a service, but it holds the same costs: hosting, production support, third-party software in the product and, for AI products, model API calls. Gross margin is revenue minus that line, divided by revenue.

Should free-tier AI usage go in COGS?

Either treatment is defensible if you keep it the same from period to period. Keeping free-tier inference in COGS shows the full cost of the product; booking it in sales and marketing treats it as acquisition spend. Whichever you choose, report free-tier inference as its own line so you can see how fast it grows.

Do employee ChatGPT or Claude subscriptions count as COGS?

No, in most cases. Seats your team uses to do its own work are operating expenses, booked to the department that uses them. The exception is a team that already sits in COGS, such as support: AI tools they use to serve customers can follow them into COGS.

How do I allocate AI COGS to individual customers?

Tag each model call with the billing customer ID, feature and model when your code makes it, then price the call from its token counts. Sum by customer for AI cost per customer. Allocate shared costs such as hosting with one simple rule and label them as allocated.

Why doesn't my tracked AI cost match the OpenAI or Anthropic invoice?

The usual causes are untagged calls from scripts or internal tools, an outdated price table, credits or discounts, and time zone differences. Provider dashboards use UTC. On Anthropic, Priority Tier costs are missing from the cost endpoint. Compare by model and by day to find the gap.

COGS is one input. Contribution margin, payback and plan pricing all build on it, and our guide to AI unit economics shows how the pieces connect.

Keep reading

All dispatches →
Denial of wallet: how attackers run up your AI bill overnight
Running AI in production
/
8
min read

Denial of wallet: how attackers run up your AI bill overnight

Are AI companies profitable? What the reported margins show
AI unit economics
/
9
min read

Are AI companies profitable? What the reported margins show

Customer profitability analysis for AI products, step by step
AI unit economics
/
8
min read

Customer profitability analysis for AI products, step by step

SaaS COGS for AI products: what belongs and how to split it
AI unit economics
/
9
min read

SaaS COGS for AI products: what belongs and how to split it

Get the numbers when they change.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
New dispatches and model price changes. Unsubscribe anytime.