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/models/index.md
+46-5Lines changed: 46 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,47 @@ The Agents SDK comes with out-of-the-box support for OpenAI models in two flavor
5
5
-**Recommended**: the [`OpenAIResponsesModel`][agents.models.openai_responses.OpenAIResponsesModel], which calls OpenAI APIs using the new [Responses API](https://platform.openai.com/docs/api-reference/responses).
6
6
- The [`OpenAIChatCompletionsModel`][agents.models.openai_chatcompletions.OpenAIChatCompletionsModel], which calls OpenAI APIs using the [Chat Completions API](https://platform.openai.com/docs/api-reference/chat).
7
7
8
+
## OpenAI models
9
+
10
+
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.
11
+
12
+
If you want to switch to other models like [`gpt-5`](https://platform.openai.com/docs/models/gpt-5), follow the steps in the next section.
13
+
14
+
### Default OpenAI model
15
+
16
+
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.
17
+
18
+
```bash
19
+
export OPENAI_DEFAULT_MODEL=gpt-5
20
+
python3 my_awesome_agent.py
21
+
```
22
+
23
+
#### GPT-5 models
24
+
25
+
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"`. If you want to build these settings yourself, call `agents.models.get_default_model_settings("gpt-5")`.
26
+
27
+
For lower latency or specific requirements, you can choose a different model and settings. To adjust the reasoning effort for the default model, pass your own `ModelSettings`:
# If OPENAI_DEFAULT_MODEL=gpt-5 is set, passing only model_settings works.
38
+
# It's also fine to pass a GPT-5 model name explicitly:
39
+
# model="gpt-5",
40
+
)
41
+
```
42
+
43
+
Specifically 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) model 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"`.
44
+
45
+
#### Non-GPT-5 models
46
+
47
+
If you pass a non–GPT-5 model name without custom `model_settings`, the SDK reverts to generic `ModelSettings` compatible with any model.
48
+
8
49
## Non-OpenAI models
9
50
10
51
You can use most other non-OpenAI models via the [LiteLLM integration](./litellm.md). First, install the litellm dependency group:
@@ -53,14 +94,14 @@ import asyncio
53
94
spanish_agent = Agent(
54
95
name="Spanish agent",
55
96
instructions="You only speak Spanish.",
56
-
model="o3-mini", # (1)!
97
+
model="gpt-5-mini", # (1)!
57
98
)
58
99
59
100
english_agent = Agent(
60
101
name="English agent",
61
102
instructions="You only speak English",
62
103
model=OpenAIChatCompletionsModel( # (2)!
63
-
model="gpt-4o",
104
+
model="gpt-5-nano",
64
105
openai_client=AsyncOpenAI()
65
106
),
66
107
)
@@ -69,7 +110,7 @@ triage_agent = Agent(
69
110
name="Triage agent",
70
111
instructions="Handoff to the appropriate agent based on the language of the request.",
71
112
handoffs=[spanish_agent, english_agent],
72
-
model="gpt-3.5-turbo",
113
+
model="gpt-5",
73
114
)
74
115
75
116
asyncdefmain():
@@ -88,7 +129,7 @@ from agents import Agent, ModelSettings
88
129
english_agent = Agent(
89
130
name="English agent",
90
131
instructions="You only speak English",
91
-
model="gpt-4o",
132
+
model="gpt-4.1",
92
133
model_settings=ModelSettings(temperature=0.1),
93
134
)
94
135
```
@@ -101,7 +142,7 @@ from agents import Agent, ModelSettings
0 commit comments