The Claude API response includes a 'usage' field. What information does this provide?
Select an answer to reveal the explanation.
Short Explanation and Infographic
The usage field tells you exactly how many input tokens your prompt consumed and how many output tokens Claude generated — the two numbers you need to calculate the cost of that call.
Full explanation below image
Full Explanation
The 'usage' object in every Claude API response contains: 'input_tokens' (count of tokens in the request including system prompt and messages), 'output_tokens' (count of tokens in Claude's response), and sometimes additional fields like 'cache_creation_input_tokens' and 'cache_read_input_tokens' when prompt caching is used. This data is essential for: monitoring token consumption, calculating costs, debugging context window issues, and optimizing prompt lengths. Option A (monthly call count) is in the Anthropic Console, not per-call. Option C (rate limit usage) is in response headers, not the usage object. Option D (confidence scores) are not provided by Claude's API.