This is the open-source Python client for SHDWsdk. It reports model names and token counts only: it never sends prompts or completions, and it never raises into your application. SHDWsdk computes energy and carbon server-side with the open EcoLogits methodology and turns your usage into Scope 3 emissions figures, an AI Bill of Materials, and EU AI Act / NIST AI RMF documentation.
The code is public so your security team can check exactly what leaves your app. There are no runtime dependencies (standard library only).
pip install shdwsdk
export SHDW_API_KEY=shdw_live_...
Instrument a client
import shdwsdk
from openai import OpenAI
shdwsdk.init() # reads SHDW_API_KEY; optional grid_region="eu-north-1"
client = shdwsdk.instrument(OpenAI()) # also Anthropic(), AsyncOpenAI(), AsyncAnthropic()
client.chat.completions.create(model="gpt-5.4-mini", messages=[...])
Per-customer Scope 3 statements
Tag calls with your customer's account id (pseudonymous, never an email). SHDWsdk then produces an emissions statement per customer for their supplier reporting.
with shdwsdk.customer(request.account_id):
client.messages.create(model="claude-sonnet-5-5", ...)
customer() uses contextvars, so it is safe with threads and asyncio.
LiteLLM
import litellm
from shdwsdk.integrations.litellm import ShdwLiteLLMLogger
litellm.callbacks = [ShdwLiteLLMLogger()]
litellm.completion(model="anthropic/claude-haiku-5-5", messages=[...],
metadata={"shdw_customer_ref": "acme-corp"})
LiteLLM proxy (config.yaml):
litellm_settings:
callbacks: shdwsdk.integrations.litellm.proxy_handler_instance
Short-lived processes
Events are sent from a background thread every 5 seconds and at exit. In serverless functions call shdwsdk.get_client().flush() before returning.
What gets sent
| Sent | Never sent |
|---|---|
| Provider and model ID | Prompts |
| Input / output token counts | Completions |
| Grid region and workload name you configure | API keys for your AI providers |
| Optional customer reference you choose | User emails or personal data |
| Delivery counters: delivered, dropped by reason, retried |
Delivery reports
From 0.2.0 the client sends its delivery counters (counts only) with normal batches about once a minute, so the developer console can show drop rates. Turn them off with ShdwClient(delivery_reports=False) or SHDW_DELIVERY_REPORTS=0.
Development
pip install -e ".[test]"
pytest
Issues and pull requests are welcome; we check them weekly. For security issues, see SECURITY.md.
License
Metadata
Release files for shdwsdk 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| shdwsdk-0.3.0.tar.gz | 15.1 kB | Without provenance | Details for shdwsdk-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| shdwsdk-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for shdwsdk-0.3.0-py3-none-any.whl |
Total release size: 28.9 kB
Release files / shdwsdk-0.3.0.tar.gz
| Download URL | shdwsdk-0.3.0.tar.gz |
|---|---|
| Size | 15.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9b11f2ff2c287ca6f414994fb64281dd24ab2a98fb24cc7a3f57097b68c6ce3d
|
|
BLAKE2b-256 checksum How to use checksums |
0cbb74524a7adb76bb7091a843c4e641544086db76c8ef7c9902ca921a9fcac3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.2
|
Release files / shdwsdk-0.3.0-py3-none-any.whl
| Download URL | shdwsdk-0.3.0-py3-none-any.whl |
|---|---|
| Size | 13.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
723d2a59198ba2b9690469a349c4e04872bf7e25399b49927d2a5e0310d5fc98
|
|
BLAKE2b-256 checksum How to use checksums |
4fe80e0b21a9b4dd5a05450cfc7a57c4c86218229e30a35e9a459fe1c9337e35
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.2
|
Security for shdwsdk 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.
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.