@tanstack/ai-anthropic 0.15.13 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -154,6 +154,70 @@ export interface AnthropicAdaptiveThinkingOptions {
154
154
  }
155
155
  }
156
156
 
157
+ /**
158
+ * Thinking configuration for models where thinking is always on
159
+ * (e.g. Claude Fable 5).
160
+ *
161
+ * On these models the only accepted explicit configuration is
162
+ * `{type: 'adaptive'}` — both `{type: 'disabled'}` and
163
+ * `{type: 'enabled', budget_tokens}` are rejected with a 400. Omitting the
164
+ * `thinking` field entirely also runs adaptive thinking.
165
+ */
166
+ export interface AnthropicAdaptiveOnlyThinkingOptions {
167
+ thinking?: {
168
+ type: 'adaptive'
169
+ /**
170
+ * Controls what (if any) thinking content is streamed back.
171
+ *
172
+ * - `'summarized'`: stream summarized thinking via `thinking_delta`
173
+ * events (the user-visible reasoning text).
174
+ * - `'omitted'` (default): stream the thinking block's
175
+ * `signature_delta` only (no reasoning text reaches the client).
176
+ */
177
+ display?: 'summarized' | 'omitted'
178
+ }
179
+ }
180
+
181
+ /**
182
+ * Thinking configuration for models that accept adaptive thinking or an
183
+ * explicit opt-out, but no manual token budget (e.g. Claude Sonnet 5,
184
+ * Claude Opus 4.7/4.8).
185
+ *
186
+ * `{type: 'enabled', budget_tokens}` is rejected with a 400 on these
187
+ * models. On Claude Sonnet 5, omitting the `thinking` field runs adaptive
188
+ * thinking by default; on Opus 4.7/4.8 it runs without thinking — set
189
+ * `{type: 'adaptive'}` explicitly there.
190
+ */
191
+ export interface AnthropicAdaptiveOrDisabledThinkingOptions {
192
+ thinking?:
193
+ | {
194
+ type: 'adaptive'
195
+ /**
196
+ * Controls what (if any) thinking content is streamed back.
197
+ * Defaults to `'omitted'` — set `'summarized'` to receive the
198
+ * reasoning text.
199
+ */
200
+ display?: 'summarized' | 'omitted'
201
+ }
202
+ | {
203
+ type: 'disabled'
204
+ }
205
+ }
206
+
207
+ /**
208
+ * `max_tokens` on its own, for models that reject the sampling parameters
209
+ * (`temperature`, `top_p`, `top_k`) — e.g. Claude Fable 5 and Claude Opus
210
+ * 4.7/4.8 reject them outright, and Claude Sonnet 5 returns a 400 when a
211
+ * non-default sampling value is sent.
212
+ */
213
+ export interface AnthropicMaxTokensOptions {
214
+ /**
215
+ * The maximum number of tokens to generate before stopping. This parameter only specifies the absolute maximum number of tokens to generate. Required by the API; the adapter defaults to 1024 when omitted.
216
+ * Range x >= 1.
217
+ */
218
+ max_tokens?: number
219
+ }
220
+
157
221
  export interface AnthropicEffortOptions {
158
222
  /**
159
223
  * Controls the thinking depth for adaptive thinking mode (Opus 4.6+).
@@ -182,7 +246,11 @@ export interface AnthropicOutputConfigOptions {
182
246
  * preserved when the engine adds `format`.
183
247
  */
184
248
  output_config?: {
185
- effort?: 'low' | 'medium' | 'high' | 'max' | null
249
+ /**
250
+ * `'xhigh'` is accepted on Claude Opus 4.7+, Claude Sonnet 5, and
251
+ * Claude Fable 5; older models support `'low'`–`'max'` only.
252
+ */
253
+ effort?: 'low' | 'medium' | 'high' | 'xhigh' | 'max' | null
186
254
  }
187
255
  }
188
256
 
@@ -275,7 +343,7 @@ export interface InternalTextProviderOptions extends ExternalTextProviderOptions
275
343
  * cast.
276
344
  */
277
345
  output_config?: {
278
- effort?: 'low' | 'medium' | 'high' | 'max' | null
346
+ effort?: 'low' | 'medium' | 'high' | 'xhigh' | 'max' | null
279
347
  format?: {
280
348
  type: 'json_schema'
281
349
  schema: Record<string, unknown>