# AI API cost calculator

URL: https://byshahid.com/tools/ai-api-cost-calculator/
Author: Muhammad Shahid (https://byshahid.com/)
Free tool · runs in your browser

Estimate what an AI feature or chatbot will cost each month from how many requests it handles and how long they are.

**Quick answer:** LLM APIs charge per million tokens, with separate prices for input (what you send) and output (what the model writes). Monthly cost = requests per month × (input tokens × input price + output tokens × output price) ÷ 1,000,000. This calculator has Anthropic's Claude list prices filled in and accepts custom prices for any other model.

## How to use it

1. **Choose a model or enter prices.** Claude prices are filled in; pick Custom to enter any model's input and output price per million tokens.
2. **Enter your usage.** Requests per day, and average input and output tokens per request.
3. **Read the cost.** Per request, per day, per month and per year.

## Example

A support bot handling 1,000 requests a day:

Input:

```
Model: Claude Sonnet 5.5 ($2 input / $10 output per million tokens)
Requests per day: 1,000
Input tokens per request: 2,000
Output tokens per request: 500
```

Output:

```
Per request: $0.009
Per day:     $9.00
Per month:   $270.00
Per year:    $3,285.00
```

## Common errors and how to fix them

- **The estimate is 1,000 times too high or low**: Prices are per million tokens, not per thousand. Check the unit on the pricing page.
- **Real costs are much higher than the estimate**: Chat apps resend the whole conversation each turn, so input tokens grow with every message. Use the average input of a full conversation.
- **Thinking tokens were left out**: Models that think before answering bill those tokens as output. Add them to the output tokens per request.
- **Retries and failed calls are not counted**: Timeouts and retries are billed too. Add a margin, or measure the real cost per completed task.

## Frequently asked questions

### How is LLM API cost calculated?

Input tokens × input price plus output tokens × output price, with prices quoted per million tokens, summed over all requests.

### Why is output more expensive than input?

Generating tokens takes more computation than reading them, so providers price output several times higher.

### How can I lower my AI API costs?

Use prompt caching for long repeated prompts, a smaller model where quality allows, shorter prompts and answers, and batch processing for work that is not urgent.

### Are the prices current?

The Claude prices are Anthropic's published list prices as of October 2026, before discounts such as caching or batching. Check the provider's pricing page before budgeting.

### Does thinking count as output tokens?

Yes. On models that think before answering, the thinking tokens are billed as output, so leave room for them in your estimate.

### How many tokens does a chatbot message use?

It depends on the system prompt, the conversation history and the reply. Because the whole conversation is sent again with every message, a support chat with a long system prompt can use thousands of input tokens per message.

### What is prompt caching and how much does it save?

It reuses a long prompt prefix between requests. Cached input tokens are billed at a fraction of the normal input price, which cuts the cost of bots that resend the same instructions and documents.

### What is batch processing?

Sending many requests to be processed asynchronously at a discount, for work that does not need an immediate answer, such as summarising thousands of documents.

### Which Claude model should I start with?

The one that meets your quality bar on real examples. Measure the cost per completed task: a cheaper model that needs more retries is not cheaper.

### Does this calculator include WhatsApp or hosting costs?

No. It covers model usage only; WhatsApp conversations, servers and databases are billed separately.

## Related

- [LLM token counter](https://byshahid.com/tools/llm-token-counter/)
- [AI chatbot ROI calculator](https://byshahid.com/tools/ai-chatbot-roi-calculator/)
- [Hire an AI agent and LLM developer](https://byshahid.com/hire/ai-agent-developer/)

## Sources

- [Anthropic: Pricing](https://claude.com/pricing)
- [Anthropic Docs: Token counting](https://platform.claude.com/docs/en/build-with-claude/token-counting)
