TanStack
OSS
ai
Sign in / Sign up
Open main menu
ai
GitHub
Overview
Runs
Analytics
Loading workspace stats
Loading workspace insights...
Statistics interval
7 days
30 days
Latest CI Pipeline Executions
Status
Fix filter
Filter
Fuzzy
Filter range
Sort by
Sort by
Start time
Sort ascending
Sort descending
Succeeded
849-ai-anthropic-max_tokens-defaults-to-1024-silently-truncating-responses-when-caller-doesnt-set-it
a58464a1 fix(anthropic): clamp non-streaming structured-output max_tokens default (#849) The #849 default of the model's full output ceiling broke the non-streaming `structuredOutput()` path: the Anthropic SDK refuses a non-streaming request whose `max_tokens` could exceed its 10-minute timeout (~21,333 tokens), so `chat({ outputSchema })` on any fallback-path model threw "Streaming is required for operations that may take longer than 10 minutes". `getAnthropicDefaultMaxTokens(model, { stream })` now clamps the default to `ANTHROPIC_MAX_NONSTREAMING_TOKENS` when `stream: false`; the streaming chat path keeps the model's full ceiling. An explicit oversized `max_tokens` still surfaces the SDK's "use streaming" error. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
by Tom Beckenham
T
Succeeded
849-ai-anthropic-max_tokens-defaults-to-1024-silently-truncating-responses-when-caller-doesnt-set-it
a58464a1 Merge aee6dd1c9af5a7d1c5b3581964f56ba49f378fb9 into 301adc3529992e7ebf0a04283f1359595f899f4f
by Tom Beckenham
T
Succeeded
849-ai-anthropic-max_tokens-defaults-to-1024-silently-truncating-responses-when-caller-doesnt-set-it
1f65f9b0 fix(anthropic): default max_tokens to the model's output ceiling (#849) Anthropic's Messages API requires `max_tokens`, so the text adapter must always send a value. It previously hard-coded `?? 1024` when the caller didn't pass one, silently truncating any non-trivial generation mid-stream with `stop_reason: "max_tokens"`. Now default to the resolved model's real `max_output_tokens` from model-meta (e.g. 64K Sonnet, 128K Opus), falling back to 64K for unrecognized ids. `max_tokens` is a ceiling, not a reservation, so this costs nothing extra. Also log a warning when a response is truncated while using the defaulted cap, so it isn't silently read as the model "doing nothing"; callers that set `max_tokens` explicitly are unaffected. The new id -> max_output_tokens map is kept in lockstep with ANTHROPIC_MODELS by `scripts/sync-provider-models.ts`, so a freshly-synced model resolves to its real ceiling rather than the fallback. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
by Tom Beckenham
T
Succeeded
849-ai-anthropic-max_tokens-defaults-to-1024-silently-truncating-responses-when-caller-doesnt-set-it
1f65f9b0 Merge f4689283bd3b32984e031f5961101e61b7d0a71b into 33acdd4df4aef13d594700d9b52087252091bd40
by Tom Beckenham
T
Previous page
Previous
Next
Next page