Skip to main content

api-cost-tracker

The client for the Synth Insight Labs API cost tracker. It records what every API call costs to https://api.synthinsightlabs.com without ever breaking the call it measures. Standard library only; macOS and Linux.

from api_cost_tracker import track, track_tokens, log_call

response = client.messages.create(...)          # any provider SDK
track(response, "anthropic", project="my-project", caller="summarizer")

track_tokens("anthropic", "claude-haiku-4-5", 1200, 300, project="my-project")  # raw HTTP calls
log_call("vercel", service="blob", project="my-project")                       # non-AI APIs
  • Providers: anthropic, openai, xai, google, openrouter (records OpenRouter's billed usage.cost).
  • Batch API calls: pass service="batches" to track() or track_tokens(). The server then prices the row at the provider's batch rate (half price).
  • Never raises. A record that can't be sent goes to an offline buffer at ~/.local/share/api_trust_tracker/buffer.db, and each later successful call sends a few buffered rows too. A record that is lost anyway is logged at WARNING.
  • Configuration: COST_TRACKER_API_KEY (required by the server) and COST_TRACKER_URL (default https://api.synthinsightlabs.com), from the environment.

Renamed from api-trust-tracker in 0.2.0. That package now only re-exports this one, and the buffer keeps its old directory so both versions share it.

Metadata

Release files for api-cost-tracker 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for api-cost-tracker 0.2.2
File Size Uploaded Provenance
api_cost_tracker-0.2.2.tar.gz 17.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for api-cost-tracker 0.2.2
File Interpreter ABI Platform
api_cost_tracker-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 28.6 kB

Release files / api_cost_tracker-0.2.2.tar.gz

Download URL api_cost_tracker-0.2.2.tar.gz
Size 17.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c71a997f5a4d9324fe9e93cc965ebb72c8a9f9a1b6399afb9fff6dd221b1beda
BLAKE2b-256 checksum
How to use checksums
2afabc2e340d231fb75b4b7e5a8796c4b9ae9fc272312581a6dd19c717f159c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / api_cost_tracker-0.2.2-py3-none-any.whl

Download URL api_cost_tracker-0.2.2-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dc164bebce50227ca72c9c76aa380256a0abc7642a78eb127d80eb1b4af497eb
BLAKE2b-256 checksum
How to use checksums
b7a1a203aff1f31dfe5db4f098afcb8e03dbd65ed11596834995c367444e80f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for api-cost-tracker 0.2.2

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page