Apiris - Intelligent API Decision Framework
Apiris (Contextual API Decision Lens) is an intelligent SDK that provides real-time decision intelligence for API traffic. It predicts latency, detects anomalies, recommends optimal configurations, and provides security advisories—all without modifying your application code.
What is Apiris?
Apiris sits between your application and external APIs, observing request patterns and providing actionable intelligence:
- Predict API response times before making requests
- Detect anomalous behavior in real-time
- Optimize cost-performance tradeoffs automatically
- Advise on security vulnerabilities (CVE database for 47 API vendors with 65 real CVEs)
- Explain every decision with human-readable insights
Key Differentiators
- Zero Code Changes: Drop-in replacement for
requestslibrary - Offline First: All AI models run locally, no external dependencies
- Advisory Only: Never blocks requests, only provides intelligence
- Production Ready: Battle-tested across OpenAI, Anthropic, AWS, and 130+ API vendors
Quick Start
pip install apiris
from apiris import ApirisClient
client = ApirisClient()
response = client.get("https://api.openai.com/v1/models")
print(f"Latency: {response.cad_summary.predicted_latency}ms | Anomaly: {response.cad_summary.anomaly_score}")
Metrics Architecture
Apiris uses a 4-stage intelligence pipeline that processes every API request:
1. Latency Prediction (Exponential Smoothing + Linear Regression)
Metrics Tracked:
- Request payload size, time of day, day of week
- Historical latency patterns (EWMA)
- Endpoint complexity (path depth, query params)
Formula: predicted_latency = α × recent_avg + β × payload_size + γ × time_factor
Accuracy: 85-92% (MAE: 234ms, RMSE: 412ms)
2. Anomaly Detection (Isolation Forest + Statistical Thresholding)
Metrics Tracked:
- Latency deviation (z-score), status code patterns
- Payload size outliers (IQR), request frequency anomalies
Formula: anomaly_score = isolation_forest.score(features) × statistical_weight
Thresholds: < 0.3 Normal | 0.3-0.7 Suspicious | > 0.7 Anomalous
Performance: Precision 0.89, Recall 0.82, F1 0.85
3. Trade-off Analysis (Multi-Objective Pareto Optimization)
Metrics Tracked:
- Cost per request × volume, latency impact score
- Cache hit rate × cost savings, request priority
Formula: utility = w₁×(1-latency) + w₂×(1-cost) + w₃×cache_benefit
Recommendations: Retry strategy, timeout values, caching policy, rate limiting
4. CVE Advisory (Security Intelligence)
Metrics Tracked:
- CVE severity (CRITICAL/HIGH/MEDIUM/LOW), CVSS score (0-10)
- Publication date, affected versions
Coverage: 47 API vendors, 65 real vulnerabilities
Formula: risk = Σ(severity_weight × recency_factor) / max_possible
Feature Engineering
| Latency Prediction | Type | Calculation | Weight |
|---|---|---|---|
| Payload Size | Numeric | len(json.dumps(body)) |
0.25 |
| Recent Avg | Numeric | ewma(past_10_requests) |
0.35 |
| Hour of Day | Categorical | datetime.now().hour |
0.15 |
| Anomaly Detection | Type | Calculation | Weight |
|---|---|---|---|
| Latency Z-Score | Numeric | (latency - μ) / σ |
0.30 |
| Error Rate | Numeric | errors / total_requests |
0.25 |
| Payload Deviation | Numeric | abs(size - median) / IQR |
0.20 |
| Trade-off Optimization | Type | Calculation | Weight |
|---|---|---|---|
| Cost Impact | Numeric | request_cost × volume |
0.35 |
| Latency Impact | Numeric | (latency / sla_target)² |
0.30 |
| Cache Benefit | Numeric | hit_rate × cost_savings |
0.20 |
Architecture
Application → ApirisClient → Interceptor → [Predictive | Anomaly | Tradeoff] Models
↓
Decision Engine → [CVE Advisory | Cache | Storage]
↓
External APIs
Components:
client.py- Main interface, orchestrates pipelineinterceptor.py- Pre/post-request hooksdecision_engine.py- Aggregates intelligence, applies policiesai/predictive_model.py- EWMA + regression forecastingai/anomaly_model.py- Isolation Forest + z-score detectionai/tradeoff_model.py- Pareto cost-latency optimizationintelligence/cve_advisory.py- Offline vulnerability DBcache.py- TTL-based LRU cachingstorage/sqlite_store.py- Metrics persistence
Metrics Tracked
| Metric | Description | Format |
|---|---|---|
| Latency Percentiles | p50, p95, p99 response times | ms |
| Prediction Error | MAE, RMSE, R² accuracy | % |
| Anomaly Rate | False positive/negative detection | 0.0-1.0 |
| Cache Hit Rate | Cache effectiveness | % |
| Cost per Request | Estimated vendor cost | $ |
| Error Rate | HTTP 4xx/5xx trends | % |
Performance Overhead
| Operation | Latency | Impact |
|---|---|---|
| Request Intercept | 1.2ms | 0.1-0.5% |
| Cache Lookup | 0.3ms | <0.1% |
| Decision Engine | 2.5ms | 0.2-1.0% |
| Total | ~4ms | <2% typical API latency |
CLI Command Reference
Apiris provides a rich, unified terminal command-line interface with standardized risk color grading, factor trees, and diagnostic tools:
# 1. System Status & Verification
apiris version # Display version and banner
apiris status # Inspect runtime health and offline model assets
apiris doctor # CI-usable deep diagnostic check (config, models, CVE data)
# 2. Live API Health Evaluation
apiris check https://api.weather.gov # Live CAD triad analysis and risk verdict
apiris check https://api.openai.com/v1/models -v # Verbose evaluation with full factor tree
# 3. Decision Engine Benchmarks & Calibration
apiris benchmark # Run corpus benchmark with p50/p95 pipeline latency
apiris calibrate # Compute empirical threshold diff against traffic corpus
apiris calibrate --apply # Compute and write calibrated thresholds to config.yaml
apiris report --format md # Generate or refresh calibration report
# 4. Contextual Anomaly Models
apiris models list # List per-API models (Trained vs. Global Fallback)
apiris models train api.stripe.com -s data.json # Train per-API Isolation Forest from sample traffic
# 5. Drift Analysis & CVE Advisories
apiris drift api.payments.net --window 5 # Analyze temporal CAD reliability & schema drift
apiris cve ghost # Query offline CVE security advisory for vendor
apiris cve --list-vendors # List all 47 tracked vendors in CVE database
License
Apache 2.0 - See LICENSE
Made with care for developers who care about API performance and security
by Tarun
Release files for apiris 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| apiris-1.1.0.tar.gz | 99.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| apiris-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 202.2 kB
Release files / apiris-1.1.0.tar.gz
| Download URL | apiris-1.1.0.tar.gz |
|---|---|
| Size | 99.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
26ba46f5f8001089e4efb3bd1c40d9526f147ab06543036eed639203946d4b3b
|
|
BLAKE2b-256 checksum How to use checksums |
d0de79baa49aa00902fae5c9d942c7a644fe48e3d05f8a2d3093fdeaae8d53e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.7
|
Release files / apiris-1.1.0-py3-none-any.whl
| Download URL | apiris-1.1.0-py3-none-any.whl |
|---|---|
| Size | 103.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c9a3bc20bd6b790ae2bac1c95f965ab6f4b60914529a0bc8b61ec9ec3e225960
|
|
BLAKE2b-256 checksum How to use checksums |
575de1cad0428d3d8c039e42ac4089d96df10231524c55cbdf1bc460d58ae05f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.7
|