Task Budgets allow developers to set maximum token spend limits for individual tasks or conversations. This is critical for agentic workflows where the model might iterate many times — without a budget, a stuck agent could consume thousands of dollars in tokens.
// Setting a task budget
const response = await anthropic.messages.create({
model: "claude-opus-4-7",
max_tokens: 8192,
task_budget: { max_input_tokens: 100000, max_output_tokens: 50000 },
messages: [{ role: "user", content: "Analyze this codebase..." }]
});
Anthropic introduced an effort parameter that lets you control the depth of reasoning:
| Level | Use Case | Speed |
|---|---|---|
low | Simple lookups, classification | Fastest |
medium | Standard analysis | Balanced |
high | Complex reasoning, code review | Slower |
max | PhD-level analysis, deep research | Slowest |
effort: "low" for routing decisions and effort: "high" only when quality justifies the cost.