Skip to content

Commit 1ef19d4

Browse files
feat(api): adding gpt-4.1 family of model IDs
1 parent c0414f1 commit 1ef19d4

12 files changed

+69
-21
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 83
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-44b20fa9d24544217fe6bb48852037537030a1ad29b202936425110744fe66fb.yml
3-
openapi_spec_hash: ea86343b5e9858a74e85da8ab2c532f6
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-a555f81249cb084f463dcefa4aba069f9341fdaf3dd6ac27d7f237fc90e8f488.yml
3+
openapi_spec_hash: 8e590296cd1a54b9508510b0c7a2c45a
44
config_hash: 5ea32de61ff42fcf5e66cff8d9e247ea

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ client.Chat.Completions.New(
569569
},
570570
},
571571
}},
572-
Model: shared.ChatModelO3Mini,
572+
Model: shared.ChatModelGPT4_1,
573573
},
574574
// This sets the per-retry timeout
575575
option.WithRequestTimeout(20*time.Second),
@@ -635,7 +635,7 @@ client.Chat.Completions.New(
635635
},
636636
},
637637
}},
638-
Model: shared.ChatModelO3Mini,
638+
Model: shared.ChatModelGPT4_1,
639639
},
640640
option.WithMaxRetries(5),
641641
)
@@ -659,7 +659,7 @@ chatCompletion, err := client.Chat.Completions.New(
659659
},
660660
},
661661
}},
662-
Model: shared.ChatModelO3Mini,
662+
Model: shared.ChatModelGPT4_1,
663663
},
664664
option.WithResponseInto(&response),
665665
)

aliases.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,24 @@ type Error = apierror.Error
2020
// This is an alias to an internal type.
2121
type ChatModel = shared.ChatModel
2222

23+
// Equals "gpt-4.1"
24+
const ChatModelGPT4_1 = shared.ChatModelGPT4_1
25+
26+
// Equals "gpt-4.1-mini"
27+
const ChatModelGPT4_1Mini = shared.ChatModelGPT4_1Mini
28+
29+
// Equals "gpt-4.1-nano"
30+
const ChatModelGPT4_1Nano = shared.ChatModelGPT4_1Nano
31+
32+
// Equals "gpt-4.1-2025-04-14"
33+
const ChatModelGPT4_1_2025_04_14 = shared.ChatModelGPT4_1_2025_04_14
34+
35+
// Equals "gpt-4.1-mini-2025-04-14"
36+
const ChatModelGPT4_1Mini2025_04_14 = shared.ChatModelGPT4_1Mini2025_04_14
37+
38+
// Equals "gpt-4.1-nano-2025-04-14"
39+
const ChatModelGPT4_1Nano2025_04_14 = shared.ChatModelGPT4_1Nano2025_04_14
40+
2341
// Equals "o3-mini"
2442
const ChatModelO3Mini = shared.ChatModelO3Mini
2543

betaassistant.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2181,6 +2181,12 @@ func (r BetaAssistantUpdateParams) MarshalJSON() (data []byte, err error) {
21812181
type BetaAssistantUpdateParamsModel string
21822182

21832183
const (
2184+
BetaAssistantUpdateParamsModelGPT4_1 BetaAssistantUpdateParamsModel = "gpt-4.1"
2185+
BetaAssistantUpdateParamsModelGPT4_1Mini BetaAssistantUpdateParamsModel = "gpt-4.1-mini"
2186+
BetaAssistantUpdateParamsModelGPT4_1Nano BetaAssistantUpdateParamsModel = "gpt-4.1-nano"
2187+
BetaAssistantUpdateParamsModelGPT4_1_2025_04_14 BetaAssistantUpdateParamsModel = "gpt-4.1-2025-04-14"
2188+
BetaAssistantUpdateParamsModelGPT4_1Mini2025_04_14 BetaAssistantUpdateParamsModel = "gpt-4.1-mini-2025-04-14"
2189+
BetaAssistantUpdateParamsModelGPT4_1Nano2025_04_14 BetaAssistantUpdateParamsModel = "gpt-4.1-nano-2025-04-14"
21842190
BetaAssistantUpdateParamsModelO3Mini BetaAssistantUpdateParamsModel = "o3-mini"
21852191
BetaAssistantUpdateParamsModelO3Mini2025_01_31 BetaAssistantUpdateParamsModel = "o3-mini-2025-01-31"
21862192
BetaAssistantUpdateParamsModelO1 BetaAssistantUpdateParamsModel = "o1"

betaassistant_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ 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.ChatModelO3Mini,
31+
Model: shared.ChatModelGPT4_1,
3232
Description: openai.String("description"),
3333
Instructions: openai.String("instructions"),
3434
Metadata: shared.MetadataParam{
@@ -114,7 +114,7 @@ func TestBetaAssistantUpdateWithOptionalParams(t *testing.T) {
114114
Metadata: shared.MetadataParam{
115115
"foo": "string",
116116
},
117-
Model: openai.BetaAssistantUpdateParamsModelO3Mini,
117+
Model: openai.BetaAssistantUpdateParamsModelGPT4_1,
118118
Name: openai.String("name"),
119119
ReasoningEffort: shared.ReasoningEffortLow,
120120
ResponseFormat: openai.AssistantResponseFormatOptionUnionParam{

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.MetadataParam{
176176
"foo": "string",
177177
},
178-
Model: shared.ChatModelO3Mini,
178+
Model: shared.ChatModelGPT4_1,
179179
ParallelToolCalls: openai.Bool(true),
180180
ResponseFormat: openai.AssistantResponseFormatOptionUnionParam{
181181
OfAuto: constant.ValueOf[constant.Auto](),

betathreadrun_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func TestBetaThreadRunNewWithOptionalParams(t *testing.T) {
5555
Metadata: shared.MetadataParam{
5656
"foo": "string",
5757
},
58-
Model: shared.ChatModelO3Mini,
58+
Model: shared.ChatModelGPT4_1,
5959
ParallelToolCalls: openai.Bool(true),
6060
ReasoningEffort: shared.ReasoningEffortLow,
6161
ResponseFormat: openai.AssistantResponseFormatOptionUnionParam{

chatcompletion_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func TestChatCompletionNewWithOptionalParams(t *testing.T) {
3535
Name: openai.String("name"),
3636
},
3737
}},
38-
Model: shared.ChatModelO3Mini,
38+
Model: shared.ChatModelGPT4_1,
3939
Audio: openai.ChatCompletionAudioParam{
4040
Format: openai.ChatCompletionAudioParamFormatWAV,
4141
Voice: openai.ChatCompletionAudioParamVoiceAlloy,

client_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func TestUserAgentHeader(t *testing.T) {
4848
},
4949
},
5050
}},
51-
Model: shared.ChatModelO3Mini,
51+
Model: shared.ChatModelGPT4_1,
5252
})
5353
if userAgent != fmt.Sprintf("OpenAI/Go %s", internal.PackageVersion) {
5454
t.Errorf("Expected User-Agent to be correct, but got: %#v", userAgent)
@@ -81,7 +81,7 @@ func TestRetryAfter(t *testing.T) {
8181
},
8282
},
8383
}},
84-
Model: shared.ChatModelO3Mini,
84+
Model: shared.ChatModelGPT4_1,
8585
})
8686
if err == nil {
8787
t.Error("Expected there to be a cancel error")
@@ -125,7 +125,7 @@ func TestDeleteRetryCountHeader(t *testing.T) {
125125
},
126126
},
127127
}},
128-
Model: shared.ChatModelO3Mini,
128+
Model: shared.ChatModelGPT4_1,
129129
})
130130
if err == nil {
131131
t.Error("Expected there to be a cancel error")
@@ -164,7 +164,7 @@ func TestOverwriteRetryCountHeader(t *testing.T) {
164164
},
165165
},
166166
}},
167-
Model: shared.ChatModelO3Mini,
167+
Model: shared.ChatModelGPT4_1,
168168
})
169169
if err == nil {
170170
t.Error("Expected there to be a cancel error")
@@ -202,7 +202,7 @@ func TestRetryAfterMs(t *testing.T) {
202202
},
203203
},
204204
}},
205-
Model: shared.ChatModelO3Mini,
205+
Model: shared.ChatModelGPT4_1,
206206
})
207207
if err == nil {
208208
t.Error("Expected there to be a cancel error")
@@ -234,7 +234,7 @@ func TestContextCancel(t *testing.T) {
234234
},
235235
},
236236
}},
237-
Model: shared.ChatModelO3Mini,
237+
Model: shared.ChatModelGPT4_1,
238238
})
239239
if err == nil {
240240
t.Error("Expected there to be a cancel error")
@@ -263,7 +263,7 @@ func TestContextCancelDelay(t *testing.T) {
263263
},
264264
},
265265
}},
266-
Model: shared.ChatModelO3Mini,
266+
Model: shared.ChatModelGPT4_1,
267267
})
268268
if err == nil {
269269
t.Error("expected there to be a cancel error")
@@ -298,7 +298,7 @@ func TestContextDeadline(t *testing.T) {
298298
},
299299
},
300300
}},
301-
Model: shared.ChatModelO3Mini,
301+
Model: shared.ChatModelGPT4_1,
302302
})
303303
if err == nil {
304304
t.Error("expected there to be a deadline error")
@@ -352,7 +352,7 @@ func TestContextDeadlineStreaming(t *testing.T) {
352352
},
353353
},
354354
}},
355-
Model: shared.ChatModelO3Mini,
355+
Model: shared.ChatModelGPT4_1,
356356
})
357357
for stream.Next() {
358358
_ = stream.Current()
@@ -408,7 +408,7 @@ func TestContextDeadlineStreamingWithRequestTimeout(t *testing.T) {
408408
},
409409
},
410410
}},
411-
Model: shared.ChatModelO3Mini,
411+
Model: shared.ChatModelGPT4_1,
412412
},
413413
option.WithRequestTimeout((100 * time.Millisecond)),
414414
)

responses/aliases.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,24 @@ type Error = apierror.Error
2020
// This is an alias to an internal type.
2121
type ChatModel = shared.ChatModel
2222

23+
// Equals "gpt-4.1"
24+
const ChatModelGPT4_1 = shared.ChatModelGPT4_1
25+
26+
// Equals "gpt-4.1-mini"
27+
const ChatModelGPT4_1Mini = shared.ChatModelGPT4_1Mini
28+
29+
// Equals "gpt-4.1-nano"
30+
const ChatModelGPT4_1Nano = shared.ChatModelGPT4_1Nano
31+
32+
// Equals "gpt-4.1-2025-04-14"
33+
const ChatModelGPT4_1_2025_04_14 = shared.ChatModelGPT4_1_2025_04_14
34+
35+
// Equals "gpt-4.1-mini-2025-04-14"
36+
const ChatModelGPT4_1Mini2025_04_14 = shared.ChatModelGPT4_1Mini2025_04_14
37+
38+
// Equals "gpt-4.1-nano-2025-04-14"
39+
const ChatModelGPT4_1Nano2025_04_14 = shared.ChatModelGPT4_1Nano2025_04_14
40+
2341
// Equals "o3-mini"
2442
const ChatModelO3Mini = shared.ChatModelO3Mini
2543

shared/shared.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ type paramObj = param.APIObject
2020
type ChatModel = string
2121

2222
const (
23+
ChatModelGPT4_1 ChatModel = "gpt-4.1"
24+
ChatModelGPT4_1Mini ChatModel = "gpt-4.1-mini"
25+
ChatModelGPT4_1Nano ChatModel = "gpt-4.1-nano"
26+
ChatModelGPT4_1_2025_04_14 ChatModel = "gpt-4.1-2025-04-14"
27+
ChatModelGPT4_1Mini2025_04_14 ChatModel = "gpt-4.1-mini-2025-04-14"
28+
ChatModelGPT4_1Nano2025_04_14 ChatModel = "gpt-4.1-nano-2025-04-14"
2329
ChatModelO3Mini ChatModel = "o3-mini"
2430
ChatModelO3Mini2025_01_31 ChatModel = "o3-mini-2025-01-31"
2531
ChatModelO1 ChatModel = "o1"

usage_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func TestUsage(t *testing.T) {
3333
},
3434
},
3535
}},
36-
Model: shared.ChatModelO3Mini,
36+
Model: shared.ChatModelGPT4_1,
3737
})
3838
if err != nil {
3939
t.Fatalf("err should be nil: %s", err.Error())

0 commit comments

Comments
 (0)