---
name: price-anything
description: Deterministic 5-domain microeconomics & pricing optimization engine (SaaS decoy tiers, AI credit packs, e-commerce OLS log-log elasticity & Lerner solver, Van Westendorp PSM / Gabor-Granger survey parser, and global PPP localization with anti-arbitrage floor). Invoke via HTTPS REST, JSON-RPC 2.0 MCP, or 0%-commission treg hub QuickJS recipe with strict $0 billing on HTTP 422 invalid inputs.
version: 1.0.0
homepage: https://price.fastmesh.dev
mcp_endpoint: https://price.fastmesh.dev/mcp
openapi_url: https://price.fastmesh.dev/openapi.json
---

# Price-Anything Agent Skill (`price.fastmesh.dev`)

Use **Price-Anything** whenever an engineering workflow, revenue-ops task, e-commerce repricer, or founder asks for deterministic, recomputable pricing optimization rather than heuristic guesswork.

## When to Invoke This Skill

1. **SaaS Subscription Tiering (`saas_tiers`)**: Designing 3-to-4 tier pricing grids, decoy anchor positioning, annual billing discounts, free-tier cannibalization audits, competitor pricing-page teardowns, or copy-paste HTML pricing cards.
2. **AI / API Credit Packs (`ai_credits`)**: Solving prepaid credit-pack ladders ($19/$79/$199 or custom), cache-hit adjusted COGS, conservative unused-balance breakage floors, and margin-safe metered overage rates.
3. **E-Commerce Elasticity & Promo Floors (`ecom_elasticity`)**: Fitting OLS log-log price elasticity (`epsilon`) from `(price, quantity)` history, computing Lerner-index optimal retail prices with inelastic/hyper-elastic caps, catching `COGS >= price` negative margins, or computing bundle / spend-$X-get-$Y-off profit floors.
4. **Willingness-to-Pay Surveys (`van_westendorp`)**: Parsing Van Westendorp CSV or JSON survey responses for exact piecewise-linear CDF intersections (`PMC`, `PME`, `OPP`, `IDP`) and optional Gabor-Granger revenue/profit curves.
5. **Global PPP Regional Pricing (`ppp_global`)**: Computing localized regional tiers across `US`, `EU`, `UK`, `JP`, `IN`, `BR`, `SEA` (and custom markets) combining PPP indices, competitor spread, COGS margin floor, and anti-arbitrage VPN floors.
6. **Multi-SKU Concurrent Batch (`POST /api/v1/batch`)**: Auditing or repricing dozens to hundreds of SKUs concurrently under a hard `max_budget_micros` spend lock.

## Safety & Billing Invariants

- **Strict `$0` Charge on Invalid Input**: Any negative price, negative COGS, empty array, `NaN`/`Inf`, missing required field, malformed JSON, or unsupported domain returns HTTP `422` with:
  ```json
  {"ok": false, "billable": false, "charged_micros": 0, "error": "..."}
  ```
- **Hard Spend Cap**: Pass `max_budget_micros` on batch calls (or `X-Max-Cost-Micros` on treg hub / API calls) so automated agent loops can never exceed authorized spend.
- **Cross-Tenant Cache Awareness**: Responses include `cache_hit: true|false` from the 7d-30d verified competitor benchmark cache.
- **Zero Data Resale**: Customer pricing inputs and survey datasets are never resold or used to train third-party models.

## Option A: Native JSON-RPC 2.0 MCP Connection

Point any MCP-compatible client at `https://price.fastmesh.dev/mcp` (streamable HTTP JSON-RPC 2.0):

```bash
# 1. Initialize MCP session
curl -sS -X POST https://price.fastmesh.dev/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"agent","version":"1.0"}}}'

# 2. List all 7 pricing tools
curl -sS -X POST https://price.fastmesh.dev/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}'

# 3. Call a domain pricing tool
curl -sS -X POST https://price.fastmesh.dev/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 3,
    "method": "tools/call",
    "params": {
      "name": "price_optimize_ppp_global",
      "arguments": {
        "base_price_usd": 79.0,
        "unit_cogs": 8.0,
        "anti_arbitrage_floor_ratio": 0.40,
        "markets": ["US", "EU", "UK", "JP", "IN", "BR", "SEA"]
      }
    }
  }'
```

Available MCP tool names:
- `price_optimize` (polymorphic)
- `price_optimize_saas_tiers`
- `price_optimize_ai_credits`
- `price_optimize_ecom_elasticity`
- `price_optimize_van_westendorp`
- `price_optimize_ppp_global`
- `price_optimize_batch`

## Option B: Direct HTTPS REST Examples (All 5 Domains + Batch)

### 1. SaaS Decoy Tier & Annual Discount Optimizer (`saas_tiers`)

```bash
curl -sS -X POST https://price.fastmesh.dev/api/v1/optimize \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "saas_tiers",
    "unit_cogs": 9.5,
    "competitor_price": 79.0,
    "competitor_json": [
      {"name": "Free", "price": 0, "users": 4000, "cogs": 0.6},
      {"name": "Starter", "price": 29, "users": 420, "cogs": 4.2},
      {"name": "Pro", "price": 79, "users": 180, "cogs": 9.5}
    ],
    "current_annual_discount_pct": 18,
    "monthly_churn_rate": 0.045,
    "target_tiers": 4
  }'
```

### 2. AI / API Prepaid Credit-Pack Bundler (`ai_credits`)

```bash
curl -sS -X POST https://price.fastmesh.dev/api/v1/optimize \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "ai_credits",
    "cogs_per_call": 0.0045,
    "cache_hit_rate": 0.35,
    "cache_overhead_per_call": 0.0004,
    "target_margin": 0.85,
    "user_distributions": [
      {"name": "light", "monthly_calls": 350, "share": 0.55},
      {"name": "medium", "monthly_calls": 2200, "share": 0.35},
      {"name": "heavy", "monthly_calls": 8000, "share": 0.10}
    ],
    "breakage_bounds": {"min": 0.0, "max": 0.20},
    "breakage_rate": 0.10,
    "pack_prices": [19, 79, 199]
  }'
```

### 3. E-Commerce OLS Log-Log Elasticity & Lerner Solver (`ecom_elasticity`)

```bash
curl -sS -X POST https://price.fastmesh.dev/api/v1/optimize \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "ecom_elasticity",
    "unit_cogs": 12.5,
    "current_price": 24.0,
    "observations": [
      {"price": 20.0, "quantity": 1250},
      {"price": 24.0, "quantity": 910},
      {"price": 28.0, "quantity": 680},
      {"price": 32.0, "quantity": 520},
      {"price": 36.0, "quantity": 415}
    ],
    "promo_threshold": {"spend": 100.0, "discount": 20.0},
    "bundle_size": 3,
    "bundle_discount_pct": 15.0
  }'
```

### 4. Van Westendorp PSM & Gabor-Granger Survey Parser (`van_westendorp`)

```bash
curl -sS -X POST https://price.fastmesh.dev/api/v1/optimize \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "van_westendorp",
    "unit_cogs": 12.0,
    "responses": [
      {"too_cheap": 15, "cheap": 29, "expensive": 65, "too_expensive": 95},
      {"too_cheap": 20, "cheap": 39, "expensive": 79, "too_expensive": 119},
      {"too_cheap": 29, "cheap": 49, "expensive": 89, "too_expensive": 135},
      {"too_cheap": 35, "cheap": 59, "expensive": 99, "too_expensive": 159},
      {"too_cheap": 45, "cheap": 69, "expensive": 119, "too_expensive": 179}
    ],
    "gabor_granger": [
      {"price": 29, "buy_probability": 0.78},
      {"price": 59, "buy_probability": 0.54},
      {"price": 79, "buy_probability": 0.45},
      {"price": 99, "buy_probability": 0.34}
    ]
  }'
```

### 5. Global PPP Regional Pricing Matrix (`ppp_global`)

```bash
curl -sS -X POST https://price.fastmesh.dev/api/v1/optimize \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "ppp_global",
    "base_price_usd": 79.0,
    "unit_cogs": 8.0,
    "anti_arbitrage_floor_ratio": 0.40,
    "markets": ["US", "EU", "UK", "JP", "IN", "BR", "SEA"]
  }'
```

### 6. Concurrent Multi-SKU Batch Optimization (`POST /api/v1/batch`)

```bash
curl -sS -X POST https://price.fastmesh.dev/api/v1/batch \
  -H "Content-Type: application/json" \
  -d '{
    "max_budget_micros": 1000000,
    "items": [
      {
        "domain": "ecom_elasticity",
        "unit_cogs": 12.0,
        "current_price": 25.0,
        "observations": [{"price": 20, "quantity": 500}, {"price": 30, "quantity": 240}]
      },
      {
        "domain": "ppp_global",
        "base_price_usd": 49.0,
        "unit_cogs": 5.0,
        "markets": ["US", "EU", "UK", "JP", "IN", "BR", "SEA"]
      }
    ]
  }'
```

## Option C: `treg hub` 0%-Commission QuickJS Tool

```bash
treg call price-anything \
  --data '{"domain":"ppp_global","payload":"{\"base_price_usd\":79,\"unit_cogs\":8,\"markets\":[\"US\",\"EU\",\"UK\",\"JP\",\"IN\",\"BR\",\"SEA\"]}"}'
```

## Prepaid Credit Packs & Balance Verification

- Starter (`price_anything_starter_19`): `$19` for 100 non-expiring credits (`$0.19`/credit)
- Growth (`price_anything_growth_79`, Recommended): `$79` for 600 non-expiring credits (`$0.1317`/credit)
- Scale (`price_anything_scale_199`): `$199` for 2,000 non-expiring credits (`$0.0995`/credit)
- Check live balance: `GET https://price.fastmesh.dev/api/v1/credits/balance?tenant_id=<id>`
- Create Creem checkout session: `POST https://price.fastmesh.dev/api/v1/checkout` with `{"sku_id": "price_anything_growth_79", "tenant_id": "<id>"}`

## Handling Errors Cleanly

- If HTTP `422` is returned (`ok: false`, `billable: false`, `charged_micros: 0`), inspect the `error` field, fix missing/negative fields, and retry safely — zero credits were consumed.
- If `warnings` contains negative-margin or boundary-cap flags (e.g., `COGS >= price` or inelastic `|epsilon| <= 1`), surface those warnings directly to the human operator before applying any live catalog price change.
