Writing
Blog
Long-form on AI cost tracking, the math of LLM bills, and how to keep an AI SaaS profitable. New posts ship as they get written.
The Complete 2026 Guide to AI Cost and Margin for SaaS
The full playbook, start to finish: measure cost per user, price against variable cost, reduce spend, and cap the worst case. Each step links to a deep-dive. Start here.
Read the guide
Getting started
Where the money goes, how cost per user works, and the first things to measure.
Bill emergency
Jul 20, 2026
My API Bill Is Too High. What to Do Right Now
You just saw a scary number. A calm triage to find the worst offender fast, the three quickest fixes, and how to make sure it never ambushes you again.
Prevention
Jul 20, 2026
How to Never Get Surprised by an AI Bill Again
You fixed one bill shock and never want another. The four habits that stop surprise AI bills before they form, three of which you can automate.
Cost calculator
Jul 18, 2026
Claude API Cost Calculator and Formula
The exact formula to turn Claude token counts into dollars, worked on Haiku, Sonnet, and Opus with real numbers, plus how to estimate your monthly Anthropic bill.
Usage tracking
Jul 18, 2026
How to Track Claude API Usage Per User
The Anthropic usage API reports organization totals, not per customer. Read the usage object on every Claude response and attribute cost to your own user ids, with Python and TypeScript examples.
Cost attribution
Jul 2, 2026
How to Get OpenAI API Cost Per User (Not Just Total Bill)
OpenAI only shows account-level totals. It has no idea who your users are. Here is how to attribute cost to each user, tag calls with a userId, and turn the total bill into a per-user breakdown.
Getting started
Jul 1, 2026
What Adding AI to Your App Actually Costs, by Feature Type
Transforms run cents per user, chat runs $1 to $15 because context compounds, agents vary 100x between users. Real numbers with the math shown, and the four levers that keep a shipped feature affordable.
Cost basics
Jul 1, 2026
What a Chatbot Really Costs: the Conversation Compounding Math
Every turn resends the whole conversation, so a 20 turn chat costs ten times a 5 turn one, not four. The formula, realistic per user ranges, and why your most engaged users are your least profitable.
Cost basics
Jul 1, 2026
Prompt Caching Economics: the 90% Discount With a 25% Trap
Cache reads cost a tenth of fresh input, but Anthropic charges 1.25x to write. The break even math, the stable prefix rule, and the silent way one prompt edit turns savings into a surcharge.
Cost basics
Jul 1, 2026
Tokens to Dollars: the Cheat Sheet for LLM Cost Arithmetic
Per token, per 1K, and per million conventions cause 1000x errors, and output priced at input rates is the other classic. The complete formula with cache rates and worked examples.
Getting started
Jul 1, 2026
AI API Free Tiers: What Is Actually Free in 2026
Gemini has a real free tier, Anthropic has none, OpenAI runs on occasional credits. Why the question matters less than it did: a complete prototype phase costs single digit dollars on current budget models.
Cost basics
Jul 1, 2026
Track LLM Cost Per Prompt Version, Because Rewrites Change the Bill
Prompt edits move output length 20 to 50 percent, and output is the expensive token class. One version tag turns iteration into an experiment: cost per version, quality per dollar, and rewrites that get decided on purpose.
Cost basics
Jul 1, 2026
How to Estimate an AI Feature’s Cost Before You Ship It
Five numbers, one formula, and a worked example that lands at $0.49 per user per month. Plus the three honesty rules: never one number, respect output prices, and account for caching before the invoice does it for you.
Cost tracking
Jun 29, 2026
How to Track AI Costs Per User (And Why the OpenAI Total Lies to You)
Your OpenAI bill came in at $4,200 this month. That single number tells you almost nothing. Here is how to track per-user cost, why the manual approach breaks at scale, and the two-line wrapper that automates it.
Margins and pricing
Unit economics, plan design, spending caps, and the heavy tail that breaks flat pricing.
Margin
Jul 20, 2026
When One User Costs More Than They Pay
On a flat plan one power user can cost more in tokens than they pay you. How to check right now, and the three sane things to do when you find one.
Spending caps
Jul 20, 2026
Per User Spending Caps for LLMs
Account level limits do not stop one user draining your margin. Why caps belong at the user level, how to build one, and when to block versus downgrade.
Unit economics
Jul 20, 2026
LLM Unit Economics for AI SaaS
AI inference cost breaks the classic SaaS unit economics model. Build a real per user model for one AI feature, and see why the average lies.
Cost reduction
Jul 18, 2026
Claude API Cost Optimization, 6 Real Levers
Six ranked levers to cut your Claude API bill: right model per task, prompt caching, leaner system prompts, capped output, the Batch API, and per user caps. With the savings math.
Spending caps
Jul 2, 2026
How to Set Spending Caps on LLM API Calls Per User
Flat subscription, variable per-token cost. Set a monthly cap per user so heavy users do not blow your budget: block the call or silently downgrade to a cheaper model. The naive approach, its failure modes, and the fix.
Unit economics
Jul 2, 2026
How to Calculate Gross Margin Per User for AI SaaS Products
Margin per user equals plan revenue minus AI cost. Here is the formula, how to calculate it manually from usage logs, why it breaks at scale, and how to see it live per user without the spreadsheet.
Model selection
Jul 2, 2026
GPT-5 vs GPT-4o-mini for Your SaaS in 2026
GPT-4o-mini is often 10x cheaper than GPT-5. Here are the real 2026 prices, what mini is genuinely good enough for, when GPT-5 earns its cost, and how to route each feature to the right model automatically.
Pricing
Jul 2, 2026
Why Flat Subscription Pricing Breaks for AI SaaS in 2026
Traditional SaaS runs 80-90% gross margin. AI-first products sit near 52%. Fixed revenue against variable per-token cost is why flat plans break, and the three fixes that actually hold your margin.
AI cost strategy
Jul 2, 2026
What Uber and Microsoft Learned About AI Costs the Hard Way
Uber burned its entire 2026 AI budget in four months. Microsoft cancelled Claude Code for thousands of engineers. Same mistake, and the lesson for any SaaS reselling AI on a flat plan.
Margins
Jul 1, 2026
3 Signs Your AI Feature Has a Margin Problem
The bill growing faster than users, unexplained step changes, and a one minute test: can you name your five most expensive users? Score yourself, and what each miss means.
Margins
Jul 1, 2026
GPT Wrapper Economics: Software Margins With a Tail Risk Attached
A $19 plan over a dollar of tokens is a software margin. The money is lost in three places: the heavy tail on flat plans, chat shaped features, and provider repricing. All three visible in one measurement.
Pricing
Jul 1, 2026
AI Credits Done Right: an Exchange Rate, Not a Guess
Credits work when actions map to measured cost and rot when the mapping is set once from guesses. Pricing the credit, handling rollover liability, and why a dollar cap still backs the ledger.
Pricing
Jul 1, 2026
A Free AI Tier That Converts Without Bleeding
Every free action has a marginal cost, so design the free tier like an acquisition budget: quota from the p95 user, a budget model, and a hard per user cap for the bots and loops that always come.
Pricing
Jul 1, 2026
How the AI Providers Bill Per Token, and How to Do It Yourself
A meter, a price sheet, and an aggregator: the provider billing machine, rebuilt for your product. Credits versus actions versus raw tokens, Stripe on rails, and the three failure modes.
B2B
Jul 1, 2026
AI Cost Per Tenant: Allocation and Chargeback for B2B SaaS
Tenants share your API key, so per account cost only exists if you record it. The composite tag pattern, what the numbers unlock at renewal time, and caps at the account grain.
Routing
Jul 1, 2026
LLM Fallback Routing: Stay Up When a Model Goes Down
Same provider sibling first, cross provider second, never fall back on your own bad requests. The chain is ten lines of code; the real work is choosing it, testing prompts on backups, and instrumenting what fallback windows cost.
Margins
Jul 1, 2026
Is Your Unlimited AI Plan Profitable? Do the Heavy Tail Math
A $49 unlimited plan keeps 71 percent margin on the typical user and loses $23 a month on the heavy one, and the average hides it. The break even call count, why unlimited selects for its own worst case, and the fix ladder.
Cost reduction
Jun 29, 2026
How to Reduce OpenAI Costs Without Breaking Your Product
Microsoft cut Claude Code for 100k engineers. Uber burned their 2026 AI budget in 4 months. Three real causes of a runaway OpenAI bill, and three fixes that do not degrade output quality.
Unit economics
Jun 29, 2026
Why Power Users Hurt Your AI SaaS Margins
Traditional SaaS runs at 80-90% gross margin. AI SaaS is structurally closer to 50-60%. Why power users hurt you, how to calculate margin per user, and what healthy AI SaaS margins actually look like.
Providers and models
OpenAI, Anthropic, Gemini and Kimi: billing, limits, price history and real task cost.
Provider costs
Jul 22, 2026
Kimi vs Claude vs GPT-5 Cost Compared
Kimi K2.6 undercuts GPT-5 and Claude Sonnet on both input and output. The real price table, where Kimi is genuinely good, the jurisdiction question, and how to track cost per user across every provider.
OpenAI cost
Jul 20, 2026
Why Is My OpenAI Bill So High?
The five most common reasons an OpenAI bill blows up, ranked by how often they are the culprit, plus a fast way to tell which one is yours.
Model cost
Jul 20, 2026
Model Downgrade on a Budget
When a user hits their cap, downgrade the model instead of blocking. A real cost comparison, when it fits, and how to automate the swap with no code.
Model cost
Jul 20, 2026
Model Routing for LLMs
Send each request to the cheapest model that can handle it. Three routing strategies, a real architecture, and why most teams over or under build it.
Claude billing
Jul 18, 2026
Anthropic Billing Explained
How the Claude API charges you: per token, input versus output, per model, with real 2026 prices. What the Anthropic console shows, what it hides, and how to get cost per user.
Provider costs
Jul 18, 2026
Anthropic vs OpenAI Billing Compared
Anthropic and OpenAI both bill per token, but the rates, usage fields, caching, and batch discounts differ. A side by side comparison and which one wins for which workload.
Benchmark
Jul 8, 2026
The Real Cost Per User of an AI Feature in 2026
How much does one AI user actually cost you per month? A transparent benchmark modeled from public 2026 pricing across three usage profiles, with the margin math against a $29 plan.
Provider costs
Jul 8, 2026
How to Track Claude API Costs Per User
The Anthropic console only shows an account total. How to get Claude cost per user from the usage object, with 2026 Claude pricing and the per-user margin math.
Provider costs
Jul 2, 2026
DeepSeek vs OpenAI vs Gemini API Costs Compared in 2026
The spread from cheapest to frontier models is more than 200x on input tokens. The real 2026 price table, why output tokens dominate, and how to compare providers on your actual usage instead of a spec sheet.
Comparisons
Jul 1, 2026
Helicone Alternative: When You Need Margins, Not Just Observability
Helicone is strong at logging and debugging LLM calls. Weckr answers a different question: which customers are unprofitable, and what enforces the budget. An honest comparison, including when to run both.
Comparisons
Jul 1, 2026
Langfuse Alternative for Cost Per User and Margin Tracking
Langfuse is an LLM engineering platform: traces, evals, prompt management. Weckr is a margin layer: cost joined to revenue per user, with caps. Choose by which problem hurts first.
Guides
Jul 1, 2026
OpenAI Budget Alerts: the Org Level Backstop and the Per User Layer
OpenAI budgets are one number for your whole org: they protect your card, not your margins, and a tripped limit stops every customer at once. How to layer per user alerts and caps under them.
Guides
Jul 1, 2026
Anthropic Spend Limits, and the Per User Layer the Ceiling Cannot Give You
Anthropic bounds spend at the account level: tiers and console limits. Useful backstop, wrong granularity: risk arrives one user at a time. Per user caps for Claude, with Opus stepping down to Sonnet.
Guides
Jul 1, 2026
LLM Cost Spike Detection: Catch It in Minutes, Not on the Invoice
Four spike patterns: loops, abuse, model misconfiguration, prompt growth. Why per user velocity windows catch them while aggregates hide them, and what should happen automatically when one fires.
OpenAI
Jul 1, 2026
The OpenAI Usage and Costs APIs, and What They Still Cannot Tell You
Admin keys, minute level token buckets, daily cost buckets, and grouping by project, key, model, and user field. The right source for what OpenAI bills you, and the margin question it cannot answer.
Anthropic
Jul 1, 2026
Claude Batch API Pricing: Half Price for Work Nobody Is Waiting On
Async processing within 24 hours cuts both input and output rates 50 percent. What belongs in a batch, how the discount stacks with caching, and the tracking wrinkle that overstates spend 2x if missed.
Anthropic
Jul 1, 2026
Anthropic Rate Limits: Three Meters, One Minute, and the User Eating It
RPM, input tokens, and output tokens are limited separately, and 429 debugging usually ends at one account consuming the minute. The tier system, the cache loophole, and the per user truth.
Gemini
Jul 1, 2026
Gemini API Cost Per User: What Google Cloud Billing Cannot Tell You
AI Studio or Vertex, the reporting stops at projects and labels. The usageMetadata capture pattern, Gemini specific pricing dimensions, and one margin view across all your providers.
Anthropic
Jul 1, 2026
The Anthropic Admin API Cost Report, and the Gap It Leaves
Anthropic ships usage and cost report endpoints behind an admin key: bucketed, groupable by model, workspace, and key. The right source for what you owe, structurally unable to say which of your customers caused it. How to use both halves.
Anthropic
Jul 1, 2026
Anthropic Console Billing, Explained: Views, Gaps, Fixes
Spend graphs, cache splits, credits, invoices: what each console view is for, the reconciliation checklist for surprising numbers, and the two structural blind spots the console cannot close from its side of the API key.
Pricing data
Jul 1, 2026
LLM Price History: What Got Cheaper, and What Quietly Did Not
Flagships fell an order of magnitude since GPT-4; budget tiers wobbled and sometimes rose. The verified 2026 moves including the 80 percent Luna cut, the longer arc, and why changes arrive as steps that break hardcoded tables.
Pricing news
Jul 1, 2026
OpenAI Cut GPT-5.6 Terra and Luna Prices. Is Your Cost Math Still Right?
Luna fell 80 percent to $0.20 and $1.20 per million on July 30, 2026, making it the cheapest current OpenAI model on output. The new numbers, who should re-route, and why every hardcoded price table now overstates Luna cost five times.
Pricing data
Jul 1, 2026
A Free Live JSON Feed of LLM Prices
Per token prices for OpenAI, Anthropic, Gemini, and Kimi as one GET request, generated from the table Weckr bills with and watched weekly for provider changes. Schema, code samples, and the honest caveats.
Building
Integration patterns, frameworks, agents, streaming, security and reliability.
Agent cost
Jul 20, 2026
Your AI Agent Is Burning Through Your Budget
Autonomous agents can fire hundreds of calls in minutes. The real cost per minute, a circuit breaker you can paste in tonight, and the automated version.
Agent cost
Jul 20, 2026
AI Agent Cost Control
Even a healthy agent fires many calls per task. Track cost per run, budget per task, alert before you kill, and how it complements loop detection.
Vercel AI SDK
Jul 8, 2026
How to Track AI Costs Per User with the Vercel AI SDK
The Vercel AI SDK gives you token usage but not per-user cost or margin. How to capture usage from generateText and streamText (including the streaming gotcha) and attribute it to a userId.
Agent loops
Jul 2, 2026
How to Detect and Stop AI Agent Reasoning Loops
A runaway agent can burn $100 in minutes. Here is what a reasoning loop is, why it is financially dangerous, how to detect it with token velocity, and how to get a Slack alert before it costs you thousands.
Agentic AI
Jul 2, 2026
How to Build Profitable AI Agents Without Runaway Costs
One agent task fans out into dozens of model calls, so cost per run is variable and spikes fast. How to track cost per agent run, budget each task, route sub-steps to cheaper models, and cap the outliers.
Building
Jul 1, 2026
Build vs Buy for LLM Cost Tracking: the Weekend v1 and the Tail
The first version is genuinely a weekend. The tail is price table rot, cache math, the revenue join, and enforcement. What building really commits you to, and the legitimate cases for doing it anyway.
Building
Jul 1, 2026
LLM Cost Tracking Per User in Next.js, the Clean Pattern
Wrap the provider call in your route handler where the session already lives: singleton client, two lines, flush() before returning in serverless. Streaming and Edge notes, plus an MIT starter with it wired.
Building
Jul 1, 2026
LLM Cost Tracking Per User in FastAPI, the Clean Pattern
Module level client, wk.chat in the endpoint with the authenticated user from your dependency, snake_case params. Zero added dependencies, and an MIT starter with a Claude endpoint wired.
Building
Jul 1, 2026
LangChain Cost Per User: Wrap the Client, Not the Framework
Skip callback plumbing: wrap the underlying client at the boundary you own. Every chain step logs per user, agents feed loop detection, caps hold mid chain, and it survives framework internals changing.
Building
Jul 1, 2026
CrewAI Cost Tracking: Price Every Agent Turn, Per User
Crews multiply calls invisibly: agents, turns, resent context. Route round trips through the wrapped client and each turn logs individually, with velocity alerts for the stuck crew and caps bounding the damage.
Building
Jul 1, 2026
Kimi API Cost Per User: Cheap Tokens Still Need a Meter
Kimi is OpenAI compatible, so tracking is the same two lines with Moonshot’s base URL. k2.6 at $0.95/$4 per million, cached rates included, caps stepping down k3 to k2.6 to k2.5.
Building
Jul 1, 2026
Don’t Call OpenAI From Your Frontend: the Proxy Pattern Every AI App Needs
A key shipped to a browser is a leaked key. The twenty line backend proxy that fixes it, why the latency argument does not survive the numbers, and why that proxy is also where per user limits and cost tracking belong.
Building
Jul 1, 2026
One API Key, Thousands of Users: the Architecture That Follows
The provider sees one customer: you. Attribution, cost, limits, and runaway control transfer silently to your code the day you ship the standard architecture. The four problems and the call shape that solves them.
Building
Jul 1, 2026
Streaming LLM Responses: Two Cost Gotchas Nobody Warns You About
OpenAI streams report zero usage unless you set include_usage, so naive tracking records nothing for streamed traffic. And abandoned generations still bill. The capture patterns for OpenAI and Anthropic.
Building
Jul 1, 2026
Rate Limiting AI Endpoints: Count Dollars, Not Just Requests
One request can cost 100 times another, so request counting misses the point. The three layer design: burst limits, shape bounds, and per user spending caps that downgrade before they block.
Building
Jul 1, 2026
BYOK or Managed Keys: Whose Card Gets Charged, Whose Funnel Gets Hurt
Bring your own key moves the bill to users and a wall into onboarding. Managed keys reverse the trade. The decision by audience, and what going managed commits you to measuring.
Agents
Jul 1, 2026
Why Claude Code Burns Tokens, and What That Teaches About Your Product
Agent context compounds: files read, tool output, and every prior turn ride along on each step. Where the tokens go, the subscription versus API math, and the same physics waiting in your own agentic features.
Reliability
Jul 1, 2026
Claude API Down? Build Fallbacks That Do Not Explode Your Costs
Confirm from your own error rate, fail over critical features, degrade the rest honestly, retry with backoff. Then the part nobody watches mid incident: fallback traffic on a model five times the price, for the whole outage.
Tooling
Jul 1, 2026
AI Cost Tracking Tools Compared: Pick by the Question
Helicone and Langfuse answer what are my calls doing. LiteLLM answers how do I route and budget traffic. Weckr answers which customers cost more than they pay. An honest map of a space where running two tools is normal.
Vercel
Jul 1, 2026
Vercel AI Gateway Cost Tracking: Provider Spend to Per User Margin
The gateway gives one endpoint, fallbacks, and provider spend visibility. Your users do not exist at that layer. The onFinish pattern that adds per user margin, plus the prefixed model id gotcha that silently prices calls at zero.
Reliability
Jul 1, 2026
Is the Model Getting Worse? Measure It From Your Own Telemetry
Output tokens per feature, latency percentiles, retry rate, abandonment: four metadata signals that settle degradation debates with a baseline instead of vibes, and catch the output bloat that quietly raises your bill 20 percent.
Security
Jul 1, 2026
Is AI Cost Tracking Safe? What Leaves Your Server, Exactly
Complete cost math needs only metadata, so a well designed tracker never sees prompts, outputs, or identities, and refuses PII if offered. The full security model, the fail open design, and five questions to ask any vendor.
AI tooling
Jul 1, 2026
MCP Server vs Claude Skill: Which Should Your Dev Tool Ship?
MCP gives the assistant live data and actions. A skill gives it know-how. When each wins, what each costs to run, and why most developer tools end up shipping both, from a team that maintains both side by side.
AI tooling
Jul 1, 2026
Claude Code Plugins for SaaS Builders
How plugins, skills, and git based marketplaces actually work, the short vendor published list worth installing, and how to audit any plugin in two minutes by reading its markdown. Honest state of a young ecosystem.
Product
How Weckr works, what it catches, and what we are building in public.
Product
Jul 1, 2026
Integrate Weckr in 10 Minutes: Signup to First Margin Row
Every step from creating an account to seeing your first cost row: project, key, npm install, the two line wrap, and the first call. What you see at each step, where people stall, and the serverless flush() detail.
Product
Jul 1, 2026
How Weckr Catches a Runaway Agent: Burst to Alert in Minutes
A loop burns 50,000 tokens in five minutes and the alert is already in your Slack. The five step detection flow, what the alert contains, and why caps bound whatever detection misses.
Product
Jul 1, 2026
Spending Caps: Should You Block the Call or Downgrade the Model?
Block protects you from free tiers and abuse; downgrade preserves the experience for paying users over budget. The decision by tier, the WeckrCapError code, and why the check fails open.
Product
Jul 1, 2026
Finding Your First Unprofitable User Takes One Sort
Open the Users page, sort by margin ascending, and the customer costing more than they pay is at the top. The full walkthrough on the live demo, no signup, with the numbers shown.
Product
Jul 1, 2026
Weckr Free vs Pro: Measurement Is Free, Enforcement Is Paid
The free tier gives you the margin view on 50,000 requests a month, no card. Pro adds caps, loop detection, alerts, and recommendations at $49. The honest rule for which you need.
Product
Jul 1, 2026
How Weckr Calculates LLM Cost, and Why You Can Check Every Number
Tokens times current rates, recomputed server side so clients cannot forge it, cache aware, weekly watched, public as JSON, open source in the SDKs. The full methodology.
Product
Jul 1, 2026
What an LLM Cost Dashboard Should Show You, Page by Page
Total spend duplicates your bill. Margin per user, cost per feature, loop history, and cap state change decisions. The tour of every view, all open on the live demo without a signup.
Product
Jul 1, 2026
AI Cost Alerts in Slack, Set Up the Low Trust Way
One incoming webhook you create and control, no OAuth, no app install. Velocity alerts, margin alerts, a Monday digest, and a test button so you never wonder whether it works.
Build in public
Jul 1, 2026
I Taught Claude My SDK: Why Every Dev Tool Should Ship a Skill
Assistants write the integration code now, from stale training data. We shipped four Claude Skills in a day, proved they load with prices no base model knows, and wired the volatile facts to a live feed. The build story with the actual files.
Build in public
Jul 1, 2026
We Let Claude Audit an AI Plan’s Margins. Here Is What It Found
A clean session, a $49 unlimited plan, one question. Claude priced calls at $0.012, flagged a $23 monthly loss on heavy users, and found break even at 4,080 calls. The unedited numbers, and why it needed a skill to get them right.
See the dashboard with real data on the live demo (no signup needed).