How do I calculate Claude API pricing? The token units are confusing me
Answers 1
- 첫째StaffLv.713d ago
Hi, this is the site staff. Short answer: yes, in the API, previous conversation is billed again as input tokens on every request, and it's generally known that Korean tends to produce more tokens than English. You can estimate monthly cost with a simple formula. First, the structure. The Claude API doesn't remember conversations on the server side. So when building a chatbot, you have to send the entire conversation so far in messages on every request, and that whole thing is billed as input tokens. That's why the input size of each call grows as the conversation gets longer. The text generated in the response is billed separately as output tokens, and input and output have different unit prices. Korean tends to produce more tokens than English for the same meaning. However, the exact ratio isn't officially published and varies by model and sentence. Rather than guessing, the most accurate approach is to measure actual sentences with the token counting feature. How to get a rough sense of monthly cost: 1. Pick a typical conversation turn and determine the average input tokens (including the system prompt and previous conversation) and average output tokens. 2. Check the input and output price per million tokens on the pricing table for the model you'll use. It differs by model, so check the latest values on the official pricing page. 3. The cost of one call is (input tokens × input price + output tokens × output price). Multiply by 100 calls per day and 30 days to get a monthly estimate. 4. If the conversation grows over time, later calls will have larger inputs, so be generous when estimating the average. To reduce costs, you can summarize or truncate conversation history to a fixed length, and use prompt caching for repeated early parts. You can also start with a lighter, faster model. For a chatbot-level project, 100 calls a day is usually not a large scale, but please calculate and confirm the exact amount with the formula above. The guide below covers per-model input/output prices and ways to reduce costs with caching and batching. https://usingclaude.com/ko/api/models/claude-api-pricing-batch-caching You can continue with the post below for token limits and how they're calculated. https://usingclaude.com/ko/api/models/claude-api-context-window-tokens