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",
},
)