内容
# 代理人现金
**AI 代理人的非托管 HTTP-402 支付。**
代理人通过单个 HTTP 402 挑战出售定价资源 — 买家直接向卖家的钱包(链上,任意币种)或通过卡(卖家自己的 Stripe)支付。平台从不持有资金。多币种:BTC(+闪电网络)、ETH + 所有 ERC-20 代币、USDT、USDC、Solana、Tron、XRP、Monero、UCASH、自定义代币。
**在线访问:** [agents.u.cash](https://agents.u.cash) · [OpenAPI 规范](https://agents.u.cash/openapi.json) · [llms.txt](https://agents.u.cash/llms.txt) · [MCP 页面](https://agents.u.cash/mcp)
## 本仓库包含的内容
| 路径 | 内容 |
|---|---|
| `sdk/javascript/` | 零依赖的 JS/Node SDK([npm: agents-u-cash](https://npmjs.com/package/agents-u-cash)) |
| `sdk/python/` | 零依赖的 Python SDK([PyPI: agents-u-cash](https://pypi.org/project/agents-u-cash/)) |
| `mcp/` | 标准输入/输出 MCP 服务器(Claude Desktop / 任意 MCP 客户端)+ 说明文档 |
| `api/openapi.json` | OpenAPI 3.1 规范(也可在 agents.u.cash/openapi.json 处访问) |
## 快速入门(60 秒)
```bash
# 1. 注册(先创建钱包,无需电子邮件循环)
curl -X POST https://agents.u.cash/v1/signup \
-H 'Content-Type: application/json' \
-d '{"email":"me@agent.dev","password":"longpass"}'
# -> {"response":{"api_key":"…","activated":false}}
# 2. 充值 ≥ $1 以激活(支付 + 在确认后激活)
curl -X POST https://agents.u.cash/v1/top-up \
-H 'X-Api-Key: $KEY' -d '{"amount":1}'
# 3. 设置接收地址(买家向该地址支付)
curl -X POST https://agents.u.cash/v1/wallets \
-H 'X-Api-Key: $KEY' -d '{"asset":"btc","address":"bc1q…"}'
# 4. 创建定价资源
curl -X POST https://agents.u.cash/v1/resources \
-H 'X-Api-Key: $KEY' -d '{"amount":0.05}'
# -> {"response":{"res_id":"res_…"}}
# 分享:https://agents.u.cash/r/{res_id}
```
## 软件开发工具包
### JavaScript
```bash
npm install agents-u-cash
```
```javascript
import { AgentsUCash } from 'agents-u-cash';
const agent = new AgentsUCash({ apiKey: 'your_key' });
await agent.setWallet('btc', 'bc1q…');
const res = await agent.createResource({ amount: 0.05 });
```
### Python
```bash
pip install agents-u-cash
```
```python
from agents_u_cash import AgentsUCash
agent = AgentsUCash(api_key='your_key')
agent.set_wallet('btc', 'bc1q…')
res = agent.create_resource(amount=0.05)
```
## MCP 服务器(Claude Desktop)
参见 [`mcp/README.md`](mcp/README.md) 以了解设置方法。工具:`uxc_get_agent`、`uxc_set_wallet`、`uxc_create_resource`、`uxc_list_resources`、`uxc_create_challenge`、`uxc_get_settlements`、`uxc_view_door`、`uxc_verify_payment`。
## UCP(通用商业协议)
agents.u.cash 实现了 UCP 发现层:
- `/.well-known/ucp` — 业务配置文件(功能、支付处理器、EC P-256 签名密钥)。
- `/catalog.json` — schema.org/Product JSON-LD 目录(商家的商店产品)。
- `/catalog/search` | `/catalog/lookup` | `/catalog/product` — 结构化目录 REST。
- `/checkout-sessions` — UCP 结账会话(创建 → 完成 → 支付处理器)。
- `/orders/{id}` — 订单状态。
UCP 是一个开放标准([ucp.dev](https://ucp.dev),Apache 许可;由 Google/Shopify/Amazon/Walmart/Microsoft/Meta/Stripe/Visa/Mastercard 共同开发)。
## 协议
[402.onl](https://402.onl) — 402 在线协议。
## 许可证
MIT