All insights

Coding agents

Claude Code Context Window: Size, Limits, and How to Check

Claude Code has no single context-window size for every setup. See a verified 1M-token Claude Code option, its access conditions, how to inspect session usage, and how an API model’s limits differ.

Illustration for Context window claude code

Short answer

There isn’t one context-window size for every Claude Code setup. Anthropic’s paid-plan documentation lists 1 million tokens for Claude Opus 4.6 in Claude Code. To select it, use /model and choose claude-opus-4-6 [1m]; on Pro, usage credits must be enabled. Anthropic lists a different context size for some other models and surfaces, so check the row for your model rather than assuming the Opus figure applies to every session. (Anthropic Help Center)

For example, the Claude API model claude-sonnet-5-5 has a documented 1M-token context window and a separate 128K maximum output. That API specification does not by itself establish which model or capacity your Claude Code session is using. (Claude Sonnet 5.5 model reference)

Check the capacity for your Claude Code setup

  1. Check the runtime. Confirm whether you are using Claude Code through Anthropic or through a cloud provider or gateway. Model names and availability can differ between providers. (Claude Code model configuration)
  2. Identify the selected model. In Claude Code, use /model. The paid-plan table documents the 1M Opus 4.6 option as claude-opus-4-6 [1m]; on Pro, usage credits are required. (Anthropic Help Center)
  3. Inspect current usage. /context shows what is occupying the current session’s context. Treat it as a usage breakdown, not as the source for the model’s documented maximum; check the model and its applicable limit separately. (Claude Code configuration debugging)
  4. Check whether 1M context is disabled. Claude Code documents CLAUDE_CODE_DISABLE_1M_CONTEXT=1 as a setting that keeps sessions at a 200K window and removes [1m] model variants from the model picker. (Claude Code model configuration)
Runtime and model Documented context Important condition
Claude Code: Claude Opus 4.6 1M tokens Select claude-opus-4-6 [1m]; Pro requires usage credits. The setting CLAUDE_CODE_DISABLE_1M_CONTEXT=1 keeps sessions at 200K.
Claude API: claude-sonnet-5-5 1M tokens Maximum output is separately limited to 128K tokens. Verify availability for the API platform you intend to use.

These are examples, not a universal model list. If you use a managed provider or gateway, confirm that the model and context option are available on that path. (Claude Code model configuration; Claude Sonnet 5.5 model reference)

What uses context?

A context window covers the text a model can reference while responding, including the response being generated. In Claude Code, session material such as instructions, files, tool information, and conversation content can occupy context; use /context to inspect the current breakdown. A large headline limit is not the same as an equal amount of room for your prompt or code. (Claude Platform context-window guide; Claude Code configuration debugging)

For the API example above, 1M is the context-window limit, while 128K is the model’s maximum output. Output is part of the context window, so do not treat those limits as additive or assume all 1M tokens are available for input. (Claude Sonnet 5.5 model reference; Claude Platform context-window guide)

Choosing between Claude Code and a production API model

For an interactive Claude Code session, check the selected model and the session’s current usage. For a production API workload, check the exact API model ID and its context and output limits, then count a representative request.

Anthropic’s Messages API token-counting endpoint is POST /v1/messages/count_tokens. It estimates input tokens for supported request content, including tools, images, and PDFs. It does not accept some inputs the Messages API supports, including server tools, the MCP connector, or image and document blocks supplied by URL or file. For requests using server tools or MCP servers, inspect the usage object returned by an actual Messages API response as well. (Token-counting guide; Count tokens API reference)

Decision guide:

  • Coding in Claude Code: identify the active model, confirm its available context option, and use /context to see what is occupying the session.
  • Production API requests: verify the model ID and limits on the intended API platform, count representative supported inputs, and check actual usage for requests that include unsupported counting inputs.
  • Either runtime: keep the working set relevant and include the output your task needs when deciding whether a model’s limits are suitable.

A larger window offers more capacity, but does not guarantee better results. Anthropic notes that accuracy and recall can degrade as context grows, so curate the material you send rather than relying only on the maximum. (Claude Platform context-window guide)

Quick checklist

  • Identify whether the workload runs in Claude Code or through the API.
  • Check the actual model, not just an assumed default.
  • For Claude Code, verify the model’s documented context option and any access condition; inspect current usage with /context.
  • Check whether CLAUDE_CODE_DISABLE_1M_CONTEXT=1 is set if a 1M option is unavailable.
  • For API workloads, verify both the context window and maximum output for the exact model ID.
  • Count representative supported API inputs, and use returned API usage for server-tool or MCP requests.

Model availability and access conditions can change. This guide reflects Anthropic documentation consulted on November 10, 2026.

Sources

How large is the context window on paid Claude plans?

Model configuration — Claude Code Docs

Debug your configuration — Claude Code Docs

Claude Sonnet 5.5 — Claude Platform Docs

Context windows — Claude Platform Docs

Token counting — Claude Platform Docs

Count tokens in a Message — Claude API Reference

Contact us