Zero-config monitoring for LLM APIs
Project description
PluvianAI Python SDK
Zero-config monitoring for LLM APIs. Automatically track all your OpenAI, Anthropic, and other LLM API calls without changing your code.
Installation
pip install pluvianai
Quick Start
Zero-Config Setup (Recommended)
import pluvianai
# Initialize with environment variables
pluvianai.init()
# That's it! All OpenAI calls are now automatically monitored
from openai import OpenAI
client = OpenAI()
response = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": "Hello!"}]
)
Environment Variables
Set these environment variables:
export PLUVIANAI_API_KEY="your-api-key"
export PLUVIANAI_PROJECT_ID="123"
export PLUVIANAI_API_URL="https://api.pluvianai.com" # Optional
export PLUVIANAI_AGENT_NAME="my-agent" # Optional
Manual Initialization
import pluvianai
pluvianai.init(
api_key="your-api-key",
project_id=123,
agent_name="my-agent"
)
Agent Chain Tracking
To track a chain of API calls that belong to the same workflow:
import pluvianai
from openai import OpenAI
pluvianai.init()
client = OpenAI()
# Use context manager to group related calls into a chain
with pluvianai.chain("user-query-123", agent_name="data-collector"):
# All calls within this block will have the same chain_id
response1 = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": "Collect data"}]
)
response2 = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": "Analyze data"}]
)
# Both calls will be grouped under chain_id="user-query-123"
# You can view them in the Agent Chains page
Manual Tracking
If you prefer to track calls manually:
import pluvianai
import time
start_time = time.time()
# ... make your API call ...
latency_ms = (time.time() - start_time) * 1000
pluvianai.track_call(
request_data={"model": "gpt-4", "messages": [...]},
response_data={"choices": [...]},
latency_ms=latency_ms,
status_code=200,
agent_name="my-agent",
chain_id="user-query-123" # Optional: group related calls
)
Features
- Zero-config: Automatically patches OpenAI SDK
- Non-blocking: Doesn't slow down your application
- Error handling: Gracefully handles failures
- Agent tracking: Track different agents in your system
Tool calls & workflow structure (optional)
The zero-config patching focuses on LLM API calls (requests/responses, latency, tokens/cost when available).
If you want PluvianAI to reliably validate tool usage policies across any framework (custom tools, LangChain, n8n-style workflows, HTTP/DB/Slack/email actions) — especially tool results and strict ordering — you may need to add lightweight, explicit instrumentation in your code (for example, wrapping tool execution or emitting tool events).
This is intentional: tool execution typically happens outside the LLM client, so it cannot always be inferred from LLM API traffic alone.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pluvianai-0.1.0.tar.gz.
File metadata
- Download URL: pluvianai-0.1.0.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a57fa22579a93b208a4edf20bed90b9705d6b3486acb9babf738a640b361681c
|
|
| MD5 |
52248c3834f43e5443d3dab5755314e3
|
|
| BLAKE2b-256 |
c2f9150c80ec69ca62bc7ad70186cba6c7d3a14398cad19e4c858263e804850b
|
File details
Details for the file pluvianai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pluvianai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
184412a75df9a9890947406c3785c57ced6e411ff63add06cf42b72da11e24e1
|
|
| MD5 |
28e328931079f4fd1747be23b5d3e62d
|
|
| BLAKE2b-256 |
f1f0877b325c618cac3be7f4786753bbad62e1fdb4cb277b4a9739312434593a
|