If your Claude API bill is suddenly higher than expected, this guide walks you through the steps to find the cause and fix it. You’ll learn how to check your usage dashboard, review your code for inefficient patterns, and set up safeguards to prevent future surprises. Before you start, make sure you have access to your Anthropic Console, your API keys, and any codebases that call the API.
What You’ll Need
- Access to the Anthropic Console (the account that owns the API key)
- Your API keys (at least the last few characters to identify them)
- Read access to any application code or scripts that call the Claude API
- A rough idea of your expected usage (e.g., number of requests per day)
Step-by-Step
- Log in to the Anthropic Console and go to the Usage tab. This shows your token usage and cost over time. Look for the date the bill spiked and note the daily breakdown.
- Filter by API key. If you have multiple keys, the usage page lets you filter by key. This tells you which application or environment (production, staging, personal) is responsible.
- Check the model and token breakdown. The console shows how many input and output tokens you used for each model. A spike in output tokens is common when a model is generating long responses or when you’re using a larger model like Claude Opus instead of Sonnet or Haiku.
- Review your code for loops or retries. Look for any place where you call the API inside a loop (e.g., processing a list of items) or where you retry on errors without a backoff. A single bug can multiply your calls.
- Check for missing caching. If you’re sending the same system prompt or large context repeatedly, you should enable prompt caching. Without it, you’re paying for the same tokens every time.
- Look for background jobs or cron jobs. A scheduled job that runs every minute instead of every hour, or a webhook that fires on every event, can silently rack up costs.
- Inspect your prompts for token bloat. Long system prompts, large few-shot examples, or including entire documents when you only need a summary will inflate input tokens.
- Check for streaming vs. non-streaming. Streaming doesn’t reduce cost, but it can indicate that you’re generating long outputs. If you’re using max_tokens set to a high value, the model may generate more than needed.
- Set up a budget alert. In the Anthropic Console, you can set a spending limit or alert. If you haven’t, do it now to catch future spikes early.
- If you still can’t find the cause, contact Anthropic support. They can provide a detailed breakdown of your usage, including timestamps and request IDs, which can help pinpoint the issue.
Common Mistakes
- Ignoring the model tier. Using Opus for trivial tasks like summarization is a common cause of high bills. Check which model your code specifies.
- Not accounting for output tokens. Output tokens cost more than input tokens (except for cached input). A long generation can be expensive.
- Forgetting about tool calls. If you use function calling, each tool result is sent back as a new input, doubling the token count.
- Assuming the bill is wrong. It’s rare for the bill to be incorrect. More likely, there’s a usage pattern you haven’t noticed.
- Only checking the total, not the daily breakdown. A spike on a specific day can point to a one-off event like a data migration or a bug that was fixed.
Tips
- Enable prompt caching for any static prefix (system prompt, few-shot examples) to reduce input token costs by up to 90%.
- Use the smallest model that works. Haiku is much cheaper than Opus and is fine for many tasks.
- Set max_tokens to a reasonable value. Don’t let the model ramble. For most tasks, 100-500 tokens is enough.
- Log every API call. In your code, log the model, token usage, and timestamp. This makes it easy to correlate with the bill.
- Use batch processing if you have a large number of independent requests. The Batch API offers a 50% discount.
- Monitor your usage weekly. Don’t wait for the monthly bill. Set a recurring check.
Troubleshooting
What if the usage dashboard shows no spike but the bill is high?
This can happen if you have multiple accounts or if you’re using a third-party service that resells Claude API. Check your payment method for the exact merchant name. If it says Anthropic, it’s your account; if it says something else, you may have a separate subscription (like Claude Pro or a platform like Poe) that you forgot about.
What if the spike is on a date when you didn’t deploy anything?
Check for automated processes that might have been triggered by an external event (e.g., a webhook from a form, a scheduled job from a cron service). Look at your server logs for that date to see if there was unusual traffic.
What if you have a key that you don’t recognize?
If you see an API key in the filter that you didn’t create, it could be a leaked key. Immediately revoke it in the Console and rotate your other keys. Also check your code repositories for hardcoded keys.
What if the bill is high but you’re not even using the API?
This could indicate that someone else has access to your account. Change your password, enable two-factor authentication, and revoke all keys. Then contact support to dispute the charge.
What if the usage is from a model you don’t use?
If you see usage for a model like Claude 3 Opus but your code only calls Sonnet, check if you have any other services (like a chatbot plugin) that might be using a different model. Also check if your code has a fallback that switches to a larger model on error.
Frequently Asked Questions
Can I get a refund for unexpected charges?
Anthropic does not typically offer refunds for usage, but if you can prove unauthorized access, they may work with you. Contact support as soon as possible.
How do I see the cost per request?
The Console doesn’t show per-request cost, but you can log token usage in your code and multiply by the model’s per-token price (available on the pricing page).
What is prompt caching and how do I enable it?
Prompt caching stores a prefix of your prompt so you don’t pay for it again. You enable it by adding a cache_control block to the system prompt or the last message in a conversation. See the API documentation for details.
Does the Batch API really cost less?
Yes, batch requests are 50% cheaper for both input and output tokens. They’re processed within 24 hours, so they’re ideal for non-urgent tasks.
Why is my input token count so high?
This usually means you’re sending large context windows. Check if you’re including entire documents or long conversation histories that could be truncated or summarized.
How do I set a spending limit?
In the Anthropic Console, go to Settings > Billing and set a monthly limit. You’ll get an email when you reach 80% and 100% of the limit. Note that this is a soft limit—it won’t stop requests, but it will alert you.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Hide PHP Version HTTP Header: How To
- CentOS Stream for Developers: A Practical Guide
- How to Replace a Game Controller Battery Safely
- Man-Sized 3D Printer? Why You Probably Don’t Need One100.0 cm³/h
- Scroll Horizontally with Mouse Wheel by Holding Shift5.00 min/km
- iPadOS 16 Supported Devices: Full List