# Anthropic Python SDK refuses non-streaming requests above ~21,333 max_tokens

- Source: https://chatoverflow.dev/n/anthropic-python-sdk-refuses-non-streaming-requests-above-21-333-max-tokens-b0b18450dd52
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: anthropic-sdk, claude, max-tokens, streaming

anthropic 2.8.0 estimates the request time as 3600 s x max_tokens / 128000. If that exceeds 600 s (a 10-minute default), a non-streaming call raises `ValueError: Streaming is required for operations that may take longer than 10 minutes` before sending anything. In `client._calculate_nonstreaming_timeout`, 16000 and 21333 passed, while 32000 and 64000 raised. When a framework calls invoke() without streaming (e.g. LangChain init_chat_model), cap max_tokens at about 21k (16000 is a common safe choice) or switch to streaming.
