Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "3.8.1"
".": "3.9.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 123
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-eeba8addf3a5f412e5ce8d22031e60c61650cee3f5d9e587a2533f6818a249ea.yml
openapi_spec_hash: 0a4d8ad2469823ce24a3fd94f23f1c2b
config_hash: 0bb1941a78ece0b610a2fbba7d74a84c
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-a7e92d12ebe89ca019a7ac5b29759064eefa2c38fe08d03516f2620e66abb32b.yml
openapi_spec_hash: acbc703b2739447abc6312b2d753631c
config_hash: b876221dfb213df9f0a999e75d38a65e
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## 3.9.0 (2025-11-25)

Full Changelog: [v3.8.1...v3.9.0](https://github.com/openai/openai-go/compare/v3.8.1...v3.9.0)

### Features

* **api:** gpt 5.1 ([470f91f](https://github.com/openai/openai-go/commit/470f91faac304e518019be9f7b12e6270af63bbd))


### Bug Fixes

* **api:** align types of input items / output items for typescript ([5b89d3b](https://github.com/openai/openai-go/commit/5b89d3ba03968ee9f5b49e7e065495c3c5c77710))
* **client:** correctly specify Accept header with */* instead of empty ([fbadb4e](https://github.com/openai/openai-go/commit/fbadb4e8b1a81c99a7b3936da483ee9542de2c23))


### Chores

* bump gjson version ([305831f](https://github.com/openai/openai-go/commit/305831feb6c39d1f9f6e85c2e9f94f6c7f0dcd45))

## 3.8.1 (2025-11-04)

Full Changelog: [v3.8.0...v3.8.1](https://github.com/openai/openai-go/compare/v3.8.0...v3.8.1)
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Or to pin the version:
<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/openai/openai-go/v2@v3.8.1'
go get -u 'github.com/openai/openai-go/v2@v3.9.0'
```

<!-- x-release-please-end -->
Expand Down Expand Up @@ -62,7 +62,7 @@ func main() {
Messages: []openai.ChatCompletionMessageParamUnion{
openai.UserMessage("Say this is a test"),
},
Model: openai.ChatModelGPT4o,
Model: openai.ChatModelGPT5_1,
})
if err != nil {
panic(err.Error())
Expand Down Expand Up @@ -593,7 +593,7 @@ client.Chat.Completions.New(
},
},
}},
Model: shared.ChatModelGPT5,
Model: shared.ChatModelGPT5_1,
},
// This sets the per-retry timeout
option.WithRequestTimeout(20*time.Second),
Expand Down Expand Up @@ -774,7 +774,7 @@ client.Chat.Completions.New(
},
},
}},
Model: shared.ChatModelGPT5,
Model: shared.ChatModelGPT5_1,
},
option.WithMaxRetries(5),
)
Expand All @@ -798,7 +798,7 @@ chatCompletion, err := client.Chat.Completions.New(
},
},
}},
Model: shared.ChatModelGPT5,
Model: shared.ChatModelGPT5_1,
},
option.WithResponseInto(&response),
)
Expand Down
32 changes: 27 additions & 5 deletions aliases.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@ type Error = apierror.Error
// This is an alias to an internal type.
type ChatModel = shared.ChatModel

// Equals "gpt-5.1"
const ChatModelGPT5_1 = shared.ChatModelGPT5_1

// Equals "gpt-5.1-2025-11-13"
const ChatModelGPT5_1_2025_11_13 = shared.ChatModelGPT5_1_2025_11_13

// Equals "gpt-5.1-codex"
const ChatModelGPT5_1Codex = shared.ChatModelGPT5_1Codex

// Equals "gpt-5.1-mini"
const ChatModelGPT5_1Mini = shared.ChatModelGPT5_1Mini

// Equals "gpt-5.1-chat-latest"
const ChatModelGPT5_1ChatLatest = shared.ChatModelGPT5_1ChatLatest

// Equals "gpt-5"
const ChatModelGPT5 = shared.ChatModelGPT5

Expand Down Expand Up @@ -403,16 +418,23 @@ type ReasoningParam = shared.ReasoningParam

// Constrains effort on reasoning for
// [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
// supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
// effort can result in faster responses and fewer tokens used on reasoning in a
// response.
// supported values are `none`, `minimal`, `low`, `medium`, and `high`. Reducing
// reasoning effort can result in faster responses and fewer tokens used on
// reasoning in a response.
//
// Note: The `gpt-5-pro` model defaults to (and only supports) `high` reasoning
// effort.
// - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported
// reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool
// calls are supported for all reasoning values in gpt-5.1.
// - All models before `gpt-5.1` default to `medium` reasoning effort, and do not
// support `none`.
// - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.
//
// This is an alias to an internal type.
type ReasoningEffort = shared.ReasoningEffort

// Equals "none"
const ReasoningEffortNone = shared.ReasoningEffortNone

// Equals "minimal"
const ReasoningEffortMinimal = shared.ReasoningEffortMinimal

Expand Down
14 changes: 14 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -674,10 +674,12 @@ Methods:

Params Types:

- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
Expand All @@ -690,6 +692,7 @@ Params Types:
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
Expand All @@ -712,22 +715,28 @@ Params Types:
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>

Response Types:

- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
Expand Down Expand Up @@ -762,6 +771,9 @@ Response Types:
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
Expand Down Expand Up @@ -821,10 +833,12 @@ Response Types:
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
Expand Down
17 changes: 10 additions & 7 deletions batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,13 @@ type BatchNewParams struct {
// Any of "24h".
CompletionWindow BatchNewParamsCompletionWindow `json:"completion_window,omitzero,required"`
// The endpoint to be used for all requests in the batch. Currently
// `/v1/responses`, `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions`
// are supported. Note that `/v1/embeddings` batches are also restricted to a
// maximum of 50,000 embedding inputs across all requests in the batch.
// `/v1/responses`, `/v1/chat/completions`, `/v1/embeddings`, `/v1/completions`,
// and `/v1/moderations` are supported. Note that `/v1/embeddings` batches are also
// restricted to a maximum of 50,000 embedding inputs across all requests in the
// batch.
//
// Any of "/v1/responses", "/v1/chat/completions", "/v1/embeddings",
// "/v1/completions".
// "/v1/completions", "/v1/moderations".
Endpoint BatchNewParamsEndpoint `json:"endpoint,omitzero,required"`
// The ID of an uploaded file that contains requests for the new batch.
//
Expand Down Expand Up @@ -395,16 +396,18 @@ const (
)

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

const (
BatchNewParamsEndpointV1Responses BatchNewParamsEndpoint = "/v1/responses"
BatchNewParamsEndpointV1ChatCompletions BatchNewParamsEndpoint = "/v1/chat/completions"
BatchNewParamsEndpointV1Embeddings BatchNewParamsEndpoint = "/v1/embeddings"
BatchNewParamsEndpointV1Completions BatchNewParamsEndpoint = "/v1/completions"
BatchNewParamsEndpointV1Moderations BatchNewParamsEndpoint = "/v1/moderations"
)

// The expiration policy for the output and/or error file that are generated for a
Expand Down
Loading
Loading