API Features & Capabilities

1M-Token Context: Loading, Ordering, and Navigating Large Inputs

A million tokens is roughly 555,000 words on the current tokenizer — an entire codebase, a due-diligence data room, a year of support tickets. Using that window well is a matter of ordering, caching, and cost discipline.

Claude 3P 101 · Updated July 2026 · Unofficial guide

Claude Fable 5, Opus 4.8, and Sonnet 5 (along with Opus 4.7/4.6 and Sonnet 4.6) all carry a 1M-token context window as the default — no beta header, no opt-in. Claude Haiku 4.5 is the exception at 200K. Crucially, there is no long-context price premium: a 900K-token request bills at the same per-token rate as a 9K-token request, and prompt caching and batch discounts apply across the full window. The window is generally available on the Claude API, Claude Platform on AWS, Amazon Bedrock, Google Vertex AI, and Microsoft Foundry.

Know what fills the window

Everything counts: the system prompt, every message (including tool results, images, and documents), tool definitions, and the generated output including extended thinking. Cached prefixes still occupy the window — caching changes what you pay, not whether tokens count. One planning wrinkle: Fable 5, Opus 4.8/4.7, and Sonnet 5 use a newer tokenizer that produces roughly 30% more tokens for the same text than the previous generation, so 1M tokens holds about 555K words (~2.5M characters) rather than the ~750K words the older tokenizer managed. Re-baseline any "will it fit?" math when you change models, and use the free token counting endpoint to measure rather than estimate.

Ordering: longform data first, question last

Anthropic's long-context guidance (for inputs of ~20K tokens and up) is consistent: put the longform data at the top of the prompt, above your query, instructions, and examples. Placing the query at the end can improve response quality by up to 30% in Anthropic's testing. Structure helps too — wrap each document in <document> tags with <document_content> and <source> subtags, so Claude can navigate and reference the pile:

<documents>
  <document>
    <source>contracts/msa-acme-2025.pdf</source>
    <document_content>...</document_content>
  </document>
  ...
</documents>

Which contracts allow termination for convenience? Cite the source.

This "context first, needle-seeking question last" shape matters more as the window grows: the model reads your question with all the evidence already loaded. If you need verifiable pointers back into the pile rather than prose answers, enable citations on the document blocks. And note that images and PDFs share the window — a single request can include up to 600 images or PDF pages on 1M-context models, and dense PDFs can fill the window before hitting the page limit.

Cost management: the window is cheap to have, expensive to resend

At Opus 4.8's $5 per million input tokens, one full-window request costs about $5 of input; at Fable 5's $10, about $10. That is fine once — ruinous if you resend the same 900K tokens on every turn of a conversation. Three tools keep it sane:

When you overflow anyway

Input alone exceeding the window returns a 400 invalid_request_error ("prompt is too long"). On Claude 4.5+ models, input plus max_tokens exceeding the window is accepted, and generation stops at the boundary with stop_reason: "model_context_window_exceeded". For long-running conversations that grow without bound, the escape valves are server-side compaction (summarize old turns) and context editing (drop stale tool results) — both beta.

Rule of thumb: big static corpus + small changing question = cache the corpus, append the question. If the "corpus" changes every request, reconsider whether retrieval (sending only relevant chunks) beats brute-force loading.

Where to go next

See prompt cache mechanics for the caching details that make long context affordable, and conversation history sizing for multi-turn growth. The feature matrix covers platform support.

Sources