Anthropic / Claude Code
官网: anthropic.com
Dline 提供两种使用 Claude 的方式:
- Anthropic:使用 Anthropic API Key,按 token 计费。
- Claude Code:使用 Claude Pro / Max 订阅登录,消耗订阅额度。
Anthropic API Key
Section titled “Anthropic API Key”获取 API Key
Section titled “获取 API Key”-
访问 Anthropic Console,注册或登录账号。
-
打开 API keys 页面。
-
点击 Create Key,为 Key 起一个便于识别的名称,例如
Dline。 -
立即复制并妥善保存 Key,页面关闭后将无法再次查看。
在 Dline 中配置
Section titled “在 Dline 中配置”通用步骤见模型配置。
-
点击 Dline 面板标题栏的 Settings 按钮。
-
在 Provider 中选择 Anthropic。
-
把 Key 粘贴到 Anthropic API Key 输入框。
-
在 Model 中搜索或选择 Claude 模型。
-
(可选)需要走网关时设置自定义 Base URL,见下一节。
自定义 Base URL
Section titled “自定义 Base URL”保持 Use custom base URL 未勾选时,请求发送到 Anthropic。勾选后,请求改为发送到你填写的其他地址,例如位于 Anthropic API 前的网关或代理。
-
勾选 Use custom base URL,填入网关提供的地址,例如
https://gateway.example.com。填写 API 地址本身,而不是网关的控制台页面。 -
Anthropic API Key 中填写该网关接受的 Key。如果网关用自有 Key 认证,这里要填网关的 Key,而不是 Anthropic 的 Key。
-
在 Model 中选择模型,模型 ID 必须是该网关接受的 ID。
默认地址为 https://api.anthropic.com,大多数用户不需要修改。Dline 只会把 Key 发送到你填写的地址,因此该网关必须接受 Anthropic 的 Messages API 形式。
Claude Code(订阅)
Section titled “Claude Code(订阅)”已有 Claude Pro / Max 订阅时,可以用订阅账号直接登录,无需管理 API Key。
-
打开 Dline 设置,在 Provider 中选择 Claude Code。
-
点击 Sign in,在 Sign in to Claude 对话框打开的浏览器页面中完成授权。浏览器无法自动返回时,把 Claude 页面给出的内容粘贴回对话框。
-
状态显示 Signed in 后,在 Model 中选择模型。
- 请求消耗订阅额度,不按 API token 计费。
- 登录失效时状态会显示 Sign-in expired,点击 Sign in again 重新授权即可。
支持思考的 Claude 模型会在模型选择下方显示思考设置:
- 自适应思考模型:在 Adaptive Thinking 中选择思考强度;强度越高,回答越详细,消耗的 token 也越多。
- 预算思考模型:设置思考 token 预算。
- Thinking Display:控制思考内容的展示方式。
思考内容会计入 token 消耗。工作机制、与工具调用和提示缓存的交互以及计费规则,见 Anthropic 扩展思考文档。
- 提示缓存: Claude 模型支持提示缓存,可以显著降低重复请求的费用和延迟。
- 价格: 最新价格见 Anthropic 定价页。