Skip to main content

logspine · Python SDK

Drop-in observability for AI agents. Track every OpenAI and Anthropic call with cost, tokens, and latency — no code changes to your prompts.

Full docs: logspine.dev/docs


Install

pip install logspine

# with OpenAI support
pip install "logspine[openai]"

# with Anthropic support
pip install "logspine[anthropic]"

# both
pip install "logspine[openai,anthropic]"

Quick start — OpenAI

import openai
from logspine import LogspineClient

logspine = LogspineClient(api_key="lsk_live_...")
client = logspine.instrument_openai(openai.OpenAI())

# Every call is now tracked automatically
response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Say hello in five words."}],
)
print(response.choices[0].message.content)

logspine.flush()  # call before process exit

Quick start — Anthropic

import anthropic
from logspine import LogspineClient

logspine = LogspineClient(api_key="lsk_live_...")
client = logspine.instrument_anthropic(anthropic.Anthropic())

response = client.messages.create(
    model="claude-sonnet-4-5",
    max_tokens=256,
    messages=[{"role": "user", "content": "Say hello in five words."}],
)
print(response.content[0].text)

logspine.flush()

Optional span metadata

Pass a logspine dict as an extra kwarg to tag individual calls:

client.chat.completions.create(
    model="gpt-4o",
    messages=[...],
    logspine={
        "trace_id": "my-session-abc123",
        "name": "summarise_document",
        "user_id": "usr_42",
    },
)

Metadata

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

Built distribution (wheel)

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

Total release size: 12.7 kB

Release files / logspine-0.1.0.tar.gz

Download URL logspine-0.1.0.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a7d83ab564a6b54dff49b0ec1eb59a23c33f1ea87f9cfdf8fb71643707b909f6
BLAKE2b-256 checksum
How to use checksums
9f3563269efb7c73badfed1c01aeb32a5dac9974a38eda62a23fde9fa2f60760
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

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

Download URL logspine-0.1.0-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
333695e1c81ca1f17d9510824b1dd2bc72aee8ec4e29bec02cf864839b7ac5bc
BLAKE2b-256 checksum
How to use checksums
c55b21805e74d81fe25de820ed28032ca4a9a572391e51ab552a2437aee42336
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Security for logspine 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