shdwsdk (Python)
Non-blocking AI carbon telemetry for OpenAI, Anthropic, Gemini and anything routed through LiteLLM. Reports model names and token counts only. It never sends prompts or completions, and it never raises into your application. Energy and carbon are computed server-side with the EcoLogits methodology.
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.
Metadata
Release files for shdwsdk 0.1.1
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.1.1.tar.gz | 8.9 kB | Without provenance | Details for shdwsdk-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| shdwsdk-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for shdwsdk-0.1.1-py3-none-any.whl |
Total release size: 18.5 kB
Release files / shdwsdk-0.1.1.tar.gz
| Download URL | shdwsdk-0.1.1.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
02e15371faf97d4298f5d033be3dd4693fe89a384894d192c5fd64bc381fa055
|
|
BLAKE2b-256 checksum How to use checksums |
ecb4c655716c0921aa59d60931d828f8692248cb9bf66934992c2654c49b0e29
|
| 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.1.1-py3-none-any.whl
| Download URL | shdwsdk-0.1.1-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
11c5cea263d4e659385768a2cb38f152433a05bdda541495c7fd23aaacfb4b27
|
|
BLAKE2b-256 checksum How to use checksums |
537e923208c3100f13307937ee32fc402b993d05239e4bd46cbc581719f104f4
|
| 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.1.1
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.