Zero-overhead observability for LLM applications
Project description
Oximy Python SDK
Zero-overhead observability for LLM applications.
This library provides a lightweight wrapper for LLM client libraries that captures telemetry and enforces policies without blocking your application.
Full documentation is available at docs.oximy.com.
Installation
pip install oximy
Quick Start
from oximy import Oximy
from openai import OpenAI
oximy = Oximy(
api_key=os.getenv("OXIMY_API_KEY"),
project_id=os.getenv("OXIMY_PROJECT_ID"),
)
openai = oximy.wrap(OpenAI())
# Use exactly as before - telemetry is automatic
response = await openai.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello"}],
)
Configuration
oximy = Oximy(
# Required
api_key="ox_xxxxxxxx",
project_id="proj_xxxxxxxx",
# Optional
environment="production",
service="chat-api",
version="1.2.3",
metadata={"team": "platform"},
timeout=100,
debug=False,
# Policy violation callback
on_policy_violation=lambda violation: print(violation.rule_name, violation.action),
)
Per-Request Context
response = await openai.chat.completions.create(
{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Hello"}],
},
oximy={
"user_id": "user_123",
"session_id": "sess_456",
"trace_id": "trace_789",
"tags": ["support", "billing"],
"metadata": {"ticket_id": "TICKET-123"},
},
)
Provider Support
Works with any OpenAI-compatible client.
OpenAI
openai = oximy.wrap(OpenAI())
Anthropic
from anthropic import Anthropic
anthropic = oximy.wrap(Anthropic())
OpenRouter
openrouter = oximy.wrap(
OpenAI(
api_key=os.getenv("OPENROUTER_API_KEY"),
base_url="https://openrouter.ai/api/v1",
)
)
Azure OpenAI
azure = oximy.wrap(
OpenAI(
api_key=os.getenv("AZURE_OPENAI_KEY"),
base_url="https://your-resource.openai.azure.com/v1",
)
)
Groq
groq = oximy.wrap(
OpenAI(
api_key=os.getenv("GROQ_API_KEY"),
base_url="https://api.groq.com/openai/v1",
)
)
Streaming
Streaming is fully supported. Telemetry is sent after the stream completes.
stream = await openai.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Tell me a story"}],
stream=True,
)
async for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")
Captured Data
| Category | Data |
|---|---|
| Request | Model, messages, tools, parameters |
| Response | Content, finish reason, tool calls |
| Usage | Input tokens, output tokens, cached tokens |
| Cost | Estimated cost (USD) |
| Timing | Duration, time-to-first-token |
| Errors | Type, message, status code |
| Context | User ID, session ID, trace ID, tags |
Policy Enforcement
Policies are configured in the Oximy dashboard and enforced automatically. No code changes required.
Modes:
- Shadow - Log violations without blocking
- Quarantine - Log and alert, allow through
- Enforce - Block or redact violations
Local Rules (evaluated in SDK, < 5ms):
- Regex patterns (API keys, secrets)
- Deny/allow lists (models, keywords, MCP servers, tool calls)
- Contains matching (SQL injection patterns)
- Token limits
- Rate limits (per user/session/global)
- Cost limits (per user/session/global)
SLM Rules (evaluated via API, 50-200ms):
- AI-powered PII detection with pseudoanonymization
- Prompt injection detection
- Custom content classification
Fail-Open Design
The SDK never blocks your application:
- 100ms telemetry timeout
- Silent failure on network errors
- Zero runtime dependencies (except httpx)
- Falls back to enabled if config fetch fails
Requirements
- Python 3.12+
- httpx (for async HTTP requests)
Support
- Documentation: docs.oximy.com
- Email: support@oximy.com
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 oximy-0.0.2.tar.gz.
File metadata
- Download URL: oximy-0.0.2.tar.gz
- Upload date:
- Size: 40.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b10b6e93facb9342dbb82577e9b17b8c1955c604aa7402238110af6ce722c893
|
|
| MD5 |
beb22026777371112d72879cc3e46ed1
|
|
| BLAKE2b-256 |
a563b697cc71f058b9bba1eeef8e57e344b63525fe22362679ac8215f81da8c3
|
File details
Details for the file oximy-0.0.2-py3-none-any.whl.
File metadata
- Download URL: oximy-0.0.2-py3-none-any.whl
- Upload date:
- Size: 37.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
169334cf88922a32d6bd70ef3a20d7a8403b9bdb82be6226b83abd56d233db6f
|
|
| MD5 |
a01a1f8012f1d85222aa3d7031450868
|
|
| BLAKE2b-256 |
d909ab62952fd42a589747e42550b19bc47804eeb12619dc5bb1986ffda5d7da
|