Is DeepSeek Compatible with Anthropic API and Claude Code?

Yes, DeepSeek V4 Pro and V4 Flash models support the Anthropic-compatible endpoint at https://api.deepseek.com/anthropic, enabling seamless integration with Claude Code and other Anthropic API clients.

The deepseek-ai/awesome-deepseek-agent repository documents how DeepSeek provides first-class support for the Anthropic Messages API specification. This compatibility layer allows developers to substitute DeepSeek models into existing Anthropic API workflows without modifying client logic or toolchains.

Anthropic-Compatible Endpoint Architecture

DeepSeek implements the Anthropic Messages API specification through a dedicated compatibility endpoint. According to the documentation in docs/deepseek-droid-guide.md (lines 8-13 and 20-28), the V4 Pro and V4 Flash models expose a provider-agnostic interface that accepts standard Anthropic request formats.

Key configuration parameters include:

  • Base URL: https://api.deepseek.com/anthropic
  • Provider Type: Must be set to "anthropic" in client configurations
  • Supported Models: deepseek-v4-pro and deepseek-v4-flash

The docs/copilot_cli.md file reinforces this requirement, emphasizing that the anthropic provider type is necessary for proper DeepSeek integration. Furthermore, CONTRIBUTING.md establishes the "Claude Code / Anthropic-compatible" naming convention for documenting these integrations, ensuring consistent references across the repository.

Configuring Claude Code for DeepSeek

Claude Code supports DeepSeek through environment variable overrides that redirect API calls from Anthropic's default endpoint to DeepSeek's Anthropic-compatible gateway. The configuration guide in docs/claude_code.md (lines 64-73) specifies three required environment variables.

Linux and macOS Setup

export ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic
export ANTHROPIC_AUTH_TOKEN=<your DeepSeek API Key>
export ANTHROPIC_MODEL=deepseek-v4-pro[1m]   # or deepseek-v4-flash[1m]

Windows PowerShell Setup

$env:ANTHROPIC_BASE_URL="https://api.deepseek.com/anthropic"
$env:ANTHROPIC_AUTH_TOKEN="<your DeepSeek API Key>"
$env:ANTHROPIC_MODEL="deepseek-v4-pro[1m]"   # or deepseek-v4-flash[1m]

After setting these variables, launch Claude Code normally:

cd /path/to/project
claude   # Initiates session using DeepSeek via Anthropic API

This pattern leverages Claude Code's existing Anthropic client implementation while routing requests to DeepSeek's infrastructure, as documented in docs/claude_code.md (lines 90-99).

Factory AI Droid Integration Pattern

For Factory AI Droid users, DeepSeek models are configured as custom Anthropic-compatible providers. The JSON configuration in docs/deepseek-droid-guide.md (lines 20-44) demonstrates the required schema:

{
  "model": "deepseek-v4-pro",
  "id": "custom:deepseek-v4-pro---Anthropic",
  "baseUrl": "https://api.deepseek.com/anthropic",
  "apiKey": "<your DeepSeek API Key>",
  "displayName": "DeepSeek V4 Pro",
  "provider": "anthropic"
},
{
  "model": "deepseek-v4-flash",
  "id": "custom:deepseek-v4-flash---Anthropic",
  "baseUrl": "https://api.deepseek.com/anthropic",
  "apiKey": "<your DeepSeek API Key>",
  "displayName": "DeepSeek V4 Flash",
  "provider": "anthropic"
}

The provider: "anthropic" field is mandatory, signaling to the Droid client that it should use Anthropic API message formatting when communicating with the DeepSeek endpoint.

Summary

  • DeepSeek V4 Pro and V4 Flash expose an Anthropic-compatible endpoint at https://api.deepseek.com/anthropic
  • Claude Code supports DeepSeek through the ANTHROPIC_BASE_URL environment variable override, as detailed in docs/claude_code.md
  • All configurations require setting the provider type to "anthropic" to enable proper API translation
  • Factory AI Droid, Claude Code, and other Anthropic API clients can use DeepSeek models without code changes by updating base URLs and authentication tokens

Frequently Asked Questions

Which DeepSeek models support the Anthropic API?

DeepSeek V4 Pro and V4 Flash are the primary models supporting the Anthropic-compatible endpoint. These models are explicitly listed in the Factory AI Droid configuration tables within docs/deepseek-droid-guide.md and support the full Anthropic Messages API specification.

How do I switch Claude Code from Claude models to DeepSeek?

Set the ANTHROPIC_BASE_URL environment variable to https://api.deepseek.com/anthropic, provide your DeepSeek API key via ANTHROPIC_AUTH_TOKEN, and specify either deepseek-v4-pro[1m] or deepseek-v4-flash[1m] as the ANTHROPIC_MODEL value. Claude Code will then route all requests to DeepSeek's infrastructure while using Anthropic's client protocols.

What is the difference between DeepSeek's native API and the Anthropic-compatible endpoint?

The native DeepSeek API uses DeepSeek-specific request and response schemas, while the Anthropic-compatible endpoint (https://api.deepseek.com/anthropic) accepts standard Anthropic Messages API payloads. The latter enables drop-in compatibility with existing Anthropic clients like Claude Code without requiring client-side code modifications.

Can other Anthropic-compatible tools work with DeepSeek?

Yes, any client that supports the Anthropic Messages API and allows custom base URLs can integrate with DeepSeek using the https://api.deepseek.com/anthropic endpoint and the anthropic provider type. This includes tools like Factory AI Droid, custom API clients, and automation frameworks that support Anthropic's protocol.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →