# turn · thinking

Canonical URL: https://developers.iagenify.com/sdk/ref/models/turn/thinking/
Language: en

`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.

Status: minimal · low · medium · high · billed as output · counts inside maxOutputTokens

## The four levels {#levels}

| Level | For |
| --- | --- |
| minimal | Classification, extraction, routing — anything where reasoning is overhead. |
| low | Ordinary questions with a bit of judgement. |
| medium | Multi-step problems; comparing options. |
| high | Hard 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.

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

## What it costs {#cost}

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

```javascript
const turn = await api.models.turn({ model, 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 {#measured}

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.

| Symptom | Usually |
| --- | --- |
| An empty or cut-off answer | The ceiling was spent thinking. Raise it, or lower the level. |
| stopReason is the ceiling | Same cause, stated plainly by the turn. |
| Cost higher than the visible text | thinkingTokens. Look at usage, not at the length of the answer. |

## Choosing a level {#choosing}

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.

```javascript
// 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 });
```

## The same thing on a session {#sessions}

A session sets it once, in `settings.thinkingLevel`, and it applies to everything that session generates — see [settings](/sdk/ref/models/settings).

- [turn · stop reasons](/sdk/ref/models/turn/stop-reasons): Telling a finished answer from a truncated one.
- [settings](/sdk/ref/models/settings): The session-level equivalent, and the output ceiling.

```python
api.models.turn(
    model="gemini-3.5-flash",
    messages=messages,
    thinking="minimal",       # a router does not need to deliberate
    max_output_tokens=16,
)
```

```python
turn = api.models.turn(model=model, messages=messages, thinking="high")

turn["usage"]
# {"credits", "inputTokens", "outputTokens", "thinkingTokens"}
```

```python
# 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)
```
