claude-sonnet-4-6
Claude Sonnet 4.6 is the generation where the Sonnet line reached a million-token context window and started keeping its reasoning across turns rather than discarding it. Both changes matter in practice: the window holds a codebase or a document set whole, and preserved thinking makes long multi-turn sessions consistent instead of rebuilding their analysis from nothing each time. It supports adaptive thinking with five effort levels and remains strong with thinking switched off entirely, which is unusual — most reasoning models degrade sharply without it. Context compaction summarises older turns automatically as a conversation approaches its limit, extending how far a session can run.

Claude Sonnet 4.6
The Sonnet generation that reached a million tokens and began preserving its own reasoning. Released 17 February 2026.
Thinking Blocks Now Persist
This is the change most likely to alter your token consumption without producing any error, and it is worth understanding before you migrate anything.
Anthropic documents a per-model split in how conversation history is handled:
Sonnet 4.6 and later Sonnet models keep previous thinking blocks by default. They travel with the conversation and count toward the context window exactly like any other input token.
Sonnet 4.5 and earlier strip them automatically when you pass them back, preserving capacity for the conversation itself.
So the same multi-turn code, unchanged, consumes context differently across that boundary. A session that comfortably fit before can grow faster than expected here — not because anything broke, but because reasoning that used to vanish now accumulates.
What it buys you. Consistency. A model that carries its earlier analysis forward reaches turn twelve reasoning from turn one, rather than reconstructing a slightly different version of it each time. On long agentic sessions those small divergences are what produce contradictory conclusions.
What it costs. Input tokens, on every subsequent turn.
Anthropic provides an override in either direction through thinking block clearing, so the default is a starting point rather than a constraint.
Extended Thinking Is Deprecated Here
The model's own specification sheet reads Adaptive (extended deprecated) — both modes work, one is on its way out.
Adaptive thinking is the current mechanism: the model decides when and how deeply to reason, and
the effort parameter sets the ceiling.
Extended thinking is the older manual approach with an explicit token budget. It still functions on this model. It is marked deprecated in the documentation.
If you are carrying thinking: {"type": "enabled", "budget_tokens": N} across from an earlier
model, it will run — and it is code with a shelf life. Moving to adaptive thinking with an effort
level is the migration that does not need repeating later.
Strong With Thinking Off
Worth calling out, because it runs against the pattern.
Anthropic states that this model performs well at any thinking effort, including with extended thinking switched off entirely — and their own benchmark reporting includes results measured with thinking disabled, which is not something a vendor does when the number embarrasses them.
Most reasoning models degrade sharply without deliberation. This one does not, which gives you a genuinely usable fast path on the same model: no reasoning for the routine work, effort raised for the parts that need it, one model ID throughout.
Their migration guidance is to explore the full spectrum rather than picking a level and leaving it.
Context Compaction
Available in beta: older context is summarised automatically as a conversation approaches its limit, extending how far a session can run beyond what the raw window allows.
On a model that also preserves thinking blocks, this pairing matters more than it would elsewhere. Preserved reasoning accumulates; compaction is what keeps that accumulation from ending the session.
Anthropic's own evaluation runs used compaction triggered at 50,000 tokens, scaling to millions of total tokens across a task — a concrete indication of how it is meant to be used.
Specifications
| Model ID | anthropic/claude-sonnet-4-6 |
| Context window | 1,000,000 tokens |
| Max output | 128,000 tokens |
| Max output (Batch API, beta) | 300,000 tokens |
| Thinking | Adaptive — extended mode deprecated |
| Default effort | high |
| Thinking block retention | Preserved by default |
| Input → output | Text and images → text |
| Reliable knowledge cutoff | August 2025 |
| Training data cutoff | January 2026 |
| Released | 17 February 2026 |
| Status | Active (legacy) |
Anthropic publishes no parameter counts, architecture, or weights for Claude models.
Capabilities
| Capability | Value |
|---|---|
input_types | text, image |
output_types | text |
audio_input | Not supported |
video_input | Not supported |
context_window | 1000000 |
max_output_tokens | 128000 |
reasoning | Adaptive — extended deprecated |
effort_levels | low, medium, high, xhigh, max |
thinking_history | Preserved by default, overridable |
context_compaction | Beta |
streaming | Supported |
tool_calling | Supported |
structured_output | Supported |
requires_prompt | Yes — text prompt required, image optional |
Using Claude Sonnet 4.6 on DEVUP AI
Base URL: https://api.devupai.com/v1 · Model ID: anthropic/claude-sonnet-4-6
First request — cURL
curl https://api.devupai.com/v1/chat/completions \
-H "Authorization: Bearer $DEVUP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-sonnet-4-6",
"messages": [
{
"role": "user",
"content": "A CIB payment confirms at the gateway but our order table still shows unpaid about once per thousand transactions, with nothing in the error log. Rank the mechanisms that would produce a silent gap like that."
}
],
"max_tokens": 16384
}'Watching context grow across turns — Python
The measurement that makes preserved thinking visible.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["DEVUP_API_KEY"],
base_url="https://api.devupai.com/v1",
)
thread = [{"role": "user", "content": "Outline three approaches to sharding this order table."}]
for turn, follow_up in enumerate(
[
None,
"Take the second approach and describe the migration path.",
"What breaks if we run both schemes during the transition?",
],
start=1,
):
if follow_up:
thread.append({"role": "user", "content": follow_up})
reply = client.chat.completions.create(
model="anthropic/claude-sonnet-4-6",
messages=thread,
max_tokens=16384,
)
thread.append(reply.choices[0].message)
usage = reply.usage
print(f"turn {turn}: in {usage.prompt_tokens:>7,} · out {usage.completion_tokens:>6,}")Run this once against a real conversation and the growth pattern becomes concrete. Input tokens rise faster than the visible text alone would explain — that difference is the preserved reasoning, and knowing its shape is what lets you budget for a long session rather than discovering the cost at the end of one.
A fast path on the same model — Python
What "strong with thinking off" makes possible.
def ask(prompt: str, *, effort: str | None = None, max_tokens: int = 8192) -> str:
"""Send a request, raising effort only where the task justifies it."""
payload = {
"model": "anthropic/claude-sonnet-4-6",
"messages": [{"role": "user", "content": prompt}],
"max_tokens": max_tokens,
}
if effort:
payload["extra_body"] = {"output_config": {"effort": effort}}
return client.chat.completions.create(**payload).choices[0].message.content
# Routine classification.
ask(f"Which department owns this ticket?\n\n{ticket}", effort="low", max_tokens=32)
# Something that actually needs working through.
ask("Why would our reconciliation job double-count refunds issued in the same minute as the charge?", effort="high")On most reasoning models the low end is a compromise. Here it is a legitimate operating point, which means one model ID can serve both halves of an application without the quality cliff that usually forces a second integration.
Whole-corpus analysis — Python
The million-token window doing what it is for.
from pathlib import Path
corpus = "\n\n---\n\n".join(
f"### {path.name}\n{path.read_text(encoding='utf-8')}"
for path in sorted(Path("agreements").glob("*.txt"))
)
reply = client.chat.completions.create(
model="anthropic/claude-sonnet-4-6",
messages=[
{
"role": "system",
"content": (
"Review this set of supplier agreements. Identify every obligation stated in one "
"document that contradicts an obligation in another. Quote both clauses and name "
"both files. Report only conflicts you can quote."
),
},
{"role": "user", "content": corpus},
],
max_tokens=32768,
)
print(reply.choices[0].message.content)Sending the set whole is the point. A contradiction between the third document and the eleventh is invisible to any pipeline that reads them one at a time, and catching exactly that kind of relationship is why the window exists.
A long agent session — Python
Where preserved thinking and compaction work together.
import json
TOOLS = [
{
"type": "function",
"function": {
"name": "read_file",
"description": "Read a file relative to the repository root.",
"parameters": {
"type": "object",
"properties": {"path": {"type": "string"}},
"required": ["path"],
},
},
},
{
"type": "function",
"function": {
"name": "run_tests",
"description": "Run the test suite and return pass/fail counts with failure output.",
"parameters": {"type": "object", "properties": {}},
},
},
]
def read_file(path: str) -> dict:
"""Replace with your real, sandboxed file access."""
raise NotImplementedError
def run_tests() -> dict:
"""Replace with your real, sandboxed test runner."""
raise NotImplementedError
HANDLERS = {"read_file": read_file, "run_tests": run_tests}
session = [
{
"role": "system",
"content": "Work inside this repository. Make the smallest change that fixes the problem, and run the tests after each edit.",
},
{"role": "user", "content": "Invoice totals ending in .005 round down. The DZD test catches it. Fix the rounding."},
]
CEILING = 30
for step in range(CEILING):
reply = client.chat.completions.create(
model="anthropic/claude-sonnet-4-6",
messages=session,
tools=TOOLS,
max_tokens=16384,
)
message = reply.choices[0].message
session.append(message) # reasoning travels with the object
if not message.tool_calls:
print(message.content)
break
for call in message.tool_calls:
handler = HANDLERS.get(call.function.name)
if handler is None:
outcome = {"error": "unknown tool", "name": call.function.name}
else:
try:
outcome = handler(**json.loads(call.function.arguments or "{}"))
except Exception as exc:
# Report the failure as data — the model works around it.
outcome = {"error": type(exc).__name__, "detail": str(exc)}
session.append({"role": "tool", "tool_call_id": call.id, "content": json.dumps(outcome)})
else:
print(f"Stopped at the {CEILING}-step ceiling.")Appending the message object as returned — rather than rebuilding it from content — is what makes
preservation function. Reconstruct it by hand and the reasoning never reaches the next turn,
defeating the behaviour you migrated for.
CEILING is what ends a session that will not end on its own.
Reading a document — Python
import base64
with open("bank_statement.png", "rb") as handle:
encoded = base64.b64encode(handle.read()).decode("utf-8")
reply = client.chat.completions.create(
model="anthropic/claude-sonnet-4-6",
messages=[
{
"role": "user",
"content": [
{"type": "image_url", "image_url": {"url": f"data:image/png;base64,{encoded}"}},
{
"type": "text",
"text": (
"List every transaction with its date, description, and amount. Mark any "
"line you cannot read cleanly as unreadable rather than reconstructing it."
),
},
],
}
],
max_tokens=8192,
)Asking it to flag unreadable lines rather than reconstruct them is worth the extra sentence. A reconstructed amount looks identical to a transcribed one and fails silently in a reconciliation.
Node.js — DEVUP AI SDK
npm install devupaiimport DevupAI from "devupai";
const client = new DevupAI({
apiKey: process.env.DEVUP_API_KEY,
});
const reply = await client.chat.completions.create({
model: "anthropic/claude-sonnet-4-6",
messages: [
{
role: "system",
content:
"Summarise this support thread for handover. State what was tried, what remains " +
"unresolved, and what the customer is waiting on.",
},
{ role: "user", content: thread },
],
max_tokens: 8192,
});
console.log(reply.choices[0]?.message?.content);Streaming
stream = client.chat.completions.create(
model="anthropic/claude-sonnet-4-6",
messages=[{"role": "user", "content": "Explain when a shared cart store makes sticky sessions unnecessary — and when it does not."}],
max_tokens=16384,
stream=True,
)
for chunk in stream:
if not chunk.choices:
if getattr(chunk, "usage", None):
print(f"\n\nin {chunk.usage.prompt_tokens:,} · out {chunk.usage.completion_tokens:,}")
continue
piece = chunk.choices[0].delta
if getattr(piece, "content", None):
print(piece.content, end="", flush=True)Migrating From Here
Two directions worth considering, with different reasons.
To Sonnet 5, the current model in this line: knowledge moves five months forward, from August 2025 to January 2026. The window and output ceiling are unchanged, so capacity is not the argument.
One thing to check before you go: Sonnet 5 rejects temperature, top_p, and top_k outright,
returning a 400 for any non-default value. A shared request builder that attaches a temperature works
here and fails there.
Staying here is reasonable when something downstream was tuned against this model, or when the deprecated extended-thinking path is load-bearing in code you are not ready to change.
Moving off extended thinking is worth doing regardless of which model you end up on. It is marked deprecated here, and adaptive thinking with an effort level is the interface that carries forward.
Choosing This Model
It fits conversational products at volume, long multi-turn sessions where consistency across turns matters, corpus-scale document work, and agent roles at either level — lead or sub-agent.
Its distinguishing property is holding up with thinking off. If your application has a fast path and a careful path, this model serves both without a second integration.
Move up when reasoning depth is the limiting factor, or when knowledge more recent than August 2025 would change your answers.
Limitations
Preserved thinking grows input tokens on every turn. That is the trade for consistency, and it changes the cost profile of long sessions relative to earlier Sonnet models.
Extended thinking is deprecated. It works; it is not the path forward.
Reliable knowledge stops at August 2025. Anything later needs retrieval or a search tool.
Text and images only. No audio, no video, no image generation.
Marked legacy by Anthropic, with a current model available in the same line.
Context compaction is beta, which means its behaviour may change.
Internals are undisclosed — no parameter count, no architecture, no weights.
A consistent answer is not a verified one. Preserved reasoning makes a long session coherent, not correct. Check anything that will act on a system of record.