Repository navigation
v0.3.0
What's new
- Per-call billing mode for model aliases: new
BillingMode(tokens|per_call) +PerCallUSDfield. Each successful request charges a fixed USD amount, independent of token counts. Token prices are retained but dormant under per_call; switch back totokensto reuse them.PerCallUSD=0is allowed (free calls, call count still increments). - Per-key usage detail subpage: new management route
GET /keys/usage?id=...returns a per-alias (per-model) usage breakdown for a single downstream key. Frontend page at/keys/:id/usagewith a daily/weekly window toggle and columns for alias, billing mode, provider, USD, call count, input/output/cache tokens, and hit rate. Configured-but-unused aliases show zero rows; aliases removed from config but with history show with anin_config=falsebadge. - Image/video pre-charge (CPA usage workaround): CPA's XAI executor does not emit usage records for
/v1/images/*and/v1/videos/*, so per-call aliases on these endpoints were never billed viausage.handle. The plugin now pre-chargesper_callaliases on these paths at access time. This is unconditional — failed upstream requests are also charged (the access hook cannot observe the upstream outcome). A UI warning surfaces this trade-off when per_call is enabled. Tracked upstream as router-for-me/CLIProxyAPI#4085. - Dual-window per-alias tracking:
ByAliasupgraded from single-window toDaily+Weekly. Legacy state files auto-migrate on load (old single-window entry → daily, weekly zeroed). - Frontend: KeyForm billing-mode toggle, KeyList call-count display, new KeyUsage page. 4 locales updated (zh-CN, zh-TW, en, ru).
Upgrading
Replace the plugin binary and restart CPA. State files from v0.2.x are auto-migrated; no manual action needed.