ClawGoal 通过 YAML 格式的配置文件进行服务端设置。本文档逐项说明所有配置字段的含义和用法。
配置文件位置
默认配置文件位于数据目录下:
~/.clawgoal/data/config.yaml
可以通过以下方式自定义数据目录:
-
修改
config.example.yaml 中的 dataPath 字段(将文件复制到数据目录,重命名为 config.yaml 后生效)
-
设置环境变量
DATA_PATH,优先级高于配置文件内的 dataPath
首次启动时,系统会自动在数据目录创建默认的 config.yaml。
配置总览
# yaml-language-server: $schema=./config.schema.json
配置文件由以下几个顶级模块组成,下面逐一说明。
Server(服务端基础)
port: 53001
timezone: 8
lang: en-US
# dataPath: ~/.clawgoal/data
| 字段 |
类型 |
默认值 |
说明 |
port |
int |
53001 |
HTTP 服务监听端口 |
timezone |
int |
8 |
UTC 偏移小时数,用于 Cron 调度和 LLM 时间注入。如 8 = UTC+8(北京时间),-5 = UTC-5(美东时间) |
lang |
string |
en-US |
默认系统语言。当客户端未发送 Accept-Language 且用户未设置个性化语言时使用。支持 en-US / zh-CN |
dataPath |
string |
~/.clawgoal/data |
基础数据目录,存放日志、上传文件、数据库、Agent 任务等。支持 ~ 家目录别名和绝对路径。注释状态,取消注释后生效 |
Backup(自动备份)
backup:
enable: true
cron: 0 2 */3 * *
keepDays: 30
| 字段 |
类型 |
默认值 |
说明 |
enable |
bool |
true |
是否启用自动备份 |
cron |
string |
0 2 */3 * * |
5 段 Cron 表达式(分 时 日 月 周),在配置的 timezone 时区下执行。此例表示每 3 天的凌晨 2:00 执行 |
keepDays |
int |
30 |
备份快照保留天数。0 表示永久保留所有备份 |
Database(数据库)
database:
provider: sqlite
url: file:./data/db/database.db
# url: "mysql://root:123456@localhost:3306/database?timezone=Asia/Shanghai"
| 字段 |
类型 |
说明 |
provider |
string |
数据库类型,支持 sqlite(默认)和 mysql |
url |
string |
数据库连接地址。SQLite 使用文件路径,MySQL 使用标准连接字符串 |
系统默认用户和租户
supervisorUserId: 1
supervisorTenantId: 1
用于 setup.yaml 初始化、API Token 认证等系统级操作。一般情况下保持默认值即可。
Auth(用户认证)
auth:
type: fixed
userId: 1
tenantId: 1
username: user
password: password
| 字段 |
类型 |
说明 |
type |
string |
认证方式。fixed = 单用户模式(用户名/密码登录),database = 多用户数据库模式 |
userId |
int |
默认用户 ID |
tenantId |
int |
默认租户 ID |
username |
string |
登录用户名 |
password |
string |
登录密码 |
JWT(令牌签名)
jwt:
secret: your-secret-key-change-in-production-2026
| 字段 |
类型 |
说明 |
secret |
string |
JWT Token 签名密钥,长度至少 16 个字符。部署到生产环境前务必修改此值 |
Logging(日志)
# log:
# path: /custom/log/path/
| 字段 |
类型 |
默认值 |
说明 |
path |
string |
<dataPath>/logs/ |
日志文件输出目录。注释状态,取消注释后生效 |
Upload(文件上传)
通用配置
upload:
type: local
url: "http://localhost:53001/uploads/"
limitExt: "jpg,png,gif,svg,doc,docx,xls,xlsx"
limitSize: 1024000
| 字段 |
类型 |
默认值 |
说明 |
type |
string |
local |
存储后端。支持 local / aliyunOss / tencentCos / qiniu / awsS3 / azureBlob / modstart |
url |
string |
— |
文件访问公网基础 URL,用于构建文件访问链接 |
limitExt |
string |
— |
允许上传的文件扩展名(逗号分隔,不含前导点号) |
limitSize |
int |
1024000 (1MB) |
最大上传字节数 |
本地存储(local)
upload:
type: local
local:
path: ""
| 字段 |
类型 |
默认值 |
说明 |
path |
string |
<dataPath>/uploads/ |
本地文件存储目录 |
阿里云 OSS
# upload:
# type: aliyunOss
# aliyunOss:
# accessKeyId: your-access-key-id
# accessKeySecret: your-access-key-secret
# bucket: your-bucket-name
# region: oss-cn-hangzhou
# endpoint: ""
| 字段 |
类型 |
说明 |
accessKeyId |
string |
阿里云 AccessKey ID |
accessKeySecret |
string |
阿里云 AccessKey Secret |
bucket |
string |
OSS Bucket 名称 |
region |
string |
地域,如 oss-cn-hangzhou |
endpoint |
string |
可选,自定义 Endpoint |
腾讯云 COS
# upload:
# type: tencentCos
# tencentCos:
# secretId: your-secret-id
# secretKey: your-secret-key
# bucket: your-bucket-1234567890
# region: ap-guangzhou
| 字段 |
类型 |
说明 |
secretId |
string |
腾讯云 SecretId |
secretKey |
string |
腾讯云 SecretKey |
bucket |
string |
COS Bucket 名称 |
region |
string |
地域,如 ap-guangzhou |
七牛云
# upload:
# type: qiniu
# qiniu:
# accessKey: your-access-key
# secretKey: your-secret-key
# bucket: your-bucket-name
# region: z0
| 字段 |
类型 |
说明 |
accessKey |
string |
七牛 AccessKey |
secretKey |
string |
七牛 SecretKey |
bucket |
string |
七牛 Bucket 名称 |
region |
string |
区域代码:z0 = 华东, z1 = 华北, z2 = 华南, na0 = 北美, as0 = 东南亚 |
AWS S3 / MinIO
# upload:
# type: awsS3
# awsS3:
# accessKeyId: your-access-key-id
# secretAccessKey: your-secret-access-key
# bucket: your-bucket-name
# region: us-east-1
# endpoint: ""
| 字段 |
类型 |
说明 |
accessKeyId |
string |
AWS AccessKey ID(或 MinIO AccessKey) |
secretAccessKey |
string |
AWS SecretAccessKey(或 MinIO SecretKey) |
bucket |
string |
S3 Bucket 名称 |
region |
string |
区域,如 us-east-1 |
endpoint |
string |
可选,自定义 Endpoint(使用 MinIO 等兼容 S3 协议的服务时需要填写) |
Azure Blob Storage
# upload:
# type: azureBlob
# azureBlob:
# accountName: your-account-name
# accountKey: your-account-key
# containerName: your-container-name
# endpoint: ""
| 字段 |
类型 |
说明 |
accountName |
string |
Azure 存储账户名称 |
accountKey |
string |
Azure 存储账户密钥 |
containerName |
string |
Blob 容器名称 |
endpoint |
string |
可选,自定义 Endpoint |
ModStart
# upload:
# type: modstart
# modstart:
# baseUrl: "https://your-modstart-site.com"
# apiMemberSecret: "your-api-member-secret"
| 字段 |
类型 |
说明 |
baseUrl |
string |
ModStart 站点基础 URL |
apiMemberSecret |
string |
对应 ModStart 环境变量 env.API_MEMBER_SECRET |
Proxy(代理服务器)
proxy:
- name: local
type: http
host: 127.0.0.1
port: "7890"
username: user # 可选
password: pass # 可选
proxy 是一个数组,可配置多个代理条目。每个条目包含:
| 字段 |
类型 |
说明 |
name |
string |
代理名称,供 modelProviders 中的 proxyName 引用 |
type |
string |
代理类型,支持 http 和 socks5 |
host |
string |
代理服务器主机地址 |
port |
string |
代理服务器端口 |
username |
string |
可选,认证用户名 |
password |
string |
可选,认证密码 |
Model Providers(模型供应商)
模型供应商是 ClawGoal 的核心配置之一。每个供应商定义一个驱动(apiBase / apiKey)并暴露一组模型。在整个配置中通过 供应商名称|模型名称 的格式引用模型。
通用字段
modelProviders:
- name: custom1
provider: custom
format: openai
apiBase: "https://api.openai.com/v1"
apiKey: your-openai-api-key-change-in-production-2026
isDefault: true
# proxyName: local
models:
- name: gpt-4o
- name: gpt-3.5-turbo
| 字段 |
类型 |
说明 |
name |
string |
供应商名称(自定义),用于在其他地方引用 |
provider |
string |
供应商类型,如 custom / openai / gemini / claude / deepseek |
format |
string |
仅对 custom 类型有效,控制 API 协议格式:openai(默认)、gemini、anthropic、ollama |
apiBase |
string |
API 基础地址 |
apiKey |
string |
API 密钥 |
isDefault |
bool |
是否设为默认供应商 |
proxyName |
string |
可选,通过指定代理名称将请求路由到对应代理 |
models |
array |
模型列表(见下方模型配置) |
模型配置
每个模型可以单独设置参数:
models:
- name: gpt-4o
# imageInputs: ["url", "base64"]
# temperature: 0.7
# maxTokens: 4096
# contextWindow: 128000
| 字段 |
类型 |
默认值 |
说明 |
name |
string |
— |
模型名称 |
imageInputs |
array |
["url", "base64"] |
支持的图片输入方式,url 和/或 base64 |
temperature |
float |
模型默认值 |
生成温度,0 = 精确,1 = 创意 |
maxTokens |
int |
模型默认值 |
每次调用最大生成 Token 数 |
contextWindow |
int |
内置默认值 |
上下文窗口大小,0 表示使用内置默认值 |
支持的供应商示例
OpenAI 官方:
# - name: openai
# provider: openai
# apiKey: sk-...
# models:
# - name: gpt-4o
Google Gemini:
# - name: gemini
# provider: gemini
# apiKey: your-gemini-api-key
# models:
# - name: gemini-2.0-flash
Anthropic Claude:
# - name: claude
# provider: claude
# apiKey: sk-ant-...
# models:
# - name: claude-3-5-sonnet-20241022
Ollama(本地模型):
# - name: ollama
# provider: custom
# format: ollama
# apiBase: "http://localhost:11434"
# apiKey: ""
# models:
# - name: llama3
DeepSeek:
# - name: deepseek
# provider: deepseek
# apiKey: your-deepseek-api-key
# models:
# - name: deepseek-chat
Embedding Model(嵌入模型)
控制知识记忆和语义搜索的向量嵌入后端。
embeddingModel:
type: default
# type: openai
# model: text-embedding-3-small
# apiKey: your-embedding-api-key
# apiBase: "https://api.openai.com/v1"
| 字段 |
类型 |
说明 |
type |
string |
default = 内置 sqlite-vec(无需外部模型和 API Key);openai = 使用 OpenAI 兼容的嵌入 API |
model |
string |
仅 openai 类型需要,嵌入模型名称 |
apiKey |
string |
仅 openai 类型需要,API 密钥 |
apiBase |
string |
仅 openai 类型需要,API 基础地址 |
Model(模型别名与回退链)
将逻辑模型别名映射到具体的 供应商名称|模型名称。支持在同一键下配置多个模型,形成自动回退链:前一个失败时自动尝试下一个。
model:
default:
- name: "custom1|gpt-4o"
router:
- name: "custom1|gpt-4o"
# fallback:
# - name: "custom1|gpt-4o"
# - name: "custom1|gpt-3.5-turbo"
| 字段 |
类型 |
说明 |
default |
array |
大多数 Agent 任务使用的主模型 |
router |
array |
任务路由和规划使用的模型(可以与 default 不同) |
fallback |
array |
回退链示例:优先使用第一个模型,失败后自动尝试后续模型 |
Runtime(运行时环境)
# runtime:
# python:
# path: /usr/bin/python3
| 字段 |
类型 |
默认值 |
说明 |
path |
string |
系统默认 python3 |
Python 解释器路径。留空或不设置则自动使用系统默认 Python |
Agent(Agent 任务)
agent:
maxConcurrent: 3
# taskPath: /custom/agent/tasks/
| 字段 |
类型 |
默认值 |
说明 |
maxConcurrent |
int |
3 |
最大同时运行的 Agent 任务数 |
taskPath |
string |
<dataPath>/agentTasks/ |
Agent 任务数据目录。注释状态,取消注释后生效 |
Env(环境变量注入)
# env:
# PATH: "/opt/homebrew/bin:$PATH"
# PYTHONPATH: "/custom/python/lib"
注入到 Shell / Python 子进程的额外环境变量。值中可以使用 $VAR 或 ${VAR} 引用已有环境变量。
Error Reporting(错误报告)
# reportUrl: "https://your-monitoring-endpoint/report"
可选的错误报告 URL。当系统发生错误时,通过 GET 请求发送 URL 编码的 JSON 数据到此地址:
GET <reportUrl>?data=<json>
Claw(Claw 模块)
claw:
skillDirs:
- /path/to/skills
| 字段 |
类型 |
说明 |
skillDirs |
array |
额外的技能目录列表(追加到默认 <dataPath>/skills/ 之后)。每个条目可以是绝对路径,也可以是相对于项目根目录的路径 |
快速上手
- 将
config.example.yaml 复制为 config.yaml
- 修改以下必要字段:
-
jwt.secret — 至少 16 个字符的随机字符串
-
auth.password — 设置登录密码
-
modelProviders — 配置至少一个可用的 AI 模型供应商
- 根据需求调整端口、数据库、存储后端等
- 启动 ClawGoal 服务,系统会自动读取配置
📘 修改配置后需要重启 ClawGoal 服务才能使新配置生效。