> ## 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.

# 鉴权

> 安全使用 Merchant API 密钥、智能体钱包签名和遥测密钥。

## Merchant API 密钥

在 **Business 个人菜单 → 开发者 → API 密钥**中创建 **Merchant API 密钥**。

```bash theme={null}
curl https://merchant-api-prod.anyway.sh/v1/me \
  -H "X-API-Key: ak_YOUR_API_KEY"
```

`GET /v1/me` 返回该密钥的 `orgId`、`apiKeyId` 和权限。Merchant API 密钥是服务端凭据。

## 智能体钱包密钥

智能体钱包密钥是为单个智能体钱包创建的 P-256 签名密钥包：

```bash theme={null}
export ANYWAY_AGENT_WALLET_KEY="<base64url key bundle>"
anyway wallets agents whoami
```

CLI 会为每个智能体钱包 API 请求签名。高级直接客户端发送：

| 请求头                 | 值                    |
| ------------------- | -------------------- |
| `X-Agent-Pubkey`    | Base64 SPKI P-256 公钥 |
| `X-Agent-Timestamp` | 当前 Unix 时间戳          |
| `X-Agent-Signature` | Base64 DER ECDSA 签名  |

签名覆盖以下内容的 SHA-256 摘要：

```text theme={null}
METHOD
/request/path
unix_timestamp
```

除非明确需要自行实现协议，否则优先使用 CLI。

## 遥测密钥

智能体追踪 API 密钥授权 SDK 向收集器上报。请保存在环境变量或密钥管理器中，并从 span 中移除。

<Warning>
  不要在浏览器代码、公开源代码、模型提示词、追踪、截图或支持消息中暴露任何密钥。如果密钥可能泄露，请立即轮换。
</Warning>
