---
name: monetize-anything
description: Universal polymorphic monetization compiler turning GitHub repos, Python scripts (AST), Node/Shell CLIs, HuggingFace/HTTP model APIs, CSV/JSON datasets, and bare MCP servers into paid OpenAPI 3.1 + /mcp + Creem prepaid + 0% treg hub servers. Zero Prompt & Trace Resale Guarantee.
---

# Monetize-Anything (`monetize.fastmesh.dev`) — Flat Agent Capability Manual

> Independent alternative; not affiliated with or endorsed by RapidAPI, Apify, Replicate, HuggingFace, Modal, Fal.ai, Zuplo, AWS Marketplace, ConvertAPI, Firecrawl, Diffbot, GitGuardian, dbt Cloud, Codacy, or any other vendor benchmarked here.

## Endpoints & Identity

- **Public Base URL**: `https://monetize.fastmesh.dev` (local upstream `http://127.0.0.1:8921`)
- **Health & Cache Telemetry**: `GET https://monetize.fastmesh.dev/health`
- **OpenAPI 3.1 Schema**: `GET https://monetize.fastmesh.dev/openapi.json`
- **Inspect Target (6 Polymorphic Forms)**: `POST https://monetize.fastmesh.dev/v1/inspect`
- **Compile Standalone Paid Server Bundle**: `POST https://monetize.fastmesh.dev/v1/compile`
- **Simulate WAL Metering / Cache / BYOK / Budget Cap**: `POST https://monetize.fastmesh.dev/v1/meter/simulate`
- **API Keys & Wallet Top-Up / Caps**: `POST https://monetize.fastmesh.dev/v1/keys`
- **Write-Only BYOK Vault**: `POST https://monetize.fastmesh.dev/v1/byok`
- **Creem HMAC-SHA256 Webhook**: `POST https://monetize.fastmesh.dev/webhooks/creem` (alias `/v1/webhooks/creem`)
- **Remote Streamable MCP (JSON-RPC 2.0)**: `POST https://monetize.fastmesh.dev/mcp`
- **treg hub 0% Commission Slug**: `monetize-anything` (`0%` platform fee; `$0.25`/compile)
- **Causal Bazaar Public Hand ID**: `b01_monetize_anything_compiler_v1` (`is_public=1`, `$0.25`/compile)
- **Prepaid Creem Packs**: Starter `$19` (`2,500` credits) | Pro `$79` (`15,000` credits) | Agency `$249` (`65,000` credits) — 0 seat tax, 0 sales calls, Creem MoR `3.9% + $0.40`

## Hard Trust, Security & Billing Invariants

1. **Zero Prompt & Call-Trace Resale Guarantee**: Source code, schemas, datasets, prompts, and call traces are never sold or licensed to third-party model labs.
2. **`$0.00` Charge on Empty / Error / Fake-200 / HTTP 422**: Invalid requests return unbilled `HTTP 422`; empty results, non-zero CLI exits, and soft fake-200 errors bill strictly `$0.00`.
3. **Atomic SQLite WAL Prepaid Ledger**: `BEGIN IMMEDIATE` with `CHECK(balance_micros >= 0)` prevents concurrent overspend; Creem webhooks enforce constant-time HMAC-SHA256 verification (`HTTP 401` on invalid signature) and `event_id` replay idempotency.
4. **Cross-Tenant Verified-Hit `ArchiveCache` (7d-30d Adaptive TTL)**: New tenants pay `100%` on verified cached hits (`$0.00` upstream cost); returning same-tenant hits pay `10%`.
5. **Strict Security Guardrails**: SSRF blocklist (`127.0.0.0/8`, RFC1918, `169.254.169.254`, `::1`, non-HTTP/HTTPS), path traversal rejection (`..`, null bytes), `shell=False` argv execution, and permissive OSS license check (MIT, Apache-2.0, BSD, ISC, MPL, CC0, Unlicense, ODC-PDDL-1.0, self-authored).

---

## 1. Inspect Any of 6 Target Types (`POST /v1/inspect`)

Supported `target_kind` values: `github_repo`, `python_ast`, `cli_tool`, `hf_http_api`, `dataset`, `mcp_server` (or `auto`).

```bash
# Example A: Public GitHub repository (microsoft/markitdown, MIT, 199,296 stars)
curl -fsSL -X POST "https://monetize.fastmesh.dev/v1/inspect" \
  -H "Content-Type: application/json" \
  -d '{"target_kind":"github_repo","repo_url":"https://github.com/microsoft/markitdown"}'

# Example B: Python script via safe AST inspection (never calls exec())
curl -fsSL -X POST "https://monetize.fastmesh.dev/v1/inspect" \
  -H "Content-Type: application/json" \
  -d '{"target_kind":"python_ast","source_code":"def validate_e164_phone(raw_number: str, default_region: str = \"US\") -> dict:\n    \"\"\"Validate E.164 phone format.\"\"\"\n    digits = \"\".join(c for c in raw_number if c.isdigit())\n    return {\"valid\": len(digits) >= 10, \"e164\": \"+\" + digits}"}'

# Example C: CSV dataset schema inference (WCO Harmonized System HS codes)
curl -fsSL -X POST "https://monetize.fastmesh.dev/v1/inspect" \
  -H "Content-Type: application/json" \
  -d '{"target_kind":"dataset","format":"csv","data":"section,hscode,description\nXVI,854231,Processors and controllers\nXVI,850440,Static converters"}'
```

---

## 2. Compile Full Standalone Paid Bundle (`POST /v1/compile`)

Emits standalone pure-stdlib `server.py`, `openapi.json`, `gateway_route.json`, 4-file `treg_hub/` merchant pack (`recipe.json`, `run.js`, `check.json`, `README.md`), `web/index.html`, and SHA-256 `manifest.json`.

```bash
curl -fsSL -X POST "https://monetize.fastmesh.dev/v1/compile" \
  -H "Content-Type: application/json" \
  -d '{
    "target_kind": "mcp_server",
    "tools": [
      {
        "name": "fetch",
        "description": "Fetch a URL and extract clean markdown",
        "inputSchema": {
          "type": "object",
          "properties": {"url": {"type": "string"}, "max_length": {"type": "integer"}},
          "required": ["url"]
        }
      }
    ],
    "subdomain": "fetch-mcp",
    "price_micros": 1000,
    "rate_limit_rpm": 120
  }'
```

---

## 3. Simulate Prepaid Metering, ArchiveCache, BYOK & Budget Caps (`POST /v1/meter/simulate`)

```bash
curl -fsSL -X POST "https://monetize.fastmesh.dev/v1/meter/simulate" \
  -H "Content-Type: application/json" \
  -d '{
    "tenant_id": "agent_alpha",
    "capability": "wco_hs_lookup",
    "params": {"hscode": "854231"},
    "outcome_price_micros": 1000,
    "topup_micros": 19000000,
    "cap_micro_usd": 50000,
    "simulated_outcome": {"hscode": "854231", "description": "Electronic integrated circuits"}
  }'
```

---

## 4. Remote Streamable MCP (`POST /mcp`)

Exposes direct tools (`monetize_inspect`, `monetize_compile`, `monetize_meter_simulate`) plus flat `DualMcpFacade` discovery tools (`tools_search`, `tools_inspect`, `tools_execute`, `tools_poll_receipt`).

```bash
curl -fsSL -X POST "https://monetize.fastmesh.dev/mcp" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}'

curl -fsSL -X POST "https://monetize.fastmesh.dev/mcp" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}'

curl -fsSL -X POST "https://monetize.fastmesh.dev/mcp" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"monetize_inspect","arguments":{"target_kind":"dataset","format":"json","data":"[{\"name\":\"tsconfig.json\",\"fileMatch\":\"tsconfig*.json\"}]"}}}'
```

---

## 5. One-Line `treg hub` Usage (`0%` Commission)

```bash
treg call monetize-anything --data '{"target_kind":"github_repo","repo_url":"https://github.com/jqlang/jq"}'
```

- Empty or failed calls automatically settle at `$0.00` inside `treg_hub/run.js`.
- Internal upstream traces are redacted automatically before responses return to the caller.
