Skip to content

Commit 770bae7

Browse files
authored
Update models document page to cover gpt-5 (#364)
1 parent 1a296db commit 770bae7

File tree

1 file changed

+49
-10
lines changed

1 file changed

+49
-10
lines changed

docs/src/content/docs/guides/models.mdx

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,53 @@ In day‑to‑day work you normally only interact with model **names** and occas
2929
title="Specifying a model per‑agent"
3030
/>
3131

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 = new Agent({
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+
3279
---
3380

3481
## The OpenAI provider
@@ -52,16 +99,6 @@ endpoints:
5299
You can also plug your own `OpenAI` client via `setDefaultOpenAIClient(client)` if you need
53100
custom networking settings.
54101

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-
65102
---
66103

67104
## ModelSettings
@@ -79,6 +116,8 @@ The OpenAI provider defaults to `gpt‑4o`. Override per agent or globally:
79116
| `truncation` | `'auto' \| 'disabled'` | Token truncation strategy. |
80117
| `maxTokens` | `number` | Maximum tokens in the response. |
81118
| `store` | `boolean` | Persist the response for retrieval / RAG workflows. |
119+
| `reasoning.effort` | `'minimal' \| 'low' \| 'medium' \| 'high'` | Reasoning effort for gpt-5 etc. |
120+
| `text.verbosity` | `'low' \| 'medium' \| 'high'` | Text verbosity for gpt-5 etc. |
82121

83122
Attach settings at either level:
84123

0 commit comments

Comments
 (0)