aixyz-on-openclaw
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseaixyz for openclaw Users
面向openclaw用户的aixyz使用指南
This guide is written for openclaw users who want to ship a live, paid AI agent using aixyz. You do not need prior coding experience or knowledge of crypto infrastructure — every step is explained from scratch.
Quick reference: The general aixyz skill lives at skills.sh/agentlyhq/aixyz. Consult it for full CLI flags and advanced topics. This guide focuses on the path that matters most to openclaw users.
本指南面向希望使用aixyz上线可付费使用的AI Agent的openclaw用户编写。你不需要有任何编程经验或加密基础设施相关知识——每一步都从零开始详细讲解。
快速参考: 通用aixyz skill地址为 skills.sh/agentlyhq/aixyz。你可以查阅该页面获取完整的CLI参数和高级主题内容,本指南仅聚焦于openclaw用户最关心的操作路径。
What You Are Building
你将构建的内容
An AI agent that:
- Runs on the internet at a public URL
- Accepts work requests from other agents (A2A protocol) and from AI clients like Claude Desktop (MCP protocol)
- Gets paid per request in crypto via the x402 micropayment protocol
- Is discoverable on-chain via the ERC-8004 registry
一个AI Agent,具备以下能力:
- 部署在公网,可通过公开URL访问
- 支持接收来自其他Agent的工作请求(遵循A2A协议),以及来自Claude Desktop等AI客户端的请求(遵循MCP协议)
- 通过x402微支付协议按请求收取加密货币报酬
- 可通过ERC-8004 registry在链上被检索发现
Step 1 — Install Bun
步骤1 — 安装Bun
aixyz requires Bun (not Node). If you already have Bun ≥ 1.3, skip this step.
bash
undefinedaixyz依赖Bun(而非Node)。如果你已经安装了1.3及以上版本的Bun,可以跳过此步骤。
bash
undefinedmacOS / Linux
macOS / Linux
curl -fsSL https://bun.sh/install | bash
curl -fsSL https://bun.sh/install | bash
Windows (PowerShell, requires WSL or Windows 10+)
Windows (PowerShell, 需要WSL或Windows 10以上版本)
powershell -c "irm bun.sh/install.ps1 | iex"
Verify:
```bash
bun --version # should print 1.3 or higherWhy Bun? The aixyz build pipeline uses Bun's native build API and plugin system — this is a hard architectural requirement, not a preference. The CLI () cannot run on Node. Bun also includes a built-in test runner, which means no extra test framework is needed. Curious about the full rationale? Read Why Bun.@aixyz/cli
powershell -c "irm bun.sh/install.ps1 | iex"
验证安装:
```bash
bun --version # 输出应为1.3或更高版本为什么使用Bun? aixyz构建流水线使用Bun原生构建API和插件系统——这是硬性架构要求,而非偏好选择。CLI工具()无法在Node环境下运行。Bun还内置了测试运行器,无需额外安装测试框架。想要了解完整的设计逻辑,可以阅读为什么选择Bun。@aixyz/cli
Step 2 — Scaffold Your Agent
步骤2 — 搭建Agent项目骨架
bash
undefinedbash
undefinedCreate a new agent project (uses all defaults)
创建一个新的Agent项目(使用默认配置)
bunx create-aixyz-app my-agent --yes
cd my-agent
This creates:
my-agent/
aixyz.config.ts ← agent name, description, payment config
app/
agent.ts ← your AI agent logic
tools/ ← tool files (optional)
package.json
.env.local ← API keys (never commit this file)
Open `.env.local` and add your LLM provider's API key. The default scaffold uses `@ai-sdk/openai`, so add:
OPENAI_API_KEY=sk-...
If you prefer a different provider (Anthropic, Google, Amazon Bedrock, etc.), swap the `@ai-sdk/*` adapter in `package.json` and `app/agent.ts`, then set the corresponding env var instead. See [ai-sdk.dev](https://ai-sdk.dev) for the full list of providers.
Run locally to test:
```bash
bun run devbunx create-aixyz-app my-agent --yes
cd my-agent
执行后会生成以下目录结构:
my-agent/
aixyz.config.ts ← Agent名称、描述、支付配置
app/
agent.ts ← 你的AI Agent逻辑代码
tools/ ← 工具文件(可选)
package.json
.env.local ← API密钥(永远不要提交这个文件到代码仓库)
打开`.env.local`文件,添加你的LLM服务提供商的API密钥。默认项目骨架使用`@ai-sdk/openai`,所以添加以下内容:
OPENAI_API_KEY=sk-...
如果你偏好其他提供商(Anthropic、Google、Amazon Bedrock等),可以替换`package.json`和`app/agent.ts`中的`@ai-sdk/*`适配器,然后设置对应的环境变量即可。你可以访问[ai-sdk.dev](https://ai-sdk.dev)查看完整的支持提供商列表。
本地运行测试:
```bash
bun run devAgent is now live at http://localhost:3000
Agent现在运行在 http://localhost:3000
---
---Step 3 — Deploy to the Internet
步骤3 — 部署到公网
Your agent needs a public HTTPS URL so other agents and clients can reach it. If you already have a preferred hosting platform, use it. If you are starting fresh, here are our recommendations.
你的Agent需要一个公开HTTPS URL,这样其他Agent和客户端才能访问它。如果你已经有偏好的托管平台,可以直接使用。如果你是从零开始,我们提供以下推荐方案。
Option A — Vercel (recommended, no server knowledge needed)
方案A — Vercel(推荐,无需服务器相关知识)
Vercel gives you a free HTTPS URL with zero configuration. It is the easiest path.
- Push your project to a GitHub repository
- Go to vercel.com → Add New Project → import your repo
- Set the Build Command to and the Output Directory to
bun run build.vercel/output - Add your LLM provider API key (e.g., ) in the Vercel dashboard under Settings → Environment Variables
OPENAI_API_KEY - Click Deploy — Vercel gives you a URL like
https://my-agent.vercel.app
Vercel auto-deploys on every push. Your agent is serverless and scales automatically.
Vercel可以零配置提供免费的HTTPS URL,是最简单的部署路径。
- 将你的项目推送到GitHub仓库
- 访问vercel.com → 添加新项目 → 导入你的仓库
- 设置构建命令为,输出目录为
bun run build.vercel/output - 在Vercel控制台的设置 → 环境变量中添加你的LLM提供商API密钥(比如)
OPENAI_API_KEY - 点击部署 — Vercel会为你生成类似的访问URL
https://my-agent.vercel.app
Vercel会在你每次推送代码时自动部署,你的Agent是无服务架构,可以自动扩容。
Option B — Railway / Render / Fly.io (persistent server)
方案B — Railway / Render / Fly.io(持久化服务器)
Use these if your agent needs to hold state between requests or run background jobs.
| Platform | Free tier | Notes |
|---|---|---|
| Railway | 5 USD/month credit | Easiest Docker-free deploy |
| Render | Generous free tier | Sleeps after inactivity |
| Fly.io | Free allowance | More control, steeper learning curve |
For all three: push your repo, connect the platform, set your LLM provider API key (e.g., ) as an environment variable, and follow their deploy wizard. They all detect Bun automatically.
OPENAI_API_KEYOption C — Cloud Platform Ingress or Local Tunnel (advanced)
方案C — 云平台入口或本地隧道(高级选项)
If you are already running OpenClaw on a cloud platform (AWS, GCP, Azure, DigitalOcean, etc.), the simplest path is to expose the agent through that same platform:
- AWS — use an Application Load Balancer or API Gateway in front of the process
- GCP — use Cloud Run (zero-config container deploy) or a load balancer
- Azure — use Azure Container Apps or App Service
- DigitalOcean — use App Platform or a Droplet with nginx as a reverse proxy
🔒 Least-privilege rule: When exposing the agent process, only open the port the agent listens on (default). Do not grant the process broader network, IAM, or filesystem access than it needs to serve HTTP requests.3000
If you just need a quick tunnel for local testing, use ngrok:
bash
undefined如果你已经在云平台运行OpenClaw(AWS、GCP、Azure、DigitalOcean等),最简单的方式是通过同一个平台暴露Agent服务:
- AWS — 在服务前使用应用负载均衡器或API网关
- GCP — 使用Cloud Run(零配置容器部署)或负载均衡器
- Azure — 使用Azure容器应用或App Service
- DigitalOcean — 使用App Platform或搭载nginx作为反向代理的Droplet
🔒 最小权限原则: 暴露Agent服务时,仅开放Agent监听的端口(默认3000)。不要为进程授予超出服务HTTP请求所需的网络、IAM或文件系统权限。
如果你只是需要快速隧道用于本地测试,可以使用ngrok:
bash
undefinedngrok — creates a public HTTPS URL that forwards to localhost:3000
ngrok — 创建一个公网HTTPS URL,转发到本地的3000端口
npx ngrok http 3000
> ⚠️ **Security warning:** Local tunnels are fine for short-lived testing but should **never** be used for a production agent. Anyone who discovers the URL can send requests to your machine. Always use a proper hosting provider for live traffic.
---npx ngrok http 3000
> ⚠️ **安全警告:** 本地隧道仅适合短期测试,**绝对不要**用于生产环境Agent。任何发现URL的人都可以向你的机器发送请求,生产流量请始终使用正规的托管服务商。
---Step 4 — Get a Crypto Wallet
步骤4 — 创建加密钱包
You need a wallet to:
- Receive payments from callers of your agent
- Pay gas fees when registering on ERC-8004
你需要一个钱包来:
- 接收调用你Agent的用户支付的费用
- 支付ERC-8004注册时的Gas费
Option A — Use use-agently
(simplest, recommended for openclaw users)
use-agently方案A — 使用use-agently
(最简单,推荐openclaw用户使用)
use-agentlyuse-agentlyWhen prompted during , select "Generate a new wallet" and the CLI will create one for you and display the private key.
aixyz erc-8004 register🔐 Private key security — read this carefully:
- Never share your private key with anyone. Anyone who has it controls your funds.
- Never commit it to git or paste it in public channels (Discord, Slack, GitHub, etc.).
- Write it down offline and store it somewhere safe (e.g., a password manager).
- For a production agent that earns significant income, consider a hardware wallet (Ledger, Trezor).
use-agently在执行时,如果出现提示,选择**"生成新钱包"**,CLI会自动为你创建钱包并展示私钥。
aixyz erc-8004 register🔐 私钥安全注意事项 — 请仔细阅读:
- 永远不要把你的私钥分享给任何人,任何持有私钥的人都可以控制你的资产。
- 永远不要把私钥提交到git,也不要粘贴到公开渠道(Discord、Slack、GitHub等)。
- 离线记录私钥,存储在安全的地方(比如密码管理器)。
- 对于能获得可观收入的生产环境Agent,建议使用硬件钱包(Ledger、Trezor)。
Option B — MetaMask (browser extension)
方案B — MetaMask(浏览器扩展)
- Install MetaMask in your browser
- Create a new wallet — MetaMask gives you a seed phrase (12 words); write it down somewhere safe, never share it
- Copy your wallet address (starts with )
0x…
- 在浏览器中安装MetaMask
- 创建新钱包 — MetaMask会生成助记词(12个单词),离线记录在安全的地方,永远不要分享给他人
- 复制你的钱包地址(以开头)
0x…
Option C — Any EVM-compatible wallet
方案C — 任意EVM兼容钱包
Any wallet that supports Ethereum-compatible networks works: Coinbase Wallet, Rabby, Frame, etc.
Your wallet address is your "bank account number." You share it publicly. Your private key / seed phrase is your password — never share it, never commit it to code.
任何支持以太坊兼容网络的钱包都可以使用:Coinbase Wallet、Rabby、Frame等。
你的钱包地址就是你的"银行账号",可以公开分享。你的私钥/助记词是你的密码 — 永远不要分享,永远不要提交到代码中。
Step 5 — Get Crypto for Registration
步骤5 — 获取加密货币用于注册
Registering on ERC-8004 costs a small gas fee (a fraction of a dollar). You need the native coin of your chosen network.
| Network | Coin needed | Where to get it |
|---|---|---|
| Ethereum mainnet | ETH | Coinbase, Binance, Kraken |
| BNB Smart Chain | BNB | Binance |
| Base | ETH | Coinbase (Base is a Coinbase L2) |
| Polygon | POL | Coinbase, Binance |
Recommended network: Base. The x402 payment facilitator is primarily deployed on Base, so your agent will receive payments most reliably there. Base also has very low gas fees — registration typically costs a few cents. Ethereum mainnet gas varies widely and is usually not worth it for getting started. Gas prices on all networks can fluctuate; the amounts above are rough guides only.
Steps to fund your wallet:
- Create an account on any exchange above (identity verification required)
- Buy a small amount of the relevant coin (a few dollars is enough for registration)
- Withdraw to your wallet address
- Wait for the transaction to confirm (~1–5 minutes)
No crypto yet? You can still build and run your agent locally and on Vercel without registration. Register once you are ready to be publicly discoverable.
在ERC-8004上注册需要支付少量Gas费(几美分),你需要持有你选择的网络的原生代币。
| 网络 | 需要的代币 | 获取地址 |
|---|---|---|
| Ethereum mainnet | ETH | Coinbase, Binance, Kraken |
| BNB Smart Chain | BNB | Binance |
| Base | ETH | Coinbase (Base是Coinbase推出的L2网络) |
| Polygon | POL | Coinbase, Binance |
推荐使用网络:Base。 x402支付服务商主要部署在Base网络上,因此你的Agent在该网络上收款最稳定。Base的Gas费也非常低,注册通常只需要几美分。以太坊主网的Gas费用波动很大,新手通常不值得选择。所有网络的Gas价格都可能波动,以上金额仅为大致参考。
钱包充值步骤:
- 在以上任意交易所注册账号(需要身份验证)
- 购买少量对应代币(几美元就足够注册使用)
- 提现到你的钱包地址
- 等待交易确认(约1-5分钟)
还没有加密货币? 你仍然可以在本地和Vercel上构建运行Agent,无需注册。等你准备好公开让用户发现时再注册即可。
Step 6 — Register on ERC-8004
步骤6 — 在ERC-8004上注册
ERC-8004 is an on-chain registry that makes your agent discoverable by other agents, platforms, and users. It is like a DNS entry but for AI agents.
Once your agent is deployed (Step 3) and you have a funded wallet (Steps 4–5), run:
bash
undefinedERC-8004是链上注册系统,能让其他Agent、平台和用户发现你的Agent,相当于AI Agent的DNS域名系统。
当你完成Agent部署(步骤3)并且钱包已经充值(步骤4-5)后,运行以下命令:
bash
undefinedInteractive mode (will prompt you for each setting)
交互模式(会提示你输入每个配置项)
aixyz erc-8004 register
aixyz erc-8004 register
Non-interactive mode (all values as flags)
非交互模式(所有参数通过flag传入)
The CLI will ask for (or accept as flags):
| Prompt | Flag | What to enter |
| ------------------ | --------------- | -------------------------------------------------- |
| Agent URL | `--url` | Your deployed URL from Step 3 |
| Chain | `--chain` | `base` (recommended), `ethereum`, `bsc`, `polygon` |
| Wallet private key | `--private-key` | The key from your wallet (never share this) |
| Trust mechanisms | `--trust` | Accept the default |
| Broadcast | `--broadcast` | Pass this flag to actually submit on-chain |
See all flags:
```bash
aixyz erc-8004 register --helpAfter registration, your agent appears in the ERC-8004 registry and becomes discoverable by the ecosystem.
CLI会要求你输入(或通过flag传入)以下内容:
| 提示项 | 参数名 | 输入内容 |
| ---------------- | --------------- | ----------------------------------------- |
| Agent URL | `--url` | 你在步骤3中获得的部署URL |
| 链 | `--chain` | `base` (推荐), `ethereum`, `bsc`, `polygon` |
| 钱包私钥 | `--private-key` | 你的钱包私钥(永远不要分享) |
| 信任机制 | `--trust` | 接受默认值即可 |
| 广播交易 | `--broadcast` | 传入该参数才会真实提交链上交易 |
查看所有可用参数:
```bash
aixyz erc-8004 register --help注册完成后,你的Agent会出现在ERC-8004注册列表中,可以被整个生态发现。
Step 7 — Set Up Payments
步骤7 — 设置支付功能
Add an export to so callers are charged per request:
acceptsapp/agent.tsts
import type { Accepts } from "aixyz/accepts";
// Gate the /agent endpoint — callers pay $0.005 per request
export const accepts: Accepts = { scheme: "exact", price: "$0.005" };Set the wallet address that receives payments in :
aixyz.config.tsts
export default {
name: "my-agent",
// ...
x402: {
payTo: "0xYourWalletAddress", // ← paste your address from Step 4
},
} satisfies AixyzConfig;Or pass it at scaffold time:
bash
bunx create-aixyz-app my-agent --yes --pay-to 0xYourWalletAddressPayments flow directly to your wallet — no platform takes a cut.
在中添加导出项,这样调用者每次请求都会被收费:
app/agent.tsacceptsts
import type { Accepts } from "aixyz/accepts";
// 对/agent端点进行收费 — 调用者每次请求支付0.005美元
export const accepts: Accepts = { scheme: "exact", price: "$0.005" };在中设置接收付款的钱包地址:
aixyz.config.tsts
export default {
name: "my-agent",
// ...
x402: {
payTo: "0xYourWalletAddress", // ← 粘贴你在步骤4中获得的地址
},
} satisfies AixyzConfig;或者在搭建项目骨架时直接传入:
bash
bunx create-aixyz-app my-agent --yes --pay-to 0xYourWalletAddress付款会直接进入你的钱包,平台不会抽取任何分成。
Step 8 — Go Live Checklist
步骤8 — 上线检查清单
Before announcing your agent, verify:
- works locally and the agent responds correctly
bun run dev - Agent is deployed to a public URL (Vercel or similar)
- LLM provider API key (e.g., ) and any other secrets are set as environment variables on the platform, not committed to your repo
OPENAI_API_KEY - has the correct
aixyz.config.ts,name, anddescriptionaddresspayTo - ERC-8004 registration is complete and the registry shows your agent URL
- export is set so your agent earns from requests
accepts
在发布你的Agent之前,请确认以下内容:
- 在本地可以正常运行,Agent响应正确
bun run dev - Agent已经部署到公开URL(Vercel或类似平台)
- LLM提供商API密钥(比如)和其他密钥都设置为平台的环境变量,没有提交到代码仓库
OPENAI_API_KEY - 中已经填写了正确的
aixyz.config.ts、name和description地址payTo - ERC-8004注册已经完成,注册列表中可以查看到你的Agent URL
- 已经设置了导出项,这样你的Agent可以从请求中获得收益
accepts
Step 9 — Market Your Agent
步骤9 — 推广你的Agent
Registration is only half the work. Getting on-chain doesn't automatically bring users. You need to actively promote your agent.
注册只是一半的工作,上链并不会自动带来用户,你需要主动推广你的Agent。
Make it discoverable
提升可发现性
- Write a clear, specific in
description— this appears in the A2A agent card and on-chain registryaixyz.config.ts - Add an — a good icon makes your agent stand out in listings
app/icon.png - Post your agent URL and ERC-8004 agent ID in the openclaw community
- 在中编写清晰、具体的
aixyz.config.ts— 这段描述会展示在A2A Agent卡片和链上注册列表中description - 添加— 好看的图标能让你的Agent在列表中更突出
app/icon.png - 在openclaw社区分享你的Agent URL和ERC-8004 Agent ID
Reach potential callers
触达潜在用户
- Share your URL — it is the standard entry point for agent-to-agent discovery
/.well-known/agent-card.json - Add your agent to relevant directories and marketplaces (check aixyz.sh for current listings)
- Write a short demo showing what your agent does and how much it costs — post on X/Twitter, Farcaster, or Discord communities
- 分享你的URL — 这是Agent之间互相发现的标准入口
/.well-known/agent-card.json - 将你的Agent添加到相关的目录和市场(可以访问aixyz.sh查看当前的收录列表)
- 制作简短的演示内容,展示你的Agent的功能和收费标准,发布到X/Twitter、Farcaster或Discord社区
Think about pricing
定价策略
- Too expensive → no callers; too cheap → not worth running
- Start with –
$0.001per request and adjust based on demand$0.01 - Monitor your wallet — incoming transactions tell you who is using your agent and how often
- 定价太高 → 没有用户;定价太低 → 收益不足以覆盖运行成本
- 初始定价可以设置为每次请求–
$0.001,再根据需求调整$0.01 - 监控你的钱包 — 到账交易可以告诉你谁在使用你的Agent,使用频率如何
Keep improving
持续优化
- Add more tools to make your agent more useful
- Respond to issues and feedback
- Update your on-chain registration if your URL changes:
aixyz erc-8004 update --help
- 添加更多工具,让你的Agent更有用
- 响应问题和用户反馈
- 如果你的URL发生变化,更新链上注册信息:
aixyz erc-8004 update --help
Troubleshooting
问题排查
"command not found: bun"
"command not found: bun"
Restart your terminal after installing Bun, or run (Linux) / (macOS).
source ~/.bashrcsource ~/.zshrc安装Bun后重启终端,或者运行(Linux)/ (macOS)。
source ~/.bashrcsource ~/.zshrc"API key is not set" / "OPENAI_API_KEY is not set"
"API key is not set" / "OPENAI_API_KEY is not set"
Add your LLM provider's API key to (local dev) or to your platform's environment variable settings (production).
.env.local将你的LLM提供商API密钥添加到(本地开发环境)或者平台的环境变量设置中(生产环境)。
.env.local"Transaction failed" during ERC-8004 registration
ERC-8004注册时提示"Transaction failed"
Your wallet does not have enough gas. Add a few more dollars of the relevant coin and retry.
你的钱包没有足够的Gas费,再充值几美元对应代币后重试即可。
Agent is deployed but not responding
Agent已经部署但没有响应
Check that your platform's build command is and that all environment variables are set. Check the platform's deploy logs for errors.
bun run build检查平台的构建命令是否是,所有环境变量是否都已设置。查看平台的部署日志排查错误。
bun run buildPayment not arriving
付款没有到账
Verify your address in is correct and that you rebuilt and redeployed after changing it.
payToaixyz.config.ts确认中的地址是否正确,修改配置后是否重新构建并部署了Agent。
aixyz.config.tspayToFurther Reading
扩展阅读
- aixyz docs — full documentation
- General aixyz skill — CLI reference for advanced usage
- ERC-8004 protocol — on-chain identity deep dive
- x402 payments — payment protocol details
- Examples — working agents to learn from
- aixyz文档 — 完整官方文档
- 通用aixyz skill — 高级用法CLI参考
- ERC-8004协议 — 链上身份深度解析
- x402支付 — 支付协议详情
- 示例代码 — 可运行的Agent示例供学习参考