API Reference

February 24, 2026 · View on GitHub

WaveGuard Client

Constructor

from waveguard import WaveGuard

wg = WaveGuard(
    api_key="YOUR_KEY",
    base_url="https://gpartin--waveguard-api-fastapi-app.modal.run",  # default
    timeout=120.0,  # seconds
)
ParameterTypeDefaultDescription
api_keystr(required)Your WaveGuard API key
base_urlstrProduction URLAPI endpoint
timeoutfloat120.0Request timeout in seconds

wg.scan(training, test, encoder_type=None, sensitivity=None)

The only method you need. Sends training + test data in one call, returns anomaly scores.

result = wg.scan(
    training=[{"cpu": 45}, {"cpu": 48}, {"cpu": 42}],
    test=[{"cpu": 46}, {"cpu": 99}],
    sensitivity=1.0,
)
ParameterTypeDefaultDescription
traininglist(required)2+ examples of normal data
testlist(required)1+ samples to check
encoder_typestrNone (auto)Force: "json", "numeric", "text", "timeseries", "tabular"
sensitivityfloatNone (1.0)0.5–3.0. Lower = more sensitive

Returns: ScanResult


wg.health()

Check API status and GPU availability. No authentication required.

health = wg.health()
print(health.status, health.gpu)

Returns: HealthStatus


wg.tier()

Get current subscription tier and rate limits.

tier = wg.tier()
print(tier.tier, tier.limits)

Returns: TierInfo


Response Types

ScanResult

AttributeTypeDescription
resultslist[SampleResult]One entry per test sample, in order
summaryScanSummaryAggregate statistics
rawdictFull JSON response

SampleResult

AttributeTypeDescription
scorefloatAnomaly score (0 = normal, higher = more anomalous)
is_anomalyboolWhether this sample is flagged
thresholdfloatScore threshold for flagging
mahalanobis_distancefloatStatistical distance from training distribution
confidencefloat0.0–1.0 confidence in the anomaly call
top_featureslist[FeatureInfo]Top dimensions driving the score
latency_msfloatPer-sample processing time
engineEngineInfoPhysics engine config used
rawdictRaw JSON for this sample

ScanSummary

AttributeTypeDescription
total_test_samplesintNumber of test samples
total_training_samplesintNumber of training samples
anomalies_foundintCount of flagged anomalies
anomaly_ratefloatFraction flagged
mean_scorefloatAverage anomaly score
max_scorefloatHighest anomaly score
total_latency_msfloatTotal scan wall-clock time
encoder_typestrEncoder used (auto-detected or specified)

FeatureInfo

AttributeTypeDescription
dimensionintIndex into the fingerprint vector
labelstrHuman-readable label (e.g. "kurt_E", "skew_chi")
z_scorefloatStandard deviations from training mean

EngineInfo

AttributeTypeDescription
grid_sizeintLattice size (N in N×N×N)
evolution_stepsintWave evolution steps per sample
fingerprint_dimsintFingerprint vector dimensionality

HealthStatus

AttributeTypeDescription
statusstr"healthy" or error state
versionstrAPI version
gpustrGPU info (e.g. "T4")
modestrRunning mode
uptime_secondsfloatServer uptime

TierInfo

AttributeTypeDescription
tierstr"BASIC", "PRO", "ULTRA", or "MEGA"
limitsdictmax_training_samples, max_test_samples, rate_limit_per_min

Exceptions

All exceptions inherit from WaveGuardError:

from waveguard import WaveGuardError, AuthenticationError, ValidationError, RateLimitError, ServerError
ExceptionHTTP CodeWhen
AuthenticationError401Invalid or missing API key
ValidationError422Bad request data
RateLimitError429Rate or tier limit exceeded
ServerError5xxTransient server errors
WaveGuardErroranyCatch-all base class

Each exception has .message, .status_code, and .detail attributes.


REST API (Direct HTTP)

If you prefer raw HTTP calls:

POST /v1/scan

curl -X POST https://gpartin--waveguard-api-fastapi-app.modal.run/v1/scan \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your-key" \
  -d '{
    "training": [{"cpu": 45}, {"cpu": 48}, {"cpu": 42}],
    "test": [{"cpu": 46}, {"cpu": 99}]
  }'

GET /v1/health

curl https://gpartin--waveguard-api-fastapi-app.modal.run/v1/health

GET /v1/tier

curl -H "X-API-Key: your-key" \
  https://gpartin--waveguard-api-fastapi-app.modal.run/v1/tier

Interactive Docs

Full Swagger UI: https://gpartin--waveguard-api-fastapi-app.modal.run/docs