# Options · model and thinking

Canonical URL: https://developers.iagenify.com/sdk/ref/agents/options/model/
Language: en

`model · fallbackModels · thinking · maxOutputTokens`

Which model serves each turn, what happens when it will not, how hard it thinks, and how much it may write.

Status: model required · fallback per turn · 16 000 output tokens

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `model` | string | required | The model name. Not required when reopening a session with `id`. |
| `fallbackModels` | string[] | [] | Tried in order when a model gives up. A name equal to `model` is dropped. |
| `thinking` | string | null | `minimal` · `low` · `medium` · `high`. |
| `maxOutputTokens` | integer | 16 000 | Imposed on the provider, per turn. Thinking counts inside it. |

```javascript
api.agents.create({
  runtime: "local", machine: pc,
  model: "gemini-3.7-flash",
  fallbackModels: ["gemini-3.5-flash"],
  thinking: "medium",
  maxOutputTokens: 24_000,
});
```

## Fallback is per turn {#fallback}

Two attempts on a model, then the next one. The following step starts again from the main model — a run does not stay demoted because one turn failed. Watch the `turn` event's `model` to see which actually served.

## The fallback's window matters {#window}

> **A smaller model may refuse a history the first one accepted**
>
> The context limit is resolved from the main model. Pick fallbacks of comparable size, or set contextTokens to a value all of them hold.

## maxOutputTokens is imposed, not suggested {#output}

It is sent to the provider as a cap, which is what makes the pre-authorisation of a turn meaningful. Thinking tokens count inside it: a high thinking setting with a low cap leaves little room for the answer.

## Thinking is billed {#thinking-cost}

At the output rate, like anything the model writes. `medium` or `high` on a long agent run is a real line on the bill — worth setting deliberately rather than by default.

## Changing it {#changing}

The model is fixed for the life of the agent object. To work with another one, create another agent — or reopen the same session with a different `model`.

- [Fallback and retry](/sdk/agent/fallback-and-retry): The order, and what is never retried.
- [models.turn()](/sdk/ref/models/turn): The call underneath.
- [budget and context](/sdk/ref/agents/options/budget): The other ceilings.

```python
api.agents.create(
    runtime="local", machine=pc,
    model="gemini-3.7-flash",
    fallback_models=["gemini-3.5-flash"],
    thinking="medium",
    max_output_tokens=24_000,
)
```
