English | 简体中文
Use Tencent CodeBuddy (IOA) chat models directly in DeepSeek Harness (DSH): browser OAuth login, automatic token renewal, and model-list sync. Log in once, and craft-agent models such as deepseek-v4-pro, glm-5.2, kimi-k3-1, and minimax-m3 appear in the model picker.
The plugin registers a native ctx.llm adapter on the codebuddy provider and owns the whole request path: browser OAuth, token storage in ctx.credentials, model discovery from /v3/config, and its own SSE streaming + message serialization. Two deliberate identities, one per plane:
| Plane | Identity | Why |
|---|---|---|
Chat (POST /v2/chat/completions) |
CLI client (User-Agent: CLI/2.96.0 CodeBuddy/2.96.0, minimal headers) |
The CLI identity is what the chat endpoint expects; using it avoids IDE-identity blocks. |
Model discovery (GET /v3/config) |
Craft / VSCode (X-Agent-Intent: craft, X-IDE-*) |
The craft catalog is the only one disclosing per-model reasoning metadata (supportedEfforts, canDisableThinking, defaultEffort) and the curated model list. The CLI catalog answers the same endpoint but carries only fixed effort values. |
The catalog is cached for 5 minutes and refreshed on demand (sync-models).
DSH installs profile plugins through its official dsh plugin CLI (a thin pnpm forwarder: installs the dependency, appends the package to the profile's dsh.profile.bundles layer stack, and mounts the plugin via the bundle's in-package patch — no manual file editing).
Prerequisite: make sure pnpm is on your PATH, e.g. via Homebrew:
brew install pnpmdsh plugin --profile web add github:cainiao1992/dsh-codebuddy-authThis single command resolves the dependency from GitHub, installs it, and activates the plugin as a profile layer.
Restart DSH. The plugin registers the codebuddy provider natively on ctx.llm at startup, so CodeBuddy already appears in the Models page — unauthenticated — before you log in.
You can log in either through the agent, or from the command line. Pick one.
Tell the agent "log in with codebuddy". The agent calls the codebuddy tool, which opens the IOA login page in your browser and polls in the background; once the token arrives it writes credentials and warms the catalog, and the next request hits the chat endpoint directly.
# Directly, no npm deps, Node >= 18 only:
node ~/.dsh/profiles/web/node_modules/dsh-codebuddy-auth/bin/login-flow.mjs
# Or via the package bin from the install directory:
cd ~/.dsh/profiles/web && pnpm exec codebuddy-login
# Add --no-browser on a remote server / headless boxThe CLI only writes the credentials — the native adapter owns the route, so there is no settings route to manage; --international merely selects the OAuth endpoints the login itself uses.
dsh plugin --profile web remove dsh-codebuddy-authThis removes the dependency and takes the plugin back out of the profile layer stack. Restart DSH to unload it.
The plugin targets the China edition by default (copilot.tencent.com / www.codebuddy.cn). Select the international edition (www.codebuddy.ai) through the mount row's edition: intl config:
# your cordis.patch.yml mount row:
- id: codebuddy-auth
name: dsh-codebuddy-auth
edition: intl # omitted = China editionThe adapter and the login/model-discovery endpoints then all use www.codebuddy.ai. The CLI's --international only selects the international OAuth endpoints for the login itself.
- Switch models: pick any model under CodeBuddy in the model picker (e.g.
deepseek-v4-pro) - Status: "check codebuddy status" → the
codebuddytool'sstatusaction - Renewal (automatic, three layers): ① at every startup, the token is renewed when less than 5 minutes of validity remains (or it has already expired); ② while running, a check every 30 minutes renews whenever less than 1 hour remains — covering a long-lived dsh that never restarts; ③ if the refresh token itself is invalidated (password change / revocation), the first two layers fail and log it — then say "refresh codebuddy" to confirm, or log in again
- Model updates: after Tencent ships new models, say "sync codebuddy models" →
sync-models - Logout: "log out of codebuddy" → clears stored credentials
Each model is declared with its full real reasoning capability from /v3/config, so the model picker shows the levels each model actually offers:
- Selectable levels (per model):
supportedEffortsmirrors straight into the picker —deepseek-v4-proofferslow/high/xhigh,hy3offerslow/high, fixed-effort models (e.g.glm-5.1) offer their singlemedium. Sent on the wire asreasoning_effort: "<level>". - Default level: each model uses the
defaultEffortits/v3/configentry reports (e.g.glm-5.2defaults tohigh); every declared level stays selectable in the picker.
lib/index.js— the Cordis host plugin (host composition row). Registers thecodebuddyprovider and thecodebuddytool; refreshes/syncs at startup and every 30 minutes.lib/codebuddy-adapter.mjs— the nativectx.llmadapter: SSE streaming, message serialization, reasoning metadata, error mapping. Ported from shatyuka/dsh-llm-codebuddy (MIT).lib/codebuddy-core.mjs— OAuth, JWT decoding, identity headers, and/v3/configdiscovery; dependency-free.bin/login-flow.mjs— standalone login CLI; no npm dependencies.cordis.patch.yml— in-package patch (self-mount row for bundle consumers).
POST /v2/chat/completionsdoes not check User-Agent — any UA works; but the request must bestream: true(non-streaming returnscode 11101). DSH's llm adapters are streaming by default, so nothing to handle.GET /v3/config(model discovery) requires the craft / VSCode identity (X-Agent-Intent: craft+X-IDE-*headers) to disclose reasoning metadata; the plugin sends its own direct request for that.- CodeBuddy reports
supportsReasoningon every craft model. Models are declared with their real reasoning capability (levels persupportedEfforts), so reasoning is selectable in the model picker rather than stripped.
MIT