Commit Graph
2 Commits
Author SHA1 Message Date
yetone 209dc69b59 providers: Tencent Cloud is one preset, its regions Plan · China, Pay as you go · China and Pay as you go · Global (Discord, Jorben: Tencent Cloud's Token Plan, TokenHub and TokenHub China were three tiles of one vendor) — tencent-token-plan, tencent-tokenhub-cn and tencent-tokenhub become tencent-cloud's regions plan, cn and intl, as Xiaomi MiMo's are, each made as its own preset made it: the plan's /plan endpoints with no Responses, its own models and no catalog; TokenHub's hosts with Responses, models.dev's tencent-tokenhub and its own keys page and docs. A region now carries its Website, Catalog and Models, and a saved provider's region is found by its endpoints (regionOf, by exact URL before path, since TokenHub China and global share their paths): normalize gives it that region's keys page, docs and catalog (a catalog the user picked is kept), and planModels its models. The old ids are aliases, as qianfan-token-plan is of baidu-qianfan: Preset and FromPreset take them, FromPreset builds at their region, normalize rewrites a saved provider's preset to tencent-cloud, and a provider's own id never changes, so its key, models, routing groups, usage and prices stay where they were; magpie://import links by an old id land at its region, and region= now also gives a region's docs and catalog. Imports from other apps match a region's endpoints. The editor's docs link follows the region picked with the segmented control, en and zh ("按量 · 中国", "按量 · 国际"); the add sheet has one Tencent Cloud tile; the site's import docs list tencent-cloud with its regions and import.html still names the old ids. TestTencentCloud (each region, old ids, FromPreset, imports, import links) and TestTencentCloudOldPresetsKeepWorking (a providers.json saved by an older magpie under all three old presets, with a routing group over them, read, re-saved as the editor saves and switched between regions) fail on the old code; TestTencentTokenHubRoutes routes through old ids and tencent-cloud alike. tencent-cloud.test.cjs (WebKit en and zh: one tile, the three regions, no select, the docs and Get a key links following the region, an old id's provider opening at its region and saved under its id) fails on the old app.js; add-sheet, zhipu-team, system-one, strip-scrollbar and click-scroll pass (Chromium doesn't launch in this sandbox). Not tried with a Tencent account. go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. 2026-10-04 19:38:14 +08:00
yetone e60b721532 providers: Tencent Cloud TokenHub pay as you go is a preset, its global endpoint and China's one row in the add sheet (Jorben on Discord: magpie's Tencent Cloud is TokenHub's Token Plan subscription, whose endpoints pay-as-you-go keys can't use; TokenHub's pay as you go is at tokenhub.tencentmaas.com and tokenhub-intl.tencentmaas.com and speaks Chat Completions, Responses and Anthropic Messages) — the only Tencent preset was tencent-token-plan, at the plan's own api.lkeap.cloud.tencent.com/plan/v3 and /plan/anthropic, where a pay-as-you-go key is no good, so such a key could only go in a custom provider by hand. Now tencent-tokenhub ("Tencent Cloud TokenHub", Singapore, tokenhub-intl.tencentmaas.com) and tencent-tokenhub-cn ("Tencent Cloud TokenHub (China)", Guangzhou, tokenhub.tencentmaas.com) are presets, as TokenHub's language-model API page (1823/130079) gives them: chat completions and Responses at <host>/v1 (Responses converted from chat on TokenHub's side for the models that speak chat alone, 1823/133813), Anthropic messages at <host>/v1/messages with the key as x-api-key, the OpenAI APIs with it as a Bearer, and the model list at /v1/models. Being id and id-cn they pair into one row in the add sheet, its editor switching between them with the key kept, beside the plan's Tencent Cloud row, with the plan's icon (tencentcloud-color), the note "Pay as you go" (按量付费), and models.dev's tencent-tokenhub entry for names and prices; Hosts, as it serves DeepSeek, GLM, Kimi, MiniMax and Qwen besides Hy, so its list is no maker's word on theirs. Keys are made at console.tencentcloud.com/tokenhub/apikey and console.cloud.tencent.com/tokenhub/apikey. An entry imported from another app at either host, on any of the three APIs, is the preset. The plan's preset, its endpoints, models and saved providers are untouched; its note "TokenHub · subscription" now has its Chinese (TokenHub · 订阅). TestTencentTokenHub (endpoints, pair, import from each API, the plan unmoved), TestTencentTokenHubList (its /v1/models as its docs show it, asked with a Bearer, an embedding model left out) and TestTencentTokenHubRoutes (both presets at a fake TokenHub: chat, Responses and messages each reach /v1/chat/completions, /v1/responses and /v1/messages untranslated, Bearer on the first two, x-api-key on messages) are new and fail without the change (no such preset). No request was made to Tencent and no real key used. add-sheet.test.cjs passes in WebKit. go vet ./internal/..., go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui -count=1 ./... under a temp HOME pass (TestFXInState's known TempDir cleanup flake aside). 2026-10-02 21:11:03 +08:00