Skip to main content

Spendwall SDK — local-first agent spend firewall

Project description

spendwall (Python)

Quick start

from spendwall import SpendwallClient

# Zero config: socket and token are auto-discovered from ~/.spendwall
# (override with SPENDWALL_DIR / SPENDWALL_SOCKET / SPENDWALL_TOKEN).
client = SpendwallClient()

Daemon lifecycle

Zero-install by default: the client lazily auto-spawns the daemon on the first call if none is running, and the daemon self-initializes its data dir.

from spendwall import ensure_daemon, SpendwallClient

# Just use it — the daemon is spawned + self-initialized on the first call.
client = SpendwallClient()

# Or manage it explicitly: reuse a healthy daemon, or spawn one (binary via
# SPENDWALL_DAEMON_BIN, the bundled wheel, or PATH).
ensure_daemon()

Opt out of auto-spawn with SPENDWALL_AUTOSPAWN=0 (or SpendwallClient(auto_spawn=False)). With it disabled, a down daemon fails open in observe/advisory modes and raises DaemonNotRunningError in enforce mode.

~/.spendwall/auth.toml is machine-managed — the daemon self-generates its bearer token on first run; don't edit it.

Compatibility window

The SDK checks the daemon's version from /v1/about on first use and refuses a daemon whose SemVer major is more than 2 away from the SDK's (in either direction) — raising SpendwallVersionMismatch, which fail-open clients (observe/advisory) swallow and enforce surfaces. If the daemon advertises a deprecation notice, the SDK emits a warnings.warn. (Pre-1.0 every version is major 0, so the window is always satisfied today.)

Provider wrappers

import openai
import spendwall.openai as sw

client = openai.OpenAI(api_key="sk-...")
client = sw.wrap(client, mode="enforce")

# Now every client.chat.completions.create(...) is observed by spendwalld.

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

spendwall-0.1.0.tar.gz (32.3 kB view details)

Uploaded Source

Built Distributions

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

spendwall-0.1.0-py3-none-manylinux_2_35_x86_64.whl (37.3 MB view details)

Uploaded Python 3manylinux: glibc 2.35+ x86-64

spendwall-0.1.0-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file spendwall-0.1.0.tar.gz.

File metadata

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

File hashes

Hashes for spendwall-0.1.0.tar.gz
Algorithm Hash digest
SHA256 61009daa2a7c291e407e9c5c21fd963bd5345d20c6530c46adc94aa2419cd75a
MD5 e59ce4393bd3e4e94dc9d64ec6f30236
BLAKE2b-256 f08525e0a67d620929d424ba94a291a3dd894d08d27d04edde525bd3e4b6675a

See more details on using hashes here.

Provenance

The following attestation bundles were made for spendwall-0.1.0.tar.gz:

Publisher: release.yml on catancs/spendwall

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

File details

Details for the file spendwall-0.1.0-py3-none-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for spendwall-0.1.0-py3-none-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 15fd9542b83a5b384894f827b5705e49ff249c9abc7927d4b4e66e27b62fc556
MD5 3d9fdcd8b0fc87516db1923eb320ed95
BLAKE2b-256 58dff2cdeb5accde3fa70c97f761f3d68bdb7e41a12fa8eb2bb9cc3ffee2a4fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for spendwall-0.1.0-py3-none-manylinux_2_35_x86_64.whl:

Publisher: release.yml on catancs/spendwall

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

File details

Details for the file spendwall-0.1.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for spendwall-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 83fc88fa5a562a254bb815f73a9606f27857093734df01a54c4c28f8e0cee758
MD5 17b48fa41aa87ef7ea639d19a5ea0446
BLAKE2b-256 5bcf4bc862f95fcacd552c7ce7cbe7a46f5bc395264caee5155b28665a69e05d

See more details on using hashes here.

Provenance

The following attestation bundles were made for spendwall-0.1.0-py3-none-any.whl:

Publisher: release.yml on catancs/spendwall

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