跳到主要内容
Ubuntu 22.04 安装 Openclaw 详细教程:配置 AI 员工与多模型接入 | 极客日志
Shell / Bash AI 算法
Ubuntu 22.04 安装 Openclaw 详细教程:配置 AI 员工与多模型接入 综述由AI生成 在 Ubuntu 22.04 系统上安装和配置 Openclaw AI 员工的完整流程。内容包括通过 Shell 脚本一键安装、配置飞书和钉钉等通讯渠道、接入 GLM-4.7-Flash、DeepSeek、MiniMax 及豆包等多个大模型 API。此外,还涵盖了如何使用 Exa.ai 增强 Web 搜索能力,包括 API 配置、MCP Server 集成、函数调用示例及搜索类型参考。文章旨在帮助用户利用 AI 辅助完成 Gnuradio 移植、FPGA 编程及 Linux 开发等任务,提升工作效率。
林间仙子 发布于 2026/4/5 更新于 2026/5/23 30 浏览Ubuntu 22.04 安装 Openclaw 详细教程
准备工作
Openclaw 中文官网:https://clawd.org.cn/
一键安装
curl -fsSL https://clawd.org.cn/install.sh | sudo bash
输入 Y 确认安装。
需要配置 DeepSeek API Key。访问 https://platform.deepseek.com/sign_in 注册并获取 API Key,在终端中输入 key。
设置通道 配置飞书
创建飞书机器人:https://open.feishu.cn
进入开发者后台,注册用户并创建 AI 机器人。
获取 App ID 和 App Secret。
在安装终端中填入 App ID 和 Secret。
后续可单独输入命令配置:openclaw-cn configure --section channels
如有问题,运行 openclaw-cn onboard --install-daemon 重新配置。
若 Gateway 未安装导致无法打开网页端,执行以下命令安装必备工具:
sudo apt install net-tools
让 AI 员工更好用
加入免费的模型
配置 GLM-4.7-Flash 官方免费 API:https://bigmodel.cn/
注册开发者账号并获取 API Key。
在控制台新建 API Key 并复制。
修改 openclaw.json 文件,写入模型配置:
"models" : {
"providers" : {
"glm" : {
"baseUrl" : "https://open.bigmodel.cn/api/paas/v4" ,
"apiKey" : "你的 apiKey" ,
"api" :
"openai-completions"
,
"models"
:
[
{
"id"
:
"glm-4.7-flash"
,
"name"
:
"GLM-4.7 Flash"
,
"contextWindow"
:
128000
,
"maxTokens"
:
4096
,
"reasoning"
:
false
,
"input"
:
[
"text"
]
,
"cost"
:
{
"input"
:
0
,
"output"
:
0
,
"cacheRead"
:
0
,
"cacheWrite"
:
0
}
}
]
}
}
}
,
"agents"
:
{
"defaults"
:
{
"model"
:
{
"primary"
:
"glm/glm-4.7-flash"
}
,
"maxConcurrent"
:
4
,
"subagents"
:
{
"maxConcurrent"
:
8
}
}
}
重启服务:openclaw-cn gateway restart
配置钉钉
Card.Instance.Write
Card.Streaming.Write
im:message
openclaw-cn plugins install https://github.com/soimy/clawdbot-channel-dingtalk.git
在 GLM-4.7-Flash 基础上加入 DeepSeek 当 GLM-4.7 Flash 免费 token 不足时,可自动切换到 DeepSeek。需在 openclaw.json 中加入 DeepSeek API Key 配置,然后重启服务:openclaw-cn gateway restart
加入 MiniMax 和豆包模型
配置 Web 搜索
注册并获取 API Key。
告知 Openclaw 配置:"我注册了 Exa.ai,并得到 apikey:xxx,请帮我配置 exa.ai,代替 Brave Search 进行网络搜索。"
重启服务:openclaw-cn gateway restart
.env File
🔌 Exa MCP Server for OpenAI Codex 给 OpenAI Codex 提供实时 Web 搜索、代码上下文和公司研究功能。
codex mcp add exa --url https://mcp.exa.ai/mcp?exaApiKey=YOUR_API_KEY
https://mcp.exa.ai/mcp?exaApiKey=YOUR_API_KEY&tools=web_search_exa,get_code_context_exa,people_search_exa
https://mcp.exa.ai/mcp?exaApiKey=YOUR_API_KEY&tools=web_search_exa,web_search_advanced_exa,get_code_context_exa,crawling_exa,company_research_exa,people_search_exa,deep_researcher_start,deep_researcher_check
Quick Start curl -X POST 'https://api.exa.ai/search' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "query": "latest developments in AI safety research", "type": "auto", "num_results": 10, "contents": { "text": { "max_characters": 20000 } } }'
Function Calling / Tool Use Function calling 允许 AI 代理根据对话上下文动态决定何时搜索网络。
import json
from openai import OpenAI
from exa_py import Exa
openai = OpenAI()
exa = Exa()
tools = [{"type" :"function" ,"function" :{"name" :"exa_search" ,"description" :"Search the web for current information." ,"parameters" :{"type" :"object" ,"properties" :{"query" :{"type" :"string" ,"description" :"Search query" }},"required" :["query" ]}}}]
def exa_search (query:str )->str :
results = exa.search_and_contents(query,type ="auto" , num_results=10 , text={"max_characters" :20000 })
return "\n" .join([f"{r.title} : {r.url} " for r in results.results])
messages = [{"role" :"user" ,"content" :"What's the latest in AI safety?" }]
response = openai.chat.completions.create(model="gpt-4o" , messages=messages, tools=tools)
if response.choices[0 ].message.tool_calls:
tool_call = response.choices[0 ].message.tool_calls[0 ]
search_results = exa_search(json.loads(tool_call.function.arguments)["query" ])
messages.append(response.choices[0 ].message)
messages.append({"role" :"tool" ,"tool_call_id" : tool_call.id ,"content" : search_results})
final = openai.chat.completions.create(model="gpt-4o" , messages=messages)
print (final.choices[0 ].message.content)
import anthropic
from exa_py import Exa
client = anthropic.Anthropic()
exa = Exa()
tools = [{"name" :"exa_search" ,"description" :"Search the web for current information." ,"input_schema" :{"type" :"object" ,"properties" :{"query" :{"type" :"string" ,"description" :"Search query" }},"required" :["query" ]}}]
def exa_search (query:str )->str :
results = exa.search_and_contents(query,type ="auto" , num_results=10 , text={"max_characters" :20000 })
return "\n" .join([f"{r.title} : {r.url} " for r in results.results])
messages = [{"role" :"user" ,"content" :"Latest quantum computing developments?" }]
response = client.messages.create(model="claude-sonnet-4-20250514" , max_tokens=4096 , tools=tools, messages=messages)
if response.stop_reason == "tool_use" :
tool_use = next (b for b in response.content if b.type =="tool_use" )
tool_result = exa_search(tool_use.input ["query" ])
messages.append({"role" :"assistant" ,"content" : response.content})
messages.append({"role" :"user" ,"content" :[{"type" :"tool_result" ,"tool_use_id" : tool_use.id ,"content" : tool_result}]})
final = client.messages.create(model="claude-sonnet-4-20250514" , max_tokens=4096 , tools=tools, messages=messages)
print (final.content[0 ].text)
Search Type Reference Type Best For Speed Depth fastReal-time apps, autocomplete, quick lookups Fastest Basic autoMost queries - balanced relevance & speed Medium Smart deepResearch, enrichment, thorough results Slow Deep deep-reasoningComplex research, multi-step reasoning Slowest Deepest
Tip: type="auto" works well for most queries.
Content Configuration Choose ONE content type per request:
Type Config Best For Text "text": {"max_characters": 20000}Full content extraction, RAG Highlights "highlights": {"max_characters": 4000}Snippets, summaries, lower cost
Warning: Using text: true can significantly increase token count.
Domain Filtering (Optional) { "includeDomains" : [ "arxiv.org" , "github.com" ] , "excludeDomains" : [ "pinterest.com" ] }
Web Search Tool { "query" : "latest developments in AI safety research" , "num_results" : 10 , "contents" : { "text" : { "max_characters" : 20000 } } }
Category Examples Use category filters to search dedicated indexes.
People Search (category: "people") : Find people by role, expertise.
Company Search (category: "company") : Find companies by industry.
News Search (category: "news") : News articles.
Research Papers (category: "research paper") : Academic papers.
Tweet Search (category: "tweet") : Twitter/X posts.
Content Freshness (maxAgeHours) Sets maximum acceptable age for cached content.
Value Behavior Best For 24 Use cache if less than 24 hours old Daily-fresh content 1 Use cache if less than 1 hour old Near real-time data 0 Always livecrawl Real-time data -1 Never livecrawl Maximum speed
Other Endpoints Endpoint Description /contentsGet contents for known URLs /answerQ&A with citations from web search
Troubleshooting
Results not relevant? Try type: "auto" or type: "deep". Refine query.
Need structured data? Use type: "deep" with outputSchema.
Results too slow? Use type: "fast" or reduce num_results.
No results? Remove filters, simplify query.
Resources 相关免费在线工具 加密/解密文本 使用加密算法(如AES、TripleDES、Rabbit或RC4)加密和解密文本明文。 在线工具,加密/解密文本在线工具,online
RSA密钥对生成器 生成新的随机RSA私钥和公钥pem证书。 在线工具,RSA密钥对生成器在线工具,online
Mermaid 预览与可视化编辑 基于 Mermaid.js 实时预览流程图、时序图等图表,支持源码编辑与即时渲染。 在线工具,Mermaid 预览与可视化编辑在线工具,online
随机西班牙地址生成器 随机生成西班牙地址(支持马德里、加泰罗尼亚、安达卢西亚、瓦伦西亚筛选),支持数量快捷选择、显示全部与下载。 在线工具,随机西班牙地址生成器在线工具,online
Gemini 图片去水印 基于开源反向 Alpha 混合算法去除 Gemini/Nano Banana 图片水印,支持批量处理与下载。 在线工具,Gemini 图片去水印在线工具,online
Base64 字符串编码/解码 将字符串编码和解码为其 Base64 格式表示形式即可。 在线工具,Base64 字符串编码/解码在线工具,online