Metadata-Version: 2.4
Name: botzone-cost
Version: 0.1.0
Summary: Cost-tracking SDK for Anthropic, OpenAI, and Gemini Python clients
Author-email: Botzone <hello@botzone.ai>
License: MIT
Project-URL: Homepage, https://github.com/botzone-ai/cost-sdk-py
Project-URL: Repository, https://github.com/botzone-ai/cost-sdk-py
Project-URL: Issues, https://github.com/botzone-ai/cost-sdk-py/issues
Keywords: llm,cost-tracking,anthropic,openai,gemini
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx>=0.25
Provides-Extra: anthropic
Requires-Dist: anthropic>=0.30; extra == "anthropic"
Provides-Extra: openai
Requires-Dist: openai>=1.0; extra == "openai"
Provides-Extra: gemini
Requires-Dist: google-generativeai>=0.5; extra == "gemini"
Provides-Extra: test
Requires-Dist: pytest>=7; extra == "test"
Requires-Dist: pytest-asyncio>=0.23; extra == "test"
Dynamic: license-file

# botzone-cost

Cost-tracking SDK for Anthropic, OpenAI, and Gemini Python clients. Wrap your
existing client; per-call usage flows to your Cost dashboard. Adds zero
measurable latency to the host call.

## Install

```
pip install botzone-cost
```

## Usage

```python
from anthropic import Anthropic
from botzone_cost import wrap

client = wrap(Anthropic(), api_key="cost_sk_...", route="follow-up-draft")
```

Same surface for OpenAI and Gemini:

```python
from openai import OpenAI
import google.generativeai as genai
from botzone_cost import wrap

openai_client = wrap(OpenAI(), route="summariser")
gemini = wrap(genai.GenerativeModel("gemini-2.5-flash"), route="classifier")
```

## Options

| arg              | default                                          |
| ---------------- | ------------------------------------------------ |
| `api_key`        | env `COST_API_KEY`                               |
| `endpoint`       | env `COST_ENDPOINT` or `https://cost.botzone.ai` |
| `route`          | (none: strongly recommended)                     |
| `user_id`        | (sha256-hashed in the SDK before send)           |
| `feature_tag`    | (none)                                           |
| `enabled`        | `True`                                           |
| `capture_bodies` | `False` (reserved, no effect today, see below)   |

## What gets captured

Token counts (including Anthropic prompt-cache reads / writes and OpenAI cached
prompt tokens), latency, model, route, user id (hashed), feature tag. Computed
USD cost is added server-side from the live pricing table. The Python SDK is
**metadata-only today**: it does not send raw request or response bodies, and
the `capture_bodies` parameter is reserved for future parity with the
TypeScript SDK.

End-user identifiers passed via `user_id` are SHA-256 hashed in the SDK before
send; the plaintext never leaves your process.
