Metadata-Version: 2.4
Name: logspine
Version: 0.1.0
Summary: Drop-in observability for AI agents — Python SDK
Project-URL: Homepage, https://www.logspine.dev
Project-URL: Documentation, https://www.logspine.dev/docs
Project-URL: Repository, https://github.com/logspine-dev/logspine
Author-email: Adam Kallen <hello@logspine.dev>
License: MIT
License-File: LICENSE
Requires-Python: >=3.9
Provides-Extra: anthropic
Requires-Dist: anthropic>=0.25.0; extra == 'anthropic'
Provides-Extra: openai
Requires-Dist: openai>=1.0.0; extra == 'openai'
Description-Content-Type: text/markdown

# 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](https://www.logspine.dev/docs)

---

## Install

```bash
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

```python
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

```python
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:

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

---

## Links

- [Docs](https://www.logspine.dev/docs)
- [Dashboard](https://www.logspine.dev/dashboard)
- [Pricing](https://www.logspine.dev/pricing)
- [GitHub](https://github.com/logspine-dev/logspine)
