Get an API key
api.models

turn · thinking

api.models.turn({ thinking })

How much the model may reason before answering. Four levels, and the one thing to know: thinking is output, and it is spent from the same ceiling.

minimal · low · medium · highbilled as outputcounts inside maxOutputTokens
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

The four levels

LevelFor
minimalClassification, extraction, routing — anything where reasoning is overhead.
lowOrdinary questions with a bit of judgement.
mediumMulti-step problems; comparing options.
highHard reasoning, long chains, work where being right matters more than being quick.

Anything outside those four is refused before the call. Leave it out and the model's own default applies.

await api.models.turn({
  model: "gemini-3.5-flash",
  messages,
  thinking: "minimal",      // a router does not need to deliberate
  maxOutputTokens: 16,
});
api.models.turn(
    model="gemini-3.5-flash",
    messages=messages,
    thinking="minimal",       # a router does not need to deliberate
    max_output_tokens=16,
)

What it costs

Thinking tokens are billed at the output rate, like the answer itself. They are reported separately so you can see what you paid for.

const turn = await api.models.turn({ model, messages, thinking: "high" });

turn.usage;
// { credits, inputTokens, outputTokens, thinkingTokens }
turn = api.models.turn(model=model, messages=messages, thinking="high")

turn["usage"]
# {"credits", "inputTokens", "outputTokens", "thinkingTokens"}
Thinking is spent from maxOutputTokens

A tight ceiling with a high level can be used up reasoning, leaving a truncated answer or none. Raise the ceiling when you raise the level — or lower the level when the ceiling is what matters.

What that looks like in practice

With a ceiling of 60 tokens and a high level, a turn was measured spending 54 on thinking and 2 on the answer, stopping at the ceiling. The reasoning was fine; there was no room left to say it.

SymptomUsually
An empty or cut-off answerThe ceiling was spent thinking. Raise it, or lower the level.
stopReason is the ceilingSame cause, stated plainly by the turn.
Cost higher than the visible textthinkingTokens. Look at usage, not at the length of the answer.

Choosing a level

Default to the lowest that gets the answer right, and raise it only where you have seen it fail. In a loop, the level applies to every turn — so « high » on a twenty-step run is twenty deliberations, most of which were not hard.

// Reason about the plan, not about every step
const level = messages.length <= 2 ? "medium" : "minimal";

const turn = await api.models.turn({ model, messages, tools, thinking: level });
# Reason about the plan, not about every step
level = "medium" if len(messages) <= 2 else "minimal"

turn = api.models.turn(model=model, messages=messages, tools=tools, thinking=level)

The same thing on a session

A session sets it once, in settings.thinkingLevel, and it applies to everything that session generates — see settings.