DeepSeek Setup
Overview
DeepSeek is an AI company known for high-quality, cost-effective large language models. DeepSeek models are popular for general chat, coding (DeepSeek Coder), and long-context tasks, often at a fraction of the cost of GPT-4 or Claude. OpenClaw is model-agnostic: you can use DeepSeek as the ābrainā of your agent by configuring it as a model provider. Your OpenClaw agent then gets DeepSeekās capabilities-strong reasoning, code generation, multilingual support-plus OpenClawās automation (files, browser, cron, messaging channels) and self-hosted control.
This guide covers:
- Getting a DeepSeek API key and where to set it
- Adding the DeepSeek provider block to your OpenClaw config
- Choosing DeepSeek model IDs (chat, coder, V2/V3) and context limits
- Cost considerations and why DeepSeek is a budget-friendly option
- DeepSeek-specific troubleshooting and best practices
- Links to agents, memory, and other model providers
Prerequisites
- OpenClaw installed and running (installation guide, platform-specific installs)
- A DeepSeek account and API access - sign up at platform.deepseek.com
- Basic familiarity with the command line and editing config (e.g.
openclaw config edit)
Step 1: Get Your DeepSeek API Key
DeepSeek uses API keys for authentication. Never commit keys to the config file; use environment variables or a secrets manager.
- Sign in or register at platform.deepseek.com.
- Create or copy an API key from the API keys or billing section.
- Set the key in your environment, for example:
On Windows (Command Prompt):export DEEPSEEK_API_KEY="sk-..."set DEEPSEEK_API_KEY=sk-.... For persistent setup, add to your shell profile or use a credential management approach recommended in our security best practices.
Step 2: Add the DeepSeek Provider in Config
Edit your OpenClaw config with openclaw config edit (or open the file path shown by openclaw doctor). In the model providers section, add a block for DeepSeek. Exact keys depend on your OpenClaw version; typical pattern:
- Provider id: e.g.
deepseek(youāll reference this in your agent config). - API key: Reference the env var (e.g.
DEEPSEEK_API_KEY) so the key is not stored in the config file. - Models: List of allowed model IDs (see below).
- Optional: Base URL (if using a proxy or custom endpoint), request timeout, or spending caps if your OpenClaw version supports them.
After editing, save the file. Restart the gateway if required by your version so it picks up the new provider. For the full config layout (gateway, channels, model providers, agents, skills, memory), see Configuration File Structure.
Step 3: Choose a DeepSeek Model
DeepSeek offers several models. Use the model ID that matches the model you want (check DeepSeekās API documentation for the latest names and context lengths). Examples of common IDs:
| Model | Typical use |
|---|---|
| deepseek-chat | General conversation, reasoning, and instruction-following; good for most agent workloads. |
| deepseek-coder | Code generation, review, and debugging; ideal for development and coding tasks. |
| DeepSeek-V2 / DeepSeek-V3 | Newer, more capable models; check DeepSeekās docs for current IDs and long-context support. |
DeepSeek models support large context windows in many cases. In OpenClaw, your memory and agent context settings determine how much history is sent; keep context within your modelās limit to avoid errors and control API cost. DeepSeek is often significantly cheaper per token than OpenAI or Anthropic, making it a strong choice for high-volume or cost-sensitive use cases.
Step 4: Assign the Model to an Agent
In the agents section of your config, set the agentās model to the DeepSeek provider and the desired model ID (e.g. deepseek-chat or the current ID from DeepSeekās docs). Only model IDs listed under your DeepSeek provider block will be allowed. See Agent customization for system prompts, multiple agents, and skills.
Verification
Run openclaw status and ensure the gateway and config are valid. Send a test message to your agent on a connected channel (e.g. Telegram). If the agent responds using DeepSeek, the provider is working. For diagnostics, use openclaw doctor and openclaw logs; see the troubleshooting guide and model and API errors for common failures.
Common Issues (DeepSeek)
| Issue | Solution |
|---|---|
| Invalid API key / 401 | Check that DEEPSEEK_API_KEY is set in the environment the gateway uses, and that the key is correct and active in the DeepSeek platform. |
| Model not found / invalid model | Use the exact model ID from DeepSeekās documentation; IDs can change with new versions. Ensure the model is listed in your providerās allowed models. |
| Rate limit (429) | DeepSeek enforces rate limits. Reduce request frequency, or add backoff/limits in config if supported; check your plan and quotas on the platform. |
| Connection or timeout errors | If you are in a region with restricted access, consider a proxy or check network/firewall settings. Ensure the base URL in config (if set) is correct. |
| Unexpected billing or high usage | Set spending limits or quotas in the DeepSeek platform; reduce context window size to lower token usage. |
For more errors and fixes, see the full troubleshooting hub and model and API errors.
Best Practices
- Secrets: Keep the API key in environment variables or a secrets manager; do not put it in the config file. See credential management and security best practices.
- Context and cost: Match your memory and agent context to your modelās context limit; DeepSeek is cost-effective but oversized context still increases latency and usage.
- Updates: Keep OpenClaw and your config in sync with the official docs; check DeepSeekās docs for model ID and pricing changes.
- Spending: Set usage or spending limits in the DeepSeek platform to avoid unexpected bills, even though DeepSeek is typically cheaper than other providers.
Other Model Providers
You can use multiple providers: e.g. DeepSeek for cost-effective daily tasks and Claude for complex reasoning. See the Model Providers overview and the per-provider guides: Anthropic Claude, OpenAI GPT, Google Gemini, Local Models (Ollama).
Next Steps
- Agent customization - system prompts, multiple agents, model per agent
- Memory configuration - persistent context and context limits
- Channel setup - connect Telegram, WhatsApp, Discord, Slack, and more
- Use cases and examples - what you can build with OpenClaw and DeepSeek
- OpenClaw vs ChatGPT - when to use cloud chat vs OpenClaw with a cost-effective model like DeepSeek
- Security checklist and security best practices
Related Resources
- Official OpenClaw Documentation - config schema and provider options
- DeepSeek API documentation - models, pricing, rate limits
- Video tutorials - installation and config walkthroughs
- Configuration templates - example configs