Skip to content

Overview

View as Markdown

ai-tally shows what your AI features cost, per feature and per customer. It also shows whether they pay for themselves.

An AI product is rarely a single prompt. One click from a user can call several models, a few tools, a vector search and an embedding. That happens for every one of your customers. Your AI provider’s bill shows one total, so it cannot tell you which feature or which customer drove the cost.

  • Every model call is recorded automatically. Calls made with the OpenAI or Anthropic Python clients, or sent through the proxy, are recorded with their model, token counts and cost.
  • Cost is grouped by feature. You name the part of your product making each call.
  • Cost is split by customer. You attach your own customer id, which is hashed so it cannot be traced back.
  • Prompts and answers are never stored. Only counts, names and hashed ids are kept.
  • Unknown cost shows as a blank. When a cost cannot be known, you see a blank, never a made-up $0.

To try it, create an account at app.ai-tally.com, then follow the Quickstart. It takes about five minutes.

Add the Python SDK and call tally.init once when your app starts. Your OpenAI client stays exactly as it is:

# pip install "git+https://github.com/jain-aanchal/ai-tally#subdirectory=sdk/python"
import os
import tally
from openai import OpenAI
tally.init(os.environ["TALLY_KEY"])
client = OpenAI() # unchanged: every call through this client is now tracked

Calls through that client now show up in ai-tally with their cost. Teams that do not want to change code can use the proxy instead, which only means changing one base URL, or send the OpenTelemetry traces they already collect.

A customer is whoever you want to see cost for: a company on your paid plan, a workspace, or a single user.

with tally.with_account("acct_northwind"):
client.chat.completions.create(model="gpt-4o-mini", messages=messages)

Every call inside the block counts toward that customer. The id is hashed inside your app before anything is sent.

A feature is a part of your product that uses AI, like a support chat or a summary button.

with tally.start_trace(feature_tag="support-chat"):
client.chat.completions.create(model="gpt-4o-mini", messages=messages)

Calls inside the block count toward that feature, and the dashboard adds up cost per feature.

AI features also pay for things that are not model calls, like vector database searches or paid APIs. You can record those too:

tally.record_vector_call(provider="pinecone", index="docs", operation="query", cost_micro_usd=250)

Costs are in whole micro-dollars, so 250 is $0.00025.