惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
云风的 BLOG
云风的 BLOG
Microsoft Security Blog
Microsoft Security Blog
WordPress大学
WordPress大学
GbyAI
GbyAI
C
Check Point Blog
M
MIT News - Artificial intelligence
T
The Blog of Author Tim Ferriss
Jina AI
Jina AI
博客园 - 【当耐特】
U
Unit 42
月光博客
月光博客
腾讯CDC
Y
Y Combinator Blog
小众软件
小众软件
博客园_首页
Last Week in AI
Last Week in AI
酷 壳 – CoolShell
酷 壳 – CoolShell
The GitHub Blog
The GitHub Blog
博客园 - 聂微东
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
MongoDB | Blog
MongoDB | Blog
博客园 - Franky
T
Tailwind CSS Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Why AI Agencies are flying blind (and how to fix your LLM...
John Medina · 2026-04-22 · via DEV Community

John Medina

If you're running an AI agency, you're probably building some
variation of RAG or agentic workflows for your clients.

You deliver the project, it works great, and then the first OpenAI bill hits.

Most agencies I talk to are still in the "winging it" phase when it
comes to API costs. They use one master key for dev, one for prod, and
maybe—if they're feeling fancy—one key per client.

But fwiw, per-client keys are a maintenance nightmare. And if you're
using a single master key for multiple clients, you're flying blind.

The "Averages" Trap

You might think: "I'll just charge a flat $100/mo for API usage."

Then one client decides to run a bulk ingest of 5,000 PDFs. Your
margin on that client just went negative, and you won't even know it
until the end of the month when you see a spike in the dashboard that
you can't explain.

Averages don't work for LLMs. Usage is too spiky.

3 ways to handle client attribution

1. The Metadata Header (The "Minimum Viable" way)

OpenAI, Anthropic, and OpenRouter all allow you to pass a user or
metadata header.

const response = await openai.chat.completions.create({
  model: "gpt-4o",
  messages: [...],
  user: `client_acme_corp`
});

Enter fullscreen mode Exit fullscreen mode

This is the bare minimum. It lets you export a CSV at the end of the
month and spend 4 hours in Excel trying to pivot-table your way to a
client invoice. tbh, it's better than nothing, but it's not real-time.

2. The Custom Proxy

You build a middleman. Every request from your client's app goes to
your proxy first, you log the tokens, then you forward it to OpenAI.
Pros: Absolute control.
Cons: You just added a single point of failure and 200ms of latency to
every request. Unless you're a DevOps wizard, this is usually
over-engineering for a boutique agency.

3. Real-time Attribution (The "Sanity" way)

You keep your direct provider connection but fire an async event for
every request.

This is why I built LLMeter. I needed a way to see exactly which
client was spending what, in real-time, without adding latency to the
main request.

We use it at Simplifai for our own tools. It tracks:

  • Cost per client (tenant)
  • Cost per model
  • Daily burn rates

If a client starts hitting the API harder than expected, I get an
alert immediately. I can then decide to upsell them, cap their usage,
or adjust the billing.

Why this matters for your agency

Clients don't like "surprise" bills. If you can show them a dashboard
(or a report) with their exact usage and cost, the trust level goes up
10x. It moves you from "freelancer with a script" to "professional AI
partner."

LLMeter is open-source (AGPL-3.0) and you can self-host it for free.
Check it out: llmeter.org

How are you billing your clients for LLM usage right now? Flat fee?
Pass-through? Or just eating the cost?