Developer Foundations · 16.8% of the exam

model selection and optimization

This is the second-heaviest domain, about a sixth of the scored questions. It covers what happens inside a model call and what each setting changes, the SDKs and transports between your code and Claude, how to choose a model family and check a new release, and what each request costs.

Course example

This domain keeps following Shelfwise, the internal stock-question tool from Domain 2: a long-lived Python service on the Agent SDK, Anthropic's library that runs Claude in a tool loop. Its agent answers shop staff from one stock feed through stock_mcp, its MCP server (a program offering tools over the Model Context Protocol), with its tools and stock rules sent as a cached prefix on every request.

In Domain 5 Shelfwise gains the model and cost choices behind its $0.01-an-answer ceiling: thinking turned off and three examples in the stock rules (5.1), retries and timeouts sized for a customer at the counter (5.2), a Sonnet-family trial that passed the evals but failed on cost, so the Haiku-family model stays (5.3), and a cost log that prices every usage field and tags staff answers apart from eval runs (5.4).

Haiku-family modelcached prefixAgent SDK retry settingscost log per usage field
$0.01mean cost per answer, checked from a week of usage logs. Only Haiku-family pricing plus prompt caching reaches it, at ≈$0.007 a warm answer (one reading the cache); a cold answer that writes the cache costs ≈$0.014, which the weekly mean absorbs while the hit rate stays high.

Start hereThe words used throughout this domain

token
The unit a model reads and writes: a word, part of a word or a character. For Claude a token is about 3.5 English characters, and input and output are priced per token.
max_tokens
The required request field that caps how many output tokens one response can write.
temperature
A sampling setting from 0 to 1: lower values favour the likeliest next tokens. 5.1 covers what it can't guarantee.
server-sent events (SSE)
The HTTP streaming format the Claude API uses: one response that the server keeps writing events down, in one direction only.
529
The Claude API's overloaded error: the platform is busy, not your own rate limit, and the SDKs retry it with backoff (2.4).
API key
The secret credential that authenticates each request to the Claude API. 5.2 shows where a service keeps it.

task statements

flashcards

0 / 12 known
Card 1 of 12