feat: add Tencent Cloud TokenHub provider with auto model sync
ci / tcc-check (push) Successful in 1m5s
ci / linux (aarch64, 0) (push) Failing after 48s
ci / linux (x86, 1) (push) Failing after 1h0m2s
ci / linux (x86_64, 1) (push) Failing after 1h0m2s
ci / windows (push) Failing after 51s

Fetch GET /v1/models on provider/key switch, activate online chat models,
and accept HERMIT_/CST_ key env aliases plus tencent* provider names.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
WHC
2026-11-03 21:18:39 +08:00
co-authored by Cursor
parent 5538ed3412
commit 88feddd794
8 changed files with 187 additions and 22 deletions
+14
View File
@@ -16,6 +16,7 @@ CST-Agent 使用 **OpenAI Chat Completions** 协议(`POST {base}/chat/completi
| `kimi-code` | `https://api.kimi.ai/coding/v1` | `k3`(另有 `k3-256k`、`kimi-for-coding`、`kimi-for-coding-highspeed`) | `KIMI_API_KEY` |
| `openai` | `https://api.openai.com/v1` | `gpt-4.1-mini` | `OPENAI_API_KEY` |
| `teamorouter` | `https://api.teamorouter.com/v1` | 登录后自动取 `/models` 第一个(`/model` 可换) | `TEAMOROUTER_API_KEY` |
| `tokenhub`(别名 `tencent` / `tencentcloud`) | `https://tokenhub.tencentmaas.com/v1`(广州;新加坡可 `--api-base https://tokenhub-intl.tencentmaas.com/v1`) | `hy3`(保存 key / 切换 provider 时自动 `GET /v1/models`,只激活 `online`/`pre-offline` 对话模型;当前模型不在列表则回落到可用默认) | `TOKENHUB_API_KEY`(亦认 `HERMIT_TOKENHUB_API_KEY`) |
显式给出的 `--api-base` / `--model` / 下表中的环境变量优先于预设。
@@ -76,6 +77,19 @@ cst-agent --provider openai
cst-agent --provider minimax
```
### 腾讯云 TokenHub
```bash
export TOKENHUB_API_KEY='...' # 或 HERMIT_TOKENHUB_API_KEY
hermit --provider tokenhub # 别名: tencent / tencentcloud
# 切换或 /key 保存后会自动 GET /v1/models,只激活 online 对话模型,
# 并把当前模型校正到可用列表(默认偏好 hy3)
hermit --provider tokenhub --model hy4-preview
# 新加坡站点:
hermit --provider tokenhub \
--api-base https://tokenhub-intl.tencentmaas.com/v1
```
### 任意兼容网关
```bash