Skip to main content

Python SDK for NullSpend — FinOps for AI agents

Project description

nullspend

Python SDK for NullSpend — FinOps for AI agents.

Installation

pip install nullspend

Quick Start

from nullspend import NullSpend, CostEventInput

ns = NullSpend(
    base_url="https://nullspend.dev",
    api_key="ns_live_sk_...",
)

# Report a cost event
ns.report_cost(CostEventInput(
    provider="openai",
    model="gpt-4o",
    input_tokens=1200,
    output_tokens=350,
    cost_microdollars=5250,
    tags={"environment": "production", "agent": "support-bot"},
))

# Check budget status
status = ns.check_budget()
for entity in status.entities:
    print(f"{entity.entity_type}/{entity.entity_id}: "
          f"${entity.remaining_microdollars / 1_000_000:.2f} remaining")

Features

  • Cost event reporting (single and batch)
  • Budget status and listing
  • Cost analytics summaries
  • Human-in-the-loop action management (create, poll, mark result)
  • propose_and_wait() high-level orchestrator
  • Automatic retries with exponential backoff
  • Idempotency keys on mutating requests
  • Type hints throughout (py.typed)

Documentation

See the NullSpend docs for full API reference.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nullspend-0.2.0.tar.gz (56.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nullspend-0.2.0-py3-none-any.whl (34.9 kB view details)

Uploaded Python 3

File details

Details for the file nullspend-0.2.0.tar.gz.

File metadata

  • Download URL: nullspend-0.2.0.tar.gz
  • Upload date:
  • Size: 56.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nullspend-0.2.0.tar.gz
Algorithm Hash digest
SHA256 325a18a00270521c7477dd3e9a9462d4446bfd09e40d0d87b7cdf5e1b7b6c7d9
MD5 1e4823f29f6ed8d23bfe3d72c6d25b76
BLAKE2b-256 bc1b22bdea018923307d8a53dc28d81791fa5b1393a4e7405693403af6d49106

See more details on using hashes here.

Provenance

The following attestation bundles were made for nullspend-0.2.0.tar.gz:

Publisher: publish-python.yml on NullSpend/nullspend

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nullspend-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: nullspend-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 34.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nullspend-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e86f46cd3957f7f3b34ec3e527cd970b1838862ce84b5721b32bd18c9bc95953
MD5 36a56533a3ac05f5ad295a2668f704f5
BLAKE2b-256 26d2b9a6dd21d86b9e5151ff28d2a52acbb68e7bea645025945cb840f835065c

See more details on using hashes here.

Provenance

The following attestation bundles were made for nullspend-0.2.0-py3-none-any.whl:

Publisher: publish-python.yml on NullSpend/nullspend

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page