Skip to content

Commit af46c88

Browse files
feat(api): adds GPT-5 and new API features: platform.openai.com/docs/guides/gpt-5
1 parent b0fc133 commit af46c88

23 files changed

+2094
-256
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 97
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-d6a16b25b969c3e5382e7d413de15bf83d5f7534d5c3ecce64d3a7e847418f9e.yml
3-
openapi_spec_hash: 0c0bcf4aee9ca2a948dd14b890dfe728
4-
config_hash: aeff9289bd7f8c8482e4d738c3c2fde1
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-f5c45f4ae5c2075cbc603d6910bba3da31c23714c209fbd3fd82a94f634a126b.yml
3+
openapi_spec_hash: 3eb8d86c06f0bb5e1190983e5acfc9ba
4+
config_hash: 9a64321968e21ed72f5c0e02164ea00d

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ client.Chat.Completions.New(
589589
},
590590
},
591591
}},
592-
Model: shared.ChatModelGPT4_1,
592+
Model: shared.ChatModelGPT5,
593593
},
594594
// This sets the per-retry timeout
595595
option.WithRequestTimeout(20*time.Second),
@@ -770,7 +770,7 @@ client.Chat.Completions.New(
770770
},
771771
},
772772
}},
773-
Model: shared.ChatModelGPT4_1,
773+
Model: shared.ChatModelGPT5,
774774
},
775775
option.WithMaxRetries(5),
776776
)
@@ -794,7 +794,7 @@ chatCompletion, err := client.Chat.Completions.New(
794794
},
795795
},
796796
}},
797-
Model: shared.ChatModelGPT4_1,
797+
Model: shared.ChatModelGPT5,
798798
},
799799
option.WithResponseInto(&response),
800800
)

aliases.go

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,27 @@ type Error = apierror.Error
1919
// This is an alias to an internal type.
2020
type ChatModel = shared.ChatModel
2121

22+
// Equals "gpt-5"
23+
const ChatModelGPT5 = shared.ChatModelGPT5
24+
25+
// Equals "gpt-5-mini"
26+
const ChatModelGPT5Mini = shared.ChatModelGPT5Mini
27+
28+
// Equals "gpt-5-nano"
29+
const ChatModelGPT5Nano = shared.ChatModelGPT5Nano
30+
31+
// Equals "gpt-5-2025-08-07"
32+
const ChatModelGPT5_2025_08_07 = shared.ChatModelGPT5_2025_08_07
33+
34+
// Equals "gpt-5-mini-2025-08-07"
35+
const ChatModelGPT5Mini2025_08_07 = shared.ChatModelGPT5Mini2025_08_07
36+
37+
// Equals "gpt-5-nano-2025-08-07"
38+
const ChatModelGPT5Nano2025_08_07 = shared.ChatModelGPT5Nano2025_08_07
39+
40+
// Equals "gpt-5-chat-latest"
41+
const ChatModelGPT5ChatLatest = shared.ChatModelGPT5ChatLatest
42+
2243
// Equals "gpt-4.1"
2344
const ChatModelGPT4_1 = shared.ChatModelGPT4_1
2445

@@ -259,6 +280,36 @@ const CompoundFilterTypeOr = shared.CompoundFilterTypeOr
259280
// This is an alias to an internal type.
260281
type CompoundFilterParam = shared.CompoundFilterParam
261282

283+
// The input format for the custom tool. Default is unconstrained text.
284+
//
285+
// This is an alias to an internal type.
286+
type CustomToolInputFormatUnion = shared.CustomToolInputFormatUnion
287+
288+
// Unconstrained free-form text.
289+
//
290+
// This is an alias to an internal type.
291+
type CustomToolInputFormatText = shared.CustomToolInputFormatText
292+
293+
// A grammar defined by the user.
294+
//
295+
// This is an alias to an internal type.
296+
type CustomToolInputFormatGrammar = shared.CustomToolInputFormatGrammar
297+
298+
// The input format for the custom tool. Default is unconstrained text.
299+
//
300+
// This is an alias to an internal type.
301+
type CustomToolInputFormatUnionParam = shared.CustomToolInputFormatUnionParam
302+
303+
// Unconstrained free-form text.
304+
//
305+
// This is an alias to an internal type.
306+
type CustomToolInputFormatTextParam = shared.CustomToolInputFormatTextParam
307+
308+
// A grammar defined by the user.
309+
//
310+
// This is an alias to an internal type.
311+
type CustomToolInputFormatGrammarParam = shared.CustomToolInputFormatGrammarParam
312+
262313
// This is an alias to an internal type.
263314
type ErrorObject = shared.ErrorObject
264315

@@ -339,16 +390,18 @@ const ReasoningSummaryDetailed = shared.ReasoningSummaryDetailed
339390
// This is an alias to an internal type.
340391
type ReasoningParam = shared.ReasoningParam
341392

342-
// **o-series models only**
343-
//
344393
// Constrains effort on reasoning for
345394
// [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
346-
// supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
347-
// result in faster responses and fewer tokens used on reasoning in a response.
395+
// supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
396+
// effort can result in faster responses and fewer tokens used on reasoning in a
397+
// response.
348398
//
349399
// This is an alias to an internal type.
350400
type ReasoningEffort = shared.ReasoningEffort
351401

402+
// Equals "minimal"
403+
const ReasoningEffortMinimal = shared.ReasoningEffortMinimal
404+
352405
// Equals "low"
353406
const ReasoningEffortLow = shared.ReasoningEffortLow
354407

api.md

Lines changed: 26 additions & 3 deletions
Large diffs are not rendered by default.

betaassistant.go

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,14 +1780,13 @@ type BetaAssistantNewParams struct {
17801780
// Keys are strings with a maximum length of 64 characters. Values are strings with
17811781
// a maximum length of 512 characters.
17821782
Metadata shared.Metadata `json:"metadata,omitzero"`
1783-
// **o-series models only**
1784-
//
17851783
// Constrains effort on reasoning for
17861784
// [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
1787-
// supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
1788-
// result in faster responses and fewer tokens used on reasoning in a response.
1785+
// supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
1786+
// effort can result in faster responses and fewer tokens used on reasoning in a
1787+
// response.
17891788
//
1790-
// Any of "low", "medium", "high".
1789+
// Any of "minimal", "low", "medium", "high".
17911790
ReasoningEffort shared.ReasoningEffort `json:"reasoning_effort,omitzero"`
17921791
// A set of resources that are used by the assistant's tools. The resources are
17931792
// specific to the type of tool. For example, the `code_interpreter` tool requires
@@ -2051,14 +2050,13 @@ type BetaAssistantUpdateParams struct {
20512050
// Keys are strings with a maximum length of 64 characters. Values are strings with
20522051
// a maximum length of 512 characters.
20532052
Metadata shared.Metadata `json:"metadata,omitzero"`
2054-
// **o-series models only**
2055-
//
20562053
// Constrains effort on reasoning for
20572054
// [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
2058-
// supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
2059-
// result in faster responses and fewer tokens used on reasoning in a response.
2055+
// supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
2056+
// effort can result in faster responses and fewer tokens used on reasoning in a
2057+
// response.
20602058
//
2061-
// Any of "low", "medium", "high".
2059+
// Any of "minimal", "low", "medium", "high".
20622060
ReasoningEffort shared.ReasoningEffort `json:"reasoning_effort,omitzero"`
20632061
// A set of resources that are used by the assistant's tools. The resources are
20642062
// specific to the type of tool. For example, the `code_interpreter` tool requires
@@ -2115,6 +2113,12 @@ func (r *BetaAssistantUpdateParams) UnmarshalJSON(data []byte) error {
21152113
type BetaAssistantUpdateParamsModel string
21162114

21172115
const (
2116+
BetaAssistantUpdateParamsModelGPT5 BetaAssistantUpdateParamsModel = "gpt-5"
2117+
BetaAssistantUpdateParamsModelGPT5Mini BetaAssistantUpdateParamsModel = "gpt-5-mini"
2118+
BetaAssistantUpdateParamsModelGPT5Nano BetaAssistantUpdateParamsModel = "gpt-5-nano"
2119+
BetaAssistantUpdateParamsModelGPT5_2025_08_07 BetaAssistantUpdateParamsModel = "gpt-5-2025-08-07"
2120+
BetaAssistantUpdateParamsModelGPT5Mini2025_08_07 BetaAssistantUpdateParamsModel = "gpt-5-mini-2025-08-07"
2121+
BetaAssistantUpdateParamsModelGPT5Nano2025_08_07 BetaAssistantUpdateParamsModel = "gpt-5-nano-2025-08-07"
21182122
BetaAssistantUpdateParamsModelGPT4_1 BetaAssistantUpdateParamsModel = "gpt-4.1"
21192123
BetaAssistantUpdateParamsModelGPT4_1Mini BetaAssistantUpdateParamsModel = "gpt-4.1-mini"
21202124
BetaAssistantUpdateParamsModelGPT4_1Nano BetaAssistantUpdateParamsModel = "gpt-4.1-nano"

betaassistant_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ func TestBetaAssistantNewWithOptionalParams(t *testing.T) {
2828
option.WithAPIKey("My API Key"),
2929
)
3030
_, err := client.Beta.Assistants.New(context.TODO(), openai.BetaAssistantNewParams{
31-
Model: shared.ChatModelGPT4_1,
31+
Model: shared.ChatModelGPT5,
3232
Description: openai.String("description"),
3333
Instructions: openai.String("instructions"),
3434
Metadata: shared.Metadata{
3535
"foo": "string",
3636
},
3737
Name: openai.String("name"),
38-
ReasoningEffort: shared.ReasoningEffortLow,
38+
ReasoningEffort: shared.ReasoningEffortMinimal,
3939
ResponseFormat: openai.AssistantResponseFormatOptionUnionParam{
4040
OfAuto: constant.ValueOf[constant.Auto](),
4141
},
@@ -114,9 +114,9 @@ func TestBetaAssistantUpdateWithOptionalParams(t *testing.T) {
114114
Metadata: shared.Metadata{
115115
"foo": "string",
116116
},
117-
Model: openai.BetaAssistantUpdateParamsModelGPT4_1,
117+
Model: openai.BetaAssistantUpdateParamsModelGPT5,
118118
Name: openai.String("name"),
119-
ReasoningEffort: shared.ReasoningEffortLow,
119+
ReasoningEffort: shared.ReasoningEffortMinimal,
120120
ResponseFormat: openai.AssistantResponseFormatOptionUnionParam{
121121
OfAuto: constant.ValueOf[constant.Auto](),
122122
},

betathread_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func TestBetaThreadNewAndRunWithOptionalParams(t *testing.T) {
175175
Metadata: shared.Metadata{
176176
"foo": "string",
177177
},
178-
Model: shared.ChatModelGPT4_1,
178+
Model: shared.ChatModelGPT5,
179179
ParallelToolCalls: openai.Bool(true),
180180
ResponseFormat: openai.AssistantResponseFormatOptionUnionParam{
181181
OfAuto: constant.ValueOf[constant.Auto](),

betathreadrun.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -621,14 +621,13 @@ type BetaThreadRunNewParams struct {
621621
// model associated with the assistant. If not, the model associated with the
622622
// assistant will be used.
623623
Model shared.ChatModel `json:"model,omitzero"`
624-
// **o-series models only**
625-
//
626624
// Constrains effort on reasoning for
627625
// [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
628-
// supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
629-
// result in faster responses and fewer tokens used on reasoning in a response.
626+
// supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
627+
// effort can result in faster responses and fewer tokens used on reasoning in a
628+
// response.
630629
//
631-
// Any of "low", "medium", "high".
630+
// Any of "minimal", "low", "medium", "high".
632631
ReasoningEffort shared.ReasoningEffort `json:"reasoning_effort,omitzero"`
633632
// Override the tools the assistant can use for this run. This is useful for
634633
// modifying the behavior on a per-run basis.

betathreadrun_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ func TestBetaThreadRunNewWithOptionalParams(t *testing.T) {
5555
Metadata: shared.Metadata{
5656
"foo": "string",
5757
},
58-
Model: shared.ChatModelGPT4_1,
58+
Model: shared.ChatModelGPT5,
5959
ParallelToolCalls: openai.Bool(true),
60-
ReasoningEffort: shared.ReasoningEffortLow,
60+
ReasoningEffort: shared.ReasoningEffortMinimal,
6161
ResponseFormat: openai.AssistantResponseFormatOptionUnionParam{
6262
OfAuto: constant.ValueOf[constant.Auto](),
6363
},

0 commit comments

Comments
 (0)