Profit Margins & Sane Defaults
1-Line Profit Margin Engine
By default, billing tools calculate raw wholesale provider costs. VibezCheck lets you declare your desired profit margin in one line:
model: vibezcheck('openai/gpt--mini', { customer: 'sarah@acme.com', pricing: { margin: 1.5, // ๐ Automatically adds a 50% profit margin! minimumChargeUSD: 0.01, // ๐ Minimum charge 1 cent per question },})When this runs:
- โOpenAI Wholesale Cost: $0.0020
- โBilled to Customer: $0.0030 (via Stripe)
- โNet Profit: $0.0010 (50% margin)
The 6 Sane Defaults (Active by Default)
When you write vibezcheck('model'), six critical protections are active automatically:
1. ๐ก๏ธ $0.50 Safety Fuse Box: Automatically prevents runaway loops without requiring manual ceilings.
2. ๐ In-Flight Abort Trapper: Captures and bills partial tokens even if a user closes their browser tab mid-stream.
3. ๐ท๏ธ Automatic 85% Cache Discounts: Passes real prompt caching savings through to preserve true margins.
4. ๐ Serverless Lifecycle Protection: Automatically enqueues flushes via after() or waitUntil() so containers never freeze mid-billing.
5. ๐ Zero Double-Billing: Generates deterministic SHA-256 idempotency keys on every network event.
6. ๐ข Free Local Vibe Mode: Works locally with zero Stripe keys without crashing.
Minimum Charge Floor
Use minimumChargeUSD to round up tiny fractions of a cent so every interaction covers your payment processing minimums:
pricing: { minimumChargeUSD: 0.01 // Every call is at least 1ยข}