feat: add alibaba-token-plan provider#33109
Closed
orcool wants to merge 1 commit into
Closed
Conversation
e57261c to
b91a7fc
Compare
Contributor
Author
|
Updated this PR after a self-review:
Focused test passes: 83/83 in tests/hermes_cli/test_model_validation.py. |
Add support for Alibaba Cloud Token Plan (Team Edition) as a dedicated provider with its own model catalog. Token Plan offers broader model selection than Coding Plan, including: - Qwen 3.7-max, 3.6-plus, 3.6-flash - DeepSeek v4-pro, v4-flash, v3.2 - Kimi k2.6, k2.5 - GLM 5.1, 5 - MiniMax M2.5 Base URL: https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1 Env var: ALIBABA_TOKEN_PLAN_API_KEY This allows users to select the correct provider in setup wizard and model picker instead of using alibaba-coding-plan which has a limited model list. Refs: https://modelstudio.console.alibabacloud.com/ap-southeast-1/?tab=doc#/doc/?type=model&url=3028858
b91a7fc to
7eef57c
Compare
Contributor
Author
|
Updated after checking Alibaba's official Hermes Agent setup guide. Changes in this update:
The OpenAI-compatible Token Plan endpoint can still be used by setting ALIBABA_TOKEN_PLAN_BASE_URL explicitly. Focused tests pass: 104/104. |
Contributor
Author
|
Additional protocol-adjacent checks pass after the Anthropic-compatible endpoint change:
Result: 133 passed. |
Contributor
Author
|
Closing this for now because the branch has drifted from current main and the provider integration surface changed while this PR was open. If still useful, I’ll reopen a cleaner, smaller PR from current main with the Token Plan / Coding Plan separation and transport choice documented more clearly. |
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
Add support for Alibaba Cloud Token Plan (Team Edition) as a dedicated provider, separate from
alibaba-coding-plan.Problem
Token Plan users currently have to configure Alibaba's Token Plan through a custom endpoint. That is easy to mix up with Coding Plan or DashScope pay-as-you-go because each plan uses different API keys, base URLs, billing/quota semantics, and supported model catalogs.
Alibaba's own Hermes Agent setup guide recommends the Token Plan Anthropic-compatible endpoint, so this PR wires Token Plan as an
anthropic_messagesprovider by default.Changes
alibaba-token-planprovider toPROVIDER_REGISTRYhttps://token-plan.ap-southeast-1.maas.aliyuncs.com/apps/anthropicalibaba-token-planprovider overlay with:transport="anthropic_messages"ALIBABA_TOKEN_PLAN_API_KEYALIBABA_TOKEN_PLAN_BASE_URLoverride supportalibaba_tokenalibaba-tokenalibaba_token_planqwen3.7-maxqwen3.6-plusqwen3.6-flashdeepseek-v4-prodeepseek-v4-flashdeepseek-v3.2kimi-k2.6kimi-k2.5glm-5.1glm-5MiniMax-M2.5/apps/anthropicAPI-mode auto-detectionNotes
Token Plan also exposes an OpenAI-compatible URL:
This PR intentionally uses the Anthropic-compatible endpoint by default because Alibaba's Hermes Agent guide recommends that configuration for Token Plan. Users can still override the base URL with
ALIBABA_TOKEN_PLAN_BASE_URLif they need the OpenAI-compatible endpoint.Image generation models such as
qwen-image-2.0andwan2.7-imageare not included in the chat model catalog here. Alibaba documents those as separate multimodal-generation APIs that should be integrated through a tool/skill/extension mechanism.Test Plan
./venv/bin/python -m py_compile hermes_cli/auth.py hermes_cli/providers.py tests/hermes_cli/test_alibaba_token_plan_provider.py./venv/bin/pytest tests/hermes_cli/test_alibaba_token_plan_provider.py tests/hermes_cli/test_model_validation.py tests/hermes_cli/test_detect_api_mode_for_url.py -q --tb=short -o 'addopts='Docs Source
https://www.alibabacloud.com/help/en/model-studio/token-plan-quickstarthttps://www.alibabacloud.com/help/en/model-studio/token-plan-overviewhttps://www.alibabacloud.com/help/en/model-studio/hermes-agent