feat(usage-limits): add Moonshot balance providers - #186
mynameistito wants to merge 4 commits into
Conversation
🦋 Changeset detectedLatest commit: e126062 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 37 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (5)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (23)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughThis change adds global and China Moonshot/Kimi API balance providers. It adds region-specific configuration and credential handling, accepts finite negative balances, and updates provider registration, tests, examples, and documentation. ChangesMoonshot/Kimi API balances
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant UsageLimits
participant MoonshotProvider
participant CredentialSources
participant MoonshotBalanceAPI
UsageLimits->>MoonshotProvider: Request regional balance
MoonshotProvider->>CredentialSources: Resolve matching region credential
MoonshotProvider->>MoonshotBalanceAPI: GET balance endpoint with bearer token
MoonshotBalanceAPI-->>MoonshotProvider: Return balance response
MoonshotProvider-->>UsageLimits: Return regional currency balance
Merge Risk: ⚪ Minimal · up to No actionable pre-merge issue was established; the regional balance providers are ready for normal merge checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The integrations keep automatically discovered credentials region-specific and validate responses before displaying balances. Explicit credential overrides remain user-controlled. No introduced security defect was established, but live redirect behavior and credential-file permissions remain unverified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit checks the balance line, Comment |
Deploying with
|
| Status | Name | Latest commit | Updated (UTC) |
|---|---|---|---|
| Deployment successful View Cloudflare logs |
opencode-plugins-docs-pr-186 | e126062c | 2026-10-05T09:18:49.989Z |
Diagnostics: View GitHub Actions run
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
What changed
moonshotai(USD) andmoonshotai-cn(CNY) balance providers, using each region's official endpoint and auth entry.available_balanceas-is, including zero and negative values, and require a successful response before displaying it.Verification
bun run checkbun run typecheckbun run testbun run buildbun run test:packagebun run testinapps/webCloses #170
Summary by cubic
Adds Moonshot/Kimi API pay-as-you-go balance tracking as two region-isolated providers:
moonshotaifor global USD balances andmoonshotai-cnfor China CNY balances. Each provider only uses its region's official endpoint and never sends credentials to the other region.Behavior details
available_balancedirectly, including zero and negative amounts.code: 0,status: true, or a finite numeric balance.Written for commit e126062. Summary will update on new commits.