Documentation/Core Concepts/Profit Margins & Sane Defaults

Profit Margins & Sane Defaults

*"Don't just show me what OpenAI charges me. Make sure I pocket a 50% profit margin on every single question."*

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:

typescript
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:

typescript
pricing: {
minimumChargeUSD: 0.01 // Every call is at least 1ยข
}
Page 6 of 15