
Comprehensive Guide to Integrating DeepSeek API with OpenClaw

By Ethan Stone


By Ethan Stone
I searched all over the web but could not find a guide on how to configure the official DeepSeek API key in OpenClaw, so I created one myself. The content below was summarized and generated by Claude Code based on my chat history. I hope it helps anyone who wants to use the official DeepSeek API key in OpenClaw.
npm install -g openclaw@latestThe installation process may take 3-5 minutes and will download about 674 dependency packages.
openclaw --versionIt should display something like:🦞 OpenClaw 2026.2.9
openclaw onboard --install-daemon --non-interactive --accept-riskExplanation:
--install-daemon: Install the background service
--non-interactive: Non-interactive mode
--accept-risk: Accept the security risk notice
openclaw statusMake sure the Gateway service is running.
Visit DeepSeek Official Website to register and obtain an API key.
Run the following command (replace YOUR_API_KEY with your actual API key):
openclaw config set models.providers.deepseek '{
"baseUrl": "https://api.deepseek.com/v1",
"apiKey": "YOUR_API_KEY",
"api": "openai-completions",
"models": [
{
"id": "deepseek-chat",
"name": "DeepSeek Chat (V3)"
},
{
"id": "deepseek-reasoner",
"name": "DeepSeek Reasoner (R1)"
}
]
}'openclaw config set agents.defaults.model.primary "deepseek/deepseek-chat"openclaw models aliases add deepseek-v3 "deepseek/deepseek-chat"
openclaw models aliases add deepseek-r1 "deepseek/deepseek-reasoner"openclaw gateway restartWait 3-5 seconds for the service to fully start.
openclaw agent --session-id test --message "Hello, please introduce yourself"If the configuration is successful, DeepSeek will reply normally.
openclaw dashboardYour browser will automatically open the dashboard. The URL format is:
http://127.0.0.1:18789/#token=YOUR_GATEWAY_TOKENopenclaw models statusIt should display:
# # Start Gateway
openclaw gateway
# # Restart Gateway
openclaw gateway restart
# # Stop Gateway
openclaw gateway stop
# Check service status
openclaw status
# Check detailed status
openclaw status --all
# # View real-time logs
openclaw logs --follow# # List all available models
openclaw models list --all
# # View current model configuration
openclaw models status
# Switch models during chat
/model deepseek-v3
# # Set the default model
openclaw config set agents.defaults.model.primary "MODEL_ID"
# # Add model aliases
openclaw models aliases add ALIAS "MODEL_ID"
# View all aliases
openclaw models aliases list# # Send a single message
openclaw agent --session-id SESSION_ID --message "Your question"
# # Specify timeout in seconds
openclaw agent --session-id test --message "Question" --timeout 60
# Use local mode (without Gateway)
openclaw agent --local --session-id test --message "Question"# # View configuration
openclaw config get CONFIG_PATH
# # Set configuration
openclaw config set CONFIG_PATH "VALUE"
# Remove configuration
openclaw config unset CONFIG_PATH
# # Run the setup wizard
openclaw configureError Message: disconnected (1008): unauthorized: gateway token missing
Solution:
# Open the dashboard with the token
openclaw dashboardOr retrieve the token manually:
openclaw config get gateway.auth.tokenError Message: Unknown model: test
Solution:
Error Message: HTTP 401 or Unauthorized
Solution:
Error Message: Request timed out or No reply from agent
Solution:
Solution:
Automatically switch to a fallback model when the primary model is unavailable:
openclaw config set agents.defaults.model.fallbacks '["deepseek/deepseek-reasoner"]'Add the following content to ~/.zshrc or ~/.bashrc:
# DeepSeek API Key (optional, if already set in the config file)
export DEEPSEEK_API_KEY="YOUR_API_KEY"
# OpenClaw Gateway Token (optional)
export OPENCLAW_TOKEN="YOUR_GATEWAY_TOKEN"Then reload the configuration:
source ~/.zshrc # or source ~/.bashrcopenclaw config set agents.defaults.workspace "/custom/workspace/path"Tip: If you run into other issues, you can run openclaw doctor --deep for deep diagnostics, or visit the official documentation for more help.
About the author

Ethan Stone is a recognized expert in the field of OpenClaw, known for his innovative contributions to its foundational frameworks and practical applications. He has dedicated his career to advancing the OpenClaw ecosystem, particularly in developing robust and scalable solutions for complex data processing. His work is frequently cited for its clarity and depth, and he is a sought-after speaker at industry conferences, where he shares insights on the future of OpenClaw technologies and their impact on various sectors.

by Sarah Jenkins