Skip to content

Add Alibaba Token Plan Personal/Solo variants (mainland + international) - #2487

Merged
steipete merged 1 commit into
mainfrom
codex/alibaba-personal-variants
Jul 29, 2026
Merged

Add Alibaba Token Plan Personal/Solo variants (mainland + international)#2487
steipete merged 1 commit into
mainfrom
codex/alibaba-personal-variants

Conversation

@steipete

Copy link
Copy Markdown
Owner

Summary

  • add explicit international and China-mainland Personal/Solo variants inside the existing Alibaba Token Plan provider
  • route Personal usage to the dedicated rolling-window gateways while leaving both existing Team variants on GetSubscriptionSummary
  • rebuild browser cookies independently for the dashboard and quota hosts, and support cookie-only Personal requests without requiring sec_token
  • parse shared 5-hour/7-day usage, reset times, subscription tier, and tier quota metadata from issue-documented fixtures
  • keep weekly-only payloads visible and label Personal rows as 5-hour / 7-day across the menu, descriptors, and widget snapshots

Based on the investigation by @LeoLin990405 (#2370) and @halilertekin (#2349). The international endpoint work from @rohitsabu's closed #2437 also informed the coordinated rewrite, with contributor credit preserved in the commit.

Verification

  • swift test --filter AlibabaTokenPlan — 46 tests passed
  • focused settings picker test — passed
  • make check — passed (format, strict lint, locale/docs/package gates)
  • isolated autoreview — clean, no accepted/actionable findings

Live provider authentication was not run here, so this intentionally relies on the reporters confirming both variants in the next release, mirroring the #2361 approach. Issues #2370 and #2349 should remain open until that confirmation.

Co-authored-by: Rohit Sabu <13933510+rohitsabu@users.noreply.github.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 20d54c0094

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

switch self {
case .international, .internationalPersonal:
// This is Alibaba's live console contract, including its historical spelling.
"MODELSTUDIO_ALBABACLOUD"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use the Model Studio consoleSite spelling

When a user selects the International — Personal/Solo variant, the Personal request body sends this consoleSite value through IntlBroadScopeAspnGateway, but the existing Model Studio OneConsole path in AlibabaCodingPlanAPIRegion.consoleSite uses MODELSTUDIO_ALIBABACLOUD. The new tests only assert the mainland Personal request body, so this typo can leave the international Personal gateway receiving an unrecognized site id while the mainland variant still works.

Useful? React with 👍 / 👎.

@LeoLin990405

Copy link
Copy Markdown
Contributor

Reporter of #2370 here — thanks for the coordinated rewrite and the credit.

China-mainland Personal/Solo: confirmed working against a live account. I wired the same routing locally (a chinaMainlandPersonal region → bailian-cs.console.aliyun.com + the .../tokenplan/personal/api/v2/{usage,subscription,quota-config} gateway, cookie-only, no sec_token) and it renders real data on my live Solo account:

5-hour: usedPercent=0  windowMinutes=300
7-day:  usedPercent=0  windowMinutes=10080   (src=web)

The two things this PR calls out both hold up in practice:

  • cookie-only works — no sec_token needed;
  • the host-scoped cookie rebuild matters — a flat aliyun cookie header gets BailianGateway.Login.NotLogined; only cookies scoped to bailian-cs.console.aliyun.com (most-specific host winning on name clashes) authenticate. Good that the PR rebuilds cookies independently per host.

+1 on the Codex review's consoleSite finding — it's a real typo, not a false positive. The mainland variant is unaffected (different consoleSite), which is why my mainland test passes, but the International Personal path sends "MODELSTUDIO_ALBABACLOUD" while the existing AlibabaCodingPlanAPIRegion.consoleSite uses "MODELSTUDIO_ALIBABACLOUD" (with the I). Worth fixing before merge so the intl Personal gateway doesn't get an unrecognized site id — and maybe assert the intl Personal request body in the tests too, since only the mainland body is currently checked.

I can only speak to the mainland variant end-to-end (I'm a mainland Solo account); I can't authenticate the international gateway myself. Happy to re-run mainland against the shipped build once it lands to close out #2370.

@steipete
steipete merged commit d04c74a into main Jul 29, 2026
15 of 17 checks passed
@steipete

Copy link
Copy Markdown
Owner Author

Merged after full verification (owner-approved architecture: Personal/Solo as explicit variants inside the Alibaba provider). Mainland Personal targets the bailian-cs.console.aliyun.com gateway with host-scoped cookie assembly; international Personal covers the Model Studio Singapore path; a shared rolling-window parser serves both; cookie-only auth works (no secToken requirement); weekly-only responses render; existing Team variants are untouched (regressions pin that). 46 focused tests + make check green; autoreview clean; exact-head CI fully green after a musl SDK infra rerun (https://github.com/steipete/CodexBar/actions/runs/30403595624). Based on the investigations by @LeoLin990405 (#2370) and @halilertekin (#2349) — live confirmation requested from both on the next release.

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.

2 participants