DEV Community

Arnon Shimoni
Arnon Shimoni

Posted on • Originally published at blog.paid.ai

You need AI cost tracking, and you should start now

"We basically look at our monthly OpenAI bill and apply a distribution factor."

Sound familiar? You're not alone.

I analyzed hundreds of our customer conversations about AI agent monetization. The second most common pain point after pricing? Cost tracking. Or more accurately, the complete lack of it.

Figuring out the costs can be hard

Way too many people have no idea what their AI is racking up in costs, and you see it on Reddit, X, and in communities everywhere.

CloudZero says AI spend is jumping

According to CloudZero, the average monthly AI spend is jumping from $62,964 to $85,521 in 2025 - a 36% increase - but I actually think they’re underestimating it.

Why it gets harder at 10 customers

Imagine yourself in this person’s shoes who told us they track globally:

"We have separate API keys per customer so that we can track usage per customer. But it doesn't give you the dollar figure. It gives you tokens or usage. Then we just basically look at our monthly bill at OpenAI and apply a distribution factor."

This works when you have 5 customers. Maybe even 10. But here's what happens at scale:

  1. At 5 customers: You're checking OpenAI dashboard daily. Life is good.
  2. At 10 customers: You've got separate API keys. Maybe a spreadsheet. Still manageable.
  3. At 50 customers: Welcome to the Spreadsheet Spiral of Death.

By the time you figure out a customer is unprofitable, they've already burned through months of margin.

The API key problems: What OpenAI and Anthropic won’t tell you about usage

These foundation model providers’s usage dashboard is built for developers, not businesses.

Can you figure out what was actually performed here or what the value delivered was in this OpenAI dashboard?

Can you figure out what was actually performed here or what the value delivered was in this OpenAI dashboard?

One founder told me:

"There are all these vendor tools, right? And certain discounts based off bundles. Pricing is very fluid, and so that cost may change. But right now it seems like it's a static view."

What you get:

  • Token counts by API key
  • Monthly aggregate spend
  • Basic usage graphs

Anthropic’s billing/costs dashboard is even more basic than OpenAI’s.<br>

Anthropic’s billing/costs dashboard is even more basic than OpenAI’s.

What you really need:

  • Cost per customer, per action, per outcome
  • Real-time margin alerts
  • Workflow-level profitability
  • Which features are margin killers

The gap between what you need and what you get? That's where companies die.

🛠️ Building a simple cost attribution

Before you spin up a massive data warehouse project - get practical. You need cost visibility TODAY, not in 3 months.

Here's the progression that works:

Level 1: Just ship it

Start tracking these 5 signals immediately - you can pull this off in an hour!

In Python it’ll look something like:

# Basic cost tracking - implement this in the next hour
def track_ai_operation(customer_id, operation_type, model, tokens):
    cost_map = {
        'gpt-4o': 0.03 / 1000,
        'gpt-4o-mini': 0.002 / 1000,
        'claude-4-sonnet': 0.003 / 1000,
        'embeddings': 0.0001 / 1000
    }

    cost = tokens * cost_map.get(model, 0)

    # Log to CSV, database, whatever - just START
    log_entry = {
        'timestamp': datetime.now(),
        'customer_id': customer_id,
        'operation': operation_type,
        'model': model,
        'tokens': tokens,
        'cost': cost
    }

    return log_entry

Enter fullscreen mode Exit fullscreen mode

Pro tip from Paid: Even a CSV beats nothing. Perfect is the enemy of shipped.

Level 2: Attribution magic

You wrap every AI call:

In Javascript, it’ll look something like:

const trackCost = async (customerId, agentId, operation) => {
    const startTime = Date.now();
    const result = await operation();

    const costData = {
        customerId,
        agentId,
        operation: operation.name,
        model: result.model,
        inputTokens: result.usage.prompt_tokens,
        outputTokens: result.usage.completion_tokens,
        totalCost: calculateCost(result.usage, result.model),
        duration: Date.now() - startTime
    };

    await recordCost(costData);

    return result;
};
Enter fullscreen mode Exit fullscreen mode

Level 3: Get a purpose-built system

"… this is crushing us. Our cost has gone up, and it's driving our margins down."

We’ve seen customers go from 70% margins to 40% because ONE customer was "very chatty" with their voice agent.

This is where Paid’s AI cost tracking and margin management can help.

Paid's real-time visibility

Some vendors like Paid.ai provide real-time visibility into AI agent costs by automatically tracking spend, profit margins, and usage across providers like OpenAI and Anthropic using SDKs and OpenTelemetry. It enables pricing accuracy and scalable profitability with alerts for cost spikes, per-agent margin insights, and unified dashboards for vendor expenses.

Don’t build this yourself - let someone else handle the details and stay up-to-date.


One of our customers had negative margins…

A founder walked into our office (figuratively - we met online) and told us “we're bleeding money and I don't really know why."

They have a clean UI (not shadcdn!), happy customers, $299/month pricing that looked profitable on paper. They were celebrating hitting 100 customers when their CTO dropped a "we're losing money on every single call"…

We helped dig in to their voice bills where most customers had totally normal usage - but then we found a really chatty customer.

  • Average customer: 2,000 voice tokens/month ($8 in costs)
  • Chatty customer: 187,000 voice tokens/month ($748 in costs)
  • The $299/month became -$449/month

Chatty customers

The fix was to introduce complexity factors. More complex workflows cost more, and use the higher-value LLMs. Once a certain threshold has been reached, the models were downgraded.

💡 Your path forward

Every day that you operate without cost visibility is a day you're potentially losing money. But you don't need a perfect system to start.

Today: Implement basic signal tracking. Even a CSV is better than nothing.

In a few weeks: Add customer-level attribution. Know who's killing your margins.

In a couple of months: Graduate to real-time monitoring. Catch problems before they compound.

Stop guessing based on your vendor bills - start tracking, start managing, start profiting.

Your margins will thank you.

Top comments (0)