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.
| Method | Path | Auth | Purpose |
|---|---|---|---|
| GET | /health | none | Liveness check |
| GET | /plans | none | Plan matrix |
| POST | /scan/pulse | any key | Pulse detector — fast |
| POST | /scan/sonar | sonar feature | Sonar detector — deep ensemble |
| POST | /sanitize | any key | Sanitize + 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
| 400 | Empty upload |
| 401 | Missing / invalid / revoked key |
| 403 | Plan does not include this detector |
| 413 | File too large or audio too long |
| 415 | Unsupported or corrupt audio format |
| 429 | Rate limit or monthly quota exceeded |
The SDK raises AuthenticationError, PlanError, QuotaExceededError, or SubphaseError accordingly.
Plans & limits
| Plan | Price | Scans / mo | Rate | Detectors |
|---|---|---|---|---|
| Free | $0 | 1,000 | 10/min | Heuristic |
| Developer | $49 | 5,000 | 60/min | + CNN |
| Pro | $199 | 10,000 | 300/min | + CNN |
| Enterprise | Custom | Unlimited | Custom | + CNN |
The CNN detector is in beta.