Blog

Connect DeepSeek Harness (dsh) to Moyi API: settings.yaml and DEEPSEEK_BASE_URL in dsh 0.2.x

Quick Answer

DeepSeek Harness (dsh) sends model requests to DeepSeek's official API by default. There are two ways to send them to Moyi API instead; we tested both with dsh 0.2.1-rc.3 on November 2, 2026:

  1. Add Moyi API as a provider (recommended). Put an OpenAI-compatible provider in ~/.dsh/settings.yaml and the key in ~/.dsh/.env. You choose which models dsh lists and which one is the default.
  2. Two environment variables (quick). DEEPSEEK_API_KEY and DEEPSEEK_BASE_URL redirect dsh's built-in DeepSeek provider to Moyi API. You get DeepSeek's two official model names, deepseek-flash by default. DEEPSEEK_DEFAULT_MODEL has no effect in dsh 0.2.x.

New accounts start with a $0 balance — top up before your first request. Top up from $5. If a request returns 402 (400 on the OpenAI format) with "wallet balance is insufficient", your balance is empty — your base URL and key are fine. Top up and retry.

Option 1: Add Moyi API as a provider

1. Get a key. Create an API key (sk-...) in the Moyi API console.

2. Save the provider as ~/.dsh/settings.yaml:

yaml
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-v4-pro
          name: DeepSeek V4 Pro
        - id: deepseek-flash
          name: DeepSeek V4.1 Flash
agent-default-model:
  provider: moyiapi
  model: deepseek-v4-pro

Add any other model ID from the pricing page to models to use it from the same key.

3. Put the key in ~/.dsh/.env:

bash
echo 'MOYIAPI_API_KEY=sk-your-key' >> ~/.dsh/.env
chmod 600 ~/.dsh/.env

4. Start dsh:

bash
npx @deepseek-ai/dsh web

On first start dsh 0.2.x imports settings.yaml into the profile you start (here ~/.dsh/profiles/web/cordis.patch.yml) and renames it to settings.yaml.imported. Open http://127.0.0.1:3080, start a session and pick a Moyi API model.

The import only happens once, into whichever profile you start next. Another profile, such as dsh headless, doesn't see it. Either pass the web profile's file:

bash
dsh headless --patch ~/.dsh/profiles/web/cordis.patch.yml "Reply with one word: pong"

or write a fresh settings.yaml before starting that profile. The DeepSeek Harness setup guide has a one-step script that writes both files for you.

Option 2: Two environment variables

bash
export DEEPSEEK_API_KEY="sk-your-key"
export DEEPSEEK_BASE_URL="https://api.moyi-api.com/v1"
npx @deepseek-ai/dsh web

What this does in dsh 0.2.1-rc.3, from our test:

  • dsh keeps its built-in deepseek-official provider and sends Anthropic-format requests to $DEEPSEEK_BASE_URL/messages, here https://api.moyi-api.com/v1/messages. Moyi API accepts them.
  • The model is DeepSeek's official name: deepseek-flash by default, or deepseek-v4-pro if you pick it in the Web UI's model picker. Other Moyi API models aren't listed.
  • DEEPSEEK_DEFAULT_MODEL is ignored: the request still used deepseek-flash with it set to deepseek-v4-pro. To change the default, use option 1.

Why point dsh at Moyi API

  1. No DeepSeek account — the key and balance come from Moyi API, so you don't need to register and fund platform.deepseek.com.
  2. One key, many models — with option 1, list DeepSeek, GPT, Gemini, Kimi or GLM models side by side and switch between them inside dsh.
  3. Pay per token — no subscription; top up from $5 by card. Current prices are on the pricing page.

Common Pitfalls

MISSING_CREDENTIAL ... deepseek-official?

dsh is still on its built-in provider and finds no key. With option 1, the profile you started didn't import settings.yaml (see the import note above), or ~/.dsh/.env has no MOYIAPI_API_KEY. With option 2, DEEPSEEK_API_KEY isn't exported in the shell that started dsh.

404 / connection failed?

Keep /v1 at the end of the base URL in both options. Option 1 appends /chat/completions; option 2 appends /messages. Either way the full path must start with https://api.moyi-api.com/v1/.

401 auth error?

The key is wrong, incomplete or deleted. Check that it starts with sk- and has no stray spaces, in ~/.dsh/.env for option 1 or in echo $DEEPSEEK_API_KEY for option 2.

Can I switch models per session?

Yes. The Web UI's model picker switches per session among the models the provider lists: the models you wrote with option 1, or deepseek-flash and deepseek-v4-pro with option 2.

Should the key go in the repo's .env?

No. Keep it in ~/.dsh/.env or your shell profile, outside the repository, so it is never committed.

Next: install DeepSeek Harness, or run DeepSeek's Super-agent on the same provider.

Ready to connect?Log in · top up · create an API key — three steps to start.