Connect Moyi API to DeepSeek Harness
DeepSeek Harness (command: dsh) supports OpenAI-compatible model providers. After completing this guide, you can use models such as deepseek-flash, deepseek-v4-pro, deepseek-v4-flash, gpt-6-astra, gpt-6-sol, gpt-6-luna, and gpt-5.6-sol through Moyi API while keeping the Harness web interface, sessions, and agent capabilities.
Supported models
- DeepSeek:
deepseek-flash(DeepSeek V4.1 Flash),deepseek-v4-pro(August 13 official release),deepseek-v4-flash(July 31 official release) - GPT:
gpt-6-astra,gpt-6-sol,gpt-6-luna,gpt-5.6-sol,gpt-5.6-luna,gpt-5.6-terra,gpt-5.5
New accounts start with a $0 balance — top up before your first request. Top up from $5. If a request returns 402 with "wallet balance is insufficient", your balance is empty — your base URL and key are fine. Top up and retry.
1. Prerequisites
Before you begin, install Node.js 24 and prepare a valid Moyi API API key.
1.1 Install Node.js 24
DeepSeek Harness requires Node.js 24. npm is included with Node.js. Download the installer for your operating system and CPU architecture:
When using the China mirror, select a v24.x.x directory and download the installer for your system. After installation, reopen your terminal and check the versions:
node --version
npm --version
The output of node --version should start with v24..
Moyi API API keys start with sk-. You can create one in the Moyi API dashboard.
2. Configure and start in one step
You do not need to open or manually edit any configuration files. Replace sk-replace-with-your-api-key in the code block with your Moyi API API key, then copy and run the entire command in your terminal. It installs, configures, and starts DeepSeek Harness automatically.
macOS / Linux
bash <<'MOYIAPI_SETUP'
set -e
npm install -g @deepseek-ai/dsh
MOYIAPI_API_KEY="sk-replace-with-your-api-key"
export MOYIAPI_API_KEY
NODE_PATH="$(npm root -g)/@deepseek-ai/dsh/node_modules" node <<'NODE'
const fs = require('fs');
const os = require('os');
const path = require('path');
const yaml = require('js-yaml');
const home = process.env.DSH_HOME || path.join(os.homedir(), '.dsh');
const settingsPath = path.join(home, 'settings.yaml');
fs.mkdirSync(home, { recursive: true });
const current = fs.existsSync(settingsPath)
? (yaml.load(fs.readFileSync(settingsPath, 'utf8')) || {})
: {};
if (fs.existsSync(settingsPath)) {
fs.copyFileSync(settingsPath, settingsPath + '.bak.' + Date.now());
}
current['llm-pi-ai'] ??= {};
current['llm-pi-ai'].providers ??= {};
current['llm-pi-ai'].providers.moyiapi = {
displayName: 'Moyi API',
apiKeyEnv: 'MOYIAPI_API_KEY',
api: 'openai-completions',
baseURL: 'https://api.moyi-api.com/v1',
models: [
{ id: 'deepseek-flash', name: 'DeepSeek V4.1 Flash' },
{ id: 'deepseek-v4-pro', name: 'DeepSeek V4 Pro' },
{ id: 'deepseek-v4-flash', name: 'DeepSeek V4 Flash' },
{ id: 'gpt-6-astra', name: 'GPT 6 Astra' },
{ id: 'gpt-6-sol', name: 'GPT 6 Sol' },
{ id: 'gpt-6-luna', name: 'GPT 6 Luna' },
{ id: 'gpt-5.6-sol', name: 'GPT 5.6 Sol' },
{ id: 'gpt-5.6-luna', name: 'GPT 5.6 Luna' },
{ id: 'gpt-5.6-terra', name: 'GPT 5.6 Terra' },
{ id: 'gpt-5.5', name: 'GPT 5.5' },
],
};
current['agent-default-model'] = {
provider: 'moyiapi',
model: 'deepseek-flash',
};
fs.writeFileSync(
settingsPath,
yaml.dump(current, { lineWidth: -1, noRefs: true }),
{ mode: 0o600 },
);
const envPath = path.join(home, '.env');
const oldLines = fs.existsSync(envPath)
? fs.readFileSync(envPath, 'utf8').split(/\r?\n/)
: [];
const lines = oldLines.filter(
(line) => line && !line.startsWith('MOYIAPI_API_KEY='),
);
lines.push('MOYIAPI_API_KEY=' + process.env.MOYIAPI_API_KEY);
fs.writeFileSync(envPath, lines.join('\n') + '\n', { mode: 0o600 });
console.log('Moyi API configured. Default model: deepseek-flash');
NODE
dsh web
MOYIAPI_SETUP
Windows PowerShell
npm install -g @deepseek-ai/dsh
$env:MOYIAPI_API_KEY = 'sk-replace-with-your-api-key'
$env:NODE_PATH = "$(npm root -g)\@deepseek-ai\dsh\node_modules"
@'
const fs = require('fs');
const os = require('os');
const path = require('path');
const yaml = require('js-yaml');
const home = process.env.DSH_HOME || path.join(os.homedir(), '.dsh');
const settingsPath = path.join(home, 'settings.yaml');
fs.mkdirSync(home, { recursive: true });
const current = fs.existsSync(settingsPath)
? (yaml.load(fs.readFileSync(settingsPath, 'utf8')) || {})
: {};
if (fs.existsSync(settingsPath)) {
fs.copyFileSync(settingsPath, settingsPath + '.bak.' + Date.now());
}
current['llm-pi-ai'] ??= {};
current['llm-pi-ai'].providers ??= {};
current['llm-pi-ai'].providers.moyiapi = {
displayName: 'Moyi API',
apiKeyEnv: 'MOYIAPI_API_KEY',
api: 'openai-completions',
baseURL: 'https://api.moyi-api.com/v1',
models: [
{ id: 'deepseek-flash', name: 'DeepSeek V4.1 Flash' },
{ id: 'deepseek-v4-pro', name: 'DeepSeek V4 Pro' },
{ id: 'deepseek-v4-flash', name: 'DeepSeek V4 Flash' },
{ id: 'gpt-6-astra', name: 'GPT 6 Astra' },
{ id: 'gpt-6-sol', name: 'GPT 6 Sol' },
{ id: 'gpt-6-luna', name: 'GPT 6 Luna' },
{ id: 'gpt-5.6-sol', name: 'GPT 5.6 Sol' },
{ id: 'gpt-5.6-luna', name: 'GPT 5.6 Luna' },
{ id: 'gpt-5.6-terra', name: 'GPT 5.6 Terra' },
{ id: 'gpt-5.5', name: 'GPT 5.5' }
]
};
current['agent-default-model'] = {
provider: 'moyiapi',
model: 'deepseek-flash'
};
fs.writeFileSync(
settingsPath,
yaml.dump(current, { lineWidth: -1, noRefs: true }),
{ mode: 0o600 }
);
const envPath = path.join(home, '.env');
const oldLines = fs.existsSync(envPath)
? fs.readFileSync(envPath, 'utf8').split(/\r?\n/)
: [];
const lines = oldLines.filter(
(line) => line && !line.startsWith('MOYIAPI_API_KEY=')
);
lines.push('MOYIAPI_API_KEY=' + process.env.MOYIAPI_API_KEY);
fs.writeFileSync(envPath, lines.join('\n') + '\n', { mode: 0o600 });
console.log('Moyi API configured. Default model: deepseek-flash');
'@ | node
if ($LASTEXITCODE -eq 0) {
dsh web
}
The command installs DeepSeek Harness, backs up and merges any existing configuration, stores your key, configures the Moyi API models, and starts Harness. It does not remove your existing theme or other settings.
After startup, the terminal displays a local URL, usually http://127.0.0.1:3080. Open it in your browser and create a new session. To start Harness again later, run this command from your project directory:
dsh web
To use Harness in a specific project, change to the actual project directory before running dsh web. Do not copy /path/to/my-project literally; it is only a placeholder.
3. Verify the connection
In the page opened by dsh web, start a new session and send "Reply with OK only". If you get OK back, Harness is calling models through Moyi API. If it shows an invalid API key error, check that the key is complete.
You can also verify from the terminal. The setup in step 2 is imported only into the configuration that dsh web uses, so headless mode needs that configuration passed in. Without it you get MISSING_CREDENTIAL (it uses the official DeepSeek route, not Moyi API). The key is already saved in ~/.dsh/.env, so you don't need to export it:
dsh headless --patch ~/.dsh/profiles/web/cordis.patch.yml "Reply with OK only"
Windows PowerShell:
dsh headless --patch "$HOME\.dsh\profiles\web\cordis.patch.yml" "Reply with OK only"
If the terminal returns OK, the connection works.
4. Add and switch models
To choose from multiple Moyi API models in Harness, add them to the same models list. This example includes DeepSeek V4.1 Flash, DeepSeek V4 models, and several GPT models:
After dsh web starts for the first time, ~/.dsh/settings.yaml is imported and renamed to settings.yaml.imported. To change models later, create ~/.dsh/settings.yaml again with the full content below (it replaces the Moyi API model list and default model), then restart dsh web.
llm-pi-ai:
providers:
moyiapi:
displayName: Moyi API
apiKeyEnv: MOYIAPI_API_KEY
api: openai-completions
baseURL: https://api.moyi-api.com/v1
models:
- id: deepseek-flash
name: DeepSeek V4.1 Flash
- id: deepseek-v4-pro
name: DeepSeek V4 Pro
- id: deepseek-v4-flash
name: DeepSeek V4 Flash
- id: gpt-6-astra
name: GPT 6 Astra
- id: gpt-6-sol
name: GPT 6 Sol
- id: gpt-6-luna
name: GPT 6 Luna
- id: gpt-5.6-sol
name: GPT 5.6 Sol
- id: gpt-5.6-luna
name: GPT 5.6 Luna
- id: gpt-5.5
name: GPT 5.5
- id: gpt-5.4
name: GPT 5.4
agent-default-model:
provider: moyiapi
model: deepseek-flash
Change agent-default-model.model to set the default model for new sessions. Existing sessions may continue using their original model. After changing the default, refresh the page and create a new session, or switch models manually from the model selector.
Moyi API's model catalog is updated continuously. To confirm the current model IDs, run:
curl https://api.moyi-api.com/v1/models \
-H "Authorization: Bearer sk-xxxxxx"
5. Troubleshooting
The API returns 401 or invalid_bearer_token. Make sure the API key is complete, contains no extra spaces, has not been deleted, and starts with sk-. If the error continues, create a new key in the Moyi API dashboard and try again.
MISSING_CREDENTIAL mentioning deepseek-official / DEEPSEEK_API_KEY. This run did not pick up the Moyi API configuration or key. For headless and other modes, add --patch ~/.dsh/profiles/web/cordis.patch.yml as shown in step 3. If dsh web shows it too, check that ~/.dsh/.env contains MOYIAPI_API_KEY=sk-...; if not, run the step 2 command again.