@ai-sdk/anthropic 4.0.0-beta.29 → 4.0.0-beta.31
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.
- package/CHANGELOG.md +13 -0
- package/dist/index.d.ts +11 -1
- package/dist/index.js +103 -16
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +3 -1
- package/dist/internal/index.js +102 -15
- package/dist/internal/index.js.map +1 -1
- package/docs/05-anthropic.mdx +72 -2
- package/package.json +3 -3
- package/src/anthropic-messages-language-model.ts +86 -9
- package/src/anthropic-messages-options.ts +23 -1
package/docs/05-anthropic.mdx
CHANGED
|
@@ -122,10 +122,14 @@ The following optional provider options are available for Anthropic models:
|
|
|
122
122
|
If you are experiencing issues with the model handling requests involving
|
|
123
123
|
reasoning content, you can set this to `false` to omit them from the request.
|
|
124
124
|
|
|
125
|
-
- `effort` _"
|
|
125
|
+
- `effort` _"low" | "medium" | "high" | "xhigh" | "max"_
|
|
126
126
|
|
|
127
127
|
Optional. See [Effort section](#effort) for more details.
|
|
128
128
|
|
|
129
|
+
- `taskBudget` _object_
|
|
130
|
+
|
|
131
|
+
Optional. See [Task Budgets section](#task-budgets) for more details.
|
|
132
|
+
|
|
129
133
|
- `speed` _"fast" | "standard"_
|
|
130
134
|
|
|
131
135
|
Optional. See [Fast Mode section](#fast-mode) for more details.
|
|
@@ -187,7 +191,7 @@ const result = streamText({
|
|
|
187
191
|
|
|
188
192
|
### Effort
|
|
189
193
|
|
|
190
|
-
Anthropic introduced an `effort` option with `claude-opus-4-5` that affects thinking, text responses, and function calls. Effort defaults to `high` and you can set it to `medium` or `low` to save tokens and to lower time-to-last-token latency (TTLT).
|
|
194
|
+
Anthropic introduced an `effort` option with `claude-opus-4-5` that affects thinking, text responses, and function calls. Effort defaults to `high` and you can set it to `medium` or `low` to save tokens and to lower time-to-last-token latency (TTLT). `claude-opus-4-7` additionally supports `xhigh` for maximum reasoning effort.
|
|
191
195
|
|
|
192
196
|
```ts highlight="8-10"
|
|
193
197
|
import { anthropic, AnthropicLanguageModelOptions } from '@ai-sdk/anthropic';
|
|
@@ -228,6 +232,46 @@ const { text } = await generateText({
|
|
|
228
232
|
|
|
229
233
|
The `speed` option accepts `'fast'` or `'standard'` (default behavior).
|
|
230
234
|
|
|
235
|
+
### Task Budgets
|
|
236
|
+
|
|
237
|
+
`claude-opus-4-7` supports a `taskBudget` option that informs the model of the total token budget available for an agentic turn. The model uses this information to prioritize work, plan ahead, and wind down gracefully as the budget is consumed.
|
|
238
|
+
|
|
239
|
+
Task budgets are advisory — they do not enforce a hard token limit. The model will attempt to stay within budget, but actual usage may vary.
|
|
240
|
+
|
|
241
|
+
```ts highlight="8-13"
|
|
242
|
+
import { anthropic, AnthropicLanguageModelOptions } from '@ai-sdk/anthropic';
|
|
243
|
+
import { generateText } from 'ai';
|
|
244
|
+
|
|
245
|
+
const { text } = await generateText({
|
|
246
|
+
model: anthropic('claude-opus-4-7'),
|
|
247
|
+
prompt: 'Research the pros and cons of Rust vs Go for building CLI tools.',
|
|
248
|
+
providerOptions: {
|
|
249
|
+
anthropic: {
|
|
250
|
+
taskBudget: {
|
|
251
|
+
type: 'tokens',
|
|
252
|
+
total: 400000,
|
|
253
|
+
},
|
|
254
|
+
} satisfies AnthropicLanguageModelOptions,
|
|
255
|
+
},
|
|
256
|
+
});
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
For long-running agents that compact and restart context, you can carry the remaining budget forward using the `remaining` field:
|
|
260
|
+
|
|
261
|
+
```ts
|
|
262
|
+
taskBudget: {
|
|
263
|
+
type: 'tokens',
|
|
264
|
+
total: 400000,
|
|
265
|
+
remaining: 215000, // budget left after prior compacted-away contexts
|
|
266
|
+
}
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
The `taskBudget` object accepts:
|
|
270
|
+
|
|
271
|
+
- `type` _"tokens"_ - Budget type. Currently only `"tokens"` is supported.
|
|
272
|
+
- `total` _number_ - Total task budget for the agentic turn. Minimum 20,000.
|
|
273
|
+
- `remaining` _number_ - Budget left after prior compacted-away contexts. Must be between 0 and `total`. Defaults to `total` if omitted.
|
|
274
|
+
|
|
231
275
|
### Data Residency
|
|
232
276
|
|
|
233
277
|
Anthropic supports an [`inferenceGeo` option](https://platform.claude.com/docs/en/build-with-claude/data-residency) that controls where model inference runs for a request.
|
|
@@ -292,6 +336,31 @@ const { text } = await generateText({
|
|
|
292
336
|
});
|
|
293
337
|
```
|
|
294
338
|
|
|
339
|
+
##### Thinking Display (Opus 4.7+)
|
|
340
|
+
|
|
341
|
+
Starting with `claude-opus-4-7`, thinking content is omitted from the response by default — thinking blocks are present in the stream but their text is empty. To receive reasoning output, set `display: 'summarized'`:
|
|
342
|
+
|
|
343
|
+
```ts highlight="5"
|
|
344
|
+
const { text, reasoningText } = await generateText({
|
|
345
|
+
model: anthropic('claude-opus-4-7'),
|
|
346
|
+
providerOptions: {
|
|
347
|
+
anthropic: {
|
|
348
|
+
thinking: { type: 'adaptive', display: 'summarized' },
|
|
349
|
+
} satisfies AnthropicLanguageModelOptions,
|
|
350
|
+
},
|
|
351
|
+
prompt: 'How many people will live in the world in 2040?',
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
console.log(reasoningText); // reasoning text (empty without display: 'summarized')
|
|
355
|
+
console.log(text);
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
<Note>
|
|
359
|
+
If you stream reasoning to users with `claude-opus-4-7`, the default `"omitted"` display will
|
|
360
|
+
cause a long pause before output begins. Set `display: "summarized"` to restore visible
|
|
361
|
+
progress during thinking.
|
|
362
|
+
</Note>
|
|
363
|
+
|
|
295
364
|
#### Budget-Based Thinking
|
|
296
365
|
|
|
297
366
|
For earlier models (`claude-opus-4-20250514`, `claude-sonnet-4-20250514`, `claude-sonnet-4-5-20250929`),
|
|
@@ -1376,6 +1445,7 @@ and the `mediaType` should be set to `'application/pdf'`.
|
|
|
1376
1445
|
|
|
1377
1446
|
| Model | Image Input | Object Generation | Tool Usage | Computer Use | Web Search | Tool Search | Compaction |
|
|
1378
1447
|
| ------------------- | ------------------- | ------------------- | ------------------- | ------------------- | ------------------- | ------------------- | ------------------- |
|
|
1448
|
+
| `claude-opus-4-7` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
1379
1449
|
| `claude-opus-4-6` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
1380
1450
|
| `claude-sonnet-4-6` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | |
|
|
1381
1451
|
| `claude-opus-4-5` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/anthropic",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.31",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@ai-sdk/provider
|
|
39
|
-
"@ai-sdk/provider": "
|
|
38
|
+
"@ai-sdk/provider": "4.0.0-beta.12",
|
|
39
|
+
"@ai-sdk/provider-utils": "5.0.0-beta.22"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/node": "20.17.24",
|
|
@@ -293,9 +293,38 @@ export class AnthropicMessagesLanguageModel implements LanguageModelV4 {
|
|
|
293
293
|
maxOutputTokens: maxOutputTokensForModel,
|
|
294
294
|
supportsStructuredOutput: modelSupportsStructuredOutput,
|
|
295
295
|
supportsAdaptiveThinking,
|
|
296
|
+
rejectsSamplingParameters,
|
|
297
|
+
supportsXhighEffort,
|
|
296
298
|
isKnownModel,
|
|
297
299
|
} = getModelCapabilities(this.modelId);
|
|
298
300
|
|
|
301
|
+
if (rejectsSamplingParameters) {
|
|
302
|
+
if (temperature != null) {
|
|
303
|
+
warnings.push({
|
|
304
|
+
type: 'unsupported',
|
|
305
|
+
feature: 'temperature',
|
|
306
|
+
details: `temperature is not supported by ${this.modelId} and will be ignored`,
|
|
307
|
+
});
|
|
308
|
+
temperature = undefined;
|
|
309
|
+
}
|
|
310
|
+
if (topK != null) {
|
|
311
|
+
warnings.push({
|
|
312
|
+
type: 'unsupported',
|
|
313
|
+
feature: 'topK',
|
|
314
|
+
details: `topK is not supported by ${this.modelId} and will be ignored`,
|
|
315
|
+
});
|
|
316
|
+
topK = undefined;
|
|
317
|
+
}
|
|
318
|
+
if (topP != null) {
|
|
319
|
+
warnings.push({
|
|
320
|
+
type: 'unsupported',
|
|
321
|
+
feature: 'topP',
|
|
322
|
+
details: `topP is not supported by ${this.modelId} and will be ignored`,
|
|
323
|
+
});
|
|
324
|
+
topP = undefined;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
299
328
|
const isAnthropicModel = isKnownModel || this.modelId.startsWith('claude-');
|
|
300
329
|
|
|
301
330
|
const supportsStructuredOutput =
|
|
@@ -366,20 +395,22 @@ export class AnthropicMessagesLanguageModel implements LanguageModelV4 {
|
|
|
366
395
|
* Map top-level `reasoning` to Anthropic thinking/effort when provider
|
|
367
396
|
* options don't already specify them. Provider options always take precedence.
|
|
368
397
|
*/
|
|
369
|
-
if (
|
|
370
|
-
isCustomReasoning(reasoning) &&
|
|
371
|
-
anthropicOptions?.thinking == null &&
|
|
372
|
-
anthropicOptions?.effort == null
|
|
373
|
-
) {
|
|
398
|
+
if (isCustomReasoning(reasoning) && anthropicOptions?.effort == null) {
|
|
374
399
|
const reasoningConfig = resolveAnthropicReasoningConfig({
|
|
375
400
|
reasoning,
|
|
376
401
|
supportsAdaptiveThinking,
|
|
402
|
+
supportsXhighEffort,
|
|
377
403
|
maxOutputTokensForModel,
|
|
378
404
|
warnings,
|
|
379
405
|
});
|
|
380
406
|
if (reasoningConfig != null) {
|
|
381
|
-
anthropicOptions.thinking
|
|
382
|
-
|
|
407
|
+
if (anthropicOptions.thinking == null) {
|
|
408
|
+
anthropicOptions.thinking = reasoningConfig.thinking;
|
|
409
|
+
}
|
|
410
|
+
if (
|
|
411
|
+
reasoningConfig.effort != null &&
|
|
412
|
+
anthropicOptions.thinking?.type !== 'disabled'
|
|
413
|
+
) {
|
|
383
414
|
anthropicOptions.effort = reasoningConfig.effort;
|
|
384
415
|
}
|
|
385
416
|
}
|
|
@@ -392,6 +423,10 @@ export class AnthropicMessagesLanguageModel implements LanguageModelV4 {
|
|
|
392
423
|
thinkingType === 'enabled'
|
|
393
424
|
? anthropicOptions?.thinking?.budgetTokens
|
|
394
425
|
: undefined;
|
|
426
|
+
const thinkingDisplay =
|
|
427
|
+
thinkingType === 'adaptive'
|
|
428
|
+
? anthropicOptions?.thinking?.display
|
|
429
|
+
: undefined;
|
|
395
430
|
|
|
396
431
|
const maxTokens = maxOutputTokens ?? maxOutputTokensForModel;
|
|
397
432
|
|
|
@@ -411,9 +446,11 @@ export class AnthropicMessagesLanguageModel implements LanguageModelV4 {
|
|
|
411
446
|
thinking: {
|
|
412
447
|
type: thinkingType,
|
|
413
448
|
...(thinkingBudget != null && { budget_tokens: thinkingBudget }),
|
|
449
|
+
...(thinkingDisplay != null && { display: thinkingDisplay }),
|
|
414
450
|
},
|
|
415
451
|
}),
|
|
416
452
|
...((anthropicOptions?.effort ||
|
|
453
|
+
anthropicOptions?.taskBudget ||
|
|
417
454
|
(useStructuredOutput &&
|
|
418
455
|
responseFormat?.type === 'json' &&
|
|
419
456
|
responseFormat.schema != null)) && {
|
|
@@ -421,6 +458,15 @@ export class AnthropicMessagesLanguageModel implements LanguageModelV4 {
|
|
|
421
458
|
...(anthropicOptions?.effort && {
|
|
422
459
|
effort: anthropicOptions.effort,
|
|
423
460
|
}),
|
|
461
|
+
...(anthropicOptions?.taskBudget && {
|
|
462
|
+
task_budget: {
|
|
463
|
+
type: anthropicOptions.taskBudget.type,
|
|
464
|
+
total: anthropicOptions.taskBudget.total,
|
|
465
|
+
...(anthropicOptions.taskBudget.remaining != null && {
|
|
466
|
+
remaining: anthropicOptions.taskBudget.remaining,
|
|
467
|
+
}),
|
|
468
|
+
},
|
|
469
|
+
}),
|
|
424
470
|
...(useStructuredOutput &&
|
|
425
471
|
responseFormat?.type === 'json' &&
|
|
426
472
|
responseFormat.schema != null && {
|
|
@@ -665,6 +711,10 @@ export class AnthropicMessagesLanguageModel implements LanguageModelV4 {
|
|
|
665
711
|
betas.add('effort-2025-11-24');
|
|
666
712
|
}
|
|
667
713
|
|
|
714
|
+
if (anthropicOptions?.taskBudget) {
|
|
715
|
+
betas.add('task-budgets-2026-03-13');
|
|
716
|
+
}
|
|
717
|
+
|
|
668
718
|
if (anthropicOptions?.speed === 'fast') {
|
|
669
719
|
betas.add('fast-mode-2026-02-01');
|
|
670
720
|
}
|
|
@@ -2342,9 +2392,20 @@ export function getModelCapabilities(modelId: string): {
|
|
|
2342
2392
|
maxOutputTokens: number;
|
|
2343
2393
|
supportsStructuredOutput: boolean;
|
|
2344
2394
|
supportsAdaptiveThinking: boolean;
|
|
2395
|
+
rejectsSamplingParameters: boolean;
|
|
2396
|
+
supportsXhighEffort: boolean;
|
|
2345
2397
|
isKnownModel: boolean;
|
|
2346
2398
|
} {
|
|
2347
|
-
if (
|
|
2399
|
+
if (modelId.includes('claude-opus-4-7')) {
|
|
2400
|
+
return {
|
|
2401
|
+
maxOutputTokens: 128000,
|
|
2402
|
+
supportsStructuredOutput: true,
|
|
2403
|
+
supportsAdaptiveThinking: true,
|
|
2404
|
+
rejectsSamplingParameters: true,
|
|
2405
|
+
supportsXhighEffort: true,
|
|
2406
|
+
isKnownModel: true,
|
|
2407
|
+
};
|
|
2408
|
+
} else if (
|
|
2348
2409
|
modelId.includes('claude-sonnet-4-6') ||
|
|
2349
2410
|
modelId.includes('claude-opus-4-6')
|
|
2350
2411
|
) {
|
|
@@ -2352,6 +2413,8 @@ export function getModelCapabilities(modelId: string): {
|
|
|
2352
2413
|
maxOutputTokens: 128000,
|
|
2353
2414
|
supportsStructuredOutput: true,
|
|
2354
2415
|
supportsAdaptiveThinking: true,
|
|
2416
|
+
rejectsSamplingParameters: false,
|
|
2417
|
+
supportsXhighEffort: false,
|
|
2355
2418
|
isKnownModel: true,
|
|
2356
2419
|
};
|
|
2357
2420
|
} else if (
|
|
@@ -2363,6 +2426,8 @@ export function getModelCapabilities(modelId: string): {
|
|
|
2363
2426
|
maxOutputTokens: 64000,
|
|
2364
2427
|
supportsStructuredOutput: true,
|
|
2365
2428
|
supportsAdaptiveThinking: false,
|
|
2429
|
+
rejectsSamplingParameters: false,
|
|
2430
|
+
supportsXhighEffort: false,
|
|
2366
2431
|
isKnownModel: true,
|
|
2367
2432
|
};
|
|
2368
2433
|
} else if (modelId.includes('claude-opus-4-1')) {
|
|
@@ -2370,6 +2435,8 @@ export function getModelCapabilities(modelId: string): {
|
|
|
2370
2435
|
maxOutputTokens: 32000,
|
|
2371
2436
|
supportsStructuredOutput: true,
|
|
2372
2437
|
supportsAdaptiveThinking: false,
|
|
2438
|
+
rejectsSamplingParameters: false,
|
|
2439
|
+
supportsXhighEffort: false,
|
|
2373
2440
|
isKnownModel: true,
|
|
2374
2441
|
};
|
|
2375
2442
|
} else if (modelId.includes('claude-sonnet-4-')) {
|
|
@@ -2377,6 +2444,8 @@ export function getModelCapabilities(modelId: string): {
|
|
|
2377
2444
|
maxOutputTokens: 64000,
|
|
2378
2445
|
supportsStructuredOutput: false,
|
|
2379
2446
|
supportsAdaptiveThinking: false,
|
|
2447
|
+
rejectsSamplingParameters: false,
|
|
2448
|
+
supportsXhighEffort: false,
|
|
2380
2449
|
isKnownModel: true,
|
|
2381
2450
|
};
|
|
2382
2451
|
} else if (modelId.includes('claude-opus-4-')) {
|
|
@@ -2384,6 +2453,8 @@ export function getModelCapabilities(modelId: string): {
|
|
|
2384
2453
|
maxOutputTokens: 32000,
|
|
2385
2454
|
supportsStructuredOutput: false,
|
|
2386
2455
|
supportsAdaptiveThinking: false,
|
|
2456
|
+
rejectsSamplingParameters: false,
|
|
2457
|
+
supportsXhighEffort: false,
|
|
2387
2458
|
isKnownModel: true,
|
|
2388
2459
|
};
|
|
2389
2460
|
} else if (modelId.includes('claude-3-haiku')) {
|
|
@@ -2391,6 +2462,8 @@ export function getModelCapabilities(modelId: string): {
|
|
|
2391
2462
|
maxOutputTokens: 4096,
|
|
2392
2463
|
supportsStructuredOutput: false,
|
|
2393
2464
|
supportsAdaptiveThinking: false,
|
|
2465
|
+
rejectsSamplingParameters: false,
|
|
2466
|
+
supportsXhighEffort: false,
|
|
2394
2467
|
isKnownModel: true,
|
|
2395
2468
|
};
|
|
2396
2469
|
} else {
|
|
@@ -2398,6 +2471,8 @@ export function getModelCapabilities(modelId: string): {
|
|
|
2398
2471
|
maxOutputTokens: 4096,
|
|
2399
2472
|
supportsStructuredOutput: false,
|
|
2400
2473
|
supportsAdaptiveThinking: false,
|
|
2474
|
+
rejectsSamplingParameters: false,
|
|
2475
|
+
supportsXhighEffort: false,
|
|
2401
2476
|
isKnownModel: false,
|
|
2402
2477
|
};
|
|
2403
2478
|
}
|
|
@@ -2431,11 +2506,13 @@ function hasWebTool20260209WithoutCodeExecution(
|
|
|
2431
2506
|
function resolveAnthropicReasoningConfig({
|
|
2432
2507
|
reasoning,
|
|
2433
2508
|
supportsAdaptiveThinking,
|
|
2509
|
+
supportsXhighEffort,
|
|
2434
2510
|
maxOutputTokensForModel,
|
|
2435
2511
|
warnings,
|
|
2436
2512
|
}: {
|
|
2437
2513
|
reasoning: LanguageModelV4CallOptions['reasoning'];
|
|
2438
2514
|
supportsAdaptiveThinking: boolean;
|
|
2515
|
+
supportsXhighEffort: boolean;
|
|
2439
2516
|
maxOutputTokensForModel: number;
|
|
2440
2517
|
warnings: SharedV4Warning[];
|
|
2441
2518
|
}): Pick<AnthropicLanguageModelOptions, 'thinking' | 'effort'> | undefined {
|
|
@@ -2455,7 +2532,7 @@ function resolveAnthropicReasoningConfig({
|
|
|
2455
2532
|
low: 'low' as const,
|
|
2456
2533
|
medium: 'medium' as const,
|
|
2457
2534
|
high: 'high' as const,
|
|
2458
|
-
xhigh: 'max' as const,
|
|
2535
|
+
xhigh: supportsXhighEffort ? ('xhigh' as const) : ('max' as const),
|
|
2459
2536
|
},
|
|
2460
2537
|
warnings,
|
|
2461
2538
|
});
|
|
@@ -17,6 +17,7 @@ export type AnthropicMessagesModelId =
|
|
|
17
17
|
| 'claude-sonnet-4-5'
|
|
18
18
|
| 'claude-sonnet-4-6'
|
|
19
19
|
| 'claude-opus-4-6'
|
|
20
|
+
| 'claude-opus-4-7'
|
|
20
21
|
| (string & {});
|
|
21
22
|
|
|
22
23
|
/**
|
|
@@ -83,6 +84,12 @@ export const anthropicLanguageModelOptions = z.object({
|
|
|
83
84
|
z.object({
|
|
84
85
|
/** for Sonnet 4.6, Opus 4.6, and newer models */
|
|
85
86
|
type: z.literal('adaptive'),
|
|
87
|
+
/**
|
|
88
|
+
* Controls whether thinking content is included in the response.
|
|
89
|
+
* - `"omitted"`: Thinking blocks are present but text is empty (default for Opus 4.7+).
|
|
90
|
+
* - `"summarized"`: Thinking content is returned. Required to see reasoning output.
|
|
91
|
+
*/
|
|
92
|
+
display: z.enum(['omitted', 'summarized']).optional(),
|
|
86
93
|
}),
|
|
87
94
|
z.object({
|
|
88
95
|
/** for models before Opus 4.6, except Sonnet 4.6 still supports it */
|
|
@@ -189,7 +196,22 @@ export const anthropicLanguageModelOptions = z.object({
|
|
|
189
196
|
/**
|
|
190
197
|
* @default 'high'
|
|
191
198
|
*/
|
|
192
|
-
effort: z.enum(['low', 'medium', 'high', 'max']).optional(),
|
|
199
|
+
effort: z.enum(['low', 'medium', 'high', 'xhigh', 'max']).optional(),
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Task budget for agentic turns. Informs the model of the total token budget
|
|
203
|
+
* available for the current task, allowing it to prioritize work and wind down
|
|
204
|
+
* gracefully as the budget is consumed.
|
|
205
|
+
*
|
|
206
|
+
* Advisory only — does not enforce a hard token limit.
|
|
207
|
+
*/
|
|
208
|
+
taskBudget: z
|
|
209
|
+
.object({
|
|
210
|
+
type: z.literal('tokens'),
|
|
211
|
+
total: z.number().int().min(20000),
|
|
212
|
+
remaining: z.number().int().min(0).optional(),
|
|
213
|
+
})
|
|
214
|
+
.optional(),
|
|
193
215
|
|
|
194
216
|
/**
|
|
195
217
|
* Enable fast mode for faster inference (2.5x faster output token speeds).
|