Skip to content

feat(providers): add Alibaba Token Plan (China + global) - #1089

Merged
Astro-Han merged 1 commit into
mainfrom
feat/providers-alibaba-token-plan
Jul 16, 2026
Merged

Astro-Han merged 1 commit into
mainfrom
feat/providers-alibaba-token-plan

Conversation

@Astro-Han

Copy link
Copy Markdown
Contributor

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 alibaba direct 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', and modelDiscovery: { kind: 'fallback' } (the plan endpoint publishes no /models list). Ordering uses fractional readyOrder/catalogOrder 41.3 (CN) and 41.4 (global) to sit next to the existing alibaba entry (41).

fallbackModels is a hard-coded allowlist pinned to the models.dev snapshot, guarded by identity + functionCalling assertions. 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 no packages/headless/src/provider-env.ts entry is added and headless resolves an empty key even when a credential/env var is present. The existing vendored alibabacloud.svg brand mark is reused (no new asset, no THIRD_PARTY_LICENSES change).

Models expose only reasoning: true (no reasoning-effort levels), so — like the alibaba direct API — no model-factory.ts buildProviderOptions case 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 (includes sync-model-metadata.test.mjs)
  • npm --workspace @maka/core test — 1038 / 0
  • npm --workspace @maka/runtime test — 1972 / 0 (registry-driven conformance matrix, incl. the "no contract gaps" report)
  • npm --workspace @maka/storage test — 282 / 0
  • npm --workspace @maka/headless test — 1006 / 0
  • npm --workspace maka-agent test — 407 / 0
  • npm --workspace @maka/desktop test — 2556 / 0
  • npm run check:stale — dist is fresh
  • git diff --check — clean

Generated model-metadata.generated.ts was refreshed via npm 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 from main.

@Astro-Han
Astro-Han force-pushed the feat/providers-alibaba-token-plan branch from b66c030 to ca176e5 Compare July 16, 2026 09:08
@Astro-Han
Astro-Han merged commit 7aa4aa2 into main Jul 16, 2026
3 checks passed
@Astro-Han
Astro-Han deleted the feat/providers-alibaba-token-plan branch July 16, 2026 09:12
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.

1 participant