Advertisement

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. The route now supports text workflows on V4 Flash and Pro, plus image input on the experimental deepseek-v4-flash-vision-exp model. General document blocks remain unsupported.

Current contract rechecked: August 22, 2026. This source review covers DeepSeek’s official Anthropic API compatibility guide, Vision guide, Files API guide, the July 31 V4 Flash update, the August 13 V4 Pro GA release, and the August 21 Vision Exp release. The three original visuals remain preserved as dated evidence from July 21, 2026; their model and image-support rows are historical rather than current.

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.

Advertisement

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
  • Current model values: deepseek-v4-pro, deepseek-v4-flash, and deepseek-v4-flash-vision-exp. The served versions are DeepSeek-V4-Pro-0813 in GA, DeepSeek-V4-Flash-0731 in public beta, and experimental DeepSeek-V4-Flash-Vision-Exp. All three also support the OpenAI-compatible Responses API, which is separate from this Anthropic-compatible route.
  • Core support: text messages, system prompts, max tokens, stop sequences, streaming, thinking, core tool use, and image blocks when the Vision Exp model is selected
  • Important limitations: document, MCP, code-execution, and container-upload content blocks remain unsupported. image is supported only by deepseek-v4-flash-vision-exp, with source.type equal to base64, url, or file.
  • Ignored fields: include anthropic-version, top_k, service_tier, and Anthropic-style cache_control. The anthropic-beta header is ignored for ordinary Messages features, but files-api-2025-04-14 is required for Anthropic-compatible Files operations and for a Messages request that references an image with source.type=file.

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. DeepSeek now documents Anthropic-compatible Messages and image-only Files endpoints; it does not thereby promise Anthropic Batches, token-counting, Admin, general document upload, or every other Anthropic endpoint. 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
Text modelsdeepseek-v4-pro or deepseek-v4-flashExplicit IDs avoid silent fallback routing
Vision modeldeepseek-v4-flash-vision-expRequired when a Messages request contains an image block
Historical DeepSeek Anthropic endpoint and model mapping verified July 21 2026
Historical evidence — verified July 21, 2026. This original endpoint and model-routing visual predates the August 21 release of deepseek-v4-flash-vision-exp. Use the current table above for production configuration.

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 text route
deepseek-v4-flashdeepseek-v4-flashUse explicitly for the Flash text route
deepseek-v4-flash-vision-expdeepseek-v4-flash-vision-expUse explicitly for image input; experimental
Starts with claude-opusdeepseek-v4-proCompatibility alias only; does not select Vision
Starts with claude-sonnetdeepseek-v4-flashCompatibility alias only; does not select Vision
Starts with claude-haikudeepseek-v4-flashCompatibility alias only; does not select Vision
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-betaIgnored for ordinary Messages features; Files beta required for file-backed imagesSend files-api-2025-04-14 for Anthropic Files operations and on a Messages request using source.type=file; do not infer support for unrelated Anthropic betas

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
Historical DeepSeek Anthropic request-field matrix verified July 21, 2026; superseded for Vision images and file-backed image headers.
Historical evidence — verified July 21, 2026. This older matrix predates Vision Exp. The current contract supports image blocks through Base64, URL, or file; anthropic-beta is ignored for ordinary Messages features but anthropic-beta: files-api-2025-04-14 is required for Anthropic Files operations and Messages that reference source.type=file.

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 current Thinking Mode documentation says thinking is enabled by default with high effort. The direct documented effort values are low, high, and max; compatibility requests for medium and xhigh map to high. The mapping is now identical for Flash and Pro. If your application needs temperature or top_p to influence generation, explicitly send thinking: { type: "disabled" }.

Requested settingV4 Flash behaviorV4 Pro behavior
thinkingSupported; enabled by defaultSupported; enabled by default
thinking.budget_tokensIgnoredIgnored
effort: "low"Mapped to lowMapped to low
effort: "medium"Mapped to highMapped to high
effort: "high"Mapped to highMapped to high
effort: "xhigh"Mapped to highMapped to high
effort: "max"Mapped to maxMapped to max
temperature and top_pNo effect while thinking is enabledNo effect while thinking is enabled

Current mapping note: As rechecked on August 22, 2026, DeepSeek’s official Thinking Mode table still documents the same mapping specifically for deepseek-v4-flash and deepseek-v4-pro. The August 13 release superseded the earlier forward-looking note about a possible Pro mapping change. Vision Exp is experimental; validate its reasoning controls in staging rather than extending the two-column mapping by assumption.

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 current message-field scope published by DeepSeek. Image support is model-gated: an image block is processed only with deepseek-v4-flash-vision-exp. “Not supported” still applies to general document and other listed block types.

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"Supported with Vision Expsource.type may be base64, url, or file; file requires the Files beta header
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
Historical DeepSeek Anthropic message and tool compatibility matrix verified July 21 2026
Historical evidence — verified July 21, 2026. This original visual correctly records the contract at that date, when the image row was unsupported. DeepSeek added Anthropic image blocks for Vision Exp on August 21; use the current table above.

Vision and image files through the Anthropic route

Select deepseek-v4-flash-vision-exp whenever the request contains an image. The current Anthropic-compatible shape supports Base64 image data, a public HTTP(S) URL, or a previously uploaded image referenced by file_id. JPEG, PNG, GIF, and WebP are supported. This is image understanding—not image generation—and it does not make type: "document" valid.

import anthropic

client = anthropic.Anthropic(
    api_key="<DeepSeek API Key>",
    base_url="https://api.deepseek.com/anthropic",
)

message = client.messages.create(
    model="deepseek-v4-flash-vision-exp",
    max_tokens=1024,
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "Describe the chart and flag anomalies."},
            {
                "type": "image",
                "source": {
                    "type": "url",
                    "url": "https://example.com/chart.png"
                }
            }
        ]
    }],
)

print(message.content)

For a reusable upload, call the Anthropic-compatible Files API under /anthropic/v1/files and send anthropic-beta: files-api-2025-04-14. Send the same header on the Messages request that uses an image block whose source.type is file and whose file_id is the returned file-api-... value. The Files API accepts images only: maximum upload 64 MiB, maximum storage 25 GiB or 10,000 files, and expiry from one hour to 30 days or permanent when omitted.

Image sourceRequired fieldsImportant limit
base64media_type + Base64 data32 MiB per inline image; counts toward 48 MiB request body
urlPublic HTTP(S) URLURL up to 8192 characters; image up to 32 MiB; 60-second download
filefile_id + Files beta headerUploaded image up to 64 MiB

File operations are free, but inference is not: image tokens are billed as model input at Vision Exp pricing, which matches Flash. DeepSeek caps image-token conversion at 384 tokens per image after automatic resizing. See the dedicated Vision input guide and Files API guide.

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. Route image requests deliberately: use deepseek-v4-flash-vision-exp and a supported image source; continue replacing unsupported 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, deepseek-v4-flash, or deepseek-v4-flash-vision-exp explicitly
A setting appears to do nothingThe field is ignored, or thinking mode makes sampling controls ineffectiveCompare the payload with the tables above
Image request failsA text-only model, unsupported source shape, wrong media format, or exceeded image limitSelect Vision Exp and validate base64/url/file shape and limits
Document request failstype: "document" remains unsupportedExtract permitted text in your application; do not upload PDFs to the image Files API
File-backed image request failsMissing or incorrect Anthropic Files beta headerSend anthropic-beta: files-api-2025-04-14 on Files operations and the Messages request using source.type=file
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?

Image blocks are supported when you select deepseek-v4-flash-vision-exp; their source may be Base64, a public URL, or a Files API file_id. General document blocks remain unsupported, so a PDF or office document still needs an application-owned extraction workflow.

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.

Privacy and cookie settings