Skip to content

Commit ff6d55f

Browse files
authored
Re: #1534 Update models document page to cover gpt-5 use cases (#1535)
1 parent 11b1c1e commit ff6d55f

File tree

1 file changed

+46
-5
lines changed

1 file changed

+46
-5
lines changed

docs/models/index.md

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,47 @@ 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), 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`:
28+
29+
```python
30+
from openai.types.shared import Reasoning
31+
from agents import Agent, ModelSettings
32+
33+
my_agent = Agent(
34+
name="My Agent",
35+
instructions="You're a helpful agent.",
36+
model_settings=ModelSettings(reasoning=Reasoning(effort="minimal"), verbosity="low")
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+
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+
849
## Non-OpenAI models
950

1051
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
5394
spanish_agent = Agent(
5495
name="Spanish agent",
5596
instructions="You only speak Spanish.",
56-
model="o3-mini", # (1)!
97+
model="gpt-5-mini", # (1)!
5798
)
5899

59100
english_agent = Agent(
60101
name="English agent",
61102
instructions="You only speak English",
62103
model=OpenAIChatCompletionsModel( # (2)!
63-
model="gpt-4o",
104+
model="gpt-5-nano",
64105
openai_client=AsyncOpenAI()
65106
),
66107
)
@@ -69,7 +110,7 @@ triage_agent = Agent(
69110
name="Triage agent",
70111
instructions="Handoff to the appropriate agent based on the language of the request.",
71112
handoffs=[spanish_agent, english_agent],
72-
model="gpt-3.5-turbo",
113+
model="gpt-5",
73114
)
74115

75116
async def main():
@@ -88,7 +129,7 @@ from agents import Agent, ModelSettings
88129
english_agent = Agent(
89130
name="English agent",
90131
instructions="You only speak English",
91-
model="gpt-4o",
132+
model="gpt-4.1",
92133
model_settings=ModelSettings(temperature=0.1),
93134
)
94135
```
@@ -101,7 +142,7 @@ from agents import Agent, ModelSettings
101142
english_agent = Agent(
102143
name="English agent",
103144
instructions="You only speak English",
104-
model="gpt-4o",
145+
model="gpt-4.1",
105146
model_settings=ModelSettings(
106147
temperature=0.1,
107148
extra_args={"service_tier": "flex", "user": "user_12345"},

0 commit comments

Comments
 (0)