DeepSeek API Integration: OpenAI & Anthropic Formats
Master DeepSeek API integration. OpenAI-compatible SDK configuration, Anthropic API format for Claude tooling, tool calls with thinking mode, strict JSON schema enforcement, and migration patterns from OpenAI and Anthropic.
DeepSeek's API is uniquely dual-format — it supports both OpenAI-compatible endpoints and Anthropic API format. This means you can use the OpenAI SDK with base_url=https://api.deepseek.com or the Anthropic SDK with base_url=https://api.deepseek.com/anthropic. Migration from either ecosystem is typically a single-line change.
But integration depth varies. The Anthropic format supports thinking mode, tool calls, and streaming — but ignores budget_tokens for thinking and cache_control. The OpenAI format supports JSON mode, FIM completion, and streaming. Tool calls in thinking mode have unique constraints around reasoning_content management. The pages in this section cover the full integration landscape.
Note:
LangChain compatible: DeepSeek works with LangChain out of the box. Just set the OpenAI-compatible base_url and api_key in your LangChain configuration.
What You'll Find Here
OpenAI-Compatible API
SDK configuration for OpenAI, LangChain, and other compatible tooling. Anthropic API format for Claude ecosystem tools. Migration patterns from both platforms. Streaming differences and keep-alive handling.
Tool Calls with Thinking
Combining tools and reasoning in DeepSeek. The mandatory reasoning_content passback rule for tool-call loops. strict mode (beta) for JSON schema enforcement in function calls. Error handling and 400 avoidance patterns.
Related Articles & Guides
DeepSeek OpenAI-Compatible API: SDK Integration & Migration
Configure DeepSeek's OpenAI-compatible API and Anthropic API format. SDK integration patterns, LangChain support, migration from OpenAI/Anthropic, streaming differences, and model mapping behavior.
DeepSeek V4 in OpenCode: Setup Guide
Run DeepSeek V4 in OpenCode. Configure the provider, set model IDs, and fix the thinking-mode bug where reasoning_content gets dropped and OpenCode errors out on turn 2-3.
DeepSeek V4 with Claude Code: Full Setup Guide
Run Claude Code on DeepSeek V4 models. Configure ANTHROPIC_BASE_URL, model mapping (opus→v4-pro, sonnet/haiku→v4-flash), subagent models, web search, and cost savings.