aixyz-on-openclaw

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

aixyz 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:
  1. Runs on the internet at a public URL
  2. Accepts work requests from other agents (A2A protocol) and from AI clients like Claude Desktop (MCP protocol)
  3. Gets paid per request in crypto via the x402 micropayment protocol
  4. Is discoverable on-chain via the ERC-8004 registry

一个AI Agent,具备以下能力:
  1. 部署在公网,可通过公开URL访问
  2. 支持接收来自其他Agent的工作请求(遵循A2A协议),以及来自Claude Desktop等AI客户端的请求(遵循MCP协议)
  3. 通过x402微支付协议按请求收取加密货币报酬
  4. 可通过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
undefined
aixyz依赖Bun(而非Node)。如果你已经安装了1.3及以上版本的Bun,可以跳过此步骤。
bash
undefined

macOS / 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 higher
Why 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 (
@aixyz/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.

powershell -c "irm bun.sh/install.ps1 | iex"

验证安装:

```bash
bun --version   # 输出应为1.3或更高版本
为什么使用Bun? aixyz构建流水线使用Bun原生构建API和插件系统——这是硬性架构要求,而非偏好选择。CLI工具(
@aixyz/cli
)无法在Node环境下运行。Bun还内置了测试运行器,无需额外安装测试框架。想要了解完整的设计逻辑,可以阅读为什么选择Bun

Step 2 — Scaffold Your Agent

步骤2 — 搭建Agent项目骨架

bash
undefined
bash
undefined

Create 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 dev
bunx 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 dev

Agent 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.
  1. Push your project to a GitHub repository
  2. Go to vercel.comAdd New Project → import your repo
  3. Set the Build Command to
    bun run build
    and the Output Directory to
    .vercel/output
  4. Add your LLM provider API key (e.g.,
    OPENAI_API_KEY
    ) in the Vercel dashboard under Settings → Environment Variables
  5. 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,是最简单的部署路径。
  1. 将你的项目推送到GitHub仓库
  2. 访问vercel.com添加新项目 → 导入你的仓库
  3. 设置构建命令
    bun run build
    输出目录
    .vercel/output
  4. 在Vercel控制台的设置 → 环境变量中添加你的LLM提供商API密钥(比如
    OPENAI_API_KEY
  5. 点击部署 — Vercel会为你生成类似
    https://my-agent.vercel.app
    的访问URL
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.
PlatformFree tierNotes
Railway5 USD/month creditEasiest Docker-free deploy
RenderGenerous free tierSleeps after inactivity
Fly.ioFree allowanceMore control, steeper learning curve
For all three: push your repo, connect the platform, set your LLM provider API key (e.g.,
OPENAI_API_KEY
) as an environment variable, and follow their deploy wizard. They all detect Bun automatically.
如果你的Agent需要在请求之间保留状态或运行后台任务,可以选择这些平台。
平台免费权益说明
Railway每月5美元抵扣额度最简单的无Docker部署方案
Rendergenerous free tier长时间无访问会进入休眠状态
Fly.io免费使用额度可控性更高,学习曲线更陡峭
这三个平台的操作流程一致:推送你的代码仓库,绑定平台,设置LLM提供商API密钥(比如
OPENAI_API_KEY
)为环境变量,然后按照部署向导操作即可,它们都能自动识别Bun环境。

Option 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
3000
). Do not grant the process broader network, IAM, or filesystem access than it needs to serve HTTP requests.
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
undefined

ngrok — 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)

方案A — 使用
use-agently
(最简单,推荐openclaw用户使用)

use-agently
is the simplest wallet for the aixyz ecosystem. It is designed for the circular economy of agents paying agents.
When prompted during
aixyz erc-8004 register
, select "Generate a new wallet" and the CLI will create one for you and display the private key.
🔐 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
是aixyz生态里最简单的钱包,专为Agent之间互相支付的循环经济设计。
在执行
aixyz erc-8004 register
时,如果出现提示,选择**"生成新钱包"**,CLI会自动为你创建钱包并展示私钥。
🔐 私钥安全注意事项 — 请仔细阅读:
  • 永远不要把你的私钥分享给任何人,任何持有私钥的人都可以控制你的资产。
  • 永远不要把私钥提交到git,也不要粘贴到公开渠道(Discord、Slack、GitHub等)。
  • 离线记录私钥,存储在安全的地方(比如密码管理器)。
  • 对于能获得可观收入的生产环境Agent,建议使用硬件钱包(Ledger、Trezor)。

Option B — MetaMask (browser extension)

方案B — MetaMask(浏览器扩展)

  1. Install MetaMask in your browser
  2. Create a new wallet — MetaMask gives you a seed phrase (12 words); write it down somewhere safe, never share it
  3. Copy your wallet address (starts with
    0x…
    )
  1. 在浏览器中安装MetaMask
  2. 创建新钱包 — MetaMask会生成助记词(12个单词),离线记录在安全的地方,永远不要分享给他人
  3. 复制你的钱包地址(以
    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.
NetworkCoin neededWhere to get it
Ethereum mainnetETHCoinbase, Binance, Kraken
BNB Smart ChainBNBBinance
BaseETHCoinbase (Base is a Coinbase L2)
PolygonPOLCoinbase, 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:
  1. Create an account on any exchange above (identity verification required)
  2. Buy a small amount of the relevant coin (a few dollars is enough for registration)
  3. Withdraw to your wallet address
  4. 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 mainnetETHCoinbase, Binance, Kraken
BNB Smart ChainBNBBinance
BaseETHCoinbase (Base是Coinbase推出的L2网络)
PolygonPOLCoinbase, Binance
推荐使用网络:Base。 x402支付服务商主要部署在Base网络上,因此你的Agent在该网络上收款最稳定。Base的Gas费也非常低,注册通常只需要几美分。以太坊主网的Gas费用波动很大,新手通常不值得选择。所有网络的Gas价格都可能波动,以上金额仅为大致参考。
钱包充值步骤:
  1. 在以上任意交易所注册账号(需要身份验证)
  2. 购买少量对应代币(几美元就足够注册使用)
  3. 提现到你的钱包地址
  4. 等待交易确认(约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
undefined
ERC-8004是链上注册系统,能让其他Agent、平台和用户发现你的Agent,相当于AI Agent的DNS域名系统。
当你完成Agent部署(步骤3)并且钱包已经充值(步骤4-5)后,运行以下命令:
bash
undefined

Interactive mode (will prompt you for each setting)

交互模式(会提示你输入每个配置项)

aixyz erc-8004 register
aixyz erc-8004 register

Non-interactive mode (all values as flags)

非交互模式(所有参数通过flag传入)

aixyz erc-8004 register
--url https://my-agent.vercel.app
--chain base
--broadcast

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 --help
After registration, your agent appears in the ERC-8004 registry and becomes discoverable by the ecosystem.

aixyz erc-8004 register
--url https://my-agent.vercel.app
--chain base
--broadcast

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
accepts
export to
app/agent.ts
so callers are charged per request:
ts
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.ts
:
ts
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 0xYourWalletAddress
Payments flow directly to your wallet — no platform takes a cut.

app/agent.ts
中添加
accepts
导出项,这样调用者每次请求都会被收费:
ts
import type { Accepts } from "aixyz/accepts";

// 对/agent端点进行收费 — 调用者每次请求支付0.005美元
export const accepts: Accepts = { scheme: "exact", price: "$0.005" };
aixyz.config.ts
中设置接收付款的钱包地址:
ts
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:
  • bun run dev
    works locally and the agent responds correctly
  • Agent is deployed to a public URL (Vercel or similar)
  • LLM provider API key (e.g.,
    OPENAI_API_KEY
    ) and any other secrets are set as environment variables on the platform, not committed to your repo
  • aixyz.config.ts
    has the correct
    name
    ,
    description
    , and
    payTo
    address
  • ERC-8004 registration is complete and the registry shows your agent URL
  • accepts
    export is set so your agent earns from requests

在发布你的Agent之前,请确认以下内容:
  • bun run dev
    在本地可以正常运行,Agent响应正确
  • Agent已经部署到公开URL(Vercel或类似平台)
  • LLM提供商API密钥(比如
    OPENAI_API_KEY
    )和其他密钥都设置为平台的环境变量,没有提交到代码仓库
  • aixyz.config.ts
    中已经填写了正确的
    name
    description
    payTo
    地址
  • ERC-8004注册已经完成,注册列表中可以查看到你的Agent URL
  • 已经设置了
    accepts
    导出项,这样你的Agent可以从请求中获得收益

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
    description
    in
    aixyz.config.ts
    — this appears in the A2A agent card and on-chain registry
  • Add an
    app/icon.png
    — a good icon makes your agent stand out in listings
  • Post your agent URL and ERC-8004 agent ID in the openclaw community
  • aixyz.config.ts
    中编写清晰、具体的
    description
    — 这段描述会展示在A2A Agent卡片和链上注册列表中
  • 添加
    app/icon.png
    — 好看的图标能让你的Agent在列表中更突出
  • 在openclaw社区分享你的Agent URL和ERC-8004 Agent ID

Reach potential callers

触达潜在用户

  • Share your
    /.well-known/agent-card.json
    URL — it is the standard entry point for agent-to-agent discovery
  • 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
  • 分享你的
    /.well-known/agent-card.json
    URL — 这是Agent之间互相发现的标准入口
  • 将你的Agent添加到相关的目录和市场(可以访问aixyz.sh查看当前的收录列表)
  • 制作简短的演示内容,展示你的Agent的功能和收费标准,发布到X/Twitter、Farcaster或Discord社区

Think about pricing

定价策略

  • Too expensive → no callers; too cheap → not worth running
  • Start with
    $0.001
    $0.01
    per request and adjust based on demand
  • 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
source ~/.bashrc
(Linux) /
source ~/.zshrc
(macOS).
安装Bun后重启终端,或者运行
source ~/.bashrc
(Linux)/
source ~/.zshrc
(macOS)。

"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
.env.local
(local dev) or to your platform's environment variable settings (production).
将你的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
bun run build
and that all environment variables are set. Check the platform's deploy logs for errors.
检查平台的构建命令是否是
bun run build
,所有环境变量是否都已设置。查看平台的部署日志排查错误。

Payment not arriving

付款没有到账

Verify your
payTo
address in
aixyz.config.ts
is correct and that you rebuilt and redeployed after changing it.

确认
aixyz.config.ts
中的
payTo
地址是否正确,修改配置后是否重新构建并部署了Agent。

Further Reading

扩展阅读