Claude Certified Architect – Foundations Practice Question 90: Request ID Usage Logging

Claude Certified Architect, Foundations · Test 9 · question 10 of 10

Context Management & Reliabilityhard

A production agent's monthly API bill doubled after a release, and users report occasional bad answers that engineers cannot reproduce. Existing logs record only the user ID and the final answer. Dashboards built from input_tokens show tiny input volumes even though the prompts contain large cached documents. The team wants telemetry that can explain cost changes and let Anthropic support investigate a specific bad response. What should each request log?

Select one answer
Show answer and explanation

Answer:

  • A. The request-id, model, stop_reason, and every usage field: input_tokens, output_tokens, cache_creation_input_tokens, and cache_read_input_tokens

A is correct. Every response carries a unique request-id header (also the request_id field in error bodies) that support needs to investigate a specific request. The usage object breaks input into input_tokens (only tokens after the last cache breakpoint), cache_creation_input_tokens and cache_read_input_tokens; total input is the sum of all three, and each cost differently. Logging all of them with the model and stop_reason shows whether a release broke cache hits, changed the model or lengthened outputs.

B is wrong because input_tokens excludes cached portions, which is why the dashboards look tiny; cache writes and reads are billed separately and omitted. C is wrong because status codes and retry counts say nothing about the cost of successful calls, and usage is in successful responses. D is wrong because a pre-send count is an estimate of input, not the billed usage reported after the call, and it cannot show cache behavior.

Reference: Prompt caching - Tracking cache performance and Claude API errors - Request ID

Practice Test 9 ›

Study guides for Claude Certified Architect, Foundations