一、Antigravity Manager完全配置指南
什么是Antigravity Manager?
Antigravity Manager是一个AI模型账号管理服务,支持多种高端AI模型的接入和管理,包括Claude Sonnet 4.5、Claude Opus 4.5 Thinking、Gemini 3 Pro Image等。
系统要求和前置准备
- OpenClaw已安装并配置完成
- 拥有Antigravity账号
- 获取到有效的User Token
安装Antigravity Manager
bash
openclaw config add provider antigravity
配置AI模型账号
json
{
"providers": [{
"type": "antigravity",
"token": "your-user-token"
}]
}
配置OpenClaw
json
{
"agent": {
"provider": "antigravity",
"model": "claude-sonnet-4-5"
}
}
支持的模型配置
| 模型名称 | 配置值 | 特点 |
|---|---|---|
| Claude Sonnet 4.5 | claude-sonnet-4-5 |
平衡性能和成本 |
| Claude Opus 4.5 Thinking | claude-opus-4-5-thinking |
深度推理能力 |
| Gemini 3 Pro Image | gemini-3-pro-image |
图像理解和生成 |
常用命令速查
bash
# 验证配置
openclaw doctor
# 测试模型连接
openclaw test provider antigravity
# 切换模型
openclaw config set agent.model claude-opus-4-5-thinking
二、多模型切换策略
模型特点对比
| 模型 | 速度 | 质量 | 成本 | 适用场景 |
|---|---|---|---|---|
| GPT-4o | 快 | 高 | 中 | 日常对话 |
| Claude 3.5 Sonnet | 中 | 很高 | 中 | 代码、分析 |
| Claude 3 Opus | 慢 | 极高 | 高 | 复杂任务 |
| DeepSeek V3 | 快 | 高 | 低 | 中文场景 |
场景化选择策略
日常聊天
使用轻量级模型如GPT-4o-mini或DeepSeek V3,成本低响应快
代码开发
使用Claude 3.5 Sonnet,代码理解和生成能力强
复杂分析
使用Claude 3 Opus或GPT-4o,推理能力更强
模型容灾机制(Fallback)
json
{
"agent": {
"provider": "openai",
"model": "gpt-4o",
"fallback": {
"provider": "anthropic",
"model": "claude-3-5-sonnet"
}
}
}
多认证Profile + Token轮换
json
{
"providers": [
{
"type": "openai",
"name": "openai-primary",
"apiKey": "sk-xxx1"
},
{
"type": "openai",
"name": "openai-backup",
"apiKey": "sk-xxx2"
}
]
}
三、记忆搜索配置(Memory Search)
什么是Memory Search?
Memory Search是OpenClaw的智能记忆系统,允许AI助手搜索和引用历史对话记录,提供更连贯和个性化的交互体验。
基础配置
json
{
"memory": {
"enabled": true,
"search": {
"enabled": true,
"maxResults": 5,
"similarityThreshold": 0.7
}
}
}
配置项详解
- enabled: 是否启用记忆搜索
- maxResults: 每次搜索返回的最大记忆数量
- similarityThreshold: 相似度阈值,0-1之间
使用场景
💡 最佳实践
- 长期项目跟踪:记住项目上下文和历史决策
- 个性化服务:记住用户偏好和习惯
- 知识库问答:基于历史对话提供准确回答
四、成本优化方案
Token消耗分析
理解Token的消耗模式是优化成本的第一步:
- 输入Token:用户消息和系统提示词
- 输出Token:AI生成的回复
- 上下文Token:历史对话累积
缓存策略
json
{
"agent": {
"cache": {
"enabled": true,
"ttl": 3600
}
}
}
降级策略
json
{
"agent": {
"model": "gpt-4o",
"costControl": {
"maxCostPerDay": 10,
"fallbackModel": "gpt-4o-mini"
}
}
}
成本控制实战
💡 省钱技巧
- 使用国产模型(DeepSeek、Kimi)替代国际模型
- 限制上下文长度,避免长对话累积
- 对简单任务使用轻量级模型
- 启用缓存减少重复调用
五、性能调优技巧
响应速度优化
启用流式输出
逐字显示回复,提升用户体验
限制上下文长度
减少Token消耗和传输时间
使用本地缓存
缓存频繁访问的数据
并发处理优化
json
{
"gateway": {
"concurrency": {
"maxConnections": 10,
"maxRequestsPerSecond": 5
}
}
}
内存管理
- 定期清理过期会话
- 限制内存中保留的最大会话数
- 使用流式处理大文件
六、模型提供商配置详解
支持的模型提供商
| 类型 | 提供商 | 推荐场景 |
|---|---|---|
| 国际模型 | OpenAI、Anthropic、Google | 高质量通用任务 |
| 国产模型 | DeepSeek、Kimi、通义千问 | 中文场景、成本敏感 |
| 本地模型 | Ollama、LM Studio | 隐私敏感、离线使用 |
配置OpenAI
json
{
"providers": [{
"type": "openai",
"apiKey": "sk-xxx",
"baseURL": "https://api.openai.com/v1"
}]
}
配置DeepSeek
json
{
"providers": [{
"type": "deepseek",
"apiKey": "sk-xxx"
}]
}
配置Ollama(本地模型)
json
{
"providers": [{
"type": "ollama",
"baseURL": "http://localhost:11434"
}]
}
七、工具系统详解
内置工具列表
| 工具名称 | 功能 | 安全风险 |
|---|---|---|
| file_read | 读取文件内容 | 低 |
| file_write | 写入文件 | 中 |
| shell | 执行Shell命令 | 高 |
| web_search | 网络搜索 | 低 |
| code_interpreter | 执行代码 | 中 |
启用和禁用工具
json
{
"agent": {
"tools": {
"enabled": ["file_read", "web_search"],
"disabled": ["shell"]
}
}
}
工具权限控制
⚠️ 安全提醒
建议根据使用场景谨慎启用工具:
- 只读场景:仅启用 file_read、web_search
- 开发场景:可启用 shell、code_interpreter
- 生产环境:禁用高风险工具
八、CLI命令完整参考
核心命令
bash
# 初始化配置
openclaw onboard
# 查看版本
openclaw --version
# 运行诊断
openclaw doctor
Gateway管理
bash
# 启动网关
openclaw gateway start [name]
# 停止网关
openclaw gateway stop [name]
# 重启网关
openclaw gateway restart [name]
# 查看状态
openclaw gateway status
配置管理
bash
# 添加网关
openclaw config add gateway
# 添加提供商
openclaw config add provider
# 设置配置项
openclaw config set
# 查看配置
openclaw config get
Skills管理
bash
# 列出Skills
openclaw skills list
# 安装Skill
openclaw skills install
# 更新Skills
openclaw skills update [name]
# 卸载Skill
openclaw skills uninstall