Claude 计费风险

Claude Code API vs 订阅

理解 Claude Code 订阅和 API Key 的差别,避免长任务意外产生 API token 账单。

中文说明

这页适合排查为什么 Claude Code 明明有订阅却还在产生 API 账单,以及如何区分登录模式、环境变量和 Console Usage。

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

Subscription login

Use this path when you want Claude Code to draw from a Pro, Max, Team, or Enterprise subscription. Limits are shared with Claude activity on the same plan.

  • Good for predictable individual usage.
  • Expect reset messages when limits are reached.
  • Monitor plan usage in Claude settings where available.

API key billing

Use this path when you intentionally want pay-as-you-go billing through Console or another supported provider. There may be no subscription-style hard stop.

  • Use /cost during sessions.
  • Set spend limits in the API Console.
  • Clear long sessions to avoid unnecessary token spend.

Quick check

If ANTHROPIC_API_KEY is set on your machine, official Claude docs warn that Claude Code may use that API key for authentication instead of your subscription, causing API usage charges.

Setup checklist

1. Check auth mode

Confirm whether you signed in through Claude or are relying on an API key.

2. Check environment

Look for ANTHROPIC_API_KEY in shell profiles, project env files, CI, and terminal sessions.

3. Check spend

When using API mode, use /cost and Console spend limits before long agentic tasks.