文档中心>知识引擎原子能力>DeepSeek 兼容接口>腾讯云 DeepSeek Anthropic 兼容接口

腾讯云 DeepSeek Anthropic 兼容接口

最近更新时间:2025-12-22 10:43:31

我的收藏
腾讯云知识引擎原子能力 DeepSeek Anthropic 接口兼容了 Anthropic 的接口规范,您仅需要将 base_url 和 api_key 替换成相关配置,不需要对应用做额外修改,即可将 DeepSeek 的能力,接入到 Anthropic API 生态中。
base_url:https://api.lkeap.cloud.tencent.com/anthropic
api_key:需在控制台 API key 页面进行创建,操作步骤请参见 API key 管理
接口请求地址完整路径:https://api.lkeap.cloud.tencent.com/anthropic/v1/messages
调用情况可在 控制台 中查看。计费详情请参见 计费概述
说明:
默认单账号下的模型限制为:
QPM (Queries Per Minute): 15,000
TPM (Tokens Per Minute): 1,200,000

已支持的模型

DeepSeek V3.1 模型

模型
model 参数值
参数量
最大上下文长度
最大输入长度
最大输出长度
思维链最大输出长度
DeepSeek-V3.1
deepseek-v3.1
685B
128k
96k
32k
默认4k
32k
DeepSeek-V3.1-Terminus
deepseek-v3.1-terminus
685B
128k
96k
32k
默认4k
32k
说明:
model 参数值:调用模型时携带的“Model”字段,例如 deepseek-v3.1-terminus。

DeepSeek-V3.1(model 参数值为 deepseek-v3.1)

DeepSeek-V3.1 为685B 参数 MoE 模型,支持混合推理架构,有更高的思考效率和更强的 Agent 能力。

DeepSeek-V3.1-Terminus(model 参数值为 deepseek-v3.1-terminus)

DeepSeek-V3.1-Terminus 为685B 参数 MoE 模型,在保持模型原有能力的基础上,优化了语言一致性和 Agent 能力等问题,输出效果相比前一版本更加稳定。

快速开始

API 使用前提:已在腾讯云控制台 API key 管理 开通知识引擎原子能力并创建 API Key。
如果您首次使用知识引擎原子能力,请参考 API key 管理 进行知识引擎原子能力的开通,并将示例代码中的 model 参数修改为上表中您需要调用的模型名称。

将 DeepSeek 模型接入 Claude Code

安装 Claude Code

安装或更新 Anthropic Claude Code,运行以下命令:
npm install -g @anthropic-ai/claude-code

配置环境变量

export ANTHROPIC_BASE_URL=https://api.lkeap.cloud.tencent.com/anthropic
export ANTHROPIC_AUTH_TOKEN=${API_KEY}
export API_TIMEOUT_MS=600000
export ANTHROPIC_MODEL=${MODEL_NAME}
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1

Running Environment

Operating System: Ubuntu 24.04.3 LTS / x86_64

Runtime Version: GNU bash, version 5.2.21(1)-release (x86_64-pc-linux-gnu)

注意:
设置 API_TIMEOUT_MS 是为了防止输出过长,触发 Claude Code 客户端超时,这里设置的超时时间为 10 分钟,使用者可自行设置。

执行 claude 命令

进入项目目录,执行 claude 命令,即可开始使用。
cd my-project
claude




通过 Anthropic API 调用 DeepSeek 模型

安装SDK

安装或更新 Anthropic Python SDK,运行以下命令:
pip install anthropic

示例代码片段

Python
cURL

import anthropic

client = anthropic.Anthropic(
api_key=os.getenv("API_KEY"),
base_url="https://api.lkeap.cloud.tencent.com/anthropic",
)

message = client.messages.create(
model="deepseek-v3-terminus",
max_tokens=1000,
system="You are a helpful assistant.",
messages=[
{
"role": "user",
"content": [
{
"type": "text",
"text": "Hi, how are you?"
}
]
}
]
)
print(message.content)
curl https://api.lkeap.cloud.tencent.com/anthropic/v1/messages \\
-H "Content-Type: application/json" \\
-H "x-api-key: sk-xxxxxxx" \\
-d '{
"model": "deepseek-v3.1-terminus",
"max_tokens": 1000,
"stream": true,
"system": [
{
"type": "text",
"text": "You are a helpful assistant."
}
],
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Hi, how are you?"
}
]
}
]
}'


Anthropic API 兼容性详情

HTTP Headers

字段
支持状态
说明
anthropic-beta
忽略
不处理此头部
anthropic-version
忽略
不处理此头部
x-api-key
完全支持
用于身份验证

基础字段

字段
支持状态
说明
model
支持
使用 DeepSeek 模型替代
max_tokens
完全支持
最大输出令牌数
container
忽略
不处理此字段
mcp_servers
忽略
不处理此字段
metadata
忽略
不处理此字段
service_tier
忽略
不处理此字段
stop_sequences
完全支持
停止序列
stream
完全支持
流式响应
system
完全支持
系统消息
temperature
完全支持
温度参数 (0.0-2.0)
thinking
忽略
不处理此字段
top_k
忽略
不处理此字段
top_p
完全支持
Top-p 采样

工具支持

tools

字段
支持状态
说明
name
完全支持
工具名称
input_schema
完全支持
输入参数模式
description
完全支持
工具描述
cache_control
忽略
不处理此字段
tool_choice
字符串格式
完全支持
tool_choice
对象格式
完全支持
tool_choice.disable_parallel_tool_use
忽略
不处理此字段

tool_choice

字段
支持状态
none
完全支持
auto
完全支持
any
完全支持
tool
完全支持
disable_parallel_tool_use
忽略

消息字段支持

字段类型
变体
子字段
支持状态
content
string
-
完全支持
content
array, type="text"
text
完全支持
content
array, type="text"
cache_control
忽略
content
array, type="text"
citations
忽略
content
array, type="image"
-
不支持
content
array, type="document"
-
不支持
content
array, type="search_result"
-
不支持
content
array, type="thinking"
-
忽略
content
array, type="redacted_thinking"
-
不支持
content
array, type="tool_use"
id
完全支持
content
array, type="tool_use"
input
完全支持
content
array, type="tool_use"
name
完全支持
content
array, type="tool_use"
cache_control
忽略
content
array, type="tool_result"
tool_use_id
完全支持
content
array, type="tool_result"
content
完全支持
content
array, type="tool_result"
cache_control
忽略
content
array, type="tool_result"
is_error
忽略
注意:
1. 忽略的字段:某些 Anthropic 特有的字段会被忽略,但不会报错。
2. 工具并行调用disable_parallel_tool_use 参数被忽略。
3. 缓存控制:所有 cache_control 相关字段都被忽略。