Claude model behaviour
Anthropic's API as it behaves in practice — streaming event types, prefilling, token counting, tool use and the limits that shape how a Claude integration is written.
The Anthropic Messages API is small. One endpoint, a handful of top-level parameters, and a response whose content is a list of typed blocks. Almost everything that surprises people building on it comes not from the surface but from the shapes that move through it: which block types can appear together, what the same field means in a streamed response versus a buffered one, and which parameter is a hint the model can ignore rather than a limit the server enforces.
These pages are about those shapes. Each one takes a single field, parameter or block type and follows it end to end — the request that produces it, the response that carries it, and the error you get when it is wrong. Where a figure is a documented limit it is named and attributed, and where it is expected to change with the next model release it is marked as such rather than presented as a constant.
Claude's Context Window: 200K, 1M, and What Fills It Fastest
The documented input limits per Claude model family, what counts against them, and a worked example of how quickly tool definitions and history consume the budget.
9 min read
Claude's Max Output Tokens per Model
The documented per-model output ceiling, why max_tokens is required, and why the large ceilings are only reachable on a streamed request.
8 min read
The system Parameter in the Claude API: A Field, Not a Message
Where the system prompt goes in a Messages API request, what error you get if you put it in the messages array, and what the array form of the field buys you.
8 min read
stop_sequences in the Claude API: What Comes Back When One Fires
How the stop_sequences array changes generation, which two response fields tell you a sequence fired, and why the matched text is not in the output.
7 min read
Claude's tool_use and tool_result Content Blocks, End to End
A full request, tool_use response, tool_result reply and final answer, with each field of both block types explained in place.
9 min read
Forcing a Specific Tool Call in the Claude API
The four tool_choice variants, what each one changes about the response you get back, and the constraints that come with forcing a call.
8 min read
Claude's Streaming Event Types, From message_start to message_stop
Every server-sent event type in a streamed Messages API response, in the order they arrive, and which fields each one carries.
9 min read
Prompt Caching in the Claude API: cache_control Breakpoints and the TTL
Where the cache_control marker goes, the prefix rule that decides whether you get a hit, the two TTLs, and the usage fields that prove it worked.
9 min read
Extended Thinking in Claude: budget_tokens and What Replaced It
What the budget_tokens parameter does, how it trades off against the visible answer inside max_tokens, and which models now reject it.
9 min read
Claude's Computer Use Tool: How Screenshots and Actions Round-Trip
The specific tool_use loop behind computer use — what the model emits, what you execute, and how a screenshot goes back in a tool_result.
9 min read
Claude's Citations Feature: How Source Spans Come Back in the Response
How to enable citations on a document block and what the citation objects attached to the response text actually contain.
8 min read
What a Declined Response Looks Like in the Claude API
The stop_reason and stop_details a declined request returns, why it arrives as an HTTP 200, and how its shape differs from a normal completion.
8 min read
Claude Vision: Image Size and Token Cost per Image
Anthropic's documented pixels-to-tokens formula, applied to three real image sizes, with the resize ceiling that caps what any single image can cost.
8 min read
PDF Input in the Claude API: How Pages Become Tokens
Why a PDF page costs what it costs in the Claude API, derived from the two things Anthropic does to each page, with a twenty-page document priced end to end.
8 min read
Claude's Dated Model Snapshots and Why the -latest Alias Moves
How Anthropic's model id naming works, what changes under you when you call an alias, and the one field in the response that tells you which weights actually answered.
8 min read
Claude's Model Deprecation Policy and Retirement Notice Window
The lifecycle states an Anthropic model passes through, the minimum notice the published policy commits to, and what a request to a retired model actually returns.
7 min read
Why Claude's Token Counts Differ From GPT's on the Same Text
The three separate reasons two providers report different token counts for identical text, and why the difference makes a per-million price comparison unreliable.
9 min read
The count_tokens Endpoint in the Claude API
How to price and size a Claude request before you send it, using the token-counting endpoint with the exact body you intend to submit.
8 min read
Claude's Temperature Parameter Range and Default
The documented 0.0 to 1.0 range and its default, why the ceiling is where it is, and what happens to a temperature value copied from an OpenAI configuration.
7 min read
Forcing JSON Output From Claude Without a Dedicated JSON Mode
Claude has no response_format parameter; the supported route to structured output is a single forced tool call, and this is the full mechanism with a working example.
9 min read
Why max_tokens Is Required in the Claude API
The 400 you get when max_tokens is missing, why Anthropic has no default for it, and why setting it to the model maximum is the wrong fix.
7 min read
What Happens Past Claude's 200K Context Window
The prompt-is-too-long error, the token count Anthropic hands you inside it, and why a prompt that fits can still be rejected.
8 min read
Why the Claude API Rejects a Second System Message
The validation error from putting a system-role message in the messages array, why Anthropic made system a top-level field, and how to port code that sends several.
8 min read
Interleaved Thinking and Tool Use in Claude
How the interleaved-thinking beta lets Claude reason between tool calls, and what that does to the order of blocks you have to send back.
9 min read
Claude Haiku’s Context Window and Output Cap
The documented context and output limits across the Haiku line, and the error you get when max_tokens exceeds the model's cap.
7 min read
Claude’s stop_reason Field: Every Value and What Triggers It
Each documented stop_reason value, the condition that produces it, and what your code should do differently for each one.
9 min read
Prefilling Claude’s Assistant Turn: How It Changes the Response
How a trailing assistant message constrains Claude's first tokens, what comes back in the response, and the restrictions on using it.
8 min read
Beta Headers in the Claude API: How Features Ship Before General Availability
How the anthropic-beta header opts a single request into pre-GA behaviour, and the specific failures you get when it is missing.
8 min read
Claude’s Message Batches API: Async Processing and the 24-Hour Window
How to submit, poll and read a Claude batch, with the documented completion window, discount and per-batch limits.
9 min read
Claude and Multiple Images in One Request: Ordering Rules
The documented per-request image limits, and how position in the content array is what lets your text refer to a specific image.
8 min read
Claude’s Knowledge Cutoff by Model
The documented training cutoff for each Claude generation, and why Anthropic publishes a second, earlier 'reliable knowledge' date.
8 min read
Token-Efficient Tool Use in the Claude API
The beta header that trims the token overhead of tool calls, what Anthropic reports it saves, and how to measure the difference on your own tools.
8 min read
Why Claude Sometimes Returns Text and a Tool Call in the Same Turn
Why an assistant turn can contain a text block and a tool_use block at once, what order they arrive in, and what you must send back.
8 min read
disable_parallel_tool_use in the Claude API
The tool_choice flag that limits Claude to one tool call per turn, how it interacts with auto, any and tool, and when forcing sequence is worth the round trips.
8 min read
Other topics
- LLM fundamentals & architecture
- Tokens, tokenization & context windows
- Prompt engineering
- Reasoning models & test-time compute
- Multimodal AI: vision, audio, video
- RAG & retrieval
- Embeddings & vector search
- AI agents & tool use
- Structured output & function calling
- Fine-tuning & post-training
- Local inference errors, string by string
- Running local models day to day
- Testing code that calls an LLM
- Snapshot and property testing for model output
- Regression suites for prompts
- Eval gates in CI
- Flaky tests against a model
- Determinism and the cost of testing
- Contract and streaming tests
- Testing tool calls and retrieval
- Inference, serving & latency
- Rolling out a prompt change
- Testing AI systems in practice
- Forecasting a time series
- Machine learning on tabular data
- Geospatial data and models
- Understanding audio that is not speech
- Understanding video
- Core computer vision tasks
- Machine learning on graphs
- Point clouds and 3D
- Evaluation, benchmarks & LLM-as-judge
- Sensor and IoT data
- Logs and event streams
- Models over biological sequences
- Machine learning on molecules
- Embedding and searching code
- Extracting invoices and purchase orders
- Receipts, statements and tax forms
- Insurance policies and contracts
- Deeds, court filings and patents
- Extracting from medical records
- Observability & LLMOps
- CVs, certificates and identity documents
- Shipping, customs and technical documents
- Meetings, email, chat and filled-in forms
- Building an extraction pipeline
- Business, property and inspection documents
- Contract clauses and insurance claims
- Regulated and compliance documents
- Consumer, travel and closing documents
- Mapping one chat API onto another
- SDK and framework migrations
- Hallucination & failure modes
- Re-embedding and model deprecation
- Cutting over between providers
- Parity gaps, shims and legacy endpoints
- Moving between model versions
- Migrating vector stores and caches
- Mapping capabilities and parameters
- Migrating pipelines and agents
- Contracts, runbooks and rollback
- Auditing a codebase before a cutover
- Compliance and fine-tune migration
- LLM cost engineering
- Routing, cost tracking and multi-tenancy
- What a migration does to your prompts
- AI security & prompt injection
- Privacy, compliance & data residency
- AI governance, policy & society
- Building reliable AI applications
- AI hardware, GPUs & compute
- Open-weight models & local inference
- AI for developers & coding agents
- AI in industry: vertical playbooks
- AGI, superintelligence, alignment & the long future
- Machine learning foundations
- NLP fundamentals & classical tasks
- Data engineering for AI
- Synthetic data & dataset curation
- AI product design & UX
- Search, ranking & recommendation
- Enterprise adoption & change management
- AI careers, skills & teams
- Reading AI research
- AI in science & discovery
- Robotics & embodied AI
- AI economics, markets & business models
- AI myths, hype & media literacy
- Context engineering
- Shipping AI features: patterns & anti-patterns
- Build it: end-to-end AI tutorials
- Python for AI: hands-on recipes
- TypeScript, React and the web
- Frameworks and SDKs
- Errors and troubleshooting
- AI facts, numbers and statistics
- The history of AI
- The maths behind AI
- Architectures beyond the transformer
- Reinforcement learning
- Diffusion and generative media
- Speech, audio and voice engineering
- Benchmarks, one at a time
- AI search visibility
- Infrastructure and operations
- Databases and storage for AI
- Knowledge graphs and structured knowledge
- Classical ML in production
- Regulation, jurisdiction by jurisdiction
- Prompt recipes and pattern library
- AI for people who do not write code
- Writing, media and creative work
- Edge and on-device AI
- Interpretability and model internals
- Field notes
- OpenAI model behaviour
- Gemini model behaviour
- Llama model behaviour
- Mistral model behaviour
- Qwen model behaviour
- DeepSeek model behaviour
- Cohere model behaviour
- Grok model behaviour
- Small model behaviour
- Hybrid model architectures
- Token cost by language and script
- Transliteration, romanization and script handling
- Locale-correct output
- Multilingual generation quality
- Multilingual pipelines
- The EU AI Act, article by article
- AI under the GDPR and EU data law
- US AI regulation, state and sector
- International AI governance and standards
- AI litigation and enforcement
- Running AI workloads on AWS
- Running AI workloads on Google Cloud
- Running AI workloads on Azure
- AI at the edge: Workers, Vercel and Netlify
- Serving models on Kubernetes
- Operating AI infrastructure
- Quantization formats and what they cost
- llama.cpp, flag by flag
- Ollama and the desktop local-model runtimes
- Local models on Apple Silicon
- Hardware for local inference
- Running speech and embedding models locally
- Model files, adapters and conversion
- VRAM arithmetic for local models