# n8n Cohere API Key 凭证配置指南 **目标**: 在 `n8n.citupro.com` 中配置 Cohere API Key 凭证 **API Key**: `4pLcF0CGE7LeDmAudBQHdvAxGaKwNOKfxUGkHb5C` **日期**: 2025-01-27 --- ## ✅ 凭证已创建成功! **当前凭证 ID**: `Trtn1MtQhDwHYoPO` **凭证名称**: `Cohere API Key` **凭证类型**: `cohereApi` **创建时间**: 2026-01-19T03:55:55.019Z **注意**: 如果遇到 "Forbidden" 错误,请参考 [故障排除指南](n8n_cohere_credential_troubleshooting.md) 你现在可以在工作流中使用此凭证了! --- ## 📋 方法一:通过 Web UI 手动配置(推荐) ### 步骤 1: 登录 n8n 实例 1. 访问 **https://n8n.citupro.com** 2. 使用你的账号登录 ### 步骤 2: 进入凭证管理页面 1. 点击左侧边栏的 **"Settings"**(设置)图标 2. 在设置菜单中,点击 **"Credentials"**(凭证) 3. 或者直接访问:`https://n8n.citupro.com/home/credentials` ### 步骤 3: 创建新的 Cohere 凭证 1. 点击页面右上角的 **"Add Credential"**(添加凭证)按钮 2. 在搜索框中输入 **"Cohere"** 3. 选择 **"Cohere API"** 凭证类型 ### 步骤 4: 填写凭证信息 在凭证配置表单中填写: - **Name**(名称): `Cohere API Key` 或 `Cohere - Production`(便于识别的名称) - **API Key**: `4pLcF0CGE7LeDmAudBQHdvAxGaKwNOKfxUGkHb5C` ### 步骤 5: 保存凭证 1. 点击 **"Save"**(保存)按钮 2. n8n 会自动验证 API Key 是否有效 3. 如果验证成功,凭证会出现在凭证列表中 --- ## 🔧 方法二:通过 API 脚本配置(实验性) 如果 n8n API 支持凭证管理,可以使用以下脚本: ### 使用脚本创建凭证 ```bash python scripts/create_n8n_cohere_credential.py ``` **注意**: n8n 的凭证管理 API 可能有限制,如果 API 不支持,请使用方法一(Web UI)。 --- ## ✅ 验证配置 ### 在工作流中使用凭证 1. 打开任意包含 **Reranker Cohere** 节点的工作流 2. 点击 **Reranker Cohere** 节点 3. 在右侧配置面板中,找到 **"Credential to connect with"** 字段 4. 从下拉菜单中选择刚才创建的 **"Cohere API Key"** 凭证 5. 保存节点配置 ### 测试凭证是否有效 1. 创建一个简单的测试工作流: - 添加 **Manual Trigger** 节点 - 添加 **Reranker Cohere** 节点 - 配置模型为 `rerank-multilingual-v3.0` - 连接两个节点 2. 点击 **"Execute Workflow"** 测试 3. 如果执行成功,说明凭证配置正确 --- ## 📝 凭证使用示例 ### 在工作流 JSON 中引用凭证 ```json { "parameters": { "modelName": "rerank-multilingual-v3.0", "topN": 5 }, "type": "@n8n/n8n-nodes-langchain.rerankerCohere", "name": "Reranker Cohere", "credentials": { "cohereApi": { "id": "凭证ID", "name": "Cohere API Key" } } } ``` **获取凭证 ID**: 1. 在凭证列表中点击创建的凭证 2. 从浏览器地址栏获取 ID:`/home/credentials/{凭证ID}` --- ## 🔒 安全注意事项 1. **不要公开 API Key**: 在分享工作流 JSON 或截图时,不要包含 API Key 2. **权限管理**: 确保只有授权用户可以访问凭证 3. **定期轮换**: 建议定期更换 API Key 以提高安全性 4. **凭证加密**: n8n 会自动加密存储凭证,不会明文显示 --- ## 🆘 常见问题 ### Q1: 找不到 "Cohere API" 凭证类型? **A**: 确保你的 n8n 版本支持 Cohere 节点。如果使用的是较旧版本,可能需要: - 更新 n8n 到最新版本 - 或安装 `@n8n/n8n-nodes-langchain` 包 ### Q2: API Key 验证失败? **A**: 检查: - API Key 是否正确复制(没有多余空格) - Cohere 账户是否有效 - 网络连接是否正常 ### Q3: 如何查看凭证 ID? **A**: 1. 进入 Settings → Credentials 2. 点击目标凭证 3. 从浏览器地址栏获取:`/home/credentials/{凭证ID}` --- ## 📚 相关文档 - [n8n Cohere 节点文档](https://docs.n8n.io/integrations/builtin/credentials/cohere/) - [n8n 凭证管理指南](https://docs.n8n.io/credentials/add-edit-credentials/) - [Cohere API 文档](https://docs.cohere.com/) --- **配置完成后,你就可以在工作流中使用 Cohere Reranker 节点了!** 🎉