---
title: "Claude Code Running Out of Quota? Check Usage Before You Upgrade"
description: "Hitting Claude Code usage limits? Find where quota goes with /cost, then choose: trim context, upgrade your official plan, or switch the endpoint to a metered gateway."
url: https://cdnping.org/en/blog/claude-code-quota-not-enough
language: en
published: 2026-11-06
category: "Developer tools"
tags: ["Claude Code","usage limits","quota","billing","AI coding"]
source: cdnping.org
license: Free to quote and summarize with a link to the url above.
---
# Claude Code Running Out of Quota? Check Usage Before You Upgrade

When Claude Code quota runs out, the quota is usually not too small. More often, your context and the way you split up tasks make every turn re-spend the same tokens. Spend ten minutes finding out where the quota goes, then pick one of three paths: optimize how you use it, upgrade your official plan, or switch to a pay-as-you-go or monthly gateway. If you do it in the opposite order, you will often upgrade and hit the limit again soon after.

This article reflects the situation as of October 2026. Plan quotas, reset windows, and command output change over time. For anything involving numbers, rely on Anthropic's official documentation and what your own account shows.

## First, work out which kind of "out of quota" you have

"Used up" in Claude Code covers at least three situations, and each is handled differently:

| Symptom | Common cause | Where to look first |
| --- | --- | --- |
| Subscription login shows a usage limit message and you must wait for a reset | The window quota for your plan is used up | The usage limit explanation in the official help center |
| With an API key, the balance drains quickly | Token-based billing; context too long or too many loops | Usage page in the Console, `/cost` in a session |
| Requests return 429 or 5xx | Rate limiting or a server-side problem, not necessarily quota | [/en/down/claude-code](/en/down/claude-code), [/en/status/anthropic](/en/status/anthropic) |

The third case is often mistaken for a quota problem. If it is only rate limiting or an outage, upgrading your plan will not help at all. Check the status page before you do anything else.

If you have not yet sorted out the difference between subscription login and API key billing, read [Claude Code: subscription login or API key, and how the two billing methods compare](/en/blog/claude-code-subscription-or-api-key) first. For how subscription windows are calculated, see [How Claude usage limits work: reset windows and ways to save quota](/en/blog/claude-usage-limit-reset-window).

## Check usage first: find where the quota goes

Inside a session you can use these commands. Output format, and whether they apply to your login method, depends on the official documentation:

1. `/cost`: shows token and cost statistics for the current session. The display may differ between subscription login and API key.
2. `/context`: shows what is filling the context window, such as the system prompt, tool definitions, conversation history, and files that were read in.
3. `/compact`: compresses the current conversation history and keeps the key points.
4. `/clear`: clears the conversation and starts a clean session.

The method is simple. For a given kind of task, note the `/cost` figure before, run the task, then check again. The difference is what that task consumed. After a few tasks you will know which operations are the most expensive. To turn that into a monthly cost, work it out yourself using the method in [How to estimate Claude Code token consumption: calculate monthly cost from your own usage](/en/blog/ai-coding-agent-token-cost-estimate).

## Path 1: optimize first. How much can you save?

Common sources of waste, in rough order of how often they show up:

- One session running from morning to night. The longer the history, the more each turn has to carry. Use `/clear` when you switch tasks and `/compact` when a single task gets long.
- Asking it to "look at the whole project." Point it at a directory or file instead of letting it scan the entire repo.
- Large files, logs, and build artifacts getting read into context. Put directories you don't need in your ignore rules; see the official documentation for the exact syntax.
- A long project notes file (CLAUDE.md), which is loaded into every session. Keep it short and include only conventions you really need every time.
- Repeated trial and error. Narrowing down an error yourself before pasting it in saves far more than letting it retry blindly.

If you use the API, prompt caching can also cut the cost of repeated prefixes. For where to place the markers and how to check cache hits, see [How to use Claude prompt caching to actually save money](/en/blog/claude-prompt-caching-save-cost).

After optimizing, compare with `/cost` once more. If the same workload now uses clearly less, you may not need either of the other two paths.

## Path 2: upgrade your official plan. When is it worth it?

If you still hit the limit often after optimizing, and your work really depends on features of an official Claude account (the web app, other official features), upgrading is a reasonable choice. Before deciding, answer three questions:

1. When during the day do you hit the limit? Is it concentrated in one heavy task, or does consumption stay even throughout the day?
2. How far is the upgraded quota from your actual consumption? Estimate this from the `/cost` data above, not from gut feeling.
3. Is your region within the officially supported range, and can your account subscribe normally?

For the differences between plans, see [Claude Pro vs. Max: what's different and when to upgrade](/en/blog/claude-pro-vs-max-difference) and [Is Claude Pro worth buying? Work out your usage first](/en/blog/is-claude-pro-worth-it). If your account is restricted or you are in an unsupported region, the only route is official policy and the appeal process; see [What "Claude is not available in your region" means: causes, official policy, and compliant options](/en/blog/claude-unsupported-region-explained).

## Path 3: change the endpoint and use a metered or monthly gateway

Claude Code lets you set the API endpoint and key through environment variables, so you can also send requests to a compatible gateway that bills in its own way. The upside is that you can choose the billing model and no Claude account is required. The cost is that you now have to judge the reliability of a third party.

The configuration goes in the `env` section of settings.json. For file hierarchy and precedence, see [Claude Code settings.json: hierarchy, precedence, and env configuration](/en/blog/claude-code-settings-json-guide). For how each tool is configured side by side, see [Custom API endpoints for Claude Code, Codex, and OpenCode](/en/blog/configure-custom-api-endpoint-claude-code-codex).

Before choosing a gateway, run through [How to choose an API relay: 8 checkable items including uptime, billing, and data policy](/en/blog/api-relay-how-to-evaluate). Once you are using one and the bill looks wrong, check it line by line with [How to investigate incorrect API billing](/en/blog/relay-billing-token-mismatch).

### AGI Plan is one option

AGI Plan is a multi-provider LLM aggregation gateway, and it is a commercial partner of cdnping. This article uses it only as an example, not as the only choice. How it works:

- Monthly subscription, paid in RMB, no overseas credit card needed.
- Compatible with both OpenAI and Anthropic API formats. For Claude Code and Codex you only change one endpoint address, and Claude Code does not need a Claude account.
- One quota can be switched among four capability groups: frontier reasoning, balanced general-purpose, Chinese flagship models, and fast lightweight models. The unit is the CU (1 CU equals 1,000 output tokens of the baseline model).
- Plans are Lite ¥49/month, Plus ¥119/month, Pro ¥649/month, and Max ¥1,368/month. The four tiers differ only in quota, and annual billing gets 20% off. Pay-as-you-go is also available at ¥1 = 500 CU, with a minimum top-up of ¥20. Prices are as listed on the [AGI Plan pricing page](https://agiplan.dev/pricing).

Two points to note: the service states clearly that it is not an officially authorized channel, and some models are marked "outside China only"; check the [models page](https://agiplan.dev/models) for specifics. Setup is: sign up with an emailed verification code, choose a plan and create a key, change one configuration entry. Details are on the [startup page](https://agiplan.dev/startup). Why no Claude account is needed is explained in [Can you use Claude Code without a Claude account? How the endpoint approach works](/en/blog/claude-code-without-claude-account).

With any gateway, first find out whether it logs request content and how it calculates uptime. See [Are Claude API relays reliable? Four main risks and checks you can run yourself](/en/blog/is-claude-api-relay-safe).

## How to choose among the three paths

| Your situation | Suggestion |
| --- | --- |
| You have not checked usage and keep one session open all day | Do Path 1 first, then see whether you still hit the limit |
| Still hitting the limit after optimizing, account is fine, you depend on official features | Upgrade your official plan |
| No Claude account, or you want flexible pay-per-use billing | Evaluate a gateway such as AGI Plan (first confirm your region and the terms of service allow it) |
| Occasional errors but quota remains | Check the status page and your network first; this is not a quota problem |

## Next step

Do one thing today: run `/cost` before and after a task you do often, and write down the result. With that number in hand, go back to the table above and the choice stops being a guess. If you end up choosing a gateway, first use the [cdnping home page](/en) to test your network latency to each API (see [/en/learn/ai-api-latency-china](/en/learn/ai-api-latency-china) for how to read the results), then follow the setup steps on the [AGI Plan startup page](https://agiplan.dev/startup).
