climeter
Usage-based metering and billing for CLI tools and AI agents — Python SDK.
🌐 climeter.ai · 📖 Docs
Install
pip install climeter
Python 3.8+. Zero runtime dependencies (stdlib only).
Quick Start
from climeter import meter
meter.configure(api_key="clmtr_...", tool_slug="my-tool")
@meter.track(price=0.01)
def search(query: str):
return do_search(query)
Or set environment variables and skip configure():
export CLIMETER_API_KEY=clmtr_...
export CLIMETER_TOOL_SLUG=my-tool
Usage
Decorator
from climeter import meter
@meter.track(price=0.01)
def search(query: str):
return do_search(query)
# Async — same decorator
@meter.track(price=0.01)
async def search_async(query: str):
return await do_search_async(query)
Context manager
with meter.track_usage("search", price=0.01):
result = do_search(query)
# Async
async with meter.track_usage_async("search", price=0.01):
result = await do_search_async(query)
Manual
meter.record("search", price=0.01, metadata={"query_len": len(query)})
Consumer Usage
If you're calling CLIMeter-powered tools as a user (not building them), use the call() function:
from climeter import call, InsufficientBalanceError
try:
result = call("tool-uuid-here")
print(f"Success — balance remaining: ${result['balance_remaining']:.4f}")
except InsufficientBalanceError as e:
print(f"Out of credits. Top up at: {e.checkout_url}")
The call deducts from your CLIMeter wallet (or free tier). If balance is insufficient, InsufficientBalanceError is raised with a checkout_url to top up.
API
| Method | Description |
|---|---|
meter.configure(api_key, tool_slug, api_url) |
Configure the global meter |
@meter.track(price, name, metadata) |
Decorator — records event after each call |
meter.track_usage(name, price, metadata) |
Sync context manager |
meter.track_usage_async(name, price, metadata) |
Async context manager |
meter.record(name, price, metadata) |
Manual event recording |
meter.flush() |
Force-flush pending events |
meter.shutdown() |
Flush and stop background thread |
meter.status() |
Returns {configured, tool_slug, queue_size} |
CLI
climeter init # set up API key
climeter status # show current config
climeter diagnose # test connection
License
MIT © CLIMeter
Metadata
Release files for climeter 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| climeter-0.1.7.tar.gz | 17.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| climeter-0.1.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.5 kB
Release files / climeter-0.1.7.tar.gz
| Download URL | climeter-0.1.7.tar.gz |
|---|---|
| Size | 17.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8f344d74b98c069b2e24ca497649773eb852fdc5a4e191ff3efbe2311a9ad050
|
|
BLAKE2b-256 checksum How to use checksums |
aa7c70c3d386562e49968774fc67c56af71d527def1eebadd443d49322bab478
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / climeter-0.1.7-py3-none-any.whl
| Download URL | climeter-0.1.7-py3-none-any.whl |
|---|---|
| Size | 15.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ffefe349bee652bf8c4b873523d7046f0b7a1dedac0a38329eae06e99c4b9870
|
|
BLAKE2b-256 checksum How to use checksums |
91a23dfb113ef512658f5bd11e2d71c6b0b9fa0893a16db13ae754c10ebf8b87
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Security for climeter 0.1.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.