anthropic.ThinkingConfig

Extended-thinking configuration (`thinking` on the Messages request).

Reference version

Signature

class anthropic.ThinkingConfig

Extended-thinking configuration (thinking on the Messages request).

budget_tokens must be smaller than the request's max_tokens, and Anthropic rejects temperature / top_p / top_k alongside enabled thinking — the client sends what it is given and lets the API say so.

Source:<builtin>/anthropic/messages.bamlbytes 6051127

Fields

type

string

"enabled" or "disabled".

budget_tokens

int | null

Static methods

function

disabled

() -> anthropic.ThinkingConfig

Turns extended thinking off.

function

enabled

(budget_tokens: int) -> anthropic.ThinkingConfig

Turns extended thinking on, with budget_tokens reserved for it.