Use AI Hub with DeepSeek Harness
Run DeepSeek Harness headless agent sessions through AI Hub's OpenAI-compatible Chat Completions endpoint with a Cordis provider patch.
@deepseek-ai/dsh@0.2.2-rc.1 is a release-candidate package and requires Node.js 24.9.0 or later. Pin the tested version when installing, and scope unattended runs to --profile headless over https://tokenhub-api.belive.sg/api/v1.
1. Prepare your workspace and key
Create a dedicated workspace inference key in API keys in this AI Hub environment and set a monthly spend cap. Use the API base below with a key from the same environment.
Supply the secret as BELIVE_TOKENHUB_API_KEY in the shell environment or in $DSH_HOME/.env (by default ~/.deepseek-harness/.env):
printf 'AI Hub API key: ' read -r -s BELIVE_TOKENHUB_API_KEY printf '\n' export BELIVE_TOKENHUB_API_KEY
- Do not store an AI Hub key in
DEEPSEEK_API_KEY. WhenDEEPSEEK_API_KEYis present, DeepSeek Harness mounts itsdsh-web-search-deepseekplugin and sends web-search calls with that token directly toapi.deepseek.cominstead of AI Hub. - Headless runs ignore
.credentials.yaml.--profile headlessdisables the interactivedsh-credentialsstore, so keys saved for interactive sessions are not loaded unless exported in the process environment or$DSH_HOME/.env.
2. Install the pinned CLI
Verify that Node.js 24.9.0 or later is active, then install the pinned CLI release candidate:
node --version npm install -g @deepseek-ai/dsh@0.2.2-rc.1 dsh --version
3. Configure $DSH_HOME/cordis.patch.yml
Create ~/.deepseek-harness/cordis.patch.yml (or $DSH_HOME/cordis.patch.yml when DSH_HOME is customized) to configure llm-pi-ai and agent-default-model:
- id: llm-pi-ai config: providers: belive-aihub: displayName: BeLive AI Hub apiKeyEnv: BELIVE_TOKENHUB_API_KEY api: openai-completions baseURL: "https://tokenhub-api.belive.sg/api/v1" compat: supportsDeveloperRole: false models: - id: qwen/qwen3.8-flash name: Qwen3.8 Flash contextWindow: 1000000 maxTokens: 32768 input: [text, image] compat: thinkingFormat: qwen supportsReasoningEffort: false reasoningEfforts: high: high off: - id: qwen/qwen3.8-max name: Qwen3.8 Max contextWindow: 1000000 maxTokens: 32768 input: [text, image] compat: thinkingFormat: qwen supportsReasoningEffort: false reasoningEfforts: high: high off: - id: deepseek/deepseek-v4.1-flash-1017 name: DeepSeek V4.1 Flash contextWindow: 1024000 maxTokens: 32768 input: [text, image] reasoningEfforts: minimal: minimal low: low medium: medium high: high xhigh: xhigh max: max off: none - id: agent-default-model config: provider: belive-aihub model: qwen/qwen3.8-flash reasoningEffort: high
- Exact catalogue IDs: Every
idundermodelsis an exactauthor/slugID from Models.agent-default-modelpairsprovider: belive-aihubwith that exactmodelID and dispatches requests tohttps://tokenhub-api.belive.sg/api/v1/chat/completions. - Bounded
maxTokens:qwen/qwen3.8-flashandqwen/qwen3.8-maxpublish a131000-token completion limit anddeepseek/deepseek-v4.1-flash-1017publishes384000. SettingmaxTokens: 32768bounds each turn's output reservation while leaving room for reasoning and multi-file edits. Checkhttps://tokenhub-api.belive.sg/api/v1/modelsor Models before adding other models. - Thinking controls (
thinkingFormatandreasoningEfforts):- On
qwen/qwen3.8-flashandqwen/qwen3.8-max,thinkingFormat: qwenwithsupportsReasoningEffort: falsetoggles DashScope's binaryenable_thinking: trueorfalseparameter (off:omits the effort sopi-aisendsenable_thinking: false). DashScope accepts top-levelreasoning_effortwithout error, whereas the catalogue publishesenable_thinkingandthinking_budget. - On
deepseek/deepseek-v4.1-flash-1017,dsh-llm-pi-aidefaults to OpenAI-stylereasoning_effort. Valuesminimalthroughmaxare accepted by the upstream route, andoff: nonemapsreasoningEffort: offtoreasoning_effort: "none", which disables thinking (omittingreasoning_effortleaves thinking enabled by default).
- On
supportsDeveloperRole: false: Rewrites system prompts from OpenAI'sdeveloperrole tosystemon the client side. This flag is optional: AI Hub accepts thedeveloperrole on Qwen routes and sends it assystem. Keeping it is harmless.
4. Run a headless task
Verify the composed configuration, then run a bounded one-shot task in a disposable project directory:
dsh --profile headless --dump-config >/dev/null dsh --profile headless --approval-policy never \ "Read package.json and list its script names."
Switch models or disable thinking on a single invocation with a --patch overlay:
cat > deepseek.patch.yml <<'EOF' - id: agent-default-model config: provider: belive-aihub model: deepseek/deepseek-v4.1-flash-1017 reasoningEffort: off EOF dsh --profile headless --patch ./deepseek.patch.yml --approval-policy never \ "Run node -v with bash and report the version."
In --profile headless, read-only file inspection is pre-approved while shell commands (bash) and file edits wait for interactive confirmation unless --approval-policy never is set. Use --approval-policy never only inside an isolated checkout or container.
This guide covers --profile headless over Chat Completions (https://tokenhub-api.belive.sg/api/v1). Check Activity after a run to inspect the req_… request ID, token usage and recorded cost.
Troubleshooting
401authentication error: ConfirmBELIVE_TOKENHUB_API_KEYis exported to thedshprocess or written to$DSH_HOME/.env, and matches this AI Hub environment. Never print the secret to inspect it.- Raw
<function=…>text during streaming tool turns onqwen/qwen3-coder-flash: Useqwen/qwen3.8-flashorqwen/qwen3.8-maxfor streaming agent tool loops until a later AI Hub release fixes this.