> For the complete documentation index, see [llms.txt](https://docs.goassay.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.goassay.ai/developers/zh/shi-yong-gong-ju-ru-men/spending-limits.md).

# 支出限额

了解本地支出防护、钱包批准的支付密钥上限及其默认值。

付费调用必须同时符合电脑上的限额和钱包批准的限额。提高一层限额不会提高另一层。以下金额均以美元计价，在 **Robinhood Chain** 上使用 **USDG** 支付。

## 默认值及设置位置

| 限额            | 默认值                                                   | 控制范围                            | 修改位置                                                                   |
| ------------- | ----------------------------------------------------- | ------------------------------- | ---------------------------------------------------------------------- |
| 本地单次调用        | $0.50                                                 | 代理为单次调用签名的最高金额。                 | 交互式终端：`limits set --per-call`。                                         |
| 本地滚动 24 小时    | $5                                                    | 过去 24 小时内记录的待签名金额总和，加上本次调用。     | 交互式终端：`limits set --per-day`。                                          |
| 本地确认阈值        | 关闭                                                    | 超过阈值时，必须在客户端批准这笔确切的付款。等于阈值时不提示。 | 交互式终端：`limits set --confirm-above`。                                    |
| 支付密钥链上单次调用    | $0.50                                                 | 此密钥获准支付的最高单笔金额。                 | 启用付费页面的 **Per call**，通过钱包批准。                                           |
| 支付密钥链上每 24 小时 | $5                                                    | 合约执行的密钥支出窗口上限。                  | 启用付费页面的 **Per 24 hours**，通过钱包批准。                                       |
| 支付密钥链上有效期     | 30 天                                                  | 密钥可授权付款的时长。                     | 启用付费页面的 **Days**，通过钱包批准。                                               |
| 链上账户上限        | 默认批准时，如果尚未设置或过低，会设为每次调用 $0.50、每 24 小时 $5；已有上限足够时保持不变。 | 约束整个账户，也约束密钥的上限。                | 需要时在启用付费页面通过钱包批准；后续通过 **Money → Funding → Change account ceiling** 修改。 |

默认设置下，一个本地预算涵盖此电脑上的所有 Assay 服务器。智能体的限额也跨电脑生效。

本地窗口统计记录的待签名金额，不只统计成功返回结果的调用。这是滚动总额，不会在午夜清零。即使付费调用随后失败，金额仍会计入，直到移出窗口。

链上窗口的机制不同：已用额度计数器会在 24 小时内逐步回落，并非精确统计过去 24 小时的付款总额。兑付付款时，合约会同时检查密钥和账户的计数器。

## 密钥到期前的最高支出

上限为：

```
per-24-hour key cap × (1 + days)
$5 × (1 + 30) = $155
```

默认设置下，密钥到期前最多可支出 **$155**。这个上限包括初始可用额度，以及密钥有效期内恢复的额度。它不是充值额，也不是额外预算；本地限额、智能体限额、账户上限和可用资金都可能降低实际可支出金额。

## 查看本地限额

在终端中运行：

```sh
npx -y @goassay-ai/mcp limits
```

全新的默认设置会显示：每次调用 $0.50、每 24 小时 $5、确认关闭、提供方不受限制。

## 确认是否成功

确认终端显示默认值，批准页面显示预期的密钥上限和有效期。付款必须通过所有适用上限；在钱包中批准更高上限不会改变终端输出。

<details>

<summary>可选：修改本地限额</summary>

请自行在交互式终端运行。此示例将单次调用限额降至 $0.25、滚动累计限额降至 $2，并要求超过 $0.10 时确认：

```sh
npx -y @goassay-ai/mcp limits set --per-call 0.25 --per-day 2 --confirm-above 0.10
npx -y @goassay-ai/mcp limits
```

`--per-call` 和 `--per-day` 均为必填。单次金额不能超过每日金额。省略 `--confirm-above` 会保留现值；传入 `--confirm-above off` 可关闭确认。

如果启用确认，而客户端无法显示确认提示，超过阈值的调用会被拒绝。批准仅适用于显示的那笔确切付款。

本地限额保存在电脑上。该命令要求输入和输出都连接交互式终端。网页、服务器响应、项目配置或 MCP 工具调用都没有受支持的方式修改这些限额；普通 AI 子进程使用管道，因此会被拒绝。这能防止远程指令修改预算，但无法防范已控制你的操作系统用户或终端的程序。

</details>

<details>

<summary>可选：修改链上密钥上限</summary>

密钥创建后，运行：

```sh
npx -y @goassay-ai/mcp enable-paid
```

打开返回的链接，核对支付密钥指纹，然后修改 **Per call**、**Per 24 hours** 和 **Days**（1 至 365），并在钱包中签名。[开启付费调用](https://docs.goassay.ai/use-tools/zh/turn-on-paid-calls)展示了每个界面。等待确认后，再请客户端进行付费调用。

这些签名会修改链上权限，不会修改本地限额。

</details>

## 错误

被拒绝的付款会显示 **Assay asked for a payment this app refused:**，后跟原因。请在下表中查找该原因。

| 消息中的原因                                                           | 代码                         | 解决方法                                  |
| ---------------------------------------------------------------- | -------------------------- | ------------------------------------- |
| the amount is above the local limit per call                     | `G7_PER_CALL`              | 选择更便宜的调用，或自行在终端提高 `--per-call`。       |
| the amount would pass the local limit per 24 hours               | `G7_PER_DAY`               | 等待较早的金额移出滚动窗口，或自行在终端提高 `--per-day`。   |
| the amount is above the confirmation limit and was not confirmed | `G7_CONFIRMATION_REQUIRED` | 在支持确认提示的客户端中批准这笔确切付款。                 |
| the amount is above the payment key's on-chain cap               | `G6_DELEGATE_CAP`          | 使用更便宜的调用，或通过 `enable-paid` 和钱包提高密钥上限。 |
| the amount is above the escrow's on-chain cap                    | `G6_ESCROW_CAP`            | 使用更便宜的调用，或通过钱包提高账户上限。                 |

通过管道运行设置命令会被拒绝，并显示 **changes local safety settings, so it runs only in an interactive terminal**。请自行在终端运行该命令。其他原因请参阅[故障排查](/developers/zh/shi-yong-gong-ju-jin-jie/troubleshooting.md)中的“付款拒绝”部分。

## 延伸阅读

* 使用工具：[设置限额与规则](https://docs.goassay.ai/use-tools/zh/set-limits-and-rules)

## 下一步

* [安全模型](/developers/zh/shi-yong-gong-ju-jin-jie/security-model.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.goassay.ai/developers/zh/shi-yong-gong-ju-ru-men/spending-limits.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
