Skip to main content

Serial Alice SDK for Python

The official Python SDK for Serial Alice — certify AI energy consumption in one function call.

Install

pip install serialalice

No required dependencies. Uses requests if available, falls back to stdlib urllib.

Quick start

from serialalice import SerialAlice

alice = SerialAlice(api_key="sa_xxx")

cert = alice.certify({
    "model":            "mistralai/Mistral-7B-Instruct-v0.3",
    "hardware":         "H100-SXM-80GB",
    "provider":         "RunPod",
    "energy_wh":        0.00419,
    "tokens_input":     50,
    "tokens_output":    200,
    "duration_seconds": 4.2,
})

print(cert.id)              # sa-abc123...
print(cert.verify_url)      # https://api.serialalice.pt/...
print(cert.trust_score)     # 0.85
print(cert.signature_valid) # True
print(cert.anchor_status)   # PENDING → ANCHORED

Certificate object

cert.id               # "sa-abc123..."
cert.verify_url       # public verification URL (no auth)
cert.download_url     # full certificate bundle URL
cert.signature_valid  # Ed25519 signature intact
cert.anchor_status    # "PENDING" | "ANCHORED" | "FAILED"
cert.anchor_tx        # Polygon tx hash (once anchored)
cert.trust_score      # 0.0–1.0
cert.trust_posture    # "hardware_measured" | "self_reported"
cert.claim_type       # "hardware_measured" | "scheduling_decision"
cert.energy_wh        # measured energy in Wh
cert.uwh_per_token    # µWh per output token
cert.model_id         # HuggingFace model ID
cert.hardware         # GPU label
cert.issued_at        # ISO 8601 timestamp

# Methods
bundle = cert.download_bundle()   # full signed JSON bundle
valid  = cert.verify()            # re-check signature now
d      = cert.to_dict()           # export as plain dict

Auto-derived fields

You don't need to provide:

  • tokens_total — derived as tokens_input + tokens_output
  • uwh_per_token — derived as energy_wh * 1e6 / tokens_output
  • nvml_samples — derived as duration_seconds * 10
  • batch_size — defaults to 1

Other methods

# Retrieve an existing certificate
cert = alice.get_certificate("sa-abc123...")

# Quick signature check (public endpoint)
valid = alice.verify("sa-abc123...")

# List recent certificates for this tenant
certs = alice.list_certificates(limit=20)

Error handling

from serialalice import (
    SerialAlice,
    AuthenticationError,   # invalid API key or missing scope
    IssuanceError,         # server rejected the request
    ValidationError,       # invalid workload payload
    TimeoutError,          # polling timed out
    NotFoundError,         # certificate not found
)

try:
    cert = alice.certify(workload)
except AuthenticationError:
    print("Check your API key and scopes")
except ValidationError as e:
    print(f"Bad payload: {e}")
except TimeoutError:
    print("Try increasing poll_timeout")

Configuration

alice = SerialAlice(
    api_key="sa_xxx",
    base_url="https://api.serialalice.pt",   # default
    poll_interval=1.0,   # seconds between polls (default: 1)
    poll_timeout=60.0,   # max wait for cert (default: 60)
    timeout=30.0,        # HTTP request timeout (default: 30)
)

Metadata

Release files for serialalice 1.1.3

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

Source distribution (sdist)

Source distribution for serialalice 1.1.3
File Size Uploaded Provenance Actions
serialalice-1.1.3.tar.gz 15.1 kB Without provenance Details for serialalice-1.1.3.tar.gz

Built distribution (wheel)

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

Total release size: 27.3 kB

Release files / serialalice-1.1.3.tar.gz

Download URL serialalice-1.1.3.tar.gz
Size 15.1 kB
Tags Source
SHA-256 checksum
How to use checksums
fafa0e934904dcc108cd6368458d25b3f325b01b32c47aa1aae1bc82b5940b76
BLAKE2b-256 checksum
How to use checksums
8b23dedec0388ee3190872bc3c12dd3a501eb9327cf78de4682f6624c70f975a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release files / serialalice-1.1.3-py3-none-any.whl

Download URL serialalice-1.1.3-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ed428146339abfdde403afe6cce8e2d3b9899d8dc23d095f863e21e31fdf6505
BLAKE2b-256 checksum
How to use checksums
733183c545552b85200fcd353d06571fee4fdbcb57a6537b02777ee7a0b177ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Security for serialalice 1.1.3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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