Docs

Documentation

Subphase detects adversarial audio attacks. Use the Python SDK or call the REST API directly. All detection runs on Subphase's servers; a key is required for every scan.

Quickstart

pip install subphase
from subphase import Subphase

client = Subphase(api_key="sk_dev_...")     # or set SUBPHASE_API_KEY
result = client.scan("voice-note.wav")       # pulse — free
print(result["status"])                      # "clean" or "threat"

# Sonar — higher accuracy (Developer+ plan):
result = client.scan("voice-note.wav", model="sonar")

Authentication

Every scan requires an API key. Get a free key at subphase / pricing. Pass it directly or via environment variable. Keys are shown once — store them securely.

# Header (REST):
Authorization: Bearer sk_dev_...
# or:  X-API-Key: sk_dev_...

# Environment (SDK):
export SUBPHASE_API_KEY="sk_dev_..."

REST API

Base URL https://subphase.ai/api. Scan endpoints take a multipart file field.

MethodPathAuthPurpose
GET/healthnoneLiveness check
GET/plansnonePlan matrix
POST/scan/pulseany keyPulse detector — fast
POST/scan/sonarsonar featureSonar detector — deep ensemble
POST/sanitizeany keySanitize + re-score
curl -X POST https://subphase.ai/api/scan/sonar \
  -H "Authorization: Bearer $SUBPHASE_API_KEY" \
  -F file=@voice-note.wav

Python SDK

Subphase(api_key=None, base_url=None, timeout=30.0)

scan(audio, model="pulse") → dict

  • audio — file path, http(s) URL, bytes, or a file-like object.
  • model — "pulse" (free) or "sonar" (Developer+).

Responses

{
  "status": "threat",            // or "clean"
  "confidence": 0.82,            // 0.0 - 1.0, two decimals
  "threat_type": "adversarial_perturbation",
  "latency_ms": 12.3,
  "model": "sonar",              // or "pulse"
  "plan": "developer",
  "quota_remaining": 998
}

Errors

400Empty upload
401Missing / invalid / revoked key
403Plan does not include this detector
413File too large or audio too long
415Unsupported or corrupt audio format
429Rate limit or monthly quota exceeded

The SDK raises AuthenticationError, PlanError, QuotaExceededError, or SubphaseError accordingly.

Plans & limits

PlanPriceScans / moRateDetectors
Free$01,00010/minHeuristic
Developer$495,00060/min+ CNN
Pro$19910,000300/min+ CNN
EnterpriseCustomUnlimitedCustom+ CNN

The CNN detector is in beta.