First, the reality. The local credentials file looks like this (values masked):
version: 1
refs:
DEEPSEEK_API_KEY: <your key>
records:
client-connection/browser-session:
kind: grant
payload:
version: 1
secret: <session secret>The key under refs is plaintext, not a reference to a secret store. So treat the file as the key itself: out of repos, out of public backups, never sent to someone to debug.
Why use an environment variable anyway
- Backup granularity: the config worth keeping is tens of megabytes. With the key in the environment, that archive can be passed around freely; with the key in a file, every archive needs hand-picking.
- Multiple machines: environment variables are per machine, so syncing config does not carry the key.
How to set it
export DEEPSEEK_API_KEY='sk-...' # current shell echo 'export DEEPSEEK_API_KEY=...' >> ~/.bashrc # persistent; mind file permissions
In Windows PowerShell it is $env:DEEPSEEK_API_KEY = "sk-..."; persist with [Environment]::SetEnvironmentVariable.
ps e can surface it on some systems. It solves 'config got synced away', not 'the machine was compromised'. Not encryption.Verify it took effect
dsh --dump-config | grep -i -A3 model
If the dump shows a reference rather than a literal key, the path is right. Then run a file-reading task to confirm end to end.