Token 知识库

额度什么时候重置、怎么省 token?按目录查阅各个主题,Codex 和 Claude 分开说明,附官方原文和链接。

skill 和插件每轮占多少 token?

每轮带上的只是每个 skill 的名字和描述,不是全文;实测一个带 6 个 skill 的插件每轮约 221 token。全文在用到那个 skill 时才读进来。Claude Code 的 /usage 会按插件列出每轮占用,Codex 机制相同,但没有按 skill 拆分的数字。

Codex

机制相同:开头只带每个 skill 的名字、描述和文件路径,全文选中才读;Codex 不按 skill 显示 token 占用。

Codex 的初始 skill 清单最多占上下文窗口的 2%(窗口大小未知时为 8,000 个字符)。装得多时先缩短描述,再多就直接不列一部分 skill,并给出警告。选中某个 skill 后,Codex 照样读它的 SKILL.md 全文。Codex CLI 的 /usage 只按天、周、累计显示 token,不拆到 skill;想少带,就在 ~/.codex/config.toml 里把不用的 skill 关掉。

官方原文

Skills use progressive disclosure to manage context efficiently. ChatGPT and Codex start with each skill's name and description, then load the full SKILL.md instructions when they decide to use that skill. In Codex, the initial list also includes each skill's file path.
OpenAI docs · Build skills
To avoid crowding out the rest of the prompt, this list uses at most 2% of the model's context window, or 8,000 characters when the context window is unknown. If many skills are installed, Codex shortens skill descriptions first. For large skill sets, Codex may omit some skills from the initial list and show a warning.
OpenAI docs · Build skills
/usage — View account token usage or use a rate-limit reset. Inspect daily, weekly, or cumulative ChatGPT token activity from inside the TUI.
OpenAI docs · Developer commands

Claude

每轮只带每个 skill 的名字和描述;/usage 里能看到每个插件每轮加了多少 token。

Claude Code 把所有 skill 的名字和描述列成一张清单放进系统提示,每条消息都带着它,用不用都算;第一轮之后按缓存价重读。这张清单有上限:上下文窗口的 1%,单个 skill 的描述最多 1,536 个字符,超了就从最少用的 skill 开始砍描述。SKILL.md 全文只在 skill 被调用时读进来,读进来之后留在对话里,后面每一轮跟着一起重读。

官方原文

In a regular session, skill descriptions are loaded into context so Claude knows what's available, but full skill content only loads when invoked.
Claude Code docs · Extend Claude with skills
Every skill in the skill listing adds to your context on every turn, whether or not Claude ever uses it. Run /skill-doctor to see what each of your skills costs and how often it gets used, so you can decide which ones to turn off.
Claude Code docs · Extend Claude with skills
The budget scales at 1% of the model's context window. When the listing overflows, Claude Code drops descriptions starting with the skills you invoke least, so the skills you use most keep their full text.
Claude Code docs · Extend Claude with skills
Skills load on-demand only when invoked, so moving specialized instructions into skills keeps your base context smaller.
Claude Code docs · Manage costs effectively

在 /usage 里看每个插件的占用

在 Claude Code 里运行 /usage,找到 Plugin skill-listing footprint 一栏。它按插件列出「几个 skill、每轮约多少 token」,例如:diagram-design 6 skills · ~221 tok/turn。这个数字是一个插件的实测例子,不是平均值。

这一栏在 /usage 面板上的说明是:每个插件的 skill 描述给系统提示加了多少(第一轮之后按缓存输入计),agent 和 MCP 工具暂未计入。英文原句:What each plugin's skill descriptions add to the system prompt (cached input after the first turn). Agents and MCP tools not yet counted. 这句话来自 /usage 面板,不是官方文档。插件里自带的 agent 和 MCP 工具要在这个数字之外另算。

怎么关掉不用的 skill

关掉之后,这个 skill 的描述就不再每轮带上。怎么关,看它是从哪来的。

  1. Claude Code,插件自带的 skill:运行 /plugin disable 插件名@市场名,或在 /plugin 的 Installed 页里操作。插件自带的 skill 只能这样关。

  2. Claude Code,自己装的 skill:打开 /skills,选中后按空格切换状态、按 Esc 保存。name-only 只留名字,off 完全隐藏。

  3. Claude Code,只想手动触发的 skill:在 SKILL.md 头部加 disable-model-invocation: true,它的描述就不再每轮带上。

  4. Codex:在 ~/.codex/config.toml 里加一段 [[skills.config]],写上 path = "/path/to/skill/SKILL.md" 和 enabled = false,改完重启 Codex。

官方原文

Plugin skills are not affected by skillOverrides. Manage those through /plugin instead.
Claude Code docs · Extend Claude with skills
Use [[skills.config]] entries in ~/.codex/config.toml to disable a skill without deleting it
OpenAI docs · Build skills

常见误解

  • 装了 50 个 skill,每轮就要多读 50 份全文

    不会。每轮带的只是名字和描述,实测 6 个 skill 合计约 221 token;全文只有那个 skill 被用到时才读进来。

  • skill 的描述写得越详细越好

    不是。描述是每轮都带的那部分,而且会被截断:Claude Code 每条最多 1,536 个字符、整张清单最多占上下文的 1%,Codex 整张清单最多 2%。把最关键的用途和触发词放在最前面,写短。

  • skill 用完就不占 token 了

    不是。skill 全文读进来后就留在对话里,之后每一轮都跟着重读;Claude Code 压缩会话后,每个调用过的 skill 还会保留前 5,000 token(合计最多 25,000)。换任务就开新会话。

建议

  • Claude Code:运行 /usage,看 Plugin skill-listing footprint 一栏,先找每轮 token 最多的插件。
  • Claude Code:运行 /skill-doctor(需要 v2.1.252 及以上),它会标出从没被调用过的 skill 和最近没用过的插件;/context 的 Skills 一行是整张清单当前的大小。
  • 调用过 skill 之后要换任务,就 /clear(Codex 用 /new):读进来的 skill 全文会一直留在这段会话里。

Codex 重置公告与记录 · Claude 重置公告与记录