Skip to content

Add channel billing multiplier rules#2984

Open
zxczrx123 wants to merge 1 commit into
Wei-Shaw:mainfrom
zxczrx123:feature/channel-billing-multiplier-rules
Open

Add channel billing multiplier rules#2984
zxczrx123 wants to merge 1 commit into
Wei-Shaw:mainfrom
zxczrx123:feature/channel-billing-multiplier-rules

Conversation

@zxczrx123

Copy link
Copy Markdown

Summary

  • add ordered channel billing multiplier rules scoped by group and optional account
  • apply matched channel multipliers to user-facing ActualCost for balance, subscription, API key quota, and rate-limit accounting
  • expose rule management in the admin channel form alongside existing channel pricing controls

Notes

  • account stats pricing remains separate and continues to control account/statistics cost semantics
  • rules require at least one group; account IDs are optional and narrow the match when present
  • first matching rule wins according to saved order

Tests

  • go test -tags unit ./internal/service ./internal/repository ./internal/handler/admin
  • pnpm typecheck
  • local smoke test on isolated deployment at 127.0.0.1:18080: health endpoint, admin login, migration table

@github-actions

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA. ✅
Posted by the CLA Assistant Lite bot.

@zxczrx123

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@zxczrx123

Copy link
Copy Markdown
Author

recheck

Add ordered channel rules that multiply the user-facing billing multiplier by group and optional account match, while keeping account statistics pricing separate.

Constraint: Needed per-account billing control inside the same group without changing account stats cost semantics.
Rejected: Reusing account stats pricing rules | those rules are cost/statistics oriented and do not feed user balance, subscription, or API key quota consumption.
Confidence: high
Scope-risk: moderate
Directive: Keep channel billing multiplier rules applied only to user-facing ActualCost paths; do not merge them with account stats pricing.
Tested: go test -tags unit ./internal/service ./internal/repository ./internal/handler/admin
Tested: pnpm typecheck
Not-tested: Full end-to-end upstream gateway request against a real provider.
@zxczrx123 zxczrx123 force-pushed the feature/channel-billing-multiplier-rules branch from 09a6e09 to e090013 Compare June 2, 2026 18:21
github-actions Bot added a commit that referenced this pull request Jun 2, 2026
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.

1 participant