Skip to main content

silvanexum

Official Python SDK for Silvanexum — the spend-control plane for AI agents. Meter, attribute, cap, and audit what every agent spends across your whole agent-to-agent mesh, on any model or rail. Models are generated from the API's Zod contracts (pydantic v2), so they never drift from the live API.

📚 Full docs: https://docs.silvanexum.com

Install

pip install silvanexum
# uv add silvanexum · poetry add silvanexum

Requires Python ≥ 3.9.

Quickstart — cap spend, then see who spent it

import os
from silvanexum import Silvanexum

sx = Silvanexum(api_key=os.environ["SILVANEXUM_API_KEY"])

# Cap runaway spend — a run or mesh hop that would breach the budget is
# rejected server-side (HTTP 402). "Spent" is computed from real run telemetry.
sx.budgets.create(
    name="support-team",
    scope_type="agent",
    scope_id="agt_123",
    period_type="monthly",
    limit_credits=50_000,
    enforcement="block",
)

# Attribute cost across the mesh — which agent / project / model actually spent.
for row in sx.spending.summary(group_by="agent"):
    print(row.label, row.costCredits)

The client is a context manager, so connections are cleaned up for you:

with Silvanexum() as sx:          # reads SILVANEXUM_API_KEY from the env
    trend = sx.spending.trends(bucket="1d")  # daily spend, last 30 days

What's in the SDK

Resource What it does
sx.spending Cost attribution — summary / trends / mesh_trace (by agent, project, model, provider)
sx.budgets Spend caps with off / alert / block enforcement + live status
sx.gateway Zero-code OpenAI-compatible capture + usage
sx.fleet Cost, latency, drift, and alert observability
sx.runs · sx.agents Run agents; read signed, replayable traces
sx.security Hash-chained audit log + compliance export

…plus marketplace, wallet, routing, connectors, team, and more. Full reference: https://docs.silvanexum.com/docs/sdk-reference/python.

Zero-code capture (gateway)

Point your OpenAI client's base_url at the gateway and use your Silvanexum key. Every call is metered on your own provider key and counts toward budgets:

from openai import OpenAI

openai = OpenAI(
    base_url=sx.gateway.openai_base_url(),
    api_key=os.environ["SILVANEXUM_API_KEY"],
    default_headers={"x-silvanexum-trace": trace_id},  # optional mesh stitching
)

Errors

from silvanexum import InsufficientCreditsError, RateLimitError

try:
    sx.runs.create(agent_id="agt_123", prompt="…")
except InsufficientCreditsError:
    ...  # budget/credits exhausted (HTTP 402) — top up or raise the cap
except RateLimitError:
    ...  # client already retried with backoff

Licensed Apache-2.0.

Metadata

Release files for silvanexum 0.3.0

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

Source distribution (sdist)

Source distribution for silvanexum 0.3.0
File Size Uploaded Provenance Actions
silvanexum-0.3.0.tar.gz 30.5 kB With provenance Details for silvanexum-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for silvanexum 0.3.0
File Interpreter ABI Platform Actions
silvanexum-0.3.0-py3-none-any.whl Python 3 none any Details for silvanexum-0.3.0-py3-none-any.whl

Total release size: 63.8 kB

Release files / silvanexum-0.3.0.tar.gz

Download URL silvanexum-0.3.0.tar.gz
Size 30.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7aa2949761c41e3e2d2fe75ae124edc34c6ef59f0ca55e0e563c6a183b74e604
BLAKE2b-256 checksum
How to use checksums
9b258779410a11559469ed96986e44560b0407eec09868f76ea1904b58bc3e45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / silvanexum-0.3.0-py3-none-any.whl

Download URL silvanexum-0.3.0-py3-none-any.whl
Size 33.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1364a4dc5c1a243cb9928bb62641d4dd23532a10936f8e7e7ad7b7c2608bdd45
BLAKE2b-256 checksum
How to use checksums
f2ba4f2f07425155799f57f61201909cf82211d44655c4125ff47b05b1aa5b9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Security for silvanexum 0.3.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for silvanexum-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

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