Hello World Hello World

首次配置:API Key 与平台接入

Mathe 7 0

首次配置:API Key 与平台接入

本篇讲解如何配置 OpenClaw 的 API Key 并接入你喜欢的平台。

获取 API Key

OpenClaw 支持多种大语言模型,常用的是 OpenAI 系列和 Claude 等。以 OpenAI 为例:

  1. 访问 platform.openai.com
  2. 登录后进入 API Keys 页面
  3. 点击 "Create new secret key"
  4. 复制生成的 Key(格式类似 sk-xxxx...

配置文件位置

配置文件通常在 ~/.openclaw/config.yml 或通过 openclaw config edit 直接编辑。

基础配置示例

model:

  provider: openai
  api_key: sk-your-key-here
  model: gpt-4

server:
  port: 3000
  host: 0.0.0.0

接入平台

飞书(Lark)

channels:

  feishu:
    app_id: cli_xxx
    app_secret: xxx
    bot_name: 小龙虾

需要在飞书开放平台创建企业自建应用,获取 App ID 和 App Secret。

Discord

channels:

  discord:
    token: your-discord-bot-token
    guild_id: xxx

在 Discord Developer Portal 创建 Bot,获取 Token 和 Guild ID。

验证配置

配置完成后,运行:

openclaw status

查看各平台连接状态。如果一切正常,你就可以开始使用了!

下一步

下一篇我们将讲解安装和配置过程中常见的错误及解决方法。

评论列表 (已有0条评论)

消灭零回复

评论已关闭