> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anyway.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# 超级 API

> 通过统一的 x402 兼容接口发现并调用付费 API。

超级 API 让智能体可以发现服务、获得报价、授权付款并取得 API 响应。

<Card title="浏览超级 API" icon="arrow-up-right-from-square" href="https://app.anyway.sh/marketplace?view=agent">
  在 Agents 视图中打开超级 API，然后复制已经准备好的提示词或端点示例。
</Card>

## 调用前先查找服务

列出当前服务：

```bash theme={null}
curl https://marketplace-prod.anyway.sh/v1/api/directory
```

然后读取所选服务的最新端点信息：

```bash theme={null}
curl https://marketplace-prod.anyway.sh/v1/api/info/{upstream_id}
```

<Warning>
  请把目录条目的 `id` 作为 `upstream_id`，再使用服务信息响应中 `endpoints` 和 `curl_x402` 给出的 HTTP 方法、参数与 x402 URL；不要根据展示名称自行拼接。
</Warning>

## 进行付费调用

配置智能体钱包密钥后：

```bash theme={null}
anyway superapi call "<x402 endpoint URL>"
```

POST 端点示例：

```bash theme={null}
anyway superapi call "<x402 endpoint URL>" \
  --body '{"query":"open source payment APIs"}'
```

该命令会：

1. 发起初次请求；
2. 解码支付要求；
3. 显示报价；
4. 请求确认；
5. 使用所选智能体钱包签名；
6. 带支付签名重试；
7. 输出 API 结果。

使用 `--format json` 获得机器可读输出。只有明确允许运行环境自动批准报价时才使用 `--yes`。

## 支付安全规则

* 符合条件时，先使用组织额度，再使用钱包 USDC。
* 智能体钱包的支出策略在服务端执行。
* 超出策略上限的付款会被拒绝。
* 应定期刷新目录和服务信息响应，不要永久缓存。
