Skip to main content

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.0

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

Source distribution (sdist)

Source distribution for shdwsdk 0.1.0
File Size Uploaded Provenance Actions
shdwsdk-0.1.0.tar.gz 8.8 kB Without provenance Details for shdwsdk-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 18.3 kB

Release files / shdwsdk-0.1.0.tar.gz

Download URL shdwsdk-0.1.0.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a8e00214eecef595d85359afd32324b3c302d50626734cc781c4eacfe58bc5fa
BLAKE2b-256 checksum
How to use checksums
332eb8c7bb45fa1ecaf79b71ae6cefe48a82ba2d9081666c772ee438fc2dd4ce
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.0-py3-none-any.whl

Download URL shdwsdk-0.1.0-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0eef17d77586b7608b03ca4ce869a5aa5bab753e516796933e83f178eea970a7
BLAKE2b-256 checksum
How to use checksums
539cb923abc6581ff50419feb1323688d90d58d68de3a06086555ba0ca9e8f5d
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.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.

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