// How-to · Control AI costs and usage limits
How much have Claude Code / Codex used and cost?
Usage windows and limits on subscription tools are opaque, and API calls are scattered. Local log analysers and a unified gateway are the two main approaches.
verified 2026-10-102 official sources
Scenario: Control AI costs and usage limits →
Symptoms
- You do not know how close you are to a limit and get throttled at bad moments
- The monthly bill is higher than expected
Common causes
- Subscription usage is only shown roughly in the official UI
- Calls are spread across projects and keys with no aggregation
How to fix
- Subscription users: analyse local logs with ccusage, e.g.
npx ccusage@latest(supported tools and commands per the project README) - API users: route calls through a gateway such as LiteLLM or OpenRouter to see spend per key and project in one place
- Record tokens and cost per request with an observability tool such as Helicone
- Set usage alerts or hard caps in the provider’s console
- Limit rules change often; follow the latest official terms and note the date you checked
Official references
Compiled from official documentation and public discussions on 2026-10-10; not yet reproduced in our own environment. Follow the official docs if they differ.