Claude 使用排查

Claude Code 使用检查清单

用一张清单检查 Claude Code 为什么容易撞限、变贵或在大仓库中表现不稳定。

中文说明

先检查 API Key、模型选择、上下文大小、是否频繁重试、是否忘记 /clear,再考虑升级计划。很多成本问题来自上下文和工具调用,而不是单次请求。

第一版中文页保留部分英文 API 字段、模型名和表单标签,方便和官方文档、价格表、开发工具配置项对应。计算结果只做预算和选型参考,最终价格、限额和条款以官方后台或服务商当前公开说明为准。

Before a long session

  1. Run /clear if you are starting a new task.
  2. Use Sonnet for execution unless Opus is clearly needed.
  3. Plan the file scope before letting the agent edit widely.
  4. Check whether ANTHROPIC_API_KEY is set.
  5. Use smaller prompts instead of dumping unrelated context.

When you hit a limit

  1. Read the reset time in the Claude Code message.
  2. Switch to a lighter model if available.
  3. Use /compact if the context window is the problem.
  4. Use /cost if running through API mode.
  5. Upgrade only if limits interrupt normal work repeatedly.

Five common causes

Long conversation

Old context keeps getting carried forward. Clear or compact when the task changes.

Large repo context

Reading many files and producing many diffs increases context pressure.

Opus-heavy use

Use Opus where reasoning matters, then switch down for execution.

Tool-heavy sessions

Search, file context, and repeated tool calls can increase usage.

API key mode

API key billing behaves differently from plan-limited subscription usage.

Weekly caps

Some paid plans have weekly usage limits in addition to session windows.