内容
# AgentServices
> 50 端点加密、市场情报和 AI 推理 API,适用于 AI 代理,基于 Base 的 x402 微支付
[](https://github.com/vbkotecha/aiservices-api)
[](https://base.org)
[](https://x402.org)
[](https://modelcontextprotocol.io)
[](https://agentservices.to/health)
**实时地址:** [agentservices.to](https://agentservices.to) | **MCP 服务器:** `https://agentservices.to/mcp` (SSE) | **发现:** `/.well-known/x402`
## 什么是 AgentServices?
AgentServices 是 AI 代理的货币化 API 层。无需 API 密钥,无需订阅 — 代理按需使用 USDC 在 Base 上通过 [x402 支付协议](https://x402.org) 进行支付。
**50 个端点**,涵盖加密货币数据、市场情报、DeFi 分析、链上分析、AI 推理、投资组合情报和纠纷解决等。12 个免费端点,38 个付费端点(通过 x402,价格从 $0.002 到 $0.25 每调用不等)。
## 端点
### 免费(无需支付)
| 端点 | 描述 |
|----------|-------------|
| `GET /v1/prices?symbols=BTC,ETH` | 当前加密货币价格(CoinGecko) |
| `GET /v1/trending` | 市场活动趋势代币 |
| `GET /v1/global` | 全球市场资本、交易量、BTC 占比 |
| `GET /v1/fear-greed` | 加密货币恐惧与贪婪情绪指数 |
| `GET /v1/gas` | Base/Ethereum 当前 Gas 价格 |
| `GET /v1/predictions` | AI 生成的市场预测 |
| `GET /v1/news` | 最新加密货币新闻头条 |
| `GET /v1/social/trending` | 趋势社交话题 |
| `GET /v1/geo?ip=1.2.3.4` | IP 地理位置查询 |
| `GET /v1/swap/quote?from=&to=&amount=` | DEX 兑换报价(0x 集成) |
| `GET /v1/policies` | 纠纷解决政策模板列表 |
| `GET /health` | API 健康检查 |
### 付费 — 数据 API(x402)
| 端点 | 价格 | 描述 |
|----------|-------|-------------|
| `GET /v1/indicators/BTC` | $0.02 | 技术指标(RSI、MACD、布林带、ATR、支撑/阻力) |
| `GET /v1/yields` | $0.02 | 顶级 DeFi 收益池(TVL) |
| `GET /v1/metadata?url=` | $0.01 | URL 元数据提取和展开 |
| `GET /v1/search?q=` | $0.01 | 加密货币/市场信息网络搜索 |
| `GET /v1/onchain/:address` | $0.02 | 任意地址的链上分析 |
| `GET /v1/onchain/:address/tokens` | $0.03 | 任意地址的代币持有量 |
### 付费 — 合成 API(x402)
| 端点 | 价格 | 描述 |
|----------|-------|-------------|
| `GET /v1/token-risk/:symbol` | $0.03 | 任意代币的风险评估(地毯拉盘、流动性、合约审计) |
| `GET /v1/crypto-signals` | $0.04 | 多个指标的聚合买卖信号 |
| `GET /v1/yield-comparison` | $0.03 | 跨协议的收益比较,风险调整后回报 |
| `GET /v1/hn-sentiment` | $0.02 | Hacker News 技术话题的情绪分析 |
| `GET /v1/npm-stats/:package` | $0.02 | NPM 包下载统计和趋势 |
| `GET /v1/github-trending` | $0.02 | 语言/话题的趋势 GitHub 仓库 |
| `GET /v1/marketing-intel` | $0.05 | 市场情报:竞争对手、内容空白、广告文案 |
### 付费 — 捆绑情报(x402)
| 端点 | 价格 | 描述 |
|----------|-------|-------------|
| `GET /v1/research?q=` | $0.05 | 深度研究:搜索 + 提取 + 合成,一次调用 |
| `GET /v1/portfolio?symbol=BTC` | $0.10 | 投资组合情报:价格 + 信号 + 风险 + 情绪 + 判决 |
| `GET /v1/defi-strategy` | $0.25 | DeFi 策略报告:顶级收益 + TVL + 比较 + 风险标记 |
| `GET /v1/market-pulse` | $0.05 | 市场脉搏:恐惧贪婪 + 趋势 + 新闻 + 社交 + 鲸鱼 + 全球 |
| `GET /v1/onchain-overview` | $0.15 | 链上概览:鲸鱼 + 交易所流动 + 稳定币流动 + 相关性 + DeFi TVL |
### 付费 — AI 推理(x402)
| 端点 | 价格 | 描述 |
|----------|-------|-------------|
| `POST /v1/inference` | $0.03 | LLM 推理(gpt-5.4/5.4-mini/5.5)— 聊天完成 |
| `POST /v1/complete` | $0.03 | 文本完成(CodexSale 代理) |
### 付费 — 纠纷解决(x402)
| 端点 | 价格 | 描述 |
|----------|-------|-------------|
| `POST /v1/disputes` | $0.05 | AI 驱动的纠纷解决(7 个政策模板) |
---
## 用例 — 代理可以构建什么
### 投资组合监控
```bash
# 一键获取投资组合情报 ($0.10)
# 返回:价格 + 技术信号 + 风险评分 + 市场情绪 + 判决
curl "https://agentservices.to/v1/portfolio?symbol=BTC"
# 或使用单个端点自行构建:
# 获取当前价格(免费)
curl https://agentservices.to/v1/prices?symbols=BTC,ETH,SOL
# 获取技术信号用于入场/出场 ($0.04)
curl https://agentservices.to/v1/crypto-signals
# 在购买前检查代币风险 ($0.03)
curl https://agentservices.to/v1/token-risk/PEPE
```
### DeFi 收益优化器
```bash
# 一键获取 DeFi 策略报告 ($0.25)
# 返回:顶级收益 + 协议 TVL + 跨链比较 + 风险标记
curl "https://agentservices.to/v1/defi-strategy"
# 获取所有按 TVL 排名的收益池 ($0.02)
curl https://agentservices.to/v1/yields
# 比较收益与风险调整后的回报 ($0.03)
curl https://agentservices.to/v1/yield-comparison
# 检查任意钱包的链上头寸 ($0.02)
curl https://agentservices.to/v1/onchain/0x9863aB6242663FCc84c33632741711dB78f8Fd15
```
### 市场情报代理
```bash
# 一键获取市场脉搏报告 ($0.05)
# 返回:恐惧贪婪 + 趋势 + 新闻 + 社交 + 鲸鱼 + 全球市场
curl "https://agentservices.to/v1/market-pulse"
# 获取市场情绪(免费)
curl https://agentservices.to/v1/fear-greed
# 搜索任意话题的最新新闻 ($0.01)
curl "https://agentservices.to/v1/search?q=base+chain+ecosystem"
# 获取趋势代币(免费)
curl https://agentservices.to/v1/trending
# 获取市场情报报告 ($0.05)
curl "https://agentservices.to/v1/marketing-intel?competitor=blockrun&topic=x402"
```
### 技术分析机器人
```bash
# 完整的技术指标套件 ($0.02)
curl https://agentservices.to/v1/indicators/BTC
# 返回:RSI、MACD、布林带、ATR、支撑/阻力水平
# AI 生成的市场预测(免费)
curl https://agentservices.to/v1/predictions
# 与链上分析结合 ($0.03)
curl https://agentservices.to/v1/onchain/0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045/tokens
```
### 开发人员研究代理
```bash
# GitHub 趋势仓库 ($0.02)
curl "https://agentservices.to/v1/github-trending?language=python&since=weekly"
# NPM 包统计 ($0.02)
curl https://agentservices.to/v1/npm-stats/react
# Hacker News 情绪 ($0.02)
curl "https://agentservices.to/v1/hn-sentiment?q=AI+agents"
```
### AI 聊天/推理
```bash
# 通过 x402 进行聊天完成 ($0.03)
curl -X POST https://agentservices.to/v1/inference \
-H "Content-Type: application/json" \
-d '{"model":"gpt-5.4-mini","messages":[{"role":"user","content":"Explain x402 in 3 sentences"}]}'
```
### 链上分析
```bash
# 一键获取完整的链上概览 ($0.15)
# 返回:鲸鱼动作 + 交易所流动 + 稳定币流动 + 相关性矩阵 + DeFi TVL
curl "https://agentservices.to/v1/onchain-overview"
# 任意钱包的链上分析 ($0.02)
curl https://agentservices.to/v1/onchain/0x9863aB6242663FCc84c33632741711dB78f8Fd15
# 任意钱包的代币持有量 ($0.03)
curl https://agentservices.to/v1/onchain/0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045/tokens
```
---
## 快速入门
### 使用 curl
```bash
# 免费 — 无需支付
curl https://agentservices.to/v1/prices?symbols=BTC,ETH
# 付费 — 返回 HTTP 402,头部包含支付说明
curl -i https://agentservices.to/v1/indicators/BTC
# 响应包含 x402 支付信封:网络、金额、支付地址
# 代理通过 x402 客户端支付,重试并携带 X-Payment 头部,获取数据
```
### 作为 MCP 服务器使用(Claude Desktop、Cursor 等)
```json
{
"mcpServers": {
"agentservices": {
"url": "https://agentservices.to/mcp",
"transport": "sse"
}
}
}
```
13+ MCP 工具可用:`crypto_prices`、`trending_tokens`、`global_market`、`gas_prices`、`market_predictions`、`crypto_news`、`social_trending`、`technical_indicators`、`defi_yields`、`search_web`、`token_risk`、`crypto_signals`、`onchain_analytics`、`deep_research`、`portfolio_intelligence`、`defi_strategy`、`market_pulse`、`onchain_overview`
### 与 Python 结合使用
```python
import httpx
# 免费端点
resp = httpx.get("https://agentservices.to/v1/prices?symbols=BTC,ETH")
prices = resp.json()
# 付费端点 — 使用 x402 客户端处理支付
from x402.client import x402Client
client = x402Client()
result = client.get("https://agentservices.to/v1/indicators/BTC")
# 客户端处理 402 → 支付 USDC → 重试并携带支付证明 → 返回数据
```
### 与 JavaScript/TypeScript 结合使用
```typescript
// 免费端点
const prices = await fetch("https://agentservices.to/v1/prices?symbols=BTC,ETH").then(r => r.json());
// 付费端点 — 使用 @x402/facilitator
import { wrapFetchWithPayment } from "@x402/facilitator";
const paidFetch = wrapFetchWithPayment(fetch);
const indicators = await paidFetch("https://agentservices.to/v1/indicators/BTC").then(r => r.json());
```
## 纠纷解决引擎
AgentServices 包含一个 AI 驱动的纠纷解决系统,带有 7 个政策模板:
| 政策 | 用例 |
|--------|----------|
| `freelance-delivery` | 自由职业者与客户的交付纠纷 |
| `milestone-payment` | 基于里程碑的项目支付纠纷 |
| `sla-monitoring` | 服务水平协议违规 |
| `api-quality` | API 响应质量/正常运行时间纠纷 |
| `bug-bounty` | Bug 赏金有效性纠纷 |
| `scope-dispute` | 项目范围蔓延纠纷 |
| `physical-commerce` | 实物商品交易纠纷 |
## 发现与列表
- [x402 发现](https://agentservices.to/.well-known/x402) — 已上线
- [MCP 注册表](https://registry.modelcontextprotocol.io) — 已列出为 `to.agentservices/agentservices`
- [CDP Bazaar](https://bazaar.coinbase.com) — 已启用扩展
- [awesome-x402](https://github.com/xpaysh/awesome-x402) — 已提交 PR
## 技术栈
- **FastAPI** (Python 3.11+)
- **x402 v2** 支付中间件(Coinbase CDP 促进者)
- **USDC** 在 **Base Mainnet** 上(EIP-3009 无 Gas 转账)
- 在 Railway 上部署,自定义域名 + TLS
## Coinbase AgentKit 集成
AgentServices 包含一个内置的 [Coinbase AgentKit](https://github.com/coinbase/agentkit) 动作提供者(`agentkit/` 目录)。这允许任何 AgentKit 代理使用 AgentServices API,具有类型化、文档化的动作:
```python
from coinbase_agentkit import AgentKit, AgentKitConfig
from agentkit import agentservices_action_provider
agent_kit = AgentKit(AgentKitConfig(
wallet_provider=wallet_provider,
action_providers=[agentservices_action_provider()]
))
```
**18 个动作**,涵盖免费(价格、恐惧贪婪、趋势、Gas)和付费端点(指标、DeFi 收益、投资组合情报、研究、链上分析、AI 推理等)。参见 [`agentkit/README.md`](agentkit/README.md) 获取完整文档。
## 许可证
MIT — 在其基础上构建、fork 或集成。
## 链接
- **API:** [agentservices.to](https://agentservices.to)
- **MCP:** [agentservices.to/mcp](https://agentservices.to/mcp)
- **发现:** [agentservices.to/.well-known/x402](https://agentservices.to/.well-known/x402)
- **GitHub:** [github.com/vbkotecha/aiservices-api](https://github.com/vbkotecha/aiservices-api)
- **x402 协议:** [x402.org](https://x402.org)
- **Base:** [base.org](https://base.org)