Back to library
AI
tutorial

Drop-In DeepSeek V4 Using OpenAI or Anthropic SDKs

Use existing OpenAI or Anthropic code structures to run DeepSeek.

Leverage DeepSeek's new multi-interface support to swap expensive models for V4-Flash or V4-Pro with zero code refactoring.

DeepSeek

The Scenario

You have a high-volume data processing script written for the Anthropic Claude API but need to drastically reduce costs without rewriting your entire codebase.

Before & after

The old way

Developers would spend 1-2 hours rewriting their specific Anthropic SDK implementation code to match a different provider's unique JSON structure.

With AI

Swap your Claude or GPT endpoint for DeepSeek V4-Flash using the Anthropic-compatible interface. This configuration change takes about 3 minutes.

The Prompt

# Change your client initialization (example for Anthropic-style SDK):
client = Anthropic(
    api_key="[YOUR_DEEPSEEK_API_KEY]",
    base_url="https://api.deepseek.com"
)
# Use model: "deepseek-v4-flash"

DeepSeek V4 now natively supports both OpenAI and Anthropic interfaces, meaning you can drop the API key and URL into existing codebases built for Claude without refactoring your logic.

Source

Change Log | DeepSeek API Docs
"DeepSeek API now supports V4-Pro and V4-Flash, available via both the OpenAI ChatCompletions interface and the Anthropic interface."