fix(usage): console-aware Token Plan guidance + subscription hint on bailian 401 - #12288
Merged
diegosouzapw merged 2 commits intoSep 1, 2026
Merged
Conversation
…n bailian 401 The personal Token Plan is sold through two consoles with different portals, gateway hosts and login tickets. Two operator-facing messages ignored the split: - The quota guidance always said 'get the cookie at home.qwencloud.com', even for connections served by the Alibaba Model Studio console — following it verbatim produces a cookie the gateway rejects (console mismatch → BailianGateway.Login.NotLogined). The guidance now derives the console from the provider via resolveConsoleSite, matching what the fetcher will do with the pasted cookie. - Key validation mapped upstream 401 to a bare 'Invalid API key'. An expired Token Plan subscription produces the exact same upstream 401 (observed live 2026-09-01: subscription ended 08-23, the working key started failing), so the message now names the subscription as a cause worth checking.
…prefix match search-provider-validation.test.ts pinned the exact 'Invalid API key' string for the bailian validator; the message now also names an expired Token Plan subscription. Same property asserted (401/403 => invalid), prefix match.
diegosouzapw
added a commit
to HouMinXi/OmniRoute
that referenced
this pull request
Sep 1, 2026
…ude diegosouzapw#12288) Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…bailian 401 (diegosouzapw#12288) * fix(usage): console-aware Token Plan guidance and subscription hint on bailian 401 The personal Token Plan is sold through two consoles with different portals, gateway hosts and login tickets. Two operator-facing messages ignored the split: - The quota guidance always said 'get the cookie at home.qwencloud.com', even for connections served by the Alibaba Model Studio console — following it verbatim produces a cookie the gateway rejects (console mismatch → BailianGateway.Login.NotLogined). The guidance now derives the console from the provider via resolveConsoleSite, matching what the fetcher will do with the pasted cookie. - Key validation mapped upstream 401 to a bare 'Invalid API key'. An expired Token Plan subscription produces the exact same upstream 401 (observed live 2026-09-01: subscription ended 08-23, the working key started failing), so the message now names the subscription as a cause worth checking. * test(providers): align the remaining bailian 401/403 message pins to prefix match search-provider-validation.test.ts pinned the exact 'Invalid API key' string for the bailian validator; the message now also names an expired Token Plan subscription. Same property asserted (401/403 => invalid), prefix match.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem (two operator-facing messages, one root cause)
The personal Token Plan is sold through two consoles (QwenCloud and Alibaba Model Studio)
with different portals, gateway hosts and login tickets — and the gateway validates the session
against the console identity, so a cookie captured on the wrong console is rejected with
BailianGateway.Login.NotLogined.home.qwencloud.com/cs-data.qwencloud.com/login_qwencloud_ticket, even forbailian-coding-planconnections served by the Alibaba console. An operator following itverbatim captures a cookie the gateway rejects. (This confused the operator on 2026-08-18.)
Invalid API keyhid the real cause. An expired Token Plan subscription produces theexact same upstream
401 invalid_api_keyas a wrong key — observed live 2026-09-01: thesubscription ended 08-23 (
autoRenewFlag: false) and the previously verified working keystarted failing validation with "Invalid API key".
Changes
open-sse/services/usage/qwen-token-plan.ts— the guidance derives the console from theprovider via
resolveConsoleSite(the same rule the fetcher applies to a pasted cookie):ALIYUN connections get the Model Studio instructions (
modelstudio.console.alibabacloud.com,gateway
bailian-singapore-cs.alibabacloud.com,login_aliyunid_ticket); QwenCloud keeps thecurrent text. Brand label follows suit.
src/lib/providers/validation/audioMiscProviders.ts— bailian 401/403 message becomes"Invalid API key — or the Token Plan subscription is expired/inactive; check it in the Model
Studio console".
401 → invalid).
Tests (TDD — RED first)
tests/unit/token-plan-console-aware-messages.test.ts:operator hunting for
login_qwencloud_ticket— RED before.Sibling sweep green:
bailian-coding-plan-provider,provider-validation-specialty,qwen-token-plan-{quota-fetcher,console-site,cookie-field}— 176 pass / 0 fail — plustypecheck:core, focused ESLint + Prettier.