Fix DSH API key errors: MISSING_CREDENTIAL and UNKNOWN_MODEL
MISSING_CREDENTIAL in DeepSeek Harness means no API key is stored, while UNKNOWN_MODEL means the model is not configured — the former fails before the request is sent, the latter fails when the key exists but the model does not match. The root rule is that the API key, base URL and model name must all match the same provider. Fix it in three steps: store the key, check the model name, verify with one chat message.
DeepSeek Harness API key errors and when they trigger
MISSING_CREDENTIAL appears before UNKNOWN_MODEL: without any key the request never goes out; once a key exists, the model check runs and may then fail. The two messages and triggers (source):
MISSING_CREDENTIAL— the chat request fails right away with a "no API key stored" message. Triggered when: no key has been entered during first-time setup,~/.dsh/.credentials.yamlhas noDEEPSEEK_API_KEY, or no environment variable is exported;UNKNOWN_MODEL— the request can start but the model check fails. Triggered when: the model name is misspelled, the custom provider has never been given that model, or the name is not in the provider's list;- Order of attack: fix
MISSING_CREDENTIAL(missing key) first, thenUNKNOWN_MODEL(model mismatch) — the key is the gate, the model is the next hurdle.
Why DeepSeek Harness API key errors happen: missing credential, mismatched model
The two errors have two roots — no usable credential (the key is not stored) and a model name inconsistent with the provider config — and both sit under the same rule: the key, base URL and model name must all match one provider. In detail:
- No stored credential: when both the official Models page and
.credentials.yamlare empty, the request fails withMISSING_CREDENTIAL(source); the adapter source throws exactly this code when no key is found anywhere in the chain (source). - Model not configured:
UNKNOWN_MODELfires when the selected model is invisible to the provider — the official docs state the fix plainly: "Select a configured model or add the missing model to the custom provider" (source). - All three must match: the key is issued by that provider, the base URL is its endpoint, and the model name lives in its model list — one account, one endpoint, one model set; cross-mixing always errors.
Fix DeepSeek Harness API key errors: store the key, check the model, verify
Follow the fixed order: store the key via the settings page or config file, check the model name against the provider, then send one test message to confirm all three match. Step by step:
- Store the API key (fixes
MISSING_CREDENTIAL) — GUI route: open Settings → Models and entersk-your-keyin the provider's input field, then save; - Or edit the config file — edit
~/.dsh/.credentials.yamland add:Save and restart dsh so the credentials service reloads (source);yamlDEEPSEEK_API_KEY: sk-your-key - Check the model name (fixes
UNKNOWN_MODEL) — on Settings → Models, confirm the selected model exists in the current provider's list: compare spelling character by character (case-sensitive), and for a custom provider add the model to the provider config first; - Check the base URL — if you use a custom gateway, confirm the base URL and key belong to the same provider; an endpoint that does not match the DeepSeek official API produces 401 (see the "fetch available models 401" guide);
- Verify with one message — send a message in a session; a normal reply means success. If it still errors, read the code:
MISSING_CREDENTIAL→ back to step 1,UNKNOWN_MODEL→ back to step 3, 401 → check the base URL.
How to verify a DeepSeek Harness API key config: curl test and one chat message
Do not jump straight into a chat after configuring — verify the key with a curl call first, then confirm end-to-end with one message; only when both pass is the fix complete. In order:
-
Test the key directly with curl — bypass dsh to confirm the key works on its own:
bashcurl https://api.deepseek.com/v1/models -H "Authorization: Bearer <your-key>"200 with a model list → the key is valid; 401 → the key is invalid or expired, back to step 1 of the fix section.
-
Check the config file — confirm the key is actually written to the credentials file:
bashcat ~/.dsh/.credentials.yamlSeeing
DEEPSEEK_API_KEY: sk-your-keymeans it is stored; a missing file means you used the GUI route earlier. -
Environment-variable route (a third way to store the key) — to avoid touching files, export the variable before starting:
bashexport DEEPSEEK_API_KEY=sk-your-key dsh webNote: the variable lives only in the current terminal session — re-export it at the next launch.
-
One chat message as an end-to-end check — send "hello" in a Web UI session; a normal reply means the key, base URL and model name all match. If it still errors, map the code back to the fix section:
MISSING_CREDENTIAL,UNKNOWN_MODELor 401.
Notes: DeepSeek Harness — check the key before the model
MISSING_CREDENTIALandUNKNOWN_MODELare two gates: fix the key first, then the model — do not skip.- The environment-variable route (
export DEEPSEEK_API_KEY=sk-...in the launching terminal) works too, but only for that session. - Always restart dsh after changing config — credentials and the model list load at startup.
- Model errors are unrelated to plugins; installing or removing plugins does not change this three-way matching rule.
- See install error troubleshooting for other DeepSeek Harness install issues.
Sources: dshbase troubleshooting, DeepSeek Harness providers.md, llm-deepseek adapter.ts
FAQ
MISSING_CREDENTIAL in DeepSeek Harness means no usable API key existed when the request was made — nothing was entered on the Models page, DEEPSEEK_API_KEY is absent from ~/.dsh/.credentials.yaml, or no environment variable was exported. Enter the key on Settings → Models, or write DEEPSEEK_API_KEY: sk-your-key into that file (source: dshbase troubleshooting).
UNKNOWN_MODEL in DeepSeek Harness means the model you selected does not exist or is not configured on the provider — a typo in the model name or a model never added to a custom provider. Add the model to the provider, or select one that is already configured (source: DeepSeek Harness providers.md).
In DeepSeek Harness, MISSING_CREDENTIAL fails before the request is even sent (no key at all), while UNKNOWN_MODEL fails after the key is present but the model does not match. Troubleshoot in that order — check the key first, then the model name; only then does the request actually go out.
DeepSeek Harness requires all three settings to point at the same provider: the key is issued by that provider, the base URL is its endpoint, and the model name exists in its model list. After configuring, send one test message — a normal reply means all three match; otherwise map the error to MISSING_CREDENTIAL, UNKNOWN_MODEL or 401.
Related Terms
- MISSING_CREDENTIAL
- MISSING_CREDENTIAL is the error code DeepSeek Harness throws when a request finds no API key anywhere, meaning no credential is stored and no environment variable is exported.— DeepSeek Harness docs providers.md
- UNKNOWN_MODEL
- UNKNOWN_MODEL is the error code DeepSeek Harness throws when the selected model is not configured on the provider, meaning the name is wrong or the model was never added to a custom provider.— DeepSeek Harness docs providers.md
- API Key
- An API Key is the identity credential for calling a model service; DeepSeek Harness stores it via the Settings → Models page or the ~/.dsh/.credentials.yaml file and resolves it per request through its credentials service.— dshbase troubleshooting
- Base URL
- Base URL is the API endpoint of the model service provider; the key, base URL and model name must all match the same provider, and any mismatch fails the request.— dshbase troubleshooting