| Domain | Wt |
|---|---|
| 1 Agents and Workflows | 14.7% |
| 2 Applications and Integration | 33.1% |
| 3 Claude Code | 3.1% |
| 4 Eval, Testing, Debugging | 2.6% |
| 5 Model Selection and Optimization | 16.8% |
| 6 Prompt and Context Engineering | 11.0% |
| 7 Security and Safety | 8.1% |
| 8 Tools and MCPs | 10.6% |
Domain 2 alone is a third of the exam. Domains 3+4 (Claude Code, Eval/Debugging) are ~6% combined despite the credential explicitly validating eval design and trace-based debugging — don't skip them because the weight looks small.
POST /v1/messages
{model, max_tokens,
system, messages:[
{role:"user", content}]}
system = top-level field, not a message role.user, assistant. No "system" message.max_tokens required; temperature/top_p/top_k optional.| Block | Where |
|---|---|
| text | req + resp |
| image / document | request |
| tool_use | response |
| tool_result | request |
| thinking / redacted_thinking | response |
content is always an array, never a bare string in responses.
| Value | Meaning |
|---|---|
| end_turn | finished normally |
| max_tokens | truncated, hit ceiling |
| stop_sequence | hit a stop string |
| tool_use | must send tool_result back |
| pause_turn | long/agentic turn paused |
| refusal | declined for policy |
tools arraystop_reason:"tool_use" + tool_use block(s)tool_result block(s), keyed by tool_use_idend_turnTrap: forgetting to resend tools on the follow-up call (stateless API).
{name, description,
input_schema:{type:"object",
properties:{...}, required:[...]}}
| tool_choice | Effect |
|---|---|
| auto | model decides (default) |
| any | must call some tool |
| tool + name | force this one — best for structured output |
| none | disable tools this call |
message_start → content_block_start → content_block_delta ×N → content_block_stop → (repeat per block) → message_delta → message_stop
text_delta, input_json_delta (partial JSON — concat before parsing!), thinking_delta, signature_delta.ping = keepalive, ignore. Mid-stream failure → error event."cache_control":{"type":"ephemeral"} on a block in system/messages/tools.usage.cache_creation_input_tokens / cache_read_input_tokens to verify hits."thinking":{"type":"enabled","budget_tokens":N}, N < max_tokens.thinking block (with signature) before the answer.redacted_thinking = encrypted reasoning, still round-trip it.POST /v1/messages/count_tokens to check cost before sending.| Header | Meaning |
|---|---|
| anthropic-ratelimit-requests-* | req/min budget |
| anthropic-ratelimit-tokens-* | token/min budget |
| retry-after | on 429/529, seconds to wait |
Retry 429/529 + backoff/jitter. Never retry 400 unchanged — it'll fail identically.
| Status | error.type |
|---|---|
| 400 | invalid_request_error |
| 401 | authentication_error |
| 403 | permission_error |
| 404 | not_found_error |
| 413 | request_too_large |
| 429 | rate_limit_error |
| 500 | api_error |
| 529 | overloaded_error |
POST /v1/messages/batches — array of {custom_id, params}, each params = a normal Messages request.GET /v1/messages/batches/{id} for status.custom_id.POST /v1/files) → reference by file_id in image/document blocks — avoids re-sending base64 every call.image block is fine.document block + "citations":{"enabled":true} → response text carries citation metadata back to the source passage.pip install anthropic
client = Anthropic()
client.messages.create(...)
npm install @anthropic-ai/sdk
const client = new Anthropic();
await client.messages.create({...});
Both read the API key from ANTHROPIC_API_KEY by default. Both offer a .stream() helper.
| Family | Fit |
|---|---|
| Opus | hardest reasoning/agentic, $$$ |
| Sonnet | default balanced production choice |
| Haiku | high-volume, cheap, fast, simple tasks |
Pin a dated model ID in production; don't rely on a rolling alias.
| Primitive | Invoked by |
|---|---|
| Tools | the model |
| Resources | the app/user (read-only data) |
| Prompts | the user (explicit template) |
stdio = local subprocess, simplest. Streamable HTTP = remote server.
usage, stop_reason, model ID, latency per call for regression detection.tool_use.input as pre-sanitized; validate before executing (esp. filesystem/shell/DB tools).stop_reason: max_tokensstop_reason: tool_useinput_json_delta, concat firstinvalid_request_errormessages doesn't exist (it's top-level) · content is always an array · forgetting to resend tools on the tool_result call · parsing partial input_json_delta as JSON · stripping thinking blocks before a later turn · caching a block with a varying value inside it · retrying 400 errors · assuming Domain 2 (33.1%) is like the other seven domains — it isn't