Skip to main content

Spendline Python SDK

Spendline tracks LLM usage in production with one line of code. The SDK captures tokens, model, latency, cost, timestamp, workflow ID, and request metadata without collecting prompt or completion text.

Install

pip install spendline

Quick Start

from openai import OpenAI
from spendline import track

client = OpenAI()

response = track(
    client.chat.completions.create(
        model="gpt-5-mini",
        messages=[{"role": "user", "content": "Say hello"}],
    ),
    workflow_id="support-bot",
    session_id="session-123",
    metadata={"feature": "chat", "environment": "production"},
)

print(response.choices[0].message.content)

Auto-Patch Supported Clients

from spendline import patch

patch()

LangChain

from spendline.langchain import SpendlineCallbackHandler

handler = SpendlineCallbackHandler(workflow_id="chatbot")

Supported Providers

Provider Support
OpenAI track() and patch()
Anthropic track() and patch()
Google Gemini track()
DeepSeek track()
Bedrock track()

Environment Variables

Variable Purpose
SPENDLINE_API_KEY Default ingest key
SPENDLINE_API_URL Override API base URL
SPENDLINE_DISABLE Disable tracking when true
SPENDLINE_LOG Print tracked events locally

Privacy

Spendline does not collect:

  • Prompt text
  • Completion text
  • Raw request bodies
  • Secrets from your application context

Metadata

Release files for spendline 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 spendline 0.1.0
File Size Uploaded Provenance
spendline-0.1.0.tar.gz 6.6 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 15.8 kB

Release files / spendline-0.1.0.tar.gz

Download URL spendline-0.1.0.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
915a2887569164aa2b901d35a0bb20f95dbea415b1fb247c756990cc9d303265
BLAKE2b-256 checksum
How to use checksums
b8c0b0ce4d44685db5f9927facd79e73d269f0a6a282aa0c0fe7a24c80cc58ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / spendline-0.1.0-py3-none-any.whl

Download URL spendline-0.1.0-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c85e8c46b2163e962b0e96915fb7081abf549100bbb09aed9d30f3d100cdb506
BLAKE2b-256 checksum
How to use checksums
eba4e8e09d75b624a4dc0296459f0d8710e851ef133b6c31fabed6a49b79d049
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Security for spendline 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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