Skip to content

CCDV-F · Domain 5: Model Selection and Optimization · 12% of the exam

Task 5.3: Cost Diagnosis and Optimization

Reading usage and cost data to find what drives the bill, then picking and sizing the fix: cache breakpoints placed for single, layered or rolling caching, batch processing, or token budgets.

Study it

  • Cost drivers: cache breakpoints, batch processing and token budgets

    Partly covered by: The KV Cache

Sample questions

Try each one before opening the answer. Every option is explained, with the Anthropic documentation page that proves it.

Question 1 · choose 1

Your research chat attaches the 24 retrieved passages of each turn as separate document blocks, so each turn adds about 26 blocks. Every request puts cache_control only on its final block. Usage over three consecutive turns looks like this:turn cache_creation_input_tokens cache_read_input_tokens 2 41,200 0 3 49,800 0 4 58,100 0Which change starts producing cache reads?

  1. ASwitch every breakpoint to the 1-hour cache duration so that earlier entries are still available
  2. BReplace the breakpoints with one top-level cache_control field so that automatic caching finds the earlier entries
  3. CAlso put cache_control on the last block of the previous turn, where the last cache write was made
  4. DMove the retrieved passages into the system prompt so that they are cached ahead of the conversation
Show the answer and why
  • ASwitch every breakpoint to the 1-hour cache duration so that earlier entries are still available

    Incorrect

    The entries have not expired; they lie outside the 20-block lookback window.

  • BReplace the breakpoints with one top-level cache_control field so that automatic caching finds the earlier entries

    Incorrect

    Automatic caching uses the same 20-block lookback window as explicit breakpoints.

  • CAlso put cache_control on the last block of the previous turn, where the last cache write was made

    Correct

    A second breakpoint near the previous write starts its own lookback and finds that entry.

  • DMove the retrieved passages into the system prompt so that they are cached ahead of the conversation

    Incorrect

    The passages change every turn, so putting them earlier in the prefix invalidates more of the cache.

Cache reads look back at most 20 blocks from each breakpoint for an entry an earlier request wrote. When a turn adds 20 or more blocks, the previous write falls outside the window. A second breakpoint closer to that position starts another lookback window that finds it.

Question 2 · choose 2

A nightly job sends 40,000 requests through the Message Batches API on the Claude API, each starting with the same long system prompt marked for caching. Half of the batches are submitted with a key for the etl workspace and half with a key for the reports workspace. A partner company runs the same job, with an identical system prompt, in its own organization. You are working out how caching behaves for this job. Which TWO statements are correct? (Choose TWO.)

  1. ARequests that read the cached prompt get shorter responses, which also lowers the output tokens they use
  2. BRequests sent with one workspace's key don't read entries written with the other's, so each workspace writes its own
  3. CA request still reads the cached prompt when its system prompt differs only by small edits, such as extra whitespace
  4. DAn entry's lifetime counts from the start of the request that reads it, not from the end of its response
  5. EThe partner's requests can read the entries your job writes, since the system prompts are identical
Show the answer and why
  • ARequests that read the cached prompt get shorter responses, which also lowers the output tokens they use

    Incorrect

    Prompt caching has no effect on output generation; the response is the same as without caching.

  • BRequests sent with one workspace's key don't read entries written with the other's, so each workspace writes its own

    Correct

    On the Claude API, caches are isolated between workspaces, and each workspace builds its own cache.

  • CA request still reads the cached prompt when its system prompt differs only by small edits, such as extra whitespace

    Incorrect

    Cache hits require 100 percent identical prompt segments up to the block marked with cache control.

  • DAn entry's lifetime counts from the start of the request that reads it, not from the end of its response

    Correct

    The lifetime is measured from the start of the request that writes or reads the entry, so generation time counts against it.

  • EThe partner's requests can read the entries your job writes, since the system prompts are identical

    Incorrect

    Different organizations never share caches, even with identical prompts.

Caches are never shared across organizations and, on the Claude API, are also isolated between workspaces, so each workspace builds its own cache. A cache hit needs an identical prefix up to the breakpoint, caching does not change the generated output, and an entry's lifetime is measured from the start of the request that writes or reads it, not from the end of its response.

Question 3 · choose 1

A request already places cache_control on four content blocks, and a developer adds a top-level cache_control field to turn on automatic caching as well. What happens?

  1. AAutomatic caching replaces the four block-level breakpoints
  2. BThe top-level field is ignored, and the four breakpoints keep working
  3. CThe API returns a 400 error, because no breakpoint slot is left for automatic caching
  4. DThe request succeeds with five breakpoints at a higher write price
Show the answer and why
  • AAutomatic caching replaces the four block-level breakpoints

    Incorrect

    The two can be combined; the automatic breakpoint needs a free slot.

  • BThe top-level field is ignored, and the four breakpoints keep working

    Incorrect

    With no slot left, the request is rejected rather than ignored.

  • CThe API returns a 400 error, because no breakpoint slot is left for automatic caching

    Correct

    Automatic caching uses one of the 4 breakpoint slots; with 4 explicit ones there is none.

  • DThe request succeeds with five breakpoints at a higher write price

    Incorrect

    A request can have at most 4 breakpoints.

Automatic caching is compatible with explicit breakpoints, but it uses one of the 4 available breakpoint slots. If 4 explicit block-level breakpoints already exist, the API returns a 400 error.

Question 4 · choose 1

In Claude Code, you type /cost to look at your usage, and the output is the same as /usage. Why?

  1. A/cost is an alias for /usage
  2. B/cost only works with API keys
  3. C/cost shows the previous session
  4. D/cost was removed in a recent release
Show the answer and why
  • A/cost is an alias for /usage

    Correct

    The commands reference lists /cost as an alias for /usage.

  • B/cost only works with API keys

    Incorrect

    The two commands are the same command under two names.

  • C/cost shows the previous session

    Incorrect

    It is an alias, not a view of another session.

  • D/cost was removed in a recent release

    Incorrect

    The command still exists as an alias.

The built-in commands reference lists /cost as an alias for /usage, so both show the same information.

Practice domain 5 →Practice all domains →