Repository navigation
Offer free Luna with a configurable weekly allowance and upgrades - #4620
reachjalil wants to merge 2 commits into
Conversation
Test evidence — free-luna-meters-a-person-s-actual-weekly-usage-across-keys-organizations-and-la — ✅ passedSHA 00b1b9b · engine v1 ✅ passed · 4 expectations passed · 0 failed · 0 pending
verdict passed · 0 user observations · 0 probes · steps 0/0 ℹ️ ASSERTION — 1. Actual usage, not estimates, consumes one USD per person per Monday UTC weekHTTP 200 replies reached the fixture; SQL settled 0.25 + 0.50 + 0.50 USD. All three keys then received 402 without upstream; the second person and paid ledger stayed unchanged.
ℹ️ ASSERTION — 2. Person locking neither deadlocks independent first use nor admits two requests for one personTwo independent first admissions completed concurrently; two cross-organization keys for a fresh person produced exactly one upstream call and HTTP 200/423, with a retained SQL hold when usage.cost was missing.
ℹ️ ASSERTION — 3. Old-week missing usage blocks new admission until an authenticated original-week receipt settles once423 survived explicit rollover seeding; invalid signature and wrong identity did not release the hold. Late and replayed receipts charged only the old week. An active key then used the fresh one-USD week; the revoked key remained denied.
ℹ️ ASSERTION — 4. Response usage and signed webhook fallback cannot double-chargeRacing the final SSE usage against the authenticated webhook settled exactly 0.25 USD once; replay left SQL unchanged, the independent person unchanged, and paid accounting empty.
Test run created 2026-09-08T12:18:36.003Z · Source: |
|
@reachjalil I think we should just go full free I have a branch ready PR is coming up soon |
Stack
Parent: #4619 (
feature/new-install-signin), above #4608. This PR adds the free managed-model offer; it does not repeat the installation gate or change legacy sign-in policy.Experience
openai/gpt-5.6-lunathrough OpenWork inference without a paid subscription.GET /v1/inference/access; the SDK and both clients use the shared reason contract. In-flight usage remains free access, not lost entitlement.Metered allowance, not a strict pre-reserved dollar ceiling
Admission checks actual weekly usage before generation and permits one unsettled request per person. Requests are limited to 32 KiB supplied input, 128 KiB wire size and 4,096 output tokens, including reasoning. The final admitted reply may exceed the weekly dollar amount. Future calls are then blocked. This is the intended usage-metered policy, not a guarantee of zero overage.
Actual provider cost settles transactionally from the terminal response or authenticated webhook. Missing receipts retain the hold and request manual retry rather than granting fresh capacity. Late/repeated receipts charge only the original person/week once.
reservedUsdis an estimate, not billed cost. Another managed model and exhausted usage return explicit 402 upgrade errors; a request already running returns a non-upsell 423.Paid policies, paid upstream keys and BYOK remain separate. Admin disablement cannot be silently overridden. Free keys are not distributed to organization-wide shared workers.
Configuration and migration
0093_free_inference_allowancebefore enabling. The large generated snapshot is schema metadata.INFERENCE_FREE_ENABLED,INFERENCE_FREE_WEEKLY_BUDGET_USDandINFERENCE_FREE_MODEL_IDin Den and inference. Defaults are disabled, USD 1, standard Luna.INFERENCE_FREE_UPSTREAM_API_KEYonly in inference and retain authenticated usage export. No shared upstream key is delivered to clients.ee/apps/inference/FREE_ALLOWANCE.mdandee/apps/den-api/FREE_ALLOWANCE.md.Verification — Incomplete
Exact head:
00b1b9b77bd750ce5996712ba21666dc0319d873.Passed
pnpm evals:pr specs/free-inference-allowance.test.ts— exit 0, 1 passed, 0 failed, 0 skipped, on this exact head. The PR lane used the existing local MySQL prerequisite with an isolated disposable database; it does not print the E2E placement banner. Real inference HTTP service and SQL accounting; only upstream generation is synthetic.pnpm sdk:check; catalog validation.Deferred / Incomplete
Overlap and deployment boundary
#4471 changes overlapping paid managed-inference accounting and capability surfaces. This free ledger/entitlement is isolated, paid behavior is retained, and #4471 is untouched; reconcile both diffs before integration.
Both stack branch names are disabled in all four Vercel Git deployment configs before publication. GitHub reports no deployment records for either branch. No Vercel deployment command, merge or release is included. Merge bottom-up only after separate approval and fresh exact-head checks.