返回文章列表
Hypereal AI Team
AIGuide
2026年如何在 OpenClaw 中使用 GLM-5 API
openclaw glm-5
6 min read
100+ AI 模型,一个 API
开始使用 Hypereal 构建
通过单个 API 访问 Kling、Flux、Sora、Veo 等。免费积分开始,扩展到数百万。
无需信用卡 • 10万+ 开发者 • 企业级服务
2026年如何在 OpenClaw 中使用 GLM-5 API
OpenClaw 是一个流行的开源自动化框架,可以让你使用模块化、可组合的节点构建 AI 驱动的工作流。将它与 GLM-5 —— 智谱AI 拥有 128K 上下文的强大编程模型 —— 搭配使用,可以为代码生成、文档分析和复杂推理任务打造高性价比的处理管线。
本指南将带你完成在 OpenClaw 中通过 Hypereal 作为 API 提供商来配置 GLM-5 的全过程。
前提条件
- 已安装 OpenClaw(v2.0+)
- 拥有 Hypereal API 密钥 —— 在 hypereal.ai 免费注册(35 积分,无需信用卡)
- 对 OpenClaw 工作流有基本了解
第一步:获取 Hypereal API 密钥
- 前往 hypereal.ai 创建账号
- 进入控制面板中的 API Keys 部分
- 生成新的 API 密钥并复制
注册即可获得 35 个免费积分,足够你深入测试 GLM-5。
第二步:在 OpenClaw 中配置 API 提供商
OpenClaw 通过设置面板支持自定义 LLM 提供商。将 Hypereal 添加为新的提供商:
{
"providers": {
"hypereal": {
"type": "openai-compatible",
"baseURL": "https://hypereal.tech/api/v1/chat",
"apiKey": "your-hypereal-api-key",
"models": ["glm-5"]
}
}
}
也可以通过 OpenClaw 界面进行配置:
- 打开 Settings > LLM Providers
- 点击 Add Provider
- 选择 OpenAI-Compatible 作为提供商类型
- 输入 Base URL:
https://hypereal.tech/api/v1/chat - 粘贴你的 Hypereal API 密钥
- 在模型列表中添加
glm-5
第三步:创建 GLM-5 工作流
以下是一个使用 GLM-5 分析代码并提出改进建议的简单 OpenClaw 工作流:
name: code-review-pipeline
nodes:
- id: input
type: text-input
config:
label: "粘贴你的代码"
- id: analyze
type: llm
config:
provider: hypereal
model: glm-5
system_prompt: |
你是一位资深代码审查员。请分析提供的代码,关注以下方面:
1. Bug 和潜在问题
2. 性能优化建议
3. 代码风格和可读性
请提供具体、可操作的反馈。
temperature: 0.3
max_tokens: 4096
- id: output
type: text-output
config:
label: "审查结果"
edges:
- from: input
to: analyze
- from: analyze
to: output
第四步:在代码节点中使用 GLM-5
如需更多控制,可以在 OpenClaw 代码节点中直接使用 GLM-5:
import openai
def run(inputs):
client = openai.OpenAI(
api_key=inputs["api_key"],
base_url="https://hypereal.tech/api/v1/chat"
)
response = client.chat.completions.create(
model="glm-5",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": inputs["prompt"]}
],
max_tokens=4096,
temperature=0.3
)
return {"result": response.choices[0].message.content}
import OpenAI from "openai";
export async function run(inputs: { apiKey: string; prompt: string }) {
const client = new OpenAI({
apiKey: inputs.apiKey,
baseURL: "https://hypereal.tech/api/v1/chat",
});
const response = await client.chat.completions.create({
model: "glm-5",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: inputs.prompt },
],
max_tokens: 4096,
temperature: 0.3,
});
return { result: response.choices[0].message.content };
}
进阶:多步骤管线
GLM-5 的 128K 上下文窗口使其非常适合在节点之间累积上下文的多步骤工作流:
name: document-to-code
nodes:
- id: doc-input
type: file-input
config:
accept: [".md", ".txt", ".pdf"]
- id: extract-requirements
type: llm
config:
provider: hypereal
model: glm-5
system_prompt: "从这份文档中提取所有功能需求,以编号列表的形式呈现。"
temperature: 0.2
max_tokens: 4096
- id: generate-code
type: llm
config:
provider: hypereal
model: glm-5
system_prompt: "根据给定的需求生成简洁、可用于生产环境的 Python 代码。包含类型提示和文档字符串。"
temperature: 0.3
max_tokens: 8192
- id: generate-tests
type: llm
config:
provider: hypereal
model: glm-5
system_prompt: "为提供的代码编写全面的 pytest 测试。覆盖边界情况。"
temperature: 0.3
max_tokens: 4096
- id: output
type: text-output
edges:
- from: doc-input
to: extract-requirements
- from: extract-requirements
to: generate-code
- from: generate-code
to: generate-tests
- from: generate-tests
to: output
为什么选择 GLM-5 + OpenClaw + Hypereal?
- 高性价比 —— 通过 Hypereal 使用 GLM-5 比智谱AI 官方价格低 40%(输入/输出每百万 tokens 仅需 $0.60/$2.70)
- 128K 上下文 —— 处理大型文档和多步骤工作流不会被截断
- OpenAI 兼容 —— 无需使用自定义 SDK,可直接使用标准 OpenAI 客户端库
- 免费起步 —— Hypereal 注册即送 35 积分,无需信用卡
- 编程能力强 —— GLM-5 在代码生成、审查和重构任务上表现出色
常见问题排查
- 401 Unauthorized —— 请仔细检查提供商设置中的 API 密钥
- Model not found —— 确保使用
glm-5作为模型名称(区分大小写) - 超时错误 —— 对于较长的输出,请在 OpenClaw 节点配置中增加超时时间
- 速率限制 —— Hypereal 的速率限制较为宽松,如果触发限制,可在 LLM 调用之间添加延迟节点
立即开始
免费试用 Hypereal AI —— 35 个积分,无需信用卡。
设置好 API 密钥,在 OpenClaw 中配置提供商,几分钟内即可开始使用 GLM-5 构建强大的 AI 工作流。
