DeepSeek Anthropic API Compatibility: Complete Field Mapping

DeepSeek Anthropic API compatibility lets an Anthropic Messages client call DeepSeek by changing the SDK base URL, API key, and model value—but it is not full Claude feature parity. DeepSeek supports core text, system prompts, streaming, thinking, and tool-use fields, while it ignores or rejects several Anthropic-specific fields and content blocks.

Last verified: July 21, 2026. This guide maps every header, top-level request field, tool field, and message content block listed in DeepSeek’s official Anthropic API compatibility guide.

Chat-Deep.ai is an independent guide and is not affiliated with DeepSeek or Anthropic. The examples below were syntax-checked against the documented SDK interfaces. We did not send a live API request because no test API key was used.

Quick answer

  • Base URL: https://api.deepseek.com/anthropic
  • Authentication: a DeepSeek API key passed through the Anthropic SDK or the x-api-key header
  • Recommended model values: deepseek-v4-pro or deepseek-v4-flash
  • Core support: text messages, system prompts, max tokens, stop sequences, streaming, thinking, and core tool use
  • Important limitations: image, document, MCP, code-execution, and container-upload content blocks are not supported by this compatibility route
  • Ignored fields: include anthropic-version, anthropic-beta, top_k, service_tier, and Anthropic-style cache_control

On this page

What DeepSeek Anthropic API compatibility means

The compatibility layer accepts the Anthropic Messages API shape at a DeepSeek-hosted base URL. This is useful when an application already depends on Anthropic’s official SDK, request structure, or tool-call conventions. In many text workflows, migration requires only a different client configuration and an explicit DeepSeek model ID.

Compatibility does not mean that DeepSeek runs a Claude model or implements every Anthropic beta feature. Treat the tables below as an allowlist: preserve supported fields, deliberately remove ignored fields, and redesign any workflow that depends on unsupported content blocks. A field or endpoint that is absent from DeepSeek’s published matrix is undocumented for portable use—not compatible by assumption. The published scope covers the Messages workflow; it does not promise Anthropic Batches, Files, token-counting, Admin, or other Anthropic endpoints. For a general platform introduction, see the DeepSeek API overview.

Endpoint and authentication

SettingDeepSeek valueCompatibility behavior
SDK base URLhttps://api.deepseek.com/anthropicDocumented Anthropic-format route
API keyYour DeepSeek API keyAccepted through the SDK or x-api-key
Messages methodclient.messages.create(...)Uses the Anthropic SDK’s Messages interface
Modeldeepseek-v4-pro or deepseek-v4-flashExplicit DeepSeek IDs avoid silent fallback routing
deepseek-anthropic-endpoint-model-mapping
Original visual summary of the endpoint, authentication method, and documented model routing. Based on DeepSeek API Docs; verified July 21, 2026.

Create a key in DeepSeek’s API platform and keep it server-side. Do not expose it in browser JavaScript, public repositories, screenshots, or WordPress page source. See how to create and protect a DeepSeek API key.

Node.js: use DeepSeek with the Anthropic SDK

Install Anthropic’s official TypeScript/JavaScript SDK:

npm install @anthropic-ai/sdk

Set a server-side environment variable named DEEPSEEK_API_KEY, then initialize the SDK with DeepSeek’s base URL:

import Anthropic from "@anthropic-ai/sdk";

const apiKey = process.env.DEEPSEEK_API_KEY;

if (!apiKey) {
  throw new Error("Set DEEPSEEK_API_KEY before starting the app.");
}

const client = new Anthropic({
  apiKey,
  baseURL: "https://api.deepseek.com/anthropic",
});

const message = await client.messages.create({
  model: "deepseek-v4-pro",
  max_tokens: 1024,
  system: "You are a concise technical assistant.",
  messages: [
    {
      role: "user",
      content: "Explain Anthropic model-prefix routing in one paragraph.",
    },
  ],
});

for (const block of message.content) {
  if (block.type === "text") {
    console.log(block.text);
  }
}

The SDK constructs the Messages request path beneath the configured base URL. Do not append a guessed path to baseURL; use the exact base URL DeepSeek documents.

Python setup

DeepSeek’s official compatibility page demonstrates the Anthropic Python SDK. Install it with:

pip install anthropic
import os
from anthropic import Anthropic

client = Anthropic(
    api_key=os.environ["DEEPSEEK_API_KEY"],
    base_url="https://api.deepseek.com/anthropic",
)

message = client.messages.create(
    model="deepseek-v4-pro",
    max_tokens=1024,
    system="You are a concise technical assistant.",
    messages=[
        {
            "role": "user",
            "content": "Explain Anthropic model-prefix routing in one paragraph.",
        }
    ],
)

print("".join(
    block.text for block in message.content if block.type == "text"
))

Anthropic model names mapped to DeepSeek

DeepSeek accepts its own model IDs and also maps documented Claude-style prefixes. These prefixes are routing aliases; they do not mean that the endpoint serves Claude or promises Claude feature parity.

Model value sent by the clientDeepSeek routeRecommendation
deepseek-v4-prodeepseek-v4-proUse explicitly for the Pro route
deepseek-v4-flashdeepseek-v4-flashUse explicitly for the Flash route
Starts with claude-opusdeepseek-v4-proCompatibility alias only
Starts with claude-sonnetdeepseek-v4-flashCompatibility alias only
Starts with claude-haikudeepseek-v4-flashCompatibility alias only
Other unsupported model namedeepseek-v4-flashAvoid relying on this automatic fallback

Migration rule: replace provider-specific model strings with an explicit DeepSeek model ID in production. Silent fallback can hide a typo or route traffic to a different performance tier than intended.

HTTP headers and top-level request fields

Header mapping

Anthropic headerDeepSeek statusWhat to do
x-api-keyFully supportedSend a DeepSeek API key
anthropic-versionIgnoredDo not depend on it for version negotiation
anthropic-betaIgnoredDo not assume Anthropic beta features become available

Complete top-level request-field mapping

FieldStatusDeepSeek behavior
modelMappedUse a DeepSeek model ID; documented Claude prefixes are routed as shown above
messagesSupportedUse Anthropic user/assistant messages and only the supported content blocks listed below
max_tokensFully supportedSets the maximum output-token allowance
containerIgnoredContainer state is not applied
mcp_serversIgnoredMCP server configuration is not forwarded
metadataPartially supportedOnly metadata.user_id is supported; other keys are ignored
service_tierIgnoredDoes not select a DeepSeek service tier
stop_sequencesFully supportedAccepted as stop sequences
streamFully supportedStreaming can be requested
systemFully supportedAccepted as the top-level system instruction; do not convert it to an OpenAI-style system message
temperatureFully supported outside thinking modeAccepted range is 0–2; it is silently ignored while thinking is enabled
thinkingPartially supportedtype: "enabled" and type: "disabled" are supported, but budget_tokens is ignored
output_configPartially supportedOnly output_config.effort is supported
top_kIgnoredDoes not affect generation
top_pFully supported outside thinking modeAccepted, but silently ignored while thinking is enabled
DeepSeek Anthropic API request field support matrix

Original visual summary of fully supported, partially supported, and ignored Anthropic request fields. Based on DeepSeek’s compatibility table and Thinking Mode guide; verified July 21, 2026.

Ignored is different from unsupported. An ignored field may be accepted without changing behavior, which can be more difficult to detect than a validation error. Remove ignored Anthropic fields during migration so the application does not imply controls that DeepSeek is not applying.

Thinking mode: supported fields and caveats

DeepSeek’s Anthropic-format route supports thinking content, but it does not use Anthropic’s thinking.budget_tokens as a reasoning-token budget. DeepSeek’s separate Thinking Mode documentation says thinking is enabled by default for the documented V4 models and uses output_config.effort for effort control. If your application needs temperature or top_p to influence generation, explicitly send thinking: { type: "disabled" }.

SettingBehavior
thinkingSupported
thinking.budget_tokensIgnored
output_config.effortSupported
effort: "low" or "medium"Mapped to DeepSeek’s high effort
effort: "xhigh"Mapped to DeepSeek’s max effort
temperature and top_pAccepted but have no effect while thinking is enabled

If reasoning controls are central to your application, read the dedicated DeepSeek Thinking Mode guide and test both the final text and thinking blocks your parser expects.

Tool definitions and tool_choice

Tool definition fields

FieldStatusNotes
tools[].nameFully supportedTool name is preserved
tools[].input_schemaFully supportedJSON Schema input definition is preserved
tools[].descriptionFully supportedTool description is preserved
tools[].cache_controlIgnoredDoes not enable Anthropic-style manual prompt caching

tool_choice mapping

Choice typeStatusLimitation
noneFully supportedNo documented subfield exception
autoSupporteddisable_parallel_tool_use is ignored
anySupporteddisable_parallel_tool_use is ignored
toolSupporteddisable_parallel_tool_use is ignored

Core function-style tool calls can migrate cleanly when your application owns tool execution. Do not assume that a supported content block also provides Anthropic-managed web search, code execution, or MCP infrastructure. See the implementation-focused DeepSeek Tool Calls guide.

Thinking-mode tool loop: preserve the assistant’s complete returned content array—including thinking, any opaque signature data, and tool_use—then send it back unchanged before the user’s tool_result. DeepSeek warns that omitting the prior reasoning after a thinking-mode tool call can produce an HTTP 400 response. Do not reconstruct or edit opaque thinking data.

Complete message and content-block mapping

The following table mirrors the message-field scope published by DeepSeek. “Not supported” applies to this Anthropic-compatible API route, not necessarily to every DeepSeek product or interface.

Message field or blockStatusSupported or ignored subfields
content: "plain string"Fully supportedString content is accepted
type: "text"Partially supportedtext supported; cache_control and citations ignored
type: "image"Not supportedReplace with a text-only workflow or a separately supported interface
type: "document"Not supportedExtract permitted text before sending, subject to your security rules
type: "search_result"Not supportedDo not confuse it with web_search_tool_result
type: "thinking"SupportedDo not assume budget_tokens controls its length
type: "redacted_thinking"Not supportedRemove any dependency on this block
type: "tool_use"Partially supportedid, input, and name supported; cache_control ignored
type: "tool_result"Partially supportedtool_use_id and content supported; cache_control and is_error ignored
type: "server_tool_use"SupportedBlock support does not prove parity with every managed tool
type: "web_search_tool_result"SupportedDoes not by itself mean DeepSeek supplies Anthropic’s hosted web-search tool
type: "code_execution_tool_result"Not supportedUse application-owned execution and return a supported tool result when appropriate
type: "mcp_tool_use"Not supportedMCP blocks cannot be forwarded as-is
type: "mcp_tool_result"Not supportedMCP blocks cannot be forwarded as-is
type: "container_upload"Not supportedContainer uploads are outside the documented compatibility scope
deepseek-anthropic-message-tool-compatibility
Original visual summary of supported and unsupported message and tool content blocks. Based on DeepSeek’s official compatibility table; verified July 21, 2026.

Use metadata.user_id safely

metadata.user_id is the only supported metadata key. DeepSeek documents it as an isolation signal used for content safety, KV-cache isolation, and request scheduling. It must match [a-zA-Z0-9\-_]+, contain no more than 512 characters, and must not include private information.

const message = await client.messages.create({
  model: "deepseek-v4-pro",
  max_tokens: 512,
  metadata: {
    user_id: "tenant_42_user_1087",
  },
  messages: [
    { role: "user", content: "Summarize this deployment note." },
  ],
});

Use an opaque internal identifier—not an email address, phone number, customer name, access token, or raw database record. Other keys placed inside metadata are ignored by this compatibility layer.

Streaming, response fields, and usage data

DeepSeek marks the top-level stream request field as fully supported. However, its Anthropic compatibility page does not publish a complete event-by-event streaming matrix or a field-by-field response and usage schema. Do not infer undocumented parity from the request table.

Portable response core

The official SDK example receives a standard Anthropic Message object. The safest portable core is id, type, role, model, content, stop_reason, stop_sequence, and usage. Limit content parsing to documented block types, and do not promise newer Anthropic stop reasons or response fields that DeepSeek has not listed.

Response areaSafe handling rule
content[]Handle documented text, thinking, tool_use, server_tool_use, and web_search_tool_result blocks
stop_reasonHandle core end, token-limit, stop-sequence, and tool-use outcomes; log unknown values
usage.input_tokensRead defensively from the standard message usage object
usage.output_tokensRead defensively from the standard message usage object
Cache-specific usage fieldsInspect the raw object; DeepSeek does not publish an Anthropic-endpoint name mapping

Anthropic’s SDK types include cache_creation_input_tokens and cache_read_input_tokens, while DeepSeek’s general cache documentation uses prompt_cache_hit_tokens and prompt_cache_miss_tokens. DeepSeek does not document a guaranteed translation between those names on the Anthropic route. Log the raw usage object before building billing or cache analytics around cache-specific keys.

  1. Record the event types and content-block deltas your SDK receives in a non-production test.
  2. Verify your parser handles text, thinking, tool-use, stop reason, and error paths actually used by your application.
  3. Log usage keys defensively and tolerate fields being absent.
  4. Re-run contract tests after upgrading the Anthropic SDK or changing the DeepSeek model.

A direct SSE parser must also ignore comment lines such as : keep-alive. DeepSeek documents that streaming connections may emit these comments during waits; non-streaming connections may receive blank lines. If inference has not begun after ten minutes, DeepSeek may close the connection.

If your application depends on cache-hit token accounting, do not map Anthropic cache fields by name without observing a real DeepSeek response. DeepSeek’s request-side cache_control fields are ignored, while DeepSeek context caching is a separate platform behavior explained in the DeepSeek Context Caching guide.

Migration checklist: Anthropic Messages to DeepSeek

  1. Change the base URL to https://api.deepseek.com/anthropic.
  2. Use a DeepSeek API key; do not reuse an Anthropic credential.
  3. Set an explicit DeepSeek model ID instead of relying on Claude-prefix mapping or Flash fallback.
  4. Remove ignored headers and fields so configuration does not imply behavior that is not applied.
  5. Replace unsupported content blocks, especially image, document, MCP, code-execution, and container-upload blocks.
  6. Review thinking controls: remove dependence on budget_tokens and use documented output_config.effort behavior.
  7. Review tool execution: keep application-owned tools, but do not expect cache_control, is_error, or disable_parallel_tool_use to work.
  8. Sanitize metadata.user_id and remove all private data.
  9. Contract-test streaming and responses because DeepSeek does not publish a complete event-level mapping on this compatibility page.
  10. Monitor routing and errors before moving production traffic.

If the application uses the OpenAI client rather than Anthropic’s SDK, follow the separate OpenAI SDK integration. For IDE-agent configuration, see how to use DeepSeek with Claude Code.

Common migration failures

HTTP statusDeepSeek meaning
400Invalid request format
401Authentication failure
402Insufficient balance
422Invalid parameters
429Rate or concurrency limit
500Server error
503Server overloaded
SymptomLikely causeCheck
Authentication errorAnthropic key used against DeepSeek, missing key, or server environment not loadedConfirm the client receives a DeepSeek API key and the base URL is exact
Unexpected Flash behaviorUnsupported or misspelled model value triggered automatic fallbackSend deepseek-v4-pro or deepseek-v4-flash explicitly
A setting appears to do nothingThe field is ignored, or thinking mode makes sampling controls ineffectiveCompare the payload with the tables above
Image or document request failsThose Anthropic content blocks are not supported on this routeRemove the block and use a supported text workflow
MCP configuration is missingmcp_servers is ignored and MCP content blocks are unsupportedRun MCP outside this endpoint and translate results into supported tool content
Parallel-tool policy is not enforceddisable_parallel_tool_use is ignoredEnforce sequencing in application code
Tool error flag has no effecttool_result.is_error is ignoredEncode the outcome in supported tool-result content and application state
Streaming parser breaksThe client assumes undocumented event parityCapture actual test events and update contract tests

For status codes, retry behavior, and diagnostic steps, use the DeepSeek API errors guide.

Frequently asked questions

Is the DeepSeek Anthropic API a drop-in replacement for Anthropic?

No. It preserves the Anthropic Messages shape for many core text and tool workflows, but several fields are ignored and multiple Anthropic content blocks are unsupported. Use the mapping tables as an allowlist and run contract tests before production migration.

What is the DeepSeek Anthropic base URL?

The documented base URL is https://api.deepseek.com/anthropic.

Can I use Anthropic’s official SDK with DeepSeek?

Yes. Configure the SDK with a DeepSeek API key, DeepSeek’s Anthropic-format base URL, and an explicit DeepSeek model ID. The Node.js and Python examples above show the client setup.

Which Claude model names map to DeepSeek?

Model values starting with claude-opus map to deepseek-v4-pro. Values starting with claude-sonnet or claude-haiku map to deepseek-v4-flash. These are routing aliases, not equivalent Claude models.

Does DeepSeek support Anthropic image and document blocks?

Not through the content-block compatibility table documented for this route. Both image and document are marked not supported.

Does thinking.budget_tokens limit DeepSeek reasoning?

No. DeepSeek marks budget_tokens as ignored. The documented Anthropic-format control is output_config.effort, and its values are mapped to DeepSeek’s effort levels.

Does cache_control enable prompt caching?

No. DeepSeek marks Anthropic-style cache_control fields as ignored on tool and message content. Do not use their presence as evidence of a cache write or cache hit.

Are web search and MCP fully compatible?

No. web_search_tool_result is listed as a supported content block, but that does not establish parity with Anthropic’s managed web-search tool. mcp_servers is ignored, and mcp_tool_use and mcp_tool_result blocks are not supported.

Official sources

For cost planning after compatibility testing, review DeepSeek API pricing.