为了满足大家对 Anthropic API 生态的使用需求,我们的 API 新增了对 Anthropic API 格式的支持,其 base_urlhttps://api.deepseek.com/anthropic

通过简单的配置,即可将 DeepSeek 的能力,接入到 Anthropic API 生态中。

----------------------

将 DeepSeek 模型接入 Claude Code

请参考接入 Coding Agent

通过 Anthropic API 调用 DeepSeek 模型

1. 安装 Anthropic SDK

pip install anthropic

1. 配置环境变量

export ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic
export ANTHROPIC_API_KEY=${YOUR_API_KEY}

1. 调用 API

import anthropic

client = anthropic.Anthropic()

message = client.messages.create(
    model="deepseek-v4-pro",
    max_tokens=1000,
    system="You are a helpful assistant.",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "Hi, how are you?"
                }
            ]
        }
    ]
)
print(message.content)

注意:当您给 DeepSeek 的 Anthropic API 传入不支持的模型名时,API 后端会自动将其映射到 deepseek-v4-flash 模型。

----------------------

Anthropic API 兼容性细节

HTTP Header

Simple Fields

Tool Fields

tools

tool_choice

Message Fields

via DeepSeek 新闻
 
 
Back to Top
Copyright © 2025 BESTAI. All rights reserved.
BEST AI API中转 - OpenAI DeepSeek Claude Gemini Grok MidJourney API 2.8折起
[email protected]