Claude Code 额度用完怎么办?Max 20x 的 5 小时窗口和周额度怎么算,不够用就换 API Key

Claude Code 额度用完先分清是 Claude 5 小时限制还是周额度。Claude Max 20x 周额度并非 Pro 的 20 倍;本文给出 /usage、/status 实测、省额度办法,以及 Claude Code usage limit 用完后换 API Key 的配置。

7 分钟阅读
Claude Code 额度用完怎么办?Max 20x 的 5 小时窗口和周额度怎么算,不够用就换 API Key

Claude Code 额度用完怎么办?先分清是哪道闸:Pro 和 Max 都有「5 小时窗口」和「周额度」两套限制,Claude 网页、桌面端和 Claude Code 共用同一份额度。Max 20x 的「20 倍」官方写的是每个 5 小时窗口是 Pro 的 20 倍,不是一周总量的 20 倍。5 小时窗口用完等重置就行;周额度用完、又不想停工,就把 Claude Code 换到 API Key 上,按量计费,不受订阅的 5 小时和周额度限制。

结论

情况怎么办
5 小时窗口用完等窗口重置,或者先用 /compact、新开会话、换 Sonnet 5.5 省着用
周额度用完等每周固定的重置时间,或者把 Claude Code 切到 API Key 继续干活
想知道还剩多少订阅账号看 /usage 和官网 Settings > Usage;走 API Key 时 /usage 只显示本次会话的用量
Anthropic 帮助中心原文:「Paid plans have two types of usage limits: a session limit that resets every five hours, and weekly limits that reset once every week.」出处:How do usage and length limits work?
「20x」指的是 5 小时窗口。原文:「Max 20x includes 20 times the Pro plan's per-session usage allowance.」「Max plans also have a weekly usage limit that applies across all models.」出处:What is the Max plan?
Claude 和 Claude Code 共用额度。原文:「Both Pro and Max plans have a five-hour session limit and a weekly limit. Max plans also have a separate weekly limit for Fable. These limits are shared across Claude and Claude Code, meaning all activity in both tools counts against the same limits.」出处:Use Claude Code with your Pro or Max plan

Max 20x 的周额度到底是 Pro 的几倍

官方只写了 5 小时窗口是 20 倍,没有公布周额度的倍数。用户实测的结果明显低于 20:

  • 据用户反馈,Max 20x 的周额度「测下来大概只有 Pro 的 9.7 倍」,原话是「5 小时窗口和周限额是两套闸」(@JkwuRmsl)。
  • 据用户反馈,「The "20x" doesn't mean you get 20 times more Claude for the whole week. It only means each 5 hour session is 20 times bigger than Pro's.」,并称 20x 的周额度大约只是 Max 5x 的两倍(@buildwithhassan)。

所以升级到 Max 20x 前要想清楚:你平时撞的是 5 小时窗口,还是周额度。只撞 5 小时窗口的话 20x 很有用;经常撞周额度的话,多出来的空间没有名字上看起来那么多。

怎么看剩余额度

方法能看到什么
/usage本次会话用量;订阅账号还会显示套餐额度的使用情况
/status版本、模型、账号和连接信息
官网 Settings > Usage下次重置的时间
Claude Code 官方文档原文:/usage「Show session cost, plan usage limits, and activity stats. On a Pro, Max, Team, or Enterprise plan, includes a breakdown of what counts against your plan limits」;/status「Open the Settings interface on the Status tab, showing version, model, account, and connectivity」。/cost 和 /stats 都是 /usage 的别名。出处:Claude Code Docs:Commands。
帮助中心原文:「The weekly limit resets at a fixed time each week that is assigned to your account. Your reset day and time stay the same regardless of when you start using Claude or when your subscription begins … You can see your next reset time in Settings > Usage.」

实测:走 API Key 时 /status 和 /usage 显示什么

我们在 Claude Code 2.1.308、一个干净的独立 HOME 里,用全局 settings.json 接 AI Code With 的 API Key,跑了一遍这两个命令。

启动时,标题栏里模型后面直接写的是按 API 计费:

text
Claude Code v2.1.308
Opus 5.5 · API Usage Billing

交互模式下输入 /status,3 秒内打开 Status 页(截取):

text
Version:                    2.1.308
Auth token:                 ANTHROPIC_AUTH_TOKEN
Anthropic base URL:         https://api.aicodewith.ai
Model:                      Default (claude-opus-5-5)
Setting sources:            User settings

先问了一句话再输入 /usage,3 秒内打开 Usage 页(截取,金额行已略去):

text
Session
Total duration (API):  5s
Total duration (wall): 29s
Total code changes:    0 lines added, 0 lines removed
Usage by model:
     claude-opus-5-5:  8 input, 138 output, 10.4k cache read, 2.6k cache write

结论:走 API Key 时,/usage 里只有本次会话的统计,没有出现订阅的 5 小时窗口和周额度进度条,/status 里显示的是 ANTHROPIC_AUTH_TOKEN 和自定义地址,没有订阅账号信息。

用非交互模式 claude -p 跑这两个命令,结果不一样:

text
/status isn't available in this environment.

claude -p "/usage" 0.4 秒返回,只有会话统计(当时还没发过请求,全是 0):

text
Total duration (API):  0s
Total duration (wall): 0s
Total code changes:    0 lines added, 0 lines removed
Usage:                 0 input, 0 output, 0 cache read, 0 cache write

想在脚本里看额度,用 /usage;/status 只能在交互模式里看。

最近为什么掉得快

1. 据 SemiAnalysis 报道,部分 Max 账号在做 A/B 测试。 SemiAnalysis 10 月 22 日在 X 上发帖称:「We detected an A/B test going on that DECREASES your monthly API-value by ~20% while INCREASING your 5h usage limits by ~20%. This only affects SOME」(SemiAnalysis 原帖)。据报道,他们对比了两个 Max 20x 账号,其中一个的 5 小时窗口大了约 19%,周额度少了约 20%(Tech City Authority)。

Anthropic 没有确认这个测试。据报道,SemiAnalysis 发帖之前,Anthropic 的 Boris Cherny 回复用户「No changes on our end」,Claude Code 团队的 Lydia Hallie 也说「our limits haven't changed」(Tech City Authority)。两条回复都早于 SemiAnalysis 的帖子。

这对谁影响大:5 小时窗口一天能重置好几次,重度用户先撞到的是周额度,周额度少 20% 就是实打实少了;只是偶尔撞 5 小时窗口的人,反而会觉得宽松了。

2. 恢复很久没动的长对话很贵。 据用户反馈,Claude Code 客户端在恢复一个长对话前提示过(@pumpccc,Opus 5.5):

text
This conversation has been inactive for 3h 4m and is 358.4k tokens long. Resuming it will use about 7% of your 5-hour usage limit.

也就是说,光是把一段 35 万 token 的旧对话接着聊,就要先吃掉 5 小时窗口的 7% 左右。

3. 额度是网页和 Claude Code 共用的。 白天在网页上聊得多,晚上 Claude Code 能用的就少。

怎么省额度

  1. 长对话先 /compact。 官方说明是把对话总结一下腾出空间;对话已经很长时,先压缩再继续。空闲自动压缩的开关见《Claude Code Idle Compaction 是什么》。
  2. 很久没动的长会话直接新开。 不要直接恢复几十万 token 的旧对话,用 /clear 开新会话,把要点写成交接文件再接着干,做法见《Claude Code 跑一半怎么交给 Codex?用 handoff.md 交接上下文》。
  3. 日常任务换 Sonnet 5.5。 用 /model claude-sonnet-5-5 切换,难题再切回 Opus 5.5。怎么选见《Claude Code 用哪个模型》和《Claude Sonnet 5.5 vs Opus 5.5》。
  4. 少开并行子 Agent。 每个子 Agent 都是单独的上下文,同时开很多个,额度消耗也会叠加。
  5. 注意 Fast Mode。 开法和限制见《Claude Opus 5.5 Fast Mode 怎么用》。
帮助中心原文:「Your usage is affected by several factors, including the length and complexity of your conversations, the features you use, which Claude model you're chatting with, and the effort level you've selected.」

额度不够:换 API Key

订阅额度用完后,官方给的选择是等重置、开通 usage credits,或者换 Console 账号走 API。也可以把 Claude Code 接到 AI Code With 的 API Key 上:按量计费,不受订阅的 5 小时窗口和周额度限制。

帮助中心原文:「Switch to a Claude Console account and purchase API usage credits for intensive coding sprints.」「Wait until your usage limits reset.」出处:Use Claude Code with your Pro or Max plan

第 1 步:创建 API Key

创建 API Key →

查看价格 →

第 2 步:写全局 settings.json

打开 ~/.claude/settings.json,在 env 里填上(ANTHROPIC_BASE_URL 不带 /v1):

json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.aicodewith.ai",
    "ANTHROPIC_AUTH_TOKEN": "sk-你的Key"
  }
}

重开 Claude Code,标题栏显示「API Usage Billing」、/status 里 Auth token 一行是 ANTHROPIC_AUTH_TOKEN,就说明已经走 Key 了。各字段说明和常见问题见《Claude Code 如何接入第三方 API?Base URL、API Key 与模型配置教程》。

想切回订阅:把 settings.json 里这两行删掉,在终端运行 claude login,用 Pro 或 Max 账号登录。

常见问题

周额度什么时候重置?

每周固定时间,这个时间是分配给你账号的,和你什么时候开始用、什么时候订阅都无关。在官网 Settings > Usage 能看到下次重置时间。

Claude 5 小时限制是从什么时候开始算的?

官方写的是 5 小时窗口「resets every five hours」。窗口用完后等它重置即可,期间 Claude 网页和 Claude Code 都会受限,因为两者共用额度。

订阅和 API Key 能同时用吗?

同一时间,Claude Code 只会用一种方式。settings.json 里配了 ANTHROPIC_AUTH_TOKEN 和地址,就走 Key;删掉后运行 claude login 登录订阅账号,就走订阅。你可以白天用订阅,订阅用完再切到 Key。

同一个 Key 能在 Codex 里用吗?

能。在 ~/.codex/config.toml 里配好地址和 Key 就行,见《Codex config.toml 配置指南》。Codex 自己的额度规则见《Codex 怎么收费、额度为什么掉得快》。

资料来源