DeepSeek Harness with AI Gateway
DeepSeek Harness (dsh) is DeepSeek's terminal coding agent, built on the pi-ai LLM layer. You can configure it to use AI Gateway for unified model access and spend monitoring, while keeping its native model picker.
Run the Vercel CLI setup command for DeepSeek Harness:
npx vercel ai-gateway setup --agent deepseekThe command writes an llm-pi-ai section to $DSH_HOME/settings.yaml naming AI_GATEWAY_API_KEY as the key environment variable, plus a model shortlist that leads with the newest DeepSeek models and follows with the gateway's most-used models. Re-run it to refresh the shortlist.
If you can't use the Vercel CLI, configure DeepSeek Harness manually:
Go to the AI Gateway section in the Vercel dashboard sidebar and click API keys to create a new API key.
Export the key in your shell:
Terminalexport AI_GATEWAY_API_KEY="your-ai-gateway-api-key"To persist the key, add the same line to your shell's startup file.
Add the gateway provider to the
llm-pi-aisection of$DSH_HOME/settings.yaml(default~/.dsh/settings.yaml):~/.dsh/settings.yamlllm-pi-ai: providers: vercel-ai-gateway: apiKeyEnv: AI_GATEWAY_API_KEY models: - id: deepseek/deepseek-v4-flash name: DeepSeek V4 Flash - id: openai/gpt-6-astra name: GPT-6 Astra agent-default-model: provider: vercel-ai-gateway model: deepseek/deepseek-v4-flashThe shortlist under
modelsdrives the picker. Replace pi-ai's full catalog with the gateway models you want, and add any gateway model ID to it.agent-default-modelpicks the model DeepSeek Harness starts with.Open a new terminal so the key is loaded, then run:
TerminaldshHeadless runs use the gateway route too. Switch models with
/modelin a session.
View your usage, spend, and request activity in the AI Gateway section in the Vercel dashboard sidebar. See the observability documentation for more details.
| Variable | Description |
|---|---|
AI_GATEWAY_API_KEY | Your AI Gateway API key, named by apiKeyEnv. Required |
DSH_HOME | Overrides the harness home directory. Defaults to ~/.dsh |
- Browse the models catalog for available models
- Configure spend limits on your API key
Was this helpful?