Real-Time Access Control and Credit System for High-Scale LLM Products

openai · Tech · 2026 · source Agentic: no · promotional bias: med · source-backed · extracted with prompt 0.5.6 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: High-scale LLM product access control and billing infrastructure

OpenAI needed Codex and Sora users to keep working after hitting rate limits while preserving fair access, system performance, real-time correctness, and auditable credit billing.

Constraints:

Architecture

OpenAI built an in-house real-time access engine that models access as a decision waterfall across rate limits, credits, promotions, and entitlements. A distributed usage and balance system checks per-user/per-feature rate windows and available credits synchronously, returns one definitive access outcome, and settles credit debits asynchronously through idempotent streaming processors and atomic balance-update records.

Diagram confidence: explicit (topology described by the source).

flowchart LR
  A["Codex and Sora requests"] --> B["Real-time access engine"]
  B --> C["Rate-limit windows"]
  B --> D["Credit balances"]
  B --> E["Product usage events"]
  E --> F["Monetization events"]
  F --> G["Streaming async processor"]
  G --> H["Balance updates"]
  H --> D
  H --> I["Audit and reconciliation"]
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Codex and Sora requests Interactive product requests requiring an immediate allow/block/credit decision. Real-time access engine
Real-time access engine Counts usage and evaluates rate limits, credits, promotions, and entitlements as a unified decision waterfall. Codex and Sora requests, Rate-limit windows, Credit balances, Product usage events
Rate-limit windows Tracks per-user and per-feature usage allowances. Real-time access engine
Credit balances Real-time credit availability checked when rate-limit access is exhausted. Real-time access engine, Balance updates
Product usage events Audit-trail events describing what users did. Real-time access engine, Monetization events
Monetization events Charge-intent layer derived from product usage. Product usage events, Streaming async processor
Streaming async processor Applies idempotent near-real-time debit processing. Monetization events, Balance updates
Balance updates Atomic ledger records tying credit-balance changes back to monetization events. Credit balances, Streaming async processor, Audit and reconciliation
Audit and reconciliation Offline ability to audit, replay, and reconcile the event layers. Balance updates

Data flow

A Codex or Sora request enters a single evaluation path. The access engine checks rate-limit windows, verifies credit availability when needed, and returns a real-time decision. Product usage events drive monetization events, which drive balance updates through a streaming async processor. Stable idempotency keys, serialized balance updates, and atomic database transactions keep retries, replays, and concurrent requests from corrupting credit balances.

3 supporting quotes
“Every request passes through a single evaluation path that makes a real‑time decision about how much usage is allowed”article, stated
“Product usage events: What the user actually did”article, stated
“Balance updates are serialized per account, so concurrent requests can never race to spend the same credits.”article, stated

Why this architecture

OpenAI chose a unified in-house waterfall because third-party metering was not tightly coupled enough for immediate product decisions or transparent user outcomes. Splitting synchronous access decisions from asynchronous audited debits protected user momentum while preserving billing correctness.

3 supporting quotes
“we built a real‑time access engine that counts usage.”article, stated
“They’re well‑suited for invoicing and reporting, but didn’t meet two critical requirements”article, stated
“This capability needed to be tightly integrated into our decision waterfall rather than solved in isolation”article, stated

Models used: Codex · Sora

Scale

Alternatives considered (roads not taken)

Raise rate limits

Rejected because: Higher limits would weaken demand smoothing and fairness controls and risk capacity exhaustion.

“If we simply raised rate limits, we’d lose important demand-smoothing and fairness controls and run out of capacity to serve everyone.”article, stated

Use pure asynchronous usage billing

Rejected because: Delayed billing would create lag, overages, reconciliation issues, and visible user-facing failures.

“If we relied entirely on asynchronous usage billing, we’d introduce lag, overages, or reconciliation issues”article, stated

Use third-party usage billing and metering platforms

Rejected because: Existing platforms did not satisfy immediate decisioning and integrated transparency requirements.

“We evaluated third‑party usage billing and metering platforms to handle credit consumption.”article, stated
“but didn’t meet two critical requirements”article, stated

Strict real-time balance enforcement

Rejected because: OpenAI accepted brief overshoots and refunds to prioritize provable correctness, trust, and user momentum.

“we automatically refund it; we choose provable correctness and user trust over strict enforcement.”article, stated

Patterns

cost-aware-routing (operations)

The access waterfall routes a request from included rate-limit capacity to credit-backed continuation when limits are exhausted.

“When users exceed their rate limits, credits let them keep using our products by spending down their credit balance.”article, stated

safety-policy-enforcement (governance)

A unified access engine enforces rate limits, credits, promotions, and entitlements through one decision path.

“Rate limits, free tiers, credits, promotions, and enterprise entitlements are all just layers in the same decision stack.”article, stated

observability-tracing (operations)

Usage, monetization, and balance datasets form an audit trail that supports replay, reconciliation, and explanations.

“Separating what occurred, any associated charges, and what we debited lets us independently audit, replay, and reconcile every layer.”article, stated

durable-execution (reliability)

Stable idempotency keys and serialized balance updates prevent retries, worker restarts, and concurrent requests from double-debiting credits.

“Every event carries a stable idempotency key, so retries, replays, or worker restarts can never double‑debit a balance”article, stated

Tradeoffs

Split synchronous access decisions from asynchronous credit debits.

Chose Real-time decisioning with near-real-time balance updates over Fully synchronous credit-balance mutation on the request path.

Rationale: This preserves interactive responsiveness while maintaining an auditable debit trail, accepting small balance-delay overshoots with refunds.

“This is an intentional trade-off where we are prioritizing provable correctness, at the cost of credit balance updates being slightly delayed. How we accomplished this:”article, stated
“When that brief delay causes us to overshoot a user’s credit balance, we automatically refund it; we choose provable correctness and user trust over strict enforcement.”article, stated

Build usage and balance infrastructure in-house.

Chose Integrated in-house access engine over Third-party billing and metering platforms.

Rationale: The product needed immediate correctness and outcome transparency that separate metering tools could not provide.

“To let users access our products without compromising trust, we needed full control over correctness, timing, and observability.”article, stated

Use a waterfall rather than a binary access gate.

Chose Layered decision stack across limits, credits, promotions, and entitlements over Simple allowed/blocked gate.

Rationale: The waterfall lets users keep working when one access layer is exhausted while still preserving fairness and system constraints.

“One of the key conceptual shifts we made was modeling access as a decision waterfall. Instead of asking “is this allowed?”, we ask “how much is allowed, and from where?” When counting usage, the system goes through the following sequence:”article, stated
“From a user’s perspective, they don’t “switch systems”—they just keep using Codex and Sora. That’s why credits feel invisible: they’re just another element in the waterfall.”article, stated

Gotchas (what bit them)

Traditional access models force a poor choice between hard stops and billing friction.

Root cause: Rate limits protect capacity but frustrate engaged users, while usage billing from the first token discourages exploration.

Resolution: OpenAI built a hybrid real-time waterfall that can transition from rate limits to credits within the same request.

“Zooming out, traditional access models tend to force a choice:”article, stated
“* Seamlessly transition to credits within the same request”article, stated

Third-party billing platforms were not sufficient for interactive LLM-product decisions.

Root cause: They were designed for invoicing/reporting rather than immediate allow-or-block decisions tied to product state.

Resolution: OpenAI built the decision waterfall in-house for real-time correctness, timing, and observability control.

“When a user hits a limit and has credits available, the system must know immediately. Best‑effort or delayed counting shows up as surprise blocks, inconsistent balances, and incorrect charges. For interactive products like Codex and Sora, those failures become visible and frustrating.”article, stated
“That pushed us toward an in‑house solution.”article, stated

Retries and concurrent requests can double-charge users unless billing events are idempotent and serialized.

Root cause: Distributed usage systems see retries, replays, worker restarts, and simultaneous requests against the same balance.

Resolution: Every event carries an idempotency key, balance updates are serialized per account, and balance changes are written atomically with audit records.

“* Every event carries a stable idempotency key, so retries, replays, or worker restarts can never double‑debit a balance, which prevents double‑charging. This also lets us run a batch reconciliation to verify our work offline.”article, stated
“We decrease the Credit Balance and insert a Balance Update record in a single atomic database transaction.”article, stated

Evaluation

The article frames evaluation around operational correctness and user trust rather than model-quality metrics: real-time access decisions, auditable datasets, idempotent debits, reconciliation, and predictable user-facing outcomes.

Metrics: Real-time decision availability · No double debit on retries or restarts · Replayable and reconcilable usage/billing layers · Transparency into why requests were allowed or blocked · User ability to continue work after rate limits when credits are available

3 supporting quotes
“* Make that decision in real time”article, stated
“This capability needed to be tightly integrated into our decision waterfall rather than solved in isolation in a separate usage billing platform that only saw one piece of what was happening.”article, stated
“All of this rigor supports one objective: to make access simple and safe. When people are creating or coding, they shouldn’t have to wonder whether a request will go through, if they’ll be overcharged, or whether their balance is accurate.”article, stated

Outcomes

The system supports rapidly adopted OpenAI products, per-user/per-feature usage windows, real-time request decisions, near-real-time async credit updates, and account-serialized balance records.

3 supporting quotes
“To solve this, we built a real‑time access engine that counts usage. One of the layers in that engine is the ability to purchase credits. When users exceed their rate limits, credits let them keep using our products by spending down their credit balance.”article, stated
“it then returns one definitive outcome while settling any credit debits asynchronously.”article, stated
“Building that experience required rethinking access, usage, and billing as a single system and building infrastructure that treats correctness as a first‑class product feature. The same foundation can extend to more products over time; Codex and Sora are just the beginning.”article, stated