Pricing and Billing
OpenEdge uses prepaid balance and usage-based billing as the first commercial model. Paid services check balance before execution, record transactions, and refund failed work when appropriate.
Billing Principles
Commercial service calls must be explainable:
- Check whether the user can pay before work starts.
- Cap maximum loss during uncertain-cost operations.
- Settle the final cost after the call.
- Refund failed work.
- Write every charge and refund to the ledger.
- Keep usage logs tied to request IDs and service aliases.
Current Billing Building Blocks
| Building block | Purpose |
|---|---|
users.balance | Prepaid user balance. |
transactions | Ledger for charges, deposits, refunds, and credits. |
pricing_rules | Service-level pricing configuration. |
ai_usage_logs | AI usage, token counts, status, and cost. |
tron_lease_orders | TRON order lifecycle and refund state. |
Recommended Pricing
| Service | Metric | Suggested price |
|---|---|---|
| Bot Service | request/message | $0.001 per request |
| File Service | upload/download | Starts at $0.01 per upload |
| Webhook Push | fan-out request | $0.001 per request |
| TRON Energy Lease | order | Dynamic quote |
| AI BYOK Chat | request + tokens | $0.0005 + $0.02 / 1M tokens |
| AI BYOK Stream | request + tokens | $0.0010 + $0.02 / 1M tokens |
| AI Managed | upstream cost multiplier | 1.25x to 2.00x |
AI BYOK Formula
text
final_cost = request_fee + (total_tokens / 1,000,000) * token_gateway_fee_per_1mExample:
text
request_fee = 0.0005
total_tokens = 10,000
token_gateway_fee_per_1m = 0.02
final_cost = 0.0005 + 10000 / 1000000 * 0.02
final_cost = 0.0007Pre-Authorization and Settlement
AI and TRON calls can have uncertain final costs. Use this flow:
text
1. Calculate estimated_max_cost
2. Verify balance >= estimated_max_cost
3. Reserve or charge estimated_max_cost
4. Call upstream or wait for provider fulfillment
5. Calculate final_cost
6. Refund estimated_max_cost - final_cost
7. Write usage log and transaction recordsSubscription Layers
Subscriptions should complement prepaid balance, not replace it.
| Plan | Price | Intended user | Includes |
|---|---|---|---|
| Free | $0 | Trial and hobby use | Small request quota, BYOK AI, basic services. |
| Developer | $19/month | Individual developers | Higher limits, streaming, basic logs. |
| Pro | $79/month | Small teams | Team features, budgets, longer logs. |
| Business | Custom | Commercial customers | SLA, audit, SSO, provider routing. |
Transaction Types
Recommended ledger type names:
text
DEPOSIT_STRIPE
DEPOSIT_MANUAL
USAGE_BOT
USAGE_FILE
USAGE_WEBHOOK_PUSH
USAGE_TRON
USAGE_AI
REFUND_USAGE_AI
REFUND_USAGE_TRON
SUBSCRIPTION_FEE
CREDIT_GRANT