feat: add OpenCode Zen provider with dashboard scraping#140
Draft
vmvarela wants to merge 1 commit into
Draft
Conversation
Add OpenCode Zen (opencode) provider that scrapes the billing page at
opencode.ai/workspace/{id}/billing for real-time balance data.
Key changes:
- New OpenCode Zen provider (src/providers/opencode.ts)
- Zen config resolver with env var and file support
(src/lib/opencode-zen-config.ts)
- Zen billing page scraper (src/lib/opencode-zen.ts)
- Shared config file reader utility (src/lib/config-file-reader.ts)
- Provider metadata, registry, types, and format updates
- Quota status diagnostics for Zen config
- README docs: setup instructions with cookie/workspace ID acquisition
- Complete test coverage for all new modules
Closes slkiser#106
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
Adds OpenCode Zen provider support with real-time balance scraping from the billing page at
opencode.ai/workspace/{id}/billing.How it works
Unlike the original proposal in #106 (local estimation from
opencode.dbtoken usage × models.dev pricing), this implementation scrapes the actual balance from the OpenCode Zen billing page, the same way the existing OpenCode Go provider scrapes the workspace dashboard.Why scraping instead of local estimation:
authcookie fromopencode.aiand reuse the same scraper infrastructureChanges included
opencodeprovider (src/providers/opencode.ts)src/lib/opencode-zen-config.ts)src/lib/opencode-zen.ts)src/lib/config-file-reader.ts)Closes #106