PYTHON SDK
ModelLens SDK
Integrate model explainability into your Python workflows. Upload models, run analysis, and chat with Perun programmatically.
Installation
Requires Python 3.10+. The only dependency is httpx.
Quick start
Authentication
Three ways to authenticate:
Username & password
API key (recommended for automation)
Generate API keys from your account settings. Requires Pro plan or above.
Pre-existing JWT token
Upload & explore a model
Chat with your model
Built-in slash commands: /summary /features /rules /trust /risk /fairness
Predictions & analysis
Advanced analysis
spectral_analysis()
SVD-based weight matrix health metrics — stable rank, signal rank, neural collapse index
symbolic_rules()
Extract human-readable if-then decision rules via surrogate decision tree
model_genome()
7-component Weight DNA Fingerprint — a unique behavioural signature of your model
mechanistic_trace()
Layer-by-layer feature flow showing which neurons activate for a given input
h_statistic()
Friedman H-statistic for pairwise feature interactions
weight_diff()
Compare two model versions — weight changes, prediction drift, and summary
tcav_scores()
Concept activation vectors — how sensitive are hidden layers to high-level concepts?
tabcheck()
Automated behavioural test suite — generates and runs edge case tests
Error handling
Context manager
Requirements
Python 3.10+
Tested on 3.10, 3.11, 3.12
httpx
Only runtime dependency
Pro plan or above
API access requires a paid plan
Found a bug? Open an issue