How do you track LLM cost per customer for CrewAI workflows?

The setup that’s worked for me: Phoenix (arize-phoenix) with the CrewAI + Anthropic OpenInference instrumentors. The CrewAI one captures orchestration spans, the Anthropic one captures per-call token counts (llm.token_count.prompt / llm.token_count.completion). Both activate
automatically with auto_instrument=True.

For customer attribution, I believe OpenInference has a context manager that tags all child spans:

from openinference.instrumentation import using_attributes

with using_attributes(metadata={“customer_id”: “cust-123”}):
  crew.kickoff()  # all spans inherit customer_id

Then px.Client().get_spans_dataframe() gives you everything in a DataFrame - group by customer, multiply tokens by rate ($1/$5 per MTok for Haiku 4.5), done.

To @skillforge_team’s point on the run ledger - agreed for billing. The trace approach adds the diagnostic layer: when one customer’s runs cost 3x more, you can see it was the research agent re-running a tool 6 times, not just the total.