A team is instrumenting its Claude Messages API integration to monitor usage and cost. Which TWO response fields should the developer log to track token consumption per request? (Choose two.)
The usage object also reports output_tokens, the tokens generated in the completion. Because output tokens are typically priced differently from input tokens, logging this separately is necessary for precise cost accounting. Combined with input tokens, it gives a complete per-request consumption picture from the API itself.
Why this answer
The usage object in a Messages API response exposes input_tokens and output_tokens, which together quantify consumption for each call. Because input and output tokens are priced separately, both must be logged for accurate cost attribution. Other fields like stop_reason, id, and model provide context or tracing value but do not measure token usage.
Exam trap
The trap here is logging descriptive response fields such as the model name or message id and assuming they convey token usage when only the usage object reports counts.