Skip to content

Use CLIProxyAPI v8 native quotas and readable OpenCode Go accounts - #10

Open
darfink wants to merge 1 commit into
massiveits:mainfrom
darfink:feat/native-plugin-quota
Open

darfink wants to merge 1 commit into
massiveits:mainfrom
darfink:feat/native-plugin-quota

Conversation

@darfink

@darfink darfink commented Sep 30, 2026

Copy link
Copy Markdown

OpenCode Go quota refresh currently depends on a separate plugin page, and generated account names expose key digests. This change uses CLIProxyAPI v8's generic quota API and gives accounts readable names.

The plugin advertises quota_provider and implements quota.identifier, quota.describe, and quota.fetch. Fetch uses the credential selected by CLIProxyAPI, then normalizes rolling, weekly, and monthly readings into native quota buckets. Missing readings stay unknown, invalid values return errors, and upstream errors do not expose credentials. Quota reset remains unsupported.

The separate quota page and its management routes are removed. API key entries accept an optional name; unnamed accounts use OpenCode Go or numbered labels. Existing IDs, custom labels, filenames, and host metadata remain intact. A cold-start check prevents duplicate records when existing files have readable names.

This requires CLIProxyAPI v8.0.0 or later. Imports and the SDK dependency move from v7 to v8, and the plugin version becomes 0.2.0.

Validation:

  • go test ./... passed, including selected-credential quota fetch, value validation, account labels, and cold-start duplicate coverage.
  • go vet ./... passed.
  • The macOS arm64 C-shared library builds successfully.
  • The installed plugin previously returned all three quota windows through the local generic endpoint, with no separate quota page or duplicate account files.

@massiveits massiveits self-assigned this Oct 2, 2026
@massiveits

Copy link
Copy Markdown
Owner

Thanks @darfink. This looks great and I definitely want to merge it.

I'm holding off on merging right now because we need to give users more time to upgrade to v8 before cutting a breaking release, and I'm still on CLIProxyAPI v7 myself.

I'll keep this PR open and merge it once the v8 transition window makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants