<!-- Copyright (c) 2026 defconxt. All rights reserved. -->
<!-- Licensed under AGPL-3.0 — see LICENSE file for details. -->

# API Reference — Detecting Model Hallucination Exploitation

## PyPI Package Verification
```python
import requests

resp = requests.get("https://pypi.org/pypi/nonexistent-ai-helper/json", timeout=10)
if resp.status_code == 404:
    print("WARNING: Package does not exist — possible slopsquatting target")
```

## npm Package Verification
```python
import requests

resp = requests.get("https://registry.npmjs.org/fake-llm-utils", timeout=10)
exists = resp.status_code == 200
```

## CVE Verification
```python
import requests

resp = requests.get("https://cveawg.mitre.org/api/cve/CVE-2024-99999", timeout=10)
if resp.status_code != 200:
    print("WARNING: CVE does not exist — likely hallucinated")
```

## Groundedness Scoring
```python
import difflib

output_claims = output_text.split(".")
for claim in output_claims:
    ratio = difflib.SequenceMatcher(None, claim.lower(), reference.lower()).ratio()
    if ratio < 0.3:
        print(f"UNGROUNDED: {claim}")
```
