DeepSeek Setup

šŸ“˜ Guide Status: This page covers configuring DeepSeek as an OpenClaw model provider. For first-time OpenClaw setup, see the Quick Start Guide. For the full config layout, see Configuration File Structure.

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

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.

  1. Sign in or register at platform.deepseek.com.
  2. Create or copy an API key from the API keys or billing section.
  3. Set the key in your environment, for example:
    export DEEPSEEK_API_KEY="sk-..."
    On Windows (Command Prompt): 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

Related Resources