Skip to main content

sentrinode-llm

Drop-in observability for your LLM calls. Two lines, and every Anthropic / OpenAI request is traced with model, token usage, latency, finish reason, and computed USD cost — using the OpenTelemetry GenAI semantic conventions.

Install

pip install sentrinode-llm        # add [anthropic] and/or [openai] as needed

Use

import sentrinode_llm
sentrinode_llm.instrument()   # reads SENTRINODE_API_KEY + SENTRINODE_TENANT

import anthropic
client = anthropic.Anthropic()
client.messages.create(            # ← automatically traced
    model="claude-haiku-4-5-20251001",
    max_tokens=256,
    messages=[{"role": "user", "content": "hello"}],
)

That's it — no wrapping your calls, no decorators. The same works for OpenAI:

from openai import OpenAI
OpenAI().chat.completions.create(model="gpt-4o-mini", messages=[...])  # traced

Configure

Env var Meaning Default
SENTRINODE_API_KEY your tenant API key — (required)
SENTRINODE_TENANT your tenant slug — (required)
SENTRINODE_LLM_ENDPOINT ingest base URL https://api.sentrinode.com
SENTRINODE_SERVICE_NAME label for this app llm-app

Or pass them directly: sentrinode_llm.instrument(api_key=..., tenant=...).

What gets recorded

Each call becomes one OpenTelemetry span:

Attribute Example
gen_ai.system anthropic
gen_ai.request.model claude-haiku-4-5-20251001
gen_ai.usage.input_tokens 1432
gen_ai.usage.output_tokens 211
gen_ai.usage.cost_usd 0.002486
gen_ai.response.finish_reasons ["end_turn"]

Cost is computed from pricing.py. Override any model:

sentrinode_llm.set_price("my-model", input_per_1m=2.0, output_per_1m=8.0)

Not yet

  • Streaming responses pass through untraced (usage isn't known until the stream ends — coming next).
  • Async clients and embeddings — next iteration.

Metadata

Release files for sentrinode-llm 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 sentrinode-llm 0.1.0
File Size Uploaded
sentrinode_llm-0.1.0.tar.gz 7.6 kB Details

Built distribution (wheel)

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

Total release size: 15.6 kB

Release files / sentrinode_llm-0.1.0.tar.gz

Download URL sentrinode_llm-0.1.0.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d35e7e6e9b1939af600aeadedf2d28961b9faa2610a8e2f0a996d1a5e3d27e41
BLAKE2b-256 checksum
How to use checksums
3b52356fe02d0a70e124614c986ba015c4bfbcf135100f8661bf8807a6df4aa1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

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

Download URL sentrinode_llm-0.1.0-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d3045161c8e6e2733a597257eeed4a33305ce2625764b0cc4d4ea0941bb6041c
BLAKE2b-256 checksum
How to use checksums
d16b1bda62b3b905ba32da5376da146f91df75df2900ed8225d073f3c2581255
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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