Repository navigation
Conversation
Track free-model attempts from traffic the gateway already sends. Each egress starts from an assumed daily limit, raises a floor from daily successes, and learns a ceiling from genuine daily-quota 429s. Show a local, non-authoritative estimate in Models and quotas with per-exit remaining, history, health, and a paid probe.
A transport error or 403 spent nothing and learned nothing, so it must not make an exit look observed. Capacity counts evidence-backed exits only, which keeps a fresh install honest instead of reporting an assumed 200 per exit as if it were measured.
Unseen exits now publish the starting assumption instead of a blank, and the most recently learned ceiling is used as the prior for exits the upstream has not exhausted yet. Both stay labeled assumed or low confidence and never count as measured capacity.
Unseen exits advertised an assumed limit in their row while the KPI and capacity counted measured exits only, so the page showed three totals. Capacity and remaining now cover every exit with a limit, and the panel uses one vocabulary: learned, assumed, used, no traffic.
Suydev
added a commit
to Suydev/opencode2api
that referenced
this pull request
Nov 13, 2026
…uota per egress
Contributor
Author
|
Superseded by the current per-egress implementation on |
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.
Summary
OpenCode exposes no remaining-quota endpoint and no rate-limit headers, so this estimates the free-model daily allowance per egress from traffic the gateway already sends. It is a local estimate, never presented as upstream truth.
Learning:
Only attempts that reach the provider count as evidence: transport errors, 403s, and session-risk 429s spend nothing and learn nothing.
Every configured exit that has a limit contributes to the estimate, including exits with no traffic yet. Capacity is the sum of limits, remaining is capacity minus used, so the KPI, the capacity bar, and every row reconcile. Limits stay labeled
assumeduntil a real daily-quota 429 makes onelearned; a ceiling learned on one exit is shown asassumedon an exit that has not exhausted itself.A probe sends one real free-model request and reports the classification plus a refreshed report. Every configured exit is listed; an exit with no traffic counts
0used and contributes its full limit to the estimate. Exits with no configured limit are excluded and shown separately.Evidence
go build ./...,go vet ./...,go test ./... -count=1,gofmt -l .,git diff --checkpass; CI green on all Go jobs and WebUI syntax.0 / 200, capacity is200 × exits, remaining equals capacity, and all exits readNo traffic.3,700, remaining3,595; rows and KPIs reconcile.POST /api/free-quotas/probe {"relay":{"index":0}}→200, classificationok, report returned.Merge Danger
Door: two-way. Rollback is removing the package and its hooks; a missing or corrupt tracker file is never fatal.
Blast Radius: free-model quota display only.
config.json.freequota.json; disablingfree_quotastops recording.