Study guides / CCDV-F

Quick reference

One condensed cheat-sheet per domain - the tables and rules worth re-reading right before the exam.

1.1 - Messages API: Request Shape & stop_reason

Required top-level fields: model, max_tokens, messages. system is a sibling of messages, never a role inside it. messages entries alternate user/assistant only - no role: system turn.

stop_reasonMeaningTreat as
end_turnNatural completionFinished
max_tokensHit the output cap mid-generationTruncated, not finished
stop_sequenceA custom stop_sequences string was hitFinished (check stop_sequence field)
tool_useClaude wants a tool executedNot finished - execute and continue loop
pause_turnLong-running server-side tool turn pausedResume by sending the response straight back
refusalModel declined on an otherwise normal 200Not finished - handle as a refusal

1.2 - Streaming: SSE Event Lifecycle & Deltas

Order: message_start -> (content_block_start -> deltas -> content_block_stop) per block -> message_delta -> message_stop. ping events can appear anywhere; ignore them.

Block typeDelta eventNotes
texttext_deltaSmall text chunks
tool_useinput_json_delta (partial_json)Concatenate fragments; only JSON.parse after content_block_stop
thinkingthinking_delta, then signature_deltasignature_delta is one final event per block
Symptom / questionFixWhy
Need final, trustworthy stop_reasonRead it only from message_deltaIt's null in message_start; not final until message_delta
Need final output_tokensRead it only from message_deltaoutput_tokens isn't complete until generation ends
Stream returns 200 then dies partwayWatch for an error event type throughout the stream, not just connection statusA 200 at connect time doesn't guarantee the stream completes
Stream drops mid-generationRetry the whole request from scratchNo resume/cursor mechanism exists for a partial stream

Streaming changes delivery only - it does not change cost or what the model computes.

1.3 - Vision: Sending Images & Verifying Extraction

Vision reads reliablyVision is error-prone on
Layout, general description, chart trends, clean printed textExact numeric extraction (receipt totals, dense chart values)
Well-lit, straight-on document photosLow-res, skewed, JPEG-compressed, or handwritten content

Pattern for a value that feeds a decision: force a tool call with a typed input_schema (not free text) + add a cross-check field (e.g. currency symbol) + a code-side sanity rule (threshold / mismatch -> flag for review) before auto-acting. Never let a single vision pass drive an automated payment or compliance action unverified.

1.4 - Prompt Caching: Breakpoint Placement & Economics

usage fieldMeaningPrice vs. normal input token
cache_creation_input_tokensWritten to cache this callPremium (more expensive)
cache_read_input_tokensServed from cache this callSteep discount (~1/10 the price)

Distractor to reject: caching speeds up output *generation*. It does not - it only cuts the cost/latency of reprocessing input already seen.

1.5 - Tool Use Loop: Contract & Failure Handling

SymptomFix
Model re-requests a tool it already got an answer forCheck for a tool_use_id mismatch/typo between the call and the result
Loop only ever handles one tool_use block per responseRewrite to iterate all tool_use blocks and answer each
Model omits a field the tool needsMark that field required in input_schema, not optional

1.6 - Extended Thinking: Budget, Signature, Replay

MistakeConsequence
Enabling thinking on every request by defaultLatency/cost overhead with no quality gain on easy tasks
Stripping thinking block from history to save tokensBreaks reasoning continuity across tool-use turns
Hand-editing/reconstructing a thinking block before replayCan fail signature validation
Assuming a bigger budget = more accuracy, unlimitedNot monotonic - extra budget beyond task complexity is pure overhead

1.7 - Choosing an Application Shape

Two decision questions: (1) Does a human need this result right now? (2) Does any step depend on what an earlier step returned?

ShapeLatencyStep dependencyFits
Synchronous chatLow (seconds, human waiting)None / single turnLive user-facing Q&A
Batch (Batches API)None (async, results later)Items independent of each otherHigh-volume offline jobs: nightly re-tagging, bulk reclassification
Agentic loopVariesLater step needs an earlier tool result; unknown step countMulti-step investigation, research, orchestration

1.8 - Rate Limits, Retries, Idempotency

StatusRetryable?Handling
429 (rate limited)YesExponential backoff + jitter
5xx / overloaded_errorYesExponential backoff + jitter
400 (malformed request)NoFix the payload - identical retry = identical failure
401 (bad credentials)NoFix auth, don't retry
403 (unauthorized)NoFix permissions, don't retry

1.9 - API Keys, Auth & Config Management

1.10 - Testing Claude-Integrated Applications

WhatTest approachWhy
Request construction, response parsing, error handlingMocked unit tests, no live network callDeterministic code - fast, reliable, runs every CI commit
Model's actual output qualityEvaluation harness against a curated dataset + rubric (not pass/fail unit test)Non-deterministic; measures a distribution, not one assertion
A live/recorded response's correctnessStructural/semantic assertions (valid JSON? required field present? category in allowed set?)Survives rephrasing, still catches real regressions
Realistic response shapes without a live call every runRecorded fixtures, refreshed periodicallyFast and deterministic, but can drift if never refreshed

1.11 - Versioning & Rolling Out Model Changes

Identifier typeBehaviorUse in
Dated, pinned version stringAlways the same model behavior indefinitelyProduction - deliberate, tested upgrades only
Rolling "latest" aliasShifts to a newer model over time, no code changeLocal dev / prototyping only

Distractor to reject: "newer is presumably better, no need to validate." Aggregate benchmark improvement doesn't guarantee no regression on your specific feature's format requirements.