DeepSeekDSH
Independent community guideNot affiliated with DeepSeek.Download versions and guide references

Configure DeepSeek API for Claude Code and Cline

Connect DeepSeek-V3 and DeepSeek-R1 to Claude Code and VS Code Cline to run AI code generation and agent workflows with your own API key.

On this page
DeepSeek API credentials

Generate an API key from the DeepSeek Platform (starting with sk-) and confirm your account balance before connecting.

METHOD 1

Claude Code (terminal CLI) configuration

Configure Claude Code to route requests through DeepSeek via environment variables.

Add these lines to your shell profile (~/.zshrc or ~/.bashrc):

# macOS / Linux export ANTHROPIC_BASE_URL="https://api.deepseek.com/anthropic" export ANTHROPIC_API_KEY="sk-your_deepseek_api_key" # Optional: explicit model designation export ANTHROPIC_MODEL="deepseek-chat"

For Windows PowerShell sessions:

$env:ANTHROPIC_BASE_URL="https://api.deepseek.com/anthropic" $env:ANTHROPIC_API_KEY="sk-your_deepseek_api_key" $env:ANTHROPIC_MODEL="deepseek-chat"
Tip: If the CLI performs strict key validation, leave ANTHROPIC_API_KEY unset and use export ANTHROPIC_AUTH_TOKEN="sk-your_key". Run claude and use /status to inspect the endpoint.
METHOD 2

VS Code extension setup (Cline / Roo Code)

  1. Install Cline or Roo Code from the VS Code Marketplace.
  2. Open the extension panel and click Settings ⚙️.
  3. Set API Provider to DeepSeek (or OpenAI Compatible).
  4. Paste your key into DeepSeek API Key.
  5. Choose deepseek-chat for daily coding or deepseek-reasoner for architecture planning.
OpenAI Compatible parameters:
  • Base URL: https://api.deepseek.com or https://api.deepseek.com/v1
  • Model ID: deepseek-chat or deepseek-reasoner
METHOD 3

Claude Desktop proxy setup

Claude Desktop enforces official Anthropic signatures. Use a local gateway (like LiteLLM or deepseek-claude-proxy) to bridge the protocols:

# Example: run a local LiteLLM bridge pip install litellm litellm --model deepseek/deepseek-chat --api_base https://api.deepseek.com --port 8000
VERIFY

Send a test prompt

Send a safe read-only message in your client:

Reply only with "DeepSeek connected successfully." Do not modify files.

Common errors and solutions

401 Unauthorized / Authentication Error

Ensure the key begins with sk- with no surrounding whitespace. Do not use your web password.

402 Insufficient Balance

API usage is billed separately from web subscriptions. Top up your balance in the DeepSeek Platform.

Tool calling failures with Reasoning models

deepseek-reasoner focuses on pure reasoning. Use deepseek-chat when the agent invokes tools and executes commands.

References