OpenAnchor
See every LLM request. Track costs, latency, and quality in real-time.
Sit between your app and LLM providers. Observe token usage, latency, cost, and execution metrics for every request. Identify optimization opportunities before they become expensive problems.
30-Second Start
from openanchor import Observer
# Wrap your LLM client (any provider)
with Observer() as observer:
response = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": "Hello"}]
)
# Instant metrics
print(f"Cost: ${observer.cost:.4f}")
print(f"Tokens: {observer.tokens}")
print(f"Latency: {observer.latency_ms}ms")
Why OpenAnchor?
The Problem:
- You don't know how much you're spending on LLMs
- Latency spikes go unnoticed until users complain
- No visibility into which prompts are expensive
- Cost optimization is guesswork
The Solution:
- Transparent observation of every LLM request
- Real-time cost tracking across all providers
- Latency analysis and bottleneck detection
- Automatic optimization recommendations
Key Features
- Real-Time Metrics: Cost, tokens, latency, model, provider
- Multi-Provider: Claude, GPT-4, Gemini, Llama, custom APIs
- Cost Attribution: See exactly which features cost the most
- Telemetry Export: Send to Datadog, Prometheus, cloud observability platforms
- Alerts: Notify when costs exceed thresholds
- Quality Metrics: Track accuracy, token efficiency, response quality
- Historical Analysis: Trends over time
Real-World Use Cases
Monitor Costs:
with Observer() as observer:
for i in range(100):
response = client.chat(prompt)
daily_cost = observer.total_cost
print(f"Daily LLM spending: ${daily_cost:.2f}")
if daily_cost > 100:
alert("LLM costs spiking!")
Optimize Prompts:
# Test different approaches
results = []
for prompt_version in [v1, v2, v3]:
with Observer() as obs:
response = client.chat(prompt_version)
results.append({
"version": prompt_version,
"cost": obs.cost,
"tokens": obs.tokens,
"quality": evaluate(response)
})
# v2 is cheapest and best
best = min(results, key=lambda x: x['cost'])
Detect Problems:
with Observer() as observer:
for req in requests:
observer.track(req)
# Latency spiked?
if observer.p99_latency > 2000:
print("Provider degradation detected")
Metrics Collected
| Metric | Type | Example |
|---|---|---|
| Cost | USD | $0.012 |
| Tokens | Count | 245 input, 43 output |
| Latency | ms | 245ms |
| Model | String | gpt-4-turbo |
| Provider | String | openai |
| Quality | Score | 0.95 |
Installation
pip install openanchor
# or with uv
uv pip install openanchor
Documentation
- Quick Start — Add observation to your app
- Providers — Supported LLM APIs
- Metrics — What's tracked and how
- Telemetry — Export to monitoring platforms
- Examples — Real-world setups
License
Proprietary License - Free to use with explicit attribution. See LICENSE.
OpenAnchor v2.0.0 | LLM observability | Python 3.10+ | 25 tests passing
License
MIT
MCP 2.0 Mega-Platform | v2.0.0 | Wheels-Only Distribution
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 openanchor-0.5.0.tar.gz.
File metadata
- Download URL: openanchor-0.5.0.tar.gz
- Upload date:
- Size: 42.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa90cb58ce16cbcf80bf7d8034d4599b8c3a971cfb26fa52c19a81e224f1e8c2
|
|
| MD5 |
56ab204fcdd82f540c48a47f5656edfe
|
|
| BLAKE2b-256 |
a5eb1e02c944510f6682d77940520b63e8a42c30b516474ea7ad73670660e211
|
File details
Details for the file openanchor-0.5.0-py3-none-any.whl.
File metadata
- Download URL: openanchor-0.5.0-py3-none-any.whl
- Upload date:
- Size: 37.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
216e1cccd12b5f93ece1535860eadc81e1994ef85b6dc90e03d327dfe977e3d6
|
|
| MD5 |
6be0a5cc06bfa4e463d429d2edbdb510
|
|
| BLAKE2b-256 |
917a83c337ca1db7dc28e214607f36a103531ae91177fb33ff0a76a05bad95b0
|