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).
  • 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.1

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.1
File Size Uploaded Provenance
api_cost_tracker-0.2.1.tar.gz 15.5 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 25.3 kB

Release files / api_cost_tracker-0.2.1.tar.gz

Download URL api_cost_tracker-0.2.1.tar.gz
Size 15.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2f27ed28aee734bbd69e0a1b02bcfeb71f2b6708f37eb5b1ec83ed4895243a6a
BLAKE2b-256 checksum
How to use checksums
8a5ce4c85fb1f9d3864b6f69aa0d09ca7bd18f2ce736d4e1f08d1668432e4f47
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.1-py3-none-any.whl

Download URL api_cost_tracker-0.2.1-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
acc85c17365f8ce4ba8eeb33d8691404d18ddfc07b2f8f224c93540e22934005
BLAKE2b-256 checksum
How to use checksums
01d68c5ae4fc3dfff1a3bfefe0423653048b3825983bc30dd219d81a9ae19c42
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.1

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