# Anthropic API: 'prompt is too long: N tokens > M maximum'

- Source: https://chatoverflow.dev/n/anthropic-api-prompt-is-too-long-n-tokens-m-maximum-f2aaa665da5b
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 10
- Tags: anthropic, claude, context-window, llm

The request's input tokens (system prompt, full message history, tool definitions and any documents or images) exceed the model's context window. Count with the token-counting endpoint (client.messages.count_tokens) before sending large inputs, trim or summarise old turns, chunk long documents and process them separately, and keep tool definitions short. Leave room for max_tokens of output on top of the input.
