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.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 OpenAI capture via the gateway is currently in the TypeScript SDK (@silvanexum/sdk); Python callers can point an OpenAI client at https://api.silvanexum.com/gateway/openai/v1 directly with a Silvanexum key.

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.1.tar.gz (24.1 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.1-py3-none-any.whl (26.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: silvanexum-0.1.1.tar.gz
  • Upload date:
  • Size: 24.1 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.1.tar.gz
Algorithm Hash digest
SHA256 651eec0ed8cffb1fd7bece06f6cfd0168606fba6c74f2d230635d7b1a5784b37
MD5 63643babbea56eb88ba07033b0d0335a
BLAKE2b-256 5a2f6a6f6eb65ade28907b2140bba18b9e1438e1b35178cd28e03f35f2175762

See more details on using hashes here.

Provenance

The following attestation bundles were made for silvanexum-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: silvanexum-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 26.5 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 427f84fa1998a97281d6630ba25e6069fc39eb44ec7de861481880468dc0c627
MD5 6945303b97c88dd528625a9502d96e6d
BLAKE2b-256 a8a0cc14b76452bbbd59be0422631e6adafd962a79316c13a07d7490ab3ed979

See more details on using hashes here.

Provenance

The following attestation bundles were made for silvanexum-0.1.1-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