LLM cost attribution — track OpenAI spend by user, feature, and endpoint
Project description
SpendLens
Track your OpenAI costs by user, feature, and endpoint. Two-line integration.
Install
pip install spendlens
Usage
from spendlens import SpendLensClient
client = SpendLensClient(api_key="your-spendlens-api-key")
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello"}],
tags={"user_id": "u_123", "feature": "chat", "endpoint": "/api/chat"},
)
Your costs appear on the dashboard. That's it.
- Never logs prompts or completions. Only metadata.
- Never modifies the OpenAI response.
- Never adds latency. Logging is async.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
spendlens-0.1.0.tar.gz
(2.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spendlens-0.1.0.tar.gz.
File metadata
- Download URL: spendlens-0.1.0.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78baa937c2b1144515032f19bfe6291dd1b3fd15ea60c5ff69afaf44ea3e876c
|
|
| MD5 |
4050296e6feb91e44ec5d4fd9c361198
|
|
| BLAKE2b-256 |
74a7266950fec22631e9601bbbaa8bf9c7a9b5176b4a0c2f1f45bad9627f605e
|
File details
Details for the file spendlens-0.1.0-py3-none-any.whl.
File metadata
- Download URL: spendlens-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84c9eaa527da697e5f7619f680937d3648f4ab90c8737de2495fec5f3fd59a41
|
|
| MD5 |
dfba81965ffa9e091a3bf6e9ded97259
|
|
| BLAKE2b-256 |
2c8a2d954a249517e86f568a887dd73fb16a3a13d1f9b5b94ef116ab84daa3d1
|