Configure a model (API Key)
What an API key is, where to get one, how to plug it into DSH — plus attaching OpenAI / Anthropic models and a quick error decoder.
5 min read
After this tutorial you will
- Understand what an API key is and why you need one
- Get your own DeepSeek API key into DSH
- Know how to attach other models (OpenAI, Anthropic, and more)
- Be able to fix the most common errors
What is an API key
DeepSeek Harness is the body; the model is the brain. The API key is the pass connecting the two — a string starting with sk-, essentially the credential for your model account:
- DSH itself is free and open source, but making the AI "think" calls DeepSeek's model service;
- that service is billed by usage (tokens in and out) at very low rates. A few units of credit typically lasts casual users weeks;
- the key spends from your account no matter who holds it — treat it like a payment password. Never share it, never commit it to a repository.
Step 1: Create a DeepSeek API key
- Open platform.deepseek.com, sign up and log in (ordinary phone/email registration);
- Find the API Keys page in the left menu and click Create;
- Name the key (e.g. "dsh-home") and copy it immediately — once the dialog closes you can never see the full key again; if you lose it, just create another.
Top up while you're there
The DeepSeek API isn't free-tier based; your account needs a balance to make calls. Top up a small amount on the platform's top-up page (Alipay/WeChat supported). Unused credit stays put — there is no subscription.
Step 2: Enter it in DeepSeek Harness
- Start dsh (
npx @deepseek-ai/dsh webordsh web) and open the UI in your browser; - Go to Settings → Models;
- Paste the key into the DeepSeek card's API key field and save;
- Pick a model in the model selector (
deepseek-chatis the everyday choice).
Done. No restart needed — model changes take effect on the next request.
A few facts for peace of mind:
- After saving, the UI only shows a masked key tail, never the full string;
- it is stored locally in
~/.dsh/.credentials.yamland never uploaded anywhere; - changing or deleting keys happens on the same page, anytime.
Common errors, decoded
| Error / symptom | Cause | Fix |
|---|---|---|
MISSING_CREDENTIAL | No key entered | Settings → Models, paste and save |
| 401 / insufficient balance | Invalid key, or empty account | Check the key was copied fully; top up |
UNKNOWN_MODEL | The selected model doesn't exist | Re-select a configured model in the selector |
| Requests hang forever | Network issue | Check connectivity; corporate networks may need a proxy |
Other models? Sure
DSH is model-agnostic — it is not locked to DeepSeek. Any provider with an API key works:
- Anthropic / OpenAI etc.: Settings → Models → Add provider, pick the vendor, paste the key — the model list fills in automatically;
- Self-hosted or gateway services: choose Add custom provider and fill in three things — the base URL (e.g.
https://your-gateway.com/v1), the protocol (usually OpenAI-compatible), and the API key — then add a model ID manually.
Afterwards all providers appear together in the model selector at the top, ready to switch anytime. Different sessions can use different models.
Note: vision models behind some third-party OpenAI-compatible gateways must declare image support manually — see the official docs for details.
Key hygiene, in three lines
- Never in repos: don't write the key into code or any file that gets committed;
- One key per use: separate keys per device/project — a leaked one can be revoked alone;
- Suspect a leak? Delete now: hit delete on the platform's API Keys page; containment takes 30 seconds.
Next up
The brain is in place — time to equip your assistant with its first tool: