Zero Charge on Empty API Response & Fake-200 Billing Guard
Across RapidAPI, Apify, and Zuplo, an HTTP 200 carrying an empty array, a Cloudflare challenge shell, or a soft rate-limit JSON message still deducts buyer quota or Compute Units. Monetize-Anything integrates steel_core_4's normalize_and_validate_inputs and detect_fake_200 into every compiled endpoint so malformed inputs return unbilled HTTP 422 and empty or fake-200 outcomes bill strictly $0.00. Verified in our live adversarial Gauntlet (16/16 real non-mocked heterogeneous cases passing in 13546.33 ms total, median 305.8 ms, plus 34/34 unit tests under python3 -W default with 0 warnings).
HTTP 422, and empty or fake-200 errors bill strictly $0.00.
Deterministic Architecture & Billing Invariants
normalize_and_validate_inputs rejects garbage placeholders ('N/A', empty strings, malformed URLs) with unbilled HTTP 422 before execution. Post-execution, detect_fake_200 scans response status codes, empty structures, and soft-block signatures, skipping the SQLite WAL debit and recording a $0.00 waiver receipt whenever output verification fails.
1-Source → 3-Channel Publishing: Every compiled target emits (1) a self-hosted Creem prepaid storefront + SQLite WAL gateway (3.9% + $0.40 MoR, $0/mo base), (2) a remote Streamable JSON-RPC 2.0 /mcp endpoint + Causal Bazaar public card (b01_monetize_anything_compiler_v1), and (3) a 4-file treg_hub/ merchant pack at 0% commission (treg call monetize-anything).
Data-Backed Comparison & Live Benchmarks
| Real-World Failure Mode | Legacy Marketplace / Gateway | Monetize-Anything Guard | Billed Amount |
|---|---|---|---|
| Malformed / Garbage Input ('N/A', bad URL) | Counts toward monthly quota | Unbilled HTTP 422 pre-execution reject | $0.00 |
| Zero-Row CSV/JSON Dataset Match | Billed full per-request price | Empty-result detector waives debit | $0.00 |
| HTTP 200 Soft-Block / Captcha / Rate-Limit | Billed as HTTP 200 success | detect_fake_200 intercepts & waives fee | $0.00 |
| Non-Zero CLI Exit / Corrupt Document | Billed on compute start | Post-verification debit skipped | $0.00 |
| Verified Non-Empty Output | Billed | Atomic WAL debit + SHA-256 receipt | Exact listed micro-USD |
Copy-Paste Integration Example
curl -fsSL -X POST "https://monetize.fastmesh.dev/v1/meter/simulate" \
-H "Content-Type: application/json" \
-d '{"tenant_id":"buyer_02","capability":"article_extract","params":{"url":"https://example.com/blocked"},"outcome_price_micros":1500,"topup_micros":1000000,"status_code":200,"raw_text":"{\"error\":\"rate limit exceeded\",\"content\":\"\"}"}'
Deterministic Output
{
"ok": true,
"fake_200_detected": true,
"charged_micros": 0,
"remaining_balance_micros": 1000000
}
Implementation Steps
- Reject junk inputs at HTTP 422 unbilled: Stop garbage parameters before touching compute or credits.
- Verify non-empty & non-fake-200 payload before debit: Run detect_fake_200 on every response prior to SQLite WAL debiting.
- Mirror $0 guard inside treg_hub/run.js: Invoke ctx.charge() strictly after verifying valid non-empty results.
Frequently Asked Questions
How do you stop malicious callers from abusing $0 empty queries?
Every endpoint applies a per-tenant token-bucket rate limiter (HTTP 429) ahead of execution so spam is throttled even when unbilled.
Does $0-on-empty apply to treg hub calls too?
Yes. Generated QuickJS treg_hub/run.js wrappers skip ctx.charge() on errors or empty results.
Can enterprise buyers audit unbilled vs billed calls?
Yes. Every response carries receipt_sha256, charged_micros, and explicit waiver status.
support@fastmesh.dev.