CostCrunchGet an API key

Install and connect

Install the costcrunch package and make your first call.

Updated October 31, 2026

Install

pip install costcrunch     # or: uv add costcrunch

It needs Python 3.10 or newer.

Connect

Set your API key in the environment:

export COSTCRUNCH_API_KEY=cc_live_...
from costcrunch import CostCrunch

cc = CostCrunch()                          # reads COSTCRUNCH_API_KEY
print(cc.account.whoami())

You can also pass the key directly, CostCrunch(api_key="..."), though keeping it out of your code is safer. Without a key, the client uses your cost auth login session.

Close it when you're done

with CostCrunch() as cc:
    print(cc.spend.monthly())

Next: Working with results.

Didn't answer your question?

Email [email protected]