Skip to content

Commit 0e80fd9

Browse files
committed
Update models document page to cover gpt-5 use cases
1 parent df95141 commit 0e80fd9

File tree

1 file changed

+42
-5
lines changed

1 file changed

+42
-5
lines changed

docs/models/index.md

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,43 @@ The Agents SDK comes with out-of-the-box support for OpenAI models in two flavor
55
- **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).
66
- The [`OpenAIChatCompletionsModel`][agents.models.openai_chatcompletions.OpenAIChatCompletionsModel], which calls OpenAI APIs using the [Chat Completions API](https://platform.openai.com/docs/api-reference/chat).
77

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), there are two ways to configure your agents.
13+
14+
### Change the default 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+
When you use a GPT-5 model 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")`.
24+
25+
If you prefer a different reasoning effort for the default model, pass your own `ModelSettings` as below. Note that some built-in tools (for example, file search and image generation) do not support "minimal" reasoning effort, which is why the SDK defaults to "low".
26+
27+
```python
28+
from openai.types.shared import Reasoning
29+
from agents import Agent, ModelSettings
30+
31+
my_agent = Agent(
32+
name="My Agent",
33+
instructions="You're a helpful agent.",
34+
model_settings=ModelSettings(
35+
reasoning=Reasoning(effort="minimal")
36+
)
37+
# 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+
If you pass a non–GPT-5 model name without custom `model_settings`, the SDK reverts to generic `ModelSettings` compatible with any model.
44+
845
## Non-OpenAI models
946

1047
You can use most other non-OpenAI models via the [LiteLLM integration](./litellm.md). First, install the litellm dependency group:
@@ -53,14 +90,14 @@ import asyncio
5390
spanish_agent = Agent(
5491
name="Spanish agent",
5592
instructions="You only speak Spanish.",
56-
model="o3-mini", # (1)!
93+
model="gpt-5-mini", # (1)!
5794
)
5895

5996
english_agent = Agent(
6097
name="English agent",
6198
instructions="You only speak English",
6299
model=OpenAIChatCompletionsModel( # (2)!
63-
model="gpt-4o",
100+
model="gpt-5-nano",
64101
openai_client=AsyncOpenAI()
65102
),
66103
)
@@ -69,7 +106,7 @@ triage_agent = Agent(
69106
name="Triage agent",
70107
instructions="Handoff to the appropriate agent based on the language of the request.",
71108
handoffs=[spanish_agent, english_agent],
72-
model="gpt-3.5-turbo",
109+
model="gpt-5",
73110
)
74111

75112
async def main():
@@ -88,7 +125,7 @@ from agents import Agent, ModelSettings
88125
english_agent = Agent(
89126
name="English agent",
90127
instructions="You only speak English",
91-
model="gpt-4o",
128+
model="gpt-4.1",
92129
model_settings=ModelSettings(temperature=0.1),
93130
)
94131
```
@@ -101,7 +138,7 @@ from agents import Agent, ModelSettings
101138
english_agent = Agent(
102139
name="English agent",
103140
instructions="You only speak English",
104-
model="gpt-4o",
141+
model="gpt-4.1",
105142
model_settings=ModelSettings(
106143
temperature=0.1,
107144
extra_args={"service_tier": "flex", "user": "user_12345"},

0 commit comments

Comments
 (0)