Both builds offer "<build> API key" beside the browser and desktop
sign-ins, for a key made on the build's keys page
(www.workbuddy.cn/profile/keys, www.workbuddy.ai/profile/keys).
A key is sent as WorkBuddy's own CLI sends CODEBUDDY_API_KEY
(@tencent-ai/codebuddy-code 2.177.0, read as data): its API-key
session has the key as the access token, uid "anonymous_" + the key's
last 8 characters, personal, no domain, no enterprise; model requests
carry X-API-Key: <key> and Authorization: Bearer <key>
(getCustomHeaders). So a key's chat has those, X-User-Id
anonymous_<last8>, no X-Domain, and the client headers the other
sign-ins send, to the same host: copilot.tencent.com/v2 for workbuddy
(the CLI's endpoint for CODEBUDDY_INTERNET_ENVIRONMENT=internal; it
treats www.workbuddy.cn and copilot.tencent.com as front doors of one
API) and www.workbuddy.ai/v2 for workbuddy-ai.
The loader's apiKey "" and x-api-key delete stay: they keep the SDK's
own (empty) key headers off; sign() now sets X-API-Key itself for a
key account and never for an OAuth one.
- Models: /v3/config is asked with a key only for ck_/pt_ keys, as the
CLI's shouldLoadRemoteConfig does; any other key keeps the built-in
list.
- Usage: a key's card says the credits are unknown and asks nothing
(the CLI reads no credits with a key; no endpoint guessed).
- A 401 on a key is never renewed or resent: it says the key was
refused and where to check it, marked expired only on
invalid_token. The >2 MiB reset probe doesn't ask the billing API
with a key.
Run at this tree (base ac11dcb):
- apikey.test.mjs: 12 pass; against the old index.mjs 10 fail, the 2
OAuth-unchanged tests pass.
- packages/workbuddy: HOME=<tmp> bun test, 167 pass 0 fail.
- repo: HOME=$(mktemp -d) bun test, 2760 pass 3 skip 0 fail;
bun scripts/check.mjs exit 0.
Not tried: a real WorkBuddy API key.