diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 96bcfa0d..9127b1bd 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "3.8.1"
+ ".": "3.9.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 3f222ce8..4f222cef 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -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
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f387d091..cd53c357 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,25 @@
# 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))
+* fix empty interfaces ([2aaa980](https://github.com/openai/openai-go/commit/2aaa980c2f0cac814065e4e5e294b151500c2e3f))
+
## 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)
diff --git a/README.md b/README.md
index 6614483c..47cb1546 100644
--- a/README.md
+++ b/README.md
@@ -30,7 +30,7 @@ Or to pin the 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'
```
@@ -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())
@@ -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),
@@ -774,7 +774,7 @@ client.Chat.Completions.New(
},
},
}},
- Model: shared.ChatModelGPT5,
+ Model: shared.ChatModelGPT5_1,
},
option.WithMaxRetries(5),
)
@@ -798,7 +798,7 @@ chatCompletion, err := client.Chat.Completions.New(
},
},
}},
- Model: shared.ChatModelGPT5,
+ Model: shared.ChatModelGPT5_1,
},
option.WithResponseInto(&response),
)
diff --git a/aliases.go b/aliases.go
index c390bc3b..1e740224 100644
--- a/aliases.go
+++ b/aliases.go
@@ -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
@@ -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
diff --git a/api.md b/api.md
index bcdfd26f..9951d520 100644
--- a/api.md
+++ b/api.md
@@ -674,10 +674,12 @@ Methods:
Params Types:
+- responses.ApplyPatchToolParam
- responses.ComputerToolParam
- responses.CustomToolParam
- responses.EasyInputMessageParam
- responses.FileSearchToolParam
+- responses.FunctionShellToolParam
- responses.FunctionToolParam
- responses.ResponseCodeInterpreterToolCallParam
- responses.ResponseComputerToolCallParam
@@ -690,6 +692,7 @@ Params Types:
- responses.ResponseFormatTextJSONSchemaConfigParam
- responses.ResponseFunctionCallOutputItemUnionParam
- responses.ResponseFunctionCallOutputItemListParam
+- responses.ResponseFunctionShellCallOutputContentParam
- responses.ResponseFunctionToolCallParam
- responses.ResponseFunctionWebSearchParam
- responses.ResponseIncludable
@@ -712,22 +715,28 @@ Params Types:
- responses.ResponseTextConfigParam
- responses.ToolUnionParam
- responses.ToolChoiceAllowedParam
+- responses.ToolChoiceApplyPatchParam
- responses.ToolChoiceCustomParam
- responses.ToolChoiceFunctionParam
- responses.ToolChoiceMcpParam
- responses.ToolChoiceOptions
+- responses.ToolChoiceShellParam
- responses.ToolChoiceTypesParam
- responses.WebSearchPreviewToolParam
- responses.WebSearchToolParam
Response Types:
+- responses.ApplyPatchTool
- responses.ComputerTool
- responses.CustomTool
- responses.EasyInputMessage
- responses.FileSearchTool
+- responses.FunctionShellTool
- responses.FunctionTool
- responses.Response
+- responses.ResponseApplyPatchToolCall
+- responses.ResponseApplyPatchToolCallOutput
- responses.ResponseAudioDeltaEvent
- responses.ResponseAudioDoneEvent
- responses.ResponseAudioTranscriptDeltaEvent
@@ -762,6 +771,9 @@ Response Types:
- responses.ResponseFunctionCallArgumentsDoneEvent
- responses.ResponseFunctionCallOutputItemUnion
- responses.ResponseFunctionCallOutputItemList
+- responses.ResponseFunctionShellCallOutputContent
+- responses.ResponseFunctionShellToolCall
+- responses.ResponseFunctionShellToolCallOutput
- responses.ResponseFunctionToolCall
- responses.ResponseFunctionToolCallItem
- responses.ResponseFunctionToolCallOutputItem
@@ -821,10 +833,12 @@ Response Types:
- responses.ResponseWebSearchCallSearchingEvent
- responses.ToolUnion
- responses.ToolChoiceAllowed
+- responses.ToolChoiceApplyPatch
- responses.ToolChoiceCustom
- responses.ToolChoiceFunction
- responses.ToolChoiceMcp
- responses.ToolChoiceOptions
+- responses.ToolChoiceShell
- responses.ToolChoiceTypes
- responses.WebSearchPreviewTool
- responses.WebSearchTool
diff --git a/batch.go b/batch.go
index 20853830..6005c0a8 100644
--- a/batch.go
+++ b/batch.go
@@ -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.
//
@@ -395,9 +396,10 @@ 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 (
@@ -405,6 +407,7 @@ const (
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
diff --git a/betaassistant.go b/betaassistant.go
index ea4bc634..68510735 100644
--- a/betaassistant.go
+++ b/betaassistant.go
@@ -1783,14 +1783,18 @@ type BetaAssistantNewParams struct {
Metadata shared.Metadata `json:"metadata,omitzero"`
// 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.
//
- // Any of "minimal", "low", "medium", "high".
+ // Any of "none", "minimal", "low", "medium", "high".
ReasoningEffort shared.ReasoningEffort `json:"reasoning_effort,omitzero"`
// A set of resources that are used by the assistant's tools. The resources are
// specific to the type of tool. For example, the `code_interpreter` tool requires
@@ -2056,14 +2060,18 @@ type BetaAssistantUpdateParams struct {
Metadata shared.Metadata `json:"metadata,omitzero"`
// 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.
//
- // Any of "minimal", "low", "medium", "high".
+ // Any of "none", "minimal", "low", "medium", "high".
ReasoningEffort shared.ReasoningEffort `json:"reasoning_effort,omitzero"`
// A set of resources that are used by the assistant's tools. The resources are
// specific to the type of tool. For example, the `code_interpreter` tool requires
diff --git a/betaassistant_test.go b/betaassistant_test.go
index 49a6885a..d17482c2 100644
--- a/betaassistant_test.go
+++ b/betaassistant_test.go
@@ -28,14 +28,14 @@ func TestBetaAssistantNewWithOptionalParams(t *testing.T) {
option.WithAPIKey("My API Key"),
)
_, err := client.Beta.Assistants.New(context.TODO(), openai.BetaAssistantNewParams{
- Model: shared.ChatModelGPT5,
+ Model: shared.ChatModelGPT5_1,
Description: openai.String("description"),
Instructions: openai.String("instructions"),
Metadata: shared.Metadata{
"foo": "string",
},
Name: openai.String("name"),
- ReasoningEffort: shared.ReasoningEffortMinimal,
+ ReasoningEffort: shared.ReasoningEffortNone,
ResponseFormat: openai.AssistantResponseFormatOptionUnionParam{
OfAuto: constant.ValueOf[constant.Auto](),
},
@@ -116,7 +116,7 @@ func TestBetaAssistantUpdateWithOptionalParams(t *testing.T) {
},
Model: openai.BetaAssistantUpdateParamsModelGPT5,
Name: openai.String("name"),
- ReasoningEffort: shared.ReasoningEffortMinimal,
+ ReasoningEffort: shared.ReasoningEffortNone,
ResponseFormat: openai.AssistantResponseFormatOptionUnionParam{
OfAuto: constant.ValueOf[constant.Auto](),
},
diff --git a/betathread_test.go b/betathread_test.go
index e49516a8..ea8b6be2 100644
--- a/betathread_test.go
+++ b/betathread_test.go
@@ -175,7 +175,7 @@ func TestBetaThreadNewAndRunWithOptionalParams(t *testing.T) {
Metadata: shared.Metadata{
"foo": "string",
},
- Model: shared.ChatModelGPT5,
+ Model: shared.ChatModelGPT5_1,
ParallelToolCalls: openai.Bool(true),
ResponseFormat: openai.AssistantResponseFormatOptionUnionParam{
OfAuto: constant.ValueOf[constant.Auto](),
diff --git a/betathreadrun.go b/betathreadrun.go
index 88da6c35..868c99e7 100644
--- a/betathreadrun.go
+++ b/betathreadrun.go
@@ -624,14 +624,18 @@ type BetaThreadRunNewParams struct {
Model shared.ChatModel `json:"model,omitzero"`
// 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.
//
- // Any of "minimal", "low", "medium", "high".
+ // Any of "none", "minimal", "low", "medium", "high".
ReasoningEffort shared.ReasoningEffort `json:"reasoning_effort,omitzero"`
// Override the tools the assistant can use for this run. This is useful for
// modifying the behavior on a per-run basis.
diff --git a/betathreadrun_test.go b/betathreadrun_test.go
index 60d469d4..bbd66be9 100644
--- a/betathreadrun_test.go
+++ b/betathreadrun_test.go
@@ -55,9 +55,9 @@ func TestBetaThreadRunNewWithOptionalParams(t *testing.T) {
Metadata: shared.Metadata{
"foo": "string",
},
- Model: shared.ChatModelGPT5,
+ Model: shared.ChatModelGPT5_1,
ParallelToolCalls: openai.Bool(true),
- ReasoningEffort: shared.ReasoningEffortMinimal,
+ ReasoningEffort: shared.ReasoningEffortNone,
ResponseFormat: openai.AssistantResponseFormatOptionUnionParam{
OfAuto: constant.ValueOf[constant.Auto](),
},
diff --git a/chatcompletion.go b/chatcompletion.go
index 2f937388..ddbe9c53 100644
--- a/chatcompletion.go
+++ b/chatcompletion.go
@@ -3021,16 +3021,27 @@ type ChatCompletionNewParams struct {
//
// Any of "text", "audio".
Modalities []string `json:"modalities,omitzero"`
+ // The retention policy for the prompt cache. Set to `24h` to enable extended
+ // prompt caching, which keeps cached prefixes active for longer, up to a maximum
+ // of 24 hours.
+ // [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
+ //
+ // Any of "in-memory", "24h".
+ PromptCacheRetention ChatCompletionNewParamsPromptCacheRetention `json:"prompt_cache_retention,omitzero"`
// 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.
- //
- // Note: The `gpt-5-pro` model defaults to (and only supports) `high` reasoning
- // effort.
- //
- // Any of "minimal", "low", "medium", "high".
+ // 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.
+ //
+ // - `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.
+ //
+ // Any of "none", "minimal", "low", "medium", "high".
ReasoningEffort shared.ReasoningEffort `json:"reasoning_effort,omitzero"`
// Specifies the processing type used for serving the request.
//
@@ -3191,6 +3202,17 @@ func (r *ChatCompletionNewParamsFunction) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+// The retention policy for the prompt cache. Set to `24h` to enable extended
+// prompt caching, which keeps cached prefixes active for longer, up to a maximum
+// of 24 hours.
+// [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
+type ChatCompletionNewParamsPromptCacheRetention string
+
+const (
+ ChatCompletionNewParamsPromptCacheRetentionInMemory ChatCompletionNewParamsPromptCacheRetention = "in-memory"
+ ChatCompletionNewParamsPromptCacheRetention24h ChatCompletionNewParamsPromptCacheRetention = "24h"
+)
+
// Only one field can be non-zero.
//
// Use [param.IsOmitted] to confirm if a field is set.
diff --git a/chatcompletion_test.go b/chatcompletion_test.go
index 1323506c..9d09473f 100644
--- a/chatcompletion_test.go
+++ b/chatcompletion_test.go
@@ -35,7 +35,7 @@ func TestChatCompletionNewWithOptionalParams(t *testing.T) {
Name: openai.String("name"),
},
}},
- Model: shared.ChatModelGPT5,
+ Model: shared.ChatModelGPT5_1,
Audio: openai.ChatCompletionAudioParam{
Format: openai.ChatCompletionAudioParamFormatWAV,
Voice: openai.ChatCompletionAudioParamVoiceAlloy,
@@ -68,9 +68,10 @@ func TestChatCompletionNewWithOptionalParams(t *testing.T) {
OfString: openai.String("string"),
},
},
- PresencePenalty: openai.Float(-2),
- PromptCacheKey: openai.String("prompt-cache-key-1234"),
- ReasoningEffort: shared.ReasoningEffortMinimal,
+ PresencePenalty: openai.Float(-2),
+ PromptCacheKey: openai.String("prompt-cache-key-1234"),
+ PromptCacheRetention: openai.ChatCompletionNewParamsPromptCacheRetentionInMemory,
+ ReasoningEffort: shared.ReasoningEffortNone,
ResponseFormat: openai.ChatCompletionNewParamsResponseFormatUnion{
OfText: &shared.ResponseFormatTextParam{},
},
diff --git a/client_test.go b/client_test.go
index 11f609b6..ea7489aa 100644
--- a/client_test.go
+++ b/client_test.go
@@ -48,7 +48,7 @@ func TestUserAgentHeader(t *testing.T) {
},
},
}},
- Model: shared.ChatModelGPT5,
+ Model: shared.ChatModelGPT5_1,
})
if userAgent != fmt.Sprintf("OpenAI/Go %s", internal.PackageVersion) {
t.Errorf("Expected User-Agent to be correct, but got: %#v", userAgent)
@@ -81,7 +81,7 @@ func TestRetryAfter(t *testing.T) {
},
},
}},
- Model: shared.ChatModelGPT5,
+ Model: shared.ChatModelGPT5_1,
})
if err == nil {
t.Error("Expected there to be a cancel error")
@@ -125,7 +125,7 @@ func TestDeleteRetryCountHeader(t *testing.T) {
},
},
}},
- Model: shared.ChatModelGPT5,
+ Model: shared.ChatModelGPT5_1,
})
if err == nil {
t.Error("Expected there to be a cancel error")
@@ -164,7 +164,7 @@ func TestOverwriteRetryCountHeader(t *testing.T) {
},
},
}},
- Model: shared.ChatModelGPT5,
+ Model: shared.ChatModelGPT5_1,
})
if err == nil {
t.Error("Expected there to be a cancel error")
@@ -202,7 +202,7 @@ func TestRetryAfterMs(t *testing.T) {
},
},
}},
- Model: shared.ChatModelGPT5,
+ Model: shared.ChatModelGPT5_1,
})
if err == nil {
t.Error("Expected there to be a cancel error")
@@ -234,7 +234,7 @@ func TestContextCancel(t *testing.T) {
},
},
}},
- Model: shared.ChatModelGPT5,
+ Model: shared.ChatModelGPT5_1,
})
if err == nil {
t.Error("Expected there to be a cancel error")
@@ -263,7 +263,7 @@ func TestContextCancelDelay(t *testing.T) {
},
},
}},
- Model: shared.ChatModelGPT5,
+ Model: shared.ChatModelGPT5_1,
})
if err == nil {
t.Error("expected there to be a cancel error")
@@ -298,7 +298,7 @@ func TestContextDeadline(t *testing.T) {
},
},
}},
- Model: shared.ChatModelGPT5,
+ Model: shared.ChatModelGPT5_1,
})
if err == nil {
t.Error("expected there to be a deadline error")
@@ -352,7 +352,7 @@ func TestContextDeadlineStreaming(t *testing.T) {
},
},
}},
- Model: shared.ChatModelGPT5,
+ Model: shared.ChatModelGPT5_1,
})
for stream.Next() {
_ = stream.Current()
@@ -408,7 +408,7 @@ func TestContextDeadlineStreamingWithRequestTimeout(t *testing.T) {
},
},
}},
- Model: shared.ChatModelGPT5,
+ Model: shared.ChatModelGPT5_1,
},
option.WithRequestTimeout((100 * time.Millisecond)),
)
diff --git a/container.go b/container.go
index 407d8662..aeb8c278 100644
--- a/container.go
+++ b/container.go
@@ -86,7 +86,7 @@ func (r *ContainerService) ListAutoPaging(ctx context.Context, query ContainerLi
// Delete Container
func (r *ContainerService) Delete(ctx context.Context, containerID string, opts ...option.RequestOption) (err error) {
opts = slices.Concat(r.Options, opts)
- opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
+ opts = append([]option.RequestOption{option.WithHeader("Accept", "*/*")}, opts...)
if containerID == "" {
err = errors.New("missing required container_id parameter")
return
diff --git a/containerfile.go b/containerfile.go
index aa957c86..878cf949 100644
--- a/containerfile.go
+++ b/containerfile.go
@@ -106,7 +106,7 @@ func (r *ContainerFileService) ListAutoPaging(ctx context.Context, containerID s
// Delete Container File
func (r *ContainerFileService) Delete(ctx context.Context, containerID string, fileID string, opts ...option.RequestOption) (err error) {
opts = slices.Concat(r.Options, opts)
- opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
+ opts = append([]option.RequestOption{option.WithHeader("Accept", "*/*")}, opts...)
if containerID == "" {
err = errors.New("missing required container_id parameter")
return
diff --git a/conversations/aliases.go b/conversations/aliases.go
index 47bf438c..88384745 100644
--- a/conversations/aliases.go
+++ b/conversations/aliases.go
@@ -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
@@ -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
diff --git a/conversations/item.go b/conversations/item.go
index c385c770..6858b094 100644
--- a/conversations/item.go
+++ b/conversations/item.go
@@ -120,9 +120,13 @@ func (r *ItemService) Delete(ctx context.Context, conversationID string, itemID
// [responses.ResponseComputerToolCallOutputItem],
// [responses.ResponseReasoningItem], [responses.ResponseCodeInterpreterToolCall],
// [ConversationItemLocalShellCall], [ConversationItemLocalShellCallOutput],
-// [ConversationItemMcpListTools], [ConversationItemMcpApprovalRequest],
-// [ConversationItemMcpApprovalResponse], [ConversationItemMcpCall],
-// [responses.ResponseCustomToolCall], [responses.ResponseCustomToolCallOutput].
+// [responses.ResponseFunctionShellToolCall],
+// [responses.ResponseFunctionShellToolCallOutput],
+// [responses.ResponseApplyPatchToolCall],
+// [responses.ResponseApplyPatchToolCallOutput], [ConversationItemMcpListTools],
+// [ConversationItemMcpApprovalRequest], [ConversationItemMcpApprovalResponse],
+// [ConversationItemMcpCall], [responses.ResponseCustomToolCall],
+// [responses.ResponseCustomToolCallOutput].
//
// Use the [ConversationItemUnion.AsAny] method to switch on the variant.
//
@@ -138,16 +142,18 @@ type ConversationItemUnion struct {
// Any of "message", "function_call", "function_call_output", "file_search_call",
// "web_search_call", "image_generation_call", "computer_call",
// "computer_call_output", "reasoning", "code_interpreter_call",
- // "local_shell_call", "local_shell_call_output", "mcp_list_tools",
- // "mcp_approval_request", "mcp_approval_response", "mcp_call", "custom_tool_call",
- // "custom_tool_call_output".
+ // "local_shell_call", "local_shell_call_output", "shell_call",
+ // "shell_call_output", "apply_patch_call", "apply_patch_call_output",
+ // "mcp_list_tools", "mcp_approval_request", "mcp_approval_response", "mcp_call",
+ // "custom_tool_call", "custom_tool_call_output".
Type string `json:"type"`
Arguments string `json:"arguments"`
CallID string `json:"call_id"`
Name string `json:"name"`
// This field is a union of
// [responses.ResponseFunctionToolCallOutputItemOutputUnion],
- // [responses.ResponseComputerToolCallOutputScreenshot], [string], [string],
+ // [responses.ResponseComputerToolCallOutputScreenshot], [string],
+ // [[]responses.ResponseFunctionShellToolCallOutputOutput], [string], [string],
// [responses.ResponseCustomToolCallOutputOutputUnion]
Output ConversationItemUnionOutput `json:"output"`
// This field is from variant [responses.ResponseFileSearchToolCall].
@@ -156,7 +162,8 @@ type ConversationItemUnion struct {
Results []responses.ResponseFileSearchToolCallResult `json:"results"`
// This field is a union of [responses.ResponseFunctionWebSearchActionUnion],
// [responses.ResponseComputerToolCallActionUnion],
- // [ConversationItemLocalShellCallAction]
+ // [ConversationItemLocalShellCallAction],
+ // [responses.ResponseFunctionShellToolCallAction]
Action ConversationItemUnionAction `json:"action"`
// This field is from variant [ConversationItemImageGenerationCall].
Result string `json:"result"`
@@ -173,8 +180,13 @@ type ConversationItemUnion struct {
// This field is from variant [responses.ResponseCodeInterpreterToolCall].
ContainerID string `json:"container_id"`
// This field is from variant [responses.ResponseCodeInterpreterToolCall].
- Outputs []responses.ResponseCodeInterpreterToolCallOutputUnion `json:"outputs"`
- ServerLabel string `json:"server_label"`
+ Outputs []responses.ResponseCodeInterpreterToolCallOutputUnion `json:"outputs"`
+ CreatedBy string `json:"created_by"`
+ // This field is from variant [responses.ResponseFunctionShellToolCallOutput].
+ MaxOutputLength int64 `json:"max_output_length"`
+ // This field is from variant [responses.ResponseApplyPatchToolCall].
+ Operation responses.ResponseApplyPatchToolCallOperationUnion `json:"operation"`
+ ServerLabel string `json:"server_label"`
// This field is from variant [ConversationItemMcpListTools].
Tools []ConversationItemMcpListToolsTool `json:"tools"`
Error string `json:"error"`
@@ -206,6 +218,9 @@ type ConversationItemUnion struct {
Code respjson.Field
ContainerID respjson.Field
Outputs respjson.Field
+ CreatedBy respjson.Field
+ MaxOutputLength respjson.Field
+ Operation respjson.Field
ServerLabel respjson.Field
Tools respjson.Field
Error respjson.Field
@@ -247,6 +262,10 @@ func (ConversationItemMcpCall) ImplConversationItemUnion() {}
// case responses.ResponseCodeInterpreterToolCall:
// case conversations.ConversationItemLocalShellCall:
// case conversations.ConversationItemLocalShellCallOutput:
+// case responses.ResponseFunctionShellToolCall:
+// case responses.ResponseFunctionShellToolCallOutput:
+// case responses.ResponseApplyPatchToolCall:
+// case responses.ResponseApplyPatchToolCallOutput:
// case conversations.ConversationItemMcpListTools:
// case conversations.ConversationItemMcpApprovalRequest:
// case conversations.ConversationItemMcpApprovalResponse:
@@ -282,6 +301,14 @@ func (u ConversationItemUnion) AsAny() anyConversationItem {
return u.AsLocalShellCall()
case "local_shell_call_output":
return u.AsLocalShellCallOutput()
+ case "shell_call":
+ return u.AsShellCall()
+ case "shell_call_output":
+ return u.AsShellCallOutput()
+ case "apply_patch_call":
+ return u.AsApplyPatchCall()
+ case "apply_patch_call_output":
+ return u.AsApplyPatchCallOutput()
case "mcp_list_tools":
return u.AsMcpListTools()
case "mcp_approval_request":
@@ -358,6 +385,26 @@ func (u ConversationItemUnion) AsLocalShellCallOutput() (v ConversationItemLocal
return
}
+func (u ConversationItemUnion) AsShellCall() (v responses.ResponseFunctionShellToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ConversationItemUnion) AsShellCallOutput() (v responses.ResponseFunctionShellToolCallOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ConversationItemUnion) AsApplyPatchCall() (v responses.ResponseApplyPatchToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ConversationItemUnion) AsApplyPatchCallOutput() (v responses.ResponseApplyPatchToolCallOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
func (u ConversationItemUnion) AsMcpListTools() (v ConversationItemMcpListTools) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
@@ -430,7 +477,8 @@ func (r *ConversationItemUnionContent) UnmarshalJSON(data []byte) error {
// [ConversationItemUnion].
//
// If the underlying value is not a json object, one of the following properties
-// will be valid: OfString OfOutputContentList]
+// will be valid: OfString OfOutputContentList
+// OfResponseFunctionShellToolCallOutputOutputArray]
type ConversationItemUnionOutput struct {
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
@@ -438,6 +486,9 @@ type ConversationItemUnionOutput struct {
// [[]responses.ResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion]
// instead of an object.
OfOutputContentList []responses.ResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion `json:",inline"`
+ // This field will be present if the value is a
+ // [[]responses.ResponseFunctionShellToolCallOutputOutput] instead of an object.
+ OfResponseFunctionShellToolCallOutputOutputArray []responses.ResponseFunctionShellToolCallOutputOutput `json:",inline"`
// This field is from variant [responses.ResponseComputerToolCallOutputScreenshot].
Type constant.ComputerScreenshot `json:"type"`
// This field is from variant [responses.ResponseComputerToolCallOutputScreenshot].
@@ -445,12 +496,13 @@ type ConversationItemUnionOutput struct {
// This field is from variant [responses.ResponseComputerToolCallOutputScreenshot].
ImageURL string `json:"image_url"`
JSON struct {
- OfString respjson.Field
- OfOutputContentList respjson.Field
- Type respjson.Field
- FileID respjson.Field
- ImageURL respjson.Field
- raw string
+ OfString respjson.Field
+ OfOutputContentList respjson.Field
+ OfResponseFunctionShellToolCallOutputOutputArray respjson.Field
+ Type respjson.Field
+ FileID respjson.Field
+ ImageURL respjson.Field
+ raw string
} `json:"-"`
}
@@ -490,14 +542,17 @@ type ConversationItemUnionAction struct {
// This field is from variant [ConversationItemLocalShellCallAction].
Command []string `json:"command"`
// This field is from variant [ConversationItemLocalShellCallAction].
- Env map[string]string `json:"env"`
- // This field is from variant [ConversationItemLocalShellCallAction].
- TimeoutMs int64 `json:"timeout_ms"`
+ Env map[string]string `json:"env"`
+ TimeoutMs int64 `json:"timeout_ms"`
// This field is from variant [ConversationItemLocalShellCallAction].
User string `json:"user"`
// This field is from variant [ConversationItemLocalShellCallAction].
WorkingDirectory string `json:"working_directory"`
- JSON struct {
+ // This field is from variant [responses.ResponseFunctionShellToolCallAction].
+ Commands []string `json:"commands"`
+ // This field is from variant [responses.ResponseFunctionShellToolCallAction].
+ MaxOutputLength int64 `json:"max_output_length"`
+ JSON struct {
Query respjson.Field
Type respjson.Field
Sources respjson.Field
@@ -516,6 +571,8 @@ type ConversationItemUnionAction struct {
TimeoutMs respjson.Field
User respjson.Field
WorkingDirectory respjson.Field
+ Commands respjson.Field
+ MaxOutputLength respjson.Field
raw string
} `json:"-"`
}
diff --git a/finetuningalphagrader_test.go b/finetuningalphagrader_test.go
index b61b8967..7bcd4e1f 100644
--- a/finetuningalphagrader_test.go
+++ b/finetuningalphagrader_test.go
@@ -35,7 +35,7 @@ func TestFineTuningAlphaGraderRunWithOptionalParams(t *testing.T) {
},
},
ModelSample: "model_sample",
- Item: map[string]interface{}{},
+ Item: map[string]any{},
})
if err != nil {
var apierr *openai.Error
diff --git a/go.mod b/go.mod
index 98b20ad8..3193068d 100644
--- a/go.mod
+++ b/go.mod
@@ -5,7 +5,7 @@ go 1.22
require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.0
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0
- github.com/tidwall/gjson v1.14.4
+ github.com/tidwall/gjson v1.18.0
github.com/tidwall/sjson v1.2.5
)
diff --git a/go.sum b/go.sum
index 347c1185..7795f789 100644
--- a/go.sum
+++ b/go.sum
@@ -21,8 +21,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
-github.com/tidwall/gjson v1.14.4 h1:uo0p8EbA09J7RQaflQ1aBRffTR7xedD2bcIVSYxLnkM=
-github.com/tidwall/gjson v1.14.4/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
+github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
+github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
diff --git a/gradergradermodel.go b/gradergradermodel.go
index 5d7a7dbd..abb501f0 100644
--- a/gradergradermodel.go
+++ b/gradergradermodel.go
@@ -1049,14 +1049,18 @@ type ScoreModelGraderSamplingParams struct {
MaxCompletionsTokens int64 `json:"max_completions_tokens,nullable"`
// 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.
//
- // Any of "minimal", "low", "medium", "high".
+ // Any of "none", "minimal", "low", "medium", "high".
ReasoningEffort shared.ReasoningEffort `json:"reasoning_effort,nullable"`
// A seed value to initialize the randomness, during sampling.
Seed int64 `json:"seed,nullable"`
@@ -1297,14 +1301,18 @@ type ScoreModelGraderSamplingParamsParam struct {
TopP param.Opt[float64] `json:"top_p,omitzero"`
// 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.
//
- // Any of "minimal", "low", "medium", "high".
+ // Any of "none", "minimal", "low", "medium", "high".
ReasoningEffort shared.ReasoningEffort `json:"reasoning_effort,omitzero"`
paramObj
}
diff --git a/internal/version.go b/internal/version.go
index a65f1473..f59c0ae2 100644
--- a/internal/version.go
+++ b/internal/version.go
@@ -2,4 +2,4 @@
package internal
-const PackageVersion = "3.8.1" // x-release-please-version
+const PackageVersion = "3.9.0" // x-release-please-version
diff --git a/realtime/aliases.go b/realtime/aliases.go
index 148a7a76..5f78547b 100644
--- a/realtime/aliases.go
+++ b/realtime/aliases.go
@@ -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
@@ -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
diff --git a/realtime/call.go b/realtime/call.go
index 0f3bfe23..57e54da7 100644
--- a/realtime/call.go
+++ b/realtime/call.go
@@ -40,7 +40,7 @@ func NewCallService(opts ...option.RequestOption) (r CallService) {
// it.
func (r *CallService) Accept(ctx context.Context, callID string, body CallAcceptParams, opts ...option.RequestOption) (err error) {
opts = slices.Concat(r.Options, opts)
- opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
+ opts = append([]option.RequestOption{option.WithHeader("Accept", "*/*")}, opts...)
if callID == "" {
err = errors.New("missing required call_id parameter")
return
@@ -53,7 +53,7 @@ func (r *CallService) Accept(ctx context.Context, callID string, body CallAccept
// End an active Realtime API call, whether it was initiated over SIP or WebRTC.
func (r *CallService) Hangup(ctx context.Context, callID string, opts ...option.RequestOption) (err error) {
opts = slices.Concat(r.Options, opts)
- opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
+ opts = append([]option.RequestOption{option.WithHeader("Accept", "*/*")}, opts...)
if callID == "" {
err = errors.New("missing required call_id parameter")
return
@@ -66,7 +66,7 @@ func (r *CallService) Hangup(ctx context.Context, callID string, opts ...option.
// Transfer an active SIP call to a new destination using the SIP REFER verb.
func (r *CallService) Refer(ctx context.Context, callID string, body CallReferParams, opts ...option.RequestOption) (err error) {
opts = slices.Concat(r.Options, opts)
- opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
+ opts = append([]option.RequestOption{option.WithHeader("Accept", "*/*")}, opts...)
if callID == "" {
err = errors.New("missing required call_id parameter")
return
@@ -79,7 +79,7 @@ func (r *CallService) Refer(ctx context.Context, callID string, body CallReferPa
// Decline an incoming SIP call by returning a SIP status code to the caller.
func (r *CallService) Reject(ctx context.Context, callID string, body CallRejectParams, opts ...option.RequestOption) (err error) {
opts = slices.Concat(r.Options, opts)
- opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
+ opts = append([]option.RequestOption{option.WithHeader("Accept", "*/*")}, opts...)
if callID == "" {
err = errors.New("missing required call_id parameter")
return
diff --git a/realtime/call_test.go b/realtime/call_test.go
index caad14e7..d02e1d70 100644
--- a/realtime/call_test.go
+++ b/realtime/call_test.go
@@ -94,7 +94,7 @@ func TestCallAcceptWithOptionalParams(t *testing.T) {
OfFunction: &realtime.RealtimeFunctionToolParam{
Description: openai.String("description"),
Name: openai.String("name"),
- Parameters: map[string]interface{}{},
+ Parameters: map[string]any{},
Type: realtime.RealtimeFunctionToolTypeFunction,
},
}},
diff --git a/realtime/clientsecret_test.go b/realtime/clientsecret_test.go
index 0e5ba3d5..feeca1cd 100644
--- a/realtime/clientsecret_test.go
+++ b/realtime/clientsecret_test.go
@@ -96,7 +96,7 @@ func TestClientSecretNewWithOptionalParams(t *testing.T) {
OfFunction: &realtime.RealtimeFunctionToolParam{
Description: openai.String("description"),
Name: openai.String("name"),
- Parameters: map[string]interface{}{},
+ Parameters: map[string]any{},
Type: realtime.RealtimeFunctionToolTypeFunction,
},
}},
diff --git a/responses/aliases.go b/responses/aliases.go
index 28e825f8..88dc6736 100644
--- a/responses/aliases.go
+++ b/responses/aliases.go
@@ -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
@@ -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
diff --git a/responses/inputtoken.go b/responses/inputtoken.go
index b67e9d2f..77a5994e 100644
--- a/responses/inputtoken.go
+++ b/responses/inputtoken.go
@@ -220,12 +220,14 @@ func init() {
// Use [param.IsOmitted] to confirm if a field is set.
type InputTokenCountParamsToolChoiceUnion struct {
// Check if union is this variant with !param.IsOmitted(union.OfToolChoiceMode)
- OfToolChoiceMode param.Opt[ToolChoiceOptions] `json:",omitzero,inline"`
- OfAllowedTools *ToolChoiceAllowedParam `json:",omitzero,inline"`
- OfHostedTool *ToolChoiceTypesParam `json:",omitzero,inline"`
- OfFunctionTool *ToolChoiceFunctionParam `json:",omitzero,inline"`
- OfMcpTool *ToolChoiceMcpParam `json:",omitzero,inline"`
- OfCustomTool *ToolChoiceCustomParam `json:",omitzero,inline"`
+ OfToolChoiceMode param.Opt[ToolChoiceOptions] `json:",omitzero,inline"`
+ OfAllowedTools *ToolChoiceAllowedParam `json:",omitzero,inline"`
+ OfHostedTool *ToolChoiceTypesParam `json:",omitzero,inline"`
+ OfFunctionTool *ToolChoiceFunctionParam `json:",omitzero,inline"`
+ OfMcpTool *ToolChoiceMcpParam `json:",omitzero,inline"`
+ OfCustomTool *ToolChoiceCustomParam `json:",omitzero,inline"`
+ OfSpecificApplyPatchToolChoice *ToolChoiceApplyPatchParam `json:",omitzero,inline"`
+ OfSpecificShellToolChoice *ToolChoiceShellParam `json:",omitzero,inline"`
paramUnion
}
@@ -235,7 +237,9 @@ func (u InputTokenCountParamsToolChoiceUnion) MarshalJSON() ([]byte, error) {
u.OfHostedTool,
u.OfFunctionTool,
u.OfMcpTool,
- u.OfCustomTool)
+ u.OfCustomTool,
+ u.OfSpecificApplyPatchToolChoice,
+ u.OfSpecificShellToolChoice)
}
func (u *InputTokenCountParamsToolChoiceUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
@@ -254,6 +258,10 @@ func (u *InputTokenCountParamsToolChoiceUnion) asAny() any {
return u.OfMcpTool
} else if !param.IsOmitted(u.OfCustomTool) {
return u.OfCustomTool
+ } else if !param.IsOmitted(u.OfSpecificApplyPatchToolChoice) {
+ return u.OfSpecificApplyPatchToolChoice
+ } else if !param.IsOmitted(u.OfSpecificShellToolChoice) {
+ return u.OfSpecificShellToolChoice
}
return nil
}
@@ -294,6 +302,10 @@ func (u InputTokenCountParamsToolChoiceUnion) GetType() *string {
return (*string)(&vt.Type)
} else if vt := u.OfCustomTool; vt != nil {
return (*string)(&vt.Type)
+ } else if vt := u.OfSpecificApplyPatchToolChoice; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfSpecificShellToolChoice; vt != nil {
+ return (*string)(&vt.Type)
}
return nil
}
diff --git a/responses/inputtoken_test.go b/responses/inputtoken_test.go
index d2c42d6d..21b0d97c 100644
--- a/responses/inputtoken_test.go
+++ b/responses/inputtoken_test.go
@@ -39,7 +39,7 @@ func TestInputTokenCountWithOptionalParams(t *testing.T) {
ParallelToolCalls: openai.Bool(true),
PreviousResponseID: openai.String("resp_123"),
Reasoning: shared.ReasoningParam{
- Effort: shared.ReasoningEffortMinimal,
+ Effort: shared.ReasoningEffortNone,
GenerateSummary: shared.ReasoningGenerateSummaryAuto,
Summary: shared.ReasoningSummaryAuto,
},
diff --git a/responses/response.go b/responses/response.go
index 19b529ef..25e1b551 100644
--- a/responses/response.go
+++ b/responses/response.go
@@ -120,7 +120,7 @@ func (r *ResponseService) GetStreaming(ctx context.Context, responseID string, q
// Deletes a model response with the given ID.
func (r *ResponseService) Delete(ctx context.Context, responseID string, opts ...option.RequestOption) (err error) {
opts = slices.Concat(r.Options, opts)
- opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
+ opts = append([]option.RequestOption{option.WithHeader("Accept", "*/*")}, opts...)
if responseID == "" {
err = errors.New("missing required response_id parameter")
return
@@ -144,6 +144,56 @@ func (r *ResponseService) Cancel(ctx context.Context, responseID string, opts ..
return
}
+// Allows the assistant to create, delete, or update files using unified diffs.
+type ApplyPatchTool struct {
+ // The type of the tool. Always `apply_patch`.
+ Type constant.ApplyPatch `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ApplyPatchTool) RawJSON() string { return r.JSON.raw }
+func (r *ApplyPatchTool) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this ApplyPatchTool to a ApplyPatchToolParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// ApplyPatchToolParam.Overrides()
+func (r ApplyPatchTool) ToParam() ApplyPatchToolParam {
+ return param.Override[ApplyPatchToolParam](json.RawMessage(r.RawJSON()))
+}
+
+func NewApplyPatchToolParam() ApplyPatchToolParam {
+ return ApplyPatchToolParam{
+ Type: "apply_patch",
+ }
+}
+
+// Allows the assistant to create, delete, or update files using unified diffs.
+//
+// This struct has a constant value, construct it with [NewApplyPatchToolParam].
+type ApplyPatchToolParam struct {
+ // The type of the tool. Always `apply_patch`.
+ Type constant.ApplyPatch `json:"type,required"`
+ paramObj
+}
+
+func (r ApplyPatchToolParam) MarshalJSON() (data []byte, err error) {
+ type shadow ApplyPatchToolParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ApplyPatchToolParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// A tool that controls a virtual computer. Learn more about the
// [computer tool](https://platform.openai.com/docs/guides/tools-computer-use).
type ComputerTool struct {
@@ -710,214 +760,54 @@ func (r *FileSearchToolRankingOptionsHybridSearchParam) UnmarshalJSON(data []byt
return apijson.UnmarshalRoot(data, r)
}
-func init() {
- apijson.RegisterUnion[ResponseCodeInterpreterToolCallOutputUnionParam](
- "type",
- apijson.Discriminator[ResponseCodeInterpreterToolCallOutputLogsParam]("logs"),
- apijson.Discriminator[ResponseCodeInterpreterToolCallOutputImageParam]("image"),
- )
-}
-
-func init() {
- apijson.RegisterUnion[ResponseComputerToolCallActionUnionParam](
- "type",
- apijson.Discriminator[ResponseComputerToolCallActionClickParam]("click"),
- apijson.Discriminator[ResponseComputerToolCallActionDoubleClickParam]("double_click"),
- apijson.Discriminator[ResponseComputerToolCallActionDragParam]("drag"),
- apijson.Discriminator[ResponseComputerToolCallActionKeypressParam]("keypress"),
- apijson.Discriminator[ResponseComputerToolCallActionMoveParam]("move"),
- apijson.Discriminator[ResponseComputerToolCallActionScreenshotParam]("screenshot"),
- apijson.Discriminator[ResponseComputerToolCallActionScrollParam]("scroll"),
- apijson.Discriminator[ResponseComputerToolCallActionTypeParam]("type"),
- apijson.Discriminator[ResponseComputerToolCallActionWaitParam]("wait"),
- )
-}
-
-func init() {
- apijson.RegisterFieldValidator[ResponseComputerToolCallActionClickParam](
- "button", "left", "right", "wheel", "back", "forward",
- )
-}
-
-func init() {
- apijson.RegisterUnion[ResponseFormatTextConfigUnionParam](
- "type",
- apijson.Discriminator[shared.ResponseFormatTextParam]("text"),
- apijson.Discriminator[ResponseFormatTextJSONSchemaConfigParam]("json_schema"),
- apijson.Discriminator[shared.ResponseFormatJSONObjectParam]("json_object"),
- )
-}
-
-func init() {
- apijson.RegisterUnion[ResponseFunctionWebSearchActionUnionParam](
- "type",
- apijson.Discriminator[ResponseFunctionWebSearchActionSearchParam]("search"),
- apijson.Discriminator[ResponseFunctionWebSearchActionOpenPageParam]("open_page"),
- apijson.Discriminator[ResponseFunctionWebSearchActionFindParam]("find"),
- )
-}
-
-func init() {
- apijson.RegisterFieldValidator[ResponseInputAudioInputAudioParam](
- "format", "mp3", "wav",
- )
-}
-
-func init() {
- apijson.RegisterUnion[ResponseInputContentUnionParam](
- "type",
- apijson.Discriminator[ResponseInputTextParam]("input_text"),
- apijson.Discriminator[ResponseInputImageParam]("input_image"),
- apijson.Discriminator[ResponseInputFileParam]("input_file"),
- apijson.Discriminator[ResponseInputAudioParam]("input_audio"),
- )
-}
-
-func init() {
- apijson.RegisterUnion[ResponseInputItemUnionParam](
- "type",
- apijson.Discriminator[EasyInputMessageParam]("message"),
- apijson.Discriminator[ResponseInputItemMessageParam]("message"),
- apijson.Discriminator[ResponseOutputMessageParam]("message"),
- apijson.Discriminator[ResponseFileSearchToolCallParam]("file_search_call"),
- apijson.Discriminator[ResponseComputerToolCallParam]("computer_call"),
- apijson.Discriminator[ResponseInputItemComputerCallOutputParam]("computer_call_output"),
- apijson.Discriminator[ResponseFunctionWebSearchParam]("web_search_call"),
- apijson.Discriminator[ResponseFunctionToolCallParam]("function_call"),
- apijson.Discriminator[ResponseInputItemFunctionCallOutputParam]("function_call_output"),
- apijson.Discriminator[ResponseReasoningItemParam]("reasoning"),
- apijson.Discriminator[ResponseInputItemImageGenerationCallParam]("image_generation_call"),
- apijson.Discriminator[ResponseCodeInterpreterToolCallParam]("code_interpreter_call"),
- apijson.Discriminator[ResponseInputItemLocalShellCallParam]("local_shell_call"),
- apijson.Discriminator[ResponseInputItemLocalShellCallOutputParam]("local_shell_call_output"),
- apijson.Discriminator[ResponseInputItemMcpListToolsParam]("mcp_list_tools"),
- apijson.Discriminator[ResponseInputItemMcpApprovalRequestParam]("mcp_approval_request"),
- apijson.Discriminator[ResponseInputItemMcpApprovalResponseParam]("mcp_approval_response"),
- apijson.Discriminator[ResponseInputItemMcpCallParam]("mcp_call"),
- apijson.Discriminator[ResponseCustomToolCallOutputParam]("custom_tool_call_output"),
- apijson.Discriminator[ResponseCustomToolCallParam]("custom_tool_call"),
- apijson.Discriminator[ResponseInputItemItemReferenceParam]("item_reference"),
- )
-}
-
-func init() {
- apijson.RegisterFieldValidator[ResponseInputItemMessageParam](
- "role", "user", "system", "developer",
- )
- apijson.RegisterFieldValidator[ResponseInputItemMessageParam](
- "status", "in_progress", "completed", "incomplete",
- )
- apijson.RegisterFieldValidator[ResponseInputItemMessageParam](
- "type", "message",
- )
-}
-
-func init() {
- apijson.RegisterFieldValidator[ResponseInputItemComputerCallOutputParam](
- "status", "in_progress", "completed", "incomplete",
- )
-}
-
-func init() {
- apijson.RegisterFieldValidator[ResponseInputItemFunctionCallOutputParam](
- "status", "in_progress", "completed", "incomplete",
- )
-}
-
-func init() {
- apijson.RegisterFieldValidator[ResponseInputItemImageGenerationCallParam](
- "status", "in_progress", "completed", "generating", "failed",
- )
-}
-
-func init() {
- apijson.RegisterFieldValidator[ResponseInputItemLocalShellCallParam](
- "status", "in_progress", "completed", "incomplete",
- )
-}
-
-func init() {
- apijson.RegisterFieldValidator[ResponseInputItemLocalShellCallOutputParam](
- "status", "in_progress", "completed", "incomplete",
- )
-}
-
-func init() {
- apijson.RegisterFieldValidator[ResponseInputItemItemReferenceParam](
- "type", "item_reference",
- )
+// A tool that allows the model to execute shell commands.
+type FunctionShellTool struct {
+ // The type of the shell tool. Always `shell`.
+ Type constant.Shell `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
}
-func init() {
- apijson.RegisterUnion[ResponseOutputMessageContentUnionParam](
- "type",
- apijson.Discriminator[ResponseOutputTextParam]("output_text"),
- apijson.Discriminator[ResponseOutputRefusalParam]("refusal"),
- )
+// Returns the unmodified JSON received from the API
+func (r FunctionShellTool) RawJSON() string { return r.JSON.raw }
+func (r *FunctionShellTool) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
}
-func init() {
- apijson.RegisterUnion[ResponseOutputTextAnnotationUnionParam](
- "type",
- apijson.Discriminator[ResponseOutputTextAnnotationFileCitationParam]("file_citation"),
- apijson.Discriminator[ResponseOutputTextAnnotationURLCitationParam]("url_citation"),
- apijson.Discriminator[ResponseOutputTextAnnotationContainerFileCitationParam]("container_file_citation"),
- apijson.Discriminator[ResponseOutputTextAnnotationFilePathParam]("file_path"),
- )
+// ToParam converts this FunctionShellTool to a FunctionShellToolParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// FunctionShellToolParam.Overrides()
+func (r FunctionShellTool) ToParam() FunctionShellToolParam {
+ return param.Override[FunctionShellToolParam](json.RawMessage(r.RawJSON()))
}
-func init() {
- apijson.RegisterUnion[ToolUnionParam](
- "type",
- apijson.Discriminator[FunctionToolParam]("function"),
- apijson.Discriminator[FileSearchToolParam]("file_search"),
- apijson.Discriminator[ComputerToolParam]("computer_use_preview"),
- apijson.Discriminator[WebSearchToolParam]("web_search"),
- apijson.Discriminator[WebSearchToolParam]("web_search_2025_08_26"),
- apijson.Discriminator[ToolMcpParam]("mcp"),
- apijson.Discriminator[ToolCodeInterpreterParam]("code_interpreter"),
- apijson.Discriminator[ToolImageGenerationParam]("image_generation"),
- apijson.Discriminator[ToolLocalShellParam]("local_shell"),
- apijson.Discriminator[CustomToolParam]("custom"),
- apijson.Discriminator[WebSearchPreviewToolParam]("web_search_preview"),
- apijson.Discriminator[WebSearchPreviewToolParam]("web_search_preview_2025_03_11"),
- )
+func NewFunctionShellToolParam() FunctionShellToolParam {
+ return FunctionShellToolParam{
+ Type: "shell",
+ }
}
-func init() {
- apijson.RegisterFieldValidator[ToolMcpParam](
- "connector_id", "connector_dropbox", "connector_gmail", "connector_googlecalendar", "connector_googledrive", "connector_microsoftteams", "connector_outlookcalendar", "connector_outlookemail", "connector_sharepoint",
- )
+// A tool that allows the model to execute shell commands.
+//
+// This struct has a constant value, construct it with [NewFunctionShellToolParam].
+type FunctionShellToolParam struct {
+ // The type of the shell tool. Always `shell`.
+ Type constant.Shell `json:"type,required"`
+ paramObj
}
-func init() {
- apijson.RegisterFieldValidator[ToolImageGenerationParam](
- "background", "transparent", "opaque", "auto",
- )
- apijson.RegisterFieldValidator[ToolImageGenerationParam](
- "input_fidelity", "high", "low",
- )
- apijson.RegisterFieldValidator[ToolImageGenerationParam](
- "model", "gpt-image-1",
- )
- apijson.RegisterFieldValidator[ToolImageGenerationParam](
- "moderation", "auto", "low",
- )
- apijson.RegisterFieldValidator[ToolImageGenerationParam](
- "output_format", "png", "webp", "jpeg",
- )
- apijson.RegisterFieldValidator[ToolImageGenerationParam](
- "quality", "low", "medium", "high", "auto",
- )
- apijson.RegisterFieldValidator[ToolImageGenerationParam](
- "size", "1024x1024", "1024x1536", "1536x1024", "auto",
- )
+func (r FunctionShellToolParam) MarshalJSON() (data []byte, err error) {
+ type shadow FunctionShellToolParam
+ return param.MarshalObject(r, (*shadow)(&r))
}
-
-func init() {
- apijson.RegisterFieldValidator[WebSearchToolUserLocationParam](
- "type", "approximate",
- )
+func (r *FunctionShellToolParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
}
// Defines a function in your own code the model can choose to call. Learn more
@@ -1094,6 +984,13 @@ type Response struct {
// hit rates. Replaces the `user` field.
// [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
PromptCacheKey string `json:"prompt_cache_key"`
+ // The retention policy for the prompt cache. Set to `24h` to enable extended
+ // prompt caching, which keeps cached prefixes active for longer, up to a maximum
+ // of 24 hours.
+ // [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
+ //
+ // Any of "in-memory", "24h".
+ PromptCacheRetention ResponsePromptCacheRetention `json:"prompt_cache_retention,nullable"`
// **gpt-5 and o-series models only**
//
// Configuration options for
@@ -1162,38 +1059,39 @@ type Response struct {
User string `json:"user"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- ID respjson.Field
- CreatedAt respjson.Field
- Error respjson.Field
- IncompleteDetails respjson.Field
- Instructions respjson.Field
- Metadata respjson.Field
- Model respjson.Field
- Object respjson.Field
- Output respjson.Field
- ParallelToolCalls respjson.Field
- Temperature respjson.Field
- ToolChoice respjson.Field
- Tools respjson.Field
- TopP respjson.Field
- Background respjson.Field
- Conversation respjson.Field
- MaxOutputTokens respjson.Field
- MaxToolCalls respjson.Field
- PreviousResponseID respjson.Field
- Prompt respjson.Field
- PromptCacheKey respjson.Field
- Reasoning respjson.Field
- SafetyIdentifier respjson.Field
- ServiceTier respjson.Field
- Status respjson.Field
- Text respjson.Field
- TopLogprobs respjson.Field
- Truncation respjson.Field
- Usage respjson.Field
- User respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ ID respjson.Field
+ CreatedAt respjson.Field
+ Error respjson.Field
+ IncompleteDetails respjson.Field
+ Instructions respjson.Field
+ Metadata respjson.Field
+ Model respjson.Field
+ Object respjson.Field
+ Output respjson.Field
+ ParallelToolCalls respjson.Field
+ Temperature respjson.Field
+ ToolChoice respjson.Field
+ Tools respjson.Field
+ TopP respjson.Field
+ Background respjson.Field
+ Conversation respjson.Field
+ MaxOutputTokens respjson.Field
+ MaxToolCalls respjson.Field
+ PreviousResponseID respjson.Field
+ Prompt respjson.Field
+ PromptCacheKey respjson.Field
+ PromptCacheRetention respjson.Field
+ Reasoning respjson.Field
+ SafetyIdentifier respjson.Field
+ ServiceTier respjson.Field
+ Status respjson.Field
+ Text respjson.Field
+ TopLogprobs respjson.Field
+ Truncation respjson.Field
+ Usage respjson.Field
+ User respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
@@ -1274,7 +1172,8 @@ func (r *ResponseInstructionsUnion) UnmarshalJSON(data []byte) error {
// ResponseToolChoiceUnion contains all possible properties and values from
// [ToolChoiceOptions], [ToolChoiceAllowed], [ToolChoiceTypes],
-// [ToolChoiceFunction], [ToolChoiceMcp], [ToolChoiceCustom].
+// [ToolChoiceFunction], [ToolChoiceMcp], [ToolChoiceCustom],
+// [ToolChoiceApplyPatch], [ToolChoiceShell].
//
// Use the methods beginning with 'As' to cast the union to one of its variants.
//
@@ -1333,6 +1232,16 @@ func (u ResponseToolChoiceUnion) AsCustomTool() (v ToolChoiceCustom) {
return
}
+func (u ResponseToolChoiceUnion) AsSpecificApplyPatchToolChoice() (v ToolChoiceApplyPatch) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseToolChoiceUnion) AsSpecificShellToolChoice() (v ToolChoiceShell) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
// Returns the unmodified JSON received from the API
func (u ResponseToolChoiceUnion) RawJSON() string { return u.JSON.raw }
@@ -1359,6 +1268,17 @@ func (r *ResponseConversation) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+// The retention policy for the prompt cache. Set to `24h` to enable extended
+// prompt caching, which keeps cached prefixes active for longer, up to a maximum
+// of 24 hours.
+// [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
+type ResponsePromptCacheRetention string
+
+const (
+ ResponsePromptCacheRetentionInMemory ResponsePromptCacheRetention = "in-memory"
+ ResponsePromptCacheRetention24h ResponsePromptCacheRetention = "24h"
+)
+
// Specifies the processing type used for serving the request.
//
// - If set to 'auto', then the request will be processed with the service tier
@@ -1399,9 +1319,247 @@ const (
ResponseTruncationDisabled ResponseTruncation = "disabled"
)
-// Emitted when there is a partial audio response.
-type ResponseAudioDeltaEvent struct {
- // A chunk of Base64 encoded response audio bytes.
+// A tool call that applies file diffs by creating, deleting, or updating files.
+type ResponseApplyPatchToolCall struct {
+ // The unique ID of the apply patch tool call. Populated when this item is returned
+ // via API.
+ ID string `json:"id,required"`
+ // The unique ID of the apply patch tool call generated by the model.
+ CallID string `json:"call_id,required"`
+ // One of the create_file, delete_file, or update_file operations applied via
+ // apply_patch.
+ Operation ResponseApplyPatchToolCallOperationUnion `json:"operation,required"`
+ // The status of the apply patch tool call. One of `in_progress` or `completed`.
+ //
+ // Any of "in_progress", "completed".
+ Status ResponseApplyPatchToolCallStatus `json:"status,required"`
+ // The type of the item. Always `apply_patch_call`.
+ Type constant.ApplyPatchCall `json:"type,required"`
+ // The ID of the entity that created this tool call.
+ CreatedBy string `json:"created_by"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CallID respjson.Field
+ Operation respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ CreatedBy respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseApplyPatchToolCall) RawJSON() string { return r.JSON.raw }
+func (r *ResponseApplyPatchToolCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (ResponseApplyPatchToolCall) ImplConversationItemUnion() {}
+
+// ResponseApplyPatchToolCallOperationUnion contains all possible properties and
+// values from [ResponseApplyPatchToolCallOperationCreateFile],
+// [ResponseApplyPatchToolCallOperationDeleteFile],
+// [ResponseApplyPatchToolCallOperationUpdateFile].
+//
+// Use the [ResponseApplyPatchToolCallOperationUnion.AsAny] method to switch on the
+// variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ResponseApplyPatchToolCallOperationUnion struct {
+ Diff string `json:"diff"`
+ Path string `json:"path"`
+ // Any of "create_file", "delete_file", "update_file".
+ Type string `json:"type"`
+ JSON struct {
+ Diff respjson.Field
+ Path respjson.Field
+ Type respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyResponseApplyPatchToolCallOperation is implemented by each variant of
+// [ResponseApplyPatchToolCallOperationUnion] to add type safety for the return
+// type of [ResponseApplyPatchToolCallOperationUnion.AsAny]
+type anyResponseApplyPatchToolCallOperation interface {
+ implResponseApplyPatchToolCallOperationUnion()
+}
+
+func (ResponseApplyPatchToolCallOperationCreateFile) implResponseApplyPatchToolCallOperationUnion() {}
+func (ResponseApplyPatchToolCallOperationDeleteFile) implResponseApplyPatchToolCallOperationUnion() {}
+func (ResponseApplyPatchToolCallOperationUpdateFile) implResponseApplyPatchToolCallOperationUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ResponseApplyPatchToolCallOperationUnion.AsAny().(type) {
+// case responses.ResponseApplyPatchToolCallOperationCreateFile:
+// case responses.ResponseApplyPatchToolCallOperationDeleteFile:
+// case responses.ResponseApplyPatchToolCallOperationUpdateFile:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ResponseApplyPatchToolCallOperationUnion) AsAny() anyResponseApplyPatchToolCallOperation {
+ switch u.Type {
+ case "create_file":
+ return u.AsCreateFile()
+ case "delete_file":
+ return u.AsDeleteFile()
+ case "update_file":
+ return u.AsUpdateFile()
+ }
+ return nil
+}
+
+func (u ResponseApplyPatchToolCallOperationUnion) AsCreateFile() (v ResponseApplyPatchToolCallOperationCreateFile) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseApplyPatchToolCallOperationUnion) AsDeleteFile() (v ResponseApplyPatchToolCallOperationDeleteFile) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseApplyPatchToolCallOperationUnion) AsUpdateFile() (v ResponseApplyPatchToolCallOperationUpdateFile) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ResponseApplyPatchToolCallOperationUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ResponseApplyPatchToolCallOperationUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Instruction describing how to create a file via the apply_patch tool.
+type ResponseApplyPatchToolCallOperationCreateFile struct {
+ // Diff to apply.
+ Diff string `json:"diff,required"`
+ // Path of the file to create.
+ Path string `json:"path,required"`
+ // Create a new file with the provided diff.
+ Type constant.CreateFile `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Diff respjson.Field
+ Path respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseApplyPatchToolCallOperationCreateFile) RawJSON() string { return r.JSON.raw }
+func (r *ResponseApplyPatchToolCallOperationCreateFile) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Instruction describing how to delete a file via the apply_patch tool.
+type ResponseApplyPatchToolCallOperationDeleteFile struct {
+ // Path of the file to delete.
+ Path string `json:"path,required"`
+ // Delete the specified file.
+ Type constant.DeleteFile `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Path respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseApplyPatchToolCallOperationDeleteFile) RawJSON() string { return r.JSON.raw }
+func (r *ResponseApplyPatchToolCallOperationDeleteFile) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Instruction describing how to update a file via the apply_patch tool.
+type ResponseApplyPatchToolCallOperationUpdateFile struct {
+ // Diff to apply.
+ Diff string `json:"diff,required"`
+ // Path of the file to update.
+ Path string `json:"path,required"`
+ // Update an existing file with the provided diff.
+ Type constant.UpdateFile `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Diff respjson.Field
+ Path respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseApplyPatchToolCallOperationUpdateFile) RawJSON() string { return r.JSON.raw }
+func (r *ResponseApplyPatchToolCallOperationUpdateFile) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The status of the apply patch tool call. One of `in_progress` or `completed`.
+type ResponseApplyPatchToolCallStatus string
+
+const (
+ ResponseApplyPatchToolCallStatusInProgress ResponseApplyPatchToolCallStatus = "in_progress"
+ ResponseApplyPatchToolCallStatusCompleted ResponseApplyPatchToolCallStatus = "completed"
+)
+
+// The output emitted by an apply patch tool call.
+type ResponseApplyPatchToolCallOutput struct {
+ // The unique ID of the apply patch tool call output. Populated when this item is
+ // returned via API.
+ ID string `json:"id,required"`
+ // The unique ID of the apply patch tool call generated by the model.
+ CallID string `json:"call_id,required"`
+ // The status of the apply patch tool call output. One of `completed` or `failed`.
+ //
+ // Any of "completed", "failed".
+ Status ResponseApplyPatchToolCallOutputStatus `json:"status,required"`
+ // The type of the item. Always `apply_patch_call_output`.
+ Type constant.ApplyPatchCallOutput `json:"type,required"`
+ // The ID of the entity that created this tool call output.
+ CreatedBy string `json:"created_by"`
+ // Optional textual output returned by the apply patch tool.
+ Output string `json:"output,nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CallID respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ CreatedBy respjson.Field
+ Output respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseApplyPatchToolCallOutput) RawJSON() string { return r.JSON.raw }
+func (r *ResponseApplyPatchToolCallOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (ResponseApplyPatchToolCallOutput) ImplConversationItemUnion() {}
+
+// The status of the apply patch tool call output. One of `completed` or `failed`.
+type ResponseApplyPatchToolCallOutputStatus string
+
+const (
+ ResponseApplyPatchToolCallOutputStatusCompleted ResponseApplyPatchToolCallOutputStatus = "completed"
+ ResponseApplyPatchToolCallOutputStatusFailed ResponseApplyPatchToolCallOutputStatus = "failed"
+)
+
+// Emitted when there is a partial audio response.
+type ResponseAudioDeltaEvent struct {
+ // A chunk of Base64 encoded response audio bytes.
Delta string `json:"delta,required"`
// A sequence number for this chunk of the stream response.
SequenceNumber int64 `json:"sequence_number,required"`
@@ -1890,6 +2048,14 @@ func (u ResponseCodeInterpreterToolCallOutputUnionParam) GetType() *string {
return nil
}
+func init() {
+ apijson.RegisterUnion[ResponseCodeInterpreterToolCallOutputUnionParam](
+ "type",
+ apijson.Discriminator[ResponseCodeInterpreterToolCallOutputLogsParam]("logs"),
+ apijson.Discriminator[ResponseCodeInterpreterToolCallOutputImageParam]("image"),
+ )
+}
+
// The logs output from the code interpreter.
//
// The properties Logs, Type are required.
@@ -2638,6 +2804,21 @@ func (u ResponseComputerToolCallActionUnionParam) GetY() *int64 {
return nil
}
+func init() {
+ apijson.RegisterUnion[ResponseComputerToolCallActionUnionParam](
+ "type",
+ apijson.Discriminator[ResponseComputerToolCallActionClickParam]("click"),
+ apijson.Discriminator[ResponseComputerToolCallActionDoubleClickParam]("double_click"),
+ apijson.Discriminator[ResponseComputerToolCallActionDragParam]("drag"),
+ apijson.Discriminator[ResponseComputerToolCallActionKeypressParam]("keypress"),
+ apijson.Discriminator[ResponseComputerToolCallActionMoveParam]("move"),
+ apijson.Discriminator[ResponseComputerToolCallActionScreenshotParam]("screenshot"),
+ apijson.Discriminator[ResponseComputerToolCallActionScrollParam]("scroll"),
+ apijson.Discriminator[ResponseComputerToolCallActionTypeParam]("type"),
+ apijson.Discriminator[ResponseComputerToolCallActionWaitParam]("wait"),
+ )
+}
+
// A click action.
//
// The properties Button, Type, X, Y are required.
@@ -2666,6 +2847,12 @@ func (r *ResponseComputerToolCallActionClickParam) UnmarshalJSON(data []byte) er
return apijson.UnmarshalRoot(data, r)
}
+func init() {
+ apijson.RegisterFieldValidator[ResponseComputerToolCallActionClickParam](
+ "button", "left", "right", "wheel", "back", "forward",
+ )
+}
+
// A double click action.
//
// The properties Type, X, Y are required.
@@ -4394,6 +4581,15 @@ func (u ResponseFormatTextConfigUnionParam) GetType() *string {
return nil
}
+func init() {
+ apijson.RegisterUnion[ResponseFormatTextConfigUnionParam](
+ "type",
+ apijson.Discriminator[shared.ResponseFormatTextParam]("text"),
+ apijson.Discriminator[ResponseFormatTextJSONSchemaConfigParam]("json_schema"),
+ apijson.Discriminator[shared.ResponseFormatJSONObjectParam]("json_object"),
+ )
+}
+
// JSON Schema response format. Used to generate structured JSON responses. Learn
// more about
// [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs).
@@ -4759,105 +4955,605 @@ type ResponseFunctionCallOutputItemList []ResponseFunctionCallOutputItemUnion
type ResponseFunctionCallOutputItemListParam []ResponseFunctionCallOutputItemUnionParam
-// A tool call to run a function. See the
-// [function calling guide](https://platform.openai.com/docs/guides/function-calling)
-// for more information.
-type ResponseFunctionToolCall struct {
- // A JSON string of the arguments to pass to the function.
- Arguments string `json:"arguments,required"`
- // The unique ID of the function tool call generated by the model.
- CallID string `json:"call_id,required"`
- // The name of the function to run.
- Name string `json:"name,required"`
- // The type of the function tool call. Always `function_call`.
- Type constant.FunctionCall `json:"type,required"`
- // The unique ID of the function tool call.
- ID string `json:"id"`
- // The status of the item. One of `in_progress`, `completed`, or `incomplete`.
- // Populated when items are returned via API.
- //
- // Any of "in_progress", "completed", "incomplete".
- Status ResponseFunctionToolCallStatus `json:"status"`
+// Captured stdout and stderr for a portion of a function shell tool call output.
+type ResponseFunctionShellCallOutputContent struct {
+ // The exit or timeout outcome associated with this chunk.
+ Outcome ResponseFunctionShellCallOutputContentOutcomeUnion `json:"outcome,required"`
+ // Captured stderr output for this chunk of the shell call.
+ Stderr string `json:"stderr,required"`
+ // Captured stdout output for this chunk of the shell call.
+ Stdout string `json:"stdout,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- Arguments respjson.Field
- CallID respjson.Field
- Name respjson.Field
- Type respjson.Field
- ID respjson.Field
- Status respjson.Field
+ Outcome respjson.Field
+ Stderr respjson.Field
+ Stdout respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
-func (r ResponseFunctionToolCall) RawJSON() string { return r.JSON.raw }
-func (r *ResponseFunctionToolCall) UnmarshalJSON(data []byte) error {
+func (r ResponseFunctionShellCallOutputContent) RawJSON() string { return r.JSON.raw }
+func (r *ResponseFunctionShellCallOutputContent) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ToParam converts this ResponseFunctionToolCall to a
-// ResponseFunctionToolCallParam.
+// ToParam converts this ResponseFunctionShellCallOutputContent to a
+// ResponseFunctionShellCallOutputContentParam.
//
// Warning: the fields of the param type will not be present. ToParam should only
// be used at the last possible moment before sending a request. Test for this with
-// ResponseFunctionToolCallParam.Overrides()
-func (r ResponseFunctionToolCall) ToParam() ResponseFunctionToolCallParam {
- return param.Override[ResponseFunctionToolCallParam](json.RawMessage(r.RawJSON()))
+// ResponseFunctionShellCallOutputContentParam.Overrides()
+func (r ResponseFunctionShellCallOutputContent) ToParam() ResponseFunctionShellCallOutputContentParam {
+ return param.Override[ResponseFunctionShellCallOutputContentParam](json.RawMessage(r.RawJSON()))
}
-// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
-// Populated when items are returned via API.
-type ResponseFunctionToolCallStatus string
-
-const (
- ResponseFunctionToolCallStatusInProgress ResponseFunctionToolCallStatus = "in_progress"
- ResponseFunctionToolCallStatusCompleted ResponseFunctionToolCallStatus = "completed"
- ResponseFunctionToolCallStatusIncomplete ResponseFunctionToolCallStatus = "incomplete"
-)
-
-// A tool call to run a function. See the
-// [function calling guide](https://platform.openai.com/docs/guides/function-calling)
-// for more information.
+// ResponseFunctionShellCallOutputContentOutcomeUnion contains all possible
+// properties and values from
+// [ResponseFunctionShellCallOutputContentOutcomeTimeout],
+// [ResponseFunctionShellCallOutputContentOutcomeExit].
//
-// The properties Arguments, CallID, Name, Type are required.
-type ResponseFunctionToolCallParam struct {
- // A JSON string of the arguments to pass to the function.
- Arguments string `json:"arguments,required"`
- // The unique ID of the function tool call generated by the model.
- CallID string `json:"call_id,required"`
- // The name of the function to run.
- Name string `json:"name,required"`
- // The unique ID of the function tool call.
- ID param.Opt[string] `json:"id,omitzero"`
- // The status of the item. One of `in_progress`, `completed`, or `incomplete`.
- // Populated when items are returned via API.
- //
- // Any of "in_progress", "completed", "incomplete".
- Status ResponseFunctionToolCallStatus `json:"status,omitzero"`
- // The type of the function tool call. Always `function_call`.
- //
- // This field can be elided, and will marshal its zero value as "function_call".
- Type constant.FunctionCall `json:"type,required"`
- paramObj
+// Use the [ResponseFunctionShellCallOutputContentOutcomeUnion.AsAny] method to
+// switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ResponseFunctionShellCallOutputContentOutcomeUnion struct {
+ // Any of "timeout", "exit".
+ Type string `json:"type"`
+ // This field is from variant [ResponseFunctionShellCallOutputContentOutcomeExit].
+ ExitCode int64 `json:"exit_code"`
+ JSON struct {
+ Type respjson.Field
+ ExitCode respjson.Field
+ raw string
+ } `json:"-"`
}
-func (r ResponseFunctionToolCallParam) MarshalJSON() (data []byte, err error) {
- type shadow ResponseFunctionToolCallParam
- return param.MarshalObject(r, (*shadow)(&r))
+// anyResponseFunctionShellCallOutputContentOutcome is implemented by each variant
+// of [ResponseFunctionShellCallOutputContentOutcomeUnion] to add type safety for
+// the return type of [ResponseFunctionShellCallOutputContentOutcomeUnion.AsAny]
+type anyResponseFunctionShellCallOutputContentOutcome interface {
+ implResponseFunctionShellCallOutputContentOutcomeUnion()
}
-func (r *ResponseFunctionToolCallParam) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
+
+func (ResponseFunctionShellCallOutputContentOutcomeTimeout) implResponseFunctionShellCallOutputContentOutcomeUnion() {
+}
+func (ResponseFunctionShellCallOutputContentOutcomeExit) implResponseFunctionShellCallOutputContentOutcomeUnion() {
}
-// A tool call to run a function. See the
-// [function calling guide](https://platform.openai.com/docs/guides/function-calling)
-// for more information.
-type ResponseFunctionToolCallItem struct {
- // The unique ID of the function tool call.
- ID string `json:"id,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ResponseFunctionShellCallOutputContentOutcomeUnion.AsAny().(type) {
+// case responses.ResponseFunctionShellCallOutputContentOutcomeTimeout:
+// case responses.ResponseFunctionShellCallOutputContentOutcomeExit:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ResponseFunctionShellCallOutputContentOutcomeUnion) AsAny() anyResponseFunctionShellCallOutputContentOutcome {
+ switch u.Type {
+ case "timeout":
+ return u.AsTimeout()
+ case "exit":
+ return u.AsExit()
+ }
+ return nil
+}
+
+func (u ResponseFunctionShellCallOutputContentOutcomeUnion) AsTimeout() (v ResponseFunctionShellCallOutputContentOutcomeTimeout) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseFunctionShellCallOutputContentOutcomeUnion) AsExit() (v ResponseFunctionShellCallOutputContentOutcomeExit) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ResponseFunctionShellCallOutputContentOutcomeUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ResponseFunctionShellCallOutputContentOutcomeUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Indicates that the function shell call exceeded its configured time limit.
+type ResponseFunctionShellCallOutputContentOutcomeTimeout struct {
+ // The outcome type. Always `timeout`.
+ Type constant.Timeout `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseFunctionShellCallOutputContentOutcomeTimeout) RawJSON() string { return r.JSON.raw }
+func (r *ResponseFunctionShellCallOutputContentOutcomeTimeout) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Indicates that the shell commands finished and returned an exit code.
+type ResponseFunctionShellCallOutputContentOutcomeExit struct {
+ // The exit code returned by the shell process.
+ ExitCode int64 `json:"exit_code,required"`
+ // The outcome type. Always `exit`.
+ Type constant.Exit `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ExitCode respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseFunctionShellCallOutputContentOutcomeExit) RawJSON() string { return r.JSON.raw }
+func (r *ResponseFunctionShellCallOutputContentOutcomeExit) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Captured stdout and stderr for a portion of a function shell tool call output.
+//
+// The properties Outcome, Stderr, Stdout are required.
+type ResponseFunctionShellCallOutputContentParam struct {
+ // The exit or timeout outcome associated with this chunk.
+ Outcome ResponseFunctionShellCallOutputContentOutcomeUnionParam `json:"outcome,omitzero,required"`
+ // Captured stderr output for this chunk of the shell call.
+ Stderr string `json:"stderr,required"`
+ // Captured stdout output for this chunk of the shell call.
+ Stdout string `json:"stdout,required"`
+ paramObj
+}
+
+func (r ResponseFunctionShellCallOutputContentParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseFunctionShellCallOutputContentParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseFunctionShellCallOutputContentParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type ResponseFunctionShellCallOutputContentOutcomeUnionParam struct {
+ OfTimeout *ResponseFunctionShellCallOutputContentOutcomeTimeoutParam `json:",omitzero,inline"`
+ OfExit *ResponseFunctionShellCallOutputContentOutcomeExitParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u ResponseFunctionShellCallOutputContentOutcomeUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfTimeout, u.OfExit)
+}
+func (u *ResponseFunctionShellCallOutputContentOutcomeUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *ResponseFunctionShellCallOutputContentOutcomeUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfTimeout) {
+ return u.OfTimeout
+ } else if !param.IsOmitted(u.OfExit) {
+ return u.OfExit
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseFunctionShellCallOutputContentOutcomeUnionParam) GetExitCode() *int64 {
+ if vt := u.OfExit; vt != nil {
+ return &vt.ExitCode
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseFunctionShellCallOutputContentOutcomeUnionParam) GetType() *string {
+ if vt := u.OfTimeout; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfExit; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[ResponseFunctionShellCallOutputContentOutcomeUnionParam](
+ "type",
+ apijson.Discriminator[ResponseFunctionShellCallOutputContentOutcomeTimeoutParam]("timeout"),
+ apijson.Discriminator[ResponseFunctionShellCallOutputContentOutcomeExitParam]("exit"),
+ )
+}
+
+func NewResponseFunctionShellCallOutputContentOutcomeTimeoutParam() ResponseFunctionShellCallOutputContentOutcomeTimeoutParam {
+ return ResponseFunctionShellCallOutputContentOutcomeTimeoutParam{
+ Type: "timeout",
+ }
+}
+
+// Indicates that the function shell call exceeded its configured time limit.
+//
+// This struct has a constant value, construct it with
+// [NewResponseFunctionShellCallOutputContentOutcomeTimeoutParam].
+type ResponseFunctionShellCallOutputContentOutcomeTimeoutParam struct {
+ // The outcome type. Always `timeout`.
+ Type constant.Timeout `json:"type,required"`
+ paramObj
+}
+
+func (r ResponseFunctionShellCallOutputContentOutcomeTimeoutParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseFunctionShellCallOutputContentOutcomeTimeoutParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseFunctionShellCallOutputContentOutcomeTimeoutParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Indicates that the shell commands finished and returned an exit code.
+//
+// The properties ExitCode, Type are required.
+type ResponseFunctionShellCallOutputContentOutcomeExitParam struct {
+ // The exit code returned by the shell process.
+ ExitCode int64 `json:"exit_code,required"`
+ // The outcome type. Always `exit`.
+ //
+ // This field can be elided, and will marshal its zero value as "exit".
+ Type constant.Exit `json:"type,required"`
+ paramObj
+}
+
+func (r ResponseFunctionShellCallOutputContentOutcomeExitParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseFunctionShellCallOutputContentOutcomeExitParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseFunctionShellCallOutputContentOutcomeExitParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool call that executes one or more shell commands in a managed environment.
+type ResponseFunctionShellToolCall struct {
+ // The unique ID of the function shell tool call. Populated when this item is
+ // returned via API.
+ ID string `json:"id,required"`
+ // The shell commands and limits that describe how to run the tool call.
+ Action ResponseFunctionShellToolCallAction `json:"action,required"`
+ // The unique ID of the function shell tool call generated by the model.
+ CallID string `json:"call_id,required"`
+ // The status of the shell call. One of `in_progress`, `completed`, or
+ // `incomplete`.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status ResponseFunctionShellToolCallStatus `json:"status,required"`
+ // The type of the item. Always `shell_call`.
+ Type constant.ShellCall `json:"type,required"`
+ // The ID of the entity that created this tool call.
+ CreatedBy string `json:"created_by"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Action respjson.Field
+ CallID respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ CreatedBy respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseFunctionShellToolCall) RawJSON() string { return r.JSON.raw }
+func (r *ResponseFunctionShellToolCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (ResponseFunctionShellToolCall) ImplConversationItemUnion() {}
+
+// The shell commands and limits that describe how to run the tool call.
+type ResponseFunctionShellToolCallAction struct {
+ Commands []string `json:"commands,required"`
+ // Optional maximum number of characters to return from each command.
+ MaxOutputLength int64 `json:"max_output_length,required"`
+ // Optional timeout in milliseconds for the commands.
+ TimeoutMs int64 `json:"timeout_ms,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Commands respjson.Field
+ MaxOutputLength respjson.Field
+ TimeoutMs respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseFunctionShellToolCallAction) RawJSON() string { return r.JSON.raw }
+func (r *ResponseFunctionShellToolCallAction) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The status of the shell call. One of `in_progress`, `completed`, or
+// `incomplete`.
+type ResponseFunctionShellToolCallStatus string
+
+const (
+ ResponseFunctionShellToolCallStatusInProgress ResponseFunctionShellToolCallStatus = "in_progress"
+ ResponseFunctionShellToolCallStatusCompleted ResponseFunctionShellToolCallStatus = "completed"
+ ResponseFunctionShellToolCallStatusIncomplete ResponseFunctionShellToolCallStatus = "incomplete"
+)
+
+// The output of a shell tool call.
+type ResponseFunctionShellToolCallOutput struct {
+ // The unique ID of the shell call output. Populated when this item is returned via
+ // API.
+ ID string `json:"id,required"`
+ // The unique ID of the shell tool call generated by the model.
+ CallID string `json:"call_id,required"`
+ // The maximum length of the shell command output. This is generated by the model
+ // and should be passed back with the raw output.
+ MaxOutputLength int64 `json:"max_output_length,required"`
+ // An array of shell call output contents
+ Output []ResponseFunctionShellToolCallOutputOutput `json:"output,required"`
+ // The type of the shell call output. Always `shell_call_output`.
+ Type constant.ShellCallOutput `json:"type,required"`
+ CreatedBy string `json:"created_by"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CallID respjson.Field
+ MaxOutputLength respjson.Field
+ Output respjson.Field
+ Type respjson.Field
+ CreatedBy respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseFunctionShellToolCallOutput) RawJSON() string { return r.JSON.raw }
+func (r *ResponseFunctionShellToolCallOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (ResponseFunctionShellToolCallOutput) ImplConversationItemUnion() {}
+
+// The content of a shell call output.
+type ResponseFunctionShellToolCallOutputOutput struct {
+ // Represents either an exit outcome (with an exit code) or a timeout outcome for a
+ // shell call output chunk.
+ Outcome ResponseFunctionShellToolCallOutputOutputOutcomeUnion `json:"outcome,required"`
+ Stderr string `json:"stderr,required"`
+ Stdout string `json:"stdout,required"`
+ CreatedBy string `json:"created_by"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Outcome respjson.Field
+ Stderr respjson.Field
+ Stdout respjson.Field
+ CreatedBy respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseFunctionShellToolCallOutputOutput) RawJSON() string { return r.JSON.raw }
+func (r *ResponseFunctionShellToolCallOutputOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ResponseFunctionShellToolCallOutputOutputOutcomeUnion contains all possible
+// properties and values from
+// [ResponseFunctionShellToolCallOutputOutputOutcomeTimeout],
+// [ResponseFunctionShellToolCallOutputOutputOutcomeExit].
+//
+// Use the [ResponseFunctionShellToolCallOutputOutputOutcomeUnion.AsAny] method to
+// switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ResponseFunctionShellToolCallOutputOutputOutcomeUnion struct {
+ // Any of "timeout", "exit".
+ Type string `json:"type"`
+ // This field is from variant
+ // [ResponseFunctionShellToolCallOutputOutputOutcomeExit].
+ ExitCode int64 `json:"exit_code"`
+ JSON struct {
+ Type respjson.Field
+ ExitCode respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyResponseFunctionShellToolCallOutputOutputOutcome is implemented by each
+// variant of [ResponseFunctionShellToolCallOutputOutputOutcomeUnion] to add type
+// safety for the return type of
+// [ResponseFunctionShellToolCallOutputOutputOutcomeUnion.AsAny]
+type anyResponseFunctionShellToolCallOutputOutputOutcome interface {
+ implResponseFunctionShellToolCallOutputOutputOutcomeUnion()
+}
+
+func (ResponseFunctionShellToolCallOutputOutputOutcomeTimeout) implResponseFunctionShellToolCallOutputOutputOutcomeUnion() {
+}
+func (ResponseFunctionShellToolCallOutputOutputOutcomeExit) implResponseFunctionShellToolCallOutputOutputOutcomeUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ResponseFunctionShellToolCallOutputOutputOutcomeUnion.AsAny().(type) {
+// case responses.ResponseFunctionShellToolCallOutputOutputOutcomeTimeout:
+// case responses.ResponseFunctionShellToolCallOutputOutputOutcomeExit:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ResponseFunctionShellToolCallOutputOutputOutcomeUnion) AsAny() anyResponseFunctionShellToolCallOutputOutputOutcome {
+ switch u.Type {
+ case "timeout":
+ return u.AsTimeout()
+ case "exit":
+ return u.AsExit()
+ }
+ return nil
+}
+
+func (u ResponseFunctionShellToolCallOutputOutputOutcomeUnion) AsTimeout() (v ResponseFunctionShellToolCallOutputOutputOutcomeTimeout) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseFunctionShellToolCallOutputOutputOutcomeUnion) AsExit() (v ResponseFunctionShellToolCallOutputOutputOutcomeExit) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ResponseFunctionShellToolCallOutputOutputOutcomeUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ResponseFunctionShellToolCallOutputOutputOutcomeUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Indicates that the function shell call exceeded its configured time limit.
+type ResponseFunctionShellToolCallOutputOutputOutcomeTimeout struct {
+ // The outcome type. Always `timeout`.
+ Type constant.Timeout `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseFunctionShellToolCallOutputOutputOutcomeTimeout) RawJSON() string { return r.JSON.raw }
+func (r *ResponseFunctionShellToolCallOutputOutputOutcomeTimeout) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Indicates that the shell commands finished and returned an exit code.
+type ResponseFunctionShellToolCallOutputOutputOutcomeExit struct {
+ // Exit code from the shell process.
+ ExitCode int64 `json:"exit_code,required"`
+ // The outcome type. Always `exit`.
+ Type constant.Exit `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ExitCode respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseFunctionShellToolCallOutputOutputOutcomeExit) RawJSON() string { return r.JSON.raw }
+func (r *ResponseFunctionShellToolCallOutputOutputOutcomeExit) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool call to run a function. See the
+// [function calling guide](https://platform.openai.com/docs/guides/function-calling)
+// for more information.
+type ResponseFunctionToolCall struct {
+ // A JSON string of the arguments to pass to the function.
+ Arguments string `json:"arguments,required"`
+ // The unique ID of the function tool call generated by the model.
+ CallID string `json:"call_id,required"`
+ // The name of the function to run.
+ Name string `json:"name,required"`
+ // The type of the function tool call. Always `function_call`.
+ Type constant.FunctionCall `json:"type,required"`
+ // The unique ID of the function tool call.
+ ID string `json:"id"`
+ // The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+ // Populated when items are returned via API.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status ResponseFunctionToolCallStatus `json:"status"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Arguments respjson.Field
+ CallID respjson.Field
+ Name respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseFunctionToolCall) RawJSON() string { return r.JSON.raw }
+func (r *ResponseFunctionToolCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this ResponseFunctionToolCall to a
+// ResponseFunctionToolCallParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// ResponseFunctionToolCallParam.Overrides()
+func (r ResponseFunctionToolCall) ToParam() ResponseFunctionToolCallParam {
+ return param.Override[ResponseFunctionToolCallParam](json.RawMessage(r.RawJSON()))
+}
+
+// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+// Populated when items are returned via API.
+type ResponseFunctionToolCallStatus string
+
+const (
+ ResponseFunctionToolCallStatusInProgress ResponseFunctionToolCallStatus = "in_progress"
+ ResponseFunctionToolCallStatusCompleted ResponseFunctionToolCallStatus = "completed"
+ ResponseFunctionToolCallStatusIncomplete ResponseFunctionToolCallStatus = "incomplete"
+)
+
+// A tool call to run a function. See the
+// [function calling guide](https://platform.openai.com/docs/guides/function-calling)
+// for more information.
+//
+// The properties Arguments, CallID, Name, Type are required.
+type ResponseFunctionToolCallParam struct {
+ // A JSON string of the arguments to pass to the function.
+ Arguments string `json:"arguments,required"`
+ // The unique ID of the function tool call generated by the model.
+ CallID string `json:"call_id,required"`
+ // The name of the function to run.
+ Name string `json:"name,required"`
+ // The unique ID of the function tool call.
+ ID param.Opt[string] `json:"id,omitzero"`
+ // The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+ // Populated when items are returned via API.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status ResponseFunctionToolCallStatus `json:"status,omitzero"`
+ // The type of the function tool call. Always `function_call`.
+ //
+ // This field can be elided, and will marshal its zero value as "function_call".
+ Type constant.FunctionCall `json:"type,required"`
+ paramObj
+}
+
+func (r ResponseFunctionToolCallParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseFunctionToolCallParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseFunctionToolCallParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool call to run a function. See the
+// [function calling guide](https://platform.openai.com/docs/guides/function-calling)
+// for more information.
+type ResponseFunctionToolCallItem struct {
+ // The unique ID of the function tool call.
+ ID string `json:"id,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
ExtraFields map[string]respjson.Field
@@ -5385,6 +6081,15 @@ func (u ResponseFunctionWebSearchActionUnionParam) GetURL() *string {
return nil
}
+func init() {
+ apijson.RegisterUnion[ResponseFunctionWebSearchActionUnionParam](
+ "type",
+ apijson.Discriminator[ResponseFunctionWebSearchActionSearchParam]("search"),
+ apijson.Discriminator[ResponseFunctionWebSearchActionOpenPageParam]("open_page"),
+ apijson.Discriminator[ResponseFunctionWebSearchActionFindParam]("find"),
+ )
+}
+
// Action type "search" - Performs a web search query.
//
// The properties Query, Type are required.
@@ -5761,6 +6466,12 @@ func (r *ResponseInputAudioInputAudioParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+func init() {
+ apijson.RegisterFieldValidator[ResponseInputAudioInputAudioParam](
+ "format", "mp3", "wav",
+ )
+}
+
// ResponseInputContentUnion contains all possible properties and values from
// [ResponseInputText], [ResponseInputImage], [ResponseInputFile].
//
@@ -6286,7 +6997,9 @@ func (r *ResponseInputImageContentParam) UnmarshalJSON(data []byte) error {
// [ResponseFunctionToolCall], [ResponseInputItemFunctionCallOutput],
// [ResponseReasoningItem], [ResponseInputItemImageGenerationCall],
// [ResponseCodeInterpreterToolCall], [ResponseInputItemLocalShellCall],
-// [ResponseInputItemLocalShellCallOutput], [ResponseInputItemMcpListTools],
+// [ResponseInputItemLocalShellCallOutput], [ResponseInputItemShellCall],
+// [ResponseInputItemShellCallOutput], [ResponseInputItemApplyPatchCall],
+// [ResponseInputItemApplyPatchCallOutput], [ResponseInputItemMcpListTools],
// [ResponseInputItemMcpApprovalRequest], [ResponseInputItemMcpApprovalResponse],
// [ResponseInputItemMcpCall], [ResponseCustomToolCallOutput],
// [ResponseCustomToolCall], [ResponseInputItemItemReference].
@@ -6304,8 +7017,10 @@ type ResponseInputItemUnion struct {
// "computer_call_output", "web_search_call", "function_call",
// "function_call_output", "reasoning", "image_generation_call",
// "code_interpreter_call", "local_shell_call", "local_shell_call_output",
- // "mcp_list_tools", "mcp_approval_request", "mcp_approval_response", "mcp_call",
- // "custom_tool_call_output", "custom_tool_call", "item_reference".
+ // "shell_call", "shell_call_output", "apply_patch_call",
+ // "apply_patch_call_output", "mcp_list_tools", "mcp_approval_request",
+ // "mcp_approval_response", "mcp_call", "custom_tool_call_output",
+ // "custom_tool_call", "item_reference".
Type string `json:"type"`
Status string `json:"status"`
ID string `json:"id"`
@@ -6314,13 +7029,15 @@ type ResponseInputItemUnion struct {
// This field is from variant [ResponseFileSearchToolCall].
Results []ResponseFileSearchToolCallResult `json:"results"`
// This field is a union of [ResponseComputerToolCallActionUnion],
- // [ResponseFunctionWebSearchActionUnion], [ResponseInputItemLocalShellCallAction]
+ // [ResponseFunctionWebSearchActionUnion], [ResponseInputItemLocalShellCallAction],
+ // [ResponseInputItemShellCallAction]
Action ResponseInputItemUnionAction `json:"action"`
CallID string `json:"call_id"`
// This field is from variant [ResponseComputerToolCall].
PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck `json:"pending_safety_checks"`
// This field is a union of [ResponseComputerToolCallOutputScreenshot],
- // [ResponseInputItemFunctionCallOutputOutputUnion], [string], [string],
+ // [ResponseInputItemFunctionCallOutputOutputUnion], [string],
+ // [[]ResponseFunctionShellCallOutputContent], [string], [string],
// [ResponseCustomToolCallOutputOutputUnion]
Output ResponseInputItemUnionOutput `json:"output"`
// This field is from variant [ResponseInputItemComputerCallOutput].
@@ -6338,8 +7055,12 @@ type ResponseInputItemUnion struct {
// This field is from variant [ResponseCodeInterpreterToolCall].
ContainerID string `json:"container_id"`
// This field is from variant [ResponseCodeInterpreterToolCall].
- Outputs []ResponseCodeInterpreterToolCallOutputUnion `json:"outputs"`
- ServerLabel string `json:"server_label"`
+ Outputs []ResponseCodeInterpreterToolCallOutputUnion `json:"outputs"`
+ // This field is from variant [ResponseInputItemShellCallOutput].
+ MaxOutputLength int64 `json:"max_output_length"`
+ // This field is from variant [ResponseInputItemApplyPatchCall].
+ Operation ResponseInputItemApplyPatchCallOperationUnion `json:"operation"`
+ ServerLabel string `json:"server_label"`
// This field is from variant [ResponseInputItemMcpListTools].
Tools []ResponseInputItemMcpListToolsTool `json:"tools"`
Error string `json:"error"`
@@ -6371,6 +7092,8 @@ type ResponseInputItemUnion struct {
Code respjson.Field
ContainerID respjson.Field
Outputs respjson.Field
+ MaxOutputLength respjson.Field
+ Operation respjson.Field
ServerLabel respjson.Field
Tools respjson.Field
Error respjson.Field
@@ -6402,6 +7125,10 @@ func (ResponseInputItemImageGenerationCall) implResponseInputItemUnion() {}
func (ResponseCodeInterpreterToolCall) implResponseInputItemUnion() {}
func (ResponseInputItemLocalShellCall) implResponseInputItemUnion() {}
func (ResponseInputItemLocalShellCallOutput) implResponseInputItemUnion() {}
+func (ResponseInputItemShellCall) implResponseInputItemUnion() {}
+func (ResponseInputItemShellCallOutput) implResponseInputItemUnion() {}
+func (ResponseInputItemApplyPatchCall) implResponseInputItemUnion() {}
+func (ResponseInputItemApplyPatchCallOutput) implResponseInputItemUnion() {}
func (ResponseInputItemMcpListTools) implResponseInputItemUnion() {}
func (ResponseInputItemMcpApprovalRequest) implResponseInputItemUnion() {}
func (ResponseInputItemMcpApprovalResponse) implResponseInputItemUnion() {}
@@ -6427,6 +7154,10 @@ func (ResponseInputItemItemReference) implResponseInputItemUnion() {}
// case responses.ResponseCodeInterpreterToolCall:
// case responses.ResponseInputItemLocalShellCall:
// case responses.ResponseInputItemLocalShellCallOutput:
+// case responses.ResponseInputItemShellCall:
+// case responses.ResponseInputItemShellCallOutput:
+// case responses.ResponseInputItemApplyPatchCall:
+// case responses.ResponseInputItemApplyPatchCallOutput:
// case responses.ResponseInputItemMcpListTools:
// case responses.ResponseInputItemMcpApprovalRequest:
// case responses.ResponseInputItemMcpApprovalResponse:
@@ -6463,6 +7194,14 @@ func (u ResponseInputItemUnion) AsAny() anyResponseInputItem {
return u.AsLocalShellCall()
case "local_shell_call_output":
return u.AsLocalShellCallOutput()
+ case "shell_call":
+ return u.AsShellCall()
+ case "shell_call_output":
+ return u.AsShellCallOutput()
+ case "apply_patch_call":
+ return u.AsApplyPatchCall()
+ case "apply_patch_call_output":
+ return u.AsApplyPatchCallOutput()
case "mcp_list_tools":
return u.AsMcpListTools()
case "mcp_approval_request":
@@ -6521,32 +7260,52 @@ func (u ResponseInputItemUnion) AsFunctionCall() (v ResponseFunctionToolCall) {
return
}
-func (u ResponseInputItemUnion) AsFunctionCallOutput() (v ResponseInputItemFunctionCallOutput) {
+func (u ResponseInputItemUnion) AsFunctionCallOutput() (v ResponseInputItemFunctionCallOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseInputItemUnion) AsReasoning() (v ResponseReasoningItem) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseInputItemUnion) AsImageGenerationCall() (v ResponseInputItemImageGenerationCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseInputItemUnion) AsCodeInterpreterCall() (v ResponseCodeInterpreterToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseInputItemUnion) AsLocalShellCall() (v ResponseInputItemLocalShellCall) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseInputItemUnion) AsReasoning() (v ResponseReasoningItem) {
+func (u ResponseInputItemUnion) AsLocalShellCallOutput() (v ResponseInputItemLocalShellCallOutput) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseInputItemUnion) AsImageGenerationCall() (v ResponseInputItemImageGenerationCall) {
+func (u ResponseInputItemUnion) AsShellCall() (v ResponseInputItemShellCall) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseInputItemUnion) AsCodeInterpreterCall() (v ResponseCodeInterpreterToolCall) {
+func (u ResponseInputItemUnion) AsShellCallOutput() (v ResponseInputItemShellCallOutput) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseInputItemUnion) AsLocalShellCall() (v ResponseInputItemLocalShellCall) {
+func (u ResponseInputItemUnion) AsApplyPatchCall() (v ResponseInputItemApplyPatchCall) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseInputItemUnion) AsLocalShellCallOutput() (v ResponseInputItemLocalShellCallOutput) {
+func (u ResponseInputItemUnion) AsApplyPatchCallOutput() (v ResponseInputItemApplyPatchCallOutput) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
@@ -6660,14 +7419,17 @@ type ResponseInputItemUnionAction struct {
// This field is from variant [ResponseInputItemLocalShellCallAction].
Command []string `json:"command"`
// This field is from variant [ResponseInputItemLocalShellCallAction].
- Env map[string]string `json:"env"`
- // This field is from variant [ResponseInputItemLocalShellCallAction].
- TimeoutMs int64 `json:"timeout_ms"`
+ Env map[string]string `json:"env"`
+ TimeoutMs int64 `json:"timeout_ms"`
// This field is from variant [ResponseInputItemLocalShellCallAction].
User string `json:"user"`
// This field is from variant [ResponseInputItemLocalShellCallAction].
WorkingDirectory string `json:"working_directory"`
- JSON struct {
+ // This field is from variant [ResponseInputItemShellCallAction].
+ Commands []string `json:"commands"`
+ // This field is from variant [ResponseInputItemShellCallAction].
+ MaxOutputLength int64 `json:"max_output_length"`
+ JSON struct {
Button respjson.Field
Type respjson.Field
X respjson.Field
@@ -6686,6 +7448,8 @@ type ResponseInputItemUnionAction struct {
TimeoutMs respjson.Field
User respjson.Field
WorkingDirectory respjson.Field
+ Commands respjson.Field
+ MaxOutputLength respjson.Field
raw string
} `json:"-"`
}
@@ -6703,7 +7467,7 @@ func (r *ResponseInputItemUnionAction) UnmarshalJSON(data []byte) error {
//
// If the underlying value is not a json object, one of the following properties
// will be valid: OfString OfResponseFunctionCallOutputItemArray
-// OfOutputContentList]
+// OfResponseFunctionShellCallOutputContentArray OfOutputContentList]
type ResponseInputItemUnionOutput struct {
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
@@ -6711,6 +7475,9 @@ type ResponseInputItemUnionOutput struct {
// [ResponseFunctionCallOutputItemList] instead of an object.
OfResponseFunctionCallOutputItemArray ResponseFunctionCallOutputItemList `json:",inline"`
// This field will be present if the value is a
+ // [[]ResponseFunctionShellCallOutputContent] instead of an object.
+ OfResponseFunctionShellCallOutputContentArray []ResponseFunctionShellCallOutputContent `json:",inline"`
+ // This field will be present if the value is a
// [[]ResponseCustomToolCallOutputOutputOutputContentListItemUnion] instead of an
// object.
OfOutputContentList []ResponseCustomToolCallOutputOutputOutputContentListItemUnion `json:",inline"`
@@ -6721,13 +7488,14 @@ type ResponseInputItemUnionOutput struct {
// This field is from variant [ResponseComputerToolCallOutputScreenshot].
ImageURL string `json:"image_url"`
JSON struct {
- OfString respjson.Field
- OfResponseFunctionCallOutputItemArray respjson.Field
- OfOutputContentList respjson.Field
- Type respjson.Field
- FileID respjson.Field
- ImageURL respjson.Field
- raw string
+ OfString respjson.Field
+ OfResponseFunctionCallOutputItemArray respjson.Field
+ OfResponseFunctionShellCallOutputContentArray respjson.Field
+ OfOutputContentList respjson.Field
+ Type respjson.Field
+ FileID respjson.Field
+ ImageURL respjson.Field
+ raw string
} `json:"-"`
}
@@ -6840,98 +7608,422 @@ type ResponseInputItemComputerCallOutputAcknowledgedSafetyCheck struct {
func (r ResponseInputItemComputerCallOutputAcknowledgedSafetyCheck) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseInputItemComputerCallOutputAcknowledgedSafetyCheck) UnmarshalJSON(data []byte) error {
+func (r *ResponseInputItemComputerCallOutputAcknowledgedSafetyCheck) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The output of a function tool call.
+type ResponseInputItemFunctionCallOutput struct {
+ // The unique ID of the function tool call generated by the model.
+ CallID string `json:"call_id,required"`
+ // Text, image, or file output of the function tool call.
+ Output ResponseInputItemFunctionCallOutputOutputUnion `json:"output,required"`
+ // The type of the function tool call output. Always `function_call_output`.
+ Type constant.FunctionCallOutput `json:"type,required"`
+ // The unique ID of the function tool call output. Populated when this item is
+ // returned via API.
+ ID string `json:"id,nullable"`
+ // The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+ // Populated when items are returned via API.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status,nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallID respjson.Field
+ Output respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputItemFunctionCallOutput) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemFunctionCallOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ResponseInputItemFunctionCallOutputOutputUnion contains all possible properties
+// and values from [string], [ResponseFunctionCallOutputItemList].
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfString OfResponseFunctionCallOutputItemArray]
+type ResponseInputItemFunctionCallOutputOutputUnion struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a
+ // [ResponseFunctionCallOutputItemList] instead of an object.
+ OfResponseFunctionCallOutputItemArray ResponseFunctionCallOutputItemList `json:",inline"`
+ JSON struct {
+ OfString respjson.Field
+ OfResponseFunctionCallOutputItemArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u ResponseInputItemFunctionCallOutputOutputUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseInputItemFunctionCallOutputOutputUnion) AsResponseFunctionCallOutputItemArray() (v ResponseFunctionCallOutputItemList) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ResponseInputItemFunctionCallOutputOutputUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ResponseInputItemFunctionCallOutputOutputUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An image generation request made by the model.
+type ResponseInputItemImageGenerationCall struct {
+ // The unique ID of the image generation call.
+ ID string `json:"id,required"`
+ // The generated image encoded in base64.
+ Result string `json:"result,required"`
+ // The status of the image generation call.
+ //
+ // Any of "in_progress", "completed", "generating", "failed".
+ Status string `json:"status,required"`
+ // The type of the image generation call. Always `image_generation_call`.
+ Type constant.ImageGenerationCall `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Result respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputItemImageGenerationCall) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemImageGenerationCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool call to run a command on the local shell.
+type ResponseInputItemLocalShellCall struct {
+ // The unique ID of the local shell call.
+ ID string `json:"id,required"`
+ // Execute a shell command on the server.
+ Action ResponseInputItemLocalShellCallAction `json:"action,required"`
+ // The unique ID of the local shell tool call generated by the model.
+ CallID string `json:"call_id,required"`
+ // The status of the local shell call.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status,required"`
+ // The type of the local shell call. Always `local_shell_call`.
+ Type constant.LocalShellCall `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Action respjson.Field
+ CallID respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputItemLocalShellCall) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemLocalShellCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Execute a shell command on the server.
+type ResponseInputItemLocalShellCallAction struct {
+ // The command to run.
+ Command []string `json:"command,required"`
+ // Environment variables to set for the command.
+ Env map[string]string `json:"env,required"`
+ // The type of the local shell action. Always `exec`.
+ Type constant.Exec `json:"type,required"`
+ // Optional timeout in milliseconds for the command.
+ TimeoutMs int64 `json:"timeout_ms,nullable"`
+ // Optional user to run the command as.
+ User string `json:"user,nullable"`
+ // Optional working directory to run the command in.
+ WorkingDirectory string `json:"working_directory,nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Command respjson.Field
+ Env respjson.Field
+ Type respjson.Field
+ TimeoutMs respjson.Field
+ User respjson.Field
+ WorkingDirectory respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputItemLocalShellCallAction) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemLocalShellCallAction) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The output of a local shell tool call.
+type ResponseInputItemLocalShellCallOutput struct {
+ // The unique ID of the local shell tool call generated by the model.
+ ID string `json:"id,required"`
+ // A JSON string of the output of the local shell tool call.
+ Output string `json:"output,required"`
+ // The type of the local shell tool call output. Always `local_shell_call_output`.
+ Type constant.LocalShellCallOutput `json:"type,required"`
+ // The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status,nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Output respjson.Field
+ Type respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputItemLocalShellCallOutput) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemLocalShellCallOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool representing a request to execute one or more shell commands.
+type ResponseInputItemShellCall struct {
+ // The shell commands and limits that describe how to run the tool call.
+ Action ResponseInputItemShellCallAction `json:"action,required"`
+ // The unique ID of the function shell tool call generated by the model.
+ CallID string `json:"call_id,required"`
+ // The type of the item. Always `function_shell_call`.
+ Type constant.ShellCall `json:"type,required"`
+ // The unique ID of the function shell tool call. Populated when this item is
+ // returned via API.
+ ID string `json:"id,nullable"`
+ // The status of the shell call. One of `in_progress`, `completed`, or
+ // `incomplete`.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status,nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Action respjson.Field
+ CallID respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputItemShellCall) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemShellCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The shell commands and limits that describe how to run the tool call.
+type ResponseInputItemShellCallAction struct {
+ // Ordered shell commands for the execution environment to run.
+ Commands []string `json:"commands,required"`
+ // Maximum number of UTF-8 characters to capture from combined stdout and stderr
+ // output.
+ MaxOutputLength int64 `json:"max_output_length,nullable"`
+ // Maximum wall-clock time in milliseconds to allow the shell commands to run.
+ TimeoutMs int64 `json:"timeout_ms,nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Commands respjson.Field
+ MaxOutputLength respjson.Field
+ TimeoutMs respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputItemShellCallAction) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemShellCallAction) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The streamed output items emitted by a function shell tool call.
+type ResponseInputItemShellCallOutput struct {
+ // The unique ID of the function shell tool call generated by the model.
+ CallID string `json:"call_id,required"`
+ // Captured chunks of stdout and stderr output, along with their associated
+ // outcomes.
+ Output []ResponseFunctionShellCallOutputContent `json:"output,required"`
+ // The type of the item. Always `function_shell_call_output`.
+ Type constant.ShellCallOutput `json:"type,required"`
+ // The unique ID of the function shell tool call output. Populated when this item
+ // is returned via API.
+ ID string `json:"id,nullable"`
+ // The maximum number of UTF-8 characters captured for this shell call's combined
+ // output.
+ MaxOutputLength int64 `json:"max_output_length,nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallID respjson.Field
+ Output respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ MaxOutputLength respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputItemShellCallOutput) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemShellCallOutput) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// The output of a function tool call.
-type ResponseInputItemFunctionCallOutput struct {
- // The unique ID of the function tool call generated by the model.
+// A tool call representing a request to create, delete, or update files using diff
+// patches.
+type ResponseInputItemApplyPatchCall struct {
+ // The unique ID of the apply patch tool call generated by the model.
CallID string `json:"call_id,required"`
- // Text, image, or file output of the function tool call.
- Output ResponseInputItemFunctionCallOutputOutputUnion `json:"output,required"`
- // The type of the function tool call output. Always `function_call_output`.
- Type constant.FunctionCallOutput `json:"type,required"`
- // The unique ID of the function tool call output. Populated when this item is
- // returned via API.
- ID string `json:"id,nullable"`
- // The status of the item. One of `in_progress`, `completed`, or `incomplete`.
- // Populated when items are returned via API.
+ // The specific create, delete, or update instruction for the apply_patch tool
+ // call.
+ Operation ResponseInputItemApplyPatchCallOperationUnion `json:"operation,required"`
+ // The status of the apply patch tool call. One of `in_progress` or `completed`.
//
- // Any of "in_progress", "completed", "incomplete".
- Status string `json:"status,nullable"`
+ // Any of "in_progress", "completed".
+ Status string `json:"status,required"`
+ // The type of the item. Always `apply_patch_call`.
+ Type constant.ApplyPatchCall `json:"type,required"`
+ // The unique ID of the apply patch tool call. Populated when this item is returned
+ // via API.
+ ID string `json:"id,nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CallID respjson.Field
- Output respjson.Field
+ Operation respjson.Field
+ Status respjson.Field
Type respjson.Field
ID respjson.Field
- Status respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
-func (r ResponseInputItemFunctionCallOutput) RawJSON() string { return r.JSON.raw }
-func (r *ResponseInputItemFunctionCallOutput) UnmarshalJSON(data []byte) error {
+func (r ResponseInputItemApplyPatchCall) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemApplyPatchCall) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ResponseInputItemFunctionCallOutputOutputUnion contains all possible properties
-// and values from [string], [ResponseFunctionCallOutputItemList].
+// ResponseInputItemApplyPatchCallOperationUnion contains all possible properties
+// and values from [ResponseInputItemApplyPatchCallOperationCreateFile],
+// [ResponseInputItemApplyPatchCallOperationDeleteFile],
+// [ResponseInputItemApplyPatchCallOperationUpdateFile].
//
-// Use the methods beginning with 'As' to cast the union to one of its variants.
+// Use the [ResponseInputItemApplyPatchCallOperationUnion.AsAny] method to switch
+// on the variant.
//
-// If the underlying value is not a json object, one of the following properties
-// will be valid: OfString OfResponseFunctionCallOutputItemArray]
-type ResponseInputItemFunctionCallOutputOutputUnion struct {
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a
- // [ResponseFunctionCallOutputItemList] instead of an object.
- OfResponseFunctionCallOutputItemArray ResponseFunctionCallOutputItemList `json:",inline"`
- JSON struct {
- OfString respjson.Field
- OfResponseFunctionCallOutputItemArray respjson.Field
- raw string
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ResponseInputItemApplyPatchCallOperationUnion struct {
+ Diff string `json:"diff"`
+ Path string `json:"path"`
+ // Any of "create_file", "delete_file", "update_file".
+ Type string `json:"type"`
+ JSON struct {
+ Diff respjson.Field
+ Path respjson.Field
+ Type respjson.Field
+ raw string
} `json:"-"`
}
-func (u ResponseInputItemFunctionCallOutputOutputUnion) AsString() (v string) {
+// anyResponseInputItemApplyPatchCallOperation is implemented by each variant of
+// [ResponseInputItemApplyPatchCallOperationUnion] to add type safety for the
+// return type of [ResponseInputItemApplyPatchCallOperationUnion.AsAny]
+type anyResponseInputItemApplyPatchCallOperation interface {
+ implResponseInputItemApplyPatchCallOperationUnion()
+}
+
+func (ResponseInputItemApplyPatchCallOperationCreateFile) implResponseInputItemApplyPatchCallOperationUnion() {
+}
+func (ResponseInputItemApplyPatchCallOperationDeleteFile) implResponseInputItemApplyPatchCallOperationUnion() {
+}
+func (ResponseInputItemApplyPatchCallOperationUpdateFile) implResponseInputItemApplyPatchCallOperationUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ResponseInputItemApplyPatchCallOperationUnion.AsAny().(type) {
+// case responses.ResponseInputItemApplyPatchCallOperationCreateFile:
+// case responses.ResponseInputItemApplyPatchCallOperationDeleteFile:
+// case responses.ResponseInputItemApplyPatchCallOperationUpdateFile:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ResponseInputItemApplyPatchCallOperationUnion) AsAny() anyResponseInputItemApplyPatchCallOperation {
+ switch u.Type {
+ case "create_file":
+ return u.AsCreateFile()
+ case "delete_file":
+ return u.AsDeleteFile()
+ case "update_file":
+ return u.AsUpdateFile()
+ }
+ return nil
+}
+
+func (u ResponseInputItemApplyPatchCallOperationUnion) AsCreateFile() (v ResponseInputItemApplyPatchCallOperationCreateFile) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseInputItemFunctionCallOutputOutputUnion) AsResponseFunctionCallOutputItemArray() (v ResponseFunctionCallOutputItemList) {
+func (u ResponseInputItemApplyPatchCallOperationUnion) AsDeleteFile() (v ResponseInputItemApplyPatchCallOperationDeleteFile) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseInputItemApplyPatchCallOperationUnion) AsUpdateFile() (v ResponseInputItemApplyPatchCallOperationUpdateFile) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ResponseInputItemFunctionCallOutputOutputUnion) RawJSON() string { return u.JSON.raw }
+func (u ResponseInputItemApplyPatchCallOperationUnion) RawJSON() string { return u.JSON.raw }
-func (r *ResponseInputItemFunctionCallOutputOutputUnion) UnmarshalJSON(data []byte) error {
+func (r *ResponseInputItemApplyPatchCallOperationUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// An image generation request made by the model.
-type ResponseInputItemImageGenerationCall struct {
- // The unique ID of the image generation call.
- ID string `json:"id,required"`
- // The generated image encoded in base64.
- Result string `json:"result,required"`
- // The status of the image generation call.
- //
- // Any of "in_progress", "completed", "generating", "failed".
- Status string `json:"status,required"`
- // The type of the image generation call. Always `image_generation_call`.
- Type constant.ImageGenerationCall `json:"type,required"`
+// Instruction for creating a new file via the apply_patch tool.
+type ResponseInputItemApplyPatchCallOperationCreateFile struct {
+ // Unified diff content to apply when creating the file.
+ Diff string `json:"diff,required"`
+ // Path of the file to create relative to the workspace root.
+ Path string `json:"path,required"`
+ // The operation type. Always `create_file`.
+ Type constant.CreateFile `json:"type,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- ID respjson.Field
- Result respjson.Field
- Status respjson.Field
+ Diff respjson.Field
+ Path respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
raw string
@@ -6939,31 +8031,20 @@ type ResponseInputItemImageGenerationCall struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseInputItemImageGenerationCall) RawJSON() string { return r.JSON.raw }
-func (r *ResponseInputItemImageGenerationCall) UnmarshalJSON(data []byte) error {
+func (r ResponseInputItemApplyPatchCallOperationCreateFile) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemApplyPatchCallOperationCreateFile) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// A tool call to run a command on the local shell.
-type ResponseInputItemLocalShellCall struct {
- // The unique ID of the local shell call.
- ID string `json:"id,required"`
- // Execute a shell command on the server.
- Action ResponseInputItemLocalShellCallAction `json:"action,required"`
- // The unique ID of the local shell tool call generated by the model.
- CallID string `json:"call_id,required"`
- // The status of the local shell call.
- //
- // Any of "in_progress", "completed", "incomplete".
- Status string `json:"status,required"`
- // The type of the local shell call. Always `local_shell_call`.
- Type constant.LocalShellCall `json:"type,required"`
+// Instruction for deleting an existing file via the apply_patch tool.
+type ResponseInputItemApplyPatchCallOperationDeleteFile struct {
+ // Path of the file to delete relative to the workspace root.
+ Path string `json:"path,required"`
+ // The operation type. Always `delete_file`.
+ Type constant.DeleteFile `json:"type,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- ID respjson.Field
- Action respjson.Field
- CallID respjson.Field
- Status respjson.Field
+ Path respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
raw string
@@ -6971,70 +8052,66 @@ type ResponseInputItemLocalShellCall struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseInputItemLocalShellCall) RawJSON() string { return r.JSON.raw }
-func (r *ResponseInputItemLocalShellCall) UnmarshalJSON(data []byte) error {
+func (r ResponseInputItemApplyPatchCallOperationDeleteFile) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemApplyPatchCallOperationDeleteFile) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Execute a shell command on the server.
-type ResponseInputItemLocalShellCallAction struct {
- // The command to run.
- Command []string `json:"command,required"`
- // Environment variables to set for the command.
- Env map[string]string `json:"env,required"`
- // The type of the local shell action. Always `exec`.
- Type constant.Exec `json:"type,required"`
- // Optional timeout in milliseconds for the command.
- TimeoutMs int64 `json:"timeout_ms,nullable"`
- // Optional user to run the command as.
- User string `json:"user,nullable"`
- // Optional working directory to run the command in.
- WorkingDirectory string `json:"working_directory,nullable"`
+// Instruction for updating an existing file via the apply_patch tool.
+type ResponseInputItemApplyPatchCallOperationUpdateFile struct {
+ // Unified diff content to apply to the existing file.
+ Diff string `json:"diff,required"`
+ // Path of the file to update relative to the workspace root.
+ Path string `json:"path,required"`
+ // The operation type. Always `update_file`.
+ Type constant.UpdateFile `json:"type,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- Command respjson.Field
- Env respjson.Field
- Type respjson.Field
- TimeoutMs respjson.Field
- User respjson.Field
- WorkingDirectory respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ Diff respjson.Field
+ Path respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
-func (r ResponseInputItemLocalShellCallAction) RawJSON() string { return r.JSON.raw }
-func (r *ResponseInputItemLocalShellCallAction) UnmarshalJSON(data []byte) error {
+func (r ResponseInputItemApplyPatchCallOperationUpdateFile) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemApplyPatchCallOperationUpdateFile) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// The output of a local shell tool call.
-type ResponseInputItemLocalShellCallOutput struct {
- // The unique ID of the local shell tool call generated by the model.
- ID string `json:"id,required"`
- // A JSON string of the output of the local shell tool call.
- Output string `json:"output,required"`
- // The type of the local shell tool call output. Always `local_shell_call_output`.
- Type constant.LocalShellCallOutput `json:"type,required"`
- // The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+// The streamed output emitted by an apply patch tool call.
+type ResponseInputItemApplyPatchCallOutput struct {
+ // The unique ID of the apply patch tool call generated by the model.
+ CallID string `json:"call_id,required"`
+ // The status of the apply patch tool call output. One of `completed` or `failed`.
//
- // Any of "in_progress", "completed", "incomplete".
- Status string `json:"status,nullable"`
+ // Any of "completed", "failed".
+ Status string `json:"status,required"`
+ // The type of the item. Always `apply_patch_call_output`.
+ Type constant.ApplyPatchCallOutput `json:"type,required"`
+ // The unique ID of the apply patch tool call output. Populated when this item is
+ // returned via API.
+ ID string `json:"id,nullable"`
+ // Optional human-readable log text from the apply patch tool (e.g., patch results
+ // or errors).
+ Output string `json:"output,nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
+ CallID respjson.Field
+ Status respjson.Field
+ Type respjson.Field
ID respjson.Field
Output respjson.Field
- Type respjson.Field
- Status respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
-func (r ResponseInputItemLocalShellCallOutput) RawJSON() string { return r.JSON.raw }
-func (r *ResponseInputItemLocalShellCallOutput) UnmarshalJSON(data []byte) error {
+func (r ResponseInputItemApplyPatchCallOutput) RawJSON() string { return r.JSON.raw }
+func (r *ResponseInputItemApplyPatchCallOutput) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
@@ -7326,6 +8403,44 @@ func ResponseInputItemParamOfLocalShellCallOutput(id string, output string) Resp
return ResponseInputItemUnionParam{OfLocalShellCallOutput: &localShellCallOutput}
}
+func ResponseInputItemParamOfShellCall(action ResponseInputItemShellCallActionParam, callID string) ResponseInputItemUnionParam {
+ var shellCall ResponseInputItemShellCallParam
+ shellCall.Action = action
+ shellCall.CallID = callID
+ return ResponseInputItemUnionParam{OfShellCall: &shellCall}
+}
+
+func ResponseInputItemParamOfShellCallOutput(callID string, output []ResponseFunctionShellCallOutputContentParam) ResponseInputItemUnionParam {
+ var shellCallOutput ResponseInputItemShellCallOutputParam
+ shellCallOutput.CallID = callID
+ shellCallOutput.Output = output
+ return ResponseInputItemUnionParam{OfShellCallOutput: &shellCallOutput}
+}
+
+func ResponseInputItemParamOfApplyPatchCall[
+ T ResponseInputItemApplyPatchCallOperationCreateFileParam | ResponseInputItemApplyPatchCallOperationDeleteFileParam | ResponseInputItemApplyPatchCallOperationUpdateFileParam,
+](callID string, operation T, status string) ResponseInputItemUnionParam {
+ var applyPatchCall ResponseInputItemApplyPatchCallParam
+ applyPatchCall.CallID = callID
+ switch v := any(operation).(type) {
+ case ResponseInputItemApplyPatchCallOperationCreateFileParam:
+ applyPatchCall.Operation.OfCreateFile = &v
+ case ResponseInputItemApplyPatchCallOperationDeleteFileParam:
+ applyPatchCall.Operation.OfDeleteFile = &v
+ case ResponseInputItemApplyPatchCallOperationUpdateFileParam:
+ applyPatchCall.Operation.OfUpdateFile = &v
+ }
+ applyPatchCall.Status = status
+ return ResponseInputItemUnionParam{OfApplyPatchCall: &applyPatchCall}
+}
+
+func ResponseInputItemParamOfApplyPatchCallOutput(callID string, status string) ResponseInputItemUnionParam {
+ var applyPatchCallOutput ResponseInputItemApplyPatchCallOutputParam
+ applyPatchCallOutput.CallID = callID
+ applyPatchCallOutput.Status = status
+ return ResponseInputItemUnionParam{OfApplyPatchCallOutput: &applyPatchCallOutput}
+}
+
func ResponseInputItemParamOfMcpListTools(id string, serverLabel string, tools []ResponseInputItemMcpListToolsToolParam) ResponseInputItemUnionParam {
var mcpListTools ResponseInputItemMcpListToolsParam
mcpListTools.ID = id
@@ -7387,6 +8502,10 @@ type ResponseInputItemUnionParam struct {
OfCodeInterpreterCall *ResponseCodeInterpreterToolCallParam `json:",omitzero,inline"`
OfLocalShellCall *ResponseInputItemLocalShellCallParam `json:",omitzero,inline"`
OfLocalShellCallOutput *ResponseInputItemLocalShellCallOutputParam `json:",omitzero,inline"`
+ OfShellCall *ResponseInputItemShellCallParam `json:",omitzero,inline"`
+ OfShellCallOutput *ResponseInputItemShellCallOutputParam `json:",omitzero,inline"`
+ OfApplyPatchCall *ResponseInputItemApplyPatchCallParam `json:",omitzero,inline"`
+ OfApplyPatchCallOutput *ResponseInputItemApplyPatchCallOutputParam `json:",omitzero,inline"`
OfMcpListTools *ResponseInputItemMcpListToolsParam `json:",omitzero,inline"`
OfMcpApprovalRequest *ResponseInputItemMcpApprovalRequestParam `json:",omitzero,inline"`
OfMcpApprovalResponse *ResponseInputItemMcpApprovalResponseParam `json:",omitzero,inline"`
@@ -7412,6 +8531,10 @@ func (u ResponseInputItemUnionParam) MarshalJSON() ([]byte, error) {
u.OfCodeInterpreterCall,
u.OfLocalShellCall,
u.OfLocalShellCallOutput,
+ u.OfShellCall,
+ u.OfShellCallOutput,
+ u.OfApplyPatchCall,
+ u.OfApplyPatchCallOutput,
u.OfMcpListTools,
u.OfMcpApprovalRequest,
u.OfMcpApprovalResponse,
@@ -7453,6 +8576,14 @@ func (u *ResponseInputItemUnionParam) asAny() any {
return u.OfLocalShellCall
} else if !param.IsOmitted(u.OfLocalShellCallOutput) {
return u.OfLocalShellCallOutput
+ } else if !param.IsOmitted(u.OfShellCall) {
+ return u.OfShellCall
+ } else if !param.IsOmitted(u.OfShellCallOutput) {
+ return u.OfShellCallOutput
+ } else if !param.IsOmitted(u.OfApplyPatchCall) {
+ return u.OfApplyPatchCall
+ } else if !param.IsOmitted(u.OfApplyPatchCallOutput) {
+ return u.OfApplyPatchCallOutput
} else if !param.IsOmitted(u.OfMcpListTools) {
return u.OfMcpListTools
} else if !param.IsOmitted(u.OfMcpApprovalRequest) {
@@ -7551,6 +8682,22 @@ func (u ResponseInputItemUnionParam) GetOutputs() []ResponseCodeInterpreterToolC
return nil
}
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseInputItemUnionParam) GetMaxOutputLength() *int64 {
+ if vt := u.OfShellCallOutput; vt != nil && vt.MaxOutputLength.Valid() {
+ return &vt.MaxOutputLength.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseInputItemUnionParam) GetOperation() *ResponseInputItemApplyPatchCallOperationUnionParam {
+ if vt := u.OfApplyPatchCall; vt != nil {
+ return &vt.Operation
+ }
+ return nil
+}
+
// Returns a pointer to the underlying variant's property, if present.
func (u ResponseInputItemUnionParam) GetTools() []ResponseInputItemMcpListToolsToolParam {
if vt := u.OfMcpListTools; vt != nil {
@@ -7625,6 +8772,14 @@ func (u ResponseInputItemUnionParam) GetType() *string {
return (*string)(&vt.Type)
} else if vt := u.OfLocalShellCallOutput; vt != nil {
return (*string)(&vt.Type)
+ } else if vt := u.OfShellCall; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfShellCallOutput; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfApplyPatchCall; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfApplyPatchCallOutput; vt != nil {
+ return (*string)(&vt.Type)
} else if vt := u.OfMcpListTools; vt != nil {
return (*string)(&vt.Type)
} else if vt := u.OfMcpApprovalRequest; vt != nil {
@@ -7671,6 +8826,12 @@ func (u ResponseInputItemUnionParam) GetStatus() *string {
return (*string)(&vt.Status)
} else if vt := u.OfLocalShellCallOutput; vt != nil {
return (*string)(&vt.Status)
+ } else if vt := u.OfShellCall; vt != nil {
+ return (*string)(&vt.Status)
+ } else if vt := u.OfApplyPatchCall; vt != nil {
+ return (*string)(&vt.Status)
+ } else if vt := u.OfApplyPatchCallOutput; vt != nil {
+ return (*string)(&vt.Status)
} else if vt := u.OfMcpCall; vt != nil {
return (*string)(&vt.Status)
}
@@ -7703,6 +8864,14 @@ func (u ResponseInputItemUnionParam) GetID() *string {
return (*string)(&vt.ID)
} else if vt := u.OfLocalShellCallOutput; vt != nil {
return (*string)(&vt.ID)
+ } else if vt := u.OfShellCall; vt != nil && vt.ID.Valid() {
+ return &vt.ID.Value
+ } else if vt := u.OfShellCallOutput; vt != nil && vt.ID.Valid() {
+ return &vt.ID.Value
+ } else if vt := u.OfApplyPatchCall; vt != nil && vt.ID.Valid() {
+ return &vt.ID.Value
+ } else if vt := u.OfApplyPatchCallOutput; vt != nil && vt.ID.Valid() {
+ return &vt.ID.Value
} else if vt := u.OfMcpListTools; vt != nil {
return (*string)(&vt.ID)
} else if vt := u.OfMcpApprovalRequest; vt != nil {
@@ -7733,6 +8902,14 @@ func (u ResponseInputItemUnionParam) GetCallID() *string {
return (*string)(&vt.CallID)
} else if vt := u.OfLocalShellCall; vt != nil {
return (*string)(&vt.CallID)
+ } else if vt := u.OfShellCall; vt != nil {
+ return (*string)(&vt.CallID)
+ } else if vt := u.OfShellCallOutput; vt != nil {
+ return (*string)(&vt.CallID)
+ } else if vt := u.OfApplyPatchCall; vt != nil {
+ return (*string)(&vt.CallID)
+ } else if vt := u.OfApplyPatchCallOutput; vt != nil {
+ return (*string)(&vt.CallID)
} else if vt := u.OfCustomToolCallOutput; vt != nil {
return (*string)(&vt.CallID)
} else if vt := u.OfCustomToolCall; vt != nil {
@@ -7842,6 +9019,8 @@ func (u ResponseInputItemUnionParam) GetAction() (res responseInputItemUnionPara
res.any = vt.Action.asAny()
} else if vt := u.OfLocalShellCall; vt != nil {
res.any = &vt.Action
+ } else if vt := u.OfShellCall; vt != nil {
+ res.any = &vt.Action
}
return
}
@@ -7858,7 +9037,8 @@ func (u ResponseInputItemUnionParam) GetAction() (res responseInputItemUnionPara
// [*ResponseFunctionWebSearchActionSearchParam],
// [*ResponseFunctionWebSearchActionOpenPageParam],
// [*ResponseFunctionWebSearchActionFindParam],
-// [*ResponseInputItemLocalShellCallActionParam]
+// [*ResponseInputItemLocalShellCallActionParam],
+// [*ResponseInputItemShellCallActionParam]
type responseInputItemUnionParamAction struct{ any }
// Use the following switch statement to get the type of the union:
@@ -7877,6 +9057,7 @@ type responseInputItemUnionParamAction struct{ any }
// case *responses.ResponseFunctionWebSearchActionOpenPageParam:
// case *responses.ResponseFunctionWebSearchActionFindParam:
// case *responses.ResponseInputItemLocalShellCallActionParam:
+// case *responses.ResponseInputItemShellCallActionParam:
// default:
// fmt.Errorf("not present")
// }
@@ -7982,28 +9163,37 @@ func (u responseInputItemUnionParamAction) GetEnv() map[string]string {
}
// Returns a pointer to the underlying variant's property, if present.
-func (u responseInputItemUnionParamAction) GetTimeoutMs() *int64 {
+func (u responseInputItemUnionParamAction) GetUser() *string {
switch vt := u.any.(type) {
case *ResponseInputItemLocalShellCallActionParam:
- return paramutil.AddrIfPresent(vt.TimeoutMs)
+ return paramutil.AddrIfPresent(vt.User)
}
return nil
}
// Returns a pointer to the underlying variant's property, if present.
-func (u responseInputItemUnionParamAction) GetUser() *string {
+func (u responseInputItemUnionParamAction) GetWorkingDirectory() *string {
switch vt := u.any.(type) {
case *ResponseInputItemLocalShellCallActionParam:
- return paramutil.AddrIfPresent(vt.User)
+ return paramutil.AddrIfPresent(vt.WorkingDirectory)
}
return nil
}
// Returns a pointer to the underlying variant's property, if present.
-func (u responseInputItemUnionParamAction) GetWorkingDirectory() *string {
+func (u responseInputItemUnionParamAction) GetCommands() []string {
switch vt := u.any.(type) {
- case *ResponseInputItemLocalShellCallActionParam:
- return paramutil.AddrIfPresent(vt.WorkingDirectory)
+ case *ResponseInputItemShellCallActionParam:
+ return vt.Commands
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u responseInputItemUnionParamAction) GetMaxOutputLength() *int64 {
+ switch vt := u.any.(type) {
+ case *ResponseInputItemShellCallActionParam:
+ return paramutil.AddrIfPresent(vt.MaxOutputLength)
}
return nil
}
@@ -8048,6 +9238,17 @@ func (u responseInputItemUnionParamAction) GetURL() *string {
return nil
}
+// Returns a pointer to the underlying variant's property, if present.
+func (u responseInputItemUnionParamAction) GetTimeoutMs() *int64 {
+ switch vt := u.any.(type) {
+ case *ResponseInputItemLocalShellCallActionParam:
+ return paramutil.AddrIfPresent(vt.TimeoutMs)
+ case *ResponseInputItemShellCallActionParam:
+ return paramutil.AddrIfPresent(vt.TimeoutMs)
+ }
+ return nil
+}
+
// Returns a subunion which exports methods to access subproperties
//
// Or use AsAny() to get the underlying value
@@ -8058,6 +9259,10 @@ func (u ResponseInputItemUnionParam) GetOutput() (res responseInputItemUnionPara
res.any = vt.Output.asAny()
} else if vt := u.OfLocalShellCallOutput; vt != nil {
res.any = &vt.Output
+ } else if vt := u.OfShellCallOutput; vt != nil {
+ res.any = &vt.Output
+ } else if vt := u.OfApplyPatchCallOutput; vt != nil && vt.Output.Valid() {
+ res.any = &vt.Output.Value
} else if vt := u.OfMcpCall; vt != nil && vt.Output.Valid() {
res.any = &vt.Output.Value
} else if vt := u.OfCustomToolCallOutput; vt != nil {
@@ -8066,23 +9271,56 @@ func (u ResponseInputItemUnionParam) GetOutput() (res responseInputItemUnionPara
return
}
-// Can have the runtime types [*ResponseComputerToolCallOutputScreenshotParam],
-// [*string], [*ResponseFunctionCallOutputItemListParam],
-// [\*[]ResponseCustomToolCallOutputOutputOutputContentListItemUnionParam]
-type responseInputItemUnionParamOutput struct{ any }
-
-// Use the following switch statement to get the type of the union:
-//
-// switch u.AsAny().(type) {
-// case *responses.ResponseComputerToolCallOutputScreenshotParam:
-// case *string:
-// case *responses.ResponseFunctionCallOutputItemListParam:
-// case *[]responses.ResponseCustomToolCallOutputOutputOutputContentListItemUnionParam:
-// default:
-// fmt.Errorf("not present")
-// }
-func (u responseInputItemUnionParamOutput) AsAny() any { return u.any }
-
+// Can have the runtime types [*ResponseComputerToolCallOutputScreenshotParam],
+// [*string], [*ResponseFunctionCallOutputItemListParam],
+// [_[]ResponseFunctionShellCallOutputContentParam],
+// [_[]ResponseCustomToolCallOutputOutputOutputContentListItemUnionParam]
+type responseInputItemUnionParamOutput struct{ any }
+
+// Use the following switch statement to get the type of the union:
+//
+// switch u.AsAny().(type) {
+// case *responses.ResponseComputerToolCallOutputScreenshotParam:
+// case *string:
+// case *responses.ResponseFunctionCallOutputItemListParam:
+// case *[]responses.ResponseFunctionShellCallOutputContentParam:
+// case *[]responses.ResponseCustomToolCallOutputOutputOutputContentListItemUnionParam:
+// default:
+// fmt.Errorf("not present")
+// }
+func (u responseInputItemUnionParamOutput) AsAny() any { return u.any }
+
+func init() {
+ apijson.RegisterUnion[ResponseInputItemUnionParam](
+ "type",
+ apijson.Discriminator[EasyInputMessageParam]("message"),
+ apijson.Discriminator[ResponseInputItemMessageParam]("message"),
+ apijson.Discriminator[ResponseOutputMessageParam]("message"),
+ apijson.Discriminator[ResponseFileSearchToolCallParam]("file_search_call"),
+ apijson.Discriminator[ResponseComputerToolCallParam]("computer_call"),
+ apijson.Discriminator[ResponseInputItemComputerCallOutputParam]("computer_call_output"),
+ apijson.Discriminator[ResponseFunctionWebSearchParam]("web_search_call"),
+ apijson.Discriminator[ResponseFunctionToolCallParam]("function_call"),
+ apijson.Discriminator[ResponseInputItemFunctionCallOutputParam]("function_call_output"),
+ apijson.Discriminator[ResponseReasoningItemParam]("reasoning"),
+ apijson.Discriminator[ResponseInputItemImageGenerationCallParam]("image_generation_call"),
+ apijson.Discriminator[ResponseCodeInterpreterToolCallParam]("code_interpreter_call"),
+ apijson.Discriminator[ResponseInputItemLocalShellCallParam]("local_shell_call"),
+ apijson.Discriminator[ResponseInputItemLocalShellCallOutputParam]("local_shell_call_output"),
+ apijson.Discriminator[ResponseInputItemShellCallParam]("shell_call"),
+ apijson.Discriminator[ResponseInputItemShellCallOutputParam]("shell_call_output"),
+ apijson.Discriminator[ResponseInputItemApplyPatchCallParam]("apply_patch_call"),
+ apijson.Discriminator[ResponseInputItemApplyPatchCallOutputParam]("apply_patch_call_output"),
+ apijson.Discriminator[ResponseInputItemMcpListToolsParam]("mcp_list_tools"),
+ apijson.Discriminator[ResponseInputItemMcpApprovalRequestParam]("mcp_approval_request"),
+ apijson.Discriminator[ResponseInputItemMcpApprovalResponseParam]("mcp_approval_response"),
+ apijson.Discriminator[ResponseInputItemMcpCallParam]("mcp_call"),
+ apijson.Discriminator[ResponseCustomToolCallOutputParam]("custom_tool_call_output"),
+ apijson.Discriminator[ResponseCustomToolCallParam]("custom_tool_call"),
+ apijson.Discriminator[ResponseInputItemItemReferenceParam]("item_reference"),
+ )
+}
+
// A message input to the model with a role indicating instruction following
// hierarchy. Instructions given with the `developer` or `system` role take
// precedence over instructions given with the `user` role.
@@ -8116,6 +9354,18 @@ func (r *ResponseInputItemMessageParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+func init() {
+ apijson.RegisterFieldValidator[ResponseInputItemMessageParam](
+ "role", "user", "system", "developer",
+ )
+ apijson.RegisterFieldValidator[ResponseInputItemMessageParam](
+ "status", "in_progress", "completed", "incomplete",
+ )
+ apijson.RegisterFieldValidator[ResponseInputItemMessageParam](
+ "type", "message",
+ )
+}
+
// The output of a computer tool call.
//
// The properties CallID, Output, Type are required.
@@ -8150,6 +9400,12 @@ func (r *ResponseInputItemComputerCallOutputParam) UnmarshalJSON(data []byte) er
return apijson.UnmarshalRoot(data, r)
}
+func init() {
+ apijson.RegisterFieldValidator[ResponseInputItemComputerCallOutputParam](
+ "status", "in_progress", "completed", "incomplete",
+ )
+}
+
// A pending safety check for the computer call.
//
// The property ID is required.
@@ -8258,96 +9514,418 @@ func (r ResponseInputItemImageGenerationCallParam) MarshalJSON() (data []byte, e
type shadow ResponseInputItemImageGenerationCallParam
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *ResponseInputItemImageGenerationCallParam) UnmarshalJSON(data []byte) error {
+func (r *ResponseInputItemImageGenerationCallParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[ResponseInputItemImageGenerationCallParam](
+ "status", "in_progress", "completed", "generating", "failed",
+ )
+}
+
+// A tool call to run a command on the local shell.
+//
+// The properties ID, Action, CallID, Status, Type are required.
+type ResponseInputItemLocalShellCallParam struct {
+ // The unique ID of the local shell call.
+ ID string `json:"id,required"`
+ // Execute a shell command on the server.
+ Action ResponseInputItemLocalShellCallActionParam `json:"action,omitzero,required"`
+ // The unique ID of the local shell tool call generated by the model.
+ CallID string `json:"call_id,required"`
+ // The status of the local shell call.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status,omitzero,required"`
+ // The type of the local shell call. Always `local_shell_call`.
+ //
+ // This field can be elided, and will marshal its zero value as "local_shell_call".
+ Type constant.LocalShellCall `json:"type,required"`
+ paramObj
+}
+
+func (r ResponseInputItemLocalShellCallParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputItemLocalShellCallParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseInputItemLocalShellCallParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[ResponseInputItemLocalShellCallParam](
+ "status", "in_progress", "completed", "incomplete",
+ )
+}
+
+// Execute a shell command on the server.
+//
+// The properties Command, Env, Type are required.
+type ResponseInputItemLocalShellCallActionParam struct {
+ // The command to run.
+ Command []string `json:"command,omitzero,required"`
+ // Environment variables to set for the command.
+ Env map[string]string `json:"env,omitzero,required"`
+ // Optional timeout in milliseconds for the command.
+ TimeoutMs param.Opt[int64] `json:"timeout_ms,omitzero"`
+ // Optional user to run the command as.
+ User param.Opt[string] `json:"user,omitzero"`
+ // Optional working directory to run the command in.
+ WorkingDirectory param.Opt[string] `json:"working_directory,omitzero"`
+ // The type of the local shell action. Always `exec`.
+ //
+ // This field can be elided, and will marshal its zero value as "exec".
+ Type constant.Exec `json:"type,required"`
+ paramObj
+}
+
+func (r ResponseInputItemLocalShellCallActionParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputItemLocalShellCallActionParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseInputItemLocalShellCallActionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The output of a local shell tool call.
+//
+// The properties ID, Output, Type are required.
+type ResponseInputItemLocalShellCallOutputParam struct {
+ // The unique ID of the local shell tool call generated by the model.
+ ID string `json:"id,required"`
+ // A JSON string of the output of the local shell tool call.
+ Output string `json:"output,required"`
+ // The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status,omitzero"`
+ // The type of the local shell tool call output. Always `local_shell_call_output`.
+ //
+ // This field can be elided, and will marshal its zero value as
+ // "local_shell_call_output".
+ Type constant.LocalShellCallOutput `json:"type,required"`
+ paramObj
+}
+
+func (r ResponseInputItemLocalShellCallOutputParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputItemLocalShellCallOutputParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseInputItemLocalShellCallOutputParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[ResponseInputItemLocalShellCallOutputParam](
+ "status", "in_progress", "completed", "incomplete",
+ )
+}
+
+// A tool representing a request to execute one or more shell commands.
+//
+// The properties Action, CallID, Type are required.
+type ResponseInputItemShellCallParam struct {
+ // The shell commands and limits that describe how to run the tool call.
+ Action ResponseInputItemShellCallActionParam `json:"action,omitzero,required"`
+ // The unique ID of the function shell tool call generated by the model.
+ CallID string `json:"call_id,required"`
+ // The unique ID of the function shell tool call. Populated when this item is
+ // returned via API.
+ ID param.Opt[string] `json:"id,omitzero"`
+ // The status of the shell call. One of `in_progress`, `completed`, or
+ // `incomplete`.
+ //
+ // Any of "in_progress", "completed", "incomplete".
+ Status string `json:"status,omitzero"`
+ // The type of the item. Always `function_shell_call`.
+ //
+ // This field can be elided, and will marshal its zero value as "shell_call".
+ Type constant.ShellCall `json:"type,required"`
+ paramObj
+}
+
+func (r ResponseInputItemShellCallParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputItemShellCallParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseInputItemShellCallParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[ResponseInputItemShellCallParam](
+ "status", "in_progress", "completed", "incomplete",
+ )
+}
+
+// The shell commands and limits that describe how to run the tool call.
+//
+// The property Commands is required.
+type ResponseInputItemShellCallActionParam struct {
+ // Ordered shell commands for the execution environment to run.
+ Commands []string `json:"commands,omitzero,required"`
+ // Maximum number of UTF-8 characters to capture from combined stdout and stderr
+ // output.
+ MaxOutputLength param.Opt[int64] `json:"max_output_length,omitzero"`
+ // Maximum wall-clock time in milliseconds to allow the shell commands to run.
+ TimeoutMs param.Opt[int64] `json:"timeout_ms,omitzero"`
+ paramObj
+}
+
+func (r ResponseInputItemShellCallActionParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputItemShellCallActionParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseInputItemShellCallActionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The streamed output items emitted by a function shell tool call.
+//
+// The properties CallID, Output, Type are required.
+type ResponseInputItemShellCallOutputParam struct {
+ // The unique ID of the function shell tool call generated by the model.
+ CallID string `json:"call_id,required"`
+ // Captured chunks of stdout and stderr output, along with their associated
+ // outcomes.
+ Output []ResponseFunctionShellCallOutputContentParam `json:"output,omitzero,required"`
+ // The unique ID of the function shell tool call output. Populated when this item
+ // is returned via API.
+ ID param.Opt[string] `json:"id,omitzero"`
+ // The maximum number of UTF-8 characters captured for this shell call's combined
+ // output.
+ MaxOutputLength param.Opt[int64] `json:"max_output_length,omitzero"`
+ // The type of the item. Always `function_shell_call_output`.
+ //
+ // This field can be elided, and will marshal its zero value as
+ // "shell_call_output".
+ Type constant.ShellCallOutput `json:"type,required"`
+ paramObj
+}
+
+func (r ResponseInputItemShellCallOutputParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputItemShellCallOutputParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseInputItemShellCallOutputParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool call representing a request to create, delete, or update files using diff
+// patches.
+//
+// The properties CallID, Operation, Status, Type are required.
+type ResponseInputItemApplyPatchCallParam struct {
+ // The unique ID of the apply patch tool call generated by the model.
+ CallID string `json:"call_id,required"`
+ // The specific create, delete, or update instruction for the apply_patch tool
+ // call.
+ Operation ResponseInputItemApplyPatchCallOperationUnionParam `json:"operation,omitzero,required"`
+ // The status of the apply patch tool call. One of `in_progress` or `completed`.
+ //
+ // Any of "in_progress", "completed".
+ Status string `json:"status,omitzero,required"`
+ // The unique ID of the apply patch tool call. Populated when this item is returned
+ // via API.
+ ID param.Opt[string] `json:"id,omitzero"`
+ // The type of the item. Always `apply_patch_call`.
+ //
+ // This field can be elided, and will marshal its zero value as "apply_patch_call".
+ Type constant.ApplyPatchCall `json:"type,required"`
+ paramObj
+}
+
+func (r ResponseInputItemApplyPatchCallParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputItemApplyPatchCallParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseInputItemApplyPatchCallParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[ResponseInputItemApplyPatchCallParam](
+ "status", "in_progress", "completed",
+ )
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type ResponseInputItemApplyPatchCallOperationUnionParam struct {
+ OfCreateFile *ResponseInputItemApplyPatchCallOperationCreateFileParam `json:",omitzero,inline"`
+ OfDeleteFile *ResponseInputItemApplyPatchCallOperationDeleteFileParam `json:",omitzero,inline"`
+ OfUpdateFile *ResponseInputItemApplyPatchCallOperationUpdateFileParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u ResponseInputItemApplyPatchCallOperationUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfCreateFile, u.OfDeleteFile, u.OfUpdateFile)
+}
+func (u *ResponseInputItemApplyPatchCallOperationUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *ResponseInputItemApplyPatchCallOperationUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfCreateFile) {
+ return u.OfCreateFile
+ } else if !param.IsOmitted(u.OfDeleteFile) {
+ return u.OfDeleteFile
+ } else if !param.IsOmitted(u.OfUpdateFile) {
+ return u.OfUpdateFile
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseInputItemApplyPatchCallOperationUnionParam) GetDiff() *string {
+ if vt := u.OfCreateFile; vt != nil {
+ return (*string)(&vt.Diff)
+ } else if vt := u.OfUpdateFile; vt != nil {
+ return (*string)(&vt.Diff)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseInputItemApplyPatchCallOperationUnionParam) GetPath() *string {
+ if vt := u.OfCreateFile; vt != nil {
+ return (*string)(&vt.Path)
+ } else if vt := u.OfDeleteFile; vt != nil {
+ return (*string)(&vt.Path)
+ } else if vt := u.OfUpdateFile; vt != nil {
+ return (*string)(&vt.Path)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseInputItemApplyPatchCallOperationUnionParam) GetType() *string {
+ if vt := u.OfCreateFile; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfDeleteFile; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfUpdateFile; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[ResponseInputItemApplyPatchCallOperationUnionParam](
+ "type",
+ apijson.Discriminator[ResponseInputItemApplyPatchCallOperationCreateFileParam]("create_file"),
+ apijson.Discriminator[ResponseInputItemApplyPatchCallOperationDeleteFileParam]("delete_file"),
+ apijson.Discriminator[ResponseInputItemApplyPatchCallOperationUpdateFileParam]("update_file"),
+ )
+}
+
+// Instruction for creating a new file via the apply_patch tool.
+//
+// The properties Diff, Path, Type are required.
+type ResponseInputItemApplyPatchCallOperationCreateFileParam struct {
+ // Unified diff content to apply when creating the file.
+ Diff string `json:"diff,required"`
+ // Path of the file to create relative to the workspace root.
+ Path string `json:"path,required"`
+ // The operation type. Always `create_file`.
+ //
+ // This field can be elided, and will marshal its zero value as "create_file".
+ Type constant.CreateFile `json:"type,required"`
+ paramObj
+}
+
+func (r ResponseInputItemApplyPatchCallOperationCreateFileParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputItemApplyPatchCallOperationCreateFileParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseInputItemApplyPatchCallOperationCreateFileParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// A tool call to run a command on the local shell.
+// Instruction for deleting an existing file via the apply_patch tool.
//
-// The properties ID, Action, CallID, Status, Type are required.
-type ResponseInputItemLocalShellCallParam struct {
- // The unique ID of the local shell call.
- ID string `json:"id,required"`
- // Execute a shell command on the server.
- Action ResponseInputItemLocalShellCallActionParam `json:"action,omitzero,required"`
- // The unique ID of the local shell tool call generated by the model.
- CallID string `json:"call_id,required"`
- // The status of the local shell call.
- //
- // Any of "in_progress", "completed", "incomplete".
- Status string `json:"status,omitzero,required"`
- // The type of the local shell call. Always `local_shell_call`.
+// The properties Path, Type are required.
+type ResponseInputItemApplyPatchCallOperationDeleteFileParam struct {
+ // Path of the file to delete relative to the workspace root.
+ Path string `json:"path,required"`
+ // The operation type. Always `delete_file`.
//
- // This field can be elided, and will marshal its zero value as "local_shell_call".
- Type constant.LocalShellCall `json:"type,required"`
+ // This field can be elided, and will marshal its zero value as "delete_file".
+ Type constant.DeleteFile `json:"type,required"`
paramObj
}
-func (r ResponseInputItemLocalShellCallParam) MarshalJSON() (data []byte, err error) {
- type shadow ResponseInputItemLocalShellCallParam
+func (r ResponseInputItemApplyPatchCallOperationDeleteFileParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputItemApplyPatchCallOperationDeleteFileParam
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *ResponseInputItemLocalShellCallParam) UnmarshalJSON(data []byte) error {
+func (r *ResponseInputItemApplyPatchCallOperationDeleteFileParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Execute a shell command on the server.
+// Instruction for updating an existing file via the apply_patch tool.
//
-// The properties Command, Env, Type are required.
-type ResponseInputItemLocalShellCallActionParam struct {
- // The command to run.
- Command []string `json:"command,omitzero,required"`
- // Environment variables to set for the command.
- Env map[string]string `json:"env,omitzero,required"`
- // Optional timeout in milliseconds for the command.
- TimeoutMs param.Opt[int64] `json:"timeout_ms,omitzero"`
- // Optional user to run the command as.
- User param.Opt[string] `json:"user,omitzero"`
- // Optional working directory to run the command in.
- WorkingDirectory param.Opt[string] `json:"working_directory,omitzero"`
- // The type of the local shell action. Always `exec`.
+// The properties Diff, Path, Type are required.
+type ResponseInputItemApplyPatchCallOperationUpdateFileParam struct {
+ // Unified diff content to apply to the existing file.
+ Diff string `json:"diff,required"`
+ // Path of the file to update relative to the workspace root.
+ Path string `json:"path,required"`
+ // The operation type. Always `update_file`.
//
- // This field can be elided, and will marshal its zero value as "exec".
- Type constant.Exec `json:"type,required"`
+ // This field can be elided, and will marshal its zero value as "update_file".
+ Type constant.UpdateFile `json:"type,required"`
paramObj
}
-func (r ResponseInputItemLocalShellCallActionParam) MarshalJSON() (data []byte, err error) {
- type shadow ResponseInputItemLocalShellCallActionParam
+func (r ResponseInputItemApplyPatchCallOperationUpdateFileParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputItemApplyPatchCallOperationUpdateFileParam
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *ResponseInputItemLocalShellCallActionParam) UnmarshalJSON(data []byte) error {
+func (r *ResponseInputItemApplyPatchCallOperationUpdateFileParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// The output of a local shell tool call.
+// The streamed output emitted by an apply patch tool call.
//
-// The properties ID, Output, Type are required.
-type ResponseInputItemLocalShellCallOutputParam struct {
- // The unique ID of the local shell tool call generated by the model.
- ID string `json:"id,required"`
- // A JSON string of the output of the local shell tool call.
- Output string `json:"output,required"`
- // The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+// The properties CallID, Status, Type are required.
+type ResponseInputItemApplyPatchCallOutputParam struct {
+ // The unique ID of the apply patch tool call generated by the model.
+ CallID string `json:"call_id,required"`
+ // The status of the apply patch tool call output. One of `completed` or `failed`.
//
- // Any of "in_progress", "completed", "incomplete".
- Status string `json:"status,omitzero"`
- // The type of the local shell tool call output. Always `local_shell_call_output`.
+ // Any of "completed", "failed".
+ Status string `json:"status,omitzero,required"`
+ // The unique ID of the apply patch tool call output. Populated when this item is
+ // returned via API.
+ ID param.Opt[string] `json:"id,omitzero"`
+ // Optional human-readable log text from the apply patch tool (e.g., patch results
+ // or errors).
+ Output param.Opt[string] `json:"output,omitzero"`
+ // The type of the item. Always `apply_patch_call_output`.
//
// This field can be elided, and will marshal its zero value as
- // "local_shell_call_output".
- Type constant.LocalShellCallOutput `json:"type,required"`
+ // "apply_patch_call_output".
+ Type constant.ApplyPatchCallOutput `json:"type,required"`
paramObj
}
-func (r ResponseInputItemLocalShellCallOutputParam) MarshalJSON() (data []byte, err error) {
- type shadow ResponseInputItemLocalShellCallOutputParam
+func (r ResponseInputItemApplyPatchCallOutputParam) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseInputItemApplyPatchCallOutputParam
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *ResponseInputItemLocalShellCallOutputParam) UnmarshalJSON(data []byte) error {
+func (r *ResponseInputItemApplyPatchCallOutputParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+func init() {
+ apijson.RegisterFieldValidator[ResponseInputItemApplyPatchCallOutputParam](
+ "status", "completed", "failed",
+ )
+}
+
// A list of tools available on an MCP server.
//
// The properties ID, ServerLabel, Tools, Type are required.
@@ -8521,6 +10099,12 @@ func (r *ResponseInputItemItemReferenceParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+func init() {
+ apijson.RegisterFieldValidator[ResponseInputItemItemReferenceParam](
+ "type", "item_reference",
+ )
+}
+
type ResponseInputMessageContentList []ResponseInputContentUnion
type ResponseInputMessageContentListParam []ResponseInputContentUnionParam
@@ -8700,6 +10284,8 @@ func (r *ResponseInputTextContentParam) UnmarshalJSON(data []byte) error {
// [ResponseFunctionToolCallItem], [ResponseFunctionToolCallOutputItem],
// [ResponseItemImageGenerationCall], [ResponseCodeInterpreterToolCall],
// [ResponseItemLocalShellCall], [ResponseItemLocalShellCallOutput],
+// [ResponseFunctionShellToolCall], [ResponseFunctionShellToolCallOutput],
+// [ResponseApplyPatchToolCall], [ResponseApplyPatchToolCallOutput],
// [ResponseItemMcpListTools], [ResponseItemMcpApprovalRequest],
// [ResponseItemMcpApprovalResponse], [ResponseItemMcpCall].
//
@@ -8716,21 +10302,24 @@ type ResponseItemUnion struct {
// Any of "message", "message", "file_search_call", "computer_call",
// "computer_call_output", "web_search_call", "function_call",
// "function_call_output", "image_generation_call", "code_interpreter_call",
- // "local_shell_call", "local_shell_call_output", "mcp_list_tools",
- // "mcp_approval_request", "mcp_approval_response", "mcp_call".
+ // "local_shell_call", "local_shell_call_output", "shell_call",
+ // "shell_call_output", "apply_patch_call", "apply_patch_call_output",
+ // "mcp_list_tools", "mcp_approval_request", "mcp_approval_response", "mcp_call".
Type string `json:"type"`
// This field is from variant [ResponseFileSearchToolCall].
Queries []string `json:"queries"`
// This field is from variant [ResponseFileSearchToolCall].
Results []ResponseFileSearchToolCallResult `json:"results"`
// This field is a union of [ResponseComputerToolCallActionUnion],
- // [ResponseFunctionWebSearchActionUnion], [ResponseItemLocalShellCallAction]
+ // [ResponseFunctionWebSearchActionUnion], [ResponseItemLocalShellCallAction],
+ // [ResponseFunctionShellToolCallAction]
Action ResponseItemUnionAction `json:"action"`
CallID string `json:"call_id"`
// This field is from variant [ResponseComputerToolCall].
PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck `json:"pending_safety_checks"`
// This field is a union of [ResponseComputerToolCallOutputScreenshot],
- // [ResponseFunctionToolCallOutputItemOutputUnion], [string], [string]
+ // [ResponseFunctionToolCallOutputItemOutputUnion], [string],
+ // [[]ResponseFunctionShellToolCallOutputOutput], [string], [string]
Output ResponseItemUnionOutput `json:"output"`
// This field is from variant [ResponseComputerToolCallOutputItem].
AcknowledgedSafetyChecks []ResponseComputerToolCallOutputItemAcknowledgedSafetyCheck `json:"acknowledged_safety_checks"`
@@ -8743,8 +10332,13 @@ type ResponseItemUnion struct {
// This field is from variant [ResponseCodeInterpreterToolCall].
ContainerID string `json:"container_id"`
// This field is from variant [ResponseCodeInterpreterToolCall].
- Outputs []ResponseCodeInterpreterToolCallOutputUnion `json:"outputs"`
- ServerLabel string `json:"server_label"`
+ Outputs []ResponseCodeInterpreterToolCallOutputUnion `json:"outputs"`
+ CreatedBy string `json:"created_by"`
+ // This field is from variant [ResponseFunctionShellToolCallOutput].
+ MaxOutputLength int64 `json:"max_output_length"`
+ // This field is from variant [ResponseApplyPatchToolCall].
+ Operation ResponseApplyPatchToolCallOperationUnion `json:"operation"`
+ ServerLabel string `json:"server_label"`
// This field is from variant [ResponseItemMcpListTools].
Tools []ResponseItemMcpListToolsTool `json:"tools"`
Error string `json:"error"`
@@ -8772,6 +10366,9 @@ type ResponseItemUnion struct {
Code respjson.Field
ContainerID respjson.Field
Outputs respjson.Field
+ CreatedBy respjson.Field
+ MaxOutputLength respjson.Field
+ Operation respjson.Field
ServerLabel respjson.Field
Tools respjson.Field
Error respjson.Field
@@ -8788,22 +10385,26 @@ type anyResponseItem interface {
implResponseItemUnion()
}
-func (ResponseInputMessageItem) implResponseItemUnion() {}
-func (ResponseOutputMessage) implResponseItemUnion() {}
-func (ResponseFileSearchToolCall) implResponseItemUnion() {}
-func (ResponseComputerToolCall) implResponseItemUnion() {}
-func (ResponseComputerToolCallOutputItem) implResponseItemUnion() {}
-func (ResponseFunctionWebSearch) implResponseItemUnion() {}
-func (ResponseFunctionToolCallItem) implResponseItemUnion() {}
-func (ResponseFunctionToolCallOutputItem) implResponseItemUnion() {}
-func (ResponseItemImageGenerationCall) implResponseItemUnion() {}
-func (ResponseCodeInterpreterToolCall) implResponseItemUnion() {}
-func (ResponseItemLocalShellCall) implResponseItemUnion() {}
-func (ResponseItemLocalShellCallOutput) implResponseItemUnion() {}
-func (ResponseItemMcpListTools) implResponseItemUnion() {}
-func (ResponseItemMcpApprovalRequest) implResponseItemUnion() {}
-func (ResponseItemMcpApprovalResponse) implResponseItemUnion() {}
-func (ResponseItemMcpCall) implResponseItemUnion() {}
+func (ResponseInputMessageItem) implResponseItemUnion() {}
+func (ResponseOutputMessage) implResponseItemUnion() {}
+func (ResponseFileSearchToolCall) implResponseItemUnion() {}
+func (ResponseComputerToolCall) implResponseItemUnion() {}
+func (ResponseComputerToolCallOutputItem) implResponseItemUnion() {}
+func (ResponseFunctionWebSearch) implResponseItemUnion() {}
+func (ResponseFunctionToolCallItem) implResponseItemUnion() {}
+func (ResponseFunctionToolCallOutputItem) implResponseItemUnion() {}
+func (ResponseItemImageGenerationCall) implResponseItemUnion() {}
+func (ResponseCodeInterpreterToolCall) implResponseItemUnion() {}
+func (ResponseItemLocalShellCall) implResponseItemUnion() {}
+func (ResponseItemLocalShellCallOutput) implResponseItemUnion() {}
+func (ResponseFunctionShellToolCall) implResponseItemUnion() {}
+func (ResponseFunctionShellToolCallOutput) implResponseItemUnion() {}
+func (ResponseApplyPatchToolCall) implResponseItemUnion() {}
+func (ResponseApplyPatchToolCallOutput) implResponseItemUnion() {}
+func (ResponseItemMcpListTools) implResponseItemUnion() {}
+func (ResponseItemMcpApprovalRequest) implResponseItemUnion() {}
+func (ResponseItemMcpApprovalResponse) implResponseItemUnion() {}
+func (ResponseItemMcpCall) implResponseItemUnion() {}
// Use the following switch statement to find the correct variant
//
@@ -8820,6 +10421,10 @@ func (ResponseItemMcpCall) implResponseItemUnion() {}
// case responses.ResponseCodeInterpreterToolCall:
// case responses.ResponseItemLocalShellCall:
// case responses.ResponseItemLocalShellCallOutput:
+// case responses.ResponseFunctionShellToolCall:
+// case responses.ResponseFunctionShellToolCallOutput:
+// case responses.ResponseApplyPatchToolCall:
+// case responses.ResponseApplyPatchToolCallOutput:
// case responses.ResponseItemMcpListTools:
// case responses.ResponseItemMcpApprovalRequest:
// case responses.ResponseItemMcpApprovalResponse:
@@ -8851,6 +10456,14 @@ func (u ResponseItemUnion) AsAny() anyResponseItem {
return u.AsLocalShellCall()
case "local_shell_call_output":
return u.AsLocalShellCallOutput()
+ case "shell_call":
+ return u.AsShellCall()
+ case "shell_call_output":
+ return u.AsShellCallOutput()
+ case "apply_patch_call":
+ return u.AsApplyPatchCall()
+ case "apply_patch_call_output":
+ return u.AsApplyPatchCallOutput()
case "mcp_list_tools":
return u.AsMcpListTools()
case "mcp_approval_request":
@@ -8923,6 +10536,26 @@ func (u ResponseItemUnion) AsLocalShellCallOutput() (v ResponseItemLocalShellCal
return
}
+func (u ResponseItemUnion) AsShellCall() (v ResponseFunctionShellToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseItemUnion) AsShellCallOutput() (v ResponseFunctionShellToolCallOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseItemUnion) AsApplyPatchCall() (v ResponseApplyPatchToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseItemUnion) AsApplyPatchCallOutput() (v ResponseApplyPatchToolCallOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
func (u ResponseItemUnion) AsMcpListTools() (v ResponseItemMcpListTools) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
@@ -9009,14 +10642,17 @@ type ResponseItemUnionAction struct {
// This field is from variant [ResponseItemLocalShellCallAction].
Command []string `json:"command"`
// This field is from variant [ResponseItemLocalShellCallAction].
- Env map[string]string `json:"env"`
- // This field is from variant [ResponseItemLocalShellCallAction].
- TimeoutMs int64 `json:"timeout_ms"`
+ Env map[string]string `json:"env"`
+ TimeoutMs int64 `json:"timeout_ms"`
// This field is from variant [ResponseItemLocalShellCallAction].
User string `json:"user"`
// This field is from variant [ResponseItemLocalShellCallAction].
WorkingDirectory string `json:"working_directory"`
- JSON struct {
+ // This field is from variant [ResponseFunctionShellToolCallAction].
+ Commands []string `json:"commands"`
+ // This field is from variant [ResponseFunctionShellToolCallAction].
+ MaxOutputLength int64 `json:"max_output_length"`
+ JSON struct {
Button respjson.Field
Type respjson.Field
X respjson.Field
@@ -9035,6 +10671,8 @@ type ResponseItemUnionAction struct {
TimeoutMs respjson.Field
User respjson.Field
WorkingDirectory respjson.Field
+ Commands respjson.Field
+ MaxOutputLength respjson.Field
raw string
} `json:"-"`
}
@@ -9051,7 +10689,8 @@ func (r *ResponseItemUnionAction) UnmarshalJSON(data []byte) error {
// [ResponseItemUnion].
//
// If the underlying value is not a json object, one of the following properties
-// will be valid: OfString OfOutputContentList]
+// will be valid: OfString OfOutputContentList
+// OfResponseFunctionShellToolCallOutputOutputArray]
type ResponseItemUnionOutput struct {
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
@@ -9059,6 +10698,9 @@ type ResponseItemUnionOutput struct {
// [[]ResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion] instead
// of an object.
OfOutputContentList []ResponseFunctionToolCallOutputItemOutputOutputContentListItemUnion `json:",inline"`
+ // This field will be present if the value is a
+ // [[]ResponseFunctionShellToolCallOutputOutput] instead of an object.
+ OfResponseFunctionShellToolCallOutputOutputArray []ResponseFunctionShellToolCallOutputOutput `json:",inline"`
// This field is from variant [ResponseComputerToolCallOutputScreenshot].
Type constant.ComputerScreenshot `json:"type"`
// This field is from variant [ResponseComputerToolCallOutputScreenshot].
@@ -9066,12 +10708,13 @@ type ResponseItemUnionOutput struct {
// This field is from variant [ResponseComputerToolCallOutputScreenshot].
ImageURL string `json:"image_url"`
JSON struct {
- OfString respjson.Field
- OfOutputContentList respjson.Field
- Type respjson.Field
- FileID respjson.Field
- ImageURL respjson.Field
- raw string
+ OfString respjson.Field
+ OfOutputContentList respjson.Field
+ OfResponseFunctionShellToolCallOutputOutputArray respjson.Field
+ Type respjson.Field
+ FileID respjson.Field
+ ImageURL respjson.Field
+ raw string
} `json:"-"`
}
@@ -9596,7 +11239,9 @@ func (r *ResponseMcpListToolsInProgressEvent) UnmarshalJSON(data []byte) error {
// [ResponseFunctionToolCall], [ResponseFunctionWebSearch],
// [ResponseComputerToolCall], [ResponseReasoningItem],
// [ResponseOutputItemImageGenerationCall], [ResponseCodeInterpreterToolCall],
-// [ResponseOutputItemLocalShellCall], [ResponseOutputItemMcpCall],
+// [ResponseOutputItemLocalShellCall], [ResponseFunctionShellToolCall],
+// [ResponseFunctionShellToolCallOutput], [ResponseApplyPatchToolCall],
+// [ResponseApplyPatchToolCallOutput], [ResponseOutputItemMcpCall],
// [ResponseOutputItemMcpListTools], [ResponseOutputItemMcpApprovalRequest],
// [ResponseCustomToolCall].
//
@@ -9607,13 +11252,14 @@ type ResponseOutputItemUnion struct {
ID string `json:"id"`
// This field is a union of [[]ResponseOutputMessageContentUnion],
// [[]ResponseReasoningItemContent]
- Content []ResponseOutputMessageContentUnion `json:"content"`
+ Content ResponseOutputItemUnionContent `json:"content"`
// This field is from variant [ResponseOutputMessage].
Role constant.Assistant `json:"role"`
Status string `json:"status"`
// Any of "message", "file_search_call", "function_call", "web_search_call",
// "computer_call", "reasoning", "image_generation_call", "code_interpreter_call",
- // "local_shell_call", "mcp_call", "mcp_list_tools", "mcp_approval_request",
+ // "local_shell_call", "shell_call", "shell_call_output", "apply_patch_call",
+ // "apply_patch_call_output", "mcp_call", "mcp_list_tools", "mcp_approval_request",
// "custom_tool_call".
Type string `json:"type"`
// This field is from variant [ResponseFileSearchToolCall].
@@ -9624,7 +11270,8 @@ type ResponseOutputItemUnion struct {
CallID string `json:"call_id"`
Name string `json:"name"`
// This field is a union of [ResponseFunctionWebSearchActionUnion],
- // [ResponseComputerToolCallActionUnion], [ResponseOutputItemLocalShellCallAction]
+ // [ResponseComputerToolCallActionUnion], [ResponseOutputItemLocalShellCallAction],
+ // [ResponseFunctionShellToolCallAction]
Action ResponseOutputItemUnionAction `json:"action"`
// This field is from variant [ResponseComputerToolCall].
PendingSafetyChecks []ResponseComputerToolCallPendingSafetyCheck `json:"pending_safety_checks"`
@@ -9639,13 +11286,19 @@ type ResponseOutputItemUnion struct {
// This field is from variant [ResponseCodeInterpreterToolCall].
ContainerID string `json:"container_id"`
// This field is from variant [ResponseCodeInterpreterToolCall].
- Outputs []ResponseCodeInterpreterToolCallOutputUnion `json:"outputs"`
- ServerLabel string `json:"server_label"`
+ Outputs []ResponseCodeInterpreterToolCallOutputUnion `json:"outputs"`
+ CreatedBy string `json:"created_by"`
+ // This field is from variant [ResponseFunctionShellToolCallOutput].
+ MaxOutputLength int64 `json:"max_output_length"`
+ // This field is a union of [[]ResponseFunctionShellToolCallOutputOutput],
+ // [string], [string]
+ Output ResponseOutputItemUnionOutput `json:"output"`
+ // This field is from variant [ResponseApplyPatchToolCall].
+ Operation ResponseApplyPatchToolCallOperationUnion `json:"operation"`
+ ServerLabel string `json:"server_label"`
// This field is from variant [ResponseOutputItemMcpCall].
ApprovalRequestID string `json:"approval_request_id"`
Error string `json:"error"`
- // This field is from variant [ResponseOutputItemMcpCall].
- Output string `json:"output"`
// This field is from variant [ResponseOutputItemMcpListTools].
Tools []ResponseOutputItemMcpListToolsTool `json:"tools"`
// This field is from variant [ResponseCustomToolCall].
@@ -9669,10 +11322,13 @@ type ResponseOutputItemUnion struct {
Code respjson.Field
ContainerID respjson.Field
Outputs respjson.Field
+ CreatedBy respjson.Field
+ MaxOutputLength respjson.Field
+ Output respjson.Field
+ Operation respjson.Field
ServerLabel respjson.Field
ApprovalRequestID respjson.Field
Error respjson.Field
- Output respjson.Field
Tools respjson.Field
Input respjson.Field
raw string
@@ -9695,6 +11351,10 @@ func (ResponseReasoningItem) implResponseOutputItemUnion() {}
func (ResponseOutputItemImageGenerationCall) implResponseOutputItemUnion() {}
func (ResponseCodeInterpreterToolCall) implResponseOutputItemUnion() {}
func (ResponseOutputItemLocalShellCall) implResponseOutputItemUnion() {}
+func (ResponseFunctionShellToolCall) implResponseOutputItemUnion() {}
+func (ResponseFunctionShellToolCallOutput) implResponseOutputItemUnion() {}
+func (ResponseApplyPatchToolCall) implResponseOutputItemUnion() {}
+func (ResponseApplyPatchToolCallOutput) implResponseOutputItemUnion() {}
func (ResponseOutputItemMcpCall) implResponseOutputItemUnion() {}
func (ResponseOutputItemMcpListTools) implResponseOutputItemUnion() {}
func (ResponseOutputItemMcpApprovalRequest) implResponseOutputItemUnion() {}
@@ -9712,6 +11372,10 @@ func (ResponseCustomToolCall) implResponseOutputItemUnion() {}
// case responses.ResponseOutputItemImageGenerationCall:
// case responses.ResponseCodeInterpreterToolCall:
// case responses.ResponseOutputItemLocalShellCall:
+// case responses.ResponseFunctionShellToolCall:
+// case responses.ResponseFunctionShellToolCallOutput:
+// case responses.ResponseApplyPatchToolCall:
+// case responses.ResponseApplyPatchToolCallOutput:
// case responses.ResponseOutputItemMcpCall:
// case responses.ResponseOutputItemMcpListTools:
// case responses.ResponseOutputItemMcpApprovalRequest:
@@ -9739,6 +11403,14 @@ func (u ResponseOutputItemUnion) AsAny() anyResponseOutputItem {
return u.AsCodeInterpreterCall()
case "local_shell_call":
return u.AsLocalShellCall()
+ case "shell_call":
+ return u.AsShellCall()
+ case "shell_call_output":
+ return u.AsShellCallOutput()
+ case "apply_patch_call":
+ return u.AsApplyPatchCall()
+ case "apply_patch_call_output":
+ return u.AsApplyPatchCallOutput()
case "mcp_call":
return u.AsMcpCall()
case "mcp_list_tools":
@@ -9796,6 +11468,26 @@ func (u ResponseOutputItemUnion) AsLocalShellCall() (v ResponseOutputItemLocalSh
return
}
+func (u ResponseOutputItemUnion) AsShellCall() (v ResponseFunctionShellToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseOutputItemUnion) AsShellCallOutput() (v ResponseFunctionShellToolCallOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseOutputItemUnion) AsApplyPatchCall() (v ResponseApplyPatchToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseOutputItemUnion) AsApplyPatchCallOutput() (v ResponseApplyPatchToolCallOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
func (u ResponseOutputItemUnion) AsMcpCall() (v ResponseOutputItemMcpCall) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
@@ -9883,14 +11575,17 @@ type ResponseOutputItemUnionAction struct {
// This field is from variant [ResponseOutputItemLocalShellCallAction].
Command []string `json:"command"`
// This field is from variant [ResponseOutputItemLocalShellCallAction].
- Env map[string]string `json:"env"`
- // This field is from variant [ResponseOutputItemLocalShellCallAction].
- TimeoutMs int64 `json:"timeout_ms"`
+ Env map[string]string `json:"env"`
+ TimeoutMs int64 `json:"timeout_ms"`
// This field is from variant [ResponseOutputItemLocalShellCallAction].
User string `json:"user"`
// This field is from variant [ResponseOutputItemLocalShellCallAction].
WorkingDirectory string `json:"working_directory"`
- JSON struct {
+ // This field is from variant [ResponseFunctionShellToolCallAction].
+ Commands []string `json:"commands"`
+ // This field is from variant [ResponseFunctionShellToolCallAction].
+ MaxOutputLength int64 `json:"max_output_length"`
+ JSON struct {
Query respjson.Field
Type respjson.Field
Sources respjson.Field
@@ -9909,6 +11604,8 @@ type ResponseOutputItemUnionAction struct {
TimeoutMs respjson.Field
User respjson.Field
WorkingDirectory respjson.Field
+ Commands respjson.Field
+ MaxOutputLength respjson.Field
raw string
} `json:"-"`
}
@@ -9917,6 +11614,32 @@ func (r *ResponseOutputItemUnionAction) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+// ResponseOutputItemUnionOutput is an implicit subunion of
+// [ResponseOutputItemUnion]. ResponseOutputItemUnionOutput provides convenient
+// access to the sub-properties of the union.
+//
+// For type safety it is recommended to directly use a variant of the
+// [ResponseOutputItemUnion].
+//
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfResponseFunctionShellToolCallOutputOutputArray OfString]
+type ResponseOutputItemUnionOutput struct {
+ // This field will be present if the value is a
+ // [[]ResponseFunctionShellToolCallOutputOutput] instead of an object.
+ OfResponseFunctionShellToolCallOutputOutputArray []ResponseFunctionShellToolCallOutputOutput `json:",inline"`
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ JSON struct {
+ OfResponseFunctionShellToolCallOutputOutputArray respjson.Field
+ OfString respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (r *ResponseOutputItemUnionOutput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// An image generation request made by the model.
type ResponseOutputItemImageGenerationCall struct {
// The unique ID of the image generation call.
@@ -10423,6 +12146,14 @@ func (u ResponseOutputMessageContentUnionParam) GetType() *string {
return nil
}
+func init() {
+ apijson.RegisterUnion[ResponseOutputMessageContentUnionParam](
+ "type",
+ apijson.Discriminator[ResponseOutputTextParam]("output_text"),
+ apijson.Discriminator[ResponseOutputRefusalParam]("refusal"),
+ )
+}
+
// A refusal from the model.
type ResponseOutputRefusal struct {
// The refusal explanation from the model.
@@ -10917,6 +12648,16 @@ func (u ResponseOutputTextAnnotationUnionParam) GetStartIndex() *int64 {
return nil
}
+func init() {
+ apijson.RegisterUnion[ResponseOutputTextAnnotationUnionParam](
+ "type",
+ apijson.Discriminator[ResponseOutputTextAnnotationFileCitationParam]("file_citation"),
+ apijson.Discriminator[ResponseOutputTextAnnotationURLCitationParam]("url_citation"),
+ apijson.Discriminator[ResponseOutputTextAnnotationContainerFileCitationParam]("container_file_citation"),
+ apijson.Discriminator[ResponseOutputTextAnnotationFilePathParam]("file_path"),
+ )
+}
+
// A citation to a file.
//
// The properties FileID, Filename, Index, Type are required.
@@ -12957,8 +14698,8 @@ func (r *ResponseWebSearchCallSearchingEvent) UnmarshalJSON(data []byte) error {
// ToolUnion contains all possible properties and values from [FunctionTool],
// [FileSearchTool], [ComputerTool], [WebSearchTool], [ToolMcp],
-// [ToolCodeInterpreter], [ToolImageGeneration], [ToolLocalShell], [CustomTool],
-// [WebSearchPreviewTool].
+// [ToolCodeInterpreter], [ToolImageGeneration], [ToolLocalShell],
+// [FunctionShellTool], [CustomTool], [WebSearchPreviewTool], [ApplyPatchTool].
//
// Use the [ToolUnion.AsAny] method to switch on the variant.
//
@@ -12970,7 +14711,8 @@ type ToolUnion struct {
// This field is from variant [FunctionTool].
Strict bool `json:"strict"`
// Any of "function", "file_search", "computer_use_preview", nil, "mcp",
- // "code_interpreter", "image_generation", "local_shell", "custom", nil.
+ // "code_interpreter", "image_generation", "local_shell", "shell", "custom", nil,
+ // "apply_patch".
Type string `json:"type"`
Description string `json:"description"`
// This field is from variant [FileSearchTool].
@@ -13110,6 +14852,11 @@ func (u ToolUnion) AsLocalShell() (v ToolLocalShell) {
return
}
+func (u ToolUnion) AsShell() (v FunctionShellTool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
func (u ToolUnion) AsCustom() (v CustomTool) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
@@ -13120,6 +14867,11 @@ func (u ToolUnion) AsWebSearchPreview() (v WebSearchPreviewTool) {
return
}
+func (u ToolUnion) AsApplyPatch() (v ApplyPatchTool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
// Returns the unmodified JSON received from the API
func (u ToolUnion) RawJSON() string { return u.JSON.raw }
@@ -13492,7 +15244,7 @@ func (u ToolCodeInterpreterContainerUnion) AsString() (v string) {
return
}
-func (u ToolCodeInterpreterContainerUnion) AsCodeInterpreterContainerAuto() (v ToolCodeInterpreterContainerCodeInterpreterContainerAuto) {
+func (u ToolCodeInterpreterContainerUnion) AsCodeInterpreterToolAuto() (v ToolCodeInterpreterContainerCodeInterpreterContainerAuto) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
@@ -13682,7 +15434,7 @@ func ToolParamOfCodeInterpreter[
case string:
codeInterpreter.Container.OfString = param.NewOpt(v)
case ToolCodeInterpreterContainerCodeInterpreterContainerAutoParam:
- codeInterpreter.Container.OfCodeInterpreterContainerAuto = &v
+ codeInterpreter.Container.OfCodeInterpreterToolAuto = &v
}
return ToolUnionParam{OfCodeInterpreter: &codeInterpreter}
}
@@ -13711,8 +15463,10 @@ type ToolUnionParam struct {
OfCodeInterpreter *ToolCodeInterpreterParam `json:",omitzero,inline"`
OfImageGeneration *ToolImageGenerationParam `json:",omitzero,inline"`
OfLocalShell *ToolLocalShellParam `json:",omitzero,inline"`
+ OfShell *FunctionShellToolParam `json:",omitzero,inline"`
OfCustom *CustomToolParam `json:",omitzero,inline"`
OfWebSearchPreview *WebSearchPreviewToolParam `json:",omitzero,inline"`
+ OfApplyPatch *ApplyPatchToolParam `json:",omitzero,inline"`
paramUnion
}
@@ -13725,8 +15479,10 @@ func (u ToolUnionParam) MarshalJSON() ([]byte, error) {
u.OfCodeInterpreter,
u.OfImageGeneration,
u.OfLocalShell,
+ u.OfShell,
u.OfCustom,
- u.OfWebSearchPreview)
+ u.OfWebSearchPreview,
+ u.OfApplyPatch)
}
func (u *ToolUnionParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
@@ -13749,10 +15505,14 @@ func (u *ToolUnionParam) asAny() any {
return u.OfImageGeneration
} else if !param.IsOmitted(u.OfLocalShell) {
return u.OfLocalShell
+ } else if !param.IsOmitted(u.OfShell) {
+ return u.OfShell
} else if !param.IsOmitted(u.OfCustom) {
return u.OfCustom
} else if !param.IsOmitted(u.OfWebSearchPreview) {
return u.OfWebSearchPreview
+ } else if !param.IsOmitted(u.OfApplyPatch) {
+ return u.OfApplyPatch
}
return nil
}
@@ -14009,10 +15769,14 @@ func (u ToolUnionParam) GetType() *string {
return (*string)(&vt.Type)
} else if vt := u.OfLocalShell; vt != nil {
return (*string)(&vt.Type)
+ } else if vt := u.OfShell; vt != nil {
+ return (*string)(&vt.Type)
} else if vt := u.OfCustom; vt != nil {
return (*string)(&vt.Type)
} else if vt := u.OfWebSearchPreview; vt != nil {
return (*string)(&vt.Type)
+ } else if vt := u.OfApplyPatch; vt != nil {
+ return (*string)(&vt.Type)
}
return nil
}
@@ -14190,6 +15954,26 @@ func (u toolUnionParamUserLocation) GetType() *string {
return nil
}
+func init() {
+ apijson.RegisterUnion[ToolUnionParam](
+ "type",
+ apijson.Discriminator[FunctionToolParam]("function"),
+ apijson.Discriminator[FileSearchToolParam]("file_search"),
+ apijson.Discriminator[ComputerToolParam]("computer_use_preview"),
+ apijson.Discriminator[WebSearchToolParam]("web_search"),
+ apijson.Discriminator[WebSearchToolParam]("web_search_2025_08_26"),
+ apijson.Discriminator[ToolMcpParam]("mcp"),
+ apijson.Discriminator[ToolCodeInterpreterParam]("code_interpreter"),
+ apijson.Discriminator[ToolImageGenerationParam]("image_generation"),
+ apijson.Discriminator[ToolLocalShellParam]("local_shell"),
+ apijson.Discriminator[FunctionShellToolParam]("shell"),
+ apijson.Discriminator[CustomToolParam]("custom"),
+ apijson.Discriminator[WebSearchPreviewToolParam]("web_search_preview"),
+ apijson.Discriminator[WebSearchPreviewToolParam]("web_search_preview_2025_03_11"),
+ apijson.Discriminator[ApplyPatchToolParam]("apply_patch"),
+ )
+}
+
// Give the model access to additional tools via remote Model Context Protocol
// (MCP) servers.
// [Learn more about MCP](https://platform.openai.com/docs/guides/tools-remote-mcp).
@@ -14249,6 +16033,12 @@ func (r *ToolMcpParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+func init() {
+ apijson.RegisterFieldValidator[ToolMcpParam](
+ "connector_id", "connector_dropbox", "connector_gmail", "connector_googlecalendar", "connector_googledrive", "connector_microsoftteams", "connector_outlookcalendar", "connector_outlookemail", "connector_sharepoint",
+ )
+}
+
// Only one field can be non-zero.
//
// Use [param.IsOmitted] to confirm if a field is set.
@@ -14405,13 +16195,13 @@ func (r *ToolCodeInterpreterParam) UnmarshalJSON(data []byte) error {
//
// Use [param.IsOmitted] to confirm if a field is set.
type ToolCodeInterpreterContainerUnionParam struct {
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfCodeInterpreterContainerAuto *ToolCodeInterpreterContainerCodeInterpreterContainerAutoParam `json:",omitzero,inline"`
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfCodeInterpreterToolAuto *ToolCodeInterpreterContainerCodeInterpreterContainerAutoParam `json:",omitzero,inline"`
paramUnion
}
func (u ToolCodeInterpreterContainerUnionParam) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfString, u.OfCodeInterpreterContainerAuto)
+ return param.MarshalUnion(u, u.OfString, u.OfCodeInterpreterToolAuto)
}
func (u *ToolCodeInterpreterContainerUnionParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
@@ -14420,8 +16210,8 @@ func (u *ToolCodeInterpreterContainerUnionParam) UnmarshalJSON(data []byte) erro
func (u *ToolCodeInterpreterContainerUnionParam) asAny() any {
if !param.IsOmitted(u.OfString) {
return &u.OfString.Value
- } else if !param.IsOmitted(u.OfCodeInterpreterContainerAuto) {
- return u.OfCodeInterpreterContainerAuto
+ } else if !param.IsOmitted(u.OfCodeInterpreterToolAuto) {
+ return u.OfCodeInterpreterToolAuto
}
return nil
}
@@ -14690,6 +16480,57 @@ func (r *ToolChoiceAllowedParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+// Forces the model to call the apply_patch tool when executing a tool call.
+type ToolChoiceApplyPatch struct {
+ // The tool to call. Always `apply_patch`.
+ Type constant.ApplyPatch `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ToolChoiceApplyPatch) RawJSON() string { return r.JSON.raw }
+func (r *ToolChoiceApplyPatch) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this ToolChoiceApplyPatch to a ToolChoiceApplyPatchParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// ToolChoiceApplyPatchParam.Overrides()
+func (r ToolChoiceApplyPatch) ToParam() ToolChoiceApplyPatchParam {
+ return param.Override[ToolChoiceApplyPatchParam](json.RawMessage(r.RawJSON()))
+}
+
+func NewToolChoiceApplyPatchParam() ToolChoiceApplyPatchParam {
+ return ToolChoiceApplyPatchParam{
+ Type: "apply_patch",
+ }
+}
+
+// Forces the model to call the apply_patch tool when executing a tool call.
+//
+// This struct has a constant value, construct it with
+// [NewToolChoiceApplyPatchParam].
+type ToolChoiceApplyPatchParam struct {
+ // The tool to call. Always `apply_patch`.
+ Type constant.ApplyPatch `json:"type,required"`
+ paramObj
+}
+
+func (r ToolChoiceApplyPatchParam) MarshalJSON() (data []byte, err error) {
+ type shadow ToolChoiceApplyPatchParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ToolChoiceApplyPatchParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// Use this option to force the model to call a specific custom tool.
type ToolChoiceCustom struct {
// The name of the custom tool to call.
@@ -14866,6 +16707,56 @@ const (
ToolChoiceOptionsRequired ToolChoiceOptions = "required"
)
+// Forces the model to call the function shell tool when a tool call is required.
+type ToolChoiceShell struct {
+ // The tool to call. Always `shell`.
+ Type constant.Shell `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ToolChoiceShell) RawJSON() string { return r.JSON.raw }
+func (r *ToolChoiceShell) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this ToolChoiceShell to a ToolChoiceShellParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// ToolChoiceShellParam.Overrides()
+func (r ToolChoiceShell) ToParam() ToolChoiceShellParam {
+ return param.Override[ToolChoiceShellParam](json.RawMessage(r.RawJSON()))
+}
+
+func NewToolChoiceShellParam() ToolChoiceShellParam {
+ return ToolChoiceShellParam{
+ Type: "shell",
+ }
+}
+
+// Forces the model to call the function shell tool when a tool call is required.
+//
+// This struct has a constant value, construct it with [NewToolChoiceShellParam].
+type ToolChoiceShellParam struct {
+ // The tool to call. Always `shell`.
+ Type constant.Shell `json:"type,required"`
+ paramObj
+}
+
+func (r ToolChoiceShellParam) MarshalJSON() (data []byte, err error) {
+ type shadow ToolChoiceShellParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ToolChoiceShellParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// Indicates that the model should use a built-in tool to generate a response.
// [Learn more about built-in tools](https://platform.openai.com/docs/guides/tools).
type ToolChoiceTypes struct {
@@ -15296,6 +17187,12 @@ func (r *WebSearchToolUserLocationParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+func init() {
+ apijson.RegisterFieldValidator[WebSearchToolUserLocationParam](
+ "type", "approximate",
+ )
+}
+
type ResponseNewParams struct {
// Whether to run the model response in the background.
// [Learn more](https://platform.openai.com/docs/guides/background).
@@ -15388,6 +17285,13 @@ type ResponseNewParams struct {
// Reference to a prompt template and its variables.
// [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
Prompt ResponsePromptParam `json:"prompt,omitzero"`
+ // The retention policy for the prompt cache. Set to `24h` to enable extended
+ // prompt caching, which keeps cached prefixes active for longer, up to a maximum
+ // of 24 hours.
+ // [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
+ //
+ // Any of "in-memory", "24h".
+ PromptCacheRetention ResponseNewParamsPromptCacheRetention `json:"prompt_cache_retention,omitzero"`
// Specifies the processing type used for serving the request.
//
// - If set to 'auto', then the request will be processed with the service tier
@@ -15531,6 +17435,17 @@ func (u *ResponseNewParamsInputUnion) asAny() any {
return nil
}
+// The retention policy for the prompt cache. Set to `24h` to enable extended
+// prompt caching, which keeps cached prefixes active for longer, up to a maximum
+// of 24 hours.
+// [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).
+type ResponseNewParamsPromptCacheRetention string
+
+const (
+ ResponseNewParamsPromptCacheRetentionInMemory ResponseNewParamsPromptCacheRetention = "in-memory"
+ ResponseNewParamsPromptCacheRetention24h ResponseNewParamsPromptCacheRetention = "24h"
+)
+
// Specifies the processing type used for serving the request.
//
// - If set to 'auto', then the request will be processed with the service tier
@@ -15582,12 +17497,14 @@ func (r *ResponseNewParamsStreamOptions) UnmarshalJSON(data []byte) error {
// Use [param.IsOmitted] to confirm if a field is set.
type ResponseNewParamsToolChoiceUnion struct {
// Check if union is this variant with !param.IsOmitted(union.OfToolChoiceMode)
- OfToolChoiceMode param.Opt[ToolChoiceOptions] `json:",omitzero,inline"`
- OfAllowedTools *ToolChoiceAllowedParam `json:",omitzero,inline"`
- OfHostedTool *ToolChoiceTypesParam `json:",omitzero,inline"`
- OfFunctionTool *ToolChoiceFunctionParam `json:",omitzero,inline"`
- OfMcpTool *ToolChoiceMcpParam `json:",omitzero,inline"`
- OfCustomTool *ToolChoiceCustomParam `json:",omitzero,inline"`
+ OfToolChoiceMode param.Opt[ToolChoiceOptions] `json:",omitzero,inline"`
+ OfAllowedTools *ToolChoiceAllowedParam `json:",omitzero,inline"`
+ OfHostedTool *ToolChoiceTypesParam `json:",omitzero,inline"`
+ OfFunctionTool *ToolChoiceFunctionParam `json:",omitzero,inline"`
+ OfMcpTool *ToolChoiceMcpParam `json:",omitzero,inline"`
+ OfCustomTool *ToolChoiceCustomParam `json:",omitzero,inline"`
+ OfSpecificApplyPatchToolChoice *ToolChoiceApplyPatchParam `json:",omitzero,inline"`
+ OfSpecificShellToolChoice *ToolChoiceShellParam `json:",omitzero,inline"`
paramUnion
}
@@ -15597,7 +17514,9 @@ func (u ResponseNewParamsToolChoiceUnion) MarshalJSON() ([]byte, error) {
u.OfHostedTool,
u.OfFunctionTool,
u.OfMcpTool,
- u.OfCustomTool)
+ u.OfCustomTool,
+ u.OfSpecificApplyPatchToolChoice,
+ u.OfSpecificShellToolChoice)
}
func (u *ResponseNewParamsToolChoiceUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
@@ -15616,6 +17535,10 @@ func (u *ResponseNewParamsToolChoiceUnion) asAny() any {
return u.OfMcpTool
} else if !param.IsOmitted(u.OfCustomTool) {
return u.OfCustomTool
+ } else if !param.IsOmitted(u.OfSpecificApplyPatchToolChoice) {
+ return u.OfSpecificApplyPatchToolChoice
+ } else if !param.IsOmitted(u.OfSpecificShellToolChoice) {
+ return u.OfSpecificShellToolChoice
}
return nil
}
@@ -15656,6 +17579,10 @@ func (u ResponseNewParamsToolChoiceUnion) GetType() *string {
return (*string)(&vt.Type)
} else if vt := u.OfCustomTool; vt != nil {
return (*string)(&vt.Type)
+ } else if vt := u.OfSpecificApplyPatchToolChoice; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfSpecificShellToolChoice; vt != nil {
+ return (*string)(&vt.Type)
}
return nil
}
diff --git a/responses/response_test.go b/responses/response_test.go
index f955862e..c5e4bbbb 100644
--- a/responses/response_test.go
+++ b/responses/response_test.go
@@ -54,9 +54,10 @@ func TestResponseNewWithOptionalParams(t *testing.T) {
},
Version: openai.String("version"),
},
- PromptCacheKey: openai.String("prompt-cache-key-1234"),
+ PromptCacheKey: openai.String("prompt-cache-key-1234"),
+ PromptCacheRetention: responses.ResponseNewParamsPromptCacheRetentionInMemory,
Reasoning: shared.ReasoningParam{
- Effort: shared.ReasoningEffortMinimal,
+ Effort: shared.ReasoningEffortNone,
GenerateSummary: shared.ReasoningGenerateSummaryAuto,
Summary: shared.ReasoningSummaryAuto,
},
diff --git a/shared/constant/constants.go b/shared/constant/constants.go
index 44deca2e..718c9119 100644
--- a/shared/constant/constants.go
+++ b/shared/constant/constants.go
@@ -20,6 +20,9 @@ func ValueOf[T Constant[T]]() T {
type Active string // Always "active"
type AllowedTools string // Always "allowed_tools"
+type ApplyPatch string // Always "apply_patch"
+type ApplyPatchCall string // Always "apply_patch_call"
+type ApplyPatchCallOutput string // Always "apply_patch_call_output"
type Approximate string // Always "approximate"
type Assistant string // Always "assistant"
type AssistantDeleted string // Always "assistant.deleted"
@@ -70,10 +73,12 @@ type ConversationItemRetrieve string // Always "conversa
type ConversationItemRetrieved string // Always "conversation.item.retrieved"
type ConversationItemTruncate string // Always "conversation.item.truncate"
type ConversationItemTruncated string // Always "conversation.item.truncated"
+type CreateFile string // Always "create_file"
type CreatedAt string // Always "created_at"
type Custom string // Always "custom"
type CustomToolCall string // Always "custom_tool_call"
type CustomToolCallOutput string // Always "custom_tool_call_output"
+type DeleteFile string // Always "delete_file"
type Developer string // Always "developer"
type DoubleClick string // Always "double_click"
type Drag string // Always "drag"
@@ -84,6 +89,7 @@ type EvalRunCanceled string // Always "eval.run
type EvalRunFailed string // Always "eval.run.failed"
type EvalRunSucceeded string // Always "eval.run.succeeded"
type Exec string // Always "exec"
+type Exit string // Always "exit"
type File string // Always "file"
type FileCitation string // Always "file_citation"
type FilePath string // Always "file_path"
@@ -236,6 +242,9 @@ type ServerVad string // Always "server_v
type SessionCreated string // Always "session.created"
type SessionUpdate string // Always "session.update"
type SessionUpdated string // Always "session.updated"
+type Shell string // Always "shell"
+type ShellCall string // Always "shell_call"
+type ShellCallOutput string // Always "shell_call_output"
type Static string // Always "static"
type StringCheck string // Always "string_check"
type SubmitToolOutputs string // Always "submit_tool_outputs"
@@ -273,6 +282,7 @@ type ThreadRunStepDelta string // Always "thread.r
type ThreadRunStepExpired string // Always "thread.run.step.expired"
type ThreadRunStepFailed string // Always "thread.run.step.failed"
type ThreadRunStepInProgress string // Always "thread.run.step.in_progress"
+type Timeout string // Always "timeout"
type Tokens string // Always "tokens"
type Tool string // Always "tool"
type ToolCalls string // Always "tool_calls"
@@ -285,6 +295,7 @@ type Transcription string // Always "transcri
type TranscriptionSessionUpdate string // Always "transcription_session.update"
type TranscriptionSessionUpdated string // Always "transcription_session.updated"
type Type string // Always "type"
+type UpdateFile string // Always "update_file"
type Upload string // Always "upload"
type UploadPart string // Always "upload.part"
type URL string // Always "url"
@@ -305,6 +316,9 @@ type WebSearchCall string // Always "web_sear
func (c Active) Default() Active { return "active" }
func (c AllowedTools) Default() AllowedTools { return "allowed_tools" }
+func (c ApplyPatch) Default() ApplyPatch { return "apply_patch" }
+func (c ApplyPatchCall) Default() ApplyPatchCall { return "apply_patch_call" }
+func (c ApplyPatchCallOutput) Default() ApplyPatchCallOutput { return "apply_patch_call_output" }
func (c Approximate) Default() Approximate { return "approximate" }
func (c Assistant) Default() Assistant { return "assistant" }
func (c AssistantDeleted) Default() AssistantDeleted { return "assistant.deleted" }
@@ -377,10 +391,12 @@ func (c ConversationItemTruncate) Default() ConversationItemTruncate {
func (c ConversationItemTruncated) Default() ConversationItemTruncated {
return "conversation.item.truncated"
}
+func (c CreateFile) Default() CreateFile { return "create_file" }
func (c CreatedAt) Default() CreatedAt { return "created_at" }
func (c Custom) Default() Custom { return "custom" }
func (c CustomToolCall) Default() CustomToolCall { return "custom_tool_call" }
func (c CustomToolCallOutput) Default() CustomToolCallOutput { return "custom_tool_call_output" }
+func (c DeleteFile) Default() DeleteFile { return "delete_file" }
func (c Developer) Default() Developer { return "developer" }
func (c DoubleClick) Default() DoubleClick { return "double_click" }
func (c Drag) Default() Drag { return "drag" }
@@ -391,6 +407,7 @@ func (c EvalRunCanceled) Default() EvalRunCanceled { return "eval.
func (c EvalRunFailed) Default() EvalRunFailed { return "eval.run.failed" }
func (c EvalRunSucceeded) Default() EvalRunSucceeded { return "eval.run.succeeded" }
func (c Exec) Default() Exec { return "exec" }
+func (c Exit) Default() Exit { return "exit" }
func (c File) Default() File { return "file" }
func (c FileCitation) Default() FileCitation { return "file_citation" }
func (c FilePath) Default() FilePath { return "file_path" }
@@ -651,6 +668,9 @@ func (c ServerVad) Default() ServerVad { return "serve
func (c SessionCreated) Default() SessionCreated { return "session.created" }
func (c SessionUpdate) Default() SessionUpdate { return "session.update" }
func (c SessionUpdated) Default() SessionUpdated { return "session.updated" }
+func (c Shell) Default() Shell { return "shell" }
+func (c ShellCall) Default() ShellCall { return "shell_call" }
+func (c ShellCallOutput) Default() ShellCallOutput { return "shell_call_output" }
func (c Static) Default() Static { return "static" }
func (c StringCheck) Default() StringCheck { return "string_check" }
func (c SubmitToolOutputs) Default() SubmitToolOutputs { return "submit_tool_outputs" }
@@ -696,6 +716,7 @@ func (c ThreadRunStepFailed) Default() ThreadRunStepFailed { return "threa
func (c ThreadRunStepInProgress) Default() ThreadRunStepInProgress {
return "thread.run.step.in_progress"
}
+func (c Timeout) Default() Timeout { return "timeout" }
func (c Tokens) Default() Tokens { return "tokens" }
func (c Tool) Default() Tool { return "tool" }
func (c ToolCalls) Default() ToolCalls { return "tool_calls" }
@@ -712,6 +733,7 @@ func (c TranscriptionSessionUpdated) Default() TranscriptionSessionUpdated {
return "transcription_session.updated"
}
func (c Type) Default() Type { return "type" }
+func (c UpdateFile) Default() UpdateFile { return "update_file" }
func (c Upload) Default() Upload { return "upload" }
func (c UploadPart) Default() UploadPart { return "upload.part" }
func (c URL) Default() URL { return "url" }
@@ -736,6 +758,9 @@ func (c WebSearchCall) Default() WebSearchCall { return "web_search_call" }
func (c Active) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c AllowedTools) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ApplyPatch) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ApplyPatchCall) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ApplyPatchCallOutput) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Approximate) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Assistant) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c AssistantDeleted) MarshalJSON() ([]byte, error) { return marshalString(c) }
@@ -794,10 +819,12 @@ func (c ConversationItemRetrieve) MarshalJSON() ([]byte, error) { r
func (c ConversationItemRetrieved) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c ConversationItemTruncate) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c ConversationItemTruncated) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c CreateFile) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c CreatedAt) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Custom) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c CustomToolCall) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c CustomToolCallOutput) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c DeleteFile) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Developer) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c DoubleClick) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Drag) MarshalJSON() ([]byte, error) { return marshalString(c) }
@@ -808,6 +835,7 @@ func (c EvalRunCanceled) MarshalJSON() ([]byte, error) { r
func (c EvalRunFailed) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c EvalRunSucceeded) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Exec) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Exit) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c File) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c FileCitation) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c FilePath) MarshalJSON() ([]byte, error) { return marshalString(c) }
@@ -964,6 +992,9 @@ func (c ServerVad) MarshalJSON() ([]byte, error) { retu
func (c SessionCreated) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c SessionUpdate) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c SessionUpdated) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Shell) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ShellCall) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c ShellCallOutput) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Static) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c StringCheck) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c SubmitToolOutputs) MarshalJSON() ([]byte, error) { return marshalString(c) }
@@ -1001,6 +1032,7 @@ func (c ThreadRunStepDelta) MarshalJSON() ([]byte, error) { retu
func (c ThreadRunStepExpired) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c ThreadRunStepFailed) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c ThreadRunStepInProgress) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Timeout) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Tokens) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Tool) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c ToolCalls) MarshalJSON() ([]byte, error) { return marshalString(c) }
@@ -1013,6 +1045,7 @@ func (c Transcription) MarshalJSON() ([]byte, error) { retu
func (c TranscriptionSessionUpdate) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c TranscriptionSessionUpdated) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Type) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c UpdateFile) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Upload) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c UploadPart) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c URL) MarshalJSON() ([]byte, error) { return marshalString(c) }
diff --git a/shared/shared.go b/shared/shared.go
index f794c2ac..e2fad611 100644
--- a/shared/shared.go
+++ b/shared/shared.go
@@ -21,6 +21,11 @@ type ResponsesModel = string
// aliased to make [param.APIObject] private when embedding
const (
+ ChatModelGPT5_1 ChatModel = "gpt-5.1"
+ ChatModelGPT5_1_2025_11_13 ChatModel = "gpt-5.1-2025-11-13"
+ ChatModelGPT5_1Codex ChatModel = "gpt-5.1-codex"
+ ChatModelGPT5_1Mini ChatModel = "gpt-5.1-mini"
+ ChatModelGPT5_1ChatLatest ChatModel = "gpt-5.1-chat-latest"
ChatModelGPT5 ChatModel = "gpt-5"
ChatModelGPT5Mini ChatModel = "gpt-5-mini"
ChatModelGPT5Nano ChatModel = "gpt-5-nano"
@@ -752,14 +757,18 @@ type Metadata map[string]string
type Reasoning struct {
// 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.
//
- // Any of "minimal", "low", "medium", "high".
+ // Any of "none", "minimal", "low", "medium", "high".
Effort ReasoningEffort `json:"effort,nullable"`
// **Deprecated:** use `summary` instead.
//
@@ -837,14 +846,18 @@ const (
type ReasoningParam struct {
// 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.
//
- // Any of "minimal", "low", "medium", "high".
+ // Any of "none", "minimal", "low", "medium", "high".
Effort ReasoningEffort `json:"effort,omitzero"`
// **Deprecated:** use `summary` instead.
//
@@ -877,15 +890,20 @@ func (r *ReasoningParam) UnmarshalJSON(data []byte) error {
// 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.
type ReasoningEffort string
const (
+ ReasoningEffortNone ReasoningEffort = "none"
ReasoningEffortMinimal ReasoningEffort = "minimal"
ReasoningEffortLow ReasoningEffort = "low"
ReasoningEffortMedium ReasoningEffort = "medium"
diff --git a/usage_test.go b/usage_test.go
index 66677873..1ce5cf6f 100644
--- a/usage_test.go
+++ b/usage_test.go
@@ -33,7 +33,7 @@ func TestUsage(t *testing.T) {
},
},
}},
- Model: shared.ChatModelGPT5,
+ Model: shared.ChatModelGPT5_1,
})
if err != nil {
t.Fatalf("err should be nil: %s", err.Error())
diff --git a/webhooks/aliases.go b/webhooks/aliases.go
index 82e5b516..b4c5c174 100644
--- a/webhooks/aliases.go
+++ b/webhooks/aliases.go
@@ -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
@@ -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