You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/content/docs/guides/models.mdx
+49-10Lines changed: 49 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,53 @@ In day‑to‑day work you normally only interact with model **names** and occas
29
29
title="Specifying a model per‑agent"
30
30
/>
31
31
32
+
## Default model
33
+
34
+
When you don't specify a model when initializing an `Agent`, the default model will be used. The default is currently [`gpt-4.1`](https://platform.openai.com/docs/models/gpt-4.1), which offers a strong balance of predictability for agentic workflows and low latency.
35
+
36
+
If you want to switch to other models like [`gpt-5`](https://platform.openai.com/docs/models/gpt-5), there are two ways to configure your agents.
37
+
38
+
First, if you want to consistently use a specific model for all agents that do not set a custom model, set the `OPENAI_DEFAULT_MODEL` environment variable before running your agents.
39
+
40
+
```bash
41
+
export OPENAI_DEFAULT_MODEL=gpt-5
42
+
node my-awesome-agent.js
43
+
```
44
+
45
+
Second, you can set a default model for a `Runner` instance. If you don't set a model for an agent, this `Runner`'s default model will be used.
46
+
47
+
<Code
48
+
lang="typescript"
49
+
code={runnerWithModelExample}
50
+
title="Set a default model for a Runner"
51
+
/>
52
+
53
+
### GPT-5 models
54
+
55
+
When you use any of GPT-5's reasoning models ([`gpt-5`](https://platform.openai.com/docs/models/gpt-5), [`gpt-5-mini`](https://platform.openai.com/docs/models/gpt-5-mini), or [`gpt-5-nano`](https://platform.openai.com/docs/models/gpt-5-nano)) this way, the SDK applies sensible `modelSettings` by default. Specifically, it sets both `reasoning.effort` and `verbosity` to `"low"`. To adjust the reasoning effort for the default model, pass your own `modelSettings`:
56
+
57
+
```ts
58
+
import { Agent } from'@openai/agents';
59
+
60
+
const myAgent =newAgent({
61
+
name: 'My Agent',
62
+
instructions: "You're a helpful agent.",
63
+
modelSettings: {
64
+
reasoning: { effort: 'minimal' },
65
+
text: { verbosity: 'low' },
66
+
},
67
+
// If OPENAI_DEFAULT_MODEL=gpt-5 is set, passing only modelSettings works.
68
+
// It's also fine to pass a GPT-5 model name explicitly:
69
+
// model: 'gpt-5',
70
+
});
71
+
```
72
+
73
+
For lower latency, using either [`gpt-5-mini`](https://platform.openai.com/docs/models/gpt-5-mini) or [`gpt-5-nano`](https://platform.openai.com/docs/models/gpt-5-nano) with `reasoning.effort="minimal"` will often return responses faster than the default settings. However, some built-in tools (such as file search and image generation) in Responses API do not support `"minimal"` reasoning effort, which is why this Agents SDK defaults to `"low"`.
74
+
75
+
### Non-GPT-5 models
76
+
77
+
If you pass a non–GPT-5 model name without custom `modelSettings`, the SDK reverts to generic `modelSettings` compatible with any model.
78
+
32
79
---
33
80
34
81
## The OpenAI provider
@@ -52,16 +99,6 @@ endpoints:
52
99
You can also plug your own `OpenAI` client via `setDefaultOpenAIClient(client)` if you need
53
100
custom networking settings.
54
101
55
-
### Default model
56
-
57
-
The OpenAI provider defaults to `gpt‑4o`. Override per agent or globally:
58
-
59
-
<Code
60
-
lang="typescript"
61
-
code={runnerWithModelExample}
62
-
title="Set a default model"
63
-
/>
64
-
65
102
---
66
103
67
104
## ModelSettings
@@ -79,6 +116,8 @@ The OpenAI provider defaults to `gpt‑4o`. Override per agent or globally:
0 commit comments