Claude 接入
这篇解决什么
Claude 平台字符串怎么填、对话选项走哪套客户端。读完能对上 AiPlatformEnum.ANTHROPIC = "Anthropic",不要写成 Claude。
默认端口 48080。开启见 AI 功能设计。
示意图:走 Spring AI 的 Anthropic 客户端,不是 DeepSeek 包装。url 可覆盖默认地址。
从哪改
| 名称 | 说明 | 仓库路径 |
|---|---|---|
| 密钥 | @RequestMapping("/ai/api-key") | ruoyi-office/yudao-module-ai/.../controller/admin/model/AiApiKeyController.java |
| 工厂 | buildAnthropicChatModel(apiKey, url) | AiModelFactoryImpl |
| 选项 | AnthropicChatOptions | AiUtils.buildChatOptions |
| 管理端 | 密钥、模型页 | ruoyi-office-vben/apps/web-antd/src/views/ai/model/ |
官方菜单:密钥 2761,模型 2767。没有「Claude」独立菜单。
url 空则用 Anthropic SDK 默认 Base URL。url 有值才 builder.baseUrl(url)。模型名填 Anthropic 当前可点名,例如控制台里的 Claude 系列。
/draw 没有 Anthropic 分支。向量工厂也没有这一家。对话用 type=1。
字段
| 名称 | 说明 | 仓库路径 |
|---|---|---|
platform | 必须是 Anthropic | AiApiKeyDO / AiModelDO |
apiKey / url | 密钥;url 可选 | AiApiKeyDO |
model | Claude 模型标识 | AiModelDO |
不是 Claude 也不是 ClaudeAI
枚举值是 Anthropic。路径虽是 /guide/ai/claude/,库表不能填 Claude。
选项类不要复用 DeepSeek
国内多家走 DeepSeekChatOptions。Claude 必须走 AnthropicChatOptions,才会进 buildAnthropicChatModel。
按本仓库 DO 生成的 ER。
配置与操作
走 API 密钥(2761)建 platform=Anthropic,不要写成 Claude。url 空则用 SDK 默认地址。再在 模型配置 建 type=1,选项必须走 AnthropicChatOptions。
/draw 和向量工厂都没有这一家。开启见 AI 功能设计。

本系统截图:AI 大模型 → 控制台 → API 密钥。各厂商共用这一页,用 platform 区分。

本系统截图:控制台 → 模型配置。keyId 必须指向同平台密钥。
