Repository navigation
feat(providers): add Alibaba Token Plan (China + global) - #1089
Merged
Merged
Conversation
Astro-Han
force-pushed
the
feat/providers-alibaba-token-plan
branch
from
July 16, 2026 09:08
b66c030 to
ca176e5
Compare
57 tasks done
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.
Summary
Part of #860. Adds the Alibaba Token Plan (Team Edition) subscription as two independent, region-scoped provider ids that persist and bill separately from the existing
alibabadirect API:alibaba-token-plan-cn— China / Beijing region (https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1),category: 'domestic'.alibaba-token-plan— Global / Singapore region (https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1),category: 'overseas'.Both are OpenAI-compatible plan variants:
catalogGroup: 'plans',catalogBadge: 'Token',protocol: 'openai',runtimeAdapter: { kind: 'openai-compatible', name: 'provider' },authKind: 'api_key', andmodelDiscovery: { kind: 'fallback' }(the plan endpoint publishes no/modelslist). Ordering uses fractionalreadyOrder/catalogOrder41.3(CN) and41.4(global) to sit next to the existingalibabaentry (41).fallbackModelsis a hard-coded allowlist pinned to the models.dev snapshot, guarded by identity +functionCallingassertions. Only tool-calling text models are offered; the plan's image models (qwen-image-2.0*,wan2.7-image*) are excluded. CN and global share one model list.Following the
tencent-token-plan(#914) precedent, the Token Plan license permits interactive coding/agent tools only and forbids API automation, so nopackages/headless/src/provider-env.tsentry is added and headless resolves an empty key even when a credential/env var is present. The existing vendoredalibabacloud.svgbrand mark is reused (no new asset, noTHIRD_PARTY_LICENSESchange).Models expose only
reasoning: true(no reasoning-effort levels), so — like thealibabadirect API — nomodel-factory.tsbuildProviderOptionscase or matrix override is needed; the conformance matrix covers exact-model-id, tool-loop, and reasoning-replay wire behavior from the registry automatically.Verification
Ran from the worktree; all green:
npm run typecheck— OK (all workspaces)npm run test:scripts— 108 pass / 0 fail (includessync-model-metadata.test.mjs)npm --workspace @maka/core test— 1038 / 0npm --workspace @maka/runtime test— 1972 / 0 (registry-driven conformance matrix, incl. the "no contract gaps" report)npm --workspace @maka/storage test— 282 / 0npm --workspace @maka/headless test— 1006 / 0npm --workspace maka-agent test— 407 / 0npm --workspace @maka/desktop test— 2556 / 0npm run check:stale— dist is freshgit diff --check— cleanGenerated
model-metadata.generated.tswas refreshed vianpm run sync:model-metadata; the committed diff is restricted to the two new providers (unrelated upstream models.dev drift was reverted to keep this PR minimal and conflict-free), and the two spliced entries were confirmed byte-identical to a full sync.Maintainers have no Token Plan subscription, so this PR runs no sanitized live smoke test. Coverage is entirely deterministic: the fake two-stage tool-call wire and fallback-discovery assertions in the runtime conformance matrix, plus the interactive-only credential-boundary tests in headless (
provider-env/harbor-cell) and the registry/catalog/auth/storage/CLI contract tests. Any real-wire behavior issue will be fixed on user feedback.Note
Both variants share one model allowlist and differ only by region host and
category; they are distinct persisted ids so credentials and billing never cross. A sibling PR adds the Alibaba Coding Plan variants under #860; the two land independently frommain.