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.
Quick answer
- Base URL:
https://api.deepseek.com/anthropic - Authentication: a DeepSeek API key passed through the Anthropic SDK or the
x-api-keyheader - Current model values:
deepseek-v4-pro,deepseek-v4-flash, anddeepseek-v4-flash-vision-exp. The served versions areDeepSeek-V4-Pro-0813in GA,DeepSeek-V4-Flash-0731in public beta, and experimentalDeepSeek-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.imageis supported only bydeepseek-v4-flash-vision-exp, withsource.typeequal tobase64,url, orfile. - Ignored fields: include
anthropic-version,top_k,service_tier, and Anthropic-stylecache_control. Theanthropic-betaheader is ignored for ordinary Messages features, butfiles-api-2025-04-14is required for Anthropic-compatible Files operations and for a Messages request that references an image withsource.type=file.
On this page
- What compatibility means
- Endpoint and authentication
- Node.js setup
- Python setup
- Model mapping
- Headers and top-level request fields
- Thinking mode
- Tools and tool choice
- Message content blocks
- Vision and Files API
- Metadata and user isolation
- Streaming and response fields
- Migration checklist
- Troubleshooting
- FAQ
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
| Setting | DeepSeek value | Compatibility behavior |
|---|---|---|
| SDK base URL | https://api.deepseek.com/anthropic | Documented Anthropic-format route |
| API key | Your DeepSeek API key | Accepted through the SDK or x-api-key |
| Messages method | client.messages.create(...) | Uses the Anthropic SDK’s Messages interface |
| Text models | deepseek-v4-pro or deepseek-v4-flash | Explicit IDs avoid silent fallback routing |
| Vision model | deepseek-v4-flash-vision-exp | Required when a Messages request contains an image block |

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 client | DeepSeek route | Recommendation |
|---|---|---|
deepseek-v4-pro | deepseek-v4-pro | Use explicitly for the Pro text route |
deepseek-v4-flash | deepseek-v4-flash | Use explicitly for the Flash text route |
deepseek-v4-flash-vision-exp | deepseek-v4-flash-vision-exp | Use explicitly for image input; experimental |
Starts with claude-opus | deepseek-v4-pro | Compatibility alias only; does not select Vision |
Starts with claude-sonnet | deepseek-v4-flash | Compatibility alias only; does not select Vision |
Starts with claude-haiku | deepseek-v4-flash | Compatibility alias only; does not select Vision |
| Other unsupported model name | deepseek-v4-flash | Avoid 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 header | DeepSeek status | What to do |
|---|---|---|
x-api-key | Fully supported | Send a DeepSeek API key |
anthropic-version | Ignored | Do not depend on it for version negotiation |
anthropic-beta | Ignored for ordinary Messages features; Files beta required for file-backed images | Send 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
| Field | Status | DeepSeek behavior |
|---|---|---|
model | Mapped | Use a DeepSeek model ID; documented Claude prefixes are routed as shown above |
messages | Supported | Use Anthropic user/assistant messages and only the supported content blocks listed below |
max_tokens | Fully supported | Sets the maximum output-token allowance |
container | Ignored | Container state is not applied |
mcp_servers | Ignored | MCP server configuration is not forwarded |
metadata | Partially supported | Only metadata.user_id is supported; other keys are ignored |
service_tier | Ignored | Does not select a DeepSeek service tier |
stop_sequences | Fully supported | Accepted as stop sequences |
stream | Fully supported | Streaming can be requested |
system | Fully supported | Accepted as the top-level system instruction; do not convert it to an OpenAI-style system message |
temperature | Fully supported outside thinking mode | Accepted range is 0–2; it is silently ignored while thinking is enabled |
thinking | Partially supported | type: "enabled" and type: "disabled" are supported, but budget_tokens is ignored |
output_config | Partially supported | Only output_config.effort is supported |
top_k | Ignored | Does not affect generation |
top_p | Fully supported outside thinking mode | Accepted, but silently ignored while thinking is enabled |

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 setting | V4 Flash behavior | V4 Pro behavior |
|---|---|---|
thinking | Supported; enabled by default | Supported; enabled by default |
thinking.budget_tokens | Ignored | Ignored |
effort: "low" | Mapped to low | Mapped to low |
effort: "medium" | Mapped to high | Mapped to high |
effort: "high" | Mapped to high | Mapped to high |
effort: "xhigh" | Mapped to high | Mapped to high |
effort: "max" | Mapped to max | Mapped to max |
temperature and top_p | No effect while thinking is enabled | No 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
| Field | Status | Notes |
|---|---|---|
tools[].name | Fully supported | Tool name is preserved |
tools[].input_schema | Fully supported | JSON Schema input definition is preserved |
tools[].description | Fully supported | Tool description is preserved |
tools[].cache_control | Ignored | Does not enable Anthropic-style manual prompt caching |
tool_choice mapping
| Choice type | Status | Limitation |
|---|---|---|
none | Fully supported | No documented subfield exception |
auto | Supported | disable_parallel_tool_use is ignored |
any | Supported | disable_parallel_tool_use is ignored |
tool | Supported | disable_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 block | Status | Supported or ignored subfields |
|---|---|---|
content: "plain string" | Fully supported | String content is accepted |
type: "text" | Partially supported | text supported; cache_control and citations ignored |
type: "image" | Supported with Vision Exp | source.type may be base64, url, or file; file requires the Files beta header |
type: "document" | Not supported | Extract permitted text before sending, subject to your security rules |
type: "search_result" | Not supported | Do not confuse it with web_search_tool_result |
type: "thinking" | Supported | Do not assume budget_tokens controls its length |
type: "redacted_thinking" | Not supported | Remove any dependency on this block |
type: "tool_use" | Partially supported | id, input, and name supported; cache_control ignored |
type: "tool_result" | Partially supported | tool_use_id and content supported; cache_control and is_error ignored |
type: "server_tool_use" | Supported | Block support does not prove parity with every managed tool |
type: "web_search_tool_result" | Supported | Does not by itself mean DeepSeek supplies Anthropic’s hosted web-search tool |
type: "code_execution_tool_result" | Not supported | Use application-owned execution and return a supported tool result when appropriate |
type: "mcp_tool_use" | Not supported | MCP blocks cannot be forwarded as-is |
type: "mcp_tool_result" | Not supported | MCP blocks cannot be forwarded as-is |
type: "container_upload" | Not supported | Container uploads are outside the documented compatibility scope |

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 source | Required fields | Important limit |
|---|---|---|
base64 | media_type + Base64 data | 32 MiB per inline image; counts toward 48 MiB request body |
url | Public HTTP(S) URL | URL up to 8192 characters; image up to 32 MiB; 60-second download |
file | file_id + Files beta header | Uploaded 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 area | Safe handling rule |
|---|---|
content[] | Handle documented text, thinking, tool_use, server_tool_use, and web_search_tool_result blocks |
stop_reason | Handle core end, token-limit, stop-sequence, and tool-use outcomes; log unknown values |
usage.input_tokens | Read defensively from the standard message usage object |
usage.output_tokens | Read defensively from the standard message usage object |
| Cache-specific usage fields | Inspect 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.
- Record the event types and content-block deltas your SDK receives in a non-production test.
- Verify your parser handles text, thinking, tool-use, stop reason, and error paths actually used by your application.
- Log usage keys defensively and tolerate fields being absent.
- 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
- Change the base URL to
https://api.deepseek.com/anthropic. - Use a DeepSeek API key; do not reuse an Anthropic credential.
- Set an explicit DeepSeek model ID instead of relying on Claude-prefix mapping or Flash fallback.
- Remove ignored headers and fields so configuration does not imply behavior that is not applied.
- Route image requests deliberately: use
deepseek-v4-flash-vision-expand a supportedimagesource; continue replacing unsupported document, MCP, code-execution, and container-upload blocks. - Review thinking controls: remove dependence on
budget_tokensand use documentedoutput_config.effortbehavior. - Review tool execution: keep application-owned tools, but do not expect
cache_control,is_error, ordisable_parallel_tool_useto work. - Sanitize
metadata.user_idand remove all private data. - Contract-test streaming and responses because DeepSeek does not publish a complete event-level mapping on this compatibility page.
- 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 status | DeepSeek meaning |
|---|---|
| 400 | Invalid request format |
| 401 | Authentication failure |
| 402 | Insufficient balance |
| 422 | Invalid parameters |
| 429 | Rate or concurrency limit |
| 500 | Server error |
| 503 | Server overloaded |
| Symptom | Likely cause | Check |
|---|---|---|
| Authentication error | Anthropic key used against DeepSeek, missing key, or server environment not loaded | Confirm the client receives a DeepSeek API key and the base URL is exact |
| Unexpected Flash behavior | Unsupported or misspelled model value triggered automatic fallback | Send deepseek-v4-pro, deepseek-v4-flash, or deepseek-v4-flash-vision-exp explicitly |
| A setting appears to do nothing | The field is ignored, or thinking mode makes sampling controls ineffective | Compare the payload with the tables above |
| Image request fails | A text-only model, unsupported source shape, wrong media format, or exceeded image limit | Select Vision Exp and validate base64/url/file shape and limits |
| Document request fails | type: "document" remains unsupported | Extract permitted text in your application; do not upload PDFs to the image Files API |
| File-backed image request fails | Missing or incorrect Anthropic Files beta header | Send anthropic-beta: files-api-2025-04-14 on Files operations and the Messages request using source.type=file |
| MCP configuration is missing | mcp_servers is ignored and MCP content blocks are unsupported | Run MCP outside this endpoint and translate results into supported tool content |
| Parallel-tool policy is not enforced | disable_parallel_tool_use is ignored | Enforce sequencing in application code |
| Tool error flag has no effect | tool_result.is_error is ignored | Encode the outcome in supported tool-result content and application state |
| Streaming parser breaks | The client assumes undocumented event parity | Capture 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
- DeepSeek: Anthropic API compatibility guide
- DeepSeek: Vision guide
- DeepSeek: Files API guide
- DeepSeek: Vision Exp and Files API release — August 21, 2026
- DeepSeek: Thinking Mode guide
- DeepSeek: Rate Limit and User ID Isolation
- DeepSeek: Context Caching guide
- DeepSeek: API error codes
- Anthropic: official TypeScript SDK repository
- Anthropic: official Python SDK repository
For cost planning after compatibility testing, review DeepSeek API pricing.