Skip to content

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:

  1. Check whether the user can pay before work starts.
  2. Cap maximum loss during uncertain-cost operations.
  3. Settle the final cost after the call.
  4. Refund failed work.
  5. Write every charge and refund to the ledger.
  6. Keep usage logs tied to request IDs and service aliases.

Current Billing Building Blocks

Building blockPurpose
users.balancePrepaid user balance.
transactionsLedger for charges, deposits, refunds, and credits.
pricing_rulesService-level pricing configuration.
ai_usage_logsAI usage, token counts, status, and cost.
tron_lease_ordersTRON order lifecycle and refund state.
ServiceMetricSuggested price
Bot Servicerequest/message$0.001 per request
File Serviceupload/downloadStarts at $0.01 per upload
Webhook Pushfan-out request$0.001 per request
TRON Energy LeaseorderDynamic quote
AI BYOK Chatrequest + tokens$0.0005 + $0.02 / 1M tokens
AI BYOK Streamrequest + tokens$0.0010 + $0.02 / 1M tokens
AI Managedupstream cost multiplier1.25x to 2.00x

AI BYOK Formula

text
final_cost = request_fee + (total_tokens / 1,000,000) * token_gateway_fee_per_1m

Example:

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.0007

Pre-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 records

Subscription Layers

Subscriptions should complement prepaid balance, not replace it.

PlanPriceIntended userIncludes
Free$0Trial and hobby useSmall request quota, BYOK AI, basic services.
Developer$19/monthIndividual developersHigher limits, streaming, basic logs.
Pro$79/monthSmall teamsTeam features, budgets, longer logs.
BusinessCustomCommercial customersSLA, 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