Skip to content

Track OpenAI cost by customer, not by project or API key

The homepage is the product. This is the playbook: how teams try to see OpenAI cost by customer, and what actually lands on a P&L.

Teams try four things. The OpenAI user field is a label on their side, not an invoice. One OpenAI project per client (the Administrate pattern) works until you have fifty customers. SDK wrappers such as LLMeter count tokens in-process; they are not a proxy. Multi-provider Stripe tools such as PerUnit bill usage across vendors — a different job.

CostSlice is the pass-through: https://api.costslice.com/v1, x-cs-key, x-cs-tenant. Keep your OpenAI API key. The P&L is by customer.

api.costslice.com/v1

from openai import OpenAI
import os

client = OpenAI(
    base_url="https://api.costslice.com/v1",
    api_key=os.environ["OPENAI_API_KEY"],
    default_headers={
        "x-cs-key": os.environ["COSTSLICE_KEY"],
        "x-cs-tenant": tenant_id,       # opaque id, never an email
        "x-cs-feature": "support-copilot",
        "x-cs-env": "prod",
    },
)

Product story: CostSlice home. Demo: sample P&L. Finance noun: OpenAI cost P&L.

Starter is free. No credit card. Operator: Media Yard LLC, PO Box 73, Pennsauken, NJ 08110. hello@costslice.com

Questions

Does the OpenAI user field give cost by customer?
No. The user field is a label on OpenAI’s side, not an invoice. CostSlice tags your customer and shows cost versus plan price.
Is this one OpenAI project per client?
No. That pattern works until you have fifty customers. Keep one key. Send x-cs-tenant.
Do I keep my OpenAI API key?
Yes. Point base_url at CostSlice. Authorization is forwarded. We never store the OpenAI API key.
Do you store prompts?
No. Usage metadata only. We do not keep what people typed.