- Symptom
- Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more detailsFails as soon as max_tokens is raised, and no request reaches the APIA per-request timeout does not lift the error on @anthropic-ai/sdk before 0.117.0
- Cause
- The SDKs estimate a non-streaming call's duration from max_tokens and refuse when it could pass 10 minutes. In the TypeScript SDK the estimate is 3600 times max_tokens divided by 128,000 seconds, so max_tokens above about 21,333 trips it, and some models set a lower non-streaming token cap.
- Fix
- Use the streaming helper and read the final message, or move long jobs to the Message Batches API. On old TypeScript SDKs set the timeout on the client rather than per request, or upgrade to 0.117.0 or later.
- Apply
const msg = await client.messages.stream({ model, max_tokens: 64000, messages }).finalMessage(); # Python: with client.messages.stream(model=model, max_tokens=64000, messages=messages) as s: msg = s.get_final_message()- Affected
- @anthropic-ai/sdk and anthropic Python SDK, non-streaming messages.create, as of 2026-10; request-level timeout fix in @anthropic-ai/sdk 0.117.0
- Sources
Last verified 2026-10-15 · Confirmed by 0 builders