Test all standalone modules of @edwinfom/ai-guard directly in your browser — no API key required.

Interactive Playground

Run the standalone modules directly in your browser. All tests execute client-side — no API key, no network calls.

The tests below mirror the official smoke-test suite (smoke-test.mts) shipped with the package.

PII4 tests
○detectPII finds email
○detectPII finds French NIR
○redactPII replaces email
○redactPII custom replaceWith
Injection3 tests
○detects classic attack
○cumulative scoring — multiple patterns
○passes clean input
Schema Repair4 tests
○cleanMarkdown strips fences
○repairAndParse Level 1 — markdown
○repairAndParse Level 2 — trailing comma
○repairAndParse Level 2 — surrounding text
Budget5 tests
○calculateCost known model (gpt-4o-mini)
○calculateCost returns 0 for unknown model
○registerModelPricing — custom model
○buildUsage with real token counts
○new models — gemini-2.5-flash pricing
Canary3 tests
○generateCanaryToken is unique each call
○checkCanaryLeak detects leaked token
○checkCanaryLeak passes clean output
Content Policy2 tests
○flags violence
○passes clean text
Hallucination3 tests
○extractEntities filters trivial numbers
○suspects ungrounded entities
○passes grounded response

Click "Run All" to execute all tests in your browser.