Metadata-Version: 2.4
Name: reliably-sdk
Version: 0.1.1
Summary: Privacy-preserving third-party API benchmarks — wrap typed SDKs (`wrap`) or opt-in HTTP taps (`monitor`) for aggregate latency & errors from anonymous production traffic.
Project-URL: Homepage, https://reliably.sh
Project-URL: Repository, https://github.com/ZurabWeb/reliably
Project-URL: Documentation, https://reliably.sh/setup
License-Expression: MIT
Keywords: api,benchmarks,monitoring,observability,openai,reliability,saas,stripe,third-party
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: System :: Monitoring
Requires-Python: >=3.9
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == 'dev'
Description-Content-Type: text/markdown

# `reliably-sdk` · Python telemetry for third-party SaaS latency

Pipe **real production calls**—OpenAI-compatible hosts, Postgres-as-a-Service, SMS carriers—into **shared benchmarks**. **`reliably.wrap()`** fingerprints popular clients; **`reliably.monitor()`** swaps light hooks on outbound urllib stacks so ingest can correlate hostnames with its registry.

**Privacy:** hashed project namespaces, pathname-only outbound endpoints, batched HTTPS posts. **Bodies and secrets stay local.**

**Operational fit:** ships with Python stdlib for transports; timers flush asynchronously so FastAPI/worker processes keep their existing flow.

```bash
pip install reliably-sdk
```

## Quick Start

```python
from reliably import reliably

# Wrap any API client — zero config, no signup required
stripe = reliably.wrap(stripe.StripeClient(os.environ["STRIPE_KEY"]))
openai_client = reliably.wrap(OpenAI(api_key=os.environ["OPENAI_KEY"]))

# Use them exactly as before
charge = stripe.charges.create(amount=2000, currency="usd")
completion = openai_client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello"}]
)
```

## With Project ID

```python
from reliably import Reliably

r = Reliably(project_id="proj_xxx")
stripe = r.wrap(stripe_client)
```

## What Gets Tracked

**`wrap()`:** provider id from fingerprint, method-chain endpoint, status, latency, `resolution: wrap`.

**`monitor()`:** outbound **hostname** and pathname-only endpoint; **ingest** maps host → provider and `registry` / `fallback`. Call `reliably.monitor(...)`.

**Never sent:** bodies, auth/cookie secrets, or full URLs with query strings.

## Configuration

```python
from reliably import Reliably

r = Reliably(
    project_id="proj_xxx",       # Optional
    endpoint="https://...",      # Custom ingest (self-hosted)
    flush_interval=30.0,         # Seconds between flushes
    max_batch_size=100,          # Max events before flush
    enabled=True,                # Disable in tests
    debug=False,                 # Print events to console
)
```

## Design Principles

- Zero dependencies (stdlib only)
- Never crashes your app
- Async telemetry (background thread)
- Fire and forget — if ingest is down, your app doesn't notice

## License

MIT
