← Back to Blog

Per-Client AI Billing for Agencies: Complete Guide

Without per-client tracking, you can't answer the most important question: Which clients are profitable?

Many agencies discover too late that 30-40% of their clients are unprofitable—consuming more in AI costs than they're paying in retainers. Per-client billing visibility solves this problem by showing exactly where your money goes.

The Problem: Invisible AI Costs

Scenario: You're an agency serving 8 clients. Monthly AI bill from OpenAI: $847. Question: How much of that $847 is Client A vs Client B?

Without per-client tracking, you have no idea. You might be:

Two Pricing Models for Agencies

Model 1: Retainer with Included Tokens

Charge a flat monthly retainer that includes X tokens. If client exceeds, they pay overages or upgrade.

Example Tier Structure: - Starter: $500/month (includes 2M tokens) - Growth: $1,200/month (includes 5M tokens) - Pro: $2,500/month (includes 12M tokens) - Overage: $60 per additional 1M tokens

Pros of Retainer Model

Cons of Retainer Model

Model 2: Cost-Plus Markup

Charge actual cost + markup percentage. Client pays exactly what they use.

Example Invoice: Client XYZ - November 2025 - AI Usage: $127.43 (8.2M tokens) - Agency Markup (30%): $38.23 - Total: $165.66

Pros of Cost-Plus Model

Cons of Cost-Plus Model

How to Implement Per-Client Tracking

Step 1: Tag Every Request

Add a client identifier header to all LLM API requests:

# Python example response = client.chat.completions.create( model="gpt-4o", messages=[...], extra_headers={"X-Client-ID": "acme-corp"} ) # JavaScript example const response = await client.chat.completions.create({ model: "gpt-4o", messages: [...], extra_headers: {"X-Client-ID": "acme-corp"} });

Step 2: Export Monthly Usage

At month-end, export usage by client from your LLM gateway:

ClientRequestsTokensCost
acme-corp12,4303.2M$8.47
techstartup8,1201.9M$5.23
bigco-inc45,89012.7M$31.42

Step 3: Apply Markup and Invoice

For cost-plus model, apply your markup percentage:

bigco-inc: AI Cost: $31.42 Markup (30%): $9.43 Invoice Total: $40.85

Total time: 30 seconds per client instead of 2-3 hours of manual tracking.

What Markup Percentage Should You Charge?

Industry standard markup ranges from 20-50% depending on value-add:

Service LevelMarkupWhy
Pass-through only20-25%Minimal management, just routing requests
Basic management30-35%Cost monitoring, basic optimization
Full optimization40-50%Intelligent routing, custom prompts, A/B testing

Pricing tip: Position markup as "AI Infrastructure Management Fee" instead of "Markup." Clients understand they're paying for expertise, not just pass-through costs.

Handling Unprofitable Clients

What do you do when per-client tracking reveals a client is costing more than they're paying?

Option 1: Optimize Their Usage

Before raising prices, try optimization:

Real example: Client was using 2,400-token prompts that included entire conversation history. Optimized to only include last 3 exchanges. Result: 67% token reduction, client became profitable without price increase.

Option 2: Raise Retainer

If optimization isn't enough, raise the retainer:

Email Template: "Based on November usage (12.3M tokens, $42 in costs), your current $500/month retainer is below our cost to serve. We're moving you to the Growth tier ($1,200/month) which includes 15M tokens and priority support. Effective January 1."

Option 3: Switch to Cost-Plus

Move unprofitable retainer clients to cost-plus pricing:

"Starting next month, we're switching your account to usage-based billing. You'll pay actual AI costs + 30% management fee. This ensures fair pricing as your usage scales."

Advanced: Multi-Project Tracking

Some clients have multiple projects. Track costs per project with nested tags:

extra_headers={ "X-Client-ID": "acme-corp", "X-Project-ID": "support-chatbot" }

Then invoice with project-level breakdown:

Client: acme-corp Project: support-chatbot Cost: $12.34 Project: content-generator Cost: $8.76 Project: lead-qualification Cost: $4.21 Total: $25.31 Markup (30%): $7.59 Invoice: $32.90

Automating Client Billing

For agencies with 10+ clients, manual invoicing becomes tedious. Automate it:

Automation Flow

  1. On 1st of month, export previous month's usage via API
  2. Calculate markup for each client
  3. Generate invoice in QuickBooks/Xero/Stripe
  4. Send invoice automatically

Time saved: 2-3 hours per month for a 10-client agency.

Per-Client Tracking Built-In

AI Gateway tracks costs per client automatically. Export monthly reports in 1 click. No tagging setup required.

Try Free for 14 Days →

Related: Complete Guide to LLM Cost Optimization