CodexBar icon indicating copy to clipboard operation
CodexBar copied to clipboard

[Feature Request] Alibaba Token Plan: per-model token and Credits usage breakdown

Open Pjhhhhh opened this issue 1 month ago • 4 comments

Feature request

Please add a per-model usage breakdown for Alibaba Token Plan alongside the existing plan quota percentages, so users can see which models consume their allowance.

Current behavior

On CodexBar 0.73.0, the Alibaba Token Plan card shows quota percentages, but does not show how many tokens or Credits each model consumed.

The current provider documentation describes aggregate plan Credits and Personal/Solo rolling windows, without documenting a per-model breakdown.

Requested behavior

  • Add a per-model table in Usage & Spend or the Alibaba Token Plan detail view, with a selectable date or time range.
  • Show the fields actually available from Alibaba's official interfaces: model name, input/output tokens, cached tokens, request count, and Credits consumed. Missing fields should remain unavailable rather than appear as zero.
  • Show the data source, update time, and partial-coverage status. Totals and breakdowns should use the same plan, account, and time range.
  • Do not infer per-model usage from the aggregate percentage, label Token Plan Credits as USD, or mix ordinary pay-as-you-go API usage into the subscription breakdown.
  • Where a Personal/Team variant or region has no supported detail endpoint, show a clear unavailable state and a link to the official Token Plan usage-detail page.

Feasibility to verify

Please first establish whether the official console or an already authenticated Bailian CLI exposes plan-specific per-model details. Alibaba's CLI documentation lists bl usage stats and bl usage token-plan separately; this does not establish that generic model statistics include Token Plan usage. That relationship needs verification before integration.

If local client logs are used as an alternative, label them as partial local statistics and distinguish them from authoritative plan Credits consumption.

Suggested acceptance criteria

  1. When official per-model details are available, display the returned fields and their reporting scope.
  2. When only aggregate quota percentages are available, preserve quota reporting and clearly indicate that model details are unavailable.
  3. Preserve Personal/Team, region, account, and subscription-billing boundaries; do not make inference calls to probe usage.

Related but broader: #2695 (multi-provider cost and model coverage). This request specifically concerns Alibaba Token Plan model-level usage.

No account identifiers, cookies, API keys, session contents, or actual usage records are included in this report.

Pjhhhhh avatar Oct 14 '26 06:10 Pjhhhhh

Codex review: this still needs some work.

Summary Keep open: current main remains aggregate-only, and the maintainer has conditionally accepted per-model reporting once a plan-scoped response is supplied.

Reproducibility: Source and existing tests establish aggregate-only reporting; no live account probe was run, and official model-detail availability remains unverified.

Maintainer decision needed

  • Question: Does the supplied official response establish model-level usage for the selected Token Plan, region, and reporting range?
  • Recommendation: Wait for plan-scoped response evidence: Assess the sanitized official request and response before implementing model rows.
  • Why: The maintainer has approved the direction conditionally, but the required response evidence has not been supplied.

Next step Obtain the official model-detail request path and sanitized response with Personal/Team variant and region, as the maintainer requested, before assessing implementation.

Review details

Best possible solution:

Display verified plan-scoped model records while preserving missing fields, billing boundaries, and aggregate quota reporting.

Do we have a high-confidence way to reproduce the issue?

Source and existing tests establish aggregate-only reporting; no live account probe was run, and official model-detail availability remains unverified.

Is this the best way to solve the issue?

The requested accounting boundaries fit the maintainer's ruling, but a verified subscription-scoped response must precede parser and presentation work.

AGENTS.md: found and applied where relevant.

Remaining risk / open question:

  • No supplied response verifies plan-specific model rows, available fields, supported variants, or time-range semantics.
  • Generic model statistics may cover pay-as-you-go activity rather than subscription Credits.

Codex review notes: model internal, reasoning medium; reviewed against 4654968e91f0.

Label changes

Label changes:

  • add issue-rating: 🌊 off-meta tidepool: Current issue advisory state selects this label.
  • remove clawsweeper:needs-product-decision: Current issue advisory state no longer selects this label.
  • remove issue-rating: 🦞 diamond lobster: Current issue advisory state no longer selects this label.
  • remove clawsweeper:source-repro: Current issue advisory state no longer selects this label.

Label justifications:

  • P3: Optional reporting expansion leaves the existing aggregate quota workflow available.
  • impact:ux-friction: Users cannot attribute Alibaba subscription allowance consumption to individual models inside CodexBar.
Evidence reviewed

What I checked:

  • Maintainer direction already recorded: In https://github.com/steipete/CodexBar/issues/4515#issuecomment-6204202659, steipete accepts adding per-model rows after receiving the official request path and sanitized response, including plan variant and region; otherwise reporting remains aggregate-only, without local-log inference.
  • Current data contract lacks model records: The snapshot contains aggregate quotas, rolling and monthly windows, reset dates, and update time, with no per-model accounting fields. (Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageSnapshot.swift:3, 4654968e91f0)
  • Shared conversion preserves aggregate reporting: Conversion produces quota windows and explicitly supplies providerCost as nil; the provider descriptor also disables token-cost summaries. (Sources/CodexBarCore/Providers/Shared/AliyunOneConsole/OneConsoleTokenPlanSnapshot.swift:81, 4654968e91f0)
  • Documented and tested quota boundary: Provider documentation describes Team credits and Personal rolling/monthly windows and excludes cost summaries; menu model tests expect aggregate Credits or duration-labelled metrics. (docs/alibaba-token-plan.md:56, 4654968e91f0)
  • Broader completed request is distinct: https://github.com/steipete/CodexBar/issues/2695 was closed after expanded local history and provider activity coverage; its maintainer explanation does not establish authoritative Alibaba subscription Credits by model.
  • Canonical and paired-work search: Targeted searches for Alibaba per-model reporting and references to this issue found no distinct item owning this feature; the author's only open item is this issue.
How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge; those execution lanes are retired.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

Reviewed October 22, 2026, 8:42 AM ET / 12:42 UTC.

clawsweeper[bot] avatar Oct 14 '26 06:10 clawsweeper[bot]

Thanks for the review. I agree that source verification should come before implementing historical reporting UI.

To clarify the request: the goal is to see which models consume an Alibaba Token Plan allowance. It is not a request to estimate model usage from the aggregate percentage or to treat generic pay-as-you-go statistics as subscription consumption.

I have not yet verified a plan-scoped model-detail endpoint, so I cannot provide an authoritative response fixture at this stage. The official CLI command summary alone is not sufficient evidence.

Would maintainers be willing to consider a source-verification investigation as the first step? A useful initial result would establish whether the official console or authenticated Bailian CLI exposes per-model records, which Personal/Team and regional variants support them, the available token/Credits fields, and the account/plan/time-range scope.

If only aggregate quota data is available, an explicit "Model-level usage unavailable" state with a link to the official Token Plan usage-detail page would still be useful. A local-log alternative should be labeled as partial local usage rather than authoritative plan Credits.

Any response example used for investigation should be sanitized; raw cookies, credentials, account identifiers, prompts, and private usage records should not be posted. Please let us know which response shape or minimum evidence would help maintainers assess feasibility.

Pjhhhhh avatar Oct 14 '26 06:10 Pjhhhhh

Thanks @Pjhhhhh, agreed on all points. The minimum evidence is simple: if the Token Plan usage-detail page in the official console shows per-model rows, open the browser developer tools on that page, go to Network, find the request that returns those rows, and share its path plus a sanitized body that keeps the field names, model names and numbers (no cookies, headers, account or workspace IDs, or prompts). Please also note whether it is a Personal or Team plan and which region.

With that request shape we can add per-model rows to the existing Alibaba Token Plan source. Without a plan-scoped source we will keep reporting the aggregate only; we won't infer per-model usage from local logs or from the aggregate percentage.

steipete avatar Oct 15 '26 23:10 steipete

Thanks for clarifying the Token Plan boundary. We checked the current aggregate quota source and the replies; no plan-specific per-model response has been supplied. We're closing this request because PAYG statistics and local logs cannot establish which models consumed subscription Credits. A custom alibaba-token-details.js plugin can render model rows once the official console request is identified. A sanitized response with region, Personal/Team scope, reporting period, and units would be grounds to reconsider built-in coverage.

steipete avatar Nov 07 '26 04:11 steipete