feat(usage): enforce one free account per install (fair-use policy) - #159
Open
Fahad090NP wants to merge 4 commits into
Open
feat(usage): enforce one free account per install (fair-use policy)#159Fahad090NP wants to merge 4 commits into
Fahad090NP wants to merge 4 commits into
Conversation
Contributor
Author
|
If I ever had a wish for any of my PR to be approved, then this is the one. Not because I am jealous of the people who are using this trick to scam OpenCode and I am not, but because both Islam and then the ethics forbids such acts strictly. It was always be a difficult thing to let others think what I actually want to say. Fi Amanillah. |
Contributor
Author
|
I do not want to hear anything other than any bug or inconsistency in my code. Either Merge, tell me what to improve, or Reject it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 What does this change?
A single-free-account fair-use policy so one person can't harvest OpenCode's free quota by registering multiple free accounts (inference is expensive for everyone).
The rule: exactly one free account is allowed per install. The moment 2+ free accounts are detected, free-model usage is blocked with a clear, actionable error. Paid usage is never blocked — multiple paid accounts are fine. Delete down to 1 free account (or make the extra one paid) and free models work again.
How an account is classified (per API-key fingerprint):
*-free/big-pickle)./zen/go/v1/usageendpoint) or successfully uses a paid model → exempt from the free limit.Coverage: new profiles and existing profiles (re-evaluated on every request), the Agents window, and vision-proxy requests. The block fires before the request is sent, so no quota is spent.
Code structure (4 commits, pure-logic separation):
src/usage/freeAccountPolicy.ts+ storage wrapper + 11 unit tests (src/test/freeAccountPolicy.test.ts) covering: single free allowed, 2nd free blocks, paid exemption, lapsed-sub re-classification, TTL renewal, delete-account recovery, round-trip persistence.provideLanguageModelChatResponse(+ paid confirmation on successful paid-model usage).Delete Profilecleans the policy; the Usage quick-pick warns when free usage is blocked; Diagnostics now shows a "Free-Account Policy" section (free/paid fingerprints + blocked state) so the policy is transparent.🧪 How did you test it?
npm run lint— all 7 steps green, incl. the 11 new policy unit tests.✅ Checklist
npm run compilepassesnpm run lintpassesnpm testpassesnpm run packageproduces a VSIX (not run — code + tests only)