Skip to main content

Official Python SDK for Silvanexum — the spend-control plane for AI agents. Meter, attribute, cap, and audit agent spend across a multi-agent mesh, on any model or rail. Typed pydantic models generated from the API's Zod contracts.

Project description

silvanexum

Official Python SDK for Silvanexumthe 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.

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

silvanexum-0.1.2.tar.gz (24.9 kB view details)

Uploaded Source

Built Distribution

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

silvanexum-0.1.2-py3-none-any.whl (27.3 kB view details)

Uploaded Python 3

File details

Details for the file silvanexum-0.1.2.tar.gz.

File metadata

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

File hashes

Hashes for silvanexum-0.1.2.tar.gz
Algorithm Hash digest
SHA256 8cecb0dc16928af0e340f827501b7c0fa6c05aa674980cfee441966997ba86b0
MD5 dd53987c77610c47999d9afbe7a488b5
BLAKE2b-256 4c658238c707b1af2c895377247da8d0c387eb533810fdcee0a0c7b69e24fc6d

See more details on using hashes here.

Provenance

The following attestation bundles were made for silvanexum-0.1.2.tar.gz:

Publisher: release.yml on silvanexum/Silvanexum-sdk

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

File details

Details for the file silvanexum-0.1.2-py3-none-any.whl.

File metadata

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

File hashes

Hashes for silvanexum-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 68adf676ce3730e40a42464b9c610574073c8dee60df5f1b9ededdd9e82d9fec
MD5 262b309a150140d6783737f0b96cac9d
BLAKE2b-256 7bd56311c5c2a51405525904397bb643d2df3cb1d1c1f6b876f6e575348ea7fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for silvanexum-0.1.2-py3-none-any.whl:

Publisher: release.yml on silvanexum/Silvanexum-sdk

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