DeepSeek Harness

Configure a custom provider for DeepSeek Harness (dsh).

DeepSeek Harness (command dsh) is DeepSeek's open-source agent runtime. It ships with a web UI where you can add a custom model provider pointing at this site.

  • Protocol: OpenAI-compatible or Anthropic
  • Base URL: https://tokenfunc.com/v1 for OpenAI-compatible, https://tokenfunc.com for Anthropic
  • Models: DeepSeek and others, for example deepseek-chat
  1. Start the web UI

    Install Node.js first, then run:

    npx @deepseek-ai/dsh web

    The first start downloads dependencies and can take about two minutes with no progress output. Then open http://127.0.0.1:3080 in your browser.

  2. Add a model provider

    Go to Settings → Models → Add model provider, switch the card to Custom model API and fill in:

    FieldValue
    Provider IDtokenfunc (lowercase only; cannot be changed after saving)
    Display nametokenfunc
    Base URLhttps://tokenfunc.com/v1
    API protocolOpenAI Chat Completions
    API keysk-xxxxxxxxxxxxxxxx

    Screenshot pendingThe Add model provider card in DeepSeek Harness switched to Custom model APItools/dsh-provider.png

    A provider uses exactly one protocol. To also use Claude models over the Anthropic protocol, add a second provider with another ID (for example tokenfunc-claude), API protocol Anthropic Messages and base URL https://tokenfunc.com.

  3. Add models

    Under Model catalog click Fetch available models and tick the models you want. If the list cannot be fetched, type the model ID, for example deepseek-chat.

    Screenshot pendingThe model checklist shown by Fetch available modelstools/dsh-models.png

  4. Verify

    After saving, choose the new model in the chat model picker and send a message. A reply means you are connected.

Configuring with a file

You can also declare the provider in ~/.dsh/profiles/web/cordis.patch.yml (or ~/.dsh/cordis.patch.yml to apply it to every profile):

~/.dsh/profiles/web/cordis.patch.yml
- id: llm-pi-ai
  config:
    providers:
      tokenfunc:
        apiKeyEnv: TOKENFUNC_API_KEY
        api: openai-completions
        baseURL: https://tokenfunc.com/v1
        compat:
          supportsDeveloperRole: false
          maxTokensField: max_tokens
        models:
          - id: deepseek-chat

The key is read from the TOKENFUNC_API_KEY environment variable, which must be set before starting dsh:

export TOKENFUNC_API_KEY="sk-xxxxxxxxxxxxxxxx"

Troubleshooting

SymptomCause and fix
MISSING_CREDENTIALNo key saved, or the variable was set after dsh started
UNKNOWN_MODELThe model is not added under this provider
401 when fetching modelsWrong key. Check it on API Keys
Address and key are right but every request is rejectedAdd supportsDeveloperRole: false and maxTokensField: max_tokens under the provider's compat (see the config above)
Mistyped Provider IDIt cannot be edited. Delete the provider and create it again