🦞
零基础入门 OpenClaw入门

新手必看!龙虾(OpenClaw)大模型配置保姆级教程

零基础配置 OpenClaw:手把手教你完成 baseUrl、apiKey 与 model id 配置

预计阅读 12 分钟 共 8 个步骤 35002 次阅读
# OpenClaw # 大模型配置 # baseUrl # apiKey # 通义千问 # 豆包 # 新手入门 # 保姆级教程

教程简介

欢迎来到 OpenClaw 的世界!作为一个初次接触 AI 应用的新手,面对满屏的代码和配置文件难免会感到无从下手。本文用最通俗易懂的语言,带你一步步完成 OpenClaw 的大模型接入配置,涵盖三大核心概念入门、如何从阿里云通义千问和字节跳动豆包获取配置参数、配置文件完整模板,以及保姆级配置步骤。

1

了解三大核心概念

2

获取大模型参数

3

找到 OpenClaw 配置文件

代码示例
openclaw setup
4

备份原文件

5

替换配置文件内容

代码示例
{
  "models": {
    "mode": "merge",
    "providers": {
      "custom-001": {
        "baseUrl": "xxxxx",
        "apiKey": "xxxxxx",
        "api": "openai-completions",
        "models": [
          {
            "id": "qwen-plus",
            "name": "qwen-plus (Custom Provider)",
            "reasoning": false,
            "input": [
              "text"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            }
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "custom-001/qwen-plus"
      },
      "models": {
        "custom-001/qwen-plus": {}
      },
      "workspace": "C:\\Users\\Administrator\\.openclaw\\workspace",
      "contextPruning": {
        "mode": "cache-ttl",
        "ttl": "1h"
      },
      "compaction": {
        "mode": "safeguard"
      },
      "heartbeat": {
        "every": "30m"
      }
    }
  },
  "tools": {
    "profile": "coding",
    "web": {
      "search": {
        "enabled": true,
        "provider": "gemini",
        "gemini": {
          "apiKey": "sk-xxxxxxxxxx"
        }
      }
    }
  },
  "commands": {
    "native": "auto",
    "nativeSkills": "auto",
    "restart": true,
    "ownerDisplay": "raw"
  },
  "session": {
    "dmScope": "per-channel-peer"
  },
  "hooks": {
    "internal": {
      "enabled": true,
      "entries": {
        "boot-md": {
          "enabled": true
        },
        "bootstrap-extra-files": {
          "enabled": true
        },
        "command-logger": {
          "enabled": true
        },
        "session-memory": {
          "enabled": true
        }
      }
    }
  },
  "gateway": {
    "port": 18789,
    "mode": "local",
    "bind": "loopback",
    "controlUi": {
      "allowedOrigins": [
        "http://localhost:18789"
      ]
    },
    "auth": {
      "mode": "token",
      "token": "f2f4f617fe7a38cde2449495204c053d18168dcbc6d8ab61"
    },
    "tailscale": {
      "mode": "off",
      "resetOnExit": false
    },
    "nodes": {
      "denyCommands": [
        "camera.snap",
        "camera.clip",
        "screen.record",
        "contacts.add",
        "calendar.add",
        "reminders.add",
        "sms.send"
      ]
    }
  },
  "skills": {
    "install": {
      "nodeManager": "npm"
    },
    "entries": {
      "goplaces": {
        "apiKey": "sk-xxxxxxxxxxxxxx"
      },
      "nano-banana-pro": {
        "apiKey": "sk-xxxxxxxxxxxxxxxxxxxxx"
      },
      "notion": {
        "apiKey": "sk-xxxxxxxxxxxxxxxxxxxx"
      },
      "openai-image-gen": {
        "apiKey": "sk-xxxxxxxxxxxxxxxxxxxxx"
      },
      "openai-whisper-api": {
        "apiKey": "sk-xxxxxxxxxxxxxxxxxxxx"
      },
      "sag": {
        "apiKey": "sk-xxxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}
6

确认默认模型路径

7

处理其他服务的 API Key(可选)

8

保存并重启 OpenClaw

代码示例
openclaw gateway restart
返回教程列表
觉得有用?分享给更多朋友吧