Beyond rate limits: scaling access to Codex and Sora
# Scaling Codex and Sora Beyond Rate Limits with a Hybrid Credits System OpenAI found that rate limits alone frustrate engaged users, while pure usage-based billing charges people from the first token. To bridge the gap, they built an in-house access engine that treats rate limits and prepaid credits as layers in a single decision flow. Each request is evaluated in real time, so users keep working past their limits without interruption, and every charge is traceable and auditable. ## Why Existing Access Models Fell Short - Rate limits protect capacity and fairness, but users who hit them get a "come back later" dead end. - Usage-based billing is flexible, but it charges from the first token, which discourages early exploration. - Raising rate limits would erode demand smoothing and capacity, while purely asynchronous billing introduces lag, overages, and reconciliation problems. - The required system had to enforce rate limits first, switch to credits within the same request, make that decision in real time, and track credit consumption with rigorous accuracy. ## Access as a Waterfall - Instead of asking "is this allowed?", the system asks "how much is allowed, and from where?" - Rate limits, free tiers, credits, promotions, and enterprise entitlements are all layers in one decision stack. - Users never "switch systems," which is why credits feel invisible in daily use. ## Why They Built It In-House Third-party metering and billing platforms suit invoicing and reporting, but they fell short on two requirements: - **Real-time correctness:** Delayed or best-effort counting causes surprise blocks, inconsistent balances, and incorrect charges. - **Reconcilability and trust:** Every outcome needed to be explainable, including why a request was allowed or blocked, how much usage it consumed, and which limits or balances applied. That level of visibility required tight integration with the decision waterfall. ## A High-Scale Usage and Balance System - Tracks usage per user and per feature - Maintains rate-limit windows and real-time credit balances - Debits balances idempotently through a streaming async processor - Routes every request through one evaluation path that synchronously consumes rate limits and verifies credit sufficiency, then returns a single outcome while settling credit debits asynchronously. This keeps behavior consistent across products and avoids duplicated logic across teams. ## A Provably Correct Billing System The system maintains three linked datasets, each triggering the next: - **Product usage events:** What the user actually did, published for all activity whether or not it consumed credits, providing an audit trail that explains every charge or non-charge. - **Monetization events:** What the user is charged for their usage. - **Balance updates:** How much the credit balance changed and why. Key mechanisms: - **Stable idempotency keys** on every event ensure retries, replays, or worker restarts can never double-debit a balance. They also enable offline batch reconciliation. - **Near-real-time asynchronous balance updates** trade a small delay for auditability. If that delay causes a balance overshoot, the user is automatically refunded, so the team prioritizes provable correctness and trust over strict enforcement. - **Atomic transactions** decrease the credit balance and insert a Balance Update record together. Updates are serialized per account, so concurrent requests cannot race to spend the same credits, and every adjustment links back to the monetization event that triggered it. ## Architecture in Service of Momentum The design goal is to keep users working. Real-time balances prevent unnecessary interruptions, atomic consumption prevents double-charging, and unified access logic makes behavior predictable. The team treats the underlying access, usage, and billing as one system, and expects the same foundation to extend beyond Codex and Sora to other products.