Skip to content

Commit 470f91f

Browse files
feat(api): gpt 5.1
1 parent 471c8ae commit 470f91f

26 files changed

+2957
-739
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: 123
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-eeba8addf3a5f412e5ce8d22031e60c61650cee3f5d9e587a2533f6818a249ea.yml
3-
openapi_spec_hash: 0a4d8ad2469823ce24a3fd94f23f1c2b
4-
config_hash: 630eea84bb3067d25640419af058ed56
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-ca24bc4d8125b5153514ce643c4e3220f25971b7d67ca384d56d493c72c0d977.yml
3+
openapi_spec_hash: c6f048c7b3d29f4de48fde0e845ba33f
4+
config_hash: b876221dfb213df9f0a999e75d38a65e

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func main() {
6262
Messages: []openai.ChatCompletionMessageParamUnion{
6363
openai.UserMessage("Say this is a test"),
6464
},
65-
Model: openai.ChatModelGPT4o,
65+
Model: openai.ChatModelGPT5_1,
6666
})
6767
if err != nil {
6868
panic(err.Error())
@@ -593,7 +593,7 @@ client.Chat.Completions.New(
593593
},
594594
},
595595
}},
596-
Model: shared.ChatModelGPT5,
596+
Model: shared.ChatModelGPT5_1,
597597
},
598598
// This sets the per-retry timeout
599599
option.WithRequestTimeout(20*time.Second),
@@ -774,7 +774,7 @@ client.Chat.Completions.New(
774774
},
775775
},
776776
}},
777-
Model: shared.ChatModelGPT5,
777+
Model: shared.ChatModelGPT5_1,
778778
},
779779
option.WithMaxRetries(5),
780780
)
@@ -798,7 +798,7 @@ chatCompletion, err := client.Chat.Completions.New(
798798
},
799799
},
800800
}},
801-
Model: shared.ChatModelGPT5,
801+
Model: shared.ChatModelGPT5_1,
802802
},
803803
option.WithResponseInto(&response),
804804
)

aliases.go

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

22+
// Equals "gpt-5.1"
23+
const ChatModelGPT5_1 = shared.ChatModelGPT5_1
24+
25+
// Equals "gpt-5.1-2025-11-13"
26+
const ChatModelGPT5_1_2025_11_13 = shared.ChatModelGPT5_1_2025_11_13
27+
28+
// Equals "gpt-5.1-codex"
29+
const ChatModelGPT5_1Codex = shared.ChatModelGPT5_1Codex
30+
31+
// Equals "gpt-5.1-mini"
32+
const ChatModelGPT5_1Mini = shared.ChatModelGPT5_1Mini
33+
34+
// Equals "gpt-5.1-chat-latest"
35+
const ChatModelGPT5_1ChatLatest = shared.ChatModelGPT5_1ChatLatest
36+
2237
// Equals "gpt-5"
2338
const ChatModelGPT5 = shared.ChatModelGPT5
2439

@@ -403,16 +418,23 @@ type ReasoningParam = shared.ReasoningParam
403418

404419
// Constrains effort on reasoning for
405420
// [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
406-
// supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
407-
// effort can result in faster responses and fewer tokens used on reasoning in a
408-
// response.
421+
// supported values are `none`, `minimal`, `low`, `medium`, and `high`. Reducing
422+
// reasoning effort can result in faster responses and fewer tokens used on
423+
// reasoning in a response.
409424
//
410-
// Note: The `gpt-5-pro` model defaults to (and only supports) `high` reasoning
411-
// effort.
425+
// - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported
426+
// reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool
427+
// calls are supported for all reasoning values in gpt-5.1.
428+
// - All models before `gpt-5.1` default to `medium` reasoning effort, and do not
429+
// support `none`.
430+
// - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
412431
//
413432
// This is an alias to an internal type.
414433
type ReasoningEffort = shared.ReasoningEffort
415434

435+
// Equals "none"
436+
const ReasoningEffortNone = shared.ReasoningEffortNone
437+
416438
// Equals "minimal"
417439
const ReasoningEffortMinimal = shared.ReasoningEffortMinimal
418440

api.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,10 +674,12 @@ Methods:
674674

675675
Params Types:
676676

677+
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ApplyPatchToolParam">ApplyPatchToolParam</a>
677678
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ComputerToolParam">ComputerToolParam</a>
678679
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#CustomToolParam">CustomToolParam</a>
679680
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#EasyInputMessageParam">EasyInputMessageParam</a>
680681
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#FileSearchToolParam">FileSearchToolParam</a>
682+
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#FunctionShellToolParam">FunctionShellToolParam</a>
681683
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#FunctionToolParam">FunctionToolParam</a>
682684
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ResponseCodeInterpreterToolCallParam">ResponseCodeInterpreterToolCallParam</a>
683685
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ResponseComputerToolCallParam">ResponseComputerToolCallParam</a>
@@ -690,6 +692,7 @@ Params Types:
690692
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ResponseFormatTextJSONSchemaConfigParam">ResponseFormatTextJSONSchemaConfigParam</a>
691693
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ResponseFunctionCallOutputItemUnionParam">ResponseFunctionCallOutputItemUnionParam</a>
692694
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ResponseFunctionCallOutputItemListParam">ResponseFunctionCallOutputItemListParam</a>
695+
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ResponseFunctionShellCallOutputContentParam">ResponseFunctionShellCallOutputContentParam</a>
693696
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ResponseFunctionToolCallParam">ResponseFunctionToolCallParam</a>
694697
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ResponseFunctionWebSearchParam">ResponseFunctionWebSearchParam</a>
695698
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ResponseIncludable">ResponseIncludable</a>
@@ -712,22 +715,28 @@ Params Types:
712715
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ResponseTextConfigParam">ResponseTextConfigParam</a>
713716
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ToolUnionParam">ToolUnionParam</a>
714717
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ToolChoiceAllowedParam">ToolChoiceAllowedParam</a>
718+
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ToolChoiceApplyPatchParam">ToolChoiceApplyPatchParam</a>
715719
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ToolChoiceCustomParam">ToolChoiceCustomParam</a>
716720
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ToolChoiceFunctionParam">ToolChoiceFunctionParam</a>
717721
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ToolChoiceMcpParam">ToolChoiceMcpParam</a>
718722
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ToolChoiceOptions">ToolChoiceOptions</a>
723+
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ToolChoiceShellParam">ToolChoiceShellParam</a>
719724
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ToolChoiceTypesParam">ToolChoiceTypesParam</a>
720725
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#WebSearchPreviewToolParam">WebSearchPreviewToolParam</a>
721726
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#WebSearchToolParam">WebSearchToolParam</a>
722727

723728
Response Types:
724729

730+
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ApplyPatchTool">ApplyPatchTool</a>
725731
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ComputerTool">ComputerTool</a>
726732
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#CustomTool">CustomTool</a>
727733
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#EasyInputMessage">EasyInputMessage</a>
728734
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#FileSearchTool">FileSearchTool</a>
735+
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#FunctionShellTool">FunctionShellTool</a>
729736
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#FunctionTool">FunctionTool</a>
730737
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#Response">Response</a>
738+
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ResponseApplyPatchToolCall">ResponseApplyPatchToolCall</a>
739+
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ResponseApplyPatchToolCallOutput">ResponseApplyPatchToolCallOutput</a>
731740
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ResponseAudioDeltaEvent">ResponseAudioDeltaEvent</a>
732741
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ResponseAudioDoneEvent">ResponseAudioDoneEvent</a>
733742
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ResponseAudioTranscriptDeltaEvent">ResponseAudioTranscriptDeltaEvent</a>
@@ -762,6 +771,9 @@ Response Types:
762771
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ResponseFunctionCallArgumentsDoneEvent">ResponseFunctionCallArgumentsDoneEvent</a>
763772
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ResponseFunctionCallOutputItemUnion">ResponseFunctionCallOutputItemUnion</a>
764773
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ResponseFunctionCallOutputItemList">ResponseFunctionCallOutputItemList</a>
774+
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ResponseFunctionShellCallOutputContent">ResponseFunctionShellCallOutputContent</a>
775+
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ResponseFunctionShellToolCall">ResponseFunctionShellToolCall</a>
776+
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ResponseFunctionShellToolCallOutput">ResponseFunctionShellToolCallOutput</a>
765777
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ResponseFunctionToolCall">ResponseFunctionToolCall</a>
766778
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ResponseFunctionToolCallItem">ResponseFunctionToolCallItem</a>
767779
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ResponseFunctionToolCallOutputItem">ResponseFunctionToolCallOutputItem</a>
@@ -821,10 +833,12 @@ Response Types:
821833
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ResponseWebSearchCallSearchingEvent">ResponseWebSearchCallSearchingEvent</a>
822834
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ToolUnion">ToolUnion</a>
823835
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ToolChoiceAllowed">ToolChoiceAllowed</a>
836+
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ToolChoiceApplyPatch">ToolChoiceApplyPatch</a>
824837
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ToolChoiceCustom">ToolChoiceCustom</a>
825838
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ToolChoiceFunction">ToolChoiceFunction</a>
826839
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ToolChoiceMcp">ToolChoiceMcp</a>
827840
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ToolChoiceOptions">ToolChoiceOptions</a>
841+
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ToolChoiceShell">ToolChoiceShell</a>
828842
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#ToolChoiceTypes">ToolChoiceTypes</a>
829843
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#WebSearchPreviewTool">WebSearchPreviewTool</a>
830844
- <a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses">responses</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go/v3/responses#WebSearchTool">WebSearchTool</a>

batch.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -348,12 +348,13 @@ type BatchNewParams struct {
348348
// Any of "24h".
349349
CompletionWindow BatchNewParamsCompletionWindow `json:"completion_window,omitzero,required"`
350350
// The endpoint to be used for all requests in the batch. Currently
351-
// `/v1/responses`, `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions`
352-
// are supported. Note that `/v1/embeddings` batches are also restricted to a
353-
// maximum of 50,000 embedding inputs across all requests in the batch.
351+
// `/v1/responses`, `/v1/chat/completions`, `/v1/embeddings`, `/v1/completions`,
352+
// and `/v1/moderations` are supported. Note that `/v1/embeddings` batches are also
353+
// restricted to a maximum of 50,000 embedding inputs across all requests in the
354+
// batch.
354355
//
355356
// Any of "/v1/responses", "/v1/chat/completions", "/v1/embeddings",
356-
// "/v1/completions".
357+
// "/v1/completions", "/v1/moderations".
357358
Endpoint BatchNewParamsEndpoint `json:"endpoint,omitzero,required"`
358359
// The ID of an uploaded file that contains requests for the new batch.
359360
//
@@ -395,16 +396,18 @@ const (
395396
)
396397

397398
// The endpoint to be used for all requests in the batch. Currently
398-
// `/v1/responses`, `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions`
399-
// are supported. Note that `/v1/embeddings` batches are also restricted to a
400-
// maximum of 50,000 embedding inputs across all requests in the batch.
399+
// `/v1/responses`, `/v1/chat/completions`, `/v1/embeddings`, `/v1/completions`,
400+
// and `/v1/moderations` are supported. Note that `/v1/embeddings` batches are also
401+
// restricted to a maximum of 50,000 embedding inputs across all requests in the
402+
// batch.
401403
type BatchNewParamsEndpoint string
402404

403405
const (
404406
BatchNewParamsEndpointV1Responses BatchNewParamsEndpoint = "/v1/responses"
405407
BatchNewParamsEndpointV1ChatCompletions BatchNewParamsEndpoint = "/v1/chat/completions"
406408
BatchNewParamsEndpointV1Embeddings BatchNewParamsEndpoint = "/v1/embeddings"
407409
BatchNewParamsEndpointV1Completions BatchNewParamsEndpoint = "/v1/completions"
410+
BatchNewParamsEndpointV1Moderations BatchNewParamsEndpoint = "/v1/moderations"
408411
)
409412

410413
// The expiration policy for the output and/or error file that are generated for a

0 commit comments

Comments
 (0)